confirmdialog added
This commit is contained in:
parent
8e66057ab8
commit
e0444f7ea3
@ -9,6 +9,7 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||||
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import ConfirmDialog from '@/components/ConfirmDialog';
|
||||||
|
|
||||||
const TimeClockPage = () => {
|
const TimeClockPage = () => {
|
||||||
const videoRef = useRef(null);
|
const videoRef = useRef(null);
|
||||||
@ -138,7 +139,14 @@ const TimeClockPage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDeleteEntry = async (id) => {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,13 +541,15 @@ const TimeClockPage = () => {
|
|||||||
>
|
>
|
||||||
Modifier
|
Modifier
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<ConfirmDialog
|
||||||
onClick={() => handleDeleteEntry(entry.id)}
|
title="Supprimer le pointage"
|
||||||
variant="destructive"
|
description="Êtes-vous sûr de vouloir supprimer ce pointage ?"
|
||||||
size="sm"
|
onConfirm={() => handleDeleteEntry(entry.id)}
|
||||||
>
|
>
|
||||||
|
<Button variant="destructive" size="sm">
|
||||||
Supprimer
|
Supprimer
|
||||||
</Button>
|
</Button>
|
||||||
|
</ConfirmDialog>
|
||||||
</div>
|
</div>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user