From 7d69860edc2315973759c01c8878bca8a182795d Mon Sep 17 00:00:00 2001 From: tristan Date: Mon, 4 May 2026 14:07:34 +0200 Subject: [PATCH] feat(front) : retouches UX saisie bovin (filtre, toast, partial save, fix isSaisi) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - isSaisi : != null couvre les champs absents du JSON (API Platform strip null) - UiNumberInput : ne réécrit target.value que si réellement clampé (fix saisie décimaux) - Form : champs optionnels, payload partiel, toast de confirmation - Page : filtre N° national au-dessus de la liste Co-Authored-By: Claude Opus 4.7 (1M context) --- .../entry-exit/bovine-info-form.vue | 42 ++++----- frontend/components/ui/UiNumberInput.vue | 4 +- .../pages/entry-exit/bovine-info/[id].vue | 93 ++++++++++++------- 3 files changed, 84 insertions(+), 55 deletions(-) diff --git a/frontend/components/entry-exit/bovine-info-form.vue b/frontend/components/entry-exit/bovine-info-form.vue index 068b3c3..8003f95 100644 --- a/frontend/components/entry-exit/bovine-info-form.vue +++ b/frontend/components/entry-exit/bovine-info-form.vue @@ -1,32 +1,32 @@ @@ -53,6 +66,7 @@ import type { BovineData } from '~/services/dto/bovine-data' import type { BuildingData } from '~/services/dto/building-data' import type { ReceptionData } from '~/services/dto/reception-data' import { getBuildingList } from '~/services/building' +import BovineInfoForm from '~/components/entry-exit/bovine-info-form.vue' const route = useRoute() const router = useRouter() @@ -65,15 +79,22 @@ const bovines = ref([]) const buildings = ref([]) const loading = ref(true) const openId = ref(null) +const searchQueryRaw = ref('') +const searchQuery = computed({ + get: () => searchQueryRaw.value, + set: (value) => { + searchQueryRaw.value = value.replace(/\D/g, '') + } +}) useHead({ title: () => `Saisie information bovin ${reception.value?.identificationNumber ?? ''}`.trim() }) const isSaisi = (bovine: BovineData) => - bovine.receivedWeight !== null - && bovine.pricePerKg !== null - && bovine.buildingCase !== null + bovine.receivedWeight != null + && bovine.pricePerKg != null + && bovine.buildingCase != null const sortedBovines = computed(() => { const pending = bovines.value.filter(b => !isSaisi(b)) @@ -81,6 +102,14 @@ const sortedBovines = computed(() => { return [...pending, ...done] }) +const filteredBovines = computed(() => { + const query = searchQuery.value.trim().toLowerCase() + if (!query) return sortedBovines.value + return sortedBovines.value.filter(b => + b.nationalNumber.toLowerCase().includes(query) + ) +}) + const onToggle = (bovineId: number, value: boolean) => { openId.value = value ? bovineId : null }