Skip to content

fix(admin): commission admin panel polish and validation#1043

Merged
vholik merged 3 commits into
canaryfrom
viktorholik/commission-admin-bug-fixes
Jun 18, 2026
Merged

fix(admin): commission admin panel polish and validation#1043
vholik merged 3 commits into
canaryfrom
viktorholik/commission-admin-bug-fixes

Conversation

@vholik

@vholik vholik commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the commission Admin Panel bugs reported in the current cycle, in one PR:

  • MER-225 — Global Commission: removed the Code field, switched the type picker to radio buttons, and added a "Please enter a value." validation.
  • MER-226 — Create Rule (Step 1): removed Code; added validation for title ("Please enter a title"), stores, product types, and categories; switched the scope-type picker to radio buttons.
  • MER-227 — Create Rule (Step 2): switched the commission-type picker to radio buttons; added the "Please enter a value." validation.
  • MER-230 — Commission Rules list: dedicated empty state; status rendered as a non-badge indicator with red for inactive; the "Type" filter now filters by rule scope type (Store, Product Type, Category, Store + Product Type, Store + Category) instead of percentage/fixed.
  • MER-231 — Toasts: standardised the five commission success toasts ("… was successfully …").
  • MER-232 — Delete prompt: heading "Delete commission rule" + "You are about to delete commission rule {name}. This action cannot be undone."

Supporting changes

  • Commission rate code is now optional on create and auto-generated (unique) server-side when omitted, so the Code field could be removed from the UI.
  • Added a scope_type list filter on /admin/commission-rates, resolved server-side from each rate's linked rules (combos handled with AND semantics).
  • New i18n keys mirrored into $schema.json.

Linear

Test plan

  • bun run build
  • bun run lint (no new issues in changed files)
  • bun run test:integration:http -- commission-rates/admin/commission-rates.spec.ts — 24 passed (incl. auto-generated code + scope_type filter)
  • Manual: create/edit a global commission and a rule, verify radio pickers, value/title/scope validation, toasts, delete prompt, list empty state, status colour, and scope-type filter.

vholik added 3 commits June 18, 2026 16:52
…/227/230/231/232)

- Global commission + create rule: remove Code field, switch single-select
  type pickers to radio buttons, and require a value ("Please enter a value.").
- Create rule: add title, stores, product types, and categories validation.
- Commission rules list: dedicated empty state, non-badge status cell with
  red inactive, and filter by rule scope type instead of percentage/fixed.
- Standardise commission success toasts and the delete confirmation copy.
- Commission rate code is now optional on create and auto-generated when
  omitted; add scope_type list filter resolved from each rate's rules.

Refs MER-225, MER-226, MER-227, MER-230, MER-231, MER-232
…ayer

Move the scope_type list filter out of the admin route handler and into
CommissionModuleService by overriding listCommissionRates and
listAndCountCommissionRates (the pattern SellerModuleService already uses).
The override strips the virtual scope_type key and rewrites it into a
raw() correlated-subquery predicate on commission_rule, so filtering runs
in the database instead of in-memory in the route. query.graph delegates
to the override, so the route just forwards filters.

Refs MER-230
Override CommissionModuleService.createCommissionRates to fill a unique
code from the rate name when one is not provided, instead of generating it
in the admin route handler. Make CreateCommissionRateDTO.code optional to
match. The route now forwards the validated body unchanged.

Refs MER-225, MER-226
@vholik vholik merged commit 0d397cb into canary Jun 18, 2026
1 of 6 checks passed
@vholik vholik deleted the viktorholik/commission-admin-bug-fixes branch June 18, 2026 15:56
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