feat(ui): replace native confirm() with DaisyUI modal composable (F7.2)

Create useConfirm composable (promise-based, singleton state) and
ConfirmModal component. Replace all 10 confirm()/window.confirm() calls
across 9 pages and 1 composable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthieu
2026-02-09 11:20:13 +01:00
parent 046f464378
commit 6152848957
11 changed files with 152 additions and 21 deletions

View File

@@ -127,7 +127,7 @@ import { formatPhone } from '~/utils/formatters/phone'
import IconLucidePlus from '~icons/lucide/plus'
const { constructeurs, loading, searchConstructeurs, createConstructeur, updateConstructeur, deleteConstructeur, loadConstructeurs } = useConstructeurs()
const { showError, showSuccess } = useToast()
const { showError } = useToast()
const searchTerm = ref('')
const sortKey = usePersistedValue('constructeurs-sort', 'name')
@@ -211,8 +211,10 @@ const saveConstructeur = async () => {
}
}
const { confirm } = useConfirm()
const confirmDelete = async (constructeur) => {
if (!confirm(`Supprimer le fournisseur "${constructeur.name}" ?`)) { return }
if (!await confirm({ message: `Supprimer le fournisseur "${constructeur.name}" ?` })) { return }
const result = await deleteConstructeur(constructeur.id)
if (!result.success && result.error) {
showError(result.error)