templates/vehicule/index.html.twig line 1

Open in your IDE?
  1. {% extends "Global/layout.html.twig" %}
  2. {% block title %}Parking{% endblock %}
  3. {% set pageTitle ='Parking'%}
  4. {% block navigation %}
  5.     {% set navigation = [{'current': pageTitle}] %}
  6.     {% include 'Global/navigation.html.twig' with {navigation: navigation} %}
  7. {% endblock %}
  8. {% block content %}
  9.     <section class="card mb-3">
  10.         <header class="card-header">
  11.             <div class="card-actions">
  12.                 <a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
  13.                 <a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
  14.             </div>              
  15.             <div class="card-body">
  16.                 <table class="table table-striped" id="vehicule">
  17.                     <thead>
  18.                         <tr>
  19.                             <th>Adherent</th>
  20.                             <th>Immatriculation</th>
  21.                             <th>Marque</th>
  22.                             <th>Modele</th>
  23.                             <th>Couleur</th>
  24.                             <th>Parking</th>
  25.                             <th>Mois début</th>
  26.                             <th>Mois fin</th>
  27.                             <th>Action</th>
  28.                         </tr>
  29.                     </thead>
  30.                     <tbody>
  31.                         {% for vehicule in vehicules %}
  32.                               {% if  (vehicule.moisFin!=1) %}
  33.                             <tr>
  34.                                 <td>{{ vehicule.adherent.nomPrenom }}</td>
  35.                                 <td>{{ vehicule.immatriculation }}</td>
  36.                                 <td>{{ vehicule.marque }}</td>
  37.                                 <td>{{ vehicule.modele }}</td>
  38.                                 <td>{{ vehicule.couleur }}</td>
  39.                                 {% if  (vehicule.parking) %}
  40.                                     <td>{{ vehicule.parking.nom }}</td>
  41.                                 {% else %}
  42.                                     <td>-</td>
  43.                                 {% endif %}
  44.                                 <td>{{ vehicule.moisDebut }}</td>
  45.                                
  46.                                 <td>{{ vehicule.moisFin }}</td>
  47.                                 <td><a class="btn btn-primary" href="{{ path('app_vehicule_edit', {'id': vehicule.id}) }}">Modifier</a></td>
  48.                             </tr>
  49.                             {% endif %}
  50.                         {% endfor %}
  51.                     </tbody>
  52.                     <tfoot>
  53.                            <tr>
  54.                             <th>Adherent</th>
  55.                             <th>Immatriculation</th>
  56.                             <th>Marque</th>
  57.                             <th>Modele</th>
  58.                             <th>Couleur</th>
  59.                             <th>Parking</th>
  60.                             <th>Mois début</th>
  61.                             <th>Mois fin</th>
  62.                             <th>Action</th>
  63.                         </tr>
  64.                     </tfoot>
  65.                 </table>
  66.             </div>
  67.     </section>    
  68. {% endblock %}
  69. {% block script %}
  70.     <script>
  71.         $(document).ready(function () {
  72.             $("#vehicule").DataTable({
  73.                 language: {
  74.                     url: '//cdn.datatables.net/plug-ins/1.13.7/i18n/fr-FR.json',
  75.                 },
  76.                 lengthMenu: [
  77.                     [10, 15, 25, 50, -1],
  78.                 ],
  79.                 dom: 'Bfrtip',
  80.                 buttons: [
  81.                     {
  82.                         extend: 'pdf',
  83.                         exportOptions: {
  84.                             columns: [0, 1, 2, 3, 4, 5]
  85.                         }
  86.                     },
  87.                     {
  88.                         extend: 'print',
  89.                         exportOptions: {
  90.                             columns: [0, 1]
  91.                         }
  92.                     },
  93.                     'copy', 'csv', 'excel'
  94.                 ],
  95.                 scrollX: true,
  96.                 initComplete: function () {
  97.                     this.api()
  98.                             .columns()
  99.                             .every(function () {
  100.                                 let column = this;
  101.                                 let title = column.footer().textContent;
  102.                                 // Create input element
  103.                                 let input = document.createElement('input');
  104.                                 input.placeholder = title;
  105.                                 column.footer().replaceChildren(input);
  106.                                 // Event listener for user input
  107.                                 input.addEventListener('keyup', () => {
  108.                                     if (column.search() !== this.value) {
  109.                                         column.search(input.value).draw();
  110.                                     }
  111.                                 });
  112.                             });
  113.                 }
  114.             });
  115.         });
  116.     </script>
  117. {% endblock %}