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 RowOptionsMenuWrapper from '@/components/table/RowOptionsMenuWrapper';
import { ROWS_OPTIONS } from '@/config/constant'; import { ROWS_OPTIONS } from '@/config/constant';
import { isResponseSuccess } from '@/lib/api-helper'; 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 { InventoryProductApi } from '@/services/api/inventory';
import { useTableFilter } from '@/services/hooks/useTableFilter'; import { useTableFilter } from '@/services/hooks/useTableFilter';
import { InventoryProduct } from '@/types/api/inventory/product'; import { InventoryProduct } from '@/types/api/inventory/product';
@@ -117,8 +117,8 @@ const InventoryProductTable = () => {
header: 'Stok', header: 'Stok',
cell: (props) => { cell: (props) => {
return props.row.original.total_stock 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> <td>
{inventoryProduct?.total_stock {inventoryProduct?.total_stock
? formatNumber(inventoryProduct?.total_stock) ? formatNumber(inventoryProduct?.total_stock)
: '-'} : '0'}
</td> </td>
</tr> </tr>
</tbody> </tbody>
@@ -59,7 +59,7 @@ const StockLogTable = ({ stockLogs }: { stockLogs: StockLog[] }) => {
}, },
{ {
header: 'Oleh', header: 'Oleh',
accessorKey: 'created_by.name', accessorKey: 'created_user.name',
}, },
]} ]}
className={{ className={{
@@ -31,8 +31,8 @@ const StockProductWarehouseTable = ({
header: 'Lokasi', header: 'Lokasi',
accessorKey: 'location', accessorKey: 'location',
cell: (props) => { cell: (props) => {
return Boolean(props.row.original.location) return props.row.original.location != null
? props.row.original.location ? props.row.original.location.name
: '-'; : '-';
}, },
}, },
+3 -1
View File
@@ -3,6 +3,7 @@ import { ProductWarehouse } from '@/types/api/inventory/product-warehouse';
import { ProductCategory } from '@/types/api/master-data/product-category'; import { ProductCategory } from '@/types/api/master-data/product-category';
import { Supplier } from '@/types/api/master-data/supplier'; import { Supplier } from '@/types/api/master-data/supplier';
import { Uom } from '@/types/api/master-data/uom'; import { Uom } from '@/types/api/master-data/uom';
import { Location } from '@/types/api/master-data/location';
export type BaseInventoryProduct = { export type BaseInventoryProduct = {
id: number; id: number;
@@ -39,7 +40,8 @@ export type StockLog = {
loggable_id: number; loggable_id: number;
notes: string; notes: string;
product_warehouse_id: number; product_warehouse_id: number;
created_by: CreatedUser; created_by: number;
created_user: CreatedUser;
created_at: string; created_at: string;
}; };