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(
() => [
{
header: 'No',
cell: (props) =>
tableFilterState.pageSize * (tableFilterState.page - 1) +
props.row.index +
1,
id: 'adj_number',
header: 'No. Referensi',
accessorFn: (row) => row.adj_number ?? '-',
},
{
id: 'product_name',
header: 'Nama Produk',
accessorFn: (row) => row.product_warehouse?.product?.name ?? '-',
id: 'location',
header: 'Lokasi',
accessorFn: (row) => row.location?.name ?? '-',
},
{
id: 'project_flock',
header: 'Flock',
accessorFn: (row) => row.project_flock?.flock_name ?? '-',
},
{
id: 'warehouse_name',
@@ -66,25 +69,35 @@ const InventoryAdjustmentTable = () => {
accessorFn: (row) => row.product_warehouse?.warehouse?.name ?? '-',
},
{
id: 'created_at',
header: 'Tanggal',
accessorFn: (row) =>
row.created_at ? formatDate(row.created_at, 'DD MMM YYYY') : '-',
id: 'product_name',
header: 'Nama Produk',
accessorFn: (row) => row.product_warehouse?.product?.name ?? '-',
},
{
id: 'quantity',
header: 'Kuantitas',
cell: (props) => {
const value =
props.row.original.increase + props.row.original.decrease;
accessorFn: (row) => row.qty ?? '-',
cell: (row) => {
const value = row.row.original.increase + row.row.original.decrease;
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',
header: 'Tipe Transaksi',
cell: (props) => {
const type = props.row.original.increase;
accessorFn: (row) => row.transaction_type ?? '-',
cell: (row) => {
const type = row.row.original.increase;
const label =
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',
header: 'Oleh',