add DN in status transaction type on transfertype module
This commit is contained in:
@ -482,6 +482,7 @@ const AddDialog = () => {
|
|||||||
<SelectItem value="DA">Disbursment Agent</SelectItem>
|
<SelectItem value="DA">Disbursment Agent</SelectItem>
|
||||||
<SelectItem value="WI">Withdraw Merchant</SelectItem>
|
<SelectItem value="WI">Withdraw Merchant</SelectItem>
|
||||||
<SelectItem value="IC">Income Merchant</SelectItem>
|
<SelectItem value="IC">Income Merchant</SelectItem>
|
||||||
|
<SelectItem value="DN">Donation</SelectItem>
|
||||||
</SelectContent>
|
</SelectContent>
|
||||||
</Select>
|
</Select>
|
||||||
{errors.type && <span className="text-red-500 text-xs mt-1">{errors.type}</span>}
|
{errors.type && <span className="text-red-500 text-xs mt-1">{errors.type}</span>}
|
||||||
|
|||||||
@ -68,6 +68,7 @@ const EditDialog = () => {
|
|||||||
message: ''
|
message: ''
|
||||||
});
|
});
|
||||||
const [errors, setErrors] = useState<Record<string, string>>({});
|
const [errors, setErrors] = useState<Record<string, string>>({});
|
||||||
|
const [isLoadingData, setIsLoadingData] = useState(true);
|
||||||
|
|
||||||
const [isLoadingWallets, setIsLoadingWallets] = useState(false);
|
const [isLoadingWallets, setIsLoadingWallets] = useState(false);
|
||||||
|
|
||||||
@ -316,6 +317,7 @@ const EditDialog = () => {
|
|||||||
if (!showEditDialog || !selectedTransferType) return;
|
if (!showEditDialog || !selectedTransferType) return;
|
||||||
|
|
||||||
const fetchTransactionType = async () => {
|
const fetchTransactionType = async () => {
|
||||||
|
setIsLoadingData(true);
|
||||||
try {
|
try {
|
||||||
const response = await GetData(
|
const response = await GetData(
|
||||||
`${API_URL}/transactiontype/getdata/${selectedTransferType}`,
|
`${API_URL}/transactiontype/getdata/${selectedTransferType}`,
|
||||||
@ -357,6 +359,8 @@ const EditDialog = () => {
|
|||||||
show: true,
|
show: true,
|
||||||
message: 'Failed to load transaction type data'
|
message: 'Failed to load transaction type data'
|
||||||
});
|
});
|
||||||
|
} finally {
|
||||||
|
setIsLoadingData(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -414,7 +418,6 @@ const EditDialog = () => {
|
|||||||
<h1 className="text-xl font-semibold leading-none text-gray-900">
|
<h1 className="text-xl font-semibold leading-none text-gray-900">
|
||||||
Update Transaction Type
|
Update Transaction Type
|
||||||
</h1>
|
</h1>
|
||||||
<div className="flex items-center gap-2 text-sm font-normal text-gray-700"></div>
|
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="cursor-pointer hover:opacity-100 opacity-50"
|
className="cursor-pointer hover:opacity-100 opacity-50"
|
||||||
@ -427,6 +430,7 @@ const EditDialog = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<DialogBody className="scrollable-y px-0 pb-0" ref={parentRef}>
|
<DialogBody className="scrollable-y px-0 pb-0" ref={parentRef}>
|
||||||
<div className="flex flex-col px-0">
|
<div className="flex flex-col px-0">
|
||||||
{alert.show && (
|
{alert.show && (
|
||||||
@ -436,384 +440,415 @@ const EditDialog = () => {
|
|||||||
</Alert>
|
</Alert>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<form action="" onSubmit={handleSubmit}>
|
|
||||||
<div className="card-body grid gap-5 p-0">
|
|
||||||
<div className="w-full">
|
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
|
||||||
Transfer Type Name
|
|
||||||
<span className="text-red-500">*</span>
|
|
||||||
</label>
|
|
||||||
<div className="grow flex flex-col">
|
|
||||||
<Input
|
|
||||||
className={`input ${errors.name ? 'border-red-500' : ''}`}
|
|
||||||
type="text"
|
|
||||||
autoComplete="off"
|
|
||||||
value={formField.name}
|
|
||||||
onChange={({ target }) => {
|
|
||||||
setFormField((prev) => ({ ...prev, name: target.value }));
|
|
||||||
if (target.value) {
|
|
||||||
setErrors((prev) => ({ ...prev, name: '' }));
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
{errors.name && (
|
|
||||||
<span className="text-red-500 text-xs mt-1">{errors.name}</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="w-full">
|
{isLoadingData ? (
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div className="p-5">
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<div className="animate-pulse space-y-4">
|
||||||
Description
|
{[...Array(6)].map((_, idx) => (
|
||||||
<span className="text-red-500">*</span>
|
<div key={idx}>
|
||||||
</label>
|
<div className="h-4 bg-gray-200 rounded w-1/3 mb-2"></div>
|
||||||
<div className="grow flex flex-col">
|
<div className="h-10 bg-gray-200 rounded w-full"></div>
|
||||||
<Input
|
</div>
|
||||||
className={`input ${errors.description ? 'border-red-500' : ''}`}
|
))}
|
||||||
type="text"
|
</div>
|
||||||
autoComplete="off"
|
<p className="mt-4 text-gray-500 text-center">Loading transaction type data...</p>
|
||||||
value={formField.description}
|
</div>
|
||||||
onChange={({ target }) => {
|
) : (
|
||||||
setFormField((prev) => ({ ...prev, description: target.value }));
|
<form action="" onSubmit={handleSubmit}>
|
||||||
if (target.value) {
|
<div className="card-body grid gap-5 p-0">
|
||||||
setErrors((prev) => ({ ...prev, description: '' }));
|
<div className="w-full">
|
||||||
}
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
}}
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
/>
|
Transfer Type Name
|
||||||
{errors.description && (
|
<span className="text-red-500">*</span>
|
||||||
<span className="text-red-500 text-xs mt-1">{errors.description}</span>
|
</label>
|
||||||
)}
|
<div className="grow flex flex-col">
|
||||||
|
<Input
|
||||||
|
className={`input ${errors.name ? 'border-red-500' : ''}`}
|
||||||
|
type="text"
|
||||||
|
autoComplete="off"
|
||||||
|
value={formField.name}
|
||||||
|
onChange={({ target }) => {
|
||||||
|
setFormField((prev) => ({ ...prev, name: target.value }));
|
||||||
|
if (target.value) {
|
||||||
|
setErrors((prev) => ({ ...prev, name: '' }));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{errors.name && (
|
||||||
|
<span className="text-red-500 text-xs mt-1">{errors.name}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
Minimum Amount
|
Description
|
||||||
</label>
|
<span className="text-red-500">*</span>
|
||||||
<div className="grow">
|
</label>
|
||||||
<NumericFormat
|
<div className="grow flex flex-col">
|
||||||
className="input"
|
<Input
|
||||||
value={formField.minimum_amount}
|
className={`input ${errors.description ? 'border-red-500' : ''}`}
|
||||||
thousandSeparator="."
|
type="text"
|
||||||
decimalSeparator=","
|
autoComplete="off"
|
||||||
allowNegative={false}
|
value={formField.description}
|
||||||
onValueChange={(values) => {
|
onChange={({ target }) => {
|
||||||
setFormField((prev) => ({
|
setFormField((prev) => ({ ...prev, description: target.value }));
|
||||||
...prev,
|
if (target.value) {
|
||||||
minimum_amount: values.floatValue || 0
|
setErrors((prev) => ({ ...prev, description: '' }));
|
||||||
}));
|
}
|
||||||
}}
|
}}
|
||||||
placeholder="Enter Minimum Amount"
|
/>
|
||||||
/>
|
{errors.description && (
|
||||||
|
<span className="text-red-500 text-xs mt-1">{errors.description}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
Maximum Amount
|
Minimum Amount
|
||||||
</label>
|
</label>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<NumericFormat
|
<NumericFormat
|
||||||
className="input"
|
className="input"
|
||||||
value={formField.maximum_amount}
|
value={formField.minimum_amount}
|
||||||
thousandSeparator="."
|
thousandSeparator="."
|
||||||
decimalSeparator=","
|
decimalSeparator=","
|
||||||
allowNegative={false}
|
allowNegative={false}
|
||||||
onValueChange={(values) => {
|
onValueChange={(values) => {
|
||||||
setFormField((prev) => ({
|
setFormField((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
maximum_amount: values.floatValue || 0
|
minimum_amount: values.floatValue || 0
|
||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
placeholder="Enter Maximum Amount"
|
placeholder="Enter Minimum Amount"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div className="w-full">
|
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
|
||||||
Max Transaction per day
|
|
||||||
</label>
|
|
||||||
<div className="grow">
|
|
||||||
<NumericFormat
|
|
||||||
className="input"
|
|
||||||
value={formField.max_transaction_per_day}
|
|
||||||
thousandSeparator="."
|
|
||||||
decimalSeparator=","
|
|
||||||
allowNegative={false}
|
|
||||||
onValueChange={(values) => {
|
|
||||||
setFormField((prev) => ({
|
|
||||||
...prev,
|
|
||||||
max_transaction_per_day: values.floatValue || 0
|
|
||||||
}));
|
|
||||||
}}
|
|
||||||
placeholder="Enter Max Transaction Per Day"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="w-full">
|
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
|
||||||
From Account
|
|
||||||
<span className="text-red-500">*</span>
|
|
||||||
</label>
|
|
||||||
<div className="grow flex flex-col">
|
|
||||||
{renderSelectWithLoading(
|
|
||||||
formField.wallet_origin,
|
|
||||||
(value) => setFormField({ ...formField, wallet_origin: value }),
|
|
||||||
wallets,
|
|
||||||
'Select Wallet',
|
|
||||||
isLoadingWallets
|
|
||||||
)}
|
|
||||||
{errors.wallet_origin && (
|
|
||||||
<span className="text-red-500 text-xs mt-1">{errors.wallet_origin}</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
To Account
|
Maximum Amount
|
||||||
<span className="text-red-500">*</span>
|
</label>
|
||||||
</label>
|
<div className="grow">
|
||||||
<div className="grow flex flex-col">
|
<NumericFormat
|
||||||
<Select
|
className="input"
|
||||||
value={formField.wallet_destination}
|
value={formField.maximum_amount}
|
||||||
onValueChange={(wallet_destination) => {
|
thousandSeparator="."
|
||||||
setFormField((prev) => ({ ...prev, wallet_destination }));
|
decimalSeparator=","
|
||||||
setErrors((prev) => ({ ...prev, wallet_destination: '' }));
|
allowNegative={false}
|
||||||
}}
|
onValueChange={(values) => {
|
||||||
>
|
setFormField((prev) => ({
|
||||||
<SelectTrigger
|
...prev,
|
||||||
className={errors.wallet_destination ? 'border-red-500' : ''}
|
maximum_amount: values.floatValue || 0
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
placeholder="Enter Maximum Amount"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Max Transaction per day
|
||||||
|
</label>
|
||||||
|
<div className="grow">
|
||||||
|
<NumericFormat
|
||||||
|
className="input"
|
||||||
|
value={formField.max_transaction_per_day}
|
||||||
|
thousandSeparator="."
|
||||||
|
decimalSeparator=","
|
||||||
|
allowNegative={false}
|
||||||
|
onValueChange={(values) => {
|
||||||
|
setFormField((prev) => ({
|
||||||
|
...prev,
|
||||||
|
max_transaction_per_day: values.floatValue || 0
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
placeholder="Enter Max Transaction Per Day"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
From Account
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<div className="grow flex flex-col">
|
||||||
|
{renderSelectWithLoading(
|
||||||
|
formField.wallet_origin,
|
||||||
|
(value) => setFormField({ ...formField, wallet_origin: value }),
|
||||||
|
wallets,
|
||||||
|
'Select Wallet',
|
||||||
|
isLoadingWallets
|
||||||
|
)}
|
||||||
|
{errors.wallet_origin && (
|
||||||
|
<span className="text-red-500 text-xs mt-1">{errors.wallet_origin}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
To Account
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
<div className="grow flex flex-col">
|
||||||
|
<Select
|
||||||
|
value={formField.wallet_destination}
|
||||||
|
onValueChange={(wallet_destination) => {
|
||||||
|
setFormField((prev) => ({ ...prev, wallet_destination }));
|
||||||
|
setErrors((prev) => ({ ...prev, wallet_destination: '' }));
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<SelectValue placeholder="Select Wallet" />
|
<SelectTrigger
|
||||||
</SelectTrigger>
|
className={errors.wallet_destination ? 'border-red-500' : ''}
|
||||||
<SelectContent>
|
>
|
||||||
{wallets.map((wallet) => (
|
<SelectValue placeholder="Select Wallet" />
|
||||||
<SelectItem value={wallet.id} key={wallet.id}>
|
</SelectTrigger>
|
||||||
{wallet.name}
|
<SelectContent>
|
||||||
|
{wallets.map((wallet) => (
|
||||||
|
<SelectItem value={wallet.id} key={wallet.id}>
|
||||||
|
{wallet.name}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
{errors.wallet_destination && (
|
||||||
|
<span className="text-red-500 text-xs mt-1">
|
||||||
|
{errors.wallet_destination}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Status Transaction Type
|
||||||
|
<span className="text-red-500"> *</span>
|
||||||
|
</label>
|
||||||
|
<div className="grow flex flex-col">
|
||||||
|
<Select
|
||||||
|
value={formField.type}
|
||||||
|
onValueChange={(value) => {
|
||||||
|
setFormField((prev) => ({ ...prev, type: value }));
|
||||||
|
setErrors((prev) => ({ ...prev, type: '' }));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SelectTrigger className={errors.type ? 'border-red-500' : ''}>
|
||||||
|
<SelectValue placeholder="Select" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="D">Disbursement </SelectItem>
|
||||||
|
<SelectItem value="O">Other </SelectItem>
|
||||||
|
<SelectItem value="CA">
|
||||||
|
Change Group Emoney Customer to Agent{' '}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
<SelectItem value="AC">
|
||||||
</SelectContent>
|
Change Group Emoney Agent to Customer{' '}
|
||||||
</Select>
|
</SelectItem>
|
||||||
{errors.wallet_destination && (
|
<SelectItem value="PA">
|
||||||
<span className="text-red-500 text-xs mt-1">
|
Change Group Point Agent to Customer{' '}
|
||||||
{errors.wallet_destination}
|
</SelectItem>
|
||||||
</span>
|
<SelectItem value="PC">Change Group Point Customer to Agent</SelectItem>
|
||||||
)}
|
<SelectItem value="CE">Return Customer Emoney </SelectItem>
|
||||||
|
<SelectItem value="AD">Return Agent Deposit </SelectItem>
|
||||||
|
<SelectItem value="AM">Return Agent Merchant </SelectItem>
|
||||||
|
<SelectItem value="AE">Return Agent Emoney </SelectItem>
|
||||||
|
<SelectItem value="R">Reward Point </SelectItem>
|
||||||
|
<SelectItem value="TE">Top Up Escrow </SelectItem>
|
||||||
|
<SelectItem value="TM">Top Up Master Agent </SelectItem>
|
||||||
|
<SelectItem value="TA">Top Up Agent </SelectItem>
|
||||||
|
<SelectItem value="PL">Purchase Loja</SelectItem>
|
||||||
|
<SelectItem value="DE">Disbursment Escrow</SelectItem>
|
||||||
|
<SelectItem value="DM">Disbursment Master Agent</SelectItem>
|
||||||
|
<SelectItem value="DA">Disbursment Agent</SelectItem>
|
||||||
|
<SelectItem value="WI">Withdraw Merchant</SelectItem>
|
||||||
|
<SelectItem value="IC">Income Merchant</SelectItem>
|
||||||
|
<SelectItem value="DN">Donation</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
{errors.type && (
|
||||||
|
<span className="text-red-500 text-xs mt-1">{errors.type}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
Status Transaction Type
|
Status Approval
|
||||||
<span className="text-red-500"> *</span>
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<div className="grow flex flex-col">
|
<div className="grow flex flex-col">
|
||||||
<Select
|
<Select
|
||||||
value={formField.type}
|
value={formField.status_approval}
|
||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
setFormField((prev) => ({ ...prev, type: value }));
|
setFormField((prev) => ({ ...prev, status_approval: value }));
|
||||||
setErrors((prev) => ({ ...prev, type: '' }));
|
setErrors((prev) => ({ ...prev, status_approval: '' }));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SelectTrigger className={errors.type ? 'border-red-500' : ''}>
|
<SelectTrigger className={errors.status_approval ? 'border-red-500' : ''}>
|
||||||
<SelectValue placeholder="Select" />
|
<SelectValue placeholder="Select" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
<SelectItem value="D">Disbursement </SelectItem>
|
<SelectItem value="Y">Yes</SelectItem>
|
||||||
<SelectItem value="O">Other </SelectItem>
|
<SelectItem value="N">No</SelectItem>
|
||||||
<SelectItem value="CA">Change Group Emoney Customer to Agent </SelectItem>
|
</SelectContent>
|
||||||
<SelectItem value="AC">Change Group Emoney Agent to Customer </SelectItem>
|
</Select>
|
||||||
<SelectItem value="PA">Change Group Point Agent to Customer </SelectItem>
|
{errors.status_approval && (
|
||||||
<SelectItem value="PC">Change Group Point Customer to Agent</SelectItem>
|
<span className="text-red-500 text-xs mt-1">
|
||||||
<SelectItem value="CE">Return Customer Emoney </SelectItem>
|
{errors.status_approval}
|
||||||
<SelectItem value="AD">Return Agent Deposit </SelectItem>
|
</span>
|
||||||
<SelectItem value="AM">Return Agent Merchant </SelectItem>
|
)}
|
||||||
<SelectItem value="AE">Return Agent Emoney </SelectItem>
|
</div>
|
||||||
<SelectItem value="R">Reward Point </SelectItem>
|
|
||||||
<SelectItem value="TE">Top Up Escrow </SelectItem>
|
|
||||||
<SelectItem value="TM">Top Up Master Agent </SelectItem>
|
|
||||||
<SelectItem value="TA">Top Up Agent </SelectItem>
|
|
||||||
<SelectItem value="PL">Purchase Loja</SelectItem>
|
|
||||||
<SelectItem value="DE">Disbursment Escrow</SelectItem>
|
|
||||||
<SelectItem value="DM">Disbursment Master Agent</SelectItem>
|
|
||||||
<SelectItem value="DA">Disbursment Agent</SelectItem>
|
|
||||||
<SelectItem value="WI">Withdraw Merchant</SelectItem>
|
|
||||||
<SelectItem value="IC">Income Merchant</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
{errors.type && (
|
|
||||||
<span className="text-red-500 text-xs mt-1">{errors.type}</span>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Status Kind
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<div className="w-full">
|
<div className="grow flex flex-col">
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
<Select
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
value={formField.status_kind}
|
||||||
Status Approval
|
onValueChange={(value) => {
|
||||||
<span className="text-red-500">*</span>
|
setFormField((prev) => ({ ...prev, status_kind: value }));
|
||||||
</label>
|
setErrors((prev) => ({ ...prev, status_kind: '' }));
|
||||||
<div className="grow flex flex-col">
|
}}
|
||||||
<Select
|
>
|
||||||
value={formField.status_approval}
|
<SelectTrigger className={errors.status_kind ? 'border-red-500' : ''}>
|
||||||
onValueChange={(value) => {
|
<SelectValue placeholder="Select" />
|
||||||
setFormField((prev) => ({ ...prev, status_approval: value }));
|
</SelectTrigger>
|
||||||
setErrors((prev) => ({ ...prev, status_approval: '' }));
|
<SelectContent>
|
||||||
}}
|
<SelectItem value="R">Return</SelectItem>
|
||||||
>
|
<SelectItem value="T">Transfer</SelectItem>
|
||||||
<SelectTrigger className={errors.status_approval ? 'border-red-500' : ''}>
|
<SelectItem value="P">Purchase</SelectItem>
|
||||||
<SelectValue placeholder="Select" />
|
<SelectItem value="W">Withdraw</SelectItem>
|
||||||
</SelectTrigger>
|
<SelectItem value="U">Top Up</SelectItem>
|
||||||
<SelectContent>
|
<SelectItem value="N">Top Up Patner</SelectItem>
|
||||||
<SelectItem value="Y">Yes</SelectItem>
|
</SelectContent>
|
||||||
<SelectItem value="N">No</SelectItem>
|
</Select>
|
||||||
</SelectContent>
|
{errors.status_kind && (
|
||||||
</Select>
|
<span className="text-red-500 text-xs mt-1">{errors.status_kind}</span>
|
||||||
{errors.status_approval && (
|
)}
|
||||||
<span className="text-red-500 text-xs mt-1">{errors.status_approval}</span>
|
</div>
|
||||||
)}
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Status
|
||||||
|
<span className="text-red-500"> *</span>
|
||||||
|
</label>
|
||||||
|
<div className="grow flex flex-col">
|
||||||
|
<Select
|
||||||
|
value={formField.status}
|
||||||
|
onValueChange={(value) => {
|
||||||
|
setFormField((prev) => ({ ...prev, status: value }));
|
||||||
|
setErrors((prev) => ({ ...prev, status: '' }));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SelectTrigger className={errors.status ? 'border-red-500' : ''}>
|
||||||
|
<SelectValue placeholder="Select" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="Y">Active</SelectItem>
|
||||||
|
<SelectItem value="N">Inactive</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
{errors.status && (
|
||||||
|
<span className="text-red-500 text-xs mt-1">{errors.status}</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div className="w-full">
|
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
|
||||||
Status Kind
|
|
||||||
<span className="text-red-500">*</span>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<div className="grow flex flex-col">
|
<div className="w-full">
|
||||||
<Select
|
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
||||||
value={formField.status_kind}
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
onValueChange={(value) => {
|
Groups
|
||||||
setFormField((prev) => ({ ...prev, status_kind: value }));
|
<span className="text-red-500">*</span>
|
||||||
setErrors((prev) => ({ ...prev, status_kind: '' }));
|
</label>
|
||||||
}}
|
<div className="relative w-full">
|
||||||
>
|
<Input
|
||||||
<SelectTrigger className={errors.status_kind ? 'border-red-500' : ''}>
|
type="text"
|
||||||
<SelectValue placeholder="Select" />
|
placeholder="No groups selected"
|
||||||
</SelectTrigger>
|
value={selectedPermissionNames || ''}
|
||||||
<SelectContent>
|
readOnly
|
||||||
<SelectItem value="R">Return</SelectItem>
|
className={`bg-gray-100 mb-2 ${errors.permission ? 'border-red-500' : ''}`}
|
||||||
<SelectItem value="T">Transfer</SelectItem>
|
/>
|
||||||
<SelectItem value="P">Purchase</SelectItem>
|
{errors.permission && (
|
||||||
<SelectItem value="W">Withdraw</SelectItem>
|
<span className="text-red-500 text-xs mt-2">{errors.permission}</span>
|
||||||
<SelectItem value="U">Top Up</SelectItem>
|
)}
|
||||||
<SelectItem value="N">Top Up Patner</SelectItem>
|
<div className="border rounded-md p-3 max-h-48 overflow-y-auto">
|
||||||
</SelectContent>
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||||
</Select>
|
{groups.map((group) => (
|
||||||
{errors.status_kind && (
|
<div key={group.id} className="flex items-center space-x-2">
|
||||||
<span className="text-red-500 text-xs mt-1">{errors.status_kind}</span>
|
<Checkbox
|
||||||
)}
|
id={`group-${group.id}`}
|
||||||
</div>
|
checked={formField.permission.includes(group.id)}
|
||||||
</div>
|
onCheckedChange={() => handleGroupChange(group.id)}
|
||||||
</div>
|
/>
|
||||||
<div className="w-full">
|
<label
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
htmlFor={`group-${group.id}`}
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
||||||
Status
|
>
|
||||||
<span className="text-red-500"> *</span>
|
{group.name}
|
||||||
</label>
|
</label>
|
||||||
<div className="grow flex flex-col">
|
</div>
|
||||||
<Select
|
))}
|
||||||
value={formField.status}
|
</div>
|
||||||
onValueChange={(value) => {
|
|
||||||
setFormField((prev) => ({ ...prev, status: value }));
|
|
||||||
setErrors((prev) => ({ ...prev, status: '' }));
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SelectTrigger className={errors.status ? 'border-red-500' : ''}>
|
|
||||||
<SelectValue placeholder="Select" />
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem value="Y">Active</SelectItem>
|
|
||||||
<SelectItem value="N">Inactive</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
{errors.status && (
|
|
||||||
<span className="text-red-500 text-xs mt-1">{errors.status}</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="w-full">
|
|
||||||
<div className="flex items-baseline flex-wrap lg:flex-nowrap gap-2.5">
|
|
||||||
<label className="form-label flex items-center gap-1 max-w-56">
|
|
||||||
Groups
|
|
||||||
<span className="text-red-500">*</span>
|
|
||||||
</label>
|
|
||||||
<div className="relative w-full">
|
|
||||||
<Input
|
|
||||||
type="text"
|
|
||||||
placeholder="No groups selected"
|
|
||||||
value={selectedPermissionNames || ''}
|
|
||||||
readOnly
|
|
||||||
className={`bg-gray-100 mb-2 ${errors.permission ? 'border-red-500' : ''}`}
|
|
||||||
/>
|
|
||||||
{errors.permission && (
|
|
||||||
<span className="text-red-500 text-xs mt-2">{errors.permission}</span>
|
|
||||||
)}
|
|
||||||
<div className="border rounded-md p-3 max-h-48 overflow-y-auto">
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
|
||||||
{groups.map((group) => (
|
|
||||||
<div key={group.id} className="flex items-center space-x-2">
|
|
||||||
<Checkbox
|
|
||||||
id={`group-${group.id}`}
|
|
||||||
checked={formField.permission.includes(group.id)}
|
|
||||||
onCheckedChange={() => handleGroupChange(group.id)}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
htmlFor={`group-${group.id}`}
|
|
||||||
className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
||||||
>
|
|
||||||
{group.name}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex justify-end pt-2.5 gap-5">
|
<div className="flex justify-end pt-2.5 gap-5">
|
||||||
<Button variant={'outline'} type="button" onClick={() => resetForm()}>
|
<Button variant={'outline'} type="button" onClick={() => resetForm()}>
|
||||||
Reset
|
Reset
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant={'default'} type="submit" disabled={isSubmitting}>
|
<Button
|
||||||
{isSubmitting ? 'Saving...' : 'Save Changes'}
|
variant={'default'}
|
||||||
</Button>
|
type="submit"
|
||||||
|
disabled={isSubmitting || isLoadingData}
|
||||||
|
>
|
||||||
|
{isSubmitting ? 'Saving...' : 'Save Changes'}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</form>
|
)}
|
||||||
<ManageTransferFeeContextProvider transactionTypeId={selectedTransferType}>
|
|
||||||
<Container>
|
{isLoadingData && (
|
||||||
<div className="grid gap-5 lg:gap-7.5 mt-5">
|
<ManageTransferFeeContextProvider transactionTypeId={selectedTransferType}>
|
||||||
<DataGridInner />
|
<Container>
|
||||||
</div>
|
<div className="grid gap-5 lg:gap-7.5 mt-5">
|
||||||
<AddFeeDialog />
|
<DataGridInner />
|
||||||
<DeleteFeeDialog />
|
</div>
|
||||||
<EditFeeDialog />
|
<AddFeeDialog />
|
||||||
</Container>
|
<DeleteFeeDialog />
|
||||||
</ManageTransferFeeContextProvider>
|
<EditFeeDialog />
|
||||||
|
</Container>
|
||||||
|
</ManageTransferFeeContextProvider>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</DialogBody>
|
</DialogBody>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
|||||||
@ -203,7 +203,8 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
|||||||
DM: 'Disbursment Master Agent',
|
DM: 'Disbursment Master Agent',
|
||||||
DA: 'Disbursment Agent',
|
DA: 'Disbursment Agent',
|
||||||
WI: 'Withdraw Merchant',
|
WI: 'Withdraw Merchant',
|
||||||
IC: 'Income Merchant'
|
IC: 'Income Merchant',
|
||||||
|
DN: 'Donation'
|
||||||
};
|
};
|
||||||
|
|
||||||
return mapping[row.type] || 'Unknown';
|
return mapping[row.type] || 'Unknown';
|
||||||
@ -227,20 +228,18 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
|||||||
{
|
{
|
||||||
accessorFn: (row: { status_kind: string }) => {
|
accessorFn: (row: { status_kind: string }) => {
|
||||||
const mapping: Record<string, string> = {
|
const mapping: Record<string, string> = {
|
||||||
R: "Return",
|
R: 'Return',
|
||||||
T: "Transfer",
|
T: 'Transfer',
|
||||||
P: "Purchase",
|
P: 'Purchase',
|
||||||
W: "Withdraw",
|
W: 'Withdraw',
|
||||||
U: "Top Up",
|
U: 'Top Up',
|
||||||
N: "Top Up Patner"
|
N: 'Top Up Patner'
|
||||||
};
|
};
|
||||||
|
|
||||||
return mapping[row.status_kind] || 'Unknown';
|
return mapping[row.status_kind] || 'Unknown';
|
||||||
},
|
},
|
||||||
id: 'status_kind',
|
id: 'status_kind',
|
||||||
header: ({ column }) => (
|
header: ({ column }) => <DataGridColumnHeader title="Status Kind" column={column} />,
|
||||||
<DataGridColumnHeader title="Status Kind" column={column} />
|
|
||||||
),
|
|
||||||
enableSorting: false,
|
enableSorting: false,
|
||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: { headerClassName: 'w-[250px]' }
|
meta: { headerClassName: 'w-[250px]' }
|
||||||
@ -295,22 +294,19 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
|||||||
let filterObject: Record<string, any> = {};
|
let filterObject: Record<string, any> = {};
|
||||||
|
|
||||||
if (debouncedSearchTerm) {
|
if (debouncedSearchTerm) {
|
||||||
filterObject["any"] = debouncedSearchTerm.toLowerCase();
|
filterObject['any'] = debouncedSearchTerm.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (columnFilters.length > 0) {
|
if (columnFilters.length > 0) {
|
||||||
columnFilters.forEach((filter: any) => {
|
columnFilters.forEach((filter: any) => {
|
||||||
if (filter.id && filter.value) {
|
if (filter.id && filter.value) {
|
||||||
if (filter.id === 'name') {
|
if (filter.id === 'name') {
|
||||||
filterObject["any"] = filter.value.toLowerCase();
|
filterObject['any'] = filter.value.toLowerCase();
|
||||||
}
|
} else if (filter.id === 'wallet_origin') {
|
||||||
else if (filter.id === 'wallet_origin') {
|
filterObject['wallet_origin.name'] = filter.value.toLowerCase();
|
||||||
filterObject["wallet_origin.name"] = filter.value.toLowerCase();
|
} else if (filter.id === 'wallet_destination') {
|
||||||
}
|
filterObject['wallet_destination.name'] = filter.value.toLowerCase();
|
||||||
else if (filter.id === 'wallet_destination') {
|
} else {
|
||||||
filterObject["wallet_destination.name"] = filter.value.toLowerCase();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
filterObject[filter.id] = filter.value.toLowerCase();
|
filterObject[filter.id] = filter.value.toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user