diff --git a/locales/en.yml b/locales/en.yml index c6cb27c..2bc8531 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -11,6 +11,7 @@ common: search: Search reset: Reset show: Show + no_result: No results close: Close confirmation: Confirmation are_you_sure: Are you sure? diff --git a/locales/fr.yml b/locales/fr.yml index b3f6b34..4411bcc 100644 --- a/locales/fr.yml +++ b/locales/fr.yml @@ -11,6 +11,7 @@ common: search: Filtrer reset: Réini. show: Voir + no_result: Aucun résultat close: Fermer confirmation: Confirmation are_you_sure: Êtes-vous sûr ? diff --git a/src/routes/user.rs b/src/routes/user.rs index 3c81570..e4458eb 100644 --- a/src/routes/user.rs +++ b/src/routes/user.rs @@ -25,7 +25,7 @@ use crate::{ #[derive(Template, WebTemplate)] #[template(path = "users/index.html")] struct UsersIndexTemplate { - user_with_books_number: Vec, + users_with_books_number: Vec, query: IndexQuery, } @@ -84,7 +84,7 @@ pub async fn index( } Ok(UsersIndexTemplate { - user_with_books_number: result, + users_with_books_number: result, query, }) } diff --git a/templates/index.html b/templates/index.html index 82b28b9..4dc9640 100644 --- a/templates/index.html +++ b/templates/index.html @@ -90,62 +90,73 @@ {% endcall %} {% call cards::card() %} - - - - - - - - - - - - - {% for book_user in books_with_user %} - - - - - - - - - {% endfor %} - -
#{{ t!("book.attributes.title") }}{{ t!("book.attributes.authors") }}{{ t!("book.attributes.owner") }}{{ t!("book.attributes.current_holder") }}{{ t!("common.actions") }}
{{ book_user.book.id }}{{ book_user.book.title }}{{ book_user.book.authors }}{{ book_user.owner.name }} - {% match book_user.current_holder %} - {% when Some with (current_holder) %} - {{ current_holder.name }} - {% when None %} - - - {% endmatch %} - - {{ dropdown::crud_dropdown_button(book_user.book, t!("common.actions"), "books") }} -
+ {% if books_with_user.is_empty() %} +
+

{{ t!("common.no_result") }}

- {% if total_page > 1 %} -
- + + {{ t!("book.new.button_short") }} +
+ {% else %} + + + + + + + + + + + + + {% for book_user in books_with_user %} + + + + + + + + + {% endfor %} + +
#{{ t!("book.attributes.title") }}{{ t!("book.attributes.authors") }}{{ t!("book.attributes.owner") }}{{ t!("book.attributes.current_holder") }}{{ t!("common.actions") }}
{{ book_user.book.id }}{{ book_user.book.title }}{{ book_user.book.authors }}{{ book_user.owner.name }} + {% match book_user.current_holder %} + {% when Some with (current_holder) %} + {{ current_holder.name }} + {% when None %} + - + {% endmatch %} + + {{ dropdown::crud_dropdown_button(book_user.book, t!("common.actions"), "books") }} +
+ + {% if total_page > 1 %} +
+ +
+ {% endif %} + {% endif %} {% endcall %} {% endblock %} diff --git a/templates/users/index.html b/templates/users/index.html index e235dae..6ee5e3d 100644 --- a/templates/users/index.html +++ b/templates/users/index.html @@ -34,29 +34,39 @@ {% endcall %} {% call cards::card() %} - - - - - - - - - - - - {% for user_information in user_with_books_number %} - - - - - - + {% if users_with_books_number.is_empty() %} +
+

{{ t!("common.no_result") }}

+ + + {{ t!("user.index.button") }} + +
+ {% else %} +
#{{ t!("user.attributes.name") }}{{ t!("user.attributes.owner_books") }}{{ t!("user.attributes.borrowed_books") }}{{ t!("common.actions") }}
{{ user_information.user.id }}{{ user_information.user.name }}{{ user_information.owner_book_number }}{{ user_information.borrowed_book_number }} - {{ dropdown::crud_dropdown_button(user_information.user, t!("common.actions"), "users", show = false) }} -
+ + + + + + + - {% endfor %} - -
#{{ t!("user.attributes.name") }}{{ t!("user.attributes.owner_books") }}{{ t!("user.attributes.borrowed_books") }}{{ t!("common.actions") }}
+ + + {% for user_information in users_with_books_number %} + + {{ user_information.user.id }} + {{ user_information.user.name }} + {{ user_information.owner_book_number }} + {{ user_information.borrowed_book_number }} + + {{ dropdown::crud_dropdown_button(user_information.user, t!("common.actions"), "users", show = false) }} + + + {% endfor %} + + + {% endif %} {% endcall %} {% endblock %}