summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-01 12:47:59 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-01 12:47:59 +0100
commitdfe7e1cbea1e8503281218567e95bae819dc5dce (patch)
tree1c358f32b4a99fa3dae942ae3a86b8b5ad90f7a1 /templates
parent6b30ab3d3ec23bd3f6056f2d1685159487383378 (diff)
downloadstock-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.tpl4
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>