feat : ajout de commentaire

This commit is contained in:
2026-01-30 09:12:59 +01:00
parent 81e624100d
commit c0f113547e
6 changed files with 66 additions and 12 deletions

33
.idea/workspace.xml generated
View File

@@ -4,12 +4,14 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="feat : ajout de la partie reception des marchandises (étape 3) et modification du bon de réception">
<list default="true" id="7c107abe-5995-4428-8429-b146aaca8386" name="Changes" comment="feat : update CHANGELOG.md">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/reference.php" beforeDir="false" afterPath="$PROJECT_DIR$/config/reference.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/components/reception/reception-form.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/reception/reception-form.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/components/reception/reception-product-received.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/reception/reception-product-received.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/components/ui/license-plate-input.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/ui/license-plate-input.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/components/reception/reception-weight.vue" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/components/reception/reception-weight.vue" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/composables/usePdfPrinter.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/composables/usePdfPrinter.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/utils/constants.ts" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/utils/constants.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -274,7 +276,8 @@
<workItem from="1769413136483" duration="58000" />
<workItem from="1769413279223" duration="40490000" />
<workItem from="1769612160652" duration="23952000" />
<workItem from="1769696465294" duration="7587000" />
<workItem from="1769696465294" duration="8573000" />
<workItem from="1769756623432" duration="3392000" />
</task>
<task id="LOCAL-00001" summary="feat : Ajout de pinia, création de la table weight et reception mise en place du système de step pour les receptions (WIP)">
<option name="closed" value="true" />
@@ -588,7 +591,23 @@
<option name="project" value="LOCAL" />
<updated>1769700808988</updated>
</task>
<option name="localTasksCounter" value="40" />
<task id="LOCAL-00040" summary="feat : mise en place de composant UI pour les select, checkbox, date, text">
<option name="closed" value="true" />
<created>1769705141157</created>
<option name="number" value="00040" />
<option name="presentableId" value="LOCAL-00040" />
<option name="project" value="LOCAL" />
<updated>1769705141157</updated>
</task>
<task id="LOCAL-00041" summary="feat : update CHANGELOG.md">
<option name="closed" value="true" />
<created>1769705240487</created>
<option name="number" value="00041" />
<option name="presentableId" value="LOCAL-00041" />
<option name="project" value="LOCAL" />
<updated>1769705240487</updated>
</task>
<option name="localTasksCounter" value="42" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -638,8 +657,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="feat : ajout de la conf pour le déploiement en recette" />
<MESSAGE value="fix : fix de la conf pour le déploiement en recette" />
<MESSAGE value="fix : migration apache vers nginx pour un déploiement plus simple" />
<MESSAGE value="fix : dernière modification pour le déploiement en recette et le changement de conf vers nginx" />
<MESSAGE value="ci: auto tag + release artefact" />
@@ -663,7 +680,9 @@
<MESSAGE value="feat : finalisation de l'étape 1 &quot;Réception&quot; (formulaire)" />
<MESSAGE value="feat : ajout du numéro identification des receptions et ajustement du bon de reception" />
<MESSAGE value="feat : ajout de la partie reception des marchandises (étape 3) et modification du bon de réception" />
<option name="LAST_COMMIT_MESSAGE" value="feat : ajout de la partie reception des marchandises (étape 3) et modification du bon de réception" />
<MESSAGE value="feat : mise en place de composant UI pour les select, checkbox, date, text" />
<MESSAGE value="feat : update CHANGELOG.md" />
<option name="LAST_COMMIT_MESSAGE" value="feat : update CHANGELOG.md" />
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />

View File

@@ -142,6 +142,7 @@ import type {DriverData} from '~/services/dto/driver-data'
import {getDriverList} from '~/services/driver'
import type {VehicleData} from '~/services/dto/vehicle-data'
import {getVehicleList} from '~/services/vehicle'
import {SUPLLIER_CODE} from "~/utils/constants";
type ReceptionFormData = {
licensePlate: string
@@ -185,12 +186,16 @@ const isLoadingDrivers = ref(false)
const vehicles = ref<VehicleData[]>([])
const isLoadingVehicles = ref(false)
const authStore = useAuthStore()
// Empêche les watchers de reset des champs pendant le remplissage initial
const isHydrating = ref(false)
const liotCode = 'LIOT'
// Transporteur sélectionné dans le formulaire
const selectedCarrier = computed(() =>
carriers.value.find((carrier) => String(carrier.id) === form.carrierId) ?? null
)
const isLiotCarrier = computed(() => selectedCarrier.value?.code === liotCode)
// Indique si le transporteur est LIOT
const isLiotCarrier = computed(() => selectedCarrier.value?.code === SUPLLIER_CODE.LIOT)
// Adresses disponibles pour le fournisseur sélectionné
const supplierAddresses = computed(() => {
const supplierId = Number(form.supplierId)
if (!Number.isFinite(supplierId)) {
@@ -198,13 +203,15 @@ const supplierAddresses = computed(() => {
}
return suppliers.value.find((supplier) => supplier.id === supplierId)?.addresses ?? []
})
const filteredDrivers = computed(() => {
// Chauffeurs filtrés par transporteur (LIOT)
const filteredDrivers = computed<DriverData[]>(() => {
if (!form.carrierId) {
return []
}
return drivers.value.filter((driver) => String(driver.carrier?.id) === form.carrierId)
})
const filteredVehicles = computed(() => {
// Véhicules filtrés par transporteur + type de camion
const filteredVehicles = computed<VehicleData[]>(() => {
if (!form.carrierId) {
return []
}
@@ -215,6 +222,7 @@ const filteredVehicles = computed(() => {
)
})
// Hydrate le formulaire depuis la réception en cours
watch(
() => receptionStore.current,
(reception) => {
@@ -247,6 +255,7 @@ watch(
{immediate: true}
)
// Charge la liste des users pour le select
const loadUsers = async () => {
isLoadingUsers.value = true
try {
@@ -256,6 +265,7 @@ const loadUsers = async () => {
}
}
// Charge la liste des fournisseurs pour le select
const loadSuppliers = async () => {
isLoadingSuppliers.value = true
try {
@@ -265,6 +275,7 @@ const loadSuppliers = async () => {
}
}
// Charge la liste des camions pour le select
const loadTrucks = async () => {
isLoadingTrucks.value = true
try {
@@ -274,6 +285,7 @@ const loadTrucks = async () => {
}
}
// Charge la liste des transporteurs pour le select
const loadCarriers = async () => {
isLoadingCarriers.value = true
try {
@@ -283,6 +295,7 @@ const loadCarriers = async () => {
}
}
// Charge la liste des chauffeurs pour le select
const loadDrivers = async () => {
isLoadingDrivers.value = true
try {
@@ -292,6 +305,7 @@ const loadDrivers = async () => {
}
}
// Charge la liste des véhicules pour le select
const loadVehicles = async () => {
isLoadingVehicles.value = true
try {
@@ -301,6 +315,7 @@ const loadVehicles = async () => {
}
}
// On met le user connecté par défaut dans le select
const setDefaultUser = () => {
if (form.userId) {
return
@@ -310,6 +325,7 @@ const setDefaultUser = () => {
}
}
// On récupère toutes les données des selects au chargement du composant
onMounted(async () => {
receptionTypes.value = await getReceptionTypeList()
await loadUsers()
@@ -322,6 +338,7 @@ onMounted(async () => {
setDefaultUser()
})
// Ajuste driver/vehicle quand le transporteur change (logique LIOT)
watch(
() => [form.supplierId, suppliers.value],
() => {
@@ -346,6 +363,7 @@ watch(
{immediate: true}
)
// Valide/auto-sélectionne le véhicule selon camion + transporteur (LIOT)
watch(
() => form.carrierId,
() => {
@@ -372,6 +390,7 @@ watch(
{immediate: true}
)
// Récupère la plaque depuis le véhicule choisi (LIOT)
watch(
() => [form.truckId, form.carrierId, vehicles.value],
() => {
@@ -395,6 +414,7 @@ watch(
{immediate: true}
)
// Auto-renseigne le véhicule si la plaque correspond (LIOT)
watch(
() => [form.vehicleId, form.carrierId, vehicles.value],
() => {
@@ -428,6 +448,7 @@ watch(
}
)
// Valide le formulaire et crée/met à jour la réception
async function validate() {
const normalizedLicensePlate = form.licensePlate.trim()
const normalizedReceptionDate = form.receptionDate.trim()

View File

@@ -98,12 +98,16 @@ const selectedBuildingIds = ref<string[]>([])
const selectedPelletBuildingIds = ref<Record<string, string[]>>({})
const merchandiseDetail = ref('')
// Type de marchandise sélectionné dans le select
const selectedMerchandiseType = computed(() =>
merchandiseTypes.value.find((type) => String(type.id) === selectedMerchandiseTypeId.value)
)
// Indique si le type est "Granulé"
const isGranule = computed(() => selectedMerchandiseType.value?.code === MERCHANDISE_TYPE_CODES.GRANULE)
// Indique si le type est "Autres"
const isAutres = computed(() => selectedMerchandiseType.value?.code === MERCHANDISE_TYPE_CODES.AUTRES)
// Charge les référentiels et hydrate le formulaire depuis la réception
onMounted(async () => {
const [merchandiseTypeList, buildingList, pelletTypeList] = await Promise.all([
getMerchandiseTypeList(),
@@ -142,6 +146,7 @@ onMounted(async () => {
selectedPelletBuildingIds.value = selectionMap
})
// Enregistre les sélections et passe à l'étape suivante
async function goNext() {
if (!receptionStore.current) {
return
@@ -168,6 +173,7 @@ async function goNext() {
}
}
// Supprime toutes les associations granulés/bâtiments existantes
async function clearPelletSelections(receptionIri: string) {
const existing = await getReceptionPelletBuildingList(receptionIri)
for (const selection of existing) {
@@ -175,6 +181,7 @@ async function clearPelletSelections(receptionIri: string) {
}
}
// Synchronise les associations granulés/bâtiments avec l'état du formulaire
async function syncPelletSelections(receptionIri: string) {
const existing = await getReceptionPelletBuildingList(receptionIri)
const existingMap = new Map<string, number>()

View File

@@ -62,10 +62,12 @@ const {
updateReception: receptionStore.updateReception,
loadReception: receptionStore.loadReception
})
// Affiche le bouton de génération du bon à l'étape tare
const showGenerateReceipt = computed(
() => props.mode === 'tare' && displayWeight.value !== null
)
// Génère le bon de réception, puis clôture la réception
const printReceipt = async () => {
if (!import.meta.client || !receptionStore.current) {
return
@@ -88,6 +90,7 @@ const printReceipt = async () => {
await router.push('/')
}
// Récupère le poids dès l'arrivée sur l'écran
onMounted(() => {
fetchWeight()
})

View File

@@ -24,7 +24,7 @@ export const usePdfPrinter = () => {
a.click();
a.remove();
window.open(blobUrl, '_blank', 'noopener,noreferrer');
// L'ouverture dans un nouvel onglet déclenche un 2e PDF sans le nom personnalisé.
setTimeout(() => URL.revokeObjectURL(blobUrl), 60_000);
}

View File

@@ -6,3 +6,7 @@ export const MERCHANDISE_TYPE_CODES = {
GRANULE: 'GRANULE',
AUTRES: 'AUTRES'
} as const
export const SUPLLIER_CODE = {
LIOT: 'LIOT'
}