Implementation de la notion d'espace d'investissement

This commit is contained in:
ocroguennec committed 2026-09-17 18:25:42 +02:00
1 parent 6b6cad7cd6
commit 4b7df66862
54 files changed
+6782 -288

No files matched your search

+8 -6
View File
@@ -1,6 +1,7 @@
import { useEffect, useRef, useState } from 'react';
import * as XLSX from 'xlsx';
import { fmtEUR, fmtDate, today } from '../utils/format.js';
import { useAsyncAction } from '../hooks/useAsyncAction.js';
/* ── Éléments partagés entre l'onglet "Mouvements" de DepotsRetraits.jsx et l'onglet
"Mouvements Porte-monnaie" de Plateformes.jsx. Toute évolution ici s'applique aux deux
@@ -695,9 +696,10 @@ export function CorrectionModal({ open, onClose, onConfirm,
const diff = Math.round((Number(declared) - computedBalance) * 100) / 100;
const hasDiff = Math.abs(diff) >= 0.005;
const handleConfirm = () => {
onConfirm(hasDiff ? diff : 0);
};
// Anti-double-soumission (cf. useAsyncAction) : évite de créer deux fois la même correction
// sur un double-clic / une connexion lente, avant que la modale ne se ferme.
const { run, pending } = useAsyncAction();
const handleConfirm = () => run(() => onConfirm(hasDiff ? diff : 0));
if (!open) return null;
return (
@@ -773,9 +775,9 @@ export function CorrectionModal({ open, onClose, onConfirm,
)}
<div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end', marginTop: 8 }}>
<button onClick={onClose}>Passer</button>
<button className="primary" onClick={handleConfirm}>
{hasDiff ? 'Créer la correction' : 'OK'}
<button disabled={pending} onClick={onClose}>Passer</button>
<button className="primary" disabled={pending} onClick={handleConfirm}>
{pending ? '…' : (hasDiff ? 'Créer la correction' : 'OK')}
</button>
</div>
</div>