Add edit and new for users

This commit is contained in:
gabatxo1312 2026-01-29 23:52:55 +01:00
commit cf9a7cf33f
No known key found for this signature in database
12 changed files with 229 additions and 88 deletions

View file

@ -33,7 +33,7 @@
<div class="col-md-2">
<label for="owner_id" class="form-label">Owner</label>
<select name="owner_id" class="form-control">
<select name="owner_id" class="form-select">
<option></option>
{% match query.owner_id %}
{% when Some with (owner_id) %}
@ -55,7 +55,7 @@
<div class="col-md-2">
<label for="current_holder_id" class="form-label">Current Holder</label>
<select name="current_holder_id" class="form-control">
<select name="current_holder_id" class="form-select">
<option></option>
{% match query.current_holder_id %}
{% when Some with (current_holder_id) %}
@ -75,7 +75,11 @@
</div>
<div class="col-md-1 d-flex align-items-end">
<input type="submit" value="Search" class="btn btn-info btn">
<input type="submit" value="Search" class="btn btn-info w-100">
</div>
<div class="col-md-1 d-flex align-items-end">
<a href="/" class="btn btn-light">Reset</a>
</div>
</div>
</form>
@ -95,7 +99,7 @@
</thead>
<tbody>
{% for book_user in books_with_user %}
<tr>
<tr class="align-middle">
<th scope="row">{{ book_user.book.id }}</th>
<td>{{ book_user.book.title }}</td>
<td>{{ book_user.book.authors }}</td>
@ -109,7 +113,7 @@
{% endmatch %}
</td>
<td>
{{ dropdown::book_dropdown_button(book_user.book) }}
{{ dropdown::crud_dropdown_button(book_user.book, "Actions", "books") }}
</td>
</tr>
{% endfor %}
@ -117,25 +121,27 @@
</table>
{% if total_page > 1 %}
<nav aria-label="Page navigation">
<ul class="pagination">
<li class="page-item {% if current_page <= 1 %}disabled{% endif %}">
<a class="page-link" href="/?{{ base_query }}page={% if current_page > 1 %}{{ current_page - 1 }}{% else %}1{% endif %}">Prev</a>
</li>
<div class="d-flex justify-content-center mt-1">
<nav aria-label="Page navigation">
<ul class="pagination">
<li class="page-item {% if current_page <= 1 %}disabled{% endif %}">
<a class="page-link" href="/?{{ base_query }}page={% if current_page > 1 %}{{ current_page - 1 }}{% else %}1{% endif %}">Prev</a>
</li>
{% for page in 1..(total_page + 1) %}
{% if page >= current_page - 1 && page <= current_page + 1 %}
<li class="page-item {% if page == current_page %}active{% endif %}">
<a class="page-link" href="/?{{ base_query }}page={{ page }}">{{ page }}</a>
</li>
{% endif %}
{% endfor %}
{% for page in 1..(total_page + 1) %}
{% if page >= current_page - 1 && page <= current_page + 1 %}
<li class="page-item {% if page == current_page %}active{% endif %}">
<a class="page-link" href="/?{{ base_query }}page={{ page }}">{{ page }}</a>
</li>
{% endif %}
{% endfor %}
<li class="page-item {% if current_page == total_page %}disabled{% endif %}">
<a class="page-link" href="/?{{ base_query }}page={{ current_page + 1 }}">Next</a>
</li>
</ul>
</nav>
<li class="page-item {% if current_page == total_page %}disabled{% endif %}">
<a class="page-link" href="/?{{ base_query }}page={{ current_page + 1 }}">Next</a>
</li>
</ul>
</nav>
</div>
{% endif %}
{% endcall %}
{% endblock %}