{# Pagination Macro ================ A reusable pagination component for tables and lists. Usage: {% from 'shared/macros/pagination.html' import pagination %} {{ pagination() }} Required Alpine.js data properties: - pagination.page: Current page number - pagination.total: Total number of items - startIndex: First item index on current page - endIndex: Last item index on current page - totalPages: Total number of pages - pageNumbers: Array of page numbers with '...' for ellipsis Required Alpine.js methods: - previousPage(): Go to previous page - nextPage(): Go to next page - goToPage(pageNum): Go to specific page #} {% macro pagination(show_condition="true") %}
{# Results Info #} Showing - of {# Pagination Controls #}
{% endmacro %} {# Simple Pagination Macro (Prev/Next only) ======================================== A simpler pagination with just previous/next buttons. Usage: {% from 'shared/macros/pagination.html' import pagination_simple %} {{ 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") %}
Showing - of results
Page of
{% endmacro %}