Compare commits

...

2 Commits

Author SHA1 Message Date
gitea-actions
fee7bbb2ec chore: bump version to v0.0.77
All checks were successful
Auto Tag Develop / tag (push) Successful in 6s
Build Release Artefact / build (push) Successful in 1m47s
2026-03-24 07:33:27 +00:00
b707aae0e8 fix : bouton de mise en attente
Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
2026-03-24 08:33:13 +01:00
10 changed files with 132 additions and 31 deletions

35
.idea/workspace.xml generated
View File

@@ -4,10 +4,17 @@
<option name="autoReloadType" value="SELECTIVE" /> <option name="autoReloadType" value="SELECTIVE" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="fix : order récéption/expédition + correction style bouton récéption"> <list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="fix : style bon de récéption">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/reference.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/reference.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/config/reference.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/reference.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/reception_voucher.html.twig" beforeDir="false" afterPath="$PROJECT_DIR$/templates/reception_voucher.html.twig" afterDir="false" /> <change beforePath="$PROJECT_DIR$/frontend/components/reception/reception-form.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/reception/reception-form.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/components/shipment/shipment-form.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/shipment/shipment-form.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/components/workflow/workflow-weight.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/workflow/workflow-weight.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/composables/steps/useWeighingStep.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/composables/steps/useWeighingStep.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/composables/useWeighing.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/composables/useWeighing.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/composables/useWorkflowSteps.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/composables/useWorkflowSteps.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/pages/reception/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/reception/[[id]].vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/pages/shipment/[[id]].vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/pages/shipment/[[id]].vue" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -324,15 +331,7 @@
<workItem from="1773766075191" duration="6202000" /> <workItem from="1773766075191" duration="6202000" />
<workItem from="1773824491213" duration="24805000" /> <workItem from="1773824491213" duration="24805000" />
<workItem from="1774275549972" duration="51000" /> <workItem from="1774275549972" duration="51000" />
<workItem from="1774276665015" duration="4910000" /> <workItem from="1774276665015" duration="7447000" />
</task>
<task id="LOCAL-00029" summary="fix : gitea workflow">
<option name="closed" value="true" />
<created>1769097476629</created>
<option name="number" value="00029" />
<option name="presentableId" value="LOCAL-00029" />
<option name="project" value="LOCAL" />
<updated>1769097476629</updated>
</task> </task>
<task id="LOCAL-00030" summary="fix : script de déploiement"> <task id="LOCAL-00030" summary="fix : script de déploiement">
<option name="closed" value="true" /> <option name="closed" value="true" />
@@ -718,7 +717,15 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1774283204849</updated> <updated>1774283204849</updated>
</task> </task>
<option name="localTasksCounter" value="78" /> <task id="LOCAL-00078" summary="fix : style bon de récéption">
<option name="closed" value="true" />
<created>1774285464091</created>
<option name="number" value="00078" />
<option name="presentableId" value="LOCAL-00078" />
<option name="project" value="LOCAL" />
<updated>1774285464091</updated>
</task>
<option name="localTasksCounter" value="79" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@@ -768,7 +775,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="feat : creer une nouvelle expedtion (WIP)" />
<MESSAGE value="feat : ajout d'une page de creation d'une expedition" /> <MESSAGE value="feat : ajout d'une page de creation d'une expedition" />
<MESSAGE value="feat : changelog" /> <MESSAGE value="feat : changelog" />
<MESSAGE value="feat : lister les expeditions terminees" /> <MESSAGE value="feat : lister les expeditions terminees" />
@@ -793,7 +799,8 @@
<MESSAGE value="fix : script de déploiement + CI/CD build de l'app" /> <MESSAGE value="fix : script de déploiement + CI/CD build de l'app" />
<MESSAGE value="fix : order navbar + modification création fournisseur et client" /> <MESSAGE value="fix : order navbar + modification création fournisseur et client" />
<MESSAGE value="fix : order récéption/expédition + correction style bouton récéption" /> <MESSAGE value="fix : order récéption/expédition + correction style bouton récéption" />
<option name="LAST_COMMIT_MESSAGE" value="fix : order récéption/expédition + correction style bouton récéption" /> <MESSAGE value="fix : style bon de récéption" />
<option name="LAST_COMMIT_MESSAGE" value="fix : style bon de récéption" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View File

@@ -1,2 +1,2 @@
parameters: parameters:
app.version: '0.0.76' app.version: '0.0.77'

View File

@@ -1,5 +1,5 @@
<template> <template>
<form :class="{ submitted }" @submit.prevent="validate"> <form ref="formRef" :class="{ submitted }" @submit.prevent="validate">
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 mb-16"> <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 text-primary-500">Réception</h1> <h1 class="font-bold text-5xl uppercase col-start-1 row-start-1 text-primary-500">Réception</h1>
<UiSelect <UiSelect
@@ -141,6 +141,7 @@ const router = useRouter()
const receptionStore = useReceptionStore() const receptionStore = useReceptionStore()
const isHydrating = ref(false) const isHydrating = ref(false)
const submitted = ref(false) const submitted = ref(false)
const formRef = ref<HTMLFormElement | null>(null)
const form = reactive<ReceptionFormData>({ const form = reactive<ReceptionFormData>({
licensePlate: '', licensePlate: '',
@@ -217,7 +218,7 @@ onMounted(async () => {
await loadVehicles() await loadVehicles()
}) })
async function validate() { const buildPayload = () => {
const normalizedLicensePlate = form.licensePlate.trim() const normalizedLicensePlate = form.licensePlate.trim()
const normalizedReceptionDate = form.receptionDate.trim() const normalizedReceptionDate = form.receptionDate.trim()
const normalizedReceptionTypeId = form.receptionTypeId.trim() const normalizedReceptionTypeId = form.receptionTypeId.trim()
@@ -236,7 +237,7 @@ async function validate() {
const carrierIri = normalizedCarrierId ? `/api/carriers/${normalizedCarrierId}` : null const carrierIri = normalizedCarrierId ? `/api/carriers/${normalizedCarrierId}` : null
const driverIri = normalizedDriverId ? `/api/drivers/${normalizedDriverId}` : null const driverIri = normalizedDriverId ? `/api/drivers/${normalizedDriverId}` : null
const basePayload = { return {
licensePlate: normalizedLicensePlate, licensePlate: normalizedLicensePlate,
receptionDate: normalizedReceptionDate, receptionDate: normalizedReceptionDate,
receptionType: receptionTypeIri, receptionType: receptionTypeIri,
@@ -244,13 +245,35 @@ async function validate() {
supplier: supplierIri, supplier: supplierIri,
address: addressIri, address: addressIri,
truck: truckIri, truck: truckIri,
carrier: carrierIri carrier: carrierIri,
}
const payload = {
...basePayload,
...(isLiotCarrier.value && driverIri ? { driver: driverIri } : {}) ...(isLiotCarrier.value && driverIri ? { driver: driverIri } : {})
} }
}
const saveDraft = async () => {
const payload = buildPayload()
if (!receptionStore.current) {
await receptionStore.createReception({
currentStep: 0,
...payload
})
return
}
await receptionStore.updateReception(receptionStore.current.id, {
currentStep: receptionStore.current.currentStep,
...payload
})
}
const validateFields = () => {
submitted.value = true
return formRef.value?.reportValidity() ?? false
}
defineExpose({ saveDraft, validateFields })
async function validate() {
const payload = buildPayload()
if (!receptionStore.current) { if (!receptionStore.current) {
const created = await receptionStore.createReception({ const created = await receptionStore.createReception({

View File

@@ -1,5 +1,5 @@
<template> <template>
<form :class="{ submitted }" @submit.prevent="validate"> <form ref="formRef" :class="{ submitted }" @submit.prevent="validate">
<div class="grid grid-cols-2 h-[461px] items-start gap-y-8 gap-x-40 mb-16"> <div class="grid grid-cols-2 h-[461px] items-start gap-y-8 gap-x-40 mb-16">
<h1 class="font-bold text-5xl uppercase col-start-1 row-start-1 text-primary-500">Expédition</h1> <h1 class="font-bold text-5xl uppercase col-start-1 row-start-1 text-primary-500">Expédition</h1>
<UiSelect <UiSelect
@@ -152,6 +152,7 @@ const router = useRouter()
const shipmentStore = useShipmentStore() const shipmentStore = useShipmentStore()
const isHydrating = ref(false) const isHydrating = ref(false)
const submitted = ref(false) const submitted = ref(false)
const formRef = ref<HTMLFormElement | null>(null)
const form = reactive<ShipmentFormData>({ const form = reactive<ShipmentFormData>({
userId: '', userId: '',
@@ -286,7 +287,12 @@ const saveDraft = async () => {
}) })
} }
defineExpose({ saveDraft }) const validateFields = () => {
submitted.value = true
return formRef.value?.reportValidity() ?? false
}
defineExpose({ saveDraft, validateFields })
const validate = async () => { const validate = async () => {
const payload = buildPayload() const payload = buildPayload()

View File

@@ -60,6 +60,7 @@ const {
title, title,
fetchWeight, fetchWeight,
saveWeight, saveWeight,
saveWeightDraft,
showGenerateReceipt, showGenerateReceipt,
printReceipt printReceipt
} = useWeighingStep({ } = useWeighingStep({
@@ -75,4 +76,6 @@ const {
clearEntity: props.clearEntity, clearEntity: props.clearEntity,
buildReceiptFilename: props.buildReceiptFilename buildReceiptFilename: props.buildReceiptFilename
}) })
defineExpose({ saveWeightDraft })
</script> </script>

View File

@@ -29,7 +29,8 @@ export const useWeighingStep = (options: UseWeighingStepOptions) => {
title, title,
showLoadingBox, showLoadingBox,
fetchWeight, fetchWeight,
saveWeight saveWeight,
saveWeightDraft
} = useWeighing({ } = useWeighing({
mode: options.mode, mode: options.mode,
entity: options.entity, entity: options.entity,
@@ -71,6 +72,7 @@ export const useWeighingStep = (options: UseWeighingStepOptions) => {
showLoadingBox, showLoadingBox,
fetchWeight, fetchWeight,
saveWeight, saveWeight,
saveWeightDraft,
showGenerateReceipt, showGenerateReceipt,
printReceipt printReceipt
} }

View File

@@ -90,6 +90,38 @@ export const useWeighing = ({
} }
} }
const saveWeightDraft = async () => {
if (!entity.value) return
if (!weightData.value && !currentWeightEntry.value) return
const existingEntry = currentWeightEntry.value
const baseDsd = weightData.value?.dsd ?? existingEntry?.dsd ?? null
const baseWeight = weightData.value?.weight ?? existingEntry?.weight ?? null
const baseWeighedAt = weightData.value?.weighedAt ?? existingEntry?.weighedAt ?? null
if (baseWeight === null) return
const relationPayload: Record<string, string> = {}
relationPayload[entityName] = `/api/${apiResource}/${entity.value.id}`
if (existingEntry?.id) {
await updateWeight(existingEntry.id, {
type: mode,
dsd: baseDsd,
weight: baseWeight,
weighedAt: baseWeighedAt
})
} else {
await createWeight({
...relationPayload,
type: mode,
dsd: baseDsd,
weight: baseWeight,
weighedAt: baseWeighedAt
})
}
}
return { return {
weightData, weightData,
currentWeightEntry, currentWeightEntry,
@@ -98,7 +130,8 @@ export const useWeighing = ({
title, title,
showLoadingBox, showLoadingBox,
fetchWeight, fetchWeight,
saveWeight saveWeight,
saveWeightDraft
} }
} }

View File

@@ -48,7 +48,8 @@ export const useWorkflowSteps = (config: WorkflowConfig, store: WorkflowStore) =
return return
} }
const datePayload: Record<string, any> = {} const datePayload: Record<string, any> = {}
datePayload[config.dateField] = store.current[config.dateField] const rawDate = store.current[config.dateField]
datePayload[config.dateField] = rawDate ? rawDate.slice(0, 10) : rawDate
await store[updateMethod](store.current.id, { await store[updateMethod](store.current.id, {
currentStep: store.current.currentStep, currentStep: store.current.currentStep,
licensePlate: store.current.licensePlate, licensePlate: store.current.licensePlate,

View File

@@ -14,9 +14,10 @@
>Mettre en attente >Mettre en attente
</UiButton> </UiButton>
</div> </div>
<ReceptionForm v-if="!storeReception || storeReception.currentStep === 0"/> <ReceptionForm v-if="!storeReception || storeReception.currentStep === 0" ref="receptionFormRef"/>
<WorkflowWeight <WorkflowWeight
v-if="storeReception?.currentStep === 1" v-if="storeReception?.currentStep === 1"
ref="grossWeightRef"
mode="gross" mode="gross"
entity-name="reception" entity-name="reception"
api-resource="receptions" api-resource="receptions"
@@ -37,6 +38,7 @@
receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.BOVINS"/> receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.BOVINS"/>
<WorkflowWeight <WorkflowWeight
v-if="storeReception?.currentStep !== null && storeReception?.currentStep >= 3" v-if="storeReception?.currentStep !== null && storeReception?.currentStep >= 3"
ref="tareWeightRef"
mode="tare" mode="tare"
entity-name="reception" entity-name="reception"
api-resource="receptions" api-resource="receptions"
@@ -61,8 +63,24 @@ import { RECEPTION_TYPE_CODES } from '~/utils/constants'
const receptionStore = useReceptionStore() const receptionStore = useReceptionStore()
const { current: storeReception } = storeToRefs(receptionStore) const { current: storeReception } = storeToRefs(receptionStore)
const receptionFormRef = ref<{ saveDraft: () => Promise<void>, validateFields: () => boolean } | null>(null)
const grossWeightRef = ref<{ saveWeightDraft: () => Promise<void> } | null>(null)
const tareWeightRef = ref<{ saveWeightDraft: () => Promise<void> } | null>(null)
const { stepLabels, saveAndHold, handleStepSelect } = useWorkflowSteps(receptionConfig, receptionStore) const { stepLabels, handleStepSelect } = useWorkflowSteps(receptionConfig, receptionStore)
const router = useRouter()
const saveAndHold = async () => {
if (receptionFormRef.value) {
if (!receptionFormRef.value.validateFields()) return
await receptionFormRef.value.saveDraft()
} else {
if (grossWeightRef.value) await grossWeightRef.value.saveWeightDraft()
if (tareWeightRef.value) await tareWeightRef.value.saveWeightDraft()
}
await router.push('/')
}
// Init route watcher // Init route watcher
const route = useRoute() const route = useRoute()

View File

@@ -18,6 +18,7 @@
<ShipmentForm v-if="!storeShipment || storeShipment.currentStep === 0" ref="shipmentFormRef"/> <ShipmentForm v-if="!storeShipment || storeShipment.currentStep === 0" ref="shipmentFormRef"/>
<WorkflowWeight <WorkflowWeight
v-if="storeShipment?.currentStep === 1" v-if="storeShipment?.currentStep === 1"
ref="grossWeightRef"
mode="gross" mode="gross"
entity-name="shipment" entity-name="shipment"
api-resource="shipments" api-resource="shipments"
@@ -33,6 +34,7 @@
<ShipmentLoading v-if="storeShipment?.currentStep === 2"/> <ShipmentLoading v-if="storeShipment?.currentStep === 2"/>
<WorkflowWeight <WorkflowWeight
v-if="storeShipment?.currentStep === 3" v-if="storeShipment?.currentStep === 3"
ref="tareWeightRef"
mode="tare" mode="tare"
entity-name="shipment" entity-name="shipment"
api-resource="shipments" api-resource="shipments"
@@ -58,7 +60,9 @@ import { ref, watch } from 'vue'
const shipmentStore = useShipmentStore() const shipmentStore = useShipmentStore()
const { current: storeShipment } = storeToRefs(shipmentStore) const { current: storeShipment } = storeToRefs(shipmentStore)
const shipmentFormRef = ref<{ saveDraft: () => Promise<void> } | null>(null) const shipmentFormRef = ref<{ saveDraft: () => Promise<void>, validateFields: () => boolean } | null>(null)
const grossWeightRef = ref<{ saveWeightDraft: () => Promise<void> } | null>(null)
const tareWeightRef = ref<{ saveWeightDraft: () => Promise<void> } | null>(null)
const { stepLabels, handleStepSelect } = useWorkflowSteps(shipmentConfig, shipmentStore) const { stepLabels, handleStepSelect } = useWorkflowSteps(shipmentConfig, shipmentStore)
@@ -83,7 +87,11 @@ watch(
const saveAndHold = async () => { const saveAndHold = async () => {
if (shipmentFormRef.value) { if (shipmentFormRef.value) {
if (!shipmentFormRef.value.validateFields()) return
await shipmentFormRef.value.saveDraft() await shipmentFormRef.value.saveDraft()
} else {
if (grossWeightRef.value) await grossWeightRef.value.saveWeightDraft()
if (tareWeightRef.value) await tareWeightRef.value.saveWeightDraft()
} }
await router.push('/') await router.push('/')
} }