{% extends 'base.html.twig' %}
{% block title %}{{ 'Service requests'|trans }}{% endblock %}
{% block body %}
<h1>{{ 'Service requests'|trans }}</h1>
<table id="service-requests-table" class="table table-hover table-sm data-table" data-new_item_path="{{ path('service_request_new') }}">
<thead>
<tr>
<th>{{ 'Customer'|trans }}</th>
<th>{{ 'Request number'|trans }}</th>
<th>{{ 'Date created'|trans }}</th>
<th>{{ 'Realization date'|trans }}</th>
<th>{{ 'New request'|trans }}?</th>
<th>{{ 'Location'|trans }}</th>
<th>{{ 'Indefinite contract'|trans }}</th>
<th>{{ 'Contract duration'|trans }}</th>
<th>{{ 'Locked'|trans }}</th>
<th>{{ 'actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for service_request in service_requests %}
{% set customer = service_request.customer %}
<tr>
<td>
{% if customer.name %}
{{ customer.name }} ({{ customer.contactFirstName }} {{ customer.contactLastName }})
{% else %}
{{ customer.contactFirstName }} {{ customer.contactLastName }}
{% endif %}
</td>
<td>{{ service_request.requestNumber }}</td>
<td>{{ service_request.dateCreated|date('d.m.Y') }}</td>
<td>{{ service_request.realizationDate|date('d.m.Y') }}</td>
<td>{{ service_request.isNewRequest|str_bool }}</td>
<td>{{ service_request.locationName }}</td>
<td>{{ service_request.contractIndefinite|str_bool }}</td>
<td>{{ service_request.contractDuration }}</td>
<td>{{ service_request.locked|str_bool }}</td>
<td>
<a href="{{ path('service_request_lock', {'id': service_request.id}) }}" title="{{ 'Lock'|trans }}/{{ 'Unlock'|trans }}">{{ service_request.locked ? '🔓' : '🔒' }}</a>
<a href="{{ path('service_request_show', {'id': service_request.id}) }}" title="{{ 'View'|trans }}">📋</a>
<a href="{{ path('service_request_show', {'id': service_request.id, format: 'print'}) }}" target="_blank" title="{{ 'Print'|trans }}">🖨</a>
<a href="{{ path('service_request_edit', {'id': service_request.id}) }}" title="{{ 'Edit'|trans }}">🖊️</a>
</td>
</tr>
{% else %}
<tr>
<td colspan="12" class="text-center">{{ 'no records found'|trans }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% block javascripts %}
<script>
$(function () {
$('#service-requests-table').DataTable({
dom: 'B<"row mt-3"<"col-6"l><"col-6"f>>rtip',
buttons: ['new'],
});
});
</script>
{% endblock %}