chore(frontend): clean remaining templates and configs
This commit is contained in:
@@ -6,9 +6,7 @@
|
||||
<p class="text-sm text-gray-500">Gérez les constructeurs et leurs coordonnées.</p>
|
||||
</div>
|
||||
<button class="btn btn-primary" @click="openCreateModal">
|
||||
<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 6v12m6-6H6" />
|
||||
</svg>
|
||||
<IconLucidePlus class="w-4 h-4 mr-2" aria-hidden="true" />
|
||||
Nouveau constructeur
|
||||
</button>
|
||||
</div>
|
||||
@@ -108,6 +106,7 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { useConstructeurs } from '~/composables/useConstructeurs'
|
||||
import { useToast } from '~/composables/useToast'
|
||||
import IconLucidePlus from '~icons/lucide/plus'
|
||||
|
||||
const { constructeurs, loading, searchConstructeurs, createConstructeur, updateConstructeur, deleteConstructeur, loadConstructeurs } = useConstructeurs()
|
||||
const { showError, showSuccess } = useToast()
|
||||
|
||||
@@ -31,9 +31,7 @@
|
||||
@click="selectProfile(profile.id)"
|
||||
>
|
||||
<span>{{ profile.firstName }} {{ profile.lastName }}</span>
|
||||
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
<IconLucideChevronRight class="w-4 h-4" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
<p v-else class="text-sm text-base-content/60">Aucun profil enregistré.</p>
|
||||
@@ -59,6 +57,7 @@ import { onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useProfiles } from '#imports'
|
||||
import { useProfileSession } from '#imports'
|
||||
import IconLucideChevronRight from '~icons/lucide/chevron-right'
|
||||
|
||||
const router = useRouter()
|
||||
const { profiles, loadingProfiles, fetchProfiles } = useProfiles()
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useMachineTypesApi } from '~/composables/useMachineTypesApi'
|
||||
import { useToast } from '~/composables/useToast'
|
||||
@@ -61,7 +61,7 @@ const loading = ref(true)
|
||||
const saving = ref(false)
|
||||
|
||||
// Données éditées du type
|
||||
const editedType = reactive({
|
||||
const editedType = ref({
|
||||
name: '',
|
||||
description: '',
|
||||
category: '',
|
||||
@@ -75,11 +75,13 @@ const saveChanges = async () => {
|
||||
try {
|
||||
saving.value = true
|
||||
|
||||
const currentEditedType = editedType.value
|
||||
|
||||
// Préparer les données pour l'API
|
||||
const updatedType = {
|
||||
...editedType,
|
||||
...currentEditedType,
|
||||
// Traiter les champs personnalisés
|
||||
customFields: editedType.customFields
|
||||
customFields: (currentEditedType.customFields || [])
|
||||
.filter(field => field.name.trim() !== '')
|
||||
.map(field => ({
|
||||
name: field.name,
|
||||
@@ -91,7 +93,7 @@ const saveChanges = async () => {
|
||||
: []
|
||||
})),
|
||||
// Traiter les pièces principales
|
||||
machinePieces: editedType.machinePieces
|
||||
machinePieces: (currentEditedType.machinePieces || [])
|
||||
.filter(piece => piece.name.trim() !== '')
|
||||
.map(piece => ({
|
||||
name: piece.name,
|
||||
@@ -112,7 +114,7 @@ const saveChanges = async () => {
|
||||
}))
|
||||
})),
|
||||
// Traiter les composants
|
||||
components: editedType.components
|
||||
components: (currentEditedType.components || [])
|
||||
.filter(comp => comp.name.trim() !== '')
|
||||
.map(comp => ({
|
||||
name: comp.name,
|
||||
@@ -185,7 +187,7 @@ onMounted(async () => {
|
||||
console.log('Type loaded successfully:', type.value)
|
||||
|
||||
// Initialiser les données éditées
|
||||
Object.assign(editedType, {
|
||||
editedType.value = {
|
||||
name: type.value.name || '',
|
||||
description: type.value.description || '',
|
||||
category: type.value.category || '',
|
||||
@@ -193,7 +195,7 @@ onMounted(async () => {
|
||||
customFields: type.value.customFields || [],
|
||||
machinePieces: type.value.machinePieces || [],
|
||||
components: type.value.components || []
|
||||
})
|
||||
}
|
||||
} else {
|
||||
console.error('Failed to load type:', result.error)
|
||||
showError('Type non trouvé')
|
||||
|
||||
Reference in New Issue
Block a user