Skip to content

refactor: restore traditional pagination - #1661

Open
labmecanicatec wants to merge 3 commits into
LibreBooking:developfrom
labmecanicatec:feat/traditional-pagination
Open

refactor: restore traditional pagination#1661
labmecanicatec wants to merge 3 commits into
LibreBooking:developfrom
labmecanicatec:feat/traditional-pagination

Conversation

@labmecanicatec

@labmecanicatec labmecanicatec commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator
  • Re-enable pageable->GetPageSize() call
  • Replace null parameters with actual page number and size
  • Use page->GetPageNumber() and page->GetPageSize() for pagination
  • Improves performance by limiting results per request
  • Restore CreatePagination and CreatePageLink methods
  • Enable page navigation with prev/next buttons
  • Display results range and total count
  • Add data attributes for pagination handling
  • Replace view all behavior with paginated browsing

Close: #1612
Assisted-by: Claude:claude-haiku-4.5

- Re-enable pageable->GetPageSize() call
- Replace null parameters with actual page number and size
- Use page->GetPageNumber() and page->GetPageSize() for pagination
- Improves performance by limiting results per request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores traditional, server-driven pagination across multiple admin and credits log screens by re-enabling page size usage from IPageable/PageInfo and adding a new Smarty {pagination} helper to render page navigation links.

Changes:

  • Re-enable and consistently pass GetPageNumber() / GetPageSize() into list-loading services/repositories to avoid accidental “pageSize=1” limiting when null is coerced.
  • Add a Smarty {pagination pageInfo=$PageInfo} function and wire it into several templates to display page navigation and result counts.
  • Adjust frontend pagination click handling to target the new pagination link markup.

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Web/scripts/ajax-helpers.js Updates AJAX pagination click selector for the new pagination link markup.
tpl/Credits/transaction_log.tpl Adds {pagination} to the user transaction log partial and normalizes {datatable} call syntax.
tpl/Credits/credit_log.tpl Adds {pagination} to the user credit log partial and normalizes {datatable} call syntax.
tpl/Admin/Users/manage_users.tpl Adds {pagination} below the users table.
tpl/Admin/Users/credit_log.tpl Adds {pagination} and minor include formatting cleanup.
tpl/Admin/Schedules/view_schedules.tpl Adds {pagination} below the schedules table.
tpl/Admin/Schedules/manage_schedules.tpl Adds {pagination} and swaps datatablefilter to datatable for the schedules table initialization.
tpl/Admin/Resources/manage_resources.tpl Adds {pagination} below the resources table.
tpl/Admin/Reservations/manage_reservations.tpl Adds {pagination} below the reservations table.
tpl/Admin/Payments/transaction_log.tpl Adds {pagination} to the admin payments transaction log partial and normalizes {datatable} call syntax.
tpl/Admin/Groups/manage_groups.tpl Adds {pagination} below the groups table.
tpl/Admin/Blackouts/manage_blackouts.tpl Adds {pagination} below the blackouts table.
Presenters/ViewSchedulesPresenter.php Passes page number + page size to schedules list retrieval.
Presenters/Admin/ManageUsersPresenter.php Passes page size to user repository list retrieval; minor formatting cleanups.
Presenters/Admin/ManageSchedulesPresenter.php Passes page size to schedules list retrieval.
Presenters/Admin/ManageResourcesPresenter.php Passes page size to resources repository list retrieval.
Presenters/Admin/ManageReservationsPresenter.php Passes page size to reservations filtered load; minor formatting cleanups.
Presenters/Admin/ManageGroupsPresenter.php Passes page size to groups repository list retrieval.
Presenters/Admin/ManageBlackoutsPresenter.php Passes page size to blackouts filtered load.
Pages/Admin/ManageUsersPage.php Restores GetPageSize() by delegating to the wrapped pageable implementation.
Pages/Admin/ManageSchedulesPage.php Restores GetPageSize() (with existing cap logic) to support server pagination again.
Pages/Admin/ManageResourcesPage.php Restores GetPageSize() (with existing cap logic) to support server pagination again.
Pages/Admin/ManageReservationsPage.php Restores GetPageSize() by delegating to the wrapped pageable implementation.
Pages/Admin/ManageGroupsPage.php Restores GetPageSize() by delegating to the wrapped pageable implementation.
Pages/Admin/ManageBlackoutsPage.php Restores GetPageSize() by delegating to the wrapped pageable implementation.
lib/Common/SmartyPage.php Registers {pagination} and implements CreatePagination/CreatePageLink; adjusts DataTables initialization.
Suppressed comments (2)

Web/scripts/ajax-helpers.js:277

  • ajaxPagination reads data attributes from $(e.target). If the click originates from a nested element inside the (e.g., an icon/span), data-page/data-page-size will be missing and pagination will break. Use $(this) and/or select anchors by data attributes so all pagination links are handled consistently.
  element.find('a.page-link').on('click', function (e) {
    e.preventDefault();
    var a = $(e.target);
    callback(a.data('page'), a.data('page-size'));
  });

lib/Common/SmartyPage.php:749

  • CreateDataTableFilter's language configuration maps the Info strings incorrectly: info is currently set to the Filter text, and infoEmpty is set to the Info text. This produces incorrect UI copy in the table footer.
           const tableFilter =  new DataTable("#' . $tableId . '", {
                "dom": \'<"d-flex justify-content-between my-1"fl><t>t<"d-flex justify-content-center"i><"d-flex justify-content-center"p><"clear">\',
                "pageLength": ' . $defaultPageSize . ',
                "lengthMenu": ' . $lengthMenu . ',
                language: {

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/Common/SmartyPage.php
Comment thread lib/Common/SmartyPage.php
Comment thread lib/Common/SmartyPage.php
Comment thread lib/Common/SmartyPage.php Outdated
@labmecanicatec
labmecanicatec force-pushed the feat/traditional-pagination branch from c04639f to 67a38fd Compare August 24, 2026 15:02
@labmecanicatec
labmecanicatec requested a lite review from Copilot August 24, 2026 15:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 8 comments.

Suppressed comments (1)

lib/Common/SmartyPage.php:791

  • Use the existing PageInfo::All constant instead of the magic -1; this keeps the link coupled to the paging contract if its sentinel changes.
                $sb->Append($this->CreatePageLink(['class' => 'link-primary', 'page' => 1, 'size' => -1, 'text' => $viewAllText], $smarty));

Comment thread lib/Common/SmartyPage.php
Comment thread lib/Common/SmartyPage.php Outdated
Comment thread Web/scripts/ajax-helpers.js Outdated
Comment thread Presenters/Admin/ManageUsersPresenter.php
Comment thread Pages/Admin/ManageSchedulesPage.php
Comment thread Pages/Admin/ManageResourcesPage.php
Comment thread lib/Common/SmartyPage.php
Comment thread tpl/Admin/Schedules/manage_schedules.tpl
- Restore CreatePagination and CreatePageLink methods
- Enable page navigation with prev/next buttons
- Display results range and total count
- Add data attributes for pagination handling
- Replace view all behavior with paginated browsing

Assisted-by: Claude:claude-haiku-4.5
@labmecanicatec
labmecanicatec force-pushed the feat/traditional-pagination branch from 67a38fd to 5a34e01 Compare August 24, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Manage Users page exhausts PHP memory_limit on first load (no pagination applied)

2 participants