fix/conceptos-catalogo-general
This commit is contained in:
@@ -30,7 +30,8 @@
|
||||
|
||||
// 👇 3. Estado limpio: Solo lo que existe en la BD
|
||||
let formData = $state({
|
||||
classification: ''
|
||||
classification: '',
|
||||
description: ''
|
||||
});
|
||||
|
||||
let loading = $state(false);
|
||||
@@ -38,14 +39,18 @@
|
||||
|
||||
// Cargar datos al abrir
|
||||
$effect(() => {
|
||||
if (item) {
|
||||
formData = {
|
||||
classification: item.classification || ''
|
||||
};
|
||||
} else {
|
||||
formData = {
|
||||
classification: ''
|
||||
};
|
||||
if (open) {
|
||||
if (item) {
|
||||
formData = {
|
||||
classification: item.classification || '',
|
||||
description: item.description || ''
|
||||
};
|
||||
} else {
|
||||
formData = {
|
||||
classification: '',
|
||||
description: ''
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -63,7 +68,8 @@
|
||||
throw new Error('El nombre de la clasificación es requerido');
|
||||
|
||||
const dataToSend = {
|
||||
classification: formData.classification.trim()
|
||||
classification: formData.classification.trim(),
|
||||
description: formData.description ? formData.description.trim() : null
|
||||
};
|
||||
|
||||
// 👇 5. Llamar a la API pasando el companyId
|
||||
@@ -112,6 +118,15 @@
|
||||
maxlength={30}
|
||||
/>
|
||||
</div>
|
||||
<div class="grid gap-2">
|
||||
<Label for="description">Descripción</Label>
|
||||
<Input
|
||||
id="description"
|
||||
bind:value={formData.description}
|
||||
placeholder="Ej: Descripción general"
|
||||
maxlength={255}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Dialog.Footer>
|
||||
|
||||
Reference in New Issue
Block a user