Skip to content

VSN-2725: Add BDC / Marchés module under Facturation et Paiement

yahya.elmokhtari a demandé de fusionner VSN-2725 vers develop

Summary

Adds the BDC / Marchés module under /dashboard/facturation-paiement/bdc-marche per VSN-2725. The module is mock-backed for now (Zustand store with placeholder fetchers in src/shared/api/endpoints/bdc.ts) so backend integration is a drop-in swap.

Branch: VSN-2725develop

Scope

New page & navigation

  • Sidebar entry Facturation et Paiement → BDC / Marchés
  • Route: /dashboard/facturation-paiement/bdc-marche
  • List view with the unified table pattern (TableControlBar + TabsCustom + TabContentContainer + useTabsManager + TableHeadCustom), matching /exploitation/circuit-usager/usager
  • Edit view as a tab opened from the list (Détail BDC / Historique / Document)

Detail BDC tab

  • Informations générales — type select (Montant global / BPU détaillé / Montant par circuit), client/département display
  • Informations administratives — objet du marché, engagement, ref Chorus Pro, SIRET, conditions de paiement, date de notification, date de révision des prix + type % / Montant + valeur, description du lot
  • Montant global (when type = global) — HT / TVA 20% / TTC summary
  • BPU circuits (when type = bpu) — auto-generated lines table with editable KM retenu, PUK, forfait, qté, montant
  • Forfait par circuit (when type = circuit) — auto-generated lines with editable KM retenu and forfait HT
  • Avance — enable/disable, type % or fixed, value, mode (progressive/unique), date de versement, computed amount
  • Acomptes — list of acomptes (fixed or % type), facture liée link, totals + reste à facturer rollup
  • Summary panel (right rail) — sticky recap of HT/TVA/TTC, avance, total acomptes, reste à facturer, conditions, dates, document attached

Historique tab

  • Historique financier — Factures / Acomptes / Avances rolled up by ref, date, montant
  • Historique des modifications — tracked-fields audit (date révision prix, conditions paiement, KM retenu, document BDC, montants, statuts)
  • Liste circuits & avenants — circuits attached to the BDC with: chevron / N° circuit / Code circuit / Intitulé / À partir du / N° de Lot / État / Contrat / Département / Créé le / Auteur. Each row expands into a drawer showing the avenants for that circuit (sorted: actif → en attente → expiré), with N° Avenant / À partir du / Jusqu'à / État / Statut / Intitulé / Objet de l'avenant / Détails (avant → après) / Type. The drawer is visually fused with its parent row via shared border, ribbon shadow, and matching background.

Document tab

  • Multi-document list with prominent Importez un document purple button + refresh icon
  • Soft #DBD7F9 purple header (N° document / Nom du fichier / Type / Importé Par / Date)
  • Empty state with search-icon circle and "Aucun document trouvé"
  • Multi-file PDF / DOC / DOCX upload; first doc syncs to documentName so the SummaryPanel still indicates a document is attached

Visual & alignment polish

  • All BDC tables (list, acomptes, BPU circuits, forfait circuits, circuits & avenants) share the same conventions: #DBD7F9 purple header, neo-shadow rounded-2xl rows, fixed-pixel grid tracks, min-w-0 truncate on every cell, size={1} on every <input> so the HTML default size=20 cannot push a track wider than its grid pixel value
  • BPU and Forfait tables wrap their inner grid in w-max min-w-full so the wrapper sizes to the natural max-content of the tracks — header and body lock to identical widths regardless of viewport
  • BDC list table: row cells centered to match centered headers, Actions column fixed at 170px (no trailing 1fr expansion), Lock additional action removed (the toggle already covers active/inactive), Client column flexed (minmax(190px, 1fr)) to absorb trailing whitespace
  • Pretty-printed money via fmtMAD helper

Files

Layer Files
Routes / nav src/routes/paths.ts, src/layouts/dashboard/config-navigation.tsx
Pages src/app/dashboard/facturation-paiement/page.tsx, src/app/dashboard/facturation-paiement/bdc-marche/page.tsx
Module src/shared/sections/facturation-paiement/bdc-marche/** (list view, edit view, hooks, all section components, document/history tabs)
Types src/shared/types/bdc.ts (BDCItem, BDCCircuitLine, BDCForfaitLine, BDCAcompte, BDCAvenant, BDCCircuitChangement + statut/etat/nature/calculation type unions)
Store src/shared/api/stores/bdcStore.ts (Zustand, mock-backed actions)
Endpoints src/shared/api/endpoints/bdc.ts (placeholder paths for backend dev)
Mock src/shared/_mock/_bdc.ts
Common src/shared/types/common.ts (added Bdc = 'BDC' to TableType)

Rapports de requête de fusion