From ef2d7b801dcc80603b99b39177970d65bcc8a61f Mon Sep 17 00:00:00 2001 From: bach Date: Sat, 5 Sep 2026 10:26:47 +0200 Subject: [PATCH] Add sous-traitant, salaire/stage, and charges local pro ligne types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three new field_type_ligne values (config/sync + figli_compta_ledger.install for fresh-install parity), wired through every place that enumerates the type list: LedgerActionsController's inline type-change endpoint, home.js's type dropdown/badge, dashboard.js's per-type chart, home.css's badge colors. Sous-traitant is linkable to field_entree_liee (pays out against a client's work, like versement/achat); salaire/stage and charges local pro are not (structural costs, like charge). Turns out 13 lines already carried "salaire_stage" and 1 "sous_traitant" as raw field values from the historical migration -- list_string doesn't enforce allowed_values at the storage level, so they saved fine but had no label and weren't selectable in the UI until now. Also fixes a real bug this surfaced: filtering /lignes by a sparse type (e.g. "Autre") silently broke the sliding window -- so few rows matched that the table no longer overflowed, so it never fired another 'scroll' event, so loadOlder()/loadNewer() never ran again ("les lignes antérieures ne chargent plus"). Added ensureScrollable(), which keeps extending the window in both directions whenever a thinning filter (compte/client/type/écarts) leaves too little to scroll, and widened the trim cap while filtering (MAX_LOADED_MONTHS_FILTERED) since the normal 30-month cap actively fights a sparse filter -- extending one end and immediately trimming the other nets out to nearly the same slice every round. Bounded by a round counter rather than "did the window stop moving": addMonths() uses Date#setMonth(), which isn't invertible for month-end dates, so the window can drift indefinitely in tiny steps without ever exactly repeating. Verified: filtering by "Autre" now finds 24 matches (was stuck at 1) and the view becomes scrollable within ~17s, settling cleanly rather than hanging. --- .../field.storage.node.field_type_ligne.yml | 9 ++ .../custom/figli_compta_ledger/css/home.css | 3 + .../figli_compta_ledger.install | 3 + .../figli_compta_ledger.module | 8 +- .../figli_compta_ledger/js/dashboard.js | 6 ++ .../custom/figli_compta_ledger/js/home.js | 92 +++++++++++++++++-- .../Controller/LedgerActionsController.php | 9 +- 7 files changed, 119 insertions(+), 11 deletions(-) diff --git a/config/sync/field.storage.node.field_type_ligne.yml b/config/sync/field.storage.node.field_type_ligne.yml index 31f9e4c..33fb564 100644 --- a/config/sync/field.storage.node.field_type_ligne.yml +++ b/config/sync/field.storage.node.field_type_ligne.yml @@ -32,6 +32,15 @@ settings: - value: hebergement label: Hébergement + - + value: sous_traitant + label: Sous-traitant + - + value: salaire_stage + label: 'Salaire / stage' + - + value: charges_local_pro + label: 'Charges local pro' allowed_values_function: '' module: options locked: false diff --git a/web/modules/custom/figli_compta_ledger/css/home.css b/web/modules/custom/figli_compta_ledger/css/home.css index 1788a34..13e080c 100644 --- a/web/modules/custom/figli_compta_ledger/css/home.css +++ b/web/modules/custom/figli_compta_ledger/css/home.css @@ -215,6 +215,9 @@ html.gin--dark-mode #figli-home-app { #figli-home-app .type-achat { background: #1d4ed81a; color: #3b6fe0; } #figli-home-app .type-hebergement { background: #0e91821a; color: #0e9182; } #figli-home-app .type-ouverture { background: #7c3aed1a; color: #9061f0; } +#figli-home-app .type-sous_traitant { background: #c9312b1a; color: #c9312b; } +#figli-home-app .type-salaire_stage { background: #0891b21a; color: #0891b2; } +#figli-home-app .type-charges_local_pro { background: #65a30d1a; color: #65a30d; } #figli-home-app .type-autre { background: #6b72801a; color: var(--figli-text-light); } /* Click-to-edit type badge -- swaps for a native