Enable adding a component, piece, or product to a machine by selecting only the category (ModelType) without a specific entity. The link displays a red "À remplir" badge; clicking it reopens the modal pre-filled with the category so the user can associate an item later. Backend: entity FKs made nullable on the 3 link tables, modelType FK added, controller/audit/version/MCP normalization adapted for null entities. Frontend: modal accepts category-only confirm, page handles fill mode, hierarchy builder creates pending nodes, display components show clickable badge with event propagation through the full hierarchy. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
49 lines
1.1 KiB
Vue
49 lines
1.1 KiB
Vue
<template>
|
|
<div class="space-y-4">
|
|
<!-- Root Components -->
|
|
<div v-for="component in components" :key="component.id" class="border border-gray-200 rounded-lg p-4">
|
|
<ComponentItem
|
|
:component="component"
|
|
:is-edit-mode="isEditMode"
|
|
:show-delete="showDelete"
|
|
:collapse-all="collapseAll"
|
|
:toggle-token="toggleToken"
|
|
@update="$emit('update', $event)"
|
|
@edit-piece="$emit('edit-piece', $event)"
|
|
@custom-field-update="$emit('custom-field-update', $event)"
|
|
@delete="$emit('delete')"
|
|
@fill-entity="(linkId, typeId) => $emit('fill-entity', linkId, typeId)"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import ComponentItem from './ComponentItem.vue'
|
|
|
|
defineProps({
|
|
components: {
|
|
type: Array,
|
|
required: true
|
|
},
|
|
isEditMode: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
showDelete: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
collapseAll: {
|
|
type: Boolean,
|
|
default: true
|
|
},
|
|
toggleToken: {
|
|
type: Number,
|
|
default: 0
|
|
}
|
|
})
|
|
|
|
defineEmits(['update', 'edit-piece', 'custom-field-update', 'delete', 'fill-entity'])
|
|
</script>
|