Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c52f22472d | ||
| e7421e985e | |||
|
|
0d258ae9c6 | ||
| 7dd615ea34 | |||
|
|
6eee0745a7 | ||
| 845f94db8c | |||
|
|
86c0e74074 | ||
| be29daf4d1 |
@@ -47,7 +47,9 @@ Ajouter dans le fichier .env du frontend
|
|||||||
* [#326] Admin modification creation client
|
* [#326] Admin modification creation client
|
||||||
* [#325] Correction diverses
|
* [#325] Correction diverses
|
||||||
* fix layout admin
|
* fix layout admin
|
||||||
|
* Creation page admin listing bovins
|
||||||
|
* Creation page admin ajout/modification bovins
|
||||||
|
* [#331] Mettre à jour l'entité Shipment et bovin_shipment
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
parameters:
|
parameters:
|
||||||
app.version: '0.0.48'
|
app.version: '0.0.52'
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NuxtLink :to="link">
|
<NuxtLink :to="link">
|
||||||
<div class="w-[324px] h-[228px] border border-black rounded-lg p-6 flex flex-col justify-between">
|
<div class="w-[300px] h-[216px] border border-black rounded-lg p-6 flex flex-col justify-between gap-4">
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<div class="rounded-full w-[80px] h-[80px] bg-[#D9D9D9] flex justify-center items-center">
|
<div class="rounded-full w-[80px] h-[80px] bg-[#D9D9D9] flex justify-center items-center">
|
||||||
<Icon :name="iconName" style="color: black" size="44" />
|
<Icon :name="iconName" style="color: black" size="44" />
|
||||||
@@ -12,12 +12,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="uppercase font-bold">
|
<div class="uppercase font-bold">
|
||||||
<p class="text-3xl"> {{ label }} </p>
|
<p class="text-3xl text-primary-500">
|
||||||
|
<slot name="label">{{ label }}</slot>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -27,4 +27,3 @@ const props = defineProps<{
|
|||||||
label: string
|
label: string
|
||||||
}>()
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
v-if="receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.BOVINS"
|
v-if="receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.BOVINS"
|
||||||
class="flex flex-col items-center gap-16">
|
class="flex flex-col items-center gap-16">
|
||||||
<h1 class="text-4xl uppercase font-bold">Sélection des races réceptionnées</h1>
|
<h1 class="text-4xl uppercase font-bold text-primary-500">Sélection des races réceptionnées</h1>
|
||||||
<div
|
<div
|
||||||
class="flex flex-row gap-8 items-center">
|
class="flex flex-row gap-8 items-center">
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<form @submit.prevent="validate">
|
<form @submit.prevent="validate">
|
||||||
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 mb-16">
|
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 mb-16">
|
||||||
<h1 class="font-bold text-5xl uppercase col-start-1 row-start-1">Réception</h1>
|
<h1 class="font-bold text-5xl uppercase col-start-1 row-start-1 text-primary-500">Réception</h1>
|
||||||
<!-- Nom de l'utilisateur -->
|
<!-- Nom de l'utilisateur -->
|
||||||
<UiSelect
|
<UiSelect
|
||||||
id="reception-user"
|
id="reception-user"
|
||||||
@@ -81,21 +81,8 @@
|
|||||||
select-class="h-[34px]"
|
select-class="h-[34px]"
|
||||||
wrapper-class="col-start-2 row-start-3"
|
wrapper-class="col-start-2 row-start-3"
|
||||||
/>
|
/>
|
||||||
<!-- Chauffeur (LIOT) -->
|
|
||||||
<UiSelect
|
|
||||||
id="reception-driver"
|
|
||||||
v-model="form.driverId"
|
|
||||||
label="Nom du chauffeur si LIOT"
|
|
||||||
:options="filteredDrivers.map((driver) => ({
|
|
||||||
value: String(driver.id),
|
|
||||||
label: driver.name
|
|
||||||
}))"
|
|
||||||
:loading="isLoadingDrivers"
|
|
||||||
v-if="isLiotCarrier"
|
|
||||||
wrapper-class="col-start-2 row-start-4"
|
|
||||||
/>
|
|
||||||
<!-- Plaque d'immatriculation -->
|
<!-- Plaque d'immatriculation -->
|
||||||
<div v-if="!isLiotCarrier" class="col-start-2 row-start-5">
|
<div v-if="!isLiotCarrier" class="col-start-2 row-start-4">
|
||||||
<UiLicensePlateInput
|
<UiLicensePlateInput
|
||||||
v-model="form.licensePlate"
|
v-model="form.licensePlate"
|
||||||
v-model:allowAny="allowAnyLicensePlate"
|
v-model:allowAny="allowAnyLicensePlate"
|
||||||
@@ -113,15 +100,28 @@
|
|||||||
}))"
|
}))"
|
||||||
:loading="isLoadingVehicles"
|
:loading="isLoadingVehicles"
|
||||||
:disabled="isLoadingVehicles || filteredVehicles.length === 0"
|
:disabled="isLoadingVehicles || filteredVehicles.length === 0"
|
||||||
|
wrapper-class="col-start-2 row-start-4 h-[64px]"
|
||||||
|
/>
|
||||||
|
<!-- Chauffeur (LIOT) -->
|
||||||
|
<UiSelect
|
||||||
|
id="reception-driver"
|
||||||
|
v-model="form.driverId"
|
||||||
|
label="Nom du chauffeur si LIOT"
|
||||||
|
:options="filteredDrivers.map((driver) => ({
|
||||||
|
value: String(driver.id),
|
||||||
|
label: driver.name
|
||||||
|
}))"
|
||||||
|
:loading="isLoadingDrivers"
|
||||||
|
v-if="isLiotCarrier"
|
||||||
wrapper-class="col-start-2 row-start-5"
|
wrapper-class="col-start-2 row-start-5"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<button
|
<UiButton
|
||||||
type="submit"
|
type="submit"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] justify-self-end"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] justify-self-end"
|
||||||
>Valider
|
>Valider
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div
|
<div
|
||||||
v-if="receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.MERCHANDISES"
|
v-if="receptionStore.current?.receptionType?.code === RECEPTION_TYPE_CODES.MERCHANDISES"
|
||||||
class="flex flex-col gap-16 items-center w-full">
|
class="flex flex-col gap-16 items-center w-full">
|
||||||
<h1 class="text-4xl uppercase font-bold">Sélection des marchandises réceptionnnées</h1>
|
<h1 class="text-4xl uppercase font-bold text-primary-500">Sélection des marchandises réceptionnnées</h1>
|
||||||
<UiSelect
|
<UiSelect
|
||||||
id="merchandise-type"
|
id="merchandise-type"
|
||||||
v-model="selectedMerchandiseTypeId"
|
v-model="selectedMerchandiseTypeId"
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
>
|
>
|
||||||
<div class="grid grid-cols-1 gap-10 md:grid-cols-4">
|
<div class="grid grid-cols-1 gap-10 md:grid-cols-4">
|
||||||
<div v-for="type in pelletTypes" :key="type.id" class="flex flex-col gap-4">
|
<div v-for="type in pelletTypes" :key="type.id" class="flex flex-col gap-4">
|
||||||
<p class="font-bold uppercase">{{ type.label }}</p>
|
<p class="font-bold uppercase text-primary-500">{{ type.label }}</p>
|
||||||
<div
|
<div
|
||||||
v-for="building in buildings"
|
v-for="building in buildings"
|
||||||
:key="building.id"
|
:key="building.id"
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<div class="flex flex-col items-center w-[660px]">
|
<div class="flex flex-col items-center w-[660px]">
|
||||||
<h1 class="font-bold text-5xl uppercase">{{ title }}</h1>
|
<h1 class="font-bold text-5xl uppercase text-primary-500">{{ title }}</h1>
|
||||||
<!--@TODO Voir comment faire pour savoir si le pont-bascule et bien connecté + ajouter un icon comme sur la maquette-->
|
<!--@TODO Voir comment faire pour savoir si le pont-bascule et bien connecté + ajouter un icon comme sur la maquette-->
|
||||||
<p class="text-primary-500 uppercase text-2xl mt-2">Pont-bascule connecté</p>
|
<p class="text-primary-500 uppercase text-2xl text-primary-500 mt-2">Pont-bascule connecté</p>
|
||||||
<div
|
<div
|
||||||
v-if="showLoadingBox"
|
v-if="showLoadingBox"
|
||||||
class="w-full flex flex-col items-center justify-center border border-black h-[90px] mt-12 mb-[86px]">
|
class="w-full flex flex-col items-center justify-center border border-black h-[90px] mt-12 mb-[86px]">
|
||||||
@@ -11,27 +11,27 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else-if="displayWeight !== null" class="w-full">
|
<div v-else-if="displayWeight !== null" class="w-full">
|
||||||
<div
|
<div
|
||||||
class="w-full flex flex-col items-center justify-center border border-black h-[90px] mt-12 mb-[25px] text-4xl">
|
class="w-full flex flex-col items-center justify-center border border-black h-[90px] mt-12 mb-[25px] text-4xl text-primary-500">
|
||||||
{{ displayWeight }} kg
|
{{ displayWeight }} kg
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center mt-[54px]">
|
<div class="flex justify-center mt-[54px]">
|
||||||
<button
|
<UiButton
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
@click="fetchWeight"
|
@click="fetchWeight"
|
||||||
>{{ displayWeight !== null ? 'refaire une pesee' : 'peser' }}</button>
|
>{{ displayWeight !== null ? 'refaire une pesée' : 'peser' }}</UiButton>
|
||||||
<button
|
<UiButton
|
||||||
v-if="displayWeight !== null && !showGenerateReceipt"
|
v-if="displayWeight !== null && !showGenerateReceipt"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
||||||
@click="saveWeight"
|
@click="saveWeight"
|
||||||
>Valider</button>
|
>Valider la pesée</UiButton>
|
||||||
<button
|
<UiButton
|
||||||
v-if="showGenerateReceipt"
|
v-if="showGenerateReceipt"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
||||||
@click="printReceipt"
|
@click="printReceipt"
|
||||||
>Générer le bon</button>
|
>Générer le bon</UiButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,12 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<UiButton
|
||||||
type="submit"
|
type="submit"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
:disabled="!auth.isAdmin"
|
:disabled="!auth.isAdmin"
|
||||||
>Valider
|
>Valider
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -67,13 +67,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<UiButton
|
||||||
v-if="auth.isAdmin"
|
v-if="auth.isAdmin"
|
||||||
type="submit"
|
type="submit"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
:disabled="!auth.isAdmin"
|
:disabled="!auth.isAdmin"
|
||||||
>Valider
|
>Valider
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -30,14 +30,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<button
|
<UiButton
|
||||||
v-if="auth.isAdmin"
|
v-if="auth.isAdmin"
|
||||||
type="submit"
|
type="submit"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
|
|
||||||
>
|
>
|
||||||
Valider
|
Valider
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<form @submit.prevent="validate">
|
<form @submit.prevent="validate">
|
||||||
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 mb-16">
|
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 mb-16">
|
||||||
<h1 class="font-bold text-5xl uppercase col-start-1 row-start-1">Expédition</h1>
|
<h1 class="font-bold text-5xl uppercase col-start-1 row-start-1 text-primary-500">Expédition</h1>
|
||||||
<!-- Nom de l'utilisateur -->
|
<!-- Nom de l'utilisateur -->
|
||||||
<UiSelect
|
<UiSelect
|
||||||
id="shipment-user"
|
id="shipment-user"
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
/>
|
/>
|
||||||
<!-- Type d'expédition -->
|
<!-- Type d'expédition -->
|
||||||
<div class="col-start-1 row-start-4 h-[64px]">
|
<div class="col-start-1 row-start-4 h-[64px]">
|
||||||
<div class="flex items-end gap-8">
|
<div class="flex items-end gap-8 justify-between">
|
||||||
<UiRadioGroup
|
<UiRadioGroup
|
||||||
id="shipment-type"
|
id="shipment-type"
|
||||||
name="shipment-type"
|
name="shipment-type"
|
||||||
label="Type d'expédition"
|
label="Type d'expédition bovine"
|
||||||
v-model="selectedShipmentTypeId"
|
v-model="selectedShipmentTypeId"
|
||||||
:options="bovineShipment.map((type) => ({
|
:options="bovineShipment.map((type) => ({
|
||||||
value: String(type.id),
|
value: String(type.id),
|
||||||
@@ -89,21 +89,8 @@
|
|||||||
}))"
|
}))"
|
||||||
wrapper-class="col-start-2 row-start-3"
|
wrapper-class="col-start-2 row-start-3"
|
||||||
/>
|
/>
|
||||||
<!-- Chauffeur (LIOT) -->
|
|
||||||
<UiSelect
|
|
||||||
id="shipment-driver"
|
|
||||||
v-model="form.driverId"
|
|
||||||
label="Nom du chauffeur si LIOT"
|
|
||||||
:options="filteredDrivers.map((driver) => ({
|
|
||||||
value: String(driver.id),
|
|
||||||
label: driver.name
|
|
||||||
}))"
|
|
||||||
:loading="isLoadingDrivers"
|
|
||||||
wrapper-class="col-start-2 row-start-4"
|
|
||||||
v-if="isLiotCarrier"
|
|
||||||
/>
|
|
||||||
<!-- Plaque d'immatriculation (hors LIOT) -->
|
<!-- Plaque d'immatriculation (hors LIOT) -->
|
||||||
<div v-if="!isLiotCarrier" class="col-start-2 row-start-5">
|
<div v-if="!isLiotCarrier" class="col-start-2 row-start-4">
|
||||||
<UiLicensePlateInput
|
<UiLicensePlateInput
|
||||||
v-model="form.licencePlate"
|
v-model="form.licencePlate"
|
||||||
v-model:allowAny="allowAnyLicensePlate"
|
v-model:allowAny="allowAnyLicensePlate"
|
||||||
@@ -121,15 +108,28 @@
|
|||||||
}))"
|
}))"
|
||||||
:loading="isLoadingVehicles"
|
:loading="isLoadingVehicles"
|
||||||
:disabled="isLoadingVehicles || filteredVehicles.length === 0"
|
:disabled="isLoadingVehicles || filteredVehicles.length === 0"
|
||||||
|
wrapper-class="col-start-2 row-start-4"
|
||||||
|
/>
|
||||||
|
<!-- Chauffeur (LIOT) -->
|
||||||
|
<UiSelect
|
||||||
|
id="shipment-driver"
|
||||||
|
v-model="form.driverId"
|
||||||
|
label="Nom du chauffeur si LIOT"
|
||||||
|
:options="filteredDrivers.map((driver) => ({
|
||||||
|
value: String(driver.id),
|
||||||
|
label: driver.name
|
||||||
|
}))"
|
||||||
|
:loading="isLoadingDrivers"
|
||||||
wrapper-class="col-start-2 row-start-5"
|
wrapper-class="col-start-2 row-start-5"
|
||||||
|
v-if="isLiotCarrier"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<button
|
<UiButton
|
||||||
type="submit"
|
type="submit"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] justify-self-end"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] justify-self-end"
|
||||||
>Valider
|
>Valider
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
@@ -152,15 +152,9 @@ import type {ShipmentFormData} from '~/services/dto/shipment-data'
|
|||||||
import {SUPPLIER_CODE} from "~/utils/constants"
|
import {SUPPLIER_CODE} from "~/utils/constants"
|
||||||
import {useAuthStore} from '~/stores/auth'
|
import {useAuthStore} from '~/stores/auth'
|
||||||
import {useShipmentStore} from '~/stores/shipment'
|
import {useShipmentStore} from '~/stores/shipment'
|
||||||
import { computed, reactive, ref, watch, onMounted } from 'vue'
|
import {computed, reactive, ref, watch, onMounted} from 'vue'
|
||||||
import type {ShipmentTypeData} from "~/services/dto/shipment-type-data";
|
import type {ShipmentTypeData} from "~/services/dto/shipment-type-data";
|
||||||
import {getShipmentTypeList} from "~/services/shipment-type";
|
import {getShipmentTypeList} from "~/services/shipment-type";
|
||||||
import {
|
|
||||||
createShipmentBovine,
|
|
||||||
deleteShipmentBovine,
|
|
||||||
getBovinShipmentList,
|
|
||||||
updateShipmentBovine
|
|
||||||
} from "~/services/bovin-shipment";
|
|
||||||
|
|
||||||
const users = ref<UserData[]>([])
|
const users = ref<UserData[]>([])
|
||||||
const customers = ref<CustomerData[]>([])
|
const customers = ref<CustomerData[]>([])
|
||||||
@@ -332,23 +326,15 @@ watch(
|
|||||||
form.carrierId = shipment?.carrier?.id ? String(shipment.carrier.id) : ''
|
form.carrierId = shipment?.carrier?.id ? String(shipment.carrier.id) : ''
|
||||||
form.driverId = shipment?.driver?.id ? String(shipment.driver.id) : ''
|
form.driverId = shipment?.driver?.id ? String(shipment.driver.id) : ''
|
||||||
form.vehicleId = shipment?.vehicle?.id ? String(shipment.vehicle.id) : ''
|
form.vehicleId = shipment?.vehicle?.id ? String(shipment.vehicle.id) : ''
|
||||||
if (!shipment || !shipment.bovinShipments) {
|
|
||||||
selectedShipmentTypeId.value = ''
|
|
||||||
shipmentQuantity.value = 0
|
|
||||||
} else {
|
|
||||||
const selectedEntry = shipment.bovinShipments.find((entry) => {
|
|
||||||
const typeId = entry.shipmentType?.id
|
|
||||||
return Boolean(typeId) && Number(entry.nbBovinSend ?? 0) > 0
|
|
||||||
}) ?? shipment.bovinShipments.find((entry) => Boolean(entry.shipmentType?.id))
|
|
||||||
|
|
||||||
if (!selectedEntry?.shipmentType?.id) {
|
|
||||||
selectedShipmentTypeId.value = ''
|
selectedShipmentTypeId.value = shipment?.shipmentType?.id
|
||||||
shipmentQuantity.value = 0
|
? String(shipment.shipmentType.id)
|
||||||
} else {
|
: ''
|
||||||
selectedShipmentTypeId.value = String(selectedEntry.shipmentType.id)
|
|
||||||
shipmentQuantity.value = selectedEntry.nbBovinSend ?? 0
|
shipmentQuantity.value = shipment?.nbBovinSend ?? 0
|
||||||
}
|
|
||||||
}
|
|
||||||
isHydrating.value = false
|
isHydrating.value = false
|
||||||
},
|
},
|
||||||
{immediate: true}
|
{immediate: true}
|
||||||
@@ -474,68 +460,7 @@ watch(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
const buildDesiredBovinShipments = () => {
|
|
||||||
const typeId = Number(selectedShipmentTypeId.value)
|
|
||||||
if (!Number.isFinite(typeId)) {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
const type = bovineShipment.value.find((entry) => entry.id === typeId)
|
|
||||||
if (!type) {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
const raw = shipmentQuantity.value
|
|
||||||
const quantity = raw === null || raw === undefined ? 0 : Number(raw)
|
|
||||||
const normalizedQuantity = Number.isFinite(quantity) ? Math.max(0, Math.trunc(quantity)) : 0
|
|
||||||
if (normalizedQuantity <= 0) {
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
return [{type, quantity: normalizedQuantity}]
|
|
||||||
}
|
|
||||||
const syncBovinShipments = async (
|
|
||||||
shipmentId: number,
|
|
||||||
existing: Array<{ id?: number; nbBovinSend: number | null; shipmentType?: unknown }> = []
|
|
||||||
) => {
|
|
||||||
const shipmentIri = `/api/shipments/${shipmentId}`
|
|
||||||
const desired = buildDesiredBovinShipments()
|
|
||||||
const desiredByTypeId = new Map<number, number>()
|
|
||||||
for (const entry of desired) {
|
|
||||||
desiredByTypeId.set(entry.type.id, entry.quantity)
|
|
||||||
}
|
|
||||||
for (const entry of existing) {
|
|
||||||
if (!entry.id) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
const rawType = entry.shipmentType
|
|
||||||
let typeId: number | null = null
|
|
||||||
if (rawType && typeof rawType === 'object' && 'id' in rawType) {
|
|
||||||
typeId = Number((rawType as { id: number }).id)
|
|
||||||
} else if (typeof rawType === 'string') {
|
|
||||||
const match = rawType.match(/\/shipment_types\/(\\d+)$/)
|
|
||||||
typeId = match ? Number(match[1]) : null
|
|
||||||
}
|
|
||||||
if (!typeId) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
const desiredQuantity = desiredByTypeId.get(typeId)
|
|
||||||
if (!desiredQuantity) {
|
|
||||||
await deleteShipmentBovine(entry.id)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if (entry.nbBovinSend !== desiredQuantity) {
|
|
||||||
await updateShipmentBovine(entry.id, {nbBovinSend: desiredQuantity})
|
|
||||||
}
|
|
||||||
desiredByTypeId.delete(typeId)
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const [typeId, quantity] of desiredByTypeId.entries()) {
|
|
||||||
await createShipmentBovine({
|
|
||||||
shipment: shipmentIri,
|
|
||||||
shipmentType: `/api/shipment_types/${typeId}`,
|
|
||||||
nbBovinSend: quantity
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const buildPayload = () => {
|
const buildPayload = () => {
|
||||||
const normalizedLicensePlate = form.licencePlate.trim()
|
const normalizedLicensePlate = form.licencePlate.trim()
|
||||||
const normalizedShipmentDate = form.shipmentDate.trim()
|
const normalizedShipmentDate = form.shipmentDate.trim()
|
||||||
@@ -563,6 +488,14 @@ const buildPayload = () => {
|
|||||||
const addressIri = normalizedAddressId
|
const addressIri = normalizedAddressId
|
||||||
? `/api/addresses/${normalizedAddressId}`
|
? `/api/addresses/${normalizedAddressId}`
|
||||||
: null
|
: null
|
||||||
|
const normalizedShipmentTypeId = selectedShipmentTypeId.value.trim()
|
||||||
|
const shipmentTypeIri = normalizedShipmentTypeId
|
||||||
|
? `/api/shipment_types/${normalizedShipmentTypeId}`
|
||||||
|
: null
|
||||||
|
|
||||||
|
const rawQuantity = Number(shipmentQuantity.value ?? 0)
|
||||||
|
const normalizedQuantity = Number.isFinite(rawQuantity) ? Math.max(0,
|
||||||
|
Math.trunc(rawQuantity)) : 0
|
||||||
|
|
||||||
return {
|
return {
|
||||||
licencePlate: normalizedLicensePlate,
|
licencePlate: normalizedLicensePlate,
|
||||||
@@ -572,20 +505,19 @@ const buildPayload = () => {
|
|||||||
carrier: carrierIri,
|
carrier: carrierIri,
|
||||||
driver: driverIri,
|
driver: driverIri,
|
||||||
user: userIri,
|
user: userIri,
|
||||||
address: addressIri
|
address: addressIri,
|
||||||
|
shipmentType: shipmentTypeIri,
|
||||||
|
nbBovinSend: normalizedQuantity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveDraft = async () => {
|
const saveDraft = async () => {
|
||||||
const payload = buildPayload()
|
const payload = buildPayload()
|
||||||
if (!shipmentStore.current) {
|
if (!shipmentStore.current) {
|
||||||
const created = await shipmentStore.createShipment({
|
await shipmentStore.createShipment({
|
||||||
currentStep: 0,
|
currentStep: 0,
|
||||||
...payload
|
...payload
|
||||||
})
|
})
|
||||||
if (created) {
|
|
||||||
await syncBovinShipments(created.id, [])
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -593,10 +525,6 @@ const saveDraft = async () => {
|
|||||||
currentStep: shipmentStore.current.currentStep,
|
currentStep: shipmentStore.current.currentStep,
|
||||||
...payload
|
...payload
|
||||||
})
|
})
|
||||||
await syncBovinShipments(
|
|
||||||
shipmentStore.current.id,
|
|
||||||
shipmentStore.current?.bovinShipments ?? []
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({saveDraft})
|
defineExpose({saveDraft})
|
||||||
@@ -610,7 +538,6 @@ const validate = async () => {
|
|||||||
})
|
})
|
||||||
if (created) {
|
if (created) {
|
||||||
await shipmentStore.loadShipment(created.id)
|
await shipmentStore.loadShipment(created.id)
|
||||||
await syncBovinShipments(created.id, shipmentStore.current?.bovinShipments ?? [])
|
|
||||||
await router.push(`/shipment/${created.id}`)
|
await router.push(`/shipment/${created.id}`)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
@@ -621,6 +548,5 @@ const validate = async () => {
|
|||||||
...payload
|
...payload
|
||||||
})
|
})
|
||||||
await shipmentStore.loadShipment(shipmentStore.current.id)
|
await shipmentStore.loadShipment(shipmentStore.current.id)
|
||||||
await syncBovinShipments(shipmentStore.current.id, shipmentStore.current?.bovinShipments ?? [])
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col items-center gap-16">
|
<div class="flex flex-col items-center gap-[118px]">
|
||||||
<h1 class="font-bold text-5xl uppercase">Charment des bovins</h1>
|
<h1 class="font-bold text-5xl uppercase text-primary-500">Chargement des bovins</h1>
|
||||||
<div
|
<div
|
||||||
class="w-full flex flex-col items-center justify-center">
|
class="w-full flex flex-col items-center justify-center">
|
||||||
<UiLoadingDots />
|
<UiLoadingDots />
|
||||||
</div>
|
</div>
|
||||||
<button
|
<UiButton
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
||||||
@click="goNext"
|
@click="goNext"
|
||||||
>Pesée</button>
|
>Peser</UiButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex justify-center">
|
<div class="flex justify-center">
|
||||||
<div class="flex flex-col items-center w-[660px]">
|
<div class="flex flex-col items-center w-[660px]">
|
||||||
<h1 class="font-bold text-5xl uppercase">{{ title }}</h1>
|
<h1 class="font-bold text-5xl uppercase text-primary-500">{{ title }}</h1>
|
||||||
<!--@TODO Voir comment faire pour savoir si le pont-bascule et bien connecté + ajouter un icon comme sur la maquette-->
|
<!--@TODO Voir comment faire pour savoir si le pont-bascule et bien connecté + ajouter un icon comme sur la maquette-->
|
||||||
<p class="text-primary-500 uppercase text-2xl mt-2">Pont-bascule connecté</p>
|
<p class="text-primary-500 uppercase text-2xl mt-2">Pont-bascule connecté</p>
|
||||||
<div
|
<div
|
||||||
@@ -11,27 +11,27 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else-if="displayWeight !== null" class="w-full">
|
<div v-else-if="displayWeight !== null" class="w-full">
|
||||||
<div
|
<div
|
||||||
class="w-full flex flex-col items-center justify-center border border-black h-[90px] mt-12 mb-[25px] text-4xl">
|
class="w-full flex flex-col items-center justify-center border border-primary-500 h-[90px] mt-12 mb-[25px] text-4xl text-primary-500">
|
||||||
{{ displayWeight }} kg
|
{{ displayWeight }} kg
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center mt-[54px]">
|
<div class="flex justify-center mt-[54px]">
|
||||||
<button
|
<UiButton
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
@click="fetchWeight"
|
@click="fetchWeight"
|
||||||
>{{ displayWeight !== null ? 'refaire une pesee' : 'peser' }}</button>
|
>{{ displayWeight !== null ? 'refaire une pesée' : 'peser' }}</UiButton>
|
||||||
<button
|
<UiButton
|
||||||
v-if="displayWeight !== null && !showGenerateReceipt"
|
v-if="displayWeight !== null && !showGenerateReceipt"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
||||||
@click="saveWeight"
|
@click="saveWeight"
|
||||||
>Valider la pesée</button>
|
>Valider la pesée</UiButton>
|
||||||
<button
|
<UiButton
|
||||||
v-if="showGenerateReceipt"
|
v-if="showGenerateReceipt"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] ml-4"
|
||||||
@click="printReceipt"
|
@click="printReceipt"
|
||||||
>Générer le bon</button>
|
>Générer le bon</UiButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
39
frontend/components/ui/UiButton.vue
Normal file
39
frontend/components/ui/UiButton.vue
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<template>
|
||||||
|
<component
|
||||||
|
:is="'button'"
|
||||||
|
:type="type"
|
||||||
|
:disabled="isDisabled"
|
||||||
|
class="inline-flex items-center justify-center rounded-md"
|
||||||
|
:class="[
|
||||||
|
isDisabled ? 'cursor-not-allowed opacity-60' : 'cursor-pointer',
|
||||||
|
buttonClass
|
||||||
|
]"
|
||||||
|
v-bind="attrs"
|
||||||
|
>
|
||||||
|
<slot v-if="!loading" />
|
||||||
|
<UiLoadingDots v-else />
|
||||||
|
</component>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {computed, useAttrs} from 'vue'
|
||||||
|
|
||||||
|
defineOptions({inheritAttrs: false})
|
||||||
|
|
||||||
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
type?: 'button' | 'submit' | 'reset'
|
||||||
|
disabled?: boolean
|
||||||
|
loading?: boolean
|
||||||
|
buttonClass?: string
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
disabled: false,
|
||||||
|
loading: false,
|
||||||
|
buttonClass: ''
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const attrs = useAttrs()
|
||||||
|
const isDisabled = computed(() => props.disabled || props.loading)
|
||||||
|
</script>
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="wrapperClass">
|
<div :class="wrapperClass">
|
||||||
<label
|
<label
|
||||||
class="flex items-center gap-2 cursor-pointer"
|
class="flex items-center gap-2 cursor-pointer text-primary-500"
|
||||||
:class="labelClass"
|
:class="labelClass"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:checked="checked"
|
:checked="checked"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:class="['cursor-pointer', inputClass]"
|
:class="['cursor-pointer text-primary-500', inputClass]"
|
||||||
@change="onChange"
|
@change="onChange"
|
||||||
>
|
>
|
||||||
<span v-if="label">{{ label }}</span>
|
<span v-if="label">{{ label }}</span>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<label
|
<label
|
||||||
v-if="label"
|
v-if="label"
|
||||||
:for="id"
|
:for="id"
|
||||||
class="font-bold uppercase text-xl"
|
class="font-bold uppercase text-xl text-primary-500"
|
||||||
:class="labelClass"
|
:class="labelClass"
|
||||||
>
|
>
|
||||||
{{ label }}
|
{{ label }}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
:value="modelValue ?? ''"
|
:value="modelValue ?? ''"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
class="border-b border-black justify-self-start text-xl py-[6px] uppercase bg-transparent appearance-none h-[34px]"
|
class="border-b border-black justify-self-start text-xl text-primary-500 py-[6px] uppercase bg-transparent appearance-none h-[34px]"
|
||||||
:class="[
|
:class="[
|
||||||
isEmpty ? 'text-neutral-400' : 'text-black',
|
isEmpty ? 'text-neutral-400' : 'text-black',
|
||||||
disabled ? 'cursor-not-allowed' : 'cursor-pointer',
|
disabled ? 'cursor-not-allowed' : 'cursor-pointer',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<label
|
<label
|
||||||
v-if="label"
|
v-if="label"
|
||||||
:for="id"
|
:for="id"
|
||||||
class="text-xl flex items-center gap-2"
|
class="text-xl flex items-center gap-2 text-primary-500"
|
||||||
:class="labelClass"
|
:class="labelClass"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
:step="step"
|
:step="step"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
class="border-b border-black text-xl bg-transparent w-16"
|
class="border-b border-black text-xl bg-transparent w-16 text-primary-500"
|
||||||
:class="[
|
:class="[
|
||||||
isEmpty ? 'text-neutral-400' : 'text-black',
|
isEmpty ? 'text-neutral-400' : 'text-black',
|
||||||
disabled ? 'cursor-not-allowed' : 'cursor-text',
|
disabled ? 'cursor-not-allowed' : 'cursor-text',
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div :class="['flex flex-col', wrapperClass]">
|
<div :class="['flex flex-col', wrapperClass]">
|
||||||
<label
|
<label
|
||||||
v-if="label"
|
v-if="label"
|
||||||
class="font-bold uppercase text-xl"
|
class="font-bold uppercase text-xl text-primary-500"
|
||||||
:class="labelClass"
|
:class="labelClass"
|
||||||
>
|
>
|
||||||
{{ label }}
|
{{ label }}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
v-for="option in options"
|
v-for="option in options"
|
||||||
:key="String(option.value)"
|
:key="String(option.value)"
|
||||||
:for="`${id || 'radio'}-${option.value}`"
|
:for="`${id || 'radio'}-${option.value}`"
|
||||||
class="flex items-center gap-2"
|
class="flex items-center gap-2 text-primary-500"
|
||||||
:class="itemClass"
|
:class="itemClass"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<label
|
<label
|
||||||
v-if="label"
|
v-if="label"
|
||||||
:for="id"
|
:for="id"
|
||||||
class="font-bold uppercase text-xl"
|
class="font-bold uppercase text-xl text-primary-500"
|
||||||
:class="labelClass"
|
:class="labelClass"
|
||||||
>
|
>
|
||||||
{{ label }}
|
{{ label }}
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
:value="modelValue ?? ''"
|
:value="modelValue ?? ''"
|
||||||
:disabled="disabled || loading"
|
:disabled="disabled || loading"
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
class="border-b border-black justify-self-start text-xl py-[6px] bg-transparent"
|
class="border-b border-black justify-self-start text-xl text-primary-500 py-[6px] bg-transparent"
|
||||||
:class="[
|
:class="[
|
||||||
isEmpty ? 'text-neutral-400' : 'text-black',
|
isEmpty ? 'text-neutral-400' : 'text-black',
|
||||||
disabled || loading ? 'cursor-not-allowed' : 'cursor-pointer',
|
disabled || loading ? 'cursor-not-allowed' : 'cursor-pointer',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<label
|
<label
|
||||||
v-if="label"
|
v-if="label"
|
||||||
:for="id"
|
:for="id"
|
||||||
class="font-bold uppercase text-xl"
|
class="font-bold uppercase text-xl text-primary-500"
|
||||||
:class="labelClass"
|
:class="labelClass"
|
||||||
>
|
>
|
||||||
{{ label }}
|
{{ label }}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
:maxlength="maxlength"
|
:maxlength="maxlength"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
v-bind="attrs"
|
v-bind="attrs"
|
||||||
class="border-b border-black text-xl py-[6px] bg-transparent"
|
class="border-b border-black text-xl py-[6px] bg-transparent text-primary-500"
|
||||||
:class="[
|
:class="[
|
||||||
isEmpty ? 'text-neutral-400' : 'text-black',
|
isEmpty ? 'text-neutral-400' : 'text-black',
|
||||||
disabled ? 'cursor-not-allowed' : 'cursor-text',
|
disabled ? 'cursor-not-allowed' : 'cursor-text',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<label :for="inputId" class="font-bold uppercase text-xl">{{ label }}</label>
|
<label :for="inputId" class="font-bold uppercase text-xl text-primary-500">{{ label }}</label>
|
||||||
<div class="flex items-end gap-8">
|
<div class="flex items-end gap-8">
|
||||||
<input
|
<input
|
||||||
:id="inputId"
|
:id="inputId"
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
type="text"
|
type="text"
|
||||||
:maxlength="maxLength"
|
:maxlength="maxLength"
|
||||||
:placeholder="placeholderText"
|
:placeholder="placeholderText"
|
||||||
class="border-b border-black flex-1 min-w-0 text-xl uppercase h-[30px]"
|
class="border-b border-black flex-1 min-w-0 text-xl text-primary-500 uppercase h-[36px] py-[6px]"
|
||||||
@input="handleInput"
|
@input="handleInput"
|
||||||
/>
|
/>
|
||||||
<UiCheckbox
|
<UiCheckbox
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<div
|
<div
|
||||||
v-for="(label, index) in labels"
|
v-for="(label, index) in labels"
|
||||||
:key="label"
|
:key="label"
|
||||||
class="absolute top-0 whitespace-nowrap"
|
class="absolute top-0 whitespace-nowrap text-primary-500"
|
||||||
:class="labelClass(index)"
|
:class="labelClass(index)"
|
||||||
:style="positionStyle(index)"
|
:style="positionStyle(index)"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="min-h-screen text-neutral-900 flex flex-col">
|
<div class="min-h-screen text-neutral-900 flex flex-col">
|
||||||
<!-- HEADER -->
|
<!-- HEADER -->
|
||||||
<header class="w-full bg-primary-500 py-5 px-6">
|
<header class="w-full bg-primary-500 py-5 px-6">
|
||||||
<div class="flex w-full items-center ">
|
<div class="flex w-full items-center justify-between">
|
||||||
<!-- Burger (mobile) -->
|
<!-- Burger (mobile) -->
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -31,8 +31,8 @@
|
|||||||
:href="href"
|
:href="href"
|
||||||
@click="navigate"
|
@click="navigate"
|
||||||
:class="route.path === '/'
|
:class="route.path === '/'
|
||||||
? 'opacity-100'
|
? 'opacity-100'
|
||||||
: 'opacity-65 hover:opacity-100 transition'"
|
: 'opacity-65 hover:opacity-100 transition'"
|
||||||
>
|
>
|
||||||
Accueil
|
Accueil
|
||||||
</a>
|
</a>
|
||||||
@@ -48,8 +48,8 @@
|
|||||||
:href="href"
|
:href="href"
|
||||||
@click="navigate"
|
@click="navigate"
|
||||||
:class="route.path.startsWith('/admin/supplier')
|
:class="route.path.startsWith('/admin/supplier')
|
||||||
? 'opacity-100'
|
? 'opacity-100'
|
||||||
: 'opacity-65 hover:opacity-100 transition'"
|
: 'opacity-65 hover:opacity-100 transition'"
|
||||||
>
|
>
|
||||||
Fournisseurs
|
Fournisseurs
|
||||||
</a>
|
</a>
|
||||||
@@ -65,8 +65,8 @@
|
|||||||
:href="href"
|
:href="href"
|
||||||
@click="navigate"
|
@click="navigate"
|
||||||
:class="route.path.startsWith('/admin/carrier')
|
:class="route.path.startsWith('/admin/carrier')
|
||||||
? 'opacity-100'
|
? 'opacity-100'
|
||||||
: 'opacity-65 hover:opacity-100 transition'"
|
: 'opacity-65 hover:opacity-100 transition'"
|
||||||
>
|
>
|
||||||
Transporteurs
|
Transporteurs
|
||||||
</a>
|
</a>
|
||||||
@@ -82,8 +82,8 @@
|
|||||||
:href="href"
|
:href="href"
|
||||||
@click="navigate"
|
@click="navigate"
|
||||||
:class="route.path.startsWith('/admin/user')
|
:class="route.path.startsWith('/admin/user')
|
||||||
? 'opacity-100'
|
? 'opacity-100'
|
||||||
: 'opacity-65 hover:opacity-100 transition'"
|
: 'opacity-65 hover:opacity-100 transition'"
|
||||||
>
|
>
|
||||||
Utilisateurs
|
Utilisateurs
|
||||||
</a>
|
</a>
|
||||||
@@ -99,36 +99,53 @@
|
|||||||
:href="href"
|
:href="href"
|
||||||
@click="navigate"
|
@click="navigate"
|
||||||
:class="route.path.startsWith('/admin/customer')
|
:class="route.path.startsWith('/admin/customer')
|
||||||
? 'opacity-100'
|
? 'opacity-100'
|
||||||
: 'opacity-65 hover:opacity-100 transition'"
|
: 'opacity-65 hover:opacity-100 transition'"
|
||||||
>
|
>
|
||||||
Clients
|
Clients
|
||||||
</a>
|
</a>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
|
||||||
|
<NuxtLink
|
||||||
|
v-if="auth.isAdmin"
|
||||||
|
to="/admin/bovin/list"
|
||||||
|
custom
|
||||||
|
v-slot="{ href, navigate }"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
:href="href"
|
||||||
|
@click="navigate"
|
||||||
|
:class="route.path.startsWith('/admin/bovin')
|
||||||
|
? 'opacity-100'
|
||||||
|
: 'opacity-65 hover:opacity-100 transition'"
|
||||||
|
>
|
||||||
|
Bovins
|
||||||
|
</a>
|
||||||
|
</NuxtLink>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<!-- Spacer mobile (pour centrer visuellement le header si besoin) -->
|
<!-- Spacer mobile (pour centrer visuellement le header si besoin) -->
|
||||||
<div class="w-[44px] md:hidden"></div>
|
<div class="w-[44px] md:hidden"></div>
|
||||||
|
|
||||||
<!-- User dropdown à droite (desktop) -->
|
<!-- User dropdown à droite (desktop) -->
|
||||||
<div v-if="auth.isAuthenticated" class="ml-auto relative hidden md:flex items-center text-white">
|
<div v-if="auth.isAuthenticated" class="ml-auto relative hidden md:flex items-center text-white group">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="inline-flex items-center text-xl leading-none transition hover:opacity-80"
|
class="inline-flex items-center py-2 -my-2 text-xl leading-none transition hover:opacity-80"
|
||||||
@click="toggleUserMenu"
|
|
||||||
aria-haspopup="true"
|
aria-haspopup="true"
|
||||||
:aria-expanded="isUserMenuOpen ? 'true' : 'false'"
|
|
||||||
>
|
>
|
||||||
<span class="capitalize font-bold">{{ userDisplayName }}</span>
|
<span class="capitalize font-bold">{{ userDisplayName }}</span>
|
||||||
<span class="ml-[6px] inline-flex items-center font-bold">
|
<span
|
||||||
<Icon v-if="isUserMenuOpen" name="mdi:chevron-up" size="20"/>
|
class="ml-[6px] inline-flex items-center font-bold transition-transform group-hover:rotate-180 group-focus-within:rotate-180">
|
||||||
<Icon v-else name="mdi:chevron-down" size="20"/>
|
<Icon name="mdi:chevron-down" size="20"/>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="isUserMenuOpen"
|
class="absolute right-0 top-full z-10 w-56 rounded-md bg-primary-500 py-2 border-neutral-300 border shadow-lg
|
||||||
class="absolute right-0 top-full z-10 mt-2 w-56 rounded-md bg-primary-500 py-2 border-neutral-300 border shadow-lg"
|
opacity-0 invisible pointer-events-none transition
|
||||||
|
group-hover:opacity-100 group-hover:visible group-hover:pointer-events-auto
|
||||||
|
group-focus-within:opacity-100 group-focus-within:visible group-focus-within:pointer-events-auto"
|
||||||
role="menu"
|
role="menu"
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
@@ -169,9 +186,7 @@
|
|||||||
>
|
>
|
||||||
<aside
|
<aside
|
||||||
v-if="isMenuOpen"
|
v-if="isMenuOpen"
|
||||||
class="fixed left-0 top-0 z-50 h-full w-full bg-primary-600 px-6 pb-8 pt-6 text-white shadow-xl md:hidden"
|
class="fixed left-0 top-0 z-50 h-full w-full bg-primary-500 px-6 pb-8 pt-6 text-white shadow-xl md:hidden"
|
||||||
role="dialog"
|
|
||||||
aria-modal="true"
|
|
||||||
>
|
>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<span class="text-2xl font-bold uppercase">Menu</span>
|
<span class="text-2xl font-bold uppercase">Menu</span>
|
||||||
@@ -199,6 +214,9 @@
|
|||||||
<NuxtLink v-if="auth.isAdmin" to="/admin/customer/customer-list" @click="closeMenu">
|
<NuxtLink v-if="auth.isAdmin" to="/admin/customer/customer-list" @click="closeMenu">
|
||||||
Clients
|
Clients
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
<NuxtLink v-if="auth.isAdmin" to="/admin/bovin/list" @click="closeMenu">
|
||||||
|
Bovins
|
||||||
|
</NuxtLink>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -212,11 +230,9 @@
|
|||||||
</aside>
|
</aside>
|
||||||
</transition>
|
</transition>
|
||||||
</header>
|
</header>
|
||||||
|
<main class="mx-auto w-full max-w-[1280px] mt-16">
|
||||||
<main class="mx-auto w-full max-w-[1280px] py-2 flex-1">
|
|
||||||
<slot/>
|
<slot/>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="w-full mt-auto bg-primary-500 px-6 py-3">
|
<footer class="w-full mt-auto bg-primary-500 px-6 py-3">
|
||||||
<p class="font-bold text-white text-right">v{{ version }}</p>
|
<p class="font-bold text-white text-right">v{{ version }}</p>
|
||||||
</footer>
|
</footer>
|
||||||
@@ -231,7 +247,6 @@ const auth = useAuthStore()
|
|||||||
const {version} = useAppVersion()
|
const {version} = useAppVersion()
|
||||||
|
|
||||||
const isMenuOpen = ref(false)
|
const isMenuOpen = ref(false)
|
||||||
const isUserMenuOpen = ref(false)
|
|
||||||
|
|
||||||
const userDisplayName = computed(() => auth.user?.username ?? 'Utilisateur')
|
const userDisplayName = computed(() => auth.user?.username ?? 'Utilisateur')
|
||||||
|
|
||||||
@@ -241,14 +256,6 @@ const closeMenu = () => {
|
|||||||
|
|
||||||
const toggleMenu = () => {
|
const toggleMenu = () => {
|
||||||
isMenuOpen.value = !isMenuOpen.value
|
isMenuOpen.value = !isMenuOpen.value
|
||||||
// évite d’avoir deux menus ouverts en même temps
|
|
||||||
if (isMenuOpen.value) isUserMenuOpen.value = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const toggleUserMenu = () => {
|
|
||||||
isUserMenuOpen.value = !isUserMenuOpen.value
|
|
||||||
// idem
|
|
||||||
if (isUserMenuOpen.value) isMenuOpen.value = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleLogout = async () => {
|
const handleLogout = async () => {
|
||||||
@@ -256,7 +263,6 @@ const handleLogout = async () => {
|
|||||||
await auth.logout()
|
await auth.logout()
|
||||||
} finally {
|
} finally {
|
||||||
closeMenu()
|
closeMenu()
|
||||||
isUserMenuOpen.value = false
|
|
||||||
await navigateTo('/login')
|
await navigateTo('/login')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
104
frontend/pages/admin/bovin/[[id]].vue
Normal file
104
frontend/pages/admin/bovin/[[id]].vue
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<template>
|
||||||
|
<form @submit.prevent="validate">
|
||||||
|
<div class="text-primary-500 flex items-center justify-between">
|
||||||
|
<h1 class="text-3xl font-bold uppercase">
|
||||||
|
{{ route.params.id ? 'Modifier bovin' : 'Ajout bovin' }}
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<UiButton
|
||||||
|
type="submit"
|
||||||
|
:disabled="isLoading || isHydrating"
|
||||||
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] hover:opacity-80"
|
||||||
|
>
|
||||||
|
<Icon name="mdi:check" size="28" />
|
||||||
|
{{ isEdit ? 'Modifier' : 'Ajouter' }}
|
||||||
|
</UiButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 py-12">
|
||||||
|
<UiTextInput label="Nom du bovin" id="bovin-label" v-model="form.label" />
|
||||||
|
<UiTextInput label="Code bovin" id="code-id" v-model="form.code" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {createBovin, getBovin, updateBovin} from "~/services/bovine-type";
|
||||||
|
import type {BovineTypeData, BovinFormData} from "~/services/dto/bovine-type-data";
|
||||||
|
const router = useRouter()
|
||||||
|
const route = useRoute()
|
||||||
|
const isLoading = ref(false)
|
||||||
|
const isHydrating = ref(false)
|
||||||
|
|
||||||
|
function resolveId(param: unknown) {
|
||||||
|
const idStr = Array.isArray(param) ? param[0] : param
|
||||||
|
if (!idStr) return null
|
||||||
|
const id = Number(idStr)
|
||||||
|
return Number.isFinite(id) ? id : null
|
||||||
|
}
|
||||||
|
|
||||||
|
const idBovin = computed(() => resolveId(route.params.id))
|
||||||
|
const isEdit = computed(() => idBovin.value !== null)
|
||||||
|
|
||||||
|
const form = reactive<BovinFormData>({
|
||||||
|
label: '',
|
||||||
|
code: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const hydrateFromBovin = (bovin: BovineTypeData | null) => {
|
||||||
|
if (!bovin) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isHydrating.value = true
|
||||||
|
form.label = bovin.label ?? ''
|
||||||
|
form.code = bovin.code ?? ''
|
||||||
|
isHydrating.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => idBovin.value,
|
||||||
|
async (id) => {
|
||||||
|
if (id === null) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isLoading.value = true
|
||||||
|
try {
|
||||||
|
const bovin = await getBovin(id)
|
||||||
|
hydrateFromBovin(bovin)
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{immediate: true}
|
||||||
|
)
|
||||||
|
async function validate() {
|
||||||
|
if (isLoading.value || isHydrating.value) return
|
||||||
|
|
||||||
|
const normalizedBovinCode = form.code.trim()
|
||||||
|
const normalizedBovinLabel = form.label.trim()
|
||||||
|
|
||||||
|
|
||||||
|
const basePayload = {
|
||||||
|
label: normalizedBovinLabel,
|
||||||
|
code: normalizedBovinCode
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoading.value = true
|
||||||
|
try {
|
||||||
|
if (isEdit.value && idBovin.value !== null) {
|
||||||
|
await updateBovin(idBovin.value, basePayload)
|
||||||
|
} else {
|
||||||
|
await createBovin(basePayload)
|
||||||
|
}
|
||||||
|
await navigate()
|
||||||
|
} finally {
|
||||||
|
isLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function navigate(){
|
||||||
|
return router.push("/admin/bovin/list")
|
||||||
|
}
|
||||||
|
</script>
|
||||||
72
frontend/pages/admin/bovin/list.vue
Normal file
72
frontend/pages/admin/bovin/list.vue
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
<template>
|
||||||
|
<div class="flex items-center justify-between">
|
||||||
|
<h1 class="text-3xl font-bold text-primary-500 uppercase">Liste des types bovins</h1>
|
||||||
|
<NuxtLink
|
||||||
|
to="/admin/bovin"
|
||||||
|
class="inline-flex items-center justify-center
|
||||||
|
text-xl text-white uppercase
|
||||||
|
bg-primary-500 h-[50px] px-8 rounded
|
||||||
|
hover:opacity-80 gap-2"
|
||||||
|
@click="handleAddClick"
|
||||||
|
>
|
||||||
|
<Icon name="mdi:plus" size="28" />
|
||||||
|
Ajouter
|
||||||
|
</NuxtLink>
|
||||||
|
</div>
|
||||||
|
<div v-if="auth.isAdmin" class="mt-6 border border-slate-200 mb-16">
|
||||||
|
<div class="max-h-96 overflow-y-auto">
|
||||||
|
<div
|
||||||
|
class="sticky
|
||||||
|
grid grid-cols-2 gap-4
|
||||||
|
bg-slate-100 px-4 py-3
|
||||||
|
font-semibold uppercase
|
||||||
|
tracking-wide"
|
||||||
|
>
|
||||||
|
<div class="col-span-1">Nom</div>
|
||||||
|
<div class="col-span-1">Code</div>
|
||||||
|
</div>
|
||||||
|
<div v-if="bovinList.length === 0" class="px-4 py-6 text-slate-400">
|
||||||
|
Aucun type de bovin.
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div
|
||||||
|
v-for="bovin in bovinList"
|
||||||
|
:key="bovin.id"
|
||||||
|
class="grid grid-cols-2 border-t gap-4 px-4 py-2 hover:bg-slate-50 cursor-pointer"
|
||||||
|
@click="goToBovin(bovin.id)"
|
||||||
|
>
|
||||||
|
<div class="col-span-1">{{ bovin.label }}</div>
|
||||||
|
<div class="col-span-1">{{ bovin.code }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="mt-6 border border-slate-200 mb-16 px-4 py-6 text-slate-400">
|
||||||
|
Accès réservé aux administrateurs.
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { getBovineTypeList } from "~/services/bovine-type"
|
||||||
|
import type { BovineTypeData } from "~/services/dto/bovine-type-data"
|
||||||
|
import { useAuthStore } from "~/stores/auth"
|
||||||
|
|
||||||
|
const bovinList = ref<BovineTypeData[]>([])
|
||||||
|
const router = useRouter()
|
||||||
|
const auth = useAuthStore()
|
||||||
|
|
||||||
|
const goToBovin = (id: number) => {
|
||||||
|
if (!auth.isAdmin) return
|
||||||
|
router.push(`/admin/bovin/${id}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleAddClick = (event: Event) => {
|
||||||
|
if (auth.isAdmin) return
|
||||||
|
event.preventDefault()
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
if (!auth.isAdmin) return
|
||||||
|
bovinList.value = await getBovineTypeList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<form @submit.prevent="validate">
|
<form @submit.prevent="validate">
|
||||||
<div class="flex items-center justify-between ">
|
<div class="flex items-center justify-between">
|
||||||
<h1 class="text-3xl font-bold uppercase">
|
<h1 class="text-3xl font-bold uppercase">
|
||||||
{{ route.params.id ? 'Modifier transporteur' : 'Ajout transporteur' }}
|
{{ route.params.id ? 'Modifier transporteur' : 'Ajout transporteur' }}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<button
|
<UiButton
|
||||||
type="submit"
|
type="submit"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] justify-self-end"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] justify-self-end"
|
||||||
>Enregistrer
|
>Enregistrer
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 mb-16">
|
<div class="grid grid-cols-2 items-start gap-y-8 gap-x-40 py-12">
|
||||||
<UiTextInput
|
<UiTextInput
|
||||||
label = "nom du fournisseur"
|
label = "nom du fournisseur"
|
||||||
id="carrier-name"
|
id="carrier-name"
|
||||||
@@ -33,12 +33,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {createCarrier, getCarrier, updateCarrier} from "~/services/carrier";
|
import {createCarrier, getCarrier, updateCarrier} from "~/services/carrier";
|
||||||
import type {CarrierData, CarrierFormData} from "~/services/dto/carrier-data";
|
import type {CarrierData, CarrierFormData} from "~/services/dto/carrier-data";
|
||||||
|
import {computed} from "vue";
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const idCarrier = Number(route.params.id)
|
const idCarrier = computed(() => resolveId(route.params.id))
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
const isHydrating = ref(false)
|
const isHydrating = ref(false)
|
||||||
|
|
||||||
|
const resolveId = (param: unknown) => {
|
||||||
|
const idStr = Array.isArray(param) ? param[0] : param
|
||||||
|
if (!idStr) return null
|
||||||
|
const id = Number(idStr)
|
||||||
|
return Number.isFinite(id) ? id : null
|
||||||
|
}
|
||||||
|
|
||||||
const form = reactive<CarrierFormData>({
|
const form = reactive<CarrierFormData>({
|
||||||
code:'',
|
code:'',
|
||||||
name:''
|
name:''
|
||||||
@@ -59,7 +67,7 @@ const hydrateFromUser = (carrier: CarrierData | null) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => idCarrier,
|
() => idCarrier.value,
|
||||||
async (id) => {
|
async (id) => {
|
||||||
if (id === null) {
|
if (id === null) {
|
||||||
return
|
return
|
||||||
@@ -85,8 +93,8 @@ async function validate() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(idCarrier){
|
if(idCarrier.value){
|
||||||
await updateCarrier(idCarrier, basePayload)
|
await updateCarrier(idCarrier.value, basePayload)
|
||||||
navigate()
|
navigate()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
|
|
||||||
<div class="flex items-center justify-between ">
|
<div class="flex items-center justify-between ">
|
||||||
<h1 class="text-3xl font-bold uppercase">listes des transporteurs</h1>
|
<h1 class="text-3xl font-bold uppercase text-primary-500">listes des transporteurs</h1>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
to="/admin/carrier"
|
to="/admin/carrier"
|
||||||
class="flex items-center justify-center text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="inline-flex items-center justify-center gap-2 text-xl uppercase bg-primary-500 text-white h-[50px] px-8 rounded"
|
||||||
>Ajouter
|
>
|
||||||
|
<Icon name="mdi:plus" size="28" />
|
||||||
|
Ajouter
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
{{ customerId ? "Modifications du client" : "Ajout d'un client" }}
|
{{ customerId ? "Modifications du client" : "Ajout d'un client" }}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<button
|
<UiButton
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
type="submit"
|
type="submit"
|
||||||
:disabled="isLoading || !auth.isAdmin"
|
:disabled="isLoading || !auth.isAdmin"
|
||||||
>
|
>
|
||||||
{{ customerId ? "Sauvegarder" : "Ajouter" }}
|
{{ customerId ? "Sauvegarder" : "Ajouter" }}
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 gap-y-8 gap-x-80 mb-10 py-12">
|
<div class="grid grid-cols-2 gap-y-8 gap-x-80 mb-10 py-12">
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
<div class="mx-24 mb-4 py-6 border-t border-black"></div>
|
<div class="mx-24 mb-4 py-6 border-t border-black"></div>
|
||||||
<div class="flex items-center justify-between mb-4">
|
<div class="flex items-center justify-between mb-4">
|
||||||
<h2 class="text-3xl font-bold uppercase">Adresses client</h2>
|
<h2 class="text-3xl font-bold uppercase">Adresses client</h2>
|
||||||
<button
|
<UiButton
|
||||||
type="button"
|
type="button"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
:disabled="customerId === null || !auth.isAdmin"
|
:disabled="customerId === null || !auth.isAdmin"
|
||||||
@click="goToAddAddress"
|
@click="goToAddAddress"
|
||||||
>
|
>
|
||||||
Ajouter
|
Ajouter
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow-x-auto mb-10">
|
<div class="overflow-x-auto mb-10">
|
||||||
<table class="w-full border-collapse">
|
<table class="w-full border-collapse">
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<h1 class="text-3xl font-bold uppercase">Liste des Clients</h1>
|
<h1 class="text-3xl font-bold uppercase text-primary-500">Liste des Clients</h1>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
to="/admin/customer"
|
to="/admin/customer"
|
||||||
class="flex items-center justify-center text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="inline-flex items-center justify-center gap-2 text-xl uppercase bg-primary-500 text-white h-[50px] px-8 rounded-md"
|
||||||
:class="auth.isAdmin ? '' : 'cursor-not-allowed opacity-60'"
|
:class="auth.isAdmin ? '' : 'cursor-not-allowed opacity-60'"
|
||||||
@click="handleAddClick"
|
@click="handleAddClick"
|
||||||
>
|
>
|
||||||
|
<Icon name="mdi:plus" size="28" />
|
||||||
Ajouter
|
Ajouter
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
{{ supplierId ? "Modifications du fournisseur" : "Ajout d'un fournisseur" }}
|
{{ supplierId ? "Modifications du fournisseur" : "Ajout d'un fournisseur" }}
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<button
|
<UiButton
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
type="submit"
|
type="submit"
|
||||||
:disabled="isLoading || !auth.isAdmin"
|
:disabled="isLoading || !auth.isAdmin"
|
||||||
>
|
>
|
||||||
{{ supplierId ? "Sauvegarder" : "Ajouter" }}
|
{{ supplierId ? "Sauvegarder" : "Ajouter" }}
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 gap-y-8 gap-x-80 mb-10 py-12">
|
<div class="grid grid-cols-2 gap-y-8 gap-x-80 mb-10 py-12">
|
||||||
@@ -23,14 +23,14 @@
|
|||||||
<div class="mx-24 mb-4 py-6 border-t border-black"></div>
|
<div class="mx-24 mb-4 py-6 border-t border-black"></div>
|
||||||
<div class="flex items-center justify-between mb-4">
|
<div class="flex items-center justify-between mb-4">
|
||||||
<h2 class="text-3xl font-bold uppercase">Adresses fournisseur</h2>
|
<h2 class="text-3xl font-bold uppercase">Adresses fournisseur</h2>
|
||||||
<button
|
<UiButton
|
||||||
type="button"
|
type="button"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
:disabled="supplierId === null || !auth.isAdmin"
|
:disabled="supplierId === null || !auth.isAdmin"
|
||||||
@click="goToAddAddress"
|
@click="goToAddAddress"
|
||||||
>
|
>
|
||||||
Ajouter
|
Ajouter
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="overflow-x-auto mb-10">
|
<div class="overflow-x-auto mb-10">
|
||||||
<table class="w-full border-collapse">
|
<table class="w-full border-collapse">
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<h1 class="text-3xl font-bold uppercase">Liste des fournisseurs</h1>
|
<h1 class="text-3xl font-bold uppercase text-primary-500">Liste des fournisseurs</h1>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
to="/admin/supplier"
|
to="/admin/supplier"
|
||||||
class="flex items-center justify-center text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="inline-flex items-center justify-center gap-2 text-xl uppercase bg-primary-500 text-white h-[50px] px-8 rounded"
|
||||||
:class="auth.isAdmin ? '' : 'cursor-not-allowed opacity-60'"
|
:class="auth.isAdmin ? '' : 'cursor-not-allowed opacity-60'"
|
||||||
@click="handleAddClick"
|
@click="handleAddClick"
|
||||||
>
|
>
|
||||||
|
<Icon name="mdi:plus" size="28" />
|
||||||
Ajouter
|
Ajouter
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,15 +5,15 @@
|
|||||||
<h1 class="text-3xl font-bold uppercase">
|
<h1 class="text-3xl font-bold uppercase">
|
||||||
{{ userId ? "Modifications de l'utilisateur" : "Ajout d'un utilisateur" }}
|
{{ userId ? "Modifications de l'utilisateur" : "Ajout d'un utilisateur" }}
|
||||||
</h1>
|
</h1>
|
||||||
<button
|
<UiButton
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
{{ userId ? 'Sauvegarder' : 'Ajouter' }}
|
{{ userId ? 'Sauvegarder' : 'Ajouter' }}
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid gap-y-16 gap-x-40 mb-16">
|
<div class="grid gap-y-16 gap-x-40 py-12">
|
||||||
<UiTextInput
|
<UiTextInput
|
||||||
id="user-name"
|
id="user-name"
|
||||||
v-model="form.username"
|
v-model="form.username"
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center justify-between">
|
<div class="flex items-center justify-between">
|
||||||
<h1 class="text-3xl font-bold uppercase">Liste des utilisateurs</h1>
|
<h1 class="text-3xl font-bold uppercase text-primary-500">Liste des utilisateurs</h1>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
class="flex items-center justify-center text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px]"
|
class="inline-flex items-center justify-center gap-2 text-xl uppercase bg-primary-500 text-white h-[50px] px-8 rounded-md"
|
||||||
@click="router.push('/admin/user/')"
|
@click="router.push('/admin/user/')"
|
||||||
>
|
>
|
||||||
|
<Icon name="mdi:plus" size="28" />
|
||||||
Ajouter
|
Ajouter
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,27 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="flex flex-wrap justify-center mt-8 gap-12 mb-8 md:mb-0">
|
<div class="flex flex-wrap justify-center pb-16 gap-12">
|
||||||
<card-link label="NOUVELLE RÉCEPTION" link="/reception" iconName="mdi:truck-outline" />
|
<card-link label="NOUVELLE RÉCEPTION" link="/reception" iconName="mdi:truck-outline" />
|
||||||
<card-link label="NOUVELLE EXPÉDITION" link="/shipment" iconName="mdi:truck-fast-outline" />
|
<card-link label="NOUVELLE EXPÉDITION" link="/shipment" iconName="mdi:truck-fast-outline" />
|
||||||
<card-link label="PLAN DE SITE" link="/" iconName="material-symbols:warehouse-outline-rounded" />
|
<card-link label="PLAN DE SITE" link="/" iconName="material-symbols:warehouse-outline-rounded" />
|
||||||
<card-link label="RÉCEPTIONS EN ATTENTE" link="/reception/waiting-reception" iconName="mdi:truck-remove-outline" />
|
<card-link link="/reception/waiting-reception" iconName="mdi:truck-remove-outline">
|
||||||
<card-link label="EXPÉDITIONS EN ATTENTE" link="/shipment/waiting-shipment" iconName="mdi:truck-cargo-container" />
|
<template #label>
|
||||||
|
Réceptions<br>EN ATTENTE
|
||||||
|
</template>
|
||||||
|
</card-link>
|
||||||
|
<card-link link="/shipment/waiting-shipment" iconName="mdi:truck-cargo-container">
|
||||||
|
<template #label>
|
||||||
|
EXPÉDITIONS<br>EN ATTENTE
|
||||||
|
</template>
|
||||||
|
</card-link>
|
||||||
<card-link label="CASES" link="/" iconName="material-symbols:bottom-sheets-outline" />
|
<card-link label="CASES" link="/" iconName="material-symbols:bottom-sheets-outline" />
|
||||||
<card-link label="RÉCEPTIONS FINIES" link="/reception/finish-reception" iconName="mdi:truck-check-outline" />
|
<card-link label="RÉCEPTIONS FINIES" link="/reception/finish-reception" iconName="mdi:truck-check-outline" />
|
||||||
<card-link label="EXPÉDITIONS FINIES" link="/shipment/finish-shipment" iconName="mdi:truck-delivery-outline" />
|
<card-link label="EXPÉDITIONS FINIES" link="/shipment/finish-shipment" iconName="mdi:truck-delivery-outline" />
|
||||||
<card-link label="PASSEPORT DU BOVIN" link="/" iconName="mdi:cow" />
|
<card-link link="/" iconName="mdi:cow">
|
||||||
|
<template #label>
|
||||||
|
PASSEPORT<br>DU BOVIN
|
||||||
|
</template>
|
||||||
|
</card-link>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -39,13 +39,13 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
<UiButton
|
||||||
type="submit"
|
type="submit"
|
||||||
class="w-full rounded-md bg-primary-500 px-4 py-2 text-base font-semibold text-white transition hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-60"
|
class="w-full rounded-md bg-primary-500 px-4 py-2 text-base font-semibold text-white transition hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-60"
|
||||||
:disabled="isSubmitting"
|
:disabled="isSubmitting"
|
||||||
>
|
>
|
||||||
Connexion
|
Connexion
|
||||||
</button>
|
</UiButton>
|
||||||
<p class="font-bold">v{{ version }}</p>
|
<p class="font-bold">v{{ version }}</p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex justify-between h-[52px] mt-16 mb-[80px]">
|
<div class="flex justify-between h-[52px] mb-[80px]">
|
||||||
<div class="flex flex-1 mr-16">
|
<div class="flex flex-1 mr-16">
|
||||||
<UiStepper
|
<UiStepper
|
||||||
:labels="RECEPTION_STEP_LABELS"
|
:labels="RECEPTION_STEP_LABELS"
|
||||||
@@ -7,12 +7,12 @@
|
|||||||
@select="handleStepSelect"
|
@select="handleStepSelect"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<UiButton
|
||||||
type="button"
|
type="button"
|
||||||
class="flex flex-col justify-center uppercase text-xl bg-black text-white h-[50px] w-[272px] text-center"
|
class="flex flex-col justify-center uppercase text-xl bg-black text-white h-[50px] w-[272px] text-center"
|
||||||
@click="saveAndHold"
|
@click="saveAndHold"
|
||||||
>Mettre en attente
|
>Mettre en attente
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
<ReceptionForm v-if="!storeReception || storeReception.currentStep === 0"/>
|
<ReceptionForm v-if="!storeReception || storeReception.currentStep === 0"/>
|
||||||
<ReceptionWeight v-if="storeReception?.currentStep === 1" mode="gross"/>
|
<ReceptionWeight v-if="storeReception?.currentStep === 1" mode="gross"/>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center justify-start gap-10 mt-16">
|
<div class="flex items-center justify-start gap-10">
|
||||||
<Icon @click="router.push('/')" name="gg:arrow-left-o" style="color: black" size="44" class="cursor-pointer"/>
|
<Icon @click="router.push('/')" name="gg:arrow-left-o" size="44" class="cursor-pointer text-primary-500"/>
|
||||||
<h1 class="text-3xl font-bold uppercase">listes des réceptions finie</h1>
|
<h1 class="text-3xl font-bold uppercase text-primary-500">listes des réceptions finie</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="px-[86px]">
|
<div class="px-[86px]">
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
<div>{{ reception.supplier?.name }}</div>
|
<div>{{ reception.supplier?.name }}</div>
|
||||||
<div>{{ reception.address?.fullAddress }}</div>
|
<div>{{ reception.address?.fullAddress }}</div>
|
||||||
<div>{{ reception.receptionType?.label }}</div>
|
<div>{{ reception.receptionType?.label }}</div>
|
||||||
<div>Plein : {{ formatWeighing(reception, 'gross') }} <br> Vide : {{ formatWeighing(reception, 'tare') }}</div>
|
<div>{{ formatWeighing(reception) }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -36,16 +36,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type {ReceptionData} from "~/services/dto/reception-data";
|
import type {ReceptionData} from "~/services/dto/reception-data";
|
||||||
import {getReceptionList} from "~/services/reception";
|
import {getReceptionList} from "~/services/reception";
|
||||||
|
import type {ShipmentData} from "~/services/dto/shipment-data";
|
||||||
|
|
||||||
const receptionList = ref<ReceptionData[]>()
|
const receptionList = ref<ReceptionData[]>()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const formatWeighing = (reception: ReceptionData, type: 'gross' | 'tare') => {
|
const formatWeighing = (reception: ReceptionData) => {
|
||||||
const entry = reception.weights?.find((weight) => weight.type === type)
|
const gross = reception.weights?.find((weight) => weight.type === 'gross')?.weight
|
||||||
if (!entry || entry.weight == null || entry.dsd == null) {
|
const tare = reception.weights?.find((weight) => weight.type === 'tare')?.weight
|
||||||
|
|
||||||
|
if (gross == null || tare == null) {
|
||||||
return '—'
|
return '—'
|
||||||
}
|
}
|
||||||
return `${entry.weight} kg`
|
|
||||||
|
return `${gross - tare} kg`
|
||||||
}
|
}
|
||||||
|
|
||||||
const goToReception = (id: number) => {
|
const goToReception = (id: number) => {
|
||||||
|
|||||||
@@ -115,14 +115,14 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-center mb-2">
|
<div class="flex justify-center mb-2">
|
||||||
<button
|
<UiButton
|
||||||
v-if="auth.isAdmin"
|
v-if="auth.isAdmin"
|
||||||
type="submit"
|
type="submit"
|
||||||
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] mb-16"
|
class="text-xl uppercase bg-primary-500 text-white h-[50px] w-[272px] mb-16"
|
||||||
|
|
||||||
>
|
>
|
||||||
Enregistrer
|
Enregistrer
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-evenly gap-y-8 gap-x-40 mb-8 border-b border-slate-400">
|
<div class="flex justify-evenly gap-y-8 gap-x-40 mb-8 border-b border-slate-400">
|
||||||
<h1
|
<h1
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center justify-between mt-16">
|
<div class="flex items-center justify-between">
|
||||||
<div class="flex items-center gap-10">
|
<div class="flex items-center gap-10">
|
||||||
<Icon @click="router.push('/')" name="gg:arrow-left-o" style="color: black" size="44" class="cursor-pointer"/>
|
<Icon @click="router.push('/')" name="gg:arrow-left-o" size="44" class="cursor-pointer text-primary-500"/>
|
||||||
<h1 class="text-3xl font-bold uppercase">listes des réceptions en attente</h1>
|
<h1 class="text-3xl font-bold uppercase text-primary-500">listes des réceptions en attente</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="px-[86px]">
|
<div class="px-[86px]">
|
||||||
<div class="mt-6 border border-slate-200 mb-16 ">
|
<div class="mt-6 border border-slate-200 mb-16">
|
||||||
<div class="grid grid-cols-5 gap-4 bg-slate-100 px-4 py-3 text-sm font-semibold uppercase tracking-wide">
|
<div class="grid grid-cols-5 gap-4 bg-slate-100 px-4 py-3 text-sm font-semibold uppercase tracking-wide">
|
||||||
<div>Fournisseur</div>
|
<div>Fournisseur</div>
|
||||||
<div>Adresse</div>
|
<div>Adresse</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="flex justify-between h-[52px] mt-16 mb-[80px]">
|
<div class="flex justify-between h-[52px] mb-[80px]">
|
||||||
<div class="flex flex-1 mr-16">
|
<div class="flex flex-1 mr-16">
|
||||||
<UiStepper
|
<UiStepper
|
||||||
:labels="SHIPMENT_STEP_LABELS"
|
:labels="SHIPMENT_STEP_LABELS"
|
||||||
@@ -9,12 +9,12 @@
|
|||||||
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<UiButton
|
||||||
type="button"
|
type="button"
|
||||||
class="flex flex-col justify-center uppercase text-xl bg-black text-white h-[50px] w-[272px] text-center"
|
class="flex flex-col justify-center uppercase text-xl bg-black text-white h-[50px] w-[272px] text-center"
|
||||||
@click="saveAndHold"
|
@click="saveAndHold"
|
||||||
>Mettre en attente
|
>Mettre en attente
|
||||||
</button>
|
</UiButton>
|
||||||
</div>
|
</div>
|
||||||
<ShipmentForm v-if="!storeShipment || storeShipment.currentStep === 0" ref="shipmentFormRef"/>
|
<ShipmentForm v-if="!storeShipment || storeShipment.currentStep === 0" ref="shipmentFormRef"/>
|
||||||
<ShipmentWeight v-if="storeShipment?.currentStep === 1" mode="gross"/>
|
<ShipmentWeight v-if="storeShipment?.currentStep === 1" mode="gross"/>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center justify-start gap-10 mt-16">
|
<div class="flex items-center justify-start gap-10">
|
||||||
<Icon @click="router.push('/')" name="gg:arrow-left-o" style="color: black" size="44" class="cursor-pointer"/>
|
<Icon @click="router.push('/')" name="gg:arrow-left-o" size="44" class="cursor-pointer text-primary-500"/>
|
||||||
<h1 class="text-3xl font-bold uppercase">listes des expéditions finie</h1>
|
<h1 class="text-3xl font-bold uppercase text-primary-500">listes des expéditions finie</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="px-[86px]">
|
<div class="px-[86px]">
|
||||||
@@ -28,9 +28,9 @@
|
|||||||
<div>{{ shipment.customer?.name }}</div>
|
<div>{{ shipment.customer?.name }}</div>
|
||||||
<div>{{ shipment.address?.fullAddress }}</div>
|
<div>{{ shipment.address?.fullAddress }}</div>
|
||||||
<div>
|
<div>
|
||||||
<template v-if="formatBovinShipmentLines(shipment).length">
|
<template v-if="formatShipmentLines(shipment).length">
|
||||||
<div
|
<div
|
||||||
v-for="(line, index) in formatBovinShipmentLines(shipment)"
|
v-for="(line, index) in formatShipmentLines(shipment)"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="leading-5"
|
class="leading-5"
|
||||||
>
|
>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div>Vide : {{ formatWeighing(shipment, 'tare') }} <br> Plein :{{ formatWeighing(shipment, 'gross') }}</div>
|
<div>{{ formatWeighing(shipment) }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,24 +51,28 @@ import {getShipmentList} from "~/services/shipment";
|
|||||||
const shipmentList = ref<ShipmentData[]>()
|
const shipmentList = ref<ShipmentData[]>()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const formatWeighing = (shipment: ShipmentData, type: 'gross' | 'tare') => {
|
const formatWeighing = (shipment: ShipmentData) => {
|
||||||
const entry = shipment.weights?.find((weight) => weight.type === type)
|
const gross = shipment.weights?.find((weight) => weight.type === 'gross')?.weight
|
||||||
if (!entry || entry.weight == null || entry.dsd == null) {
|
const tare = shipment.weights?.find((weight) => weight.type === 'tare')?.weight
|
||||||
|
|
||||||
|
if (gross == null || tare == null) {
|
||||||
return '—'
|
return '—'
|
||||||
}
|
}
|
||||||
return `${entry.weight} kg`
|
|
||||||
|
return `${gross - tare} kg`
|
||||||
}
|
}
|
||||||
|
|
||||||
const formatBovinShipmentLines = (shipment: ShipmentData) => {
|
|
||||||
if (!shipment.bovinShipments?.length) {
|
const formatShipmentLines = (shipment: ShipmentData) => {
|
||||||
|
if (!shipment.shipmentType && shipment.nbBovinSend == null) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
return shipment.bovinShipments.map((entry) => {
|
|
||||||
const label = typeof entry.shipmentType === 'string'
|
const label = typeof shipment.shipmentType === 'string'
|
||||||
? entry.shipmentType
|
? shipment.shipmentType
|
||||||
: entry.shipmentType?.label
|
: shipment.shipmentType?.label
|
||||||
return `${label ?? '—'} : ${entry.nbBovinSend ?? '—'}`
|
|
||||||
})
|
return [`${label ?? '—'} : ${shipment.nbBovinSend ?? '—'}`]
|
||||||
}
|
}
|
||||||
|
|
||||||
const goShipment = (id: number) => {
|
const goShipment = (id: number) => {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex items-center justify-between mt-16">
|
<div class="flex items-center justify-between">
|
||||||
<div class="flex items-center gap-10">
|
<div class="flex items-center gap-10">
|
||||||
<Icon @click="router.push('/')" name="gg:arrow-left-o" style="color: black" size="44" class="cursor-pointer"/>
|
<Icon @click="router.push('/')" name="gg:arrow-left-o" size="44" class="cursor-pointer text-primary-500"/>
|
||||||
<h1 class="text-3xl font-bold uppercase">listes des expéditions en attente</h1>
|
<h1 class="text-3xl font-bold uppercase text-primary-500">listes des expéditions en attente</h1>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -24,12 +24,12 @@
|
|||||||
@click="goToShipment(shipment.id)"
|
@click="goToShipment(shipment.id)"
|
||||||
@keydown.enter="goToShipment(shipment.id)"
|
@keydown.enter="goToShipment(shipment.id)"
|
||||||
>
|
>
|
||||||
<div>{{ shipment.customer?.label }}</div>
|
<div>{{ shipment.customer?.name }}</div>
|
||||||
<div>{{ shipment.address?.fullAddress }}</div>
|
<div>{{ shipment.address?.fullAddress }}</div>
|
||||||
<div>
|
<div>
|
||||||
<template v-if="formatBovinShipmentLines(shipment).length">
|
<template v-if="formatShipmentLines(shipment).length">
|
||||||
<div
|
<div
|
||||||
v-for="(line, index) in formatBovinShipmentLines(shipment)"
|
v-for="(line, index) in formatShipmentLines(shipment)"
|
||||||
:key="index"
|
:key="index"
|
||||||
class="leading-5"
|
class="leading-5"
|
||||||
>
|
>
|
||||||
@@ -55,16 +55,17 @@ const router = useRouter()
|
|||||||
const goToShipment = (id: number) => {
|
const goToShipment = (id: number) => {
|
||||||
router.push(`/shipment/${id}`)
|
router.push(`/shipment/${id}`)
|
||||||
}
|
}
|
||||||
const formatBovinShipmentLines = (shipment: ShipmentData) => {
|
|
||||||
if (!shipment.bovinShipments?.length) {
|
const formatShipmentLines = (shipment: ShipmentData) => {
|
||||||
|
if (!shipment.shipmentType && shipment.nbBovinSend == null) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
return shipment.bovinShipments.map((entry) => {
|
|
||||||
const label = typeof entry.shipmentType === 'string'
|
const label = typeof shipment.shipmentType === 'string'
|
||||||
? entry.shipmentType
|
? shipment.shipmentType
|
||||||
: entry.shipmentType?.label
|
: shipment.shipmentType?.label
|
||||||
return `${label ?? '—'} : ${entry.nbBovinSend ?? '—'}`
|
|
||||||
})
|
return [`${label ?? '—'} : ${shipment.nbBovinSend ?? '—'}`]
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
import { useApi } from '~/composables/useApi'
|
|
||||||
import type { BovinShipmentData } from '~/services/dto/bovin-shipment-data'
|
|
||||||
import type { ShipmentBovinePayload, BovinShipmentListResponse } from '~/services/dto/bovin-shipment-data'
|
|
||||||
|
|
||||||
export async function getBovinShipmentList(
|
|
||||||
shipmentIri: string
|
|
||||||
): Promise<BovinShipmentData[]> {
|
|
||||||
const api = useApi()
|
|
||||||
const response = await api.get<BovinShipmentListResponse>(
|
|
||||||
'bovin_shipments',
|
|
||||||
{ shipment: shipmentIri },
|
|
||||||
{
|
|
||||||
toastErrorKey: 'errors.shipmentBovine.list'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (Array.isArray(response)) {
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
if (response && typeof response === 'object' && Array.isArray(response['hydra:member'])) {
|
|
||||||
return response['hydra:member']
|
|
||||||
}
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createShipmentBovine(
|
|
||||||
payload: ShipmentBovinePayload
|
|
||||||
): Promise<BovinShipmentData> {
|
|
||||||
const api = useApi()
|
|
||||||
return api.post<BovinShipmentData>('bovin_shipments', payload, {
|
|
||||||
toastErrorKey: 'errors.shipmentBovine.create'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function deleteShipmentBovine(id: number): Promise<void> {
|
|
||||||
const api = useApi()
|
|
||||||
await api.delete<void>(`bovin_shipments/${id}`, {}, {
|
|
||||||
toastErrorKey: 'errors.shipmentBovine.delete'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function updateShipmentBovine(
|
|
||||||
id: number,
|
|
||||||
payload: Partial<ShipmentBovinePayload>
|
|
||||||
): Promise<BovinShipmentData> {
|
|
||||||
const api = useApi()
|
|
||||||
return api.patch<BovinShipmentData>(`bovin_shipments/${id}`, payload, {
|
|
||||||
toastErrorKey: 'errors.shipmentBovine.update'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useApi } from '~/composables/useApi'
|
import { useApi } from '~/composables/useApi'
|
||||||
import type {BovineTypeData} from "~/services/dto/bovine-type-data";
|
import type { BovineTypeData, BovinPayload } from "~/services/dto/bovine-type-data";
|
||||||
|
|
||||||
export type BovineTypeListResponse =
|
export type BovineTypeListResponse =
|
||||||
| BovineTypeData[]
|
| BovineTypeData[]
|
||||||
@@ -12,12 +12,41 @@ export async function getBovineTypeList(): Promise<BovineTypeData[]> {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (Array.isArray(response)) {
|
if (Array.isArray(response)) {
|
||||||
return response
|
return response.map(mapToBovineTypeData)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response && typeof response === 'object' && Array.isArray(response['hydra:member'])) {
|
if (response && typeof response === 'object' && Array.isArray(response['hydra:member'])) {
|
||||||
return response['hydra:member']
|
return response['hydra:member'].map(mapToBovineTypeData)
|
||||||
}
|
}
|
||||||
|
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getBovin(id: number): Promise<BovineTypeData> {
|
||||||
|
const api = useApi()
|
||||||
|
const response = await api.get<BovineTypeData>(`bovine_types/${id}`)
|
||||||
|
return mapToBovineTypeData(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function createBovin(payload: BovinPayload = {}): Promise<BovineTypeData> {
|
||||||
|
const api = useApi()
|
||||||
|
const response = await api.post<BovineTypeData>('bovine_types', toBovineTypePayload(payload))
|
||||||
|
return mapToBovineTypeData(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function updateBovin(id: number, payload: BovinPayload = {}): Promise<BovineTypeData> {
|
||||||
|
const api = useApi()
|
||||||
|
const response = await api.patch<BovineTypeData>(`bovine_types/${id}`, toBovineTypePayload(payload))
|
||||||
|
return mapToBovineTypeData(response)
|
||||||
|
}
|
||||||
|
|
||||||
|
const mapToBovineTypeData = (item: BovineTypeData): BovineTypeData => ({
|
||||||
|
id: item.id,
|
||||||
|
label: item.label,
|
||||||
|
code: item.code
|
||||||
|
})
|
||||||
|
|
||||||
|
const toBovineTypePayload = (payload: BovinPayload): Partial<BovineTypeData> => ({
|
||||||
|
label: payload.label ?? undefined,
|
||||||
|
code: payload.code ?? undefined
|
||||||
|
})
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import type {ShipmentTypeData} from "~/services/dto/shipment-type-data";
|
|
||||||
|
|
||||||
export interface BovinShipmentData {
|
|
||||||
id: number
|
|
||||||
nbBovinSend: number | null
|
|
||||||
shipment?: string | null
|
|
||||||
shipmentType?: ShipmentTypeData | null
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ShipmentBovinePayload = {
|
|
||||||
nbBovinSend: number
|
|
||||||
shipment: string
|
|
||||||
shipmentType: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BovinShipmentListResponse =
|
|
||||||
| BovinShipmentData[]
|
|
||||||
| { 'hydra:member'?: BovinShipmentData[] }
|
|
||||||
@@ -3,3 +3,13 @@ export interface BovineTypeData{
|
|||||||
label: string
|
label: string
|
||||||
code: string
|
code: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface BovinFormData {
|
||||||
|
label: string
|
||||||
|
code: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export type BovinPayload = {
|
||||||
|
label?: string | null
|
||||||
|
code?: string | null
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,12 +9,6 @@ export interface ShipmentTypeData {
|
|||||||
code: string
|
code: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BovinShipmentData {
|
|
||||||
id?: number
|
|
||||||
shipmentType?: ShipmentTypeData | string | null
|
|
||||||
nbBovinSend: number | null
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ShipmentData = {
|
export type ShipmentData = {
|
||||||
id: number
|
id: number
|
||||||
identificationNumber?: string | null
|
identificationNumber?: string | null
|
||||||
@@ -26,7 +20,8 @@ export type ShipmentData = {
|
|||||||
carrier?: CarrierData | null
|
carrier?: CarrierData | null
|
||||||
truck?: TruckData | null
|
truck?: TruckData | null
|
||||||
customer?: CustomerData | null
|
customer?: CustomerData | null
|
||||||
bovinShipments?: BovinShipmentData[] | null
|
shipmentType?: ShipmentTypeData | null
|
||||||
|
nbBovinSend?: number | null
|
||||||
weights?: WeightShipmentEntryData[] | null
|
weights?: WeightShipmentEntryData[] | null
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -59,9 +54,9 @@ export type ShipmentPayload = {
|
|||||||
carrier?: string | null
|
carrier?: string | null
|
||||||
truck?: string | null
|
truck?: string | null
|
||||||
customer?: string | null
|
customer?: string | null
|
||||||
bovinShipments?: string[] | null
|
|
||||||
address?: string | null
|
address?: string | null
|
||||||
user?: string | null
|
user?: string | null
|
||||||
driver?: string | null
|
driver?: string | null
|
||||||
|
shipmentType?: string | null
|
||||||
|
nbBovinSend?: number | null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,16 +8,7 @@ export default <Partial<Config>>{
|
|||||||
},
|
},
|
||||||
colors: {
|
colors: {
|
||||||
primary: {
|
primary: {
|
||||||
50: '#f6f9ea',
|
500: '#456452',
|
||||||
100: '#eaf2cf',
|
|
||||||
200: '#d6e3a4',
|
|
||||||
300: '#c1d47a',
|
|
||||||
400: '#afc85a',
|
|
||||||
500: '#9ebb43',
|
|
||||||
600: '#7e9735',
|
|
||||||
700: '#607228',
|
|
||||||
800: '#414d1a',
|
|
||||||
900: '#24290d'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
52
migrations/Version20260218144828.php
Normal file
52
migrations/Version20260218144828.php
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20260218144828 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('ALTER TABLE bovin_shipment DROP CONSTRAINT fk_7049f4502ee48a36');
|
||||||
|
$this->addSql('ALTER TABLE bovin_shipment DROP CONSTRAINT fk_7049f4507be036fc');
|
||||||
|
$this->addSql('DROP TABLE bovin_shipment');
|
||||||
|
$this->addSql('ALTER TABLE shipment ADD nb_bovin_send INT NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE shipment ADD shipment_type_id INT DEFAULT NULL');
|
||||||
|
$this->addSql('ALTER TABLE shipment ADD CONSTRAINT FK_2CB20DC2EE48A36 FOREIGN KEY (shipment_type_id) REFERENCES shipment_type (id) NOT DEFERRABLE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_2CB20DC2EE48A36 ON shipment (shipment_type_id)');
|
||||||
|
$this->addSql('DROP INDEX uniq_weight_shipment_type');
|
||||||
|
$this->addSql('DROP INDEX uniq_weight_reception_type');
|
||||||
|
$this->addSql('ALTER INDEX idx_weight_shipment RENAME TO IDX_7CD55417BE036FC');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE TABLE bovin_shipment (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, nb_bovin_send INT NOT NULL, shipment_id INT DEFAULT NULL, shipment_type_id INT DEFAULT NULL, PRIMARY KEY (id))');
|
||||||
|
$this->addSql('CREATE INDEX idx_7049f4507be036fc ON bovin_shipment (shipment_id)');
|
||||||
|
$this->addSql('CREATE INDEX idx_7049f4502ee48a36 ON bovin_shipment (shipment_type_id)');
|
||||||
|
$this->addSql('CREATE UNIQUE INDEX uniq_bovin_shipment_one_type ON bovin_shipment (shipment_id)');
|
||||||
|
$this->addSql('ALTER TABLE bovin_shipment ADD CONSTRAINT fk_7049f4502ee48a36 FOREIGN KEY (shipment_type_id) REFERENCES shipment_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE bovin_shipment ADD CONSTRAINT fk_7049f4507be036fc FOREIGN KEY (shipment_id) REFERENCES shipment (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('ALTER TABLE shipment DROP CONSTRAINT FK_2CB20DC2EE48A36');
|
||||||
|
$this->addSql('DROP INDEX IDX_2CB20DC2EE48A36');
|
||||||
|
$this->addSql('ALTER TABLE shipment DROP nb_bovin_send');
|
||||||
|
$this->addSql('ALTER TABLE shipment DROP shipment_type_id');
|
||||||
|
$this->addSql('CREATE UNIQUE INDEX uniq_weight_shipment_type ON weight (shipment_id, type)');
|
||||||
|
$this->addSql('CREATE UNIQUE INDEX uniq_weight_reception_type ON weight (reception_id, type)');
|
||||||
|
$this->addSql('ALTER INDEX idx_7cd55417be036fc RENAME TO idx_weight_shipment');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -251,8 +251,8 @@ class SeedCommand extends Command
|
|||||||
private function seedShipmentTypes(): void
|
private function seedShipmentTypes(): void
|
||||||
{
|
{
|
||||||
$shipmentTypes = [
|
$shipmentTypes = [
|
||||||
['label' => 'Bovin de boucherie', 'code' => 'BDB'],
|
['label' => 'Boucherie', 'code' => 'BDB'],
|
||||||
['label' => "Bovin d'équarrissage", 'code' => 'BE'],
|
['label' => 'Équarrissage', 'code' => 'BE'],
|
||||||
];
|
];
|
||||||
foreach ($shipmentTypes as $type) {
|
foreach ($shipmentTypes as $type) {
|
||||||
$this->upsertByCode(ShipmentType::class, $type['code'], static function (ShipmentType $entity) use ($type) {
|
$this->upsertByCode(ShipmentType::class, $type['code'], static function (ShipmentType $entity) use ($type) {
|
||||||
@@ -540,10 +540,10 @@ class SeedCommand extends Command
|
|||||||
'addresses' => [
|
'addresses' => [
|
||||||
[
|
[
|
||||||
'label' => 'Les producteurs de la marche (LPM)',
|
'label' => 'Les producteurs de la marche (LPM)',
|
||||||
'street' => 'Rue de Nexon',
|
'street' => 'Malonze',
|
||||||
'street2' => null,
|
'street2' => null,
|
||||||
'postalCode' => '87000',
|
'postalCode' => '23300',
|
||||||
'city' => 'LIMOGES',
|
'city' => 'LA SOUTERRAINE',
|
||||||
'countryCode' => 'FR',
|
'countryCode' => 'FR',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -565,15 +565,15 @@ class SeedCommand extends Command
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'TERRENA',
|
'name' => 'TERRENA',
|
||||||
'phone' => '02.51.67.17.98',
|
'phone' => '02.40.98.90.00',
|
||||||
'email' => null,
|
'email' => 'scouillaud@terrena.fr',
|
||||||
'addresses' => [
|
'addresses' => [
|
||||||
[
|
[
|
||||||
'label' => 'TERRENA',
|
'label' => 'TERRENA',
|
||||||
'street' => 'La Blanchardière',
|
'street' => 'LA NOELLE',
|
||||||
'street2' => null,
|
'street2' => 'BP 20199',
|
||||||
'postalCode' => '44522',
|
'postalCode' => '44155',
|
||||||
'city' => 'MESANGER',
|
'city' => 'ANCENIS CEDEX',
|
||||||
'countryCode' => 'FR',
|
'countryCode' => 'FR',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -378,10 +378,10 @@ class ReferenceFixtures extends Fixture
|
|||||||
'addresses' => [
|
'addresses' => [
|
||||||
[
|
[
|
||||||
'label' => 'Les producteurs de la marche (LPM)',
|
'label' => 'Les producteurs de la marche (LPM)',
|
||||||
'street' => 'Rue de Nexon',
|
'street' => 'Malonze',
|
||||||
'street2' => null,
|
'street2' => null,
|
||||||
'postalCode' => '87000',
|
'postalCode' => '23300',
|
||||||
'city' => 'LIMOGES',
|
'city' => 'LA SOUTERRAINE',
|
||||||
'countryCode' => 'FR',
|
'countryCode' => 'FR',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -403,15 +403,15 @@ class ReferenceFixtures extends Fixture
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'TERRENA',
|
'name' => 'TERRENA',
|
||||||
'phone' => '02.51.67.17.98',
|
'phone' => '02.40.98.90.00',
|
||||||
'email' => null,
|
'email' => 'scouillaud@terrena.fr',
|
||||||
'addresses' => [
|
'addresses' => [
|
||||||
[
|
[
|
||||||
'label' => 'TERRENA',
|
'label' => 'TERRENA',
|
||||||
'street' => 'La Blanchardière',
|
'street' => 'LA NOELLE',
|
||||||
'street2' => null,
|
'street2' => 'BP 20199',
|
||||||
'postalCode' => '44522',
|
'postalCode' => '44155',
|
||||||
'city' => 'MESANGER',
|
'city' => 'ANCENIS CEDEX',
|
||||||
'countryCode' => 'FR',
|
'countryCode' => 'FR',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Entity;
|
|
||||||
|
|
||||||
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
|
|
||||||
use ApiPlatform\Metadata\ApiFilter;
|
|
||||||
use ApiPlatform\Metadata\ApiProperty;
|
|
||||||
use ApiPlatform\Metadata\ApiResource;
|
|
||||||
use ApiPlatform\Metadata\Delete;
|
|
||||||
use ApiPlatform\Metadata\Get;
|
|
||||||
use ApiPlatform\Metadata\GetCollection;
|
|
||||||
use ApiPlatform\Metadata\Patch;
|
|
||||||
use ApiPlatform\Metadata\Post;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
|
||||||
use Symfony\Component\Serializer\Attribute\Groups;
|
|
||||||
|
|
||||||
#[ORM\Entity]
|
|
||||||
#[ApiFilter(SearchFilter::class, properties: ['shipment' => 'exact'])]
|
|
||||||
#[ORM\UniqueConstraint(name: 'uniq_bovin_shipment_one_type', columns: ['shipment_id'])]
|
|
||||||
#[ORM\Table(name: 'bovin_shipment')]
|
|
||||||
#[ApiResource(
|
|
||||||
operations: [
|
|
||||||
new Get(
|
|
||||||
requirements: ['id' => '\d+'],
|
|
||||||
normalizationContext: ['groups' => ['shipment-bovine:read']],
|
|
||||||
),
|
|
||||||
new GetCollection(
|
|
||||||
normalizationContext: ['groups' => ['shipment-bovine:read']],
|
|
||||||
),
|
|
||||||
|
|
||||||
new Post(
|
|
||||||
normalizationContext: ['groups' => ['shipment-bovine:read']],
|
|
||||||
denormalizationContext: ['groups' => ['shipment-bovine:write']],
|
|
||||||
),
|
|
||||||
new Patch(
|
|
||||||
normalizationContext: ['groups' => ['shipment-bovine:read']],
|
|
||||||
denormalizationContext: ['groups' => ['shipment-bovine:write']],
|
|
||||||
),
|
|
||||||
new Delete(),
|
|
||||||
],
|
|
||||||
security: "is_granted('ROLE_USER')",
|
|
||||||
)]
|
|
||||||
class BovinShipment
|
|
||||||
{
|
|
||||||
#[ORM\Id]
|
|
||||||
#[ORM\GeneratedValue]
|
|
||||||
#[ORM\Column]
|
|
||||||
#[Groups(['shipment:read', 'shipment-bovine:read'])]
|
|
||||||
private ?int $id = null;
|
|
||||||
|
|
||||||
#[ORM\ManyToOne(inversedBy: 'bovinShipments')]
|
|
||||||
#[Groups(['shipment-bovine:read', 'shipment-bovine:write'])]
|
|
||||||
#[ApiProperty(readableLink: true)]
|
|
||||||
private ?Shipment $shipment = null;
|
|
||||||
|
|
||||||
#[ORM\ManyToOne]
|
|
||||||
#[Groups(['shipment:read', 'shipment-bovine:write', 'shipment-bovine:read'])]
|
|
||||||
#[ApiProperty(readableLink: true)]
|
|
||||||
private ?ShipmentType $shipmentType = null;
|
|
||||||
|
|
||||||
#[ORM\Column]
|
|
||||||
#[Groups(['shipment:read', 'shipment-bovine:write', 'shipment-bovine:read'])]
|
|
||||||
private ?int $nbBovinSend = null;
|
|
||||||
|
|
||||||
public function getId(): ?int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getShipment(): ?Shipment
|
|
||||||
{
|
|
||||||
return $this->shipment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setShipment(?Shipment $shipment): void
|
|
||||||
{
|
|
||||||
$this->shipment = $shipment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getShipmentType(): ?ShipmentType
|
|
||||||
{
|
|
||||||
return $this->shipmentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setShipmentType(?ShipmentType $shipmentType): void
|
|
||||||
{
|
|
||||||
$this->shipmentType = $shipmentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getNbBovinSend(): ?int
|
|
||||||
{
|
|
||||||
return $this->nbBovinSend;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setNbBovinSend(?int $nbBovinSend): void
|
|
||||||
{
|
|
||||||
$this->nbBovinSend = $nbBovinSend;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,6 +7,8 @@ namespace App\Entity;
|
|||||||
use ApiPlatform\Metadata\ApiResource;
|
use ApiPlatform\Metadata\ApiResource;
|
||||||
use ApiPlatform\Metadata\Get;
|
use ApiPlatform\Metadata\Get;
|
||||||
use ApiPlatform\Metadata\GetCollection;
|
use ApiPlatform\Metadata\GetCollection;
|
||||||
|
use ApiPlatform\Metadata\Patch;
|
||||||
|
use ApiPlatform\Metadata\Post;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Serializer\Attribute\Groups;
|
use Symfony\Component\Serializer\Attribute\Groups;
|
||||||
|
|
||||||
@@ -20,6 +22,17 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
new GetCollection(
|
new GetCollection(
|
||||||
normalizationContext: ['groups' => ['bovine-type:read']],
|
normalizationContext: ['groups' => ['bovine-type:read']],
|
||||||
),
|
),
|
||||||
|
new Post(
|
||||||
|
normalizationContext: ['groups' => ['bovine-type:read']],
|
||||||
|
denormalizationContext: ['groups' => ['bovine-type:write']],
|
||||||
|
security: "is_granted('ROLE_ADMIN')",
|
||||||
|
),
|
||||||
|
new Patch(
|
||||||
|
requirements: ['id' => '\d+'],
|
||||||
|
normalizationContext: ['groups' => ['bovine-type:read']],
|
||||||
|
denormalizationContext: ['groups' => ['bovine-type:write']],
|
||||||
|
security: "is_granted('ROLE_ADMIN')",
|
||||||
|
),
|
||||||
],
|
],
|
||||||
security: "is_granted('ROLE_USER')",
|
security: "is_granted('ROLE_USER')",
|
||||||
)]
|
)]
|
||||||
@@ -32,11 +45,11 @@ class BovineType
|
|||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 120)]
|
#[ORM\Column(length: 120)]
|
||||||
#[Groups(['bovine-type:read', 'reception:read', 'reception-bovine:read'])]
|
#[Groups(['bovine-type:read', 'bovine-type:write', 'reception:read', 'reception-bovine:read'])]
|
||||||
private ?string $label = null;
|
private ?string $label = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 50)]
|
#[ORM\Column(length: 50)]
|
||||||
#[Groups(['bovine-type:read', 'reception:read', 'reception-bovine:read'])]
|
#[Groups(['bovine-type:read', 'bovine-type:write', 'reception:read', 'reception-bovine:read'])]
|
||||||
private ?string $code = null;
|
private ?string $code = null;
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
|
|||||||
@@ -123,17 +123,15 @@ class Shipment
|
|||||||
#[ApiProperty(readableLink: true)]
|
#[ApiProperty(readableLink: true)]
|
||||||
private ?Customer $customer = null;
|
private ?Customer $customer = null;
|
||||||
|
|
||||||
/**
|
#[ORM\ManyToOne(inversedBy: 'shipments')]
|
||||||
* @var Collection<int, BovinShipment>
|
#[ORM\JoinColumn(nullable: true)]
|
||||||
*/
|
|
||||||
#[ORM\OneToMany(
|
|
||||||
targetEntity: BovinShipment::class,
|
|
||||||
mappedBy: 'shipment',
|
|
||||||
cascade: ['persist', 'remove'],
|
|
||||||
orphanRemoval: true
|
|
||||||
)]
|
|
||||||
#[Groups(['shipment:read', 'shipment:write'])]
|
#[Groups(['shipment:read', 'shipment:write'])]
|
||||||
private Collection $bovinShipments;
|
#[ApiProperty(readableLink: true)]
|
||||||
|
private ?ShipmentType $shipmentType = null;
|
||||||
|
|
||||||
|
#[ORM\Column]
|
||||||
|
#[Groups(['shipment:read', 'shipment:write'])]
|
||||||
|
private int $nbBovinSend = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Collection<int, Weight>
|
* @var Collection<int, Weight>
|
||||||
@@ -156,8 +154,7 @@ class Shipment
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->bovinShipments = new ArrayCollection();
|
$this->weights = new ArrayCollection();
|
||||||
$this->weights = new ArrayCollection();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
@@ -195,6 +192,26 @@ class Shipment
|
|||||||
$this->currentStep = $currentStep;
|
$this->currentStep = $currentStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getShipmentType(): ?ShipmentType
|
||||||
|
{
|
||||||
|
return $this->shipmentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setShipmentType(?ShipmentType $shipmentType): void
|
||||||
|
{
|
||||||
|
$this->shipmentType = $shipmentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getNbBovinSend(): int
|
||||||
|
{
|
||||||
|
return $this->nbBovinSend;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setNbBovinSend(int $nbBovinSend): void
|
||||||
|
{
|
||||||
|
$this->nbBovinSend = $nbBovinSend;
|
||||||
|
}
|
||||||
|
|
||||||
public function getIsValid(): ?bool
|
public function getIsValid(): ?bool
|
||||||
{
|
{
|
||||||
return $this->isValid;
|
return $this->isValid;
|
||||||
@@ -261,37 +278,6 @@ class Shipment
|
|||||||
$this->customer = $customer;
|
$this->customer = $customer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBovinShipments(): Collection
|
|
||||||
{
|
|
||||||
return $this->bovinShipments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setBovinShipments(Collection $bovinShipments): void
|
|
||||||
{
|
|
||||||
$this->bovinShipments = $bovinShipments;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function addBovinShipment(BovinShipment $bovinShipment): self
|
|
||||||
{
|
|
||||||
if (!$this->bovinShipments->contains($bovinShipment)) {
|
|
||||||
$this->bovinShipments->add($bovinShipment);
|
|
||||||
$bovinShipment->setShipment($this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function removeBovinShipment(BovinShipment $bovinShipment): self
|
|
||||||
{
|
|
||||||
if ($this->bovinShipments->removeElement($bovinShipment)) {
|
|
||||||
if ($bovinShipment->getShipment() === $this) {
|
|
||||||
$bovinShipment->setShipment(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection<int, Weight>
|
* @return Collection<int, Weight>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ namespace App\Entity;
|
|||||||
use ApiPlatform\Metadata\ApiResource;
|
use ApiPlatform\Metadata\ApiResource;
|
||||||
use ApiPlatform\Metadata\Get;
|
use ApiPlatform\Metadata\Get;
|
||||||
use ApiPlatform\Metadata\GetCollection;
|
use ApiPlatform\Metadata\GetCollection;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Serializer\Attribute\Groups;
|
use Symfony\Component\Serializer\Attribute\Groups;
|
||||||
|
|
||||||
@@ -40,6 +42,14 @@ class ShipmentType
|
|||||||
#[Groups(['shipment-type:read', 'shipment:read'])]
|
#[Groups(['shipment-type:read', 'shipment:read'])]
|
||||||
private ?string $code = null;
|
private ?string $code = null;
|
||||||
|
|
||||||
|
#[ORM\OneToMany(mappedBy: 'shipmentType', targetEntity: Shipment::class)]
|
||||||
|
private Collection $shipments;
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->shipments = new ArrayCollection();
|
||||||
|
}
|
||||||
|
|
||||||
public function getId(): ?int
|
public function getId(): ?int
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
),
|
),
|
||||||
new GetCollection(
|
new GetCollection(
|
||||||
normalizationContext: ['groups' => ['supplier:read']],
|
normalizationContext: ['groups' => ['supplier:read']],
|
||||||
security: "is_granted('ROLE_ADMIN')"
|
security: "is_granted('ROLE_USER')"
|
||||||
),
|
),
|
||||||
new Post(
|
new Post(
|
||||||
normalizationContext: ['groups' => ['supplier:read']],
|
normalizationContext: ['groups' => ['supplier:read']],
|
||||||
|
|||||||
@@ -250,13 +250,11 @@
|
|||||||
<td>
|
<td>
|
||||||
<strong>Bovin</strong><br><br>
|
<strong>Bovin</strong><br><br>
|
||||||
<div class="bigtable-notes">
|
<div class="bigtable-notes">
|
||||||
{% if shipment.bovinShipments is not empty %}
|
{% if shipment.shipmentType %}
|
||||||
{% for entry in shipment.bovinShipments %}
|
<p>
|
||||||
<p>
|
{{ shipment.shipmentType.label ?? '-' }} :
|
||||||
{{ entry.shipmentType ? entry.shipmentType.label : '-' }} :
|
{{ shipment.nbBovinSend ?? 0 }}
|
||||||
{{ entry.nbBovinSend ?? 0 }}
|
</p>
|
||||||
</p>
|
|
||||||
{% endfor %}
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>-</p>
|
<p>-</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user