diff --git a/CHANGELOG.md b/CHANGELOG.md index 308b37e..4016f64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Ajouter dans le fichier .env du frontend * [#315] Creation page admin utilisateur * [#317] Admin modification creation transporteur * [#318] Affichage modification reception terminée +* [#320] Affichage modification reception terminée suite ### Changed 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/components/reception/update-merchandise.vue b/frontend/components/reception/update-merchandise.vue new file mode 100644 index 0000000..e3c72a6 --- /dev/null +++ b/frontend/components/reception/update-merchandise.vue @@ -0,0 +1,257 @@ + + + diff --git a/frontend/components/reception/update-weight.vue b/frontend/components/reception/update-weight.vue new file mode 100644 index 0000000..2f97c5c --- /dev/null +++ b/frontend/components/reception/update-weight.vue @@ -0,0 +1,74 @@ + + + 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 @@
- Enregistrer
@@ -119,6 +120,28 @@ wrapper-class="col-start-2 row-start-4" /> +
+

pesées

+

{{isMerchandise ? "Marchandises" : "Bovins"}}

+
+ + + + + + @@ -141,6 +164,9 @@ 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"; +import UpdateMerchandise from "~/components/reception/update-merchandise.vue"; +import UpdateBovin from "~/components/reception/update-bovin.vue"; const router = useRouter() const receptionStore = useReceptionStore() @@ -179,6 +205,8 @@ const idReception = Number(route.params.id) const receptionLoad = await getReception(idReception) const receptionType = receptionLoad.receptionType const auth = useAuthStore() +const isBtWeight = ref(true) +const isMerchandise = ref(receptionType.code === 'MARCHANDISES') // Transporteur sélectionné dans le formulaire const selectedCarrier = computed(() => 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' + }) }