{strip}

{if $gContent->getTitle()} {tr}Edit Assembly{/tr}: {$gContent->getTitle()|escape} {else} {tr}Create Assembly{/tr} {/if}

{form id="editAssemblyForm" ipackage="stock" ifile="edit_assembly.php"} {formfeedback error=$errors success=$stockSuccess}
{formlabel label="Title" for="assembly-title" mandatory="y"} {forminput} {/forminput}
{formlabel label="Description" for="assembly-desc"} {forminput} {/forminput}
{if $gContent->mInfo.stockassembly_types} {jstabs} {section name=xrefGroup loop=$gContent->mInfo.stockassembly_types} {include file=$gContent->getXrefListTemplate($gContent->mInfo.stockassembly_types[xrefGroup].template) source=$gContent->mInfo.stockassembly_types[xrefGroup].source source_title=$gContent->mInfo.stockassembly_types[xrefGroup].title group=$gContent->mInfo.stockassembly_types[xrefGroup].sort_order allow_add=true} {/section} {/jstabs} {/if}
{if $gContent->isValid()} {/if}
{/form} {* ── Components section ── *} {if $gContent->isValid()}

{tr}Components{/tr}

{* CSV upload results *} {if isset($csvLoaded)}
{tr}Loaded{/tr}: {$csvLoaded} {if $csvSkipped}   {tr}Skipped (duplicate){/tr}: {$csvSkipped}{/if}
{if $csvErrors} {/if} {/if} {* Components table *} {if $componentMap} {form ipackage="stock" ifile="edit_assembly.php"} {foreach from=$componentMap key=contentId item=comp} {/foreach}
{smartlink ititle="Pos" isort="item_position" ifile="edit_assembly.php" ipackage="stock" idefault=1 content_id=$gContent->mContentId} {smartlink ititle="Component" isort="title" ifile="edit_assembly.php" ipackage="stock" content_id=$gContent->mContentId}
{$comp.item_position|escape} {$comp.title|escape}
{/form} {else}

{tr}No components yet.{/tr}

{/if} {* ── Upload BOM CSV ── *}

{tr}Upload Parts List (BOM){/tr}

{tr}Columns: Component, Order, Quantity, Size (SGL/PCK/SHT/VOL — optional), Ref designators, Note{/tr}

{form enctype="multipart/form-data" ipackage="stock" ifile="edit_assembly.php"}
{/form} {/if}
{/strip}