fix(FE): adjust data types for inventory product stock

This commit is contained in:
randy-ar
2025-12-04 16:35:10 +07:00
parent e0a8514814
commit a1d0c7b331
5 changed files with 10 additions and 8 deletions
@@ -9,7 +9,7 @@ import RowDropdownOptions from '@/components/table/RowDropdownOptions';
import RowOptionsMenuWrapper from '@/components/table/RowOptionsMenuWrapper';
import { ROWS_OPTIONS } from '@/config/constant';
import { isResponseSuccess } from '@/lib/api-helper';
import { cn, formatCurrency } from '@/lib/helper';
import { cn, formatCurrency, formatNumber } from '@/lib/helper';
import { InventoryProductApi } from '@/services/api/inventory';
import { useTableFilter } from '@/services/hooks/useTableFilter';
import { InventoryProduct } from '@/types/api/inventory/product';
@@ -117,8 +117,8 @@ const InventoryProductTable = () => {
header: 'Stok',
cell: (props) => {
return props.row.original.total_stock
? formatCurrency(props.row.original.total_stock)
: '-';
? formatNumber(props.row.original.total_stock)
: '0';
},
},
{
@@ -97,7 +97,7 @@ const InventoryProductDetail = ({
<td>
{inventoryProduct?.total_stock
? formatNumber(inventoryProduct?.total_stock)
: '-'}
: '0'}
</td>
</tr>
</tbody>
@@ -59,7 +59,7 @@ const StockLogTable = ({ stockLogs }: { stockLogs: StockLog[] }) => {
},
{
header: 'Oleh',
accessorKey: 'created_by.name',
accessorKey: 'created_user.name',
},
]}
className={{
@@ -31,8 +31,8 @@ const StockProductWarehouseTable = ({
header: 'Lokasi',
accessorKey: 'location',
cell: (props) => {
return Boolean(props.row.original.location)
? props.row.original.location
return props.row.original.location != null
? props.row.original.location.name
: '-';
},
},