refactor(FE): Update columns in InventoryAdjustmentTable

This commit is contained in:
rstubryan
2026-02-26 11:48:27 +07:00
parent aeeb0b721c
commit e98c49ac5a
@@ -49,16 +49,19 @@ const InventoryAdjustmentTable = () => {
const inventoryAdjustmentsColumns: ColumnDef<InventoryAdjustment>[] = useMemo( const inventoryAdjustmentsColumns: ColumnDef<InventoryAdjustment>[] = useMemo(
() => [ () => [
{ {
header: 'No', id: 'adj_number',
cell: (props) => header: 'No. Referensi',
tableFilterState.pageSize * (tableFilterState.page - 1) + accessorFn: (row) => row.adj_number ?? '-',
props.row.index +
1,
}, },
{ {
id: 'product_name', id: 'location',
header: 'Nama Produk', header: 'Lokasi',
accessorFn: (row) => row.product_warehouse?.product?.name ?? '-', accessorFn: (row) => row.location?.name ?? '-',
},
{
id: 'project_flock',
header: 'Flock',
accessorFn: (row) => row.project_flock?.flock_name ?? '-',
}, },
{ {
id: 'warehouse_name', id: 'warehouse_name',
@@ -66,25 +69,35 @@ const InventoryAdjustmentTable = () => {
accessorFn: (row) => row.product_warehouse?.warehouse?.name ?? '-', accessorFn: (row) => row.product_warehouse?.warehouse?.name ?? '-',
}, },
{ {
id: 'created_at', id: 'product_name',
header: 'Tanggal', header: 'Nama Produk',
accessorFn: (row) => accessorFn: (row) => row.product_warehouse?.product?.name ?? '-',
row.created_at ? formatDate(row.created_at, 'DD MMM YYYY') : '-',
}, },
{ {
id: 'quantity', id: 'quantity',
header: 'Kuantitas', header: 'Kuantitas',
cell: (props) => { accessorFn: (row) => row.qty ?? '-',
const value = cell: (row) => {
props.row.original.increase + props.row.original.decrease; const value = row.row.original.increase + row.row.original.decrease;
return <div className='text-center'>{formatNumber(value)}</div>; return <div className='text-center'>{formatNumber(value)}</div>;
}, },
}, },
{
id: 'price',
header: 'Harga',
accessorFn: (row) => row.price ?? '-',
},
{
id: 'grand_total',
header: 'Total',
accessorFn: (row) => row.grand_total ?? '-',
},
{ {
id: 'transaction_type', id: 'transaction_type',
header: 'Tipe Transaksi', header: 'Tipe Transaksi',
cell: (props) => { accessorFn: (row) => row.transaction_type ?? '-',
const type = props.row.original.increase; cell: (row) => {
const type = row.row.original.increase;
const label = const label =
type > 0 ? 'Peningkatan' : type <= 0 ? 'Penurunan' : '-'; type > 0 ? 'Peningkatan' : type <= 0 ? 'Penurunan' : '-';
@@ -99,6 +112,12 @@ const InventoryAdjustmentTable = () => {
); );
}, },
}, },
{
id: 'created_at',
header: 'Tanggal',
accessorFn: (row) =>
row.created_at ? formatDate(row.created_at, 'DD MMM YYYY') : '-',
},
{ {
id: 'created_by', id: 'created_by',
header: 'Oleh', header: 'Oleh',