diff --git a/src/components/pages/inventory/adjustment/InventoryAdjustmentTable.tsx b/src/components/pages/inventory/adjustment/InventoryAdjustmentTable.tsx index 3954ae33..0ae5034b 100644 --- a/src/components/pages/inventory/adjustment/InventoryAdjustmentTable.tsx +++ b/src/components/pages/inventory/adjustment/InventoryAdjustmentTable.tsx @@ -96,15 +96,27 @@ const InventoryAdjustmentTable = () => { { id: 'transaction_type', header: 'Tipe Transaksi', - accessorFn: (row) => row.transaction_type ?? '-', + accessorFn: (row) => row.transaction_subtype ?? '-', cell: (row) => { - const type = row.row.original.increase; - const label = - type > 0 ? 'Peningkatan' : type <= 0 ? 'Penurunan' : '-'; + const subtype = row.row.original.transaction_subtype; + const increase = row.row.original.increase; + + const subtypeLabelMap: Record = { + PURCHASE_IN: 'Pembelian', + MARKETING_OUT: 'Penjualan', + RECORDING_STOCK_OUT: 'Recording Stock', + RECORDING_DEPLETION_OUT: 'Recording Depletion', + RECORDING_EGG_IN: 'Recording Egg', + ADJUSTMENT_OUT: 'Penyesuaian', + }; + + const label = subtypeLabelMap[subtype] || subtype || '-'; return ( 0 ? 'success' : type <= 0 ? 'error' : 'neutral'} + color={ + increase > 0 ? 'success' : increase <= 0 ? 'error' : 'neutral' + } text={label} className={{ badge: 'whitespace-nowrap', diff --git a/src/components/pages/inventory/adjustment/form/InventoryAdjustmentForm.tsx b/src/components/pages/inventory/adjustment/form/InventoryAdjustmentForm.tsx index 9daf5be4..d67d19d0 100644 --- a/src/components/pages/inventory/adjustment/form/InventoryAdjustmentForm.tsx +++ b/src/components/pages/inventory/adjustment/form/InventoryAdjustmentForm.tsx @@ -269,7 +269,7 @@ const InventoryAdjustmentForm = ({ const transactionType = selectedTransactionType?.value; if (transactionType === 'RECORDING') { - return TRANSACTION_SUBTYPE_OPTIONS.RECORDING; + return [...TRANSACTION_SUBTYPE_OPTIONS.RECORDING]; } return []; @@ -289,8 +289,6 @@ const InventoryAdjustmentForm = ({ ) { setQuantityLabel('Kurangi Stok'); } else if ( - subtype === 'RECORDING_STOCK_IN' || - subtype === 'RECORDING_DEPLETION_IN' || subtype === 'RECORDING_EGG_IN' || subtype === 'PURCHASE_IN' ) { diff --git a/src/config/constant.ts b/src/config/constant.ts index a836ef55..12b9d89c 100644 --- a/src/config/constant.ts +++ b/src/config/constant.ts @@ -556,9 +556,8 @@ export const TRANSACTION_SUBTYPE_OPTIONS = { PEMBELIAN: { label: 'Pembelian', value: 'PURCHASE_IN' }, PENJUALAN: { label: 'Penjualan', value: 'MARKETING_OUT' }, RECORDING: [ - { label: 'Recording Stock Out', value: 'RECORDING_STOCK_OUT' }, - { label: 'Recording Depletion Out', value: 'RECORDING_DEPLETION_OUT' }, - { label: 'Recording Depletion In', value: 'RECORDING_DEPLETION_IN' }, - { label: 'Recording Egg In', value: 'RECORDING_EGG_IN' }, + { label: 'Recording Stock', value: 'RECORDING_STOCK_OUT' }, + { label: 'Recording Depletion', value: 'RECORDING_DEPLETION_OUT' }, + { label: 'Recording Egg', value: 'RECORDING_EGG_IN' }, ], -}; +} as const;