{% extends 'base.html.twig' %}
{% block title %}User index
{% endblock %}
{% block breadcrumb %}
<li class="breadcrumb-item">
<a href="{{path('user_index')}}">{% trans %}
User
{% endtrans %}</a>
</li>
<li class="breadcrumb-item active">{% trans %}
List
{% endtrans %}</li>
{% endblock %}
{% block pagetitle %}
{% trans %}
User{% endtrans %}
{% endblock %}
{% block body %}
{% if is_granted("user_create") %}
<a href="{{ path('user_new') }}" class="btn btn-sm btn-success">
<span class="fa fa-plus"></span>
{% trans %}Create new{% endtrans %}</a>
{% endif %}
<br>
<div class="card card-info mt-3 ">
<div class="card-header">
<h5>{% trans %}
Users List
{% endtrans %}</h5>
</div>
<div class="card-body">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>{{ knp_pagination_sortable(users, 'Name'|trans, 'u.full_name') }}</th>
<th>{{ knp_pagination_sortable(users, 'Email'|trans, 'u.email') }}</th>
<th>{{ knp_pagination_sortable(users, 'Unit'|trans, 'u.unit') }}</th>
<th>{{ knp_pagination_sortable(users, 'Position'|trans, 'u.position') }}</th>
<th>{{ knp_pagination_sortable(users, 'Active'|trans, 'u.isActive') }}</th>
<th>{% trans %}Actions{% endtrans %}</th>
</tr>
</thead>
<tbody>
{% set i = 1 %}
{% for user in users %}
<tr>
<td>{{ i }}
{% set i = i+1 %}
</td>
<td>{{ user.fullName }}</td>
<td>{{ user.email }}</td>
<td>{{ user.unit.name }}</td>
<td>{{ user.position }}</td>
<td>{{ user.isActive ? 'Yes' : 'No' }}</td>
<td>
{% if is_granted("user_show") %}
<a href="{{ path('user_show', {'id': user.id}) }}" class="btn btn-xs btn-primary"><span class="fa fa-eye"></span>{% trans %}Show{% endtrans %}</a>
{% endif %}
{% if is_granted("user_edit") %}
<a href="{{ path('user_edit', {'id': user.id}) }}" class="btn btn-xs btn-warning text-white"><span class="fa fa-pen"></span>
{% trans %}Edit{% endtrans %}
</a>
{% endif %}
{% if is_granted("user_delete") %}
{{ include('user_management/users/_delete_form.html.twig') }}
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="7">{% trans %}no records found{% endtrans %}</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="navigation">{{ knp_pagination_render(users) }}</div>
</div>
</div>
{% endblock %}