formulario de items en por tipo de factura: exportaciones y reparaciones de exportacion
This commit is contained in:
@@ -80,99 +80,103 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
<!-- Left Side: Labeling & Valuation -->
|
||||
<fieldset class="border rounded-md p-2 space-y-2">
|
||||
<legend class="text-xs font-semibold px-2 bg-gray-200 dark:bg-gray-700 uppercase">Labeling & Valuation</legend>
|
||||
|
||||
{#if visibility.showLabelingStandard}
|
||||
<div class="grid grid-cols-1 {visibility.showLabelingLeftSection ? 'md:grid-cols-2' : ''} gap-2">
|
||||
{#if visibility.showLabelingLeftSection}
|
||||
<!-- Left Side: Labeling & Valuation -->
|
||||
<fieldset class="border rounded-md p-2 space-y-2">
|
||||
<legend class="text-xs font-semibold px-2 bg-gray-200 dark:bg-gray-700 uppercase">Labeling & Valuation</legend>
|
||||
|
||||
{#if visibility.showLabelingStandard}
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="space-y-1">
|
||||
<Label for="numero_etiqueta" class="text-xs">Label Number:</Label>
|
||||
<Input id="numero_etiqueta" bind:value={descriptions.lot} class="h-7 text-xs" />
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<Label for="tipo_etiqueta" class="text-xs">Label Type:</Label>
|
||||
<Input id="tipo_etiqueta" bind:value={descriptions.entry_number} class="h-7 text-xs" />
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
<div class="space-y-1">
|
||||
<Label for="numero_etiqueta" class="text-xs">Label Number:</Label>
|
||||
<Input id="numero_etiqueta" bind:value={descriptions.lot} class="h-7 text-xs" />
|
||||
</div>
|
||||
<div class="space-y-1">
|
||||
<Label for="tipo_etiqueta" class="text-xs">Label Type:</Label>
|
||||
<Input id="tipo_etiqueta" bind:value={descriptions.entry_number} class="h-7 text-xs" />
|
||||
</div>
|
||||
{#if visibility.showLabelingEnhanced}
|
||||
{#if visibility.showLabelingQuantity}
|
||||
<div class="space-y-1">
|
||||
<Label for="cantidad_importar" class="text-xs">Cantidad a importar:</Label>
|
||||
<Input
|
||||
id="cantidad_importar"
|
||||
type="number"
|
||||
bind:value={lineItem.quantity!.quantity}
|
||||
class="h-7 text-xs"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{#if visibility.showLabelingValuationValue}
|
||||
<div class="space-y-1">
|
||||
<Label for="valor_det" class="text-xs">Valor Det:</Label>
|
||||
<Input
|
||||
id="valor_det"
|
||||
type="number"
|
||||
step="0.00000001"
|
||||
bind:value={lineItem.valuation_determined_value}
|
||||
class="h-7 text-xs"
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="grid grid-cols-2 gap-2">
|
||||
{#if visibility.showLabelingEnhanced}
|
||||
{#if visibility.showLabelingQuantity}
|
||||
{#if visibility.showLabelingValuationMethod}
|
||||
<div class="space-y-1">
|
||||
<Label for="cantidad_importar" class="text-xs">Cantidad a importar:</Label>
|
||||
<Input
|
||||
id="cantidad_importar"
|
||||
type="number"
|
||||
bind:value={lineItem.quantity!.quantity}
|
||||
class="h-7 text-xs"
|
||||
/>
|
||||
<Label for="metodos_valoracion" class="text-xs">Métodos de valoración:</Label>
|
||||
<div class="flex gap-1">
|
||||
<Input
|
||||
id="metodos_valoracion"
|
||||
bind:value={lineItem.valuation_method}
|
||||
class="h-7 text-xs flex-1"
|
||||
placeholder="Seleccione..."
|
||||
/>
|
||||
<Button
|
||||
size="icon"
|
||||
variant="outline"
|
||||
class="h-7 w-7"
|
||||
onclick={() => valuationSelectorOpen = true}
|
||||
>
|
||||
<Folder class="h-3 w-3" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{#if visibility.showLabelingValuationValue}
|
||||
|
||||
{#if visibility.showUsageReason}
|
||||
<div class="space-y-1">
|
||||
<Label for="valor_det" class="text-xs">Valor Det:</Label>
|
||||
<Label for="motivo_uso" class="text-xs">Motivo de uso:</Label>
|
||||
<Input
|
||||
id="valor_det"
|
||||
type="number"
|
||||
step="0.00000001"
|
||||
bind:value={lineItem.valuation_determined_value}
|
||||
id="motivo_uso"
|
||||
bind:value={lineItem.valuation_reason}
|
||||
class="h-7 text-xs"
|
||||
placeholder="Especifique motivo..."
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if visibility.showLabelingEnhanced}
|
||||
<div class="space-y-1">
|
||||
<Label for="metodos_valoracion" class="text-xs">Métodos de valoración:</Label>
|
||||
<div class="flex gap-1">
|
||||
<Input
|
||||
id="metodos_valoracion"
|
||||
bind:value={lineItem.valuation_method}
|
||||
class="h-7 text-xs flex-1"
|
||||
placeholder="Seleccione..."
|
||||
/>
|
||||
<Button
|
||||
size="icon"
|
||||
variant="outline"
|
||||
class="h-7 w-7"
|
||||
onclick={() => valuationSelectorOpen = true}
|
||||
>
|
||||
<Folder class="h-3 w-3" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if visibility.showUsageReason}
|
||||
{#if visibility.showLabelingObservations}
|
||||
<div class="space-y-1">
|
||||
<Label for="motivo_uso" class="text-xs">Motivo de uso:</Label>
|
||||
<Input
|
||||
id="motivo_uso"
|
||||
bind:value={lineItem.valuation_reason}
|
||||
class="h-7 text-xs"
|
||||
placeholder="Especifique motivo..."
|
||||
/>
|
||||
<Label for="observaciones_etiqueta" class="text-xs">Observations:</Label>
|
||||
<textarea
|
||||
id="observaciones_etiqueta"
|
||||
bind:value={descriptions.additional_info_spanish}
|
||||
class="flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-1.5 text-xs ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
||||
placeholder="Labeling observations..."
|
||||
></textarea>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
|
||||
{#if visibility.showLabelingObservations}
|
||||
<div class="space-y-1">
|
||||
<Label for="observaciones_etiqueta" class="text-xs">Observations:</Label>
|
||||
<textarea
|
||||
id="observaciones_etiqueta"
|
||||
bind:value={descriptions.additional_info_spanish}
|
||||
class="flex min-h-[60px] w-full rounded-md border border-input bg-background px-3 py-1.5 text-xs ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
||||
placeholder="Labeling observations..."
|
||||
></textarea>
|
||||
</div>
|
||||
{/if}
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
{/if}
|
||||
|
||||
{#if visibility.showLabelingEnhanced}
|
||||
<!-- Right Side: Assets Table -->
|
||||
|
||||
@@ -47,6 +47,10 @@ export interface InvoiceItemVisibility {
|
||||
showLabelingObservations: boolean;
|
||||
/** Etiquetado tab: Valuation field (Valor Det). */
|
||||
showLabelingValuationValue: boolean;
|
||||
/** Etiquetado tab: Valuation Method selector. */
|
||||
showLabelingValuationMethod: boolean;
|
||||
/** Etiquetado tab: Whole left section (Legend + all fields). */
|
||||
showLabelingLeftSection: boolean;
|
||||
}
|
||||
|
||||
const defaultVisibility: InvoiceItemVisibility = {
|
||||
@@ -74,7 +78,9 @@ const defaultVisibility: InvoiceItemVisibility = {
|
||||
showLabelingStandard: true,
|
||||
showLabelingQuantity: false,
|
||||
showLabelingObservations: true,
|
||||
showLabelingValuationValue: false
|
||||
showLabelingValuationValue: false,
|
||||
showLabelingValuationMethod: true,
|
||||
showLabelingLeftSection: true
|
||||
};
|
||||
|
||||
function normalizeInvoiceType(invoiceType?: string | null): string {
|
||||
@@ -130,8 +136,27 @@ export function getVisibility(
|
||||
const expVisibility: InvoiceItemVisibility = {
|
||||
...defaultVisibility,
|
||||
showExportLinkToImportBlock: true,
|
||||
showExportValuationFields: true
|
||||
showExportValuationFields: true,
|
||||
showLabelingEnhanced: true,
|
||||
showUsageReason: true,
|
||||
showLabelingValuationValue: true,
|
||||
showLabelingStandard: false,
|
||||
showLabelingObservations: false,
|
||||
showLabelingQuantity: false
|
||||
};
|
||||
|
||||
// CHECK FOR EXPORT REPAIR (REP / REPAR)
|
||||
const upInvoiceType = normalizeInvoiceType(invoiceType);
|
||||
if (upInvoiceType === 'REP' || upInvoiceType === 'REPAR') {
|
||||
return {
|
||||
...expVisibility,
|
||||
showLabelingValuationMethod: false,
|
||||
showLabelingValuationValue: false,
|
||||
showUsageReason: false,
|
||||
showLabelingLeftSection: false
|
||||
};
|
||||
}
|
||||
|
||||
// Per-type overrides can be added here (e.g. hide valuation for SCRAP).
|
||||
switch (exportType) {
|
||||
case 'NODES':
|
||||
@@ -193,7 +218,8 @@ export function getVisibility(
|
||||
showLabelingQuantity: true,
|
||||
showLabelingStandard: true,
|
||||
showLabelingObservations: false,
|
||||
showLabelingValuationValue: false
|
||||
showLabelingValuationValue: false,
|
||||
showLabelingValuationMethod: true
|
||||
};
|
||||
|
||||
case 'MEX':
|
||||
|
||||
Reference in New Issue
Block a user