chore: update frontend configuration
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
<template>
|
||||
<main class="container mx-auto px-6 py-8 space-y-8">
|
||||
|
||||
|
||||
<div class="card bg-base-100 shadow-xl">
|
||||
<div class="card-body space-y-6">
|
||||
<div class="flex items-center gap-3">
|
||||
@@ -12,7 +10,9 @@
|
||||
/>
|
||||
</span>
|
||||
<div>
|
||||
<h2 class="card-title text-2xl">Nouveau type de machine</h2>
|
||||
<h2 class="card-title text-2xl">
|
||||
Nouveau type de machine
|
||||
</h2>
|
||||
<p class="text-sm text-gray-500">
|
||||
Complétez les informations puis enregistrez pour générer le nouveau type.
|
||||
</p>
|
||||
@@ -37,7 +37,9 @@
|
||||
</div>
|
||||
<template v-else>
|
||||
<div v-if="recentTypes.length" class="space-y-4">
|
||||
<h3 class="text-xl font-semibold">Types générés récemment</h3>
|
||||
<h3 class="text-xl font-semibold">
|
||||
Types générés récemment
|
||||
</h3>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
<article
|
||||
v-for="type in recentTypes"
|
||||
@@ -46,10 +48,14 @@
|
||||
>
|
||||
<div class="card-body space-y-2">
|
||||
<div class="flex items-center justify-between">
|
||||
<h4 class="card-title text-base">{{ type.name }}</h4>
|
||||
<h4 class="card-title text-base">
|
||||
{{ type.name }}
|
||||
</h4>
|
||||
<span v-if="type.category" class="badge badge-outline badge-sm">{{ type.category }}</span>
|
||||
</div>
|
||||
<p class="text-sm text-gray-600 line-clamp-3">{{ type.description || 'Aucune description' }}</p>
|
||||
<p class="text-sm text-gray-600 line-clamp-3">
|
||||
{{ type.description || 'Aucune description' }}
|
||||
</p>
|
||||
<div class="text-xs text-gray-500 flex items-center gap-2">
|
||||
<span class="inline-flex items-center gap-1">
|
||||
<IconLucideClipboardList class="h-4 w-4" aria-hidden="true" />
|
||||
@@ -94,7 +100,7 @@ const createEmptyType = () => ({
|
||||
maintenanceFrequency: '',
|
||||
customFields: [],
|
||||
componentRequirements: [],
|
||||
pieceRequirements: [],
|
||||
pieceRequirements: []
|
||||
})
|
||||
|
||||
const draftType = ref(createEmptyType())
|
||||
@@ -115,7 +121,7 @@ onMounted(async () => {
|
||||
})
|
||||
|
||||
const parseOptions = (field = {}) => {
|
||||
if (field.type !== 'select') return []
|
||||
if (field.type !== 'select') { return [] }
|
||||
if (field.optionsText && typeof field.optionsText === 'string') {
|
||||
return field.optionsText
|
||||
.split('\n')
|
||||
@@ -157,7 +163,7 @@ const normalizeComponentRequirements = (requirements = []) =>
|
||||
minCount: toIntegerOrNull(req.minCount, 1),
|
||||
maxCount: toIntegerOrNull(req.maxCount, null),
|
||||
required: req.required ?? true,
|
||||
allowNewModels: req.allowNewModels ?? true,
|
||||
allowNewModels: req.allowNewModels ?? true
|
||||
}))
|
||||
|
||||
const normalizePieceRequirements = (requirements = []) =>
|
||||
@@ -169,10 +175,10 @@ const normalizePieceRequirements = (requirements = []) =>
|
||||
minCount: toIntegerOrNull(req.minCount, 0),
|
||||
maxCount: toIntegerOrNull(req.maxCount, null),
|
||||
required: req.required ?? false,
|
||||
allowNewModels: req.allowNewModels ?? true,
|
||||
allowNewModels: req.allowNewModels ?? true
|
||||
}))
|
||||
|
||||
const buildPayload = (typeData) => ({
|
||||
const buildPayload = typeData => ({
|
||||
name: typeData.name,
|
||||
description: typeData.description,
|
||||
category: typeData.category,
|
||||
@@ -204,7 +210,7 @@ const handleSubmit = async () => {
|
||||
} else if (result?.error) {
|
||||
showError(result.error)
|
||||
} else {
|
||||
showError("Impossible de créer le type.")
|
||||
showError('Impossible de créer le type.')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user