mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-29 13:10:06 +02:00
Show expired lot sum in parts table in parenthesis
This commit is contained in:
parent
1f6f39172f
commit
bd12185b44
2 changed files with 32 additions and 1 deletions
|
@ -210,8 +210,19 @@ final class PartsDataTable implements DataTableTypeInterface
|
|||
'label' => $this->translator->trans('part.table.amount'),
|
||||
'render' => function ($value, Part $context) {
|
||||
$amount = $context->getAmountSum();
|
||||
$expiredAmount = $context->getExpiredAmountSum();
|
||||
|
||||
return $this->amountFormatter->format($amount, $context->getPartUnit());
|
||||
$ret = $this->amountFormatter->format($amount, $context->getPartUnit());
|
||||
|
||||
//If we have expired lots, we show them in parentheses behind
|
||||
if ($expiredAmount > 0) {
|
||||
$ret .= sprintf(' <span title="%s" class="text-muted">(+%s)</span>',
|
||||
$this->translator->trans('part_lots.is_expired'),
|
||||
$this->amountFormatter->format($expiredAmount, $context->getPartUnit()));
|
||||
}
|
||||
|
||||
|
||||
return $ret;
|
||||
},
|
||||
'orderField' => 'amountSum'
|
||||
])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue