Prevents memory exhaustion (OOM) on production server when loading
pieces, products, and composants in the component edit page.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Align with useProducts pattern: loaded flag, cache-first return,
loading guard, and clearCache helper to avoid redundant API calls.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Primary #304998 (bleu Malio), base #FBFAFA (gris), accent #ED8521
(orange), secondary #A5ACD0 (lavande). Focus ring updated to match.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
New /activity-log page showing all audit entries across pieces, products
and composants. Includes entity type and action filters, expandable
diffs, clickable entity links and pagination. Navbar link added under
Ressources liées.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Type columns in piece, component and product catalogs now link
directly to the category edit page for quick access.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The init watcher destructured currentType/currentStructure before
setting selectedTypeId, so the values were stale (null). This caused
refreshCustomFieldInputs to receive null structure → empty definitions,
permanently wiping custom field display on piece and component edit pages.
Read selectedType.value / selectedTypeStructure.value after setting the
ID so the computed is already updated. Also remove the guard on the
piece selectedType watcher that prevented recovery.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove redundant getCustomFieldValuesByEntity() calls (use entity response)
- Remove redundant refreshDocuments() from onMounted (docs already in entity)
- Make loadHistory() non-blocking (fire-and-forget)
- Defer bulk catalog loads on component edit (pieces/products/composants)
- Use pieceTypes cache instead of separate getModelType() call on piece edit
- Try embedded typeProduct from entity response on product edit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add abort controllers and request deduplication to composables
- Add entity type cache invalidation on create/update/delete flows
- Add 179 new tests (utilities, services, composables, components)
- Fix Vue runtime warnings in structure editors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Set up Vitest with happy-dom, mock Nuxt auto-imports via #imports alias.
Add tests for: inventory-types validators (9), apiHelpers (10),
modelUtils (18), useConfirm (8), useToast (9). All 54 tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create useConfirm composable (promise-based, singleton state) and
ConfirmModal component. Replace all 10 confirm()/window.confirm() calls
across 9 pages and 1 composable.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract 680-line navbar into LayoutAppNavbar component with useNavDropdown
composable. app.vue reduced from 698 to 22 LOC.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract 3 entity composables (useEntityCustomFields, useEntityDocuments,
useEntityProductDisplay) and entityCustomFieldLogic utility shared across
ComponentItem (1336→585 LOC) and PieceItem (1588→740 LOC).
Improve type safety in edit/create pages with explicit casts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract useMachineCreatePage composable and 5 preview/selector components
from machines/new.vue, reducing it from 1231 to 196 LOC.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract 2 composables (useMachineDetailData, useMachineSkeletonEditor) and
7 UI components from machine/[id].vue, reducing it from 2989 to 219 LOC.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove all console.log/warn/debug/info from production code across 6
files. Keep console.error for legitimate error handling (72 instances).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extend ComponentModelPiece/Product with optional typePiece/typeProduct
nested objects. Replace 12 'as any' casts in assignment node, convert
Promise<any> to Promise<unknown>, use Record<string, unknown> at API
boundaries. ~15 casts eliminated.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create useEntityTypes.ts with CRUD + singleton state by category.
Rewrite useComponentTypes, usePieceTypes, useProductTypes as thin
wrappers that rename fields for backward compatibility.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create useEntityHistory.ts with parameterized entity type. Rewrite
useComponentHistory, usePieceHistory, useProductHistory as thin
backward-compatible wrappers (67→13 LOC each).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create shared/utils/apiHelpers.ts with generic extractCollection<T>()
that handles hydra:member, member, items, data, and array formats.
Replace 7 local implementations in CRUD composables.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Convert 7 composables from JS to TS with proper type annotations:
useApi, useCustomFields, useProfileSession, useProfiles, useToast,
useMachineTypesApi, useMachines. Remove deprecated stubs
useComponentModels.js and usePieceModels.js.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract assignment normalization utils to shared/utils/assignmentUtils.ts.
Extract selection state management to composables/useMachineCreateSelections.ts.
Extract preview computation and validation to composables/useMachineCreatePreview.ts.
Wire machines/new.vue to use extracted modules (-47% LOC).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Wire machine/[id].vue to import from extracted utility modules
(customFieldUtils, productDisplayUtils, useMachineHierarchy, useMachinePrint).
Remove ~1400 LOC of inline functions replaced by imports.
Fix TypeScript errors in extracted composables (AnyRecord/ConstructeurSummary
boundary casts, Map generics, optional chaining on unknown).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract ~1300 LOC of reusable logic into dedicated modules:
- shared/utils/customFieldUtils.ts: field normalization, merge, dedup, display
- shared/utils/productDisplayUtils.ts: product resolution and display helpers
- composables/useMachineHierarchy.ts: hierarchy tree builder from links
- composables/useMachinePrint.ts: print selection and execution logic
These extractions prepare the ground for wiring [id].vue to import
from these modules instead of inlining all logic.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When a category has linked items (pieces, components, products),
enable restricted mode instead of blocking all edits:
- Allow adding new custom fields
- Lock existing fields from modification or deletion
- Hide add buttons for products, pieces, and subcomponents
- Display informative message about restricted mode
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix constructeurUtils: réordonner delete/add pour sauvegarder les fournisseurs
- Fix prix/supplierPrice: envoyer en string pour DECIMAL Doctrine
- Fix useMachineTypesApi: normaliser les requirements et forceRefresh
- Fix SearchSelect: watch deep sur baseOptions
- Debug logs temporaires pour pieceRequirements
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix missing <template> tag in product/create.vue causing build error
- Preserve constructeurIds when product already has constructeurs loaded
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>