mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 14:55:44 +00:00
fix(FE): adjust data types for project flock and product stock inventory
This commit is contained in:
@@ -112,6 +112,15 @@ const InventoryProductTable = () => {
|
||||
accessorFn: (row) => row.product_category.name,
|
||||
header: 'Kategori',
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.total_stock,
|
||||
header: 'Stok',
|
||||
cell: (props) => {
|
||||
return props.row.original.total_stock
|
||||
? formatCurrency(props.row.original.total_stock)
|
||||
: '-';
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorFn: (row) => row.uom.name,
|
||||
header: 'Satuan',
|
||||
|
||||
@@ -8,20 +8,9 @@ import { useMemo } from 'react';
|
||||
|
||||
const InventoryProductDetail = ({
|
||||
inventoryProduct,
|
||||
refresh,
|
||||
}: {
|
||||
inventoryProduct?: InventoryProduct;
|
||||
refresh?: () => void;
|
||||
}) => {
|
||||
const totalStok = useMemo(() => {
|
||||
return (
|
||||
inventoryProduct?.product_warehouses?.reduce(
|
||||
(total, warehouse) => total + (warehouse.current_stock || 0),
|
||||
0
|
||||
) || 0
|
||||
);
|
||||
}, [inventoryProduct]);
|
||||
|
||||
const stockLogs = useMemo(() => {
|
||||
return (
|
||||
inventoryProduct?.product_warehouses?.flatMap(
|
||||
@@ -105,7 +94,11 @@ const InventoryProductDetail = ({
|
||||
<tr>
|
||||
<td className='font-semibold'>Total Stok</td>
|
||||
<td>:</td>
|
||||
<td>{formatNumber(totalStok)}</td>
|
||||
<td>
|
||||
{inventoryProduct?.total_stock
|
||||
? formatNumber(inventoryProduct?.total_stock)
|
||||
: '-'}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user