feat : Ajout de pinia, création de la table weight et reception mise en place du système de step pour les receptions (WIP)

This commit is contained in:
2026-01-12 18:07:58 +01:00
parent 03638d988b
commit cfe7baa4ae
31 changed files with 1226 additions and 36 deletions

View File

@@ -0,0 +1,41 @@
<template>
<div v-if="weightData">
<p>{{ weightData.weight }} kg</p>
<p>DSD : {{ weightData.dsd }}</p>
</div>
<button
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
@click="getReceptionWeight"
>Peser</button>
</template>
<script setup lang="ts">
import { getWeight } from '~/services/reception'
import type { WeightData } from '~/services/dto/weight-data'
import { useReceptionStore } from '~/stores/reception'
const isLoading = ref(false)
const weightData = ref<WeightData | null>(null)
const errorMessage = ref<string | null>(null)
const receptionStore = useReceptionStore()
async function getReceptionWeight() {
isLoading.value = true
try {
weightData.value = await getWeight()
if (receptionStore.current) {
const nextStep = receptionStore.current.currentStep + 1
await receptionStore.updateReception(receptionStore.current.id, {
dsd: weightData.value?.dsd ?? null,
weight: weightData.value?.weight ?? null,
currentStep: nextStep
})
}
} catch (error) {
errorMessage.value = error.error
} finally {
isLoading.value = false
}
}
</script>