From 9e1504ddb7a303d0dae625b61d8f2d3edbd6e544 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Tue, 24 Mar 2026 23:31:25 +0100 Subject: [PATCH] feat(machine) : add entity history section to machine detail page Co-Authored-By: Claude Opus 4.6 (1M context) --- app/composables/useEntityHistory.ts | 3 ++- app/pages/machine/[id].vue | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/app/composables/useEntityHistory.ts b/app/composables/useEntityHistory.ts index 12b0a5e..9be67b8 100644 --- a/app/composables/useEntityHistory.ts +++ b/app/composables/useEntityHistory.ts @@ -23,6 +23,7 @@ export type EntityHistoryEntry = { } const ENTITY_ENDPOINTS: Record = { + machine: '/machines', composant: '/composants', piece: '/pieces', product: '/products', @@ -35,7 +36,7 @@ const extractItems = (payload: any): EntityHistoryEntry[] => { return [] } -export function useEntityHistory(entityType: 'composant' | 'piece' | 'product') { +export function useEntityHistory(entityType: 'machine' | 'composant' | 'piece' | 'product') { const { get } = useApi() const basePath = ENTITY_ENDPOINTS[entityType] diff --git a/app/pages/machine/[id].vue b/app/pages/machine/[id].vue index bb80d32..d8ed188 100644 --- a/app/pages/machine/[id].vue +++ b/app/pages/machine/[id].vue @@ -138,6 +138,14 @@ @confirm="handleAddEntity" /> + + +
{ onMounted(() => { d.loadMachineData() d.loadInitialData() + loadHistory(String(machineId)).catch(() => {}) if (route.query.edit === 'true' && canEdit.value) { d.isEditMode.value = true