Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | #275 | Lister les expéditions en attente | ## Description de la PR ## Modification du .env ## Check list - [x] Pas de régression - [ ] TU/TI/TF rédigée - [x] TU/TI/TF OK - [x] CHANGELOG modifié Co-authored-by: Matteo <matteo@yuno.malio.fr> Reviewed-on: #23 Reviewed-by: Autin <tristan@yuno.malio.fr> Co-authored-by: kevin <kevin@yuno.malio.fr> Co-committed-by: kevin <kevin@yuno.malio.fr>
82 lines
2.9 KiB
Vue
82 lines
2.9 KiB
Vue
<template>
|
|
<div class="flex items-center justify-start gap-10">
|
|
<Icon @click="router.push('/')" name="gg:arrow-left-o" style="color: black" size="44"/>
|
|
<h1 class="text-3xl font-bold uppercase">listes des expéditions finie</h1>
|
|
</div>
|
|
|
|
<div class="ps-20 ">
|
|
<div class="mt-6 border border-slate-200 mb-16 ">
|
|
<div class="grid grid-cols-6 gap-4 bg-slate-100 px-4 py-3 text-sm font-semibold uppercase tracking-wide">
|
|
<div>Numéro</div>
|
|
<div>Date</div>
|
|
<div>Client</div>
|
|
<div>Adresse</div>
|
|
<div>Type d'expéditon</div>
|
|
<div>Poids</div>
|
|
</div>
|
|
<div
|
|
v-for="shipment in shipmentList"
|
|
:key="shipment
|
|
.id"
|
|
class="grid grid-cols-6 gap-4 px-4 py-3 text-sm hover:bg-slate-50 cursor-pointer border-t border-slate-200"
|
|
role="button"
|
|
tabindex="0"
|
|
@click="goToshipment(shipment.id)"
|
|
>
|
|
<div>{{ shipment.identificationNumber }}</div>
|
|
<div>{{ shipment.shipmentDate }}</div>
|
|
<div>{{ shipment.customer?.label }}</div>
|
|
<div>{{ shipment.address?.fullAddress }}</div>
|
|
<div>
|
|
<template v-if="formatBovinShipmentLines(shipment).length">
|
|
<div
|
|
v-for="(line, index) in formatBovinShipmentLines(shipment)"
|
|
:key="index"
|
|
class="leading-5"
|
|
>
|
|
{{ line }}
|
|
</div>
|
|
</template>
|
|
</div>
|
|
<div>{{ formatWeighing(shipment, 'gross') }} | {{ formatWeighing(shipment, 'tare') }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import type {ShipmentData} from "~/services/dto/shipment-data";
|
|
import {getShipmentList} from "~/services/shipment";
|
|
|
|
const shipmentList = ref<ShipmentData[]>()
|
|
const router = useRouter()
|
|
|
|
const formatWeighing = (shipment: ShipmentData, type: 'gross' | 'tare') => {
|
|
const entry = shipment.weights?.find((weight) => weight.type === type)
|
|
if (!entry || entry.weight == null || entry.dsd == null) {
|
|
return '—'
|
|
}
|
|
return `${entry.weight} kg`
|
|
}
|
|
|
|
const formatBovinShipmentLines = (shipment: ShipmentData) => {
|
|
if (!shipment.bovinShipments?.length) {
|
|
return []
|
|
}
|
|
return shipment.bovinShipments.map((entry) => {
|
|
const label = typeof entry.shipmentType === 'string'
|
|
? entry.shipmentType
|
|
: entry.shipmentType?.label
|
|
return `${label ?? '—'} : ${entry.nbBovinSend ?? '—'}`
|
|
})
|
|
}
|
|
|
|
const goToshipment = (id: number) => {
|
|
//router.push(`/shipment/update/${id}`)
|
|
}
|
|
|
|
onMounted(async () => {
|
|
shipmentList.value = await getShipmentList(true)
|
|
})
|
|
</script>
|