feat: enhance item configuration with subitem handling and cleanup
This commit is contained in:
@@ -105,8 +105,7 @@ export interface FaLineItem {
|
|||||||
|
|
||||||
// Subitems
|
// Subitems
|
||||||
is_subitem?: boolean;
|
is_subitem?: boolean;
|
||||||
contains_subitems?: boolean;
|
contains_subitems?: boolean;
|
||||||
includes_subitems?: boolean;
|
|
||||||
subitem_number?: number;
|
subitem_number?: number;
|
||||||
|
|
||||||
// Special flags
|
// Special flags
|
||||||
|
|||||||
@@ -35,6 +35,13 @@
|
|||||||
lineItem.fa_data.contains_subitems = val === 'si';
|
lineItem.fa_data.contains_subitems = val === 'si';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper for subitem_number binding
|
||||||
|
let subitemNumber = $derived.by(() => lineItem.fa_data?.subitem_number ?? 0);
|
||||||
|
function setSubitemNumber(val: number) {
|
||||||
|
if (!lineItem.fa_data) lineItem.fa_data = {};
|
||||||
|
lineItem.fa_data.subitem_number = val;
|
||||||
|
}
|
||||||
|
|
||||||
function handlePartSelect(part: any) {
|
function handlePartSelect(part: any) {
|
||||||
lineItem.part_number = part.id;
|
lineItem.part_number = part.id;
|
||||||
// Store part number for display
|
// Store part number for display
|
||||||
@@ -65,23 +72,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</RadioGroup.Root>
|
</RadioGroup.Root>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
{#if isSubPartidaValue === 'partida'}
|
||||||
<fieldset class="border rounded-md p-2 space-y-2">
|
<fieldset class="border rounded-md p-2 space-y-2">
|
||||||
<legend class="text-xs font-semibold px-2 bg-zinc-200 dark:bg-zinc-700">Contains Sub-Items</legend>
|
<legend class="text-xs font-semibold px-2 bg-zinc-200 dark:bg-zinc-700">Contains Sub-Items</legend>
|
||||||
<RadioGroup.Root
|
<RadioGroup.Root
|
||||||
value={containsSubPartidasValue}
|
value={containsSubPartidasValue}
|
||||||
onValueChange={setContinueSubPartidas}
|
onValueChange={setContinueSubPartidas}
|
||||||
class="flex gap-3">
|
class="flex gap-3">
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<RadioGroup.Item value="si" id="continue_si" />
|
<RadioGroup.Item value="si" id="continue_si" />
|
||||||
<Label for="continue_si" class="text-xs font-normal">Yes</Label>
|
<Label for="continue_si" class="text-xs font-normal">Yes</Label>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center space-x-2">
|
<div class="flex items-center space-x-2">
|
||||||
<RadioGroup.Item value="no" id="continue_no" />
|
<RadioGroup.Item value="no" id="continue_no" />
|
||||||
<Label for="continue_no" class="text-xs font-normal">No</Label>
|
<Label for="continue_no" class="text-xs font-normal">No</Label>
|
||||||
</div>
|
</div>
|
||||||
</RadioGroup.Root>
|
</RadioGroup.Root>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
{:else if isSubPartidaValue === 'subpartida'}
|
||||||
|
<fieldset class="border rounded-md p-1">
|
||||||
|
<legend class="text-xs font-semibold px-2 bg-zinc-200 dark:bg-zinc-700">Main Item Number</legend>
|
||||||
|
<Input
|
||||||
|
id="subitem_number"
|
||||||
|
type="number"
|
||||||
|
value={subitemNumber}
|
||||||
|
oninput={(e) => setSubitemNumber(e.currentTarget.valueAsNumber || 0)}
|
||||||
|
class="h-7 text-xs"
|
||||||
|
placeholder="Enter main item number"
|
||||||
|
/>
|
||||||
|
</fieldset>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Descriptions -->
|
<!-- Descriptions -->
|
||||||
|
|||||||
@@ -233,10 +233,7 @@
|
|||||||
>
|
>
|
||||||
<Folder class="w-4 h-4" />
|
<Folder class="w-4 h-4" />
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
{#if (customs as any).origin_country_name}
|
|
||||||
<p class="text-xs text-muted-foreground truncate">{(customs as any).origin_country_name}</p>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex items-end gap-6">
|
<div class="flex items-end gap-6">
|
||||||
|
|||||||
Reference in New Issue
Block a user