diff --git a/frontend/components/address.vue b/frontend/components/address.vue index cd8abb6..cb6e64b 100644 --- a/frontend/components/address.vue +++ b/frontend/components/address.vue @@ -12,7 +12,7 @@ type="submit" :disabled="isLoading" > - + {{ props.address? "Valider" : "Ajouter" }} diff --git a/frontend/pages/reception/update/[[id]].vue b/frontend/pages/reception/update/[[id]].vue index 62dfd11..8c564a1 100644 --- a/frontend/pages/reception/update/[[id]].vue +++ b/frontend/pages/reception/update/[[id]].vue @@ -190,7 +190,6 @@ type="submit" class="inline-flex mb-16 items-center justify-center text-xl text-white uppercase bg-primary-500 h-[50px] px-8 rounded hover:opacity-80 gap-2 justify-self-end" > - Valider diff --git a/frontend/pages/shipment/update/[[id]].vue b/frontend/pages/shipment/update/[[id]].vue index d34c003..556d697 100644 --- a/frontend/pages/shipment/update/[[id]].vue +++ b/frontend/pages/shipment/update/[[id]].vue @@ -256,13 +256,19 @@ const selectedCarrier = computed(() => carriers.value.find((carrier) => String(carrier.id) === form.carrierId) ?? null ) const isLiotCarrier = computed(() => selectedCarrier.value?.code === SUPPLIER_CODE.LIOT) +const isAddressData = (value: unknown): value is AddressData => + typeof value === 'object' && + value !== null && + 'id' in value && + 'fullAddress' in value const customerAddresses = computed(() => { + if (!form.customerId) return [] const customerId = Number(form.customerId) - if (!Number.isFinite(customerId)) { - return [] - } - return customers.value.find((customer) => customer.id === customerId)?.addresses ?? [] + if (!Number.isFinite(customerId) || customerId <= 0) return [] + + const addresses = customers.value.find((c) => c.id === customerId)?.addresses ?? [] + return addresses.filter(isAddressData) }) const customerAddressOptions = computed(() =>