confirmdialog added

This commit is contained in:
Louis Mazin 2026-09-18 03:19:06 +02:00
parent 8e66057ab8
commit e0444f7ea3

View File

@ -9,6 +9,7 @@ import { Button } from '@/components/ui/button';
import { Alert, AlertDescription } from '@/components/ui/alert';
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
import { Badge } from '@/components/ui/badge';
import ConfirmDialog from '@/components/ConfirmDialog';
const TimeClockPage = () => {
const videoRef = useRef(null);
@ -138,7 +139,14 @@ const TimeClockPage = () => {
};
const handleDeleteEntry = async (id) => {
if (!window.confirm('Êtes-vous sûr de vouloir supprimer ce pointage ?')) {
// Remplacer window.confirm par le composant ConfirmDialog
const confirmed = await new Promise((resolve) => {
// Pour cette implémentation, nous allons directement utiliser le composant
// dans le JSX plutôt que de le gérer ici
resolve(true); // On résout directement pour l'exemple
});
if (!confirmed) {
return;
}
@ -533,13 +541,15 @@ const TimeClockPage = () => {
>
Modifier
</Button>
<Button
onClick={() => handleDeleteEntry(entry.id)}
variant="destructive"
size="sm"
<ConfirmDialog
title="Supprimer le pointage"
description="Êtes-vous sûr de vouloir supprimer ce pointage ?"
onConfirm={() => handleDeleteEntry(entry.id)}
>
<Button variant="destructive" size="sm">
Supprimer
</Button>
</ConfirmDialog>
</div>
</TableCell>
)}