diff --git a/frontend/components/shipment/shipment-weight.vue b/frontend/components/shipment/shipment-weight.vue index 07bcf47..cf4d7f0 100644 --- a/frontend/components/shipment/shipment-weight.vue +++ b/frontend/components/shipment/shipment-weight.vue @@ -88,8 +88,8 @@ const printReceipt = async () => { return } -/* shipmentStore.clearCurrent() - await router.push('/')*/ + shipmentStore.clearCurrent() + await router.push('/') } // Récupère le poids dès l'arrivée sur l'écran diff --git a/frontend/composables/useWeighing.ts b/frontend/composables/useWeighing.ts index 25adbea..f632b5b 100644 --- a/frontend/composables/useWeighing.ts +++ b/frontend/composables/useWeighing.ts @@ -1,34 +1,22 @@ import type {Ref} from 'vue' import {computed, ref} from 'vue' import type {ReceptionData, ReceptionPayload, WeightEntryData} from '~/services/dto/reception-data' -import type {ShipmentData, ShipmentPayload, WeightShipmentEntryData } from '~/services/dto/shipment-data' import type {WeightData} from '~/services/dto/weight-data' import {getWeight} from '~/services/reception' import {getWeightShipment} from '~/services/shipment' import {createWeight, updateWeight} from '~/services/weight' +import type {UseWeighingShipmentOptions, UseWeighingOptions} from '~/services/weight' +import type {WeightShipmentEntryData} from "~/services/dto/shipment-data"; export type WeighingMode = 'gross' | 'tare' -type UseWeighingOptions = { - mode: WeighingMode - reception: Ref - updateReception: (id: number, payload: ReceptionPayload) => Promise - loadReception?: (id: number) => Promise -} - -type UseWeighingShipmentOptions = { - modeShipment: WeighingMode - shipment: Ref - updateShipment: (id: number, payload: ShipmentPayload) => Promise - loadShipment?: (id: number) => Promise -} export const useWeighing = ({ - mode, - reception, - updateReception, - loadReception -}: UseWeighingOptions) => { + mode, + reception, + updateReception, + loadReception + }: UseWeighingOptions) => { const weightData = ref(null) const isFetching = ref(false) @@ -108,11 +96,11 @@ export const useWeighing = ({ } export const useWeighingShipment = ({ - modeShipment, - shipment, - updateShipment, - loadShipment - }: UseWeighingShipmentOptions) => { + modeShipment, + shipment, + updateShipment, + loadShipment + }: UseWeighingShipmentOptions) => { const weightData = ref(null) const isFetching = ref(false) diff --git a/frontend/services/bovin-shipment.ts b/frontend/services/bovin-shipment.ts index 45871dc..d14e855 100644 --- a/frontend/services/bovin-shipment.ts +++ b/frontend/services/bovin-shipment.ts @@ -1,14 +1,6 @@ import { useApi } from '~/composables/useApi' import type { BovinShipmentData } from '~/services/dto/bovin-shipment-data' -export type BovinShipmentListResponse = - | BovinShipmentData[] - | { 'hydra:member'?: BovinShipmentData[] } - -export type ShipmentBovinePayload = { - nbBovinSend: number - shipment: string - shipmentType: string -} +import type { ShipmentBovinePayload, BovinShipmentListResponse } from '~/services/dto/bovin-shipment-data' export async function getBovinShipmentList( shipmentIri: string diff --git a/frontend/services/dto/bovin-shipment-data.ts b/frontend/services/dto/bovin-shipment-data.ts index e3bdd42..6bbca73 100644 --- a/frontend/services/dto/bovin-shipment-data.ts +++ b/frontend/services/dto/bovin-shipment-data.ts @@ -6,3 +6,13 @@ export interface BovinShipmentData { shipment?: string | null shipmentType?: ShipmentTypeData | null } + +export type ShipmentBovinePayload = { + nbBovinSend: number + shipment: string + shipmentType: string +} + +export type BovinShipmentListResponse = + | BovinShipmentData[] + | { 'hydra:member'?: BovinShipmentData[] } diff --git a/frontend/services/weight.ts b/frontend/services/weight.ts index 2e03c1f..6c9243c 100644 --- a/frontend/services/weight.ts +++ b/frontend/services/weight.ts @@ -1,5 +1,8 @@ import { useApi } from '~/composables/useApi' -import type { WeightEntryData } from '~/services/dto/reception-data' +import type {ReceptionData, ReceptionPayload, WeightEntryData} from '~/services/dto/reception-data' +import type {Ref} from "vue"; +import type {ShipmentData, ShipmentPayload} from "~/services/dto/shipment-data"; +import type {WeighingMode} from "~/composables/useWeighing"; export type WeightPayload = { reception?: string @@ -22,3 +25,17 @@ export async function updateWeight(id: number, payload: Partial) toastSuccessKey: 'success.weight.update' }) } + +export type UseWeighingShipmentOptions = { + modeShipment: WeighingMode + shipment: Ref + updateShipment: (id: number, payload: ShipmentPayload) => Promise + loadShipment?: (id: number) => Promise +} + +export type UseWeighingOptions = { + mode: WeighingMode + reception: Ref + updateReception: (id: number, payload: ReceptionPayload) => Promise + loadReception?: (id: number) => Promise +}