Compare commits

...

4 Commits

Author SHA1 Message Date
358133e4f5 Merge branch 'refs/heads/develop' into feat/320-afffichage-modification-reception-terminee-suite
# Conflicts:
#	frontend/pages/reception/update/[[id]].vue
#	frontend/services/dto/reception-data.ts
2026-02-10 16:05:28 +01:00
df12cce54c feat : sauvegarde01 partie 2 2026-02-10 16:01:40 +01:00
gitea-actions
fade51d3ee chore: bump version to v0.0.37
All checks were successful
Auto Tag Develop / tag (push) Successful in 4s
Build Release Artefact / build (push) Successful in 1m13s
2026-02-10 11:05:15 +00:00
9ca0a7511b [#318] Affichage d'une reception terminée (!19)
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket |
|------------------|-----------------|
|        #318          |          Affichage d'une reception terminée       |

## Description de la PR

## Modification du .env

## Check list

- [x] Pas de régression
- [ ] TU/TI/TF rédigée
- [x] TU/TI/TF OK
- [x] CHANGELOG modifié

Reviewed-on: #19
Reviewed-by: Autin <tristan@yuno.malio.fr>
Co-authored-by: sroy <sebastien@yuno.malio.fr>
Co-committed-by: sroy <sebastien@yuno.malio.fr>
2026-02-10 11:05:07 +00:00
8 changed files with 107 additions and 4 deletions

View File

@@ -1,2 +1,2 @@
parameters:
app.version: '0.0.36'
app.version: '0.0.37'

View File

@@ -123,6 +123,7 @@
</button>
</div>
</form>
</template>
<script setup lang="ts">

View File

@@ -0,0 +1,67 @@
<template>
<form @submit.prevent="validate">
<div class="grid grid-cols-2 gap-x-40 gap-y-8 mb-16">
<UiNumberInput
label="Pesée à vide"
v-model="form.weights[0].weight"
:min="0"
/>
<UiNumberInput
label="Pesée à plein"
v-model="form.weights[1].weight"
:min="0"
/>
</div>
<button
type="submit"
class="bg-primary-500 text-white px-6 py-3 rounded-md"
>
Enregistrer
</button>
</form>
</template>
<script setup lang="ts">
import type {ReceptionFormWeight, ReceptionUpdatePayload} from '~/services/dto/reception-data'
import { getReception } from '~/services/reception'
import { useReceptionStore } from '~/stores/reception'
import {updateWeight} from "~/services/weight";
const props = defineProps<{
idReception: number
}>()
const receptionStore = useReceptionStore()
const router = useRouter()
const form = reactive({
weights: [
{ id: 0, type: 'tare' as const, weight: 0 },
{ id: 0, type: 'gross' as const, weight: 0 }
]
})
const hydrateFromReception = (reception: ReceptionFormWeight) => {
const tare = reception.weights.find(weight => weight.type === 'tare')
const gross = reception.weights.find(weight => weight.type === 'gross')
if (tare) form.weights[0] = { ...tare }
if (gross) form.weights[1] = { ...gross }
}
onMounted(async () => {
const reception = await getReception(props.idReception)
hydrateFromReception(reception)
})
async function validate() {
for (const weight of form.weights) {
if (weight.id) {
await updateWeight(weight.id, {weight: weight.weight})
}
}
}
</script>

View File

@@ -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"
}
}
}

View File

@@ -14,7 +14,6 @@
</div>
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 mb-16">
<UiTextInput
label = "nom du fournisseur"
id="carrier-name"

View File

@@ -119,6 +119,13 @@
wrapper-class="col-start-2 row-start-4"
/>
</div>
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 mb-16">
<h1 class="font-bold text-5xl uppercase col-start-1 row-start-1">pesée</h1>
<h1 class="font-bold text-5xl uppercase col-start-2 row-start-1">marchandise</h1>
</div>
<update-weight
:idReception="idReception"
/>
</form>
</template>
@@ -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()

View File

@@ -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
}[]
}

View File

@@ -16,5 +16,8 @@ export async function createWeight(payload: WeightPayload) {
export async function updateWeight(id: number, payload: Partial<WeightPayload>) {
const api = useApi()
return api.patch<WeightEntryData>(`weights/${id}`, payload)
return api.patch<WeightEntryData>(`weights/${id}`, payload,{
toastErrorKey: 'errors.weight.update',
toastSuccessKey: 'success.weight.update'
})
}