[#271]Créer une nouvelle expédition (étape 1) #12

Merged
kevin merged 14 commits from feat/271-expedition-etape-1 into develop 2026-02-12 07:31:41 +00:00
5 changed files with 43 additions and 36 deletions
Showing only changes of commit 74af5d30ba - Show all commits

View File

@@ -88,8 +88,8 @@ const printReceipt = async () => {
return return
} }
/* shipmentStore.clearCurrent() shipmentStore.clearCurrent()

Supprime le commentaire

Supprime le commentaire
await router.push('/')*/ await router.push('/')
} }
// Récupère le poids dès l'arrivée sur l'écran // Récupère le poids dès l'arrivée sur l'écran

View File

@@ -1,34 +1,22 @@
import type {Ref} from 'vue' import type {Ref} from 'vue'
import {computed, ref} from 'vue' import {computed, ref} from 'vue'
import type {ReceptionData, ReceptionPayload, WeightEntryData} from '~/services/dto/reception-data' 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 type {WeightData} from '~/services/dto/weight-data'
import {getWeight} from '~/services/reception' import {getWeight} from '~/services/reception'
import {getWeightShipment} from '~/services/shipment' import {getWeightShipment} from '~/services/shipment'
import {createWeight, updateWeight} from '~/services/weight' 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' export type WeighingMode = 'gross' | 'tare'
type UseWeighingOptions = {
mode: WeighingMode
reception: Ref<ReceptionData | null>
updateReception: (id: number, payload: ReceptionPayload) => Promise<ReceptionData | null>
loadReception?: (id: number) => Promise<ReceptionData | null>
}
type UseWeighingShipmentOptions = {
modeShipment: WeighingMode
shipment: Ref<ShipmentData | null>
updateShipment: (id: number, payload: ShipmentPayload) => Promise<ShipmentData | null>
loadShipment?: (id: number) => Promise<ShipmentData | null>
}
export const useWeighing = ({ export const useWeighing = ({
mode, mode,
reception, reception,
updateReception, updateReception,
loadReception loadReception
}: UseWeighingOptions) => { }: UseWeighingOptions) => {

Fait un type dans le dto wheight.ts

Fait un type dans le dto wheight.ts
const weightData = ref<WeightData | null>(null) const weightData = ref<WeightData | null>(null)
const isFetching = ref(false) const isFetching = ref(false)

View File

@@ -1,14 +1,6 @@
import { useApi } from '~/composables/useApi' import { useApi } from '~/composables/useApi'
import type { BovinShipmentData } from '~/services/dto/bovin-shipment-data' import type { BovinShipmentData } from '~/services/dto/bovin-shipment-data'
export type BovinShipmentListResponse = import type { ShipmentBovinePayload, BovinShipmentListResponse } from '~/services/dto/bovin-shipment-data'
| BovinShipmentData[]
| { 'hydra:member'?: BovinShipmentData[] }
export type ShipmentBovinePayload = {
nbBovinSend: number
shipment: string
shipmentType: string
}
export async function getBovinShipmentList( export async function getBovinShipmentList(
shipmentIri: string shipmentIri: string

View File

@@ -6,3 +6,13 @@ export interface BovinShipmentData {
shipment?: string | null shipment?: string | null
shipmentType?: ShipmentTypeData | null shipmentType?: ShipmentTypeData | null
} }
export type ShipmentBovinePayload = {
nbBovinSend: number
shipment: string
shipmentType: string
}
export type BovinShipmentListResponse =
| BovinShipmentData[]
| { 'hydra:member'?: BovinShipmentData[] }

View File

@@ -1,5 +1,8 @@
import { useApi } from '~/composables/useApi' 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 = { export type WeightPayload = {
reception?: string reception?: string
@@ -22,3 +25,17 @@ export async function updateWeight(id: number, payload: Partial<WeightPayload>)
toastSuccessKey: 'success.weight.update' toastSuccessKey: 'success.weight.update'
}) })
} }
export type UseWeighingShipmentOptions = {
modeShipment: WeighingMode
shipment: Ref<ShipmentData | null>
updateShipment: (id: number, payload: ShipmentPayload) => Promise<ShipmentData | null>
loadShipment?: (id: number) => Promise<ShipmentData | null>
}
export type UseWeighingOptions = {
mode: WeighingMode
reception: Ref<ReceptionData | null>
updateReception: (id: number, payload: ReceptionPayload) => Promise<ReceptionData | null>
loadReception?: (id: number) => Promise<ReceptionData | null>
}