From 316a20c43adc0e85471f6b4a383afd7b0d138ad8 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 16 Feb 2026 16:05:04 +0100 Subject: [PATCH] feat : creation du composant datatable (WIP) --- config/packages/api_platform.yaml | 2 + config/reference.php | 4 +- frontend/components/ui/UiDataTable.vue | 278 +++++++++++++++++- frontend/pages/datatable.vue | 15 +- frontend/pages/reception/finish-reception.vue | 66 ++--- frontend/pages/shipment/finish-shipment.vue | 82 ++---- frontend/utils/datatable-formatters.ts | 41 +++ 7 files changed, 358 insertions(+), 130 deletions(-) create mode 100644 frontend/utils/datatable-formatters.ts diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml index 4b2b414..fd961f8 100644 --- a/config/packages/api_platform.yaml +++ b/config/packages/api_platform.yaml @@ -3,6 +3,8 @@ api_platform: version: 1.0.0 defaults: stateless: true + pagination_client_items_per_page: true + pagination_maximum_items_per_page: 100 cache_headers: vary: ['Content-Type', 'Authorization', 'Origin'] formats: diff --git a/config/reference.php b/config/reference.php index 0178e3e..21e0803 100644 --- a/config/reference.php +++ b/config/reference.php @@ -1,7 +1,5 @@ - - - - - - -
- {{ column }} -
+
+ + + + + + + + + + + + + + + +
+ {{ column.label }} +
+ Chargement... +
+ Aucune donnée +
+ +
+

+ {{ pageLabel }} +

+
+ + + +
+
+
diff --git a/frontend/pages/datatable.vue b/frontend/pages/datatable.vue index fde42e6..402cc73 100644 --- a/frontend/pages/datatable.vue +++ b/frontend/pages/datatable.vue @@ -1,10 +1,19 @@ - diff --git a/frontend/pages/reception/finish-reception.vue b/frontend/pages/reception/finish-reception.vue index bd8c1d0..579c647 100644 --- a/frontend/pages/reception/finish-reception.vue +++ b/frontend/pages/reception/finish-reception.vue @@ -1,58 +1,34 @@ diff --git a/frontend/pages/shipment/finish-shipment.vue b/frontend/pages/shipment/finish-shipment.vue index 9a84ea0..53b900c 100644 --- a/frontend/pages/shipment/finish-shipment.vue +++ b/frontend/pages/shipment/finish-shipment.vue @@ -4,44 +4,12 @@

listes des expéditions finie

-
-
-
-
Numéro
-
Date
-
Client
-
Adresse
-
Type d'expéditon
-
Poids
-
-
-
{{ shipment.identificationNumber }}
-
{{ shipment.shipmentDate }}
-
{{ shipment.customer?.name }}
-
{{ shipment.address?.fullAddress }}
-
- -
-
Vide : {{ formatWeighing(shipment, 'tare') }}
Plein :{{ formatWeighing(shipment, 'gross') }}
-
-
-
+ diff --git a/frontend/utils/datatable-formatters.ts b/frontend/utils/datatable-formatters.ts new file mode 100644 index 0000000..860e22a --- /dev/null +++ b/frontend/utils/datatable-formatters.ts @@ -0,0 +1,41 @@ +export const formatBovinShipments = (value: unknown): string => { + if (!Array.isArray(value) || value.length === 0) return '-' + return value.map((item: any) => { + const label = item?.shipmentType?.label ?? item?.shipmentType?.code ?? + 'Type inconnu' + const qty = item?.nbBovinSend ?? '-' + return `${label} (${qty})` + }).join(', ') +} + +export const formatWeights = (value: unknown): string => { + if (!Array.isArray(value) || value.length === 0) return '-' + + return value + .map((item: any) => { + const type = item?.type === 'tare' + ? 'Poids à vide' + : item?.type === 'gross' + ? 'Poids à plein' + : (item?.type ?? 'Poids') + + const weight = item?.weight ?? '-' + return `${type}: ${weight}` + }) + .join(', ') +} + +export const formatPelletBuildings = (value: unknown): string => { + if (!Array.isArray(value) || value.length === 0) return '-' + + return value + .map((item: any) => { + const pelletLabel = + item?.pelletType?.label ?? item?.pelletType?.code ?? 'Granule inconnu' + const buildingLabel = + item?.building?.label ?? item?.building?.code ?? 'Bâtiment inconnu' + + return `${pelletLabel} : ${buildingLabel}` + }) + .join('\n') +}