feat : ajout d'une page de creation d'une expedition

This commit is contained in:
2026-02-11 16:12:33 +01:00
parent 0181d72144
commit 5f4139fde3
31 changed files with 1292 additions and 356 deletions

View File

@@ -16,11 +16,10 @@
>Mettre en attente
</button>
</div>
<ShipmentForm v-if="!storeShipment || storeShipment.currentStep === 0"/>
<button
v-if="storeShipment?.currentStep === 1">
TEST ETAPE 2
</button>
<ShipmentForm v-if="!storeShipment || storeShipment.currentStep === 0" ref="shipmentFormRef"/>
<ShipmentWeight v-if="storeShipment?.currentStep === 1" mode="gross"/>
<ShipmentWeight v-if="storeShipment?.currentStep >= 2" mode="tare"/>
</div>
</template>
<script setup lang="ts">
@@ -28,9 +27,10 @@
import {SHIPMENT_STEP_LABELS} from "~/constants/steps";
import {storeToRefs} from "pinia";
import {useShipmentStore} from "~/stores/shipment";
import { ref, watch } from 'vue'
const shipmentStore = useShipmentStore()
const {current: storeShipment} = storeToRefs(shipmentStore)
const shipmentFormRef = ref<{ saveDraft: () => Promise<void> } | null>(null)
const route = useRoute()
const router = useRouter()
@@ -58,15 +58,9 @@ watch (
)
const saveAndHold = async () => {
if (!shipmentStore.current) {
await router.push('/')
return
if (shipmentFormRef.value) {
await shipmentFormRef.value.saveDraft()
}
await shipmentStore.updateShipment(shipmentStore.current.id, {
currentStep: shipmentStore.current.currentStep,
licencePlate: shipmentStore.current.licencePlate,
shipmentDate: shipmentStore.current.shipmentDate
})
await router.push('/')
}
const handleStepSelect = async (step: number) => {