gigafibre-fsm/apps/ops/src/pages
louispaulb dfd41ee993 fix(ops/client): consolidate on Service Subscription + catalog browse
Adding a forfait from the client detail dialog failed with `Update
failed: 417` because the code path manipulated ERPNext's stock
Subscription doctype — a parent/child (Subscription Plan rows) model
with tight validation ("Subscription End Date is mandatory to follow
calendar months"), and whose `plan` field expects an `SP-<hash>` doc
name rather than a free-form string.

Meanwhile all new subscription work — contract signing, chain
activation, prorated invoicing — already writes to our flat custom
`Service Subscription` doctype. The two systems were not talking to
each other: the Service Subscription created for CTR-00008 was
invisible in the client UI (which only read stock Subscription), and
the stock Subscription created by "Ajouter un service" was invisible
to the contract/chain system.

This commit makes Service Subscription the canonical doctype for
everything the ops UI does:

- useClientData.loadSubscriptions: read Service Subscription directly
  (flat doc → UI row) instead of reading stock Subscription + joining
  its Subscription Plan child rows to Items. Legacy stock Subscription
  rows (~39k from the 2026-03-29 migration) stay as audit records
  but are no longer surfaced.
- ClientDetailPage.createService: POST a Service Subscription doc
  (category inferred from item_group). No parent/child logic, no
  calendar-month coupling, no SP-<hash> plan reference. Manual
  description + price entry now works without a catalog pick.
- useSubscriptionActions.updateSub: drop the bogus `ASUB-*` name-based
  doctype detection (ASUB is not a real prefix — both stock and
  Service subs are named SUB-<hex|digits>) and always target Service
  Subscription. Also surface ERPNext's exception one-liner instead of
  raw HTML when an update fails.
- searchPlans: empty/short query now returns top-50 of the Subscription
  Plan catalog so dispatchers can browse instead of being forced to
  guess a name prefix.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-23 11:07:54 -04:00
..
AgentFlowsPage.vue refactor: major cleanup — remove dead dispatch app, commit all backend code, extract client composables 2026-04-08 17:38:38 -04:00
ClientDetailPage.vue fix(ops/client): consolidate on Service Subscription + catalog browse 2026-04-23 11:07:54 -04:00
ClientsPage.vue refactor: major cleanup — remove dead dispatch app, commit all backend code, extract client composables 2026-04-08 17:38:38 -04:00
DashboardPage.vue refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
dispatch-styles.scss refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
dispatch-styles.scss.dark-backup refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
DispatchPage.vue refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
EquipePage.vue feat: add ops app + CONTEXT.md, simplify URL to /ops/ 2026-03-30 22:41:58 -04:00
NetworkPage.vue feat: contract → chain → subscription → prorated invoice lifecycle + tech group claim 2026-04-22 20:40:54 -04:00
OcrPage.vue feat: unify vision on Gemini + port field tech scan/device into /j 2026-04-22 11:26:01 -04:00
RapportsPage.vue refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
ReportARPage.vue refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
ReportRevenuPage.vue refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
ReportTaxesPage.vue refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
ReportVentesPage.vue refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
SettingsPage.vue feat: flow editor, Gemini QR scanner with offline queue, dispatch planning v2 2026-04-22 10:44:17 -04:00
TelephonyPage.vue refactor: reduce token count, DRY code, consolidate docs 2026-04-13 08:39:58 -04:00
TicketsPage.vue feat: flow editor, Gemini QR scanner with offline queue, dispatch planning v2 2026-04-22 10:44:17 -04:00