feat: improve site management and type forms

This commit is contained in:
Matthieu
2025-09-17 11:13:57 +02:00
parent dd0ef12b46
commit c63b543c74
4 changed files with 667 additions and 1619 deletions

View File

@@ -112,18 +112,8 @@
<h3 class="card-title text-lg">Champs personnalisés du type</h3>
<span class="badge badge-primary">{{ formData.customFields.length }}</span>
</div>
<button
type="button"
@click="addCustomField"
class="btn btn-primary btn-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter un champ
</button>
</div>
<div v-if="expandedSections.customFields" class="space-y-4">
<div
v-for="(field, fieldIndex) in formData.customFields"
@@ -237,6 +227,30 @@
</div>
</div>
</div>
<div v-if="expandedSections.customFields" class="flex justify-end">
<button
type="button"
@click="addCustomField"
class="btn btn-primary btn-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter un champ
</button>
</div>
<div v-else class="flex justify-end">
<button
type="button"
@click="addCustomField"
class="btn btn-primary btn-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter un champ
</button>
</div>
</div>
</div>
@@ -263,18 +277,8 @@
<h3 class="card-title text-lg">Pièces principales</h3>
<span class="badge badge-secondary">{{ formData.machinePieces.length }}</span>
</div>
<button
type="button"
@click="addMachinePiece"
class="btn btn-primary btn-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter une pièce
</button>
</div>
<div v-if="expandedSections.machinePieces" class="space-y-4">
<div
v-for="(piece, pieceIndex) in formData.machinePieces"
@@ -372,21 +376,9 @@
</div>
<!-- Champs personnalisés de la pièce -->
<div v-if="isPieceExpanded(pieceIndex)" class="mt-4">
<div class="flex items-center gap-2 mb-2">
<span class="text-sm font-medium">Champs personnalisés de cette pièce :</span>
<button
type="button"
@click="addPieceCustomField(pieceIndex)"
class="btn btn-xs btn-outline"
>
<svg class="w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter
</button>
</div>
<div v-if="isPieceExpanded(pieceIndex)" class="mt-4 space-y-2">
<span class="text-sm font-medium">Champs personnalisés de cette pièce :</span>
<div class="space-y-2">
<div
v-for="(field, fieldIndex) in piece.customFields"
@@ -472,9 +464,45 @@
</div>
</div>
</div>
<div class="flex justify-end">
<button
type="button"
@click="addPieceCustomField(pieceIndex)"
class="btn btn-xs btn-outline"
>
<svg class="w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter
</button>
</div>
</div>
</div>
</div>
<div v-if="expandedSections.machinePieces" class="flex justify-end">
<button
type="button"
@click="addMachinePiece"
class="btn btn-primary btn-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter une pièce
</button>
</div>
<div v-else class="flex justify-end">
<button
type="button"
@click="addMachinePiece"
class="btn btn-primary btn-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter une pièce
</button>
</div>
</div>
</div>
@@ -501,16 +529,6 @@
<h3 class="card-title text-lg">Composants</h3>
<span class="badge badge-accent">{{ formData.components.length }}</span>
</div>
<button
type="button"
@click="addComponent"
class="btn btn-primary btn-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter un composant
</button>
</div>
<div v-if="expandedSections.components" class="space-y-4">
@@ -610,21 +628,9 @@
</div>
<!-- Champs personnalisés du composant -->
<div v-if="isComponentExpanded(componentIndex)" class="mt-4">
<div class="flex items-center gap-2 mb-2">
<span class="text-sm font-medium">Champs personnalisés du composant :</span>
<button
type="button"
@click="addComponentCustomField(componentIndex)"
class="btn btn-xs btn-outline"
>
<svg class="w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter
</button>
</div>
<div v-if="isComponentExpanded(componentIndex)" class="mt-4 space-y-2">
<span class="text-sm font-medium">Champs personnalisés du composant :</span>
<div class="space-y-2">
<div
v-for="(field, fieldIndex) in component.customFields"
@@ -710,15 +716,10 @@
</div>
</div>
</div>
</div>
<!-- Pièces du composant -->
<div class="mt-4">
<div class="flex items-center gap-2 mb-2">
<span class="text-sm font-medium">Pièces du composant :</span>
<div class="flex justify-end">
<button
type="button"
@click="addComponentPiece(componentIndex)"
@click="addComponentCustomField(componentIndex)"
class="btn btn-xs btn-outline"
>
<svg class="w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
@@ -727,7 +728,12 @@
Ajouter
</button>
</div>
</div>
<!-- Pièces du composant -->
<div class="mt-4 space-y-2">
<span class="text-sm font-medium">Pièces du composant :</span>
<div class="space-y-2">
<div
v-for="(piece, pieceIndex) in component.pieces"
@@ -885,9 +891,45 @@
</div>
</div>
</div>
<div class="flex justify-end">
<button
type="button"
@click="addComponentPiece(componentIndex)"
class="btn btn-xs btn-outline"
>
<svg class="w-3 h-3 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter
</button>
</div>
</div>
</div>
</div>
<div v-if="expandedSections.components" class="flex justify-end">
<button
type="button"
@click="addComponent"
class="btn btn-primary btn-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter un composant
</button>
</div>
<div v-else class="flex justify-end">
<button
type="button"
@click="addComponent"
class="btn btn-primary btn-sm"
>
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6"></path>
</svg>
Ajouter un composant
</button>
</div>
</div>
</div>