From e1f7d28f0dee320b4f9e07d804d4e1f0dba3c96c Mon Sep 17 00:00:00 2001 From: sroy Date: Thu, 26 Feb 2026 08:18:37 +0100 Subject: [PATCH] fix : bloque si bovin superieur a 52 --- frontend/pages/reception/update/[[id]].vue | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/frontend/pages/reception/update/[[id]].vue b/frontend/pages/reception/update/[[id]].vue index 5f62632..f650dff 100644 --- a/frontend/pages/reception/update/[[id]].vue +++ b/frontend/pages/reception/update/[[id]].vue @@ -607,6 +607,15 @@ async function saveBovineEntry(entry: ReceptionBovineTypeData) { }) } +function getTotalBovines() { + const totalTypes = bovineEntries.value.reduce( + (sum, entry) => sum + (entry.quantity ?? 0), + 0 + ) + return totalTypes + + (bovineOtherQuantity.value ?? 0) +} + async function syncBovineEntries() { if (!idReception) { return @@ -765,9 +774,13 @@ async function validate() { }) await syncMerchandiseEntries() } else { - await clearReceptionMerchandise(idReception) - await syncBovineEntries() - await updateReception(idReception, { + if (getTotalBovines() > 52) { + // toast/erreur UI + return + } + await clearReceptionMerchandise(idReception) + await syncBovineEntries() + await updateReception(idReception, { bovineDetail: bovineOtherQuantity.value ? String(bovineOtherQuantity.value) : null }) }