From f4c590b3a302bf236da5bcf43d202f26e81fd656 Mon Sep 17 00:00:00 2001 From: Olivier Date: Sun, 16 Aug 2026 11:43:21 +0200 Subject: [PATCH] Correctif --- frontend/src/components/MouvementsShared.jsx | 32 ++++++++++++-------- frontend/src/pages/DepotsRetraits.jsx | 14 +++++---- frontend/src/pages/Plateformes.jsx | 14 +++++---- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/frontend/src/components/MouvementsShared.jsx b/frontend/src/components/MouvementsShared.jsx index f298e6a..8a8d792 100644 --- a/frontend/src/components/MouvementsShared.jsx +++ b/frontend/src/components/MouvementsShared.jsx @@ -35,7 +35,7 @@ export function signedMontant(r) { export const MOUV_TYPE_LABELS = { depot: 'Dépôt', retrait: 'Retrait', correction: 'Correction de solde', - remboursement: 'Remboursement', bonus: 'Bonus / Cashback', souscription: 'Souscription', + remboursement: 'Remboursement', bonus: 'Bonus', cashback: 'Cashback', souscription: 'Souscription', prelevement_ir: 'Prélèvement IR', prelevement_csg: 'Prélèvement CSG', prelevement_local: "Prélèvement impôts à l'étranger", }; @@ -145,14 +145,16 @@ export function DetailPanel({ row, onEdit, onDeleteCorrection, onViewRemb, onVie ); const isCorrection = row.type === 'correction'; - const isRemb = row.type === 'remboursement' || row.type === 'bonus'; const isBonus = row.type === 'bonus'; + const isCashback = row.type === 'cashback'; + const isRemb = row.type === 'remboursement' || isBonus || isCashback; const isSouscription = row.type === 'souscription'; const isPrelevement = row.type === 'prelevement_ir' || row.type === 'prelevement_csg' || row.type === 'prelevement_local'; const isAuto = row.source === 'auto_remboursement'; const typeLabel = isCorrection ? 'Correction de solde' - : isBonus ? 'Bonus / Cashback' + : isBonus ? 'Bonus' + : isCashback ? 'Cashback' : row.type === 'remboursement' ? 'Remboursement (porte-monnaie, brut)' : row.type === 'prelevement_ir' ? 'Prélèvement impôt sur le revenu' : row.type === 'prelevement_csg' ? 'Prélèvement CSG' @@ -163,7 +165,7 @@ export function DetailPanel({ row, onEdit, onDeleteCorrection, onViewRemb, onVie const editLabel = isCorrection ? 'Modifier la correction de solde' : row.type === 'depot' ? 'Modifier le dépôt' : 'Modifier le retrait'; - // Débit (−) pour retrait/souscription/prélèvements, crédit (+) pour dépôt/remboursement/bonus ; + // Débit (−) pour retrait/souscription/prélèvements, crédit (+) pour dépôt/remboursement/bonus/cashback ; // la correction est déjà signée en base. const isDebitType = row.type === 'retrait' || isSouscription || isPrelevement; const isPos = isCorrection ? row.montant >= 0 : !isDebitType; @@ -171,17 +173,19 @@ export function DetailPanel({ row, onEdit, onDeleteCorrection, onViewRemb, onVie const montantFmt = `${sign} ${fmtEUR(Math.abs(row.montant))}`; const montantColor = undefined; + const isRembOnly = row.type === 'remboursement'; + const fields = [ { label: 'Plateforme', value: row.plateforme_nom }, { label: 'Type de mouvement', value: typeLabel }, { label: 'Montant', value: montantFmt, color: montantColor }, { label: 'Date', value: fmtDate(row.date_operation) }, - isRemb && !isBonus && row.libelle && { label: 'Projet', value: row.libelle }, - isBonus && row.libelle && { label: 'Projet', value: row.libelle }, - isRemb && !isBonus && { label: 'Capital', value: fmtEUR(row._capital) }, - isRemb && !isBonus && row._cashback > 0 && { label: 'Cashback', value: fmtEUR(row._cashback) }, - isRemb && !isBonus && { label: 'Intérêts bruts', value: fmtEUR(row._interets_bruts) }, - isRemb && !isBonus && { label: 'Traitement fiscal', value: row._isFlatTax + isRembOnly && row.libelle && { label: 'Projet', value: row.libelle }, + (isBonus || isCashback) && row.libelle && { label: 'Projet', value: row.libelle }, + isRembOnly && { label: 'Capital', value: fmtEUR(row._capital) }, + isRembOnly && row._cashback > 0 && { label: 'Cashback', value: fmtEUR(row._cashback) }, + isRembOnly && { label: 'Intérêts bruts', value: fmtEUR(row._interets_bruts) }, + isRembOnly && { label: 'Traitement fiscal', value: row._isFlatTax ? 'Flat tax France (PFU prélevé à la source — voir prélèvements associés)' : row._taxeLocale > 0 ? "Étranger avec retenue fiscale locale — voir prélèvement associé" @@ -237,9 +241,11 @@ export function DetailPanel({ row, onEdit, onDeleteCorrection, onViewRemb, onVie {isBonus ? 'Bonus crédité directement au porte-monnaie de la plateforme.' - : row._isAutoSweep - ? "Remboursement (montant brut) crédité sur le porte-monnaie puis reversé aussitôt sur le compte courant (retrait automatique associé). Les prélèvements éventuels apparaissent en lignes séparées. Modifiable depuis la page Remboursements." - : "Montant brut du remboursement versé sur le porte-monnaie de la plateforme (méthode « portefeuille ») — les prélèvements éventuels apparaissent en lignes séparées. Modifiable depuis la page Remboursements."} + : isCashback + ? "Cashback crédité au porte-monnaie de la plateforme, saisi sur un remboursement classique plutôt qu'en tant que bonus. Modifiable depuis la page Remboursements." + : row._isAutoSweep + ? "Remboursement (montant brut) crédité sur le porte-monnaie puis reversé aussitôt sur le compte courant (retrait automatique associé). Les prélèvements éventuels apparaissent en lignes séparées. Modifiable depuis la page Remboursements." + : "Montant brut du remboursement versé sur le porte-monnaie de la plateforme (méthode « portefeuille ») — les prélèvements éventuels apparaissent en lignes séparées. Modifiable depuis la page Remboursements."} )} diff --git a/frontend/src/pages/DepotsRetraits.jsx b/frontend/src/pages/DepotsRetraits.jsx index b446699..43072a8 100644 --- a/frontend/src/pages/DepotsRetraits.jsx +++ b/frontend/src/pages/DepotsRetraits.jsx @@ -319,7 +319,7 @@ export default function DepotsRetraits() { } if (cashback > 0) { - out.push({ ...base, id: `remb_${r.id}_cashback`, type: 'bonus', montant: cashback }); + out.push({ ...base, id: `remb_${r.id}_cashback`, type: 'cashback', montant: cashback }); } if (taxeLocale > 0) { @@ -1138,7 +1138,8 @@ export default function DepotsRetraits() { - + + @@ -1250,8 +1251,9 @@ export default function DepotsRetraits() { ); } - if (r.type === 'remboursement' || r.type === 'bonus') { + if (r.type === 'remboursement' || r.type === 'bonus' || r.type === 'cashback') { const isBonus = r.type === 'bonus'; + const isCashback = r.type === 'cashback'; return ( {isBonus ? 'bonus' : 'remboursement'} + color: (isBonus || isCashback) ? 'var(--warning)' : 'var(--success)', + }}>{isBonus ? 'bonus' : isCashback ? 'cashback' : 'remboursement'} {r._projet || '—'} diff --git a/frontend/src/pages/Plateformes.jsx b/frontend/src/pages/Plateformes.jsx index b4b56f8..91f69d6 100644 --- a/frontend/src/pages/Plateformes.jsx +++ b/frontend/src/pages/Plateformes.jsx @@ -1013,7 +1013,7 @@ export default function Plateformes() { } if (cashback > 0) { - out.push({ ...base, id: `remb_${r.id}_cashback`, type: 'bonus', montant: cashback }); + out.push({ ...base, id: `remb_${r.id}_cashback`, type: 'cashback', montant: cashback }); } if (taxeLocale > 0) { @@ -2404,7 +2404,8 @@ export default function Plateformes() { - + + @@ -2492,8 +2493,9 @@ export default function Plateformes() { ); } - if (r.type === 'remboursement' || r.type === 'bonus') { + if (r.type === 'remboursement' || r.type === 'bonus' || r.type === 'cashback') { const isBonus = r.type === 'bonus'; + const isCashback = r.type === 'cashback'; return ( {isBonus ? 'bonus' : 'remboursement'} + color: (isBonus || isCashback) ? 'var(--warning)' : 'var(--success)', + }}>{isBonus ? 'bonus' : isCashback ? 'cashback' : 'remboursement'} {r._projet || '—'}