diff --git a/frontend/components/reception/reception-form.vue b/frontend/components/reception/reception-form.vue index 063a363..d5bee42 100644 --- a/frontend/components/reception/reception-form.vue +++ b/frontend/components/reception/reception-form.vue @@ -123,6 +123,7 @@ + diff --git a/frontend/i18n/locales/fr.json b/frontend/i18n/locales/fr.json index 4ea1b99..2150e3e 100644 --- a/frontend/i18n/locales/fr.json +++ b/frontend/i18n/locales/fr.json @@ -12,7 +12,10 @@ "fetch": "Impossible de récupérer la réception.", "create": "Impossible de créer la réception.", "update": "Impossible de mettre à jour la réception.", - "weigh": "Impossible de récupérer la pesée." + "weight": "Impossible de récupérer la pesée." + }, + "weight": { + "update": "Impossible de mettre à jour la pesée" }, "receptionType": { "list": "Impossible de récupérer la liste des types de réception." @@ -79,6 +82,9 @@ "carrier": { "update": "Transporteur mis à jour", "create": "Transporteur créé" + }, + "weight": { + "update": "Pesée mis à jour" } } } diff --git a/frontend/pages/admin/carrier/[[id]].vue b/frontend/pages/admin/carrier/[[id]].vue index 702a3f7..350c627 100644 --- a/frontend/pages/admin/carrier/[[id]].vue +++ b/frontend/pages/admin/carrier/[[id]].vue @@ -14,7 +14,6 @@
-
+
+

pesée

+

marchandise

+
+ @@ -141,6 +148,7 @@ import {SUPLLIER_CODE} from "~/utils/constants"; import {deleteReceptionBovine, getReceptionBovineList} from "~/services/reception-bovine"; import type {ReceptionData, ReceptionFormData} from "~/services/dto/reception-data"; import {getReception} from "~/services/reception"; +import UpdateWeight from "~/components/reception/update-weight.vue"; const router = useRouter() const receptionStore = useReceptionStore() diff --git a/frontend/services/dto/reception-data.ts b/frontend/services/dto/reception-data.ts index 2ed9a77..b81bfe9 100644 --- a/frontend/services/dto/reception-data.ts +++ b/frontend/services/dto/reception-data.ts @@ -41,6 +41,14 @@ export interface WeightEntryData { weighedAt: string | null } +export interface WeightFormData { + id: number + weight: number + type: 'gross' | 'tare' +} + + + export type ReceptionPayload = { licensePlate?: string | null receptionDate?: string @@ -72,3 +80,14 @@ export type ReceptionFormData = { driverId: string vehicleId: string } + +export type ReceptionFormWeight = { + weights: WeightFormData[] +} + +export interface ReceptionUpdatePayload { + weights: { + id: number + weight: number + }[] +} diff --git a/frontend/services/weight.ts b/frontend/services/weight.ts index b8ba1f7..7d5414a 100644 --- a/frontend/services/weight.ts +++ b/frontend/services/weight.ts @@ -16,5 +16,8 @@ export async function createWeight(payload: WeightPayload) { export async function updateWeight(id: number, payload: Partial) { const api = useApi() - return api.patch(`weights/${id}`, payload) + return api.patch(`weights/${id}`, payload,{ + toastErrorKey: 'errors.weight.update', + toastSuccessKey: 'success.weight.update' + }) }