[#271]Créer une nouvelle expédition (étape 1) #12
@@ -88,8 +88,8 @@ const printReceipt = async () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
/* shipmentStore.clearCurrent()
|
shipmentStore.clearCurrent()
|
||||||
|
|
|||||||
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
|
||||||
|
|||||||
@@ -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) => {
|
||||||
|
tristan
commented
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)
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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[] }
|
||||||
|
|||||||
@@ -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>
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user
Supprime le commentaire