2018-10-08 22:31:58 +02:00

61 lines
1.9 KiB
PHP
Executable File

@extends('layouts.loggedform')
@section('card')
@component('components.card')
@slot('title')
@lang('Liste des kartings - ') <a href="{{route("kart.create")}}"><i class="far fa-plus-square"></i></a>
@endslot
<table class="table table-bordered" id="pilots-table">
<thead>
<tr>
<th></th>
<th>Nom du karting</th>
</tr>
</thead>
</table>
<script type="text/javascript">
var tableKarts = '';
window.deletePilot = function (id) {
$.ajax({
url: '/kart/'+id,
type: 'DELETE', // user.destroy
success: function(result) {
console.log('OK');
}
});
}
window.reloadData = function (id, name) {
document.cookie = "active_kartid=" + id;
document.cookie = "active_kartname=" + name;
if (name != null)
$('#btnChoiceKartTitle').html(name);
}
$(() => {
tableKarts = $('#pilots-table').DataTable({
processing: true,
ajax: '/getkartsalldata',
columns: [
{
data: 'id',
searchable: false,
render:
function (data, type, row, meta) {
return '<a onclick="deleteKart(' + data + ');tableKarts.row( $(this).parents(\'tr\') ).remove().draw();"><i class="far fa-trash-alt"></i></a>';
}
},
{data: 'name'}
]
});
})
</script>
@endcomponent
@endsection