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

View File

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

View File

@ -240,6 +240,7 @@ const EditDialog = () => {
<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>
<Input
className="input"
@ -257,6 +258,7 @@ const EditDialog = () => {
<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">
Description
<span className="text-red-500">*</span>
</label>
<Input
className="input"
@ -274,6 +276,7 @@ const EditDialog = () => {
<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">
Minimum Amount
<span className="text-red-500">*</span>
</label>
<NumericFormat
className="input"
@ -296,6 +299,7 @@ const EditDialog = () => {
<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">
Maximum Amount
<span className="text-red-500">*</span>
</label>
<NumericFormat
className="input"
@ -317,6 +321,7 @@ const EditDialog = () => {
<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">
Maximum Transaction per day
<span className="text-red-500">*</span>
</label>
<NumericFormat
className="input"
@ -336,7 +341,8 @@ const EditDialog = () => {
</div>
<div className="w-full">
<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">
<Select
value={formField.wallet_origin}
@ -361,7 +367,8 @@ const EditDialog = () => {
<div className="w-full">
<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">
<Select
value={formField.wallet_destination}
@ -385,7 +392,8 @@ const EditDialog = () => {
</div>
<div className="w-full">
<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">
<Select
value={formField.wallet_fee_destination}
@ -409,7 +417,8 @@ const EditDialog = () => {
</div>
<div className="w-full">
<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">
<Select
value={formField.customer_fee_destination}
@ -433,7 +442,8 @@ const EditDialog = () => {
</div>
<div className="w-full">
<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">
<Select
@ -456,7 +466,8 @@ const EditDialog = () => {
<div className="w-full">
<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">
<Select