From 92141c65644ec7711b2831626edf0b0ee765c0db Mon Sep 17 00:00:00 2001 From: Matthieu Date: Wed, 25 Mar 2026 10:09:44 +0100 Subject: [PATCH] feat(detail) : add consultation pages for piece, composant, product Add read-only detail pages with edit/view toggle for piece, composant and product, matching the existing machine detail pattern. Empty fields and documents section are hidden in consultation mode. Catalogs and cross-links updated to point to the new detail pages. Co-Authored-By: Claude Opus 4.6 (1M context) --- app/components/ComponentItem.vue | 2 +- app/components/DetailHeader.vue | 40 ++ app/components/PieceItem.vue | 2 +- app/composables/useComponentCreate.ts | 2 +- app/composables/useComponentEdit.ts | 1 + app/composables/usePieceEdit.ts | 1 + app/pages/comments.vue | 6 +- app/pages/component-catalog.vue | 14 +- app/pages/component/[id]/index.vue | 517 ++++++++++++++++++++++ app/pages/piece/[id].vue | 449 +++++++++++++++++++ app/pages/pieces-catalog.vue | 14 +- app/pages/pieces/create.vue | 2 +- app/pages/product-catalog.vue | 14 +- app/pages/product/[id]/index.vue | 609 ++++++++++++++++++++++++++ app/pages/product/create.vue | 4 +- 15 files changed, 1659 insertions(+), 18 deletions(-) create mode 100644 app/components/DetailHeader.vue create mode 100644 app/pages/component/[id]/index.vue create mode 100644 app/pages/piece/[id].vue create mode 100644 app/pages/product/[id]/index.vue diff --git a/app/components/ComponentItem.vue b/app/components/ComponentItem.vue index da8c2dc..6de2d7b 100644 --- a/app/components/ComponentItem.vue +++ b/app/components/ComponentItem.vue @@ -127,7 +127,7 @@ Voir le produit diff --git a/app/components/DetailHeader.vue b/app/components/DetailHeader.vue new file mode 100644 index 0000000..d54869a --- /dev/null +++ b/app/components/DetailHeader.vue @@ -0,0 +1,40 @@ + + + diff --git a/app/components/PieceItem.vue b/app/components/PieceItem.vue index 4d72aeb..579c535 100644 --- a/app/components/PieceItem.vue +++ b/app/components/PieceItem.vue @@ -180,7 +180,7 @@

Ouvrir la fiche produit diff --git a/app/composables/useComponentCreate.ts b/app/composables/useComponentCreate.ts index cd7c6c4..40ab58f 100644 --- a/app/composables/useComponentCreate.ts +++ b/app/composables/useComponentCreate.ts @@ -344,7 +344,7 @@ export function useComponentCreate() { selectedDocuments.value = [] } toast.showSuccess('Composant créé avec succès') - await router.replace(`/component/${createdComponent.id}/edit`) + await router.replace(`/component/${createdComponent.id}?edit=true`) } else if (result.error) { toast.showError(result.error) diff --git a/app/composables/useComponentEdit.ts b/app/composables/useComponentEdit.ts index 48dafc6..48e9afe 100644 --- a/app/composables/useComponentEdit.ts +++ b/app/composables/useComponentEdit.ts @@ -569,6 +569,7 @@ export function useComponentEdit(componentId: string) { handleFilesAdded, refreshDocuments, submitEdition, + fetchComponent, setSlotQuantity, setPieceSlotSelection, setProductSlotSelection, diff --git a/app/composables/usePieceEdit.ts b/app/composables/usePieceEdit.ts index 99226c4..8053dc0 100644 --- a/app/composables/usePieceEdit.ts +++ b/app/composables/usePieceEdit.ts @@ -467,6 +467,7 @@ export function usePieceEdit(pieceId: string) { handleFilesAdded, setProductSelection, submitEdition, + fetchPiece, formatPieceStructurePreview, } } diff --git a/app/pages/comments.vue b/app/pages/comments.vue index a6ca3fc..05f31e7 100644 --- a/app/pages/comments.vue +++ b/app/pages/comments.vue @@ -243,9 +243,9 @@ const handleResolve = async (commentId: string) => { const ENTITY_ROUTE_MAP: Record string> = { machine: (id: string) => `/machine/${id}`, - piece: (id: string) => `/pieces/${id}/edit`, - composant: (id: string) => `/component/${id}/edit`, - product: (id: string) => `/product/${id}/edit`, + piece: (id: string) => `/piece/${id}`, + composant: (id: string) => `/component/${id}`, + product: (id: string) => `/product/${id}`, piece_category: (id: string) => `/piece-category/${id}/edit`, component_category: (id: string) => `/component-category/${id}/edit`, product_category: (id: string) => `/product-category/${id}/edit`, diff --git a/app/pages/component-catalog.vue b/app/pages/component-catalog.vue index 4920fd0..a6ef97b 100644 --- a/app/pages/component-catalog.vue +++ b/app/pages/component-catalog.vue @@ -96,12 +96,14 @@ diff --git a/app/pages/component/[id]/index.vue b/app/pages/component/[id]/index.vue new file mode 100644 index 0000000..819f4b3 --- /dev/null +++ b/app/pages/component/[id]/index.vue @@ -0,0 +1,517 @@ +