This commit is contained in:
ocroguennec committed 2026-09-18 08:16:01 +02:00
1 parent c2dbe506c5
commit 337d0c1a2c
2 files changed
+36 -30

No files matched your search

@@ -11,7 +11,7 @@ import FraisFormModal from '../components/FraisFormModal.jsx';
import { FRAIS_CATEGORIE_LABELS } from '../components/MouvementsShared.jsx';
import { useAsyncAction } from '../hooks/useAsyncAction.js';
import { fmtEUR, fmtDate, fmtOctets, today } from '../utils/format.js';
import { emptyDealForm, AUTO_VAL_NOTE } from './InvestissementsPe.jsx';
import { emptyDealForm, AUTO_VAL_NOTE, AUTO_VAL_NOTE_LEGACY } from './InvestissementsPe.jsx';
/**
* Fiche détaillée d'un deal Private Equity (chantier "fiche détail PE", 17/09/26 — demande
@@ -117,7 +117,7 @@ export default function InvestissementPeDetail() {
if (!deal) return;
const entree = fraisOps.find(f => f.categorie === 'souscription');
const gestion = fraisOps.find(f => f.categorie === 'gestion' && f.origine === 'souscription');
const autoVal = valorisations.find(v => v.notes === AUTO_VAL_NOTE);
const autoVal = valorisations.find(v => v.notes === AUTO_VAL_NOTE || v.notes === AUTO_VAL_NOTE_LEGACY);
setForm({
...emptyDealForm,
plateforme_id: String(deal.plateforme_id || ''),
@@ -178,15 +178,16 @@ export default function InvestissementPeDetail() {
} catch { /* non bloquant */ }
};
// Toujours créée, même sans frais (= montant investi tel quel) — décision Olivier 18/09/26,
// cf. InvestissementsPe.jsx::syncValorisationInitiale (même logique, dupliquée ici pour la
// modale d'édition de la fiche détail).
const syncValorisationInitiale = async (totalFraisSource, valorisationInitialeId) => {
try {
if (valorisationInitialeId) await api.del(`/investissements-pe/${id}/valorisations/${valorisationInitialeId}`);
if (totalFraisSource > 0) {
const initiale = Math.max(0, Math.round((Number(form.montant_investi) - totalFraisSource) * 100) / 100);
await api.post(`/investissements-pe/${id}/valorisations`, {
date_valorisation: form.date_souscription, valorisation_nette: initiale, notes: AUTO_VAL_NOTE,
});
}
const initiale = Math.max(0, Math.round((Number(form.montant_investi) - totalFraisSource) * 100) / 100);
await api.post(`/investissements-pe/${id}/valorisations`, {
date_valorisation: form.date_souscription, valorisation_nette: initiale, notes: AUTO_VAL_NOTE,
});
} catch { /* non bloquant */ }
};