From 1b4764878e9ff4d70a21a70244129f2c6a1e2fb0 Mon Sep 17 00:00:00 2001 From: tristan Date: Wed, 22 Apr 2026 13:25:57 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20ajout=20du=20composant=20datatable=20su?= =?UTF-8?q?r=20tous=20les=20=C3=A9crans=20(!48)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit | Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [ ] Pas de régression - [ ] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: https://gitea.malio.fr/MALIO-DEV/Ferme/pulls/48 Co-authored-by: tristan Co-committed-by: tristan --- config/packages/api_platform.yaml | 2 + frontend/components/ui/UiDataTable.vue | 233 ++++++++++++++++++ frontend/components/ui/UiDateInput.vue | 10 +- frontend/components/ui/UiSelect.vue | 12 +- frontend/components/ui/UiTextInput.vue | 12 +- .../components/ui/license-plate-input.vue | 2 +- .../composables/useDataTableServerState.ts | 102 ++++++++ frontend/pages/admin/bovin/bovin-list.vue | 82 +++--- frontend/pages/admin/carrier/carrier-list.vue | 73 +++--- .../pages/admin/customer/customer-list.vue | 86 ++++--- .../pages/admin/supplier/supplier-list.vue | 86 ++++--- frontend/pages/admin/user/list.vue | 133 +++++----- frontend/pages/infrastructure/case.vue | 126 +++++++--- frontend/pages/reception/finish-reception.vue | 146 ++++++++--- .../pages/reception/waiting-reception.vue | 155 +++++++++--- frontend/pages/shipment/finish-shipment.vue | 177 +++++++++---- frontend/pages/shipment/waiting-shipment.vue | 179 +++++++++++--- src/Entity/Bovine.php | 9 + src/Entity/BovineType.php | 6 + src/Entity/Carrier.php | 6 + src/Entity/Customer.php | 8 + src/Entity/Reception.php | 10 + src/Entity/Shipment.php | 10 + src/Entity/Supplier.php | 8 + src/Entity/User.php | 8 +- 25 files changed, 1297 insertions(+), 384 deletions(-) create mode 100644 frontend/components/ui/UiDataTable.vue create mode 100644 frontend/composables/useDataTableServerState.ts diff --git a/config/packages/api_platform.yaml b/config/packages/api_platform.yaml index 4b2b414..c686cc6 100644 --- a/config/packages/api_platform.yaml +++ b/config/packages/api_platform.yaml @@ -5,6 +5,8 @@ api_platform: stateless: true cache_headers: vary: ['Content-Type', 'Authorization', 'Origin'] + pagination_client_items_per_page: true + pagination_maximum_items_per_page: 100 formats: json: ['application/json'] jsonld: ['application/ld+json'] diff --git a/frontend/components/ui/UiDataTable.vue b/frontend/components/ui/UiDataTable.vue new file mode 100644 index 0000000..e385879 --- /dev/null +++ b/frontend/components/ui/UiDataTable.vue @@ -0,0 +1,233 @@ + + + diff --git a/frontend/components/ui/UiDateInput.vue b/frontend/components/ui/UiDateInput.vue index b756cb8..e4f54f7 100644 --- a/frontend/components/ui/UiDateInput.vue +++ b/frontend/components/ui/UiDateInput.vue @@ -14,8 +14,9 @@ :value="modelValue ?? ''" :disabled="disabled" v-bind="attrs" - class="border-b border-primary-700 justify-self-start text-xl text-primary-700 py-[6px] uppercase bg-transparent appearance-none h-[34px]" + class="w-full min-w-0 border-b border-primary-700 justify-self-start text-primary-700 bg-transparent appearance-none" :class="[ + sizeClass, isEmpty ? 'text-neutral-400' : 'text-primary-700', disabled ? 'cursor-not-allowed' : 'cursor-pointer', inputClass @@ -36,12 +37,14 @@ const props = withDefaults( label?: string modelValue: string | null | undefined disabled?: boolean + size?: 'default' | 'compact' wrapperClass?: string labelClass?: string inputClass?: string }>(), { disabled: false, + size: 'default', wrapperClass: '', labelClass: '', inputClass: '' @@ -54,6 +57,11 @@ const emit = defineEmits<{ const attrs = useAttrs() const isEmpty = computed(() => !props.modelValue) +const sizeClass = computed(() => + props.size === 'compact' + ? 'text-sm h-8 font-normal normal-case tracking-normal' + : 'text-xl py-[6px] uppercase h-[34px]' +) const onInput = (event: Event) => { const target = event.target as HTMLInputElement diff --git a/frontend/components/ui/UiSelect.vue b/frontend/components/ui/UiSelect.vue index ecc2c71..2ab9730 100644 --- a/frontend/components/ui/UiSelect.vue +++ b/frontend/components/ui/UiSelect.vue @@ -13,15 +13,16 @@ :value="modelValue ?? ''" :disabled="disabled || loading" v-bind="attrs" - class="border-b border-primary-700 justify-self-start text-xl text-primary-700 py-[6px] bg-transparent" + class="w-full min-w-0 border-b border-primary-700 justify-self-start text-primary-700 bg-transparent" :class="[ + sizeClass, isEmpty ? 'text-neutral-400' : 'text-primary-700', disabled || loading ? 'cursor-not-allowed' : 'cursor-pointer', selectClass ]" @change="onChange" > -