bookforge/templates/users/index.html

72 lines
2.7 KiB
HTML
Raw Normal View History

2026-01-23 13:56:30 +01:00
{% extends "base.html" %}
{% import "components/typography.html" as typography %}
2026-01-29 23:52:55 +01:00
{% import "components/dropdown.html" as dropdown %}
2026-01-28 00:38:24 +01:00
{% import "components/cards.html" as cards %}
2026-01-29 23:52:55 +01:00
{% import "components/inputs.html" as form_helpers %}
2026-01-23 13:56:30 +01:00
{% block main %}
2026-01-30 18:23:54 +01:00
{% call typography::heading(t!("user.index.title")) %}
<a class="btn-success btn" href="/users/new">{{ t!("user.index.button") }}</a>
2026-01-29 23:52:55 +01:00
{% endcall %}
2026-01-23 13:56:30 +01:00
2026-01-30 14:24:00 +01:00
{% call cards::card() %}
<form method="get">
<div class="row">
<div class="col-md-3">
2026-01-30 18:23:54 +01:00
<label for="name" class="form-label">{{ t!("user.attributes.name") }}</label>
2026-01-30 14:24:00 +01:00
{% 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">
2026-01-30 18:23:54 +01:00
<input type="submit" value='{{ t!("common.search") }}' class="btn btn-info w-100">
2026-01-30 14:24:00 +01:00
</div>
<div class="col-md-1 d-flex align-items-end">
2026-01-30 18:23:54 +01:00
<a href="/users" class="btn btn-light">{{ t!("common.reset") }}</a>
2026-01-30 14:24:00 +01:00
</div>
</div>
</form>
{% endcall %}
2026-01-28 00:38:24 +01:00
{% call cards::card() %}
2026-01-30 18:40:49 +01:00
{% 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="//new">
{{ 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>
2026-01-28 00:38:24 +01:00
</tr>
2026-01-30 18:40:49 +01:00
</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 %}
2026-01-28 00:38:24 +01:00
{% endcall %}
{% endblock %}