Show the link-status badge on all linkable types, not just versement
Hébergement (and achat/sous-traitant) were already linkable to an entrée client -- LINKABLE_TYPES already included them, so the "Lier" button and the reconciliation math worked fine -- but versementStatus() hardcoded item.type !== 'versement' and returned null for every other type, so those rows never got the Non liée/Lié/Reste à verser/Sur-versé badge at all, and had no way to open the link form except the small actions-column icon. Renamed versementStatus()/versementStatusLabel()/versementStatusClasses() to linkStatus()/linkStatusLabel()/linkStatusClasses() and generalized the type check to LINKABLE_TYPES.includes(item.type). Verified live: a hébergement row linked to an entrée now shows the same badge, status math, and drill-down modal as a versement.
This commit is contained in:
@@ -417,7 +417,7 @@
|
|||||||
let surVerse = 0;
|
let surVerse = 0;
|
||||||
const detail = [];
|
const detail = [];
|
||||||
// Kept per-compte (not just folded into the two totals above) --
|
// Kept per-compte (not just folded into the two totals above) --
|
||||||
// versementStatus() below needs to check a single sortie's own
|
// linkStatus() below needs to check a single sortie's own
|
||||||
// compte(s) against the entrée, not the entrée's overall
|
// compte(s) against the entrée, not the entrée's overall
|
||||||
// reconciliation, which can span *other* comptes tied to other
|
// reconciliation, which can span *other* comptes tied to other
|
||||||
// sorties linked to the same entrée.
|
// sorties linked to the same entrée.
|
||||||
@@ -567,37 +567,38 @@
|
|||||||
const detail = relevant.map((compte) => compte + ' : ' + this.formatEur(ecarts[compte])).join(', ');
|
const detail = relevant.map((compte) => compte + ' : ' + this.formatEur(ecarts[compte])).join(', ');
|
||||||
return { detail, comptes: relevant.length };
|
return { detail, comptes: relevant.length };
|
||||||
},
|
},
|
||||||
// Status badge for a "versement freelance" row -- always present
|
// Status badge for any linkable sortie row (versement, achat,
|
||||||
// when the row is a versement, specifically so a linked-but-settled
|
// hébergement, sous-traitant -- see LINKABLE_TYPES) -- always
|
||||||
// versement still gets a badge to drill down through (it used to
|
// present for one of those types, specifically so a
|
||||||
// return null there, silently losing the only way to open the
|
// linked-but-settled row still gets a badge to drill down through
|
||||||
// linked entrée's filtered view for versements with nothing wrong
|
// (it used to return null there, silently losing the only way to
|
||||||
// to report). "kind" distinguishes not-linked-at-all, a residual
|
// open the linked entrée's filtered view for a row with nothing
|
||||||
// against at least one linked entrée, or linked-and-settled:
|
// wrong to report). "kind" distinguishes not-linked-at-all, a
|
||||||
|
// residual against at least one linked entrée, or linked-and-settled:
|
||||||
// - not linked at all
|
// - not linked at all
|
||||||
// - linked but its own compte(s) still show a residual against at
|
// - linked but its own compte(s) still show a residual against at
|
||||||
// least one linked entrée -- deliberately scoped to just the
|
// least one linked entrée -- deliberately scoped to just the
|
||||||
// compte(s) this versement's own répartition touches
|
// compte(s) this row's own répartition touches
|
||||||
// (reconciliationByEntree's parCompteResidual), not the
|
// (reconciliationByEntree's parCompteResidual), not the
|
||||||
// entrée's overall resteAVerser/surVerse, which can be driven
|
// entrée's overall resteAVerser/surVerse, which can be driven
|
||||||
// entirely by a *different* compte tied to some other sortie
|
// entirely by a *different* compte tied to some other sortie
|
||||||
// linked to the same entrée and would say nothing about
|
// linked to the same entrée and would say nothing about
|
||||||
// whether this versement's own répartition is settled. When
|
// whether this row's own répartition is settled. When linked
|
||||||
// linked to several entrées (see reconciliationByEntree's
|
// to several entrées (see reconciliationByEntree's equal-split
|
||||||
// equal-split note), each entrée's residual for these compte(s)
|
// note), each entrée's residual for these compte(s) counts
|
||||||
// counts separately -- they're independent invoices, each with
|
// separately -- they're independent invoices, each with its
|
||||||
// its own outstanding amount.
|
// own outstanding amount.
|
||||||
// - linked and settled
|
// - linked and settled
|
||||||
// - inconnu: at least one linked entrée's reconciliation couldn't
|
// - inconnu: at least one linked entrée's reconciliation couldn't
|
||||||
// be resolved (not yet fetched into groupExtraRows -- see
|
// be resolved (not yet fetched into groupExtraRows -- see
|
||||||
// allKnownRows()/loadEntreeGroup()). Deliberately distinct from
|
// allKnownRows()/loadEntreeGroup()). Deliberately distinct from
|
||||||
// "ok": defaulting an unresolved entrée to "settled" would show
|
// "ok": defaulting an unresolved entrée to "settled" would show
|
||||||
// a false all-clear for a versement that's actually fine, or
|
// a false all-clear for a row that's actually fine, or one
|
||||||
// one that owes money, purely because its linked entrée hasn't
|
// that owes money, purely because its linked entrée hasn't
|
||||||
// been fetched yet -- opening the badge resolves it and flips
|
// been fetched yet -- opening the badge resolves it and flips
|
||||||
// the status to whatever it actually is.
|
// the status to whatever it actually is.
|
||||||
versementStatus(item) {
|
linkStatus(item) {
|
||||||
if (item.type !== 'versement') return null;
|
if (!LINKABLE_TYPES.includes(item.type)) return null;
|
||||||
if (!item.entreeLieeIds.length) {
|
if (!item.entreeLieeIds.length) {
|
||||||
return { kind: 'non-liee', detail: 'Aucune entrée client liée.' };
|
return { kind: 'non-liee', detail: 'Aucune entrée client liée.' };
|
||||||
}
|
}
|
||||||
@@ -628,7 +629,7 @@
|
|||||||
const n = item.entreeLieeIds.length;
|
const n = item.entreeLieeIds.length;
|
||||||
return { kind: 'ok', detail: 'Lié à ' + n + ' entrée' + (n > 1 ? 's' : '') + ' client' + (n > 1 ? 's' : '') + '.' };
|
return { kind: 'ok', detail: 'Lié à ' + n + ' entrée' + (n > 1 ? 's' : '') + ' client' + (n > 1 ? 's' : '') + '.' };
|
||||||
},
|
},
|
||||||
versementStatusLabel(kind) {
|
linkStatusLabel(kind) {
|
||||||
if (kind === 'non-liee') return 'Non liée';
|
if (kind === 'non-liee') return 'Non liée';
|
||||||
if (kind === 'reste') return 'Reste à verser';
|
if (kind === 'reste') return 'Reste à verser';
|
||||||
if (kind === 'sur-verse') return 'Sur-versé';
|
if (kind === 'sur-verse') return 'Sur-versé';
|
||||||
@@ -639,7 +640,7 @@
|
|||||||
// inconnu are their own softer amber; ok gets neither, falling back
|
// inconnu are their own softer amber; ok gets neither, falling back
|
||||||
// to the badge's default green -- same "all clear" green the
|
// to the badge's default green -- same "all clear" green the
|
||||||
// entrée side already uses for a fully-settled "N sorties liées".
|
// entrée side already uses for a fully-settled "N sorties liées".
|
||||||
versementStatusClasses(kind) {
|
linkStatusClasses(kind) {
|
||||||
return {
|
return {
|
||||||
'is-anomalie': kind === 'non-liee' || kind === 'sur-verse',
|
'is-anomalie': kind === 'non-liee' || kind === 'sur-verse',
|
||||||
'is-reste': kind === 'reste' || kind === 'inconnu',
|
'is-reste': kind === 'reste' || kind === 'inconnu',
|
||||||
|
|||||||
@@ -157,12 +157,12 @@
|
|||||||
:title="'Écart avec la clôture calculée de ' + (item.date.slice(0, 4) - 1) + ' : ' + ouvertureEcart(item).detail"
|
:title="'Écart avec la clôture calculée de ' + (item.date.slice(0, 4) - 1) + ' : ' + ouvertureEcart(item).detail"
|
||||||
>⚠ écart clôture {{ item.date.slice(0, 4) - 1 }} ({{ ouvertureEcart(item).comptes }} compte{{ ouvertureEcart(item).comptes > 1 ? 's' : '' }})</span>
|
>⚠ écart clôture {{ item.date.slice(0, 4) - 1 }} ({{ ouvertureEcart(item).comptes }} compte{{ ouvertureEcart(item).comptes > 1 ? 's' : '' }})</span>
|
||||||
<span
|
<span
|
||||||
v-if="versementStatus(item)"
|
v-if="linkStatus(item)"
|
||||||
class="figli-recon-badge is-clickable"
|
class="figli-recon-badge is-clickable"
|
||||||
:class="versementStatusClasses(versementStatus(item).kind)"
|
:class="linkStatusClasses(linkStatus(item).kind)"
|
||||||
:title="item.entreeLieeIds.length ? versementStatus(item).detail + ' -- cliquer pour voir la ou les entrées liées' : versementStatus(item).detail + ' -- cliquer pour lier une entrée client'"
|
: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]) : openLinkForm(item.nid)"
|
||||||
>{{ versementStatus(item).kind === 'ok' ? '' : '⚠ ' }}{{ versementStatusLabel(versementStatus(item).kind) }}</span>
|
>{{ linkStatus(item).kind === 'ok' ? '' : '⚠ ' }}{{ linkStatusLabel(linkStatus(item).kind) }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="amount" :class="montantClass(item.montant_ht)">{{ formatEur(item.montant_ht) }}</td>
|
<td class="amount" :class="montantClass(item.montant_ht)">{{ formatEur(item.montant_ht) }}</td>
|
||||||
<td class="amount">{{ formatEur(item.montant_ttc) }}</td>
|
<td class="amount">{{ formatEur(item.montant_ttc) }}</td>
|
||||||
@@ -234,10 +234,10 @@
|
|||||||
:class="{'is-anomalie': reconciliationByEntree.get(item.id).surVerse > 0, 'is-reste': reconciliationByEntree.get(item.id).resteAVerser > 0}"
|
:class="{'is-anomalie': reconciliationByEntree.get(item.id).surVerse > 0, 'is-reste': reconciliationByEntree.get(item.id).resteAVerser > 0}"
|
||||||
>{{ reconciliationByEntree.get(item.id).count }} sortie{{ reconciliationByEntree.get(item.id).count > 1 ? 's' : '' }} liée{{ reconciliationByEntree.get(item.id).count > 1 ? 's' : '' }}<template v-if="reconciliationByEntree.get(item.id).resteAVerser > 0"> · reste {{ formatEur(reconciliationByEntree.get(item.id).resteAVerser) }}</template><template v-if="reconciliationByEntree.get(item.id).surVerse > 0"> · sur-versé {{ formatEur(reconciliationByEntree.get(item.id).surVerse) }}</template></span>
|
>{{ reconciliationByEntree.get(item.id).count }} sortie{{ reconciliationByEntree.get(item.id).count > 1 ? 's' : '' }} liée{{ reconciliationByEntree.get(item.id).count > 1 ? 's' : '' }}<template v-if="reconciliationByEntree.get(item.id).resteAVerser > 0"> · reste {{ formatEur(reconciliationByEntree.get(item.id).resteAVerser) }}</template><template v-if="reconciliationByEntree.get(item.id).surVerse > 0"> · sur-versé {{ formatEur(reconciliationByEntree.get(item.id).surVerse) }}</template></span>
|
||||||
<span
|
<span
|
||||||
v-if="versementStatus(item)"
|
v-if="linkStatus(item)"
|
||||||
class="figli-recon-badge"
|
class="figli-recon-badge"
|
||||||
:class="versementStatusClasses(versementStatus(item).kind)"
|
:class="linkStatusClasses(linkStatus(item).kind)"
|
||||||
>{{ versementStatus(item).kind === 'ok' ? '' : '⚠ ' }}{{ versementStatusLabel(versementStatus(item).kind) }}</span>
|
>{{ linkStatus(item).kind === 'ok' ? '' : '⚠ ' }}{{ linkStatusLabel(linkStatus(item).kind) }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="amount" :class="montantClass(item.montant_ht)">{{ formatEur(item.montant_ht) }}</td>
|
<td class="amount" :class="montantClass(item.montant_ht)">{{ formatEur(item.montant_ht) }}</td>
|
||||||
<td class="amount">{{ formatEur(item.montant_ttc) }}</td>
|
<td class="amount">{{ formatEur(item.montant_ttc) }}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user