Checkpoint: Quand un établissement est en mode tout manuel, toutes ses cellules (postes en calcul automatique inclus) sont désormais cliquables et éditables. Fond ambre pour distinguer visuellement le mode tout manuel du mode manuel poste par poste (bleu). Les cellules sans saisie affichent "cliquer" en ambre.

This commit is contained in:
Manus
2026-06-11 08:06:09 +00:00
parent 0e1cab9f6c
commit eb1684f04c

View File

@@ -1783,14 +1783,16 @@ export default function DsiOpex() {
</td> </td>
{lignes.map(ligne => { {lignes.map(ligne => {
const isManuel = ligne.mode_ventilation === 'Manuel' || ligne.isCustom; const isManuel = ligne.mode_ventilation === 'Manuel' || ligne.isCustom;
// En mode tout manuel pour cet établissement, toutes les cellules sont éditables
const isCellEditable = etab.modeManuel || isManuel;
const montant = etab.montants[ligne.libelle] ?? 0; const montant = etab.montants[ligne.libelle] ?? 0;
const cellKey = `${etab.code}|${ligne.libelle}`; const cellKey = `${etab.code}|${ligne.libelle}`;
const isEditing = inlineEditKey === cellKey; const isEditing = inlineEditKey === cellKey;
const hasOverride = montantsManuelEtab[etab.code]?.[ligne.libelle] !== undefined; const hasOverride = montantsManuelEtab[etab.code]?.[ligne.libelle] !== undefined;
if (isManuel && isEditing) { if (isCellEditable && isEditing) {
return ( return (
<td key={ligne.id} className="px-1 py-1 border border-blue-400 bg-blue-50 min-w-[90px]"> <td key={ligne.id} className="px-1 py-1 border border-amber-400 bg-amber-50 min-w-[90px]">
<input <input
autoFocus autoFocus
type="number" type="number"
@@ -1804,7 +1806,7 @@ export default function DsiOpex() {
if (e.key === 'Enter') handleInlineEditCommit(etab.code, ligne.libelle); if (e.key === 'Enter') handleInlineEditCommit(etab.code, ligne.libelle);
if (e.key === 'Escape') handleInlineEditCancel(); if (e.key === 'Escape') handleInlineEditCancel();
}} }}
className="w-full text-right text-xs tabular-nums px-1 py-0.5 border-0 bg-transparent focus:outline-none text-blue-800 font-medium" className="w-full text-right text-xs tabular-nums px-1 py-0.5 border-0 bg-transparent focus:outline-none text-amber-800 font-medium"
style={{ minWidth: '70px' }} style={{ minWidth: '70px' }}
/> />
</td> </td>
@@ -1814,20 +1816,30 @@ export default function DsiOpex() {
return ( return (
<td <td
key={ligne.id} key={ligne.id}
onClick={() => isManuel && !isValidated && handleInlineEditStart(etab.code, ligne.libelle, montant)} onClick={() => isCellEditable && !isValidated && handleInlineEditStart(etab.code, ligne.libelle, montant)}
className={`px-2 py-2 text-right tabular-nums transition-colors ${ className={`px-2 py-2 text-right tabular-nums transition-colors ${
isManuel etab.modeManuel
? `border border-blue-200 bg-blue-50/30 text-blue-800 ${ ? `border border-amber-200 bg-amber-50/30 text-amber-800 ${
!isValidated ? 'cursor-pointer hover:bg-blue-100/60 hover:border-blue-400' : '' !isValidated ? 'cursor-pointer hover:bg-amber-100/60 hover:border-amber-400' : ''
} ${hasOverride ? 'font-semibold' : ''}` } ${hasOverride ? 'font-semibold' : 'opacity-60'}`
: 'border border-emerald-200 bg-emerald-50/20 text-emerald-800' : isManuel
? `border border-blue-200 bg-blue-50/30 text-blue-800 ${
!isValidated ? 'cursor-pointer hover:bg-blue-100/60 hover:border-blue-400' : ''
} ${hasOverride ? 'font-semibold' : ''}`
: 'border border-emerald-200 bg-emerald-50/20 text-emerald-800'
}`} }`}
title={isManuel && !isValidated ? 'Cliquer pour saisir le montant' : undefined} title={
etab.modeManuel && !isValidated
? 'Cliquer pour saisir le montant (mode tout manuel)'
: isManuel && !isValidated
? 'Cliquer pour saisir le montant'
: undefined
}
> >
{montant > 0 {montant > 0
? new Intl.NumberFormat('fr-FR', { maximumFractionDigits: 0 }).format(montant) + ' €' ? new Intl.NumberFormat('fr-FR', { maximumFractionDigits: 0 }).format(montant) + ' €'
: isManuel && !isValidated : isCellEditable && !isValidated
? <span className="text-blue-300 text-[10px]">cliquer</span> ? <span className={etab.modeManuel ? 'text-amber-300 text-[10px]' : 'text-blue-300 text-[10px]'}>cliquer</span>
: <span className="text-muted-foreground"></span>} : <span className="text-muted-foreground"></span>}
</td> </td>
); );