diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-01 12:47:59 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-01 12:47:59 +0100 |
| commit | dfe7e1cbea1e8503281218567e95bae819dc5dce (patch) | |
| tree | 1c358f32b4a99fa3dae942ae3a86b8b5ad90f7a1 /templates | |
| parent | 6b30ab3d3ec23bd3f6056f2d1685159487383378 (diff) | |
| download | stock-dfe7e1cbea1e8503281218567e95bae819dc5dce.tar.gz stock-dfe7e1cbea1e8503281218567e95bae819dc5dce.tar.bz2 stock-dfe7e1cbea1e8503281218567e95bae819dc5dce.zip | |
Highlight row red when BOM remaining is short, not just when stock is negative
Pre-compute remaining before the <tr> so the row class can check both
stock level < 0 and (showBom && remaining < 0).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/list_stock.tpl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/templates/list_stock.tpl b/templates/list_stock.tpl index faac32a..19bc8a4 100644 --- a/templates/list_stock.tpl +++ b/templates/list_stock.tpl @@ -62,7 +62,8 @@ <tbody> {foreach from=$stockList item=comp} {foreach from=$comp.stock key=qtype item=row name=stockRow} - <tr{if $row.level < 0} class="danger"{elseif $row.level == 0} class="warning"{/if}> + {if $showBom}{assign var=remaining value=$row.level-($row.bom_qty*$kitCount)}{/if} + <tr{if $row.level < 0 || ($showBom && $remaining < 0)} class="danger"{elseif $row.level == 0} class="warning"{/if}> {if $smarty.foreach.stockRow.first} <td rowspan="{$comp.stock|@count}"> <a href="{$comp.display_url|escape}">{$comp.title|escape}</a> @@ -74,7 +75,6 @@ <td>{$qtype|escape}</td> <td class="text-right">{$row.level|string_format:"%.0f"}</td> {if $showBom} - {assign var=remaining value=$row.level-($row.bom_qty*$kitCount)} <td class="text-right{if $remaining < 0} text-danger{/if}">{$remaining|string_format:"%.0f"}</td> {/if} </tr> |
