feat: add total stock and total price display for raw materials in RawMaterialGroupedTable.vue, enhancing material overview for users
This commit is contained in:
parent
81c072e753
commit
db5adacdea
@ -21,6 +21,7 @@ import {
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from '@/components/ui/table';
|
||||
import { formatRupiah } from '@/lib/rupiah';
|
||||
import type {
|
||||
DataTableFilterDef,
|
||||
DataTablePagination,
|
||||
@ -87,6 +88,19 @@ function rowNumber(index: number): number {
|
||||
{{ material.unit_label }}
|
||||
</Badge>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<p class="text-xs text-muted-foreground">
|
||||
<strong>Total stok:</strong> {{material.prices.reduce((acc, price) => acc +
|
||||
Number(price.stock), 0)
|
||||
}}
|
||||
{{ material.unit_abbreviation }}
|
||||
</p>
|
||||
<p class="text-xs text-muted-foreground">
|
||||
<strong>Total harga:</strong> Rp {{formatRupiah(material.prices.reduce((acc, price) => acc +
|
||||
Number(price.stock) * Number(price.price), 0))
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user