diff --git a/src/pages/transfer/transferfee/blocks/EditDialog.tsx b/src/pages/transfer/transferfee/blocks/EditDialog.tsx index 3d6b0ce..f80794e 100644 --- a/src/pages/transfer/transferfee/blocks/EditDialog.tsx +++ b/src/pages/transfer/transferfee/blocks/EditDialog.tsx @@ -25,7 +25,14 @@ import { useCallApi } from '@/hooks'; import { doSaveLogActivity } from '@/actions/GlobalActions'; import { getAuth } from '@/auth'; 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_MASTER_DATA = apiConfig.service_master_data; @@ -178,9 +185,9 @@ const EditFeeDialog = () => { ); if (response?.status) { - toast.success('Successfully updated transfer fee'); reload(); handleEditFeeDialog(false, null); + toast.success('Successfully updated transfer fee'); const createActivity = { module: 'Manage Transfer Fee', description: `Edit Transfer Fee => ${formField.name}`, @@ -197,7 +204,7 @@ const EditFeeDialog = () => { setIsSubmitting(false); } }, - [formField, selectedTransferFee, PutData, reload, handleEditFeeDialog] + [formField, selectedTransferFee, handleEditFeeDialog] ); const fetchWallets = useCallback(async () => { @@ -315,7 +322,7 @@ const EditFeeDialog = () => { updated_by: parsedUser?.username, updated_at: new Date().toISOString().slice(0, 19).replace('T', ' ') }); - + if (response.data.transaction_type?.name) { setTransactionTypeName(response.data.transaction_type.name); } @@ -421,7 +428,7 @@ const EditFeeDialog = () => { )} - + {isLoadingTransferFee ? (
@@ -458,14 +465,14 @@ const EditFeeDialog = () => {
)} - - +
- +
- +
{ placeholder="Enter Minimum Amount" />
- +
{ placeholder="Enter Maximum Amount" />
- +
- +
- +
{ placeholder="Enter Deduct Amount" />
- +
{ placeholder="Enter Deduct Percentage" />
- +
{ placeholder="Enter Fee Amount" />
- +
- +
- +
- + {formField.credit_to === 'I' && ( -
- -
-
setOpen(!open)} - > - - {customers.find(customer => customer.id === formField.credit_destination)?.username || 'Search customer...'} - - -
- - {open && ( -
-
- setCustomerSearchTerm(e.target.value)} - autoComplete="off" - onClick={(e) => e.stopPropagation()} - autoFocus - /> -
-
- {customers - .filter(customer => - customer.username.toLowerCase().includes(customerSearchTerm.toLowerCase()) || - customer.msisdn.includes(customerSearchTerm) - ) - .map(customer => ( -
{ - setFormField({ - ...formField, - credit_destination: customer.id - }); - setOpen(false); - }} - > - {customer.username} -
- ))} - {customers.filter(customer => - customer.username.toLowerCase().includes(customerSearchTerm.toLowerCase()) || - customer.msisdn.includes(customerSearchTerm) - ).length === 0 && ( -
No customer found
- )} -
-
- )} -
-
-)} +
+ +
+
setOpen(!open)} + > + + {customers.find( + (customer) => customer.id === formField.credit_destination + )?.username || 'Search customer...'} + + +
+ {open && ( +
+
+ setCustomerSearchTerm(e.target.value)} + autoComplete="off" + onClick={(e) => e.stopPropagation()} + autoFocus + /> +
+
+ {customers + .filter( + (customer) => + customer.username + .toLowerCase() + .includes(customerSearchTerm.toLowerCase()) || + customer.msisdn.includes(customerSearchTerm) + ) + .map((customer) => ( +
{ + setFormField({ + ...formField, + credit_destination: customer.id + }); + setOpen(false); + }} + > + {customer.username} +
+ ))} + {customers.filter( + (customer) => + customer.username + .toLowerCase() + .includes(customerSearchTerm.toLowerCase()) || + customer.msisdn.includes(customerSearchTerm) + ).length === 0 && ( +
+ No customer found +
+ )} +
+
+ )} +
+
+ )} - -
- +
- +
- +
- +
-