fix double notification transfer fee

This commit is contained in:
Wikzyy
2025-04-25 14:43:07 +07:00
parent daae143823
commit 3802650b0c
2 changed files with 110 additions and 98 deletions

View File

@ -25,7 +25,14 @@ import { useCallApi } from '@/hooks';
import { doSaveLogActivity } from '@/actions/GlobalActions'; import { doSaveLogActivity } from '@/actions/GlobalActions';
import { getAuth } from '@/auth'; import { getAuth } from '@/auth';
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'; import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList } from '@/components/ui/command'; import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList
} from '@/components/ui/command';
const API_URL = apiConfig.service_transaction; const API_URL = apiConfig.service_transaction;
const API_URL_MASTER_DATA = apiConfig.service_master_data; const API_URL_MASTER_DATA = apiConfig.service_master_data;
@ -178,9 +185,9 @@ const EditFeeDialog = () => {
); );
if (response?.status) { if (response?.status) {
toast.success('Successfully updated transfer fee');
reload(); reload();
handleEditFeeDialog(false, null); handleEditFeeDialog(false, null);
toast.success('Successfully updated transfer fee');
const createActivity = { const createActivity = {
module: 'Manage Transfer Fee', module: 'Manage Transfer Fee',
description: `Edit Transfer Fee => ${formField.name}`, description: `Edit Transfer Fee => ${formField.name}`,
@ -197,7 +204,7 @@ const EditFeeDialog = () => {
setIsSubmitting(false); setIsSubmitting(false);
} }
}, },
[formField, selectedTransferFee, PutData, reload, handleEditFeeDialog] [formField, selectedTransferFee, handleEditFeeDialog]
); );
const fetchWallets = useCallback(async () => { const fetchWallets = useCallback(async () => {
@ -684,7 +691,9 @@ const EditFeeDialog = () => {
onClick={() => setOpen(!open)} onClick={() => setOpen(!open)}
> >
<span className="truncate"> <span className="truncate">
{customers.find(customer => customer.id === formField.credit_destination)?.username || 'Search customer...'} {customers.find(
(customer) => customer.id === formField.credit_destination
)?.username || 'Search customer...'}
</span> </span>
<path d="m6 9 6 6 6-6"></path> <path d="m6 9 6 6 6-6"></path>
</div> </div>
@ -705,11 +714,14 @@ const EditFeeDialog = () => {
</div> </div>
<div> <div>
{customers {customers
.filter(customer => .filter(
customer.username.toLowerCase().includes(customerSearchTerm.toLowerCase()) || (customer) =>
customer.username
.toLowerCase()
.includes(customerSearchTerm.toLowerCase()) ||
customer.msisdn.includes(customerSearchTerm) customer.msisdn.includes(customerSearchTerm)
) )
.map(customer => ( .map((customer) => (
<div <div
key={customer.id} key={customer.id}
className="cursor-pointer px-3 py-1.5 text-sm hover:bg-gray-100" className="cursor-pointer px-3 py-1.5 text-sm hover:bg-gray-100"
@ -724,21 +736,23 @@ const EditFeeDialog = () => {
{customer.username} {customer.username}
</div> </div>
))} ))}
{customers.filter(customer => {customers.filter(
customer.username.toLowerCase().includes(customerSearchTerm.toLowerCase()) || (customer) =>
customer.username
.toLowerCase()
.includes(customerSearchTerm.toLowerCase()) ||
customer.msisdn.includes(customerSearchTerm) customer.msisdn.includes(customerSearchTerm)
).length === 0 && ( ).length === 0 && (
<div className="px-3 py-2 text-sm text-gray-500">No customer found</div> <div className="px-3 py-2 text-sm text-gray-500">
)} No customer found
</div>
</div> </div>
)} )}
</div> </div>
</div> </div>
)} )}
</div>
</div>
)}
<div className="w-full"> <div className="w-full">
<label className="form-label"> <label className="form-label">
@ -777,7 +791,9 @@ const EditFeeDialog = () => {
</label> </label>
<Select <Select
value={formField.status_include} value={formField.status_include}
onValueChange={(value) => setFormField({ ...formField, status_include: value })} onValueChange={(value) =>
setFormField({ ...formField, status_include: value })
}
> >
<SelectTrigger> <SelectTrigger>
<SelectValue placeholder="Select Status" /> <SelectValue placeholder="Select Status" />
@ -808,11 +824,7 @@ const EditFeeDialog = () => {
</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'} type="button" onClick={resetForm}>
variant={'outline'}
type="button"
onClick={resetForm}
>
Reset Reset
</Button> </Button>
<Button <Button
@ -839,4 +851,4 @@ const EditFeeDialog = () => {
); );
}; };
export {EditFeeDialog}; export { EditFeeDialog };

View File

@ -378,7 +378,7 @@ const ManageTransferFeeContextProvider = ({
transactionTypeId transactionTypeId
}} }}
> >
<Toaster expand visibleToasts={9} duration={3000} /> {/* <Toaster expand visibleToasts={9} duration={3000} /> */}
<DataGridProvider <DataGridProvider
columns={columns} columns={columns}
pagination={{ size: 10 }} pagination={{ size: 10 }}