94 lines
3.2 KiB
PHP
Executable File
94 lines
3.2 KiB
PHP
Executable File
@extends('layouts.loggedform')
|
|
@section('card')
|
|
@component('components.card')
|
|
@slot('title')
|
|
@lang('Liste des pilotes - ') <a href="{{route("pilot.create")}}"><i class="far fa-plus-square"></i></a>
|
|
@endslot
|
|
|
|
<table class="table table-bordered" id="pilots-table">
|
|
<thead>
|
|
<tr>
|
|
<th></th>
|
|
<th>kart_name</th>
|
|
<th>Name</th>
|
|
<th>first_name</th>
|
|
<th>ref_time</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
<script type="text/javascript">
|
|
var tablePilots = '';
|
|
|
|
|
|
window.deletePilot = function (id) {
|
|
$.ajax({
|
|
url: '/pilot/' + 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);
|
|
|
|
|
|
$.ajax({
|
|
url: '/getpilotsBykart',
|
|
data: {id: id},
|
|
success: function (data) {
|
|
|
|
$("#kartid").val(id);
|
|
if (tablePilots != '')
|
|
tablePilots.destroy();
|
|
tablePilots = $('#pilots-table').DataTable({
|
|
data: data.data,
|
|
columns: [
|
|
{
|
|
data: 'id',
|
|
render:
|
|
function (data, type, row, meta) {
|
|
return '<a onclick="deletePilot(' + data + ');tablePilots.row( $(this).parents(\'tr\') ).remove().draw();"><i class="far fa-trash-alt"></i></a>';
|
|
}
|
|
},
|
|
{
|
|
data: 'kart_name'
|
|
}
|
|
,
|
|
{
|
|
data: 'name'
|
|
}
|
|
,
|
|
{
|
|
data: 'first_name'
|
|
}
|
|
,
|
|
{
|
|
data: 'ref_time',
|
|
render:
|
|
function (data, type, row, meta) {
|
|
return moment.utc(data*1000).format('mm:ss');
|
|
}
|
|
|
|
}
|
|
]
|
|
})
|
|
;
|
|
}
|
|
});
|
|
}
|
|
|
|
$(() => {
|
|
reloadData(getCookie('active_kartid'), getCookie('active_kartname'));
|
|
})
|
|
</script>
|
|
@endcomponent
|
|
@endsection
|