Checkpoint: Ajout d'un bouton Supprimer (rouge) avec AlertDialog de confirmation à côté de Réinitialiser dans le header OPEX DSI. Disponible uniquement pour les prévisionnels non validés. Après confirmation, efface toutes les données de l'année et affiche l'écran vide avec les boutons Créer depuis N-1 / Ajouter manuellement.
This commit is contained in:
@@ -650,6 +650,40 @@ export default function DsiOpex() {
|
|||||||
<AnneeSelectorBar />
|
<AnneeSelectorBar />
|
||||||
{!isValidated && (
|
{!isValidated && (
|
||||||
<>
|
<>
|
||||||
|
<AlertDialog>
|
||||||
|
<AlertDialogTrigger asChild>
|
||||||
|
<button
|
||||||
|
className="flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border border-destructive/40 bg-card hover:bg-destructive/10 transition-colors text-destructive"
|
||||||
|
title="Supprimer ce prévisionnel"
|
||||||
|
>
|
||||||
|
<Trash2 className="w-3.5 h-3.5" />
|
||||||
|
Supprimer
|
||||||
|
</button>
|
||||||
|
</AlertDialogTrigger>
|
||||||
|
<AlertDialogContent>
|
||||||
|
<AlertDialogHeader>
|
||||||
|
<AlertDialogTitle>Supprimer l'OPEX {annee} ?</AlertDialogTitle>
|
||||||
|
<AlertDialogDescription>
|
||||||
|
Toutes les données du prévisionnel OPEX {annee} seront <strong>définitivement supprimées</strong>. Cette action ne peut pas être annulée.
|
||||||
|
</AlertDialogDescription>
|
||||||
|
</AlertDialogHeader>
|
||||||
|
<AlertDialogFooter>
|
||||||
|
<AlertDialogCancel>Annuler</AlertDialogCancel>
|
||||||
|
<AlertDialogAction
|
||||||
|
onClick={() => {
|
||||||
|
const emptyState: OpexAnneeState = { lignes: [], validated: false };
|
||||||
|
setOpexState(emptyState);
|
||||||
|
saveOpexState(annee, emptyState);
|
||||||
|
setIsDirty(false);
|
||||||
|
toast.success(`OPEX ${annee} supprimé`, { description: 'Le prévisionnel a été effacé.' });
|
||||||
|
}}
|
||||||
|
className="bg-destructive hover:bg-destructive/90 text-destructive-foreground"
|
||||||
|
>
|
||||||
|
Supprimer définitivement
|
||||||
|
</AlertDialogAction>
|
||||||
|
</AlertDialogFooter>
|
||||||
|
</AlertDialogContent>
|
||||||
|
</AlertDialog>
|
||||||
<button
|
<button
|
||||||
onClick={handleReset}
|
onClick={handleReset}
|
||||||
className="flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border border-border bg-card hover:bg-muted transition-colors text-muted-foreground"
|
className="flex items-center gap-1.5 px-3 py-2 text-sm rounded-lg border border-border bg-card hover:bg-muted transition-colors text-muted-foreground"
|
||||||
|
|||||||
Reference in New Issue
Block a user