Resolve versement reste-à-verser/sur-versé from the server proactively
The badge on a versement freelance row previously only got the correct status once someone clicked it -- before that it could show "inconnu" (or, worse, silently default to "ok") whenever its linked entrée wasn't in the currently loaded sliding window, which is common: the entrée that got paid can be dated years before or after the versement itself. Also fixed a latent bug in the click path itself: toggleEntreeFilter() passed the *entrée's* id to loadEntreeGroup(), which needs an already-loaded row to find a starting nid for the server-side query -- if that entrée wasn't loaded (the exact case this is all about), the lookup silently found nothing and did nothing. Split the fetch+merge logic into fetchGroupFromNid() and let loadEntreeGroup() accept a fallbackNid (the versement's own, always loaded) to start the traversal from when the entrée itself isn't available locally -- LedgerStatsController::groupeEntree() finds the same connected component either way. New ensureLinkedReconciliationResolved(), triggered by a `rows` watcher after every load/loadOlder/loadNewer, calls the same server-backed resolution for every visible linkable row instead of waiting for a click, deduplicated via resolvedLinkGroups so rows sharing an entrée don't each trigger their own fetch. Verified live: the LA MINE versement (own date 2022, linked entrées dated 2023 and 2025) now shows "⚠ Sur-versé" immediately on page load with zero clicks, where before it required manually opening the badge first. Drill-down modal and the "Non liée" -> link-form click path both still work; no console errors on repeated fresh loads.
This commit is contained in:
@@ -220,7 +220,7 @@
|
||||
class="figli-recon-badge is-clickable"
|
||||
:class="linkStatusClasses(linkStatus(item).kind)"
|
||||
:title="item.entreeLieeIds.length ? linkStatus(item).detail + ' -- cliquer pour voir la ou les entrées liées' : linkStatus(item).detail + ' -- cliquer pour lier une entrée client'"
|
||||
@click="item.entreeLieeIds.length ? toggleEntreeFilter(item.entreeLieeIds[0]) : openLinkForm(item.nid)"
|
||||
@click="item.entreeLieeIds.length ? toggleEntreeFilter(item.entreeLieeIds[0], item.nid) : openLinkForm(item.nid)"
|
||||
>{{ linkStatus(item).kind === 'ok' ? '' : '⚠ ' }}{{ linkStatusLabel(linkStatus(item).kind) }}</span>
|
||||
</template>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user