2026-01-31 18:21:28 +01:00

77 lines
2.8 KiB
HTML

{% extends "base.html" %}
{% import "components/typography.html" as typography %}
{% import "components/dropdown.html" as dropdown %}
{% import "components/cards.html" as cards %}
{% import "components/inputs.html" as form_helpers %}
{% block title %}
{{ t!("user.index.title_tag") }}
{% endblock %}
{% block main %}
{% call typography::heading(t!("user.index.title")) %}
<a class="btn-success btn" href="{{ router.new_user_path() }}">{{ t!("user.index.button") }}</a>
{% endcall %}
{% call cards::card() %}
<form method="get">
<div class="row">
<div class="col-md-3">
<label for="name" class="form-label">{{ t!("user.attributes.name") }}</label>
{% match query.name %}
{% when Some with (value) %}
<input type="text" name="name" value="{{ value }}" class="form-control" placeholder="Ex: Koprotkine">
{% when None %}
<input type="text" name="name" class="form-control" placeholder="Ex: Koprotkine">
{% endmatch %}
</div>
<div class="col-md-1 d-flex align-items-end">
<input type="submit" value='{{ t!("common.search") }}' class="btn btn-info w-100">
</div>
<div class="col-md-1 d-flex align-items-end">
<a href="/users" class="btn btn-light">{{ t!("common.reset") }}</a>
</div>
</div>
</form>
{% endcall %}
{% call cards::card() %}
{% if users_with_books_number.is_empty() %}
<div class="d-flex flex-column align-items-center justify-content-center">
<h2>{{ t!("common.no_result") }}</h2>
<a class="btn btn-success text-white text-nowrap mt-3" href="{{ router.new_user_path() }}">
{{ t!("user.index.button") }}
</a>
</div>
{% else %}
<table class="table table-hover">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">{{ t!("user.attributes.name") }}</th>
<th scope="col">{{ t!("user.attributes.owner_books") }}</th>
<th scope="col">{{ t!("user.attributes.borrowed_books") }}</th>
<th scope="col">{{ t!("common.actions") }}</th>
</tr>
</thead>
<tbody>
{% for user_information in users_with_books_number %}
<tr class="align-middle">
<th scope="row">{{ user_information.user.id }}</th>
<td>{{ user_information.user.name }}</td>
<td>{{ user_information.owner_book_number }}</td>
<td>{{ user_information.borrowed_book_number }}</td>
<td>
{{ dropdown::crud_dropdown_button(user_information.user, t!("common.actions"), "users", show = false) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endcall %}
{% endblock %}