Using APIs to get Pilots
This commit is contained in:
parent
defb9834a6
commit
7434d7da6f
@ -43,16 +43,13 @@ function getKartsMenu() {
|
|||||||
url: api_url + 'karts/',
|
url: api_url + 'karts/',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (data, status) {
|
success: function (data, status) {
|
||||||
console.log(data);
|
|
||||||
$.each(data, function (index, value) {
|
$.each(data, function (index, value) {
|
||||||
console.log(index);
|
|
||||||
console.log(value.name);
|
|
||||||
$('#link_all').after("" +
|
$('#link_all').after("" +
|
||||||
" <a id=\"link_"+value.id+"\" href=\"#\" class=\"btn btn-light btn-icon-split btn-sm\">\n" +
|
" <a id=\"link_" + value.id + "\" href=\"#\" class=\"btn btn-light btn-icon-split btn-sm\">\n" +
|
||||||
" <span class=\"icon text-gray-600\">\n" +
|
" <span class=\"icon text-gray-600\">\n" +
|
||||||
" <i class=\"fas fa-car\"></i>\n" +
|
" <i class=\"fas fa-car\"></i>\n" +
|
||||||
"</span>\n" +
|
"</span>\n" +
|
||||||
" <span class=\"text\">"+value.name+"</span>" +
|
" <span class=\"text\">" + value.name + "</span>" +
|
||||||
" </a>");
|
" </a>");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -64,4 +61,75 @@ function getKartsMenu() {
|
|||||||
|
|
||||||
function getPilotsByKart() {
|
function getPilotsByKart() {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
crossDomain: true,
|
||||||
|
url: api_url + 'karts/',
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data, status) {
|
||||||
|
$.each(data, function (index, value) {
|
||||||
|
$('.container-fluid').append("" +
|
||||||
|
"<div class=\"card shadow mb-4\">\n" +
|
||||||
|
" <div class=\"card-header py-3\">\n" +
|
||||||
|
" <h6 class=\"m-0 font-weight-bold text-primary\">\n" +
|
||||||
|
" Pilot list - "+value.name+" \n" +
|
||||||
|
" <a href=\"#\" class=\"btn btn-primary btn-circle\" title='Ajouter un piote au karting "+value.name+"'>\n" +
|
||||||
|
" <i class=\"fas fa-plus\"></i>\n" +
|
||||||
|
" </a>\n" +
|
||||||
|
" </h6>\n" +
|
||||||
|
" </div>\n" +
|
||||||
|
" <div class=\"card-body\">\n" +
|
||||||
|
" <div class=\"table-responsive\">\n" +
|
||||||
|
" <table class=\"table table-bordered\" id=\"dataTable_pilots"+value.id+"\" width=\"100%\" cellspacing=\"0\">\n" +
|
||||||
|
" <thead>\n" +
|
||||||
|
" <tr>\n" +
|
||||||
|
" <th></th>\n" +
|
||||||
|
" <th>Order</th>\n" +
|
||||||
|
" <th>Short Name</th>\n" +
|
||||||
|
" <th>First Name</th>\n" +
|
||||||
|
" <th>Last Name</th>\n" +
|
||||||
|
" <th>Ref time (Sec)</th>\n" +
|
||||||
|
" </tr>\n" +
|
||||||
|
" </thead>\n" +
|
||||||
|
" <tbody>\n" +
|
||||||
|
" </tbody>\n" +
|
||||||
|
" </table>\n" +
|
||||||
|
" </div>\n" +
|
||||||
|
" </div>\n" +
|
||||||
|
" </div>" +
|
||||||
|
"");
|
||||||
|
|
||||||
|
$('#dataTable_pilots'+value.id).DataTable({
|
||||||
|
data: value.drivers,
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
data: "id",
|
||||||
|
render: function (data, type, row, meta) {
|
||||||
|
return '<a href="#" class="btn btn-primary btn-circle"><i class="fas fa-edit"></i></a> <a href="#" class="btn btn-danger btn-circle"><i class="fas fa-trash"></i>';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: "order"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: "first_name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: "first_name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: "last_name"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: "ref_time"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: function (xhr) {
|
||||||
|
alert('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText);
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
230
pilots.html
230
pilots.html
@ -13,10 +13,15 @@
|
|||||||
|
|
||||||
<!-- Custom fonts for this template-->
|
<!-- Custom fonts for this template-->
|
||||||
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
|
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
|
||||||
|
rel="stylesheet">
|
||||||
|
|
||||||
<!-- Custom styles for this template-->
|
<!-- Custom styles for this template-->
|
||||||
<link href="css/sb-admin-2.min.css" rel="stylesheet">
|
<link href="css/sb-admin-2.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Custom styles for this page -->
|
||||||
|
<link href="vendor/datatables/dataTables.bootstrap4.min.css" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body id="page-top">
|
<body id="page-top">
|
||||||
@ -185,226 +190,6 @@
|
|||||||
|
|
||||||
<!-- Begin Page Content -->
|
<!-- Begin Page Content -->
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<!-- DataTales Example -->
|
|
||||||
<div class="card shadow mb-4">
|
|
||||||
<div class="card-header py-3">
|
|
||||||
<h6 class="m-0 font-weight-bold text-primary">
|
|
||||||
Pilot list - OCK 1 -
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-plus"></i>
|
|
||||||
</a>
|
|
||||||
</h6>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-bordered" id="dataTable_ock1" width="100%" cellspacing="0">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Order</th>
|
|
||||||
<th>Short Name</th>
|
|
||||||
<th>First Name</th>
|
|
||||||
<th>Last Name</th>
|
|
||||||
<th>Ref time (Sec)</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-circle">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>1</td>
|
|
||||||
<td>BGL</td>
|
|
||||||
<td>Nicolas</td>
|
|
||||||
<td>Riault</td>
|
|
||||||
<td>59</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-circle">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>2</td>
|
|
||||||
<td>BGL</td>
|
|
||||||
<td>Nicolas</td>
|
|
||||||
<td>Riault</td>
|
|
||||||
<td>59</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-circle">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>3</td>
|
|
||||||
<td>BGL</td>
|
|
||||||
<td>Nicolas</td>
|
|
||||||
<td>Riault</td>
|
|
||||||
<td>59</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card shadow mb-4">
|
|
||||||
<div class="card-header py-3">
|
|
||||||
<h6 class="m-0 font-weight-bold text-primary">
|
|
||||||
Pilot list - OCK 2 -
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-plus"></i>
|
|
||||||
</a>
|
|
||||||
</h6>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-bordered" id="dataTable_ock2" width="100%" cellspacing="0">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Order</th>
|
|
||||||
<th>Short Name</th>
|
|
||||||
<th>First Name</th>
|
|
||||||
<th>Last Name</th>
|
|
||||||
<th>Ref time (Sec)</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-circle">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>1</td>
|
|
||||||
<td>BGL</td>
|
|
||||||
<td>Nicolas</td>
|
|
||||||
<td>Riault</td>
|
|
||||||
<td>59</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-circle">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>2</td>
|
|
||||||
<td>BGL</td>
|
|
||||||
<td>Nicolas</td>
|
|
||||||
<td>Riault</td>
|
|
||||||
<td>59</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-circle">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>3</td>
|
|
||||||
<td>BGL</td>
|
|
||||||
<td>Nicolas</td>
|
|
||||||
<td>Riault</td>
|
|
||||||
<td>59</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="card shadow mb-4">
|
|
||||||
<div class="card-header py-3">
|
|
||||||
<h6 class="m-0 font-weight-bold text-primary">
|
|
||||||
Pilot list - OCK 3 -
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-plus"></i>
|
|
||||||
</a>
|
|
||||||
</h6>
|
|
||||||
</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table table-bordered" id="dataTabl_ock3" width="100%" cellspacing="0">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Order</th>
|
|
||||||
<th>Short Name</th>
|
|
||||||
<th>First Name</th>
|
|
||||||
<th>Last Name</th>
|
|
||||||
<th>Ref time (Sec)</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-circle">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>1</td>
|
|
||||||
<td>BGL</td>
|
|
||||||
<td>Nicolas</td>
|
|
||||||
<td>Riault</td>
|
|
||||||
<td>59</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-circle">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>2</td>
|
|
||||||
<td>BGL</td>
|
|
||||||
<td>Nicolas</td>
|
|
||||||
<td>Riault</td>
|
|
||||||
<td>59</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="#" class="btn btn-primary btn-circle">
|
|
||||||
<i class="fas fa-edit"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-circle">
|
|
||||||
<i class="fas fa-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>3</td>
|
|
||||||
<td>BGL</td>
|
|
||||||
<td>Nicolas</td>
|
|
||||||
<td>Riault</td>
|
|
||||||
<td>59</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /.container-fluid -->
|
<!-- /.container-fluid -->
|
||||||
@ -442,6 +227,8 @@
|
|||||||
|
|
||||||
<!-- Custom scripts for all pages-->
|
<!-- Custom scripts for all pages-->
|
||||||
<script src="js/sb-admin-2.min.js"></script>
|
<script src="js/sb-admin-2.min.js"></script>
|
||||||
|
<script src="vendor/datatables/jquery.dataTables.min.js"></script>
|
||||||
|
<script src="vendor/datatables/dataTables.bootstrap4.min.js"></script>
|
||||||
|
|
||||||
<script src="js/timelaps.js"></script>
|
<script src="js/timelaps.js"></script>
|
||||||
|
|
||||||
@ -449,10 +236,11 @@
|
|||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
getKartsMenu();
|
getKartsMenu();
|
||||||
showKarts();
|
getPilotsByKart();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user