feat: enhance item configuration with subitem handling and cleanup
This commit is contained in:
@@ -105,8 +105,7 @@ export interface FaLineItem {
|
||||
|
||||
// Subitems
|
||||
is_subitem?: boolean;
|
||||
contains_subitems?: boolean;
|
||||
includes_subitems?: boolean;
|
||||
contains_subitems?: boolean;
|
||||
subitem_number?: number;
|
||||
|
||||
// Special flags
|
||||
|
||||
@@ -35,6 +35,13 @@
|
||||
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) {
|
||||
lineItem.part_number = part.id;
|
||||
// Store part number for display
|
||||
@@ -65,23 +72,36 @@
|
||||
</div>
|
||||
</RadioGroup.Root>
|
||||
</fieldset>
|
||||
|
||||
<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>
|
||||
<RadioGroup.Root
|
||||
value={containsSubPartidasValue}
|
||||
onValueChange={setContinueSubPartidas}
|
||||
class="flex gap-3">
|
||||
<div class="flex items-center space-x-2">
|
||||
<RadioGroup.Item value="si" id="continue_si" />
|
||||
<Label for="continue_si" class="text-xs font-normal">Yes</Label>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<RadioGroup.Item value="no" id="continue_no" />
|
||||
<Label for="continue_no" class="text-xs font-normal">No</Label>
|
||||
</div>
|
||||
</RadioGroup.Root>
|
||||
</fieldset>
|
||||
{#if isSubPartidaValue === 'partida'}
|
||||
<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>
|
||||
<RadioGroup.Root
|
||||
value={containsSubPartidasValue}
|
||||
onValueChange={setContinueSubPartidas}
|
||||
class="flex gap-3">
|
||||
<div class="flex items-center space-x-2">
|
||||
<RadioGroup.Item value="si" id="continue_si" />
|
||||
<Label for="continue_si" class="text-xs font-normal">Yes</Label>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<RadioGroup.Item value="no" id="continue_no" />
|
||||
<Label for="continue_no" class="text-xs font-normal">No</Label>
|
||||
</div>
|
||||
</RadioGroup.Root>
|
||||
</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>
|
||||
|
||||
<!-- Descriptions -->
|
||||
|
||||
@@ -233,10 +233,7 @@
|
||||
>
|
||||
<Folder class="w-4 h-4" />
|
||||
</Button>
|
||||
</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">
|
||||
|
||||
Reference in New Issue
Block a user