mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
refactor(FE): Update transaction subtype handling and labels
This commit is contained in:
@@ -96,15 +96,27 @@ const InventoryAdjustmentTable = () => {
|
|||||||
{
|
{
|
||||||
id: 'transaction_type',
|
id: 'transaction_type',
|
||||||
header: 'Tipe Transaksi',
|
header: 'Tipe Transaksi',
|
||||||
accessorFn: (row) => row.transaction_type ?? '-',
|
accessorFn: (row) => row.transaction_subtype ?? '-',
|
||||||
cell: (row) => {
|
cell: (row) => {
|
||||||
const type = row.row.original.increase;
|
const subtype = row.row.original.transaction_subtype;
|
||||||
const label =
|
const increase = row.row.original.increase;
|
||||||
type > 0 ? 'Peningkatan' : type <= 0 ? 'Penurunan' : '-';
|
|
||||||
|
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 (
|
return (
|
||||||
<StatusBadge
|
<StatusBadge
|
||||||
color={type > 0 ? 'success' : type <= 0 ? 'error' : 'neutral'}
|
color={
|
||||||
|
increase > 0 ? 'success' : increase <= 0 ? 'error' : 'neutral'
|
||||||
|
}
|
||||||
text={label}
|
text={label}
|
||||||
className={{
|
className={{
|
||||||
badge: 'whitespace-nowrap',
|
badge: 'whitespace-nowrap',
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ const InventoryAdjustmentForm = ({
|
|||||||
const transactionType = selectedTransactionType?.value;
|
const transactionType = selectedTransactionType?.value;
|
||||||
|
|
||||||
if (transactionType === 'RECORDING') {
|
if (transactionType === 'RECORDING') {
|
||||||
return TRANSACTION_SUBTYPE_OPTIONS.RECORDING;
|
return [...TRANSACTION_SUBTYPE_OPTIONS.RECORDING];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
@@ -289,8 +289,6 @@ const InventoryAdjustmentForm = ({
|
|||||||
) {
|
) {
|
||||||
setQuantityLabel('Kurangi Stok');
|
setQuantityLabel('Kurangi Stok');
|
||||||
} else if (
|
} else if (
|
||||||
subtype === 'RECORDING_STOCK_IN' ||
|
|
||||||
subtype === 'RECORDING_DEPLETION_IN' ||
|
|
||||||
subtype === 'RECORDING_EGG_IN' ||
|
subtype === 'RECORDING_EGG_IN' ||
|
||||||
subtype === 'PURCHASE_IN'
|
subtype === 'PURCHASE_IN'
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -556,9 +556,8 @@ export const TRANSACTION_SUBTYPE_OPTIONS = {
|
|||||||
PEMBELIAN: { label: 'Pembelian', value: 'PURCHASE_IN' },
|
PEMBELIAN: { label: 'Pembelian', value: 'PURCHASE_IN' },
|
||||||
PENJUALAN: { label: 'Penjualan', value: 'MARKETING_OUT' },
|
PENJUALAN: { label: 'Penjualan', value: 'MARKETING_OUT' },
|
||||||
RECORDING: [
|
RECORDING: [
|
||||||
{ label: 'Recording Stock Out', value: 'RECORDING_STOCK_OUT' },
|
{ label: 'Recording Stock', value: 'RECORDING_STOCK_OUT' },
|
||||||
{ label: 'Recording Depletion Out', value: 'RECORDING_DEPLETION_OUT' },
|
{ label: 'Recording Depletion', value: 'RECORDING_DEPLETION_OUT' },
|
||||||
{ label: 'Recording Depletion In', value: 'RECORDING_DEPLETION_IN' },
|
{ label: 'Recording Egg', value: 'RECORDING_EGG_IN' },
|
||||||
{ label: 'Recording Egg In', value: 'RECORDING_EGG_IN' },
|
|
||||||
],
|
],
|
||||||
};
|
} as const;
|
||||||
|
|||||||
Reference in New Issue
Block a user