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>