fix transactionfee + give "*" on update form

This commit is contained in:
bagusajisaputroo
2025-03-26 11:23:40 +07:00
parent f7f6b128e1
commit 41c1fed872
4 changed files with 40 additions and 36 deletions

View File

@ -75,7 +75,7 @@ const AddFeeDialog = () => {
period_end: '', period_end: '',
deduct_amount: 0, deduct_amount: 0,
deduct_percentage: 0, deduct_percentage: 0,
priority: false, priority: '',
status: '', status: '',
status_include: '', status_include: '',
created_by: '', created_by: '',
@ -107,7 +107,7 @@ const AddFeeDialog = () => {
transaction_type: formField.transaction_type, transaction_type: formField.transaction_type,
status: formField.status, status: formField.status,
status_include: formField.status_include, status_include: formField.status_include,
priority: formField.priority ? 'Y' : 'N' priority: formField.priority
}; };
}; };
useEffect(() => { useEffect(() => {
@ -162,7 +162,6 @@ const AddFeeDialog = () => {
const response = await PostData(`${API_URL}/transactionfees/create`, { const response = await PostData(`${API_URL}/transactionfees/create`, {
...formField ...formField
}); });
// console.log(response);
if (response?.status) { if (response?.status) {
toast.success('Success Create Transfer Fee'); toast.success('Success Create Transfer Fee');
reload(); reload();
@ -370,10 +369,8 @@ const AddFeeDialog = () => {
<div className="w-full"> <div className="w-full">
<label className="form-label">Priority <span className="text-red-500">*</span></label> <label className="form-label">Priority <span className="text-red-500">*</span></label>
<Select <Select
value={formField.priority ? 'Y' : 'N'} value={formField.priority}
onValueChange={(value) => onValueChange={(value) => setFormField({ ...formField, priority: value })}
setFormField((prev) => ({ ...prev, priority: value === 'Y' }))
}
> >
<SelectTrigger> <SelectTrigger>
<SelectValue placeholder="Select Priority" /> <SelectValue placeholder="Select Priority" />

View File

@ -72,7 +72,7 @@ const EditFeeDialog = () => {
period_end: '', period_end: '',
deduct_amount: 0, deduct_amount: 0,
deduct_percentage: 0, deduct_percentage: 0,
priority: false, priority: '',
status: '', status: '',
status_include: '', status_include: '',
transaction_type: '', transaction_type: '',
@ -96,9 +96,7 @@ const EditFeeDialog = () => {
async (e: React.FormEvent<HTMLFormElement>) => { async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault(); e.preventDefault();
const response = await PutData(`${API_URL}/transactionfees/update/${selectedTransferFee}`, { const response = await PutData(`${API_URL}/transactionfees/update/${selectedTransferFee}`, {
...formField, ...formField, });
priority: formField.priority ? 'Y' : 'N' // Ubah ke "Y" atau "N"
});
if (response?.status) { if (response?.status) {
handleEditFeeDialog(false, null); handleEditFeeDialog(false, null);
toast.success('Success Update User'); toast.success('Success Update User');
@ -190,7 +188,7 @@ const EditFeeDialog = () => {
period_end: response.data.period_end, period_end: response.data.period_end,
deduct_amount: response.data.deduct_amount, deduct_amount: response.data.deduct_amount,
deduct_percentage: response.data.deduct_percentage, deduct_percentage: response.data.deduct_percentage,
priority: response.data.priority === 'Y', priority: response.data.priority,
status: response.data.status, status: response.data.status,
status_include: response.data.status_include, status_include: response.data.status_include,
transaction_type: response.data.transaction_type.id transaction_type: response.data.transaction_type.id
@ -213,7 +211,7 @@ const EditFeeDialog = () => {
period_end: '', period_end: '',
deduct_amount: 0, deduct_amount: 0,
deduct_percentage: 0, deduct_percentage: 0,
priority: false, priority: '',
status: '', status: '',
status_include: '', status_include: '',
transaction_type: '', transaction_type: '',
@ -422,22 +420,20 @@ const EditFeeDialog = () => {
</Select> </Select>
</div> </div>
<div className="w-full"> <div className="w-full">
<label className="form-label">Priority <span className="text-red-500">*</span></label> <label className="form-label">Priority <span className="text-red-500">*</span></label>
<Select <Select
value={formField.priority ? 'Y' : 'N'} // Menyesuaikan nilai value={formField.priority}
onValueChange={(value) => onValueChange={(value) => setFormField({ ...formField, priority: value })}
setFormField((prev) => ({ ...prev, priority: value === 'Y' })) >
} <SelectTrigger>
> <SelectValue placeholder="Select Priority" />
<SelectTrigger> </SelectTrigger>
<SelectValue placeholder="Select Priority" /> <SelectContent>
</SelectTrigger> <SelectItem value="Y">Yes</SelectItem>
<SelectContent> <SelectItem value="N">No</SelectItem>
<SelectItem value="Y">Yes</SelectItem> </SelectContent>
<SelectItem value="N">No</SelectItem> </Select>
</SelectContent> </div>
</Select>
</div>
{/* <div className="w-full"> {/* <div className="w-full">
<label className="form-label">Priotity <span className="text-red-500">*</span></label> <label className="form-label">Priotity <span className="text-red-500">*</span></label>

View File

@ -153,7 +153,7 @@ const ManageTransferFeeContextProvider = ({ children }: { children: React.ReactN
meta: { headerClassName: 'w-[100px]' } meta: { headerClassName: 'w-[100px]' }
}, },
{ {
accessorFn: (row) => (row.status === 'Y' ? 'Active' : 'Inactieve'), accessorFn: (row) => (row.status === 'Y' ? 'Active' : 'Inactive'),
id: 'status', id: 'status',
header: ({ column }) => <DataGridColumnHeader title="Status" column={column} />, header: ({ column }) => <DataGridColumnHeader title="Status" column={column} />,
enableSorting: true, enableSorting: true,

View File

@ -240,6 +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>
</label> </label>
<Input <Input
className="input" className="input"
@ -257,6 +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>
</label> </label>
<Input <Input
className="input" className="input"
@ -274,6 +276,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">
Minimum Amount Minimum Amount
<span className="text-red-500">*</span>
</label> </label>
<NumericFormat <NumericFormat
className="input" className="input"
@ -296,6 +299,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">
Maximum Amount Maximum Amount
<span className="text-red-500">*</span>
</label> </label>
<NumericFormat <NumericFormat
className="input" className="input"
@ -317,6 +321,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">
Maximum Transaction per day Maximum Transaction per day
<span className="text-red-500">*</span>
</label> </label>
<NumericFormat <NumericFormat
className="input" className="input"
@ -336,7 +341,8 @@ 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</label> <label className="form-label 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}
@ -361,7 +367,8 @@ 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</label> <label className="form-label 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}
@ -385,7 +392,8 @@ 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</label> <label className="form-label max-w-56">Wallet Fee Destination<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}
@ -409,7 +417,8 @@ 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</label> <label className="form-label max-w-56">Select Customer<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}
@ -433,7 +442,8 @@ 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">Status Approval</label> <label className="form-label max-w-56">Status Approval<span className="text-red-500">*</span>
</label>
<div className="grow"> <div className="grow">
<Select <Select
@ -456,7 +466,8 @@ 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</label> <label className="form-label max-w-56">Status<span className="text-red-500">*</span>
</label>
<div className="grow"> <div className="grow">
<Select <Select