diff --git a/CHANGELOG.md b/CHANGELOG.md
index 70c1510..daaca58 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -49,6 +49,7 @@ Ajouter dans le fichier .env du frontend
* fix layout admin
* Creation page admin listing bovins
* Creation page admin ajout/modification bovins
+* [#331] Mettre à jour l'entité Shipment et bovin_shipment
### Changed
### Fixed
diff --git a/frontend/components/shipment/shipment-weight.vue b/frontend/components/shipment/shipment-weight.vue
index 4f8766b..0876f79 100644
--- a/frontend/components/shipment/shipment-weight.vue
+++ b/frontend/components/shipment/shipment-weight.vue
@@ -75,7 +75,7 @@ const printReceipt = async () => {
await saveWeight()
const shipment = shipmentStore.current
- const filename = `${shipment.identificationNumber ?? shipment.id}_${shipment.customer?.name ?? 'client'}_${shipment.licencePlate ?? 'immat'}.pdf`
+ const filename = `${shipment.identificationNumber ?? shipment.id}_${shipment.customer?.label ?? 'client'}_${shipment.licencePlate ?? 'immat'}.pdf`
await printPdf(`/shipments/${shipment.id}/receipt`, filename)
// Laisse le temps a la boite de dialogue d'impression de s'ouvrir.
diff --git a/frontend/pages/shipment/finish-shipment.vue b/frontend/pages/shipment/finish-shipment.vue
index 4a0cee2..451da2c 100644
--- a/frontend/pages/shipment/finish-shipment.vue
+++ b/frontend/pages/shipment/finish-shipment.vue
@@ -28,9 +28,9 @@
{{ shipment.customer?.name }}
{{ shipment.address?.fullAddress }}
-
+
@@ -62,16 +62,17 @@ const formatWeighing = (shipment: ShipmentData) => {
return `${gross - tare} kg`
}
-const formatBovinShipmentLines = (shipment: ShipmentData) => {
- if (!shipment.bovinShipments?.length) {
+
+const formatShipmentLines = (shipment: ShipmentData) => {
+ if (!shipment.shipmentType && shipment.nbBovinSend == null) {
return []
}
- return shipment.bovinShipments.map((entry) => {
- const label = typeof entry.shipmentType === 'string'
- ? entry.shipmentType
- : entry.shipmentType?.label
- return `${label ?? '—'} : ${entry.nbBovinSend ?? '—'}`
- })
+
+ const label = typeof shipment.shipmentType === 'string'
+ ? shipment.shipmentType
+ : shipment.shipmentType?.label
+
+ return [`${label ?? '—'} : ${shipment.nbBovinSend ?? '—'}`]
}
const goShipment = (id: number) => {
diff --git a/frontend/pages/shipment/waiting-shipment.vue b/frontend/pages/shipment/waiting-shipment.vue
index 3274d4d..eb8906e 100644
--- a/frontend/pages/shipment/waiting-shipment.vue
+++ b/frontend/pages/shipment/waiting-shipment.vue
@@ -24,12 +24,12 @@
@click="goToShipment(shipment.id)"
@keydown.enter="goToShipment(shipment.id)"
>
-
{{ shipment.customer?.label }}
+
{{ shipment.customer?.name }}
{{ shipment.address?.fullAddress }}
-
+
@@ -55,16 +55,17 @@ const router = useRouter()
const goToShipment = (id: number) => {
router.push(`/shipment/${id}`)
}
-const formatBovinShipmentLines = (shipment: ShipmentData) => {
- if (!shipment.bovinShipments?.length) {
+
+const formatShipmentLines = (shipment: ShipmentData) => {
+ if (!shipment.shipmentType && shipment.nbBovinSend == null) {
return []
}
- return shipment.bovinShipments.map((entry) => {
- const label = typeof entry.shipmentType === 'string'
- ? entry.shipmentType
- : entry.shipmentType?.label
- return `${label ?? '—'} : ${entry.nbBovinSend ?? '—'}`
- })
+
+ const label = typeof shipment.shipmentType === 'string'
+ ? shipment.shipmentType
+ : shipment.shipmentType?.label
+
+ return [`${label ?? '—'} : ${shipment.nbBovinSend ?? '—'}`]
}
onMounted(async () => {