Skip to content

Lay out the credit note list like the order list of default-twig - #28

Merged
ThomasDaSilva merged 3 commits into
thelia-modules:mainfrom
ThomasDaSilva:feat/credit-note-list-like-orders
Oct 23, 2026
Merged

ThomasDaSilva merged 3 commits into
thelia-modules:mainfrom
ThomasDaSilva:feat/credit-note-list-like-orders

Conversation

@ThomasDaSilva

@ThomasDaSilva ThomasDaSilva commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

The credit note list of the back-office was a plain Bootstrap table: an id column, eleven data columns, a search on the reference and the invoice date only, and a link for every page (more than 600 on a shop with 13,000 credit notes). It now has the layout of the order list of default-twig and uses the same components.

Changes:

  • Page header with the "Add a new credit note" button, one search field and the advanced filters in a collapsed panel, as on the order list. The search looks in the reference, the invoice reference, the order reference and the customer name and e-mail. Every word has to match one of them, so "Diallo Mohamed" finds Mohamed Diallo.
  • Advanced filters: status and type as colored pills, invoice date range, amount (with tax) slider. The active filters show as chips that remove one filter each.
  • The table is a BoDataTable with BoPagination. Columns: reference (opens the modal), invoice reference with the date of the document underneath, customer (flag of the invoice country, name, e-mail, as on the order list), order, status, type, total with tax and without tax underneath, creation date and update date (with their age underneath for 30 days, the date alone afterwards or when it is ahead of the clock), actions. The id column is gone. Reference, total, creation and update dates sort. On a narrow screen the columns fold into the detail row of each line, from md to xl depending on the column.
  • Row actions go through row_action(): view and PDF for a numbered credit note, edit and delete before. Edit and delete only show to an administrator with the update or delete right on the module.
  • CreditNoteListFilters reads the query string, CreditNoteListReader runs the query, CreditNoteListRowPresenter and CreditNoteListFilterPresenter shape the rows and the filters. They replace CreditNoteHookPresenter::listRows(), which only the list called; it is removed.
  • A page loads the customer, the order and the invoice address with its country in one query, the statuses and types with their translations joined, and each currency symbol once.
  • Labels in the English and French catalogs, version 4.4.0, CHANGELOG entry.

Compatibility:

  • The parameters of the previous list still filter: status_id (the links of the side menu), ref, creditNoteDateMin and creditNoteDateMax. credit_note_page and credit_note_order are no longer read; such a link opens the first page, newest first.
  • A parameter of the wrong shape (?status_ids=1, ?q[]=x) is ignored. The typed accessors of InputBag would answer 400, which the order list of default-twig still does.
  • The template relies on what default-twig ships on main: BoDataTable, BoPagination, _page_header.html.twig, row_action(), the bo-order-filters styles and the bo-range-slider controller.
  • The date filter bounds invoice_date, as before. The listener sets it when the credit note gets its reference and again when it is numbered, so a credit note not accepted yet is found by the date it was created.

Tested:

  • CreditNoteListFiltersTest (unit): parsing, legacy parameters, hostile values, chips removal. CreditNoteListTest (integration): search by each field and by words in any order, status, type, amount and date filters, row content, page past the last one, empty list, age of a date past 30 days and ahead of the clock. Each test fails when the code it covers is broken.
  • The full integration suite gives the same result as on main on the same database: the web tests error without symfony/browser-kit, and the numbering and ceiling tests fail on a database with existing credit notes.
  • In a shop with the module linked: filters, chips, sorting, the modal opened from the reference and from the row buttons, at 1920 px and at 390 px (no horizontal scroll).

Not in this PR: viewAction, updateAction and deleteAction do not call checkAuth(), so hiding the buttons does not protect the routes, and deleteAction fails on an unknown id. I will open a separate PR for it.

One search over the reference, the invoice reference, the order and the
customer (every word, in any order); status, type, invoice date and amount
filters in a collapsed panel with chips for the active ones; columns sorted
by reference, total, creation or update date, rendered by the BoDataTable
and BoPagination components of default-twig.

The id column is gone. The invoice reference has its own column with the
date of the document; the customer shows the flag of the invoice country,
the name and the e-mail. Edit and delete show only with the update or delete
right on the module. The parameters of the previous list (status_id of the
side menu, ref, creditNoteDateMin, creditNoteDateMax) still filter, and a
parameter of the wrong shape is ignored instead of answering 400.

CreditNoteHookPresenter::listRows() is replaced by CreditNoteListReader and
CreditNoteListRowPresenter. Version 4.4.0.
@ThomasDaSilva ThomasDaSilva changed the title feat(#122): lay out the credit note list like the order list Lay out the credit note list like the order list of default-twig Oct 23, 2026
@ThomasDaSilva
ThomasDaSilva marked this pull request as ready for review October 23, 2026 11:43
@ThomasDaSilva
ThomasDaSilva merged commit ef02a05 into thelia-modules:main Oct 23, 2026
5 checks passed
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.

1 participant