Overweights Chargeback UI
Frontend behavior for applying chargeback (individual or bulk) from the Overweights screen when the ticket status filter is Solved.
Where It Lives
The same Overweights table used for accept/reject overweight refunds. When the user filters by ticket status Solved, the context shifts to "refunds to reverse" and the bulk action and row actions show chargeback instead of accept/reject.
Main Screens and Purpose
| Screen / area | Purpose |
|---|---|
| Overweights table | Lists overweight records; filters include ticket status (e.g. Pending, Solved). |
| Filter "Solved" | When only Solved is selected, table shows rows whose ticket is already Solved; only rows with an approved compensation are eligible for chargeback. |
| Bulk action bar | When filter is only Solved: shows "Apply bulk chargeback" (or i18n equivalent). Otherwise: shows "Accept masive" / "Reject masive". |
| Row actions | When the row is eligible (Solved + approved compensation): shows "Apply chargeback" in addition to or instead of accept/reject. |
Chargeback Modal
- Opened when the user clicks "Apply bulk chargeback" or "Apply chargeback" on a row.
- Required: Chargeback reason (
review_comment). - On confirm: call
POST /overweights/chargebackwithcompensation_ids(selected rows'compensation_idvalues) andreview_comment. - On success: reload table, clear selection, show toast. On error (e.g. 400 ineligible): show error message.
Selection Rules
When the ticket status filter is only Solved:
- Only rows with
ticket_status_id === ACCEPTEDand a validcompensation_id(and optionally compensation status ACCEPTED) are selectable. - Rows without a compensation or not Solved should not be selectable in this mode so the user cannot send ineligible ids to the API.
User Flows
- Bulk chargeback — Set filter to Solved → select one or more eligible rows → click "Apply bulk chargeback" → enter reason → confirm. Backend applies chargeback to each compensation; balance debited, ticket set to Rejected, audit record created.
- Individual chargeback — Set filter to Solved (or navigate to a Solved row) → open row actions → "Apply chargeback" → enter reason → confirm. Same backend behavior for a single compensation.
- Accept/Reject (unchanged) — When filter is not only Solved, bulk actions remain "Accept masive" and "Reject masive"; chargeback actions are not shown.
Components and API
- Overweights Table — Conditional
bulkButtonsanditemsSelectedFilterbased onticketStatusfilter; row actions depend on eligibility (Solved + compensation_id). - API — e.g.
api.overweight.applyChargeback({ compensation_ids, review_comment })callingPOST /overweights/chargeback.
