Se agrego la forma de seleccion de clase, cliente y unidades de medida
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
import ClientSelectorDialog from '$lib/components/dashboard/parts/client-selector-dialog.svelte';
|
||||
import ClassSelectorDialog from '$lib/components/dashboard/parts/class-selector-dialog.svelte';
|
||||
import MaterialTypeSelectorDialog from '$lib/components/dashboard/parts/material-type-selector-dialog.svelte';
|
||||
import UnitMeasureSelectorDialog from '$lib/components/dashboard/parts/unit-measure-dialog.svelte';
|
||||
|
||||
// --- 1. IDENTIFICACIÓN ---
|
||||
let id = $derived($page.params.id === 'new' ? null : Number($page.params.id));
|
||||
@@ -45,6 +46,8 @@
|
||||
let showClientModal = $state(false);
|
||||
let showClassModal = $state(false);
|
||||
let showMaterialModal = $state(false);
|
||||
let showUOMModal = $state(false);
|
||||
let showAltUOMModal = $state(false);
|
||||
|
||||
// Descripciones Visuales
|
||||
let selectedClientName = $state("");
|
||||
@@ -61,7 +64,7 @@
|
||||
description_spanish: '',
|
||||
description_english: '',
|
||||
part_class: '',
|
||||
material_type: '', // Corregido: coincide con backend
|
||||
material_type: '',
|
||||
country_of_origin: 'MEX',
|
||||
unit_of_measure: 'PZ', // U.M. TIGIE
|
||||
|
||||
@@ -215,6 +218,14 @@
|
||||
selectedMaterialDesc = item.description;
|
||||
}
|
||||
|
||||
function handleUOMSelect(item: any) {
|
||||
formData.unit_of_measure = item.code;
|
||||
}
|
||||
|
||||
function handleAltUOMSelect(item: any) {
|
||||
formData.alternate_unit_measure = item.code;
|
||||
}
|
||||
|
||||
// --- SUBMIT ---
|
||||
async function handleSubmit() {
|
||||
error = null;
|
||||
@@ -393,24 +404,25 @@
|
||||
</div> -->
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="uom" class="required">Comercial</Label>
|
||||
<Select.Root type="single" bind:value={formData.unit_of_measure}>
|
||||
<Select.Trigger id="uom" class="font-mono">
|
||||
{formData.unit_of_measure || 'Seleccione...'}
|
||||
</Select.Trigger>
|
||||
<Select.Content class="max-h-[300px]">
|
||||
<Select.Group>
|
||||
<Select.Label>Comunes</Select.Label>
|
||||
<Select.Item value="PZ">Pieza (PZ)</Select.Item>
|
||||
<Select.Item value="KG">Kilogramo (KG)</Select.Item>
|
||||
<Select.Item value="L">Litro (L)</Select.Item>
|
||||
<Select.Item value="M">Metro Lineal (M)</Select.Item>
|
||||
<Select.Item value="M2">Metro Cuadrado (M2)</Select.Item>
|
||||
<Select.Item value="JGO">Juego (JGO)</Select.Item>
|
||||
<Select.Item value="PAR">Par (PAR)</Select.Item>
|
||||
</Select.Group>
|
||||
</Select.Content>
|
||||
</Select.Root>
|
||||
<Label for="uom" class="required">Unidad de Medida (TIGIE)</Label>
|
||||
<div class="flex gap-2">
|
||||
<div class="relative flex-1">
|
||||
<div class="absolute left-3 top-2.5 text-muted-foreground">
|
||||
<Scale class="h-4 w-4" />
|
||||
</div>
|
||||
<Input
|
||||
id="uom"
|
||||
bind:value={formData.unit_of_measure}
|
||||
placeholder="Seleccione..."
|
||||
class="pl-9 font-mono cursor-pointer"
|
||||
readonly
|
||||
onclick={() => showUOMModal = true}
|
||||
/>
|
||||
</div>
|
||||
<Button variant="outline" size="icon" type="button" onclick={() => showUOMModal = true}>
|
||||
<Search class="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -563,27 +575,25 @@
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="alt_um">Unidad de Medida Comercial</Label>
|
||||
<Select.Root type="single" bind:value={formData.alternate_unit_measure}>
|
||||
<Select.Trigger id="alt_um" class="font-mono">
|
||||
{formData.alternate_unit_measure || 'Seleccione...'}
|
||||
</Select.Trigger>
|
||||
<Select.Content class="max-h-[300px]">
|
||||
<Select.Group>
|
||||
<Select.Label>Comunes</Select.Label>
|
||||
<Select.Item value="PZ">Pieza (PZ)</Select.Item>
|
||||
<Select.Item value="KG">Kilogramo (KG)</Select.Item>
|
||||
<Select.Item value="L">Litro (L)</Select.Item>
|
||||
<Select.Item value="M">Metro Lineal (M)</Select.Item>
|
||||
<Select.Item value="M2">Metro Cuadrado (M2)</Select.Item>
|
||||
<Select.Item value="JGO">Juego (JGO)</Select.Item>
|
||||
<Select.Item value="PAR">Par (PAR)</Select.Item>
|
||||
<Select.Item value="SET">Set (SET)</Select.Item>
|
||||
<Select.Item value="CAJA">Caja (CAJA)</Select.Item>
|
||||
<Select.Item value="PK">Paquete (PK)</Select.Item>
|
||||
</Select.Group>
|
||||
</Select.Content>
|
||||
</Select.Root>
|
||||
<Label for="uom" class="required">Unidad de medida alternativa</Label>
|
||||
<div class="flex gap-2">
|
||||
<div class="relative flex-1">
|
||||
<div class="absolute left-3 top-2.5 text-muted-foreground">
|
||||
<Scale class="h-4 w-4" />
|
||||
</div>
|
||||
<Input
|
||||
id="uom"
|
||||
bind:value={formData.alternate_unit_measure}
|
||||
placeholder="Seleccione..."
|
||||
class="pl-9 font-mono cursor-pointer"
|
||||
readonly
|
||||
onclick={() => showAltUOMModal = true}
|
||||
/>
|
||||
</div>
|
||||
<Button variant="outline" size="icon" type="button" onclick={() => showAltUOMModal = true}>
|
||||
<Search class="h-4 w-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -658,6 +668,16 @@
|
||||
onSelect={handleMaterialSelect}
|
||||
/>
|
||||
|
||||
<UnitMeasureSelectorDialog
|
||||
bind:open={showUOMModal}
|
||||
onSelect={handleUOMSelect}
|
||||
/>
|
||||
|
||||
<UnitMeasureSelectorDialog
|
||||
bind:open={showAltUOMModal}
|
||||
onSelect={handleAltUOMSelect}
|
||||
/>
|
||||
|
||||
<style>
|
||||
:global(.required::after) {
|
||||
content: " *";
|
||||
|
||||
Reference in New Issue
Block a user