feat: add total stock and total price display for raw materials in RawMaterialGroupedTable.vue, enhancing material overview for users

This commit is contained in:
Yoga Pangestu 2026-06-19 22:16:03 +07:00
parent 81c072e753
commit db5adacdea

View File

@ -21,6 +21,7 @@ import {
TableHeader, TableHeader,
TableRow, TableRow,
} from '@/components/ui/table'; } from '@/components/ui/table';
import { formatRupiah } from '@/lib/rupiah';
import type { import type {
DataTableFilterDef, DataTableFilterDef,
DataTablePagination, DataTablePagination,
@ -87,6 +88,19 @@ function rowNumber(index: number): number {
{{ material.unit_label }} {{ material.unit_label }}
</Badge> </Badge>
</div> </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>
</div> </div>