templates/service_request/index.html.twig line 1

Open in your IDE?
  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{ 'Service requests'|trans }}{% endblock %}
  3. {% block body %}
  4.     <h1>{{ 'Service requests'|trans }}</h1>
  5.     <table id="service-requests-table" class="table table-hover table-sm data-table" data-new_item_path="{{ path('service_request_new') }}">
  6.         <thead>
  7.             <tr>
  8.                 <th>{{ 'Customer'|trans }}</th>
  9.                 <th>{{ 'Request number'|trans }}</th>
  10.                 <th>{{ 'Date created'|trans }}</th>
  11.                 <th>{{ 'Realization date'|trans }}</th>
  12.                 <th>{{ 'New request'|trans }}?</th>
  13.                 <th>{{ 'Location'|trans }}</th>
  14.                 <th>{{ 'Indefinite contract'|trans }}</th>
  15.                 <th>{{ 'Contract duration'|trans }}</th>
  16.                 <th>{{ 'Locked'|trans }}</th>
  17.                 <th>{{ 'actions'|trans }}</th>
  18.             </tr>
  19.         </thead>
  20.         <tbody>
  21.             {% for service_request in service_requests %}
  22.                 {% set customer = service_request.customer %}
  23.                 <tr>
  24.                     <td>
  25.                         {% if customer.name %}
  26.                             {{ customer.name }} ({{ customer.contactFirstName }} {{ customer.contactLastName }})
  27.                         {% else %}
  28.                             {{ customer.contactFirstName }} {{ customer.contactLastName }}
  29.                         {% endif %}
  30.                     </td>
  31.                     <td>{{ service_request.requestNumber }}</td>
  32.                     <td>{{ service_request.dateCreated|date('d.m.Y') }}</td>
  33.                     <td>{{ service_request.realizationDate|date('d.m.Y') }}</td>
  34.                     <td>{{ service_request.isNewRequest|str_bool }}</td>
  35.                     <td>{{ service_request.locationName }}</td>
  36.                     <td>{{ service_request.contractIndefinite|str_bool }}</td>
  37.                     <td>{{ service_request.contractDuration }}</td>
  38.                     <td>{{ service_request.locked|str_bool }}</td>
  39.                     <td>
  40.                         <a href="{{ path('service_request_lock', {'id': service_request.id}) }}" title="{{ 'Lock'|trans }}/{{ 'Unlock'|trans }}">{{ service_request.locked ? '🔓' : '🔒' }}</a>
  41.                         <a href="{{ path('service_request_show', {'id': service_request.id}) }}" title="{{ 'View'|trans }}">📋</a>
  42.                         <a href="{{ path('service_request_show', {'id': service_request.id, format: 'print'}) }}" target="_blank" title="{{ 'Print'|trans }}">🖨</a>
  43.                         <a href="{{ path('service_request_edit', {'id': service_request.id}) }}" title="{{ 'Edit'|trans }}">🖊️</a>
  44.                     </td>
  45.                 </tr>
  46.             {% else %}
  47.                 <tr>
  48.                     <td colspan="12" class="text-center">{{ 'no records found'|trans }}</td>
  49.                 </tr>
  50.             {% endfor %}
  51.         </tbody>
  52.     </table>
  53. {% endblock %}
  54. {% block javascripts %}
  55.     <script>
  56.         $(function () {
  57.             $('#service-requests-table').DataTable({
  58.                 dom: 'B<"row mt-3"<"col-6"l><"col-6"f>>rtip',
  59.                 buttons: ['new'],
  60.             });
  61.         });
  62.     </script>
  63. {% endblock %}