From 348d7fc8f9ad487d28fd98b65a457810ad5c9a36 Mon Sep 17 00:00:00 2001 From: tristan Date: Wed, 29 Apr 2026 10:13:10 +0200 Subject: [PATCH] =?UTF-8?q?feat(front)=20:=20bouton=20Valider=20l'entr?= =?UTF-8?q?=C3=A9e=20avec=20confirmation=20si=20saisies=20incompl=C3=A8tes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/pages/entry-exit/entry/[id].vue | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/frontend/pages/entry-exit/entry/[id].vue b/frontend/pages/entry-exit/entry/[id].vue index 499d8f4..052cab4 100644 --- a/frontend/pages/entry-exit/entry/[id].vue +++ b/frontend/pages/entry-exit/entry/[id].vue @@ -116,7 +116,9 @@ Valider l'entrée @@ -144,6 +146,7 @@ const buildings = ref([]) const savedBovines = ref([]) const isAdding = ref(false) +const isValidating = ref(false) const recapPage = ref(1) const recapPerPage = ref(50) @@ -181,6 +184,25 @@ const confirmDeleteBovine = async (bovine: BovineData) => { await loadSavedBovines() } +const validateEntry = async () => { + if (savedBovines.value.length === 0 || isValidating.value) return + + if (savedBovines.value.length < declaredCount.value) { + const confirmed = window.confirm( + `Vous n'avez saisi que ${savedBovines.value.length}/${declaredCount.value} bovins. Confirmer la fermeture de l'entrée ?` + ) + if (!confirmed) return + } + + isValidating.value = true + try { + await api.patch(`receptions/${receptionId.value}`, { entryCompleted: true }) + router.push('/entry-exit') + } finally { + isValidating.value = false + } +} + interface FormState { nationalNumber: string receivedWeight: number | null