fix add and update on transaction type
This commit is contained in:
@ -165,10 +165,7 @@ const AddDialog = () => {
|
|||||||
async (e: React.FormEvent<HTMLFormElement>) => {
|
async (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
for (const key in formField) {
|
for (const key in formField) {
|
||||||
if (
|
if (formField[key as keyof typeof formField] === '') {
|
||||||
formField[key as keyof typeof formField] === '' ||
|
|
||||||
formField[key as keyof typeof formField] === 0
|
|
||||||
) {
|
|
||||||
setAlert({ show: true, message: 'All fields must be filled out' });
|
setAlert({ show: true, message: 'All fields must be filled out' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -229,6 +226,7 @@ const AddDialog = () => {
|
|||||||
<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">
|
||||||
Transfer Type Name
|
Transfer Type Name
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
className="input"
|
className="input"
|
||||||
@ -246,6 +244,7 @@ const AddDialog = () => {
|
|||||||
<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">
|
||||||
Description
|
Description
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
className="input"
|
className="input"
|
||||||
@ -325,7 +324,10 @@ const AddDialog = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">From Account</label>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
From Account
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
value={formField.wallet_origin}
|
value={formField.wallet_origin}
|
||||||
@ -350,7 +352,10 @@ const AddDialog = () => {
|
|||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">To Account</label>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
To Account
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
value={formField.wallet_destination}
|
value={formField.wallet_destination}
|
||||||
@ -374,7 +379,10 @@ const AddDialog = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">Wallet Destination Fee</label>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Wallet Destination Fee
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
value={formField.wallet_fee_destination}
|
value={formField.wallet_fee_destination}
|
||||||
@ -398,7 +406,10 @@ const AddDialog = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">Customer Fee Destination</label>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Customer Fee Destination
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
value={formField.customer_fee_destination}
|
value={formField.customer_fee_destination}
|
||||||
@ -423,7 +434,10 @@ const AddDialog = () => {
|
|||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">Status Approval</label>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Status Approval
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
@ -446,7 +460,10 @@ const AddDialog = () => {
|
|||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">Status</label>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Status
|
||||||
|
<span className="text-red-500"> *</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
|
|||||||
@ -240,7 +240,7 @@ const EditDialog = () => {
|
|||||||
<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">
|
||||||
Transfer Type Name
|
Transfer Type Name
|
||||||
<span className="text-red-500">*</span>
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
className="input"
|
className="input"
|
||||||
@ -258,7 +258,7 @@ const EditDialog = () => {
|
|||||||
<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">
|
||||||
Description
|
Description
|
||||||
<span className="text-red-500">*</span>
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
className="input"
|
className="input"
|
||||||
@ -276,7 +276,6 @@ const EditDialog = () => {
|
|||||||
<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
|
Minimum Amount
|
||||||
<span className="text-red-500">*</span>
|
|
||||||
</label>
|
</label>
|
||||||
<NumericFormat
|
<NumericFormat
|
||||||
className="input"
|
className="input"
|
||||||
@ -287,7 +286,7 @@ const EditDialog = () => {
|
|||||||
onValueChange={(values) => {
|
onValueChange={(values) => {
|
||||||
setFormField((prev) => ({
|
setFormField((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
maximum_amount: values.floatValue || 0
|
minimum_amount: values.floatValue || 0
|
||||||
}));
|
}));
|
||||||
}}
|
}}
|
||||||
placeholder="Enter Minimum Amount"
|
placeholder="Enter Minimum Amount"
|
||||||
@ -299,7 +298,6 @@ const EditDialog = () => {
|
|||||||
<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
|
Maximum Amount
|
||||||
<span className="text-red-500">*</span>
|
|
||||||
</label>
|
</label>
|
||||||
<NumericFormat
|
<NumericFormat
|
||||||
className="input"
|
className="input"
|
||||||
@ -320,8 +318,7 @@ const EditDialog = () => {
|
|||||||
<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 Transaction per day
|
Max Transaction per day
|
||||||
<span className="text-red-500">*</span>
|
|
||||||
</label>
|
</label>
|
||||||
<NumericFormat
|
<NumericFormat
|
||||||
className="input"
|
className="input"
|
||||||
@ -341,7 +338,9 @@ const EditDialog = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">From Account<span className="text-red-500">*</span>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
From Account
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
@ -354,8 +353,8 @@ const EditDialog = () => {
|
|||||||
<SelectValue placeholder="Select Wallet" />
|
<SelectValue placeholder="Select Wallet" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{wallets.map((wallet) => (
|
{wallets.map((wallet, idx) => (
|
||||||
<SelectItem value={wallet.Wallet_id} key={wallet.Wallet_id}>
|
<SelectItem value={wallet.Wallet_id} key={wallet.Wallet_name}>
|
||||||
{wallet.Wallet_name}
|
{wallet.Wallet_name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
@ -367,7 +366,9 @@ const EditDialog = () => {
|
|||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">To Account<span className="text-red-500">*</span>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
To Account
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
@ -381,7 +382,7 @@ const EditDialog = () => {
|
|||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{wallets.map((wallet, idx) => (
|
{wallets.map((wallet, idx) => (
|
||||||
<SelectItem value={wallet.Wallet_id} key={wallet.Wallet_name}>
|
<SelectItem value={wallet.Wallet_id} key={wallet.Wallet_id}>
|
||||||
{wallet.Wallet_name}
|
{wallet.Wallet_name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
@ -392,7 +393,9 @@ const EditDialog = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">Wallet Fee Destination<span className="text-red-500">*</span>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Wallet Destination Fee
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
@ -406,7 +409,7 @@ const EditDialog = () => {
|
|||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{wallets.map((wallet, idx) => (
|
{wallets.map((wallet, idx) => (
|
||||||
<SelectItem value={wallet.Wallet_id} key={wallet.Wallet_name}>
|
<SelectItem value={wallet.Wallet_id} key={wallet.Wallet_id}>
|
||||||
{wallet.Wallet_name}
|
{wallet.Wallet_name}
|
||||||
</SelectItem>
|
</SelectItem>
|
||||||
))}
|
))}
|
||||||
@ -417,7 +420,9 @@ const EditDialog = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">Select Customer<span className="text-red-500">*</span>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Customer Fee Destination
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
<Select
|
<Select
|
||||||
@ -427,7 +432,7 @@ const EditDialog = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue placeholder="Select" />
|
<SelectValue placeholder="Select Customer" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent>
|
||||||
{customers.map((customer, idx) => (
|
{customers.map((customer, idx) => (
|
||||||
@ -440,9 +445,12 @@ const EditDialog = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">Status Approval<span className="text-red-500">*</span>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Status Approval
|
||||||
|
<span className="text-red-500">*</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
@ -466,7 +474,9 @@ const EditDialog = () => {
|
|||||||
|
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="flex items-center flex-wrap gap-2.5">
|
<div className="flex items-center flex-wrap gap-2.5">
|
||||||
<label className="form-label max-w-56">Status<span className="text-red-500">*</span>
|
<label className="form-label flex items-center gap-1 max-w-56">
|
||||||
|
Status
|
||||||
|
<span className="text-red-500"> *</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div className="grow">
|
<div className="grow">
|
||||||
@ -487,6 +497,7 @@ const EditDialog = () => {
|
|||||||
</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
|
<Button
|
||||||
variant={'outline'}
|
variant={'outline'}
|
||||||
|
|||||||
@ -85,6 +85,14 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
|||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: { headerClassName: 'w-[250px]' }
|
meta: { headerClassName: 'w-[250px]' }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
accessorFn: (row) => row.description,
|
||||||
|
id: 'description',
|
||||||
|
header: ({ column }) => <DataGridColumnHeader title="Description" column={column} />,
|
||||||
|
enableSorting: true,
|
||||||
|
enableHiding: false,
|
||||||
|
meta: { headerClassName: 'w-[250px]' }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.wallet_origin?.name || 'N/A',
|
accessorFn: (row) => row.wallet_origin?.name || 'N/A',
|
||||||
id: 'wallet_origin',
|
id: 'wallet_origin',
|
||||||
@ -127,14 +135,6 @@ const ManageTransferTypeContextProvider = ({ children }: { children: React.React
|
|||||||
enableHiding: false,
|
enableHiding: false,
|
||||||
meta: { headerClassName: 'w-[250px]' }
|
meta: { headerClassName: 'w-[250px]' }
|
||||||
},
|
},
|
||||||
{
|
|
||||||
accessorFn: (row) => row.description,
|
|
||||||
id: 'description',
|
|
||||||
header: ({ column }) => <DataGridColumnHeader title="Description" column={column} />,
|
|
||||||
enableSorting: true,
|
|
||||||
enableHiding: false,
|
|
||||||
meta: { headerClassName: 'w-[250px]' }
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
accessorFn: (row) => row.wallet_fee_destination.name,
|
accessorFn: (row) => row.wallet_fee_destination.name,
|
||||||
id: 'wallet_fee_destination',
|
id: 'wallet_fee_destination',
|
||||||
|
|||||||
Reference in New Issue
Block a user