{% extends "Global/layout.html.twig" %}
{% block title %}Parking{% endblock %}
{% set pageTitle ='Parking'%}
{% block navigation %}
{% set navigation = [{'current': pageTitle}] %}
{% include 'Global/navigation.html.twig' with {navigation: navigation} %}
{% endblock %}
{% block content %}
<section class="card mb-3">
<header class="card-header">
<div class="card-actions">
<a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
<a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
</div>
<div class="card-body">
<table class="table table-striped" id="vehicule">
<thead>
<tr>
<th>Adherent</th>
<th>Immatriculation</th>
<th>Marque</th>
<th>Modele</th>
<th>Couleur</th>
<th>Parking</th>
<th>Mois début</th>
<th>Mois fin</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for vehicule in vehicules %}
{% if (vehicule.moisFin!=1) %}
<tr>
<td>{{ vehicule.adherent.nomPrenom }}</td>
<td>{{ vehicule.immatriculation }}</td>
<td>{{ vehicule.marque }}</td>
<td>{{ vehicule.modele }}</td>
<td>{{ vehicule.couleur }}</td>
{% if (vehicule.parking) %}
<td>{{ vehicule.parking.nom }}</td>
{% else %}
<td>-</td>
{% endif %}
<td>{{ vehicule.moisDebut }}</td>
<td>{{ vehicule.moisFin }}</td>
<td><a class="btn btn-primary" href="{{ path('app_vehicule_edit', {'id': vehicule.id}) }}">Modifier</a></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Adherent</th>
<th>Immatriculation</th>
<th>Marque</th>
<th>Modele</th>
<th>Couleur</th>
<th>Parking</th>
<th>Mois début</th>
<th>Mois fin</th>
<th>Action</th>
</tr>
</tfoot>
</table>
</div>
</section>
{% endblock %}
{% block script %}
<script>
$(document).ready(function () {
$("#vehicule").DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.13.7/i18n/fr-FR.json',
},
lengthMenu: [
[10, 15, 25, 50, -1],
],
dom: 'Bfrtip',
buttons: [
{
extend: 'pdf',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5]
}
},
{
extend: 'print',
exportOptions: {
columns: [0, 1]
}
},
'copy', 'csv', 'excel'
],
scrollX: true,
initComplete: function () {
this.api()
.columns()
.every(function () {
let column = this;
let title = column.footer().textContent;
// Create input element
let input = document.createElement('input');
input.placeholder = title;
column.footer().replaceChildren(input);
// Event listener for user input
input.addEventListener('keyup', () => {
if (column.search() !== this.value) {
column.search(input.value).draw();
}
});
});
}
});
});
</script>
{% endblock %}