From 8eada1243833c980404c63eb6692b453b9da1398 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Thu, 16 Oct 2025 10:05:32 +0200 Subject: [PATCH] feat: add file upload on componet and delete code champs --- app/components/StructureNodeEditor.vue | 6 +- app/components/model-types/ManagementView.vue | 4 +- app/components/model-types/ModelTypeForm.vue | 74 +++---- app/components/model-types/Table.vue | 3 - app/components/model-types/Toolbar.vue | 5 +- app/pages/component/[id]/edit.vue | 195 +++++++++++++++++- app/pages/component/create.vue | 47 +++++ app/pages/pieces/[id]/edit.vue | 195 +++++++++++++++++- app/pages/pieces/create.vue | 47 +++++ app/services/modelTypes.ts | 2 +- 10 files changed, 527 insertions(+), 51 deletions(-) diff --git a/app/components/StructureNodeEditor.vue b/app/components/StructureNodeEditor.vue index 6f62e5e..b3929f1 100644 --- a/app/components/StructureNodeEditor.vue +++ b/app/components/StructureNodeEditor.vue @@ -266,10 +266,8 @@ const lockedTypeDisplay = computed(() => { return getComponentTypeLabel(props.node?.typeComposantId) || 'Famille non définie' }) -const formatModelTypeOption = (type: ModelTypeOption | undefined | null) => { - if (!type) return '' - return type.code ? `${type.name} (${type.code})` : type.name -} +const formatModelTypeOption = (type: ModelTypeOption | undefined | null) => + type?.name ?? '' const componentTypeMap = computed(() => { const map = new Map() diff --git a/app/components/model-types/ManagementView.vue b/app/components/model-types/ManagementView.vue index 2a535ae..8a0d72e 100644 --- a/app/components/model-types/ManagementView.vue +++ b/app/components/model-types/ManagementView.vue @@ -68,7 +68,7 @@ const props = withDefaults( const selectedCategory = ref(props.category); const searchInput = ref(""); const searchTerm = ref(""); -const sort = ref<"name" | "code" | "createdAt">("createdAt"); +const sort = ref<"name" | "createdAt">("createdAt"); const dir = ref<"asc" | "desc">("desc"); const limit = ref(20); const offset = ref(0); @@ -188,7 +188,7 @@ const onCategoryChange = (value: ModelCategory) => { } }; -const onSortChange = (value: "name" | "code" | "createdAt") => { +const onSortChange = (value: "name" | "createdAt") => { if (sort.value !== value) { sort.value = value; refresh({ resetOffset: true }); diff --git a/app/components/model-types/ModelTypeForm.vue b/app/components/model-types/ModelTypeForm.vue index e61119c..a0f887f 100644 --- a/app/components/model-types/ModelTypeForm.vue +++ b/app/components/model-types/ModelTypeForm.vue @@ -18,26 +18,6 @@ />

{{ errors.name }}

- -
- - -

Caractères autorisés : lettres, chiffres, -, _ et .

-

{{ errors.code }}

-
-
- {{ item.code }}

{{ item.notes }}

Pas de notes

diff --git a/app/components/model-types/Toolbar.vue b/app/components/model-types/Toolbar.vue index 9717be8..5e6b180 100644 --- a/app/components/model-types/Toolbar.vue +++ b/app/components/model-types/Toolbar.vue @@ -28,7 +28,7 @@ :value="search" type="search" class="grow min-w-0" - placeholder="Rechercher par nom ou code…" + placeholder="Rechercher par nom…" autocomplete="off" @input="onSearch" /> @@ -43,7 +43,6 @@ @change="emit('update:sort', ($event.target as HTMLSelectElement).value as SortField)" > - @@ -80,7 +79,7 @@ import { computed } from 'vue'; import IconLucidePlus from '~icons/lucide/plus'; import IconLucideSearch from '~icons/lucide/search'; -type SortField = 'name' | 'code' | 'createdAt'; +type SortField = 'name' | 'createdAt'; type SortDirection = 'asc' | 'desc'; const props = defineProps<{ diff --git a/app/pages/component/[id]/edit.vue b/app/pages/component/[id]/edit.vue index 09b58b3..a39e8fe 100644 --- a/app/pages/component/[id]/edit.vue +++ b/app/pages/component/[id]/edit.vue @@ -1,4 +1,9 @@