mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE): Update transaction subtype handling and labels
This commit is contained in:
@@ -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<string, string> = {
|
||||
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 (
|
||||
<StatusBadge
|
||||
color={type > 0 ? 'success' : type <= 0 ? 'error' : 'neutral'}
|
||||
color={
|
||||
increase > 0 ? 'success' : increase <= 0 ? 'error' : 'neutral'
|
||||
}
|
||||
text={label}
|
||||
className={{
|
||||
badge: 'whitespace-nowrap',
|
||||
|
||||
@@ -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'
|
||||
) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user