diff --git a/app/templates/admin/customers.html b/app/templates/admin/customers.html index fb2d5bbc..55da8ff0 100644 --- a/app/templates/admin/customers.html +++ b/app/templates/admin/customers.html @@ -3,6 +3,7 @@ {% from 'shared/macros/headers.html' import page_header %} {% from 'shared/macros/alerts.html' import loading_state, error_state %} {% from 'shared/macros/tables.html' import table_wrapper, table_header %} +{% from 'shared/macros/pagination.html' import pagination_full %} {% block title %}Customers{% endblock %} @@ -235,55 +236,7 @@ -
- - Showing - of customers - -
- - - - - -
-
+ {{ pagination_full(load_fn="loadCustomers()", item_label="customers") }} {% endblock %} diff --git a/app/templates/shared/macros/pagination.html b/app/templates/shared/macros/pagination.html index 2a44ae4d..4b415ca7 100644 --- a/app/templates/shared/macros/pagination.html +++ b/app/templates/shared/macros/pagination.html @@ -93,6 +93,86 @@ {{ pagination_simple() }} #} +{# + Pagination Full Macro (First/Prev/Numbers/Next/Last) + ===================================================== + A full pagination component with first, previous, page numbers, next, and last buttons. + + Usage: + {% from 'shared/macros/pagination.html' import pagination_full %} + {{ pagination_full() }} + + Required Alpine.js data properties: + - page: Current page number + - total: Total number of items + - limit: Items per page + - skip: Current skip value (page - 1) * limit + - totalPages: Computed total pages (Math.ceil(total / limit)) + + Required Alpine.js methods: + - getPageNumbers(): Returns array of page numbers to display + - goToPage(pageNum): Go to specific page + - loadData(): Function to reload data (called internally as loadFn parameter) +#} + +{% macro pagination_full(show_condition="total > limit", load_fn="loadData()", item_label="items") %} +
+ + Showing - of {{ item_label }} + +
+ {# First Page #} + + {# Previous Page #} + + {# Page Numbers #} + + {# Next Page #} + + {# Last Page #} + +
+
+{% endmacro %} + + {% macro pagination_simple(show_condition="true") %}