Compare commits
17 Commits
efddfe6d7a
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b141743190 | ||
|
|
f9d0b3ce6c | ||
|
|
965263a3f2 | ||
|
|
04a5d1280f | ||
|
|
d40eadb35e | ||
|
|
f4a2fd2889 | ||
|
|
96f813f632 | ||
|
|
8587b91a33 | ||
|
|
49b06e81a6 | ||
|
|
79ec8d92ae | ||
|
|
f2d8aee6a9 | ||
|
|
a108dcdb17 | ||
|
|
41a1bde62b | ||
| 35d3e07224 | |||
|
|
651c775c2a | ||
| 6c2a38becb | |||
| bddf7381a6 |
@@ -309,14 +309,14 @@ const DashboardLayout = ({ isOnline }) => {
|
||||
return (
|
||||
<span className="d-flex align-items-end gap-2">
|
||||
<HiOutlineBanknotes className="h4 m-0 fw-normal" />
|
||||
Fawateer Deposit
|
||||
Reversal Transaction / Fawateer Deposit
|
||||
</span>
|
||||
);
|
||||
case path.startsWith("/account-deletion-request"):
|
||||
return (
|
||||
<span className="d-flex align-items-end gap-2">
|
||||
<RiAccountBoxLine className="h4 m-0 fw-normal" />
|
||||
Account Deletion Request
|
||||
Reversal Transaction / Account Deletion Request
|
||||
</span>
|
||||
);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
Box,
|
||||
Button,
|
||||
FormControl,
|
||||
FormHelperText,
|
||||
FormLabel,
|
||||
Input,
|
||||
Modal,
|
||||
@@ -32,16 +33,17 @@ import { useGetDrawalRequestQuery } from "../../Services/drawal.request.service"
|
||||
import {
|
||||
useApproveDepositRequestMutation,
|
||||
useGetDeleteRequestByIdQuery,
|
||||
useGetDeleteRequestQuery,
|
||||
} from "../../Services/delete.request.service";
|
||||
|
||||
const FILE_TYPES = ["image/jpeg", "image/png", "image/gif"];
|
||||
|
||||
// export const conformModalSchema = yup.object().shape({
|
||||
// adminComment: yup.string().notRequired(),
|
||||
// });
|
||||
|
||||
export const conformModalSchema = yup.object().shape({
|
||||
adminComment: yup
|
||||
.string()
|
||||
.min(2, "Comment contain at least 2 character")
|
||||
.max(150, "Comment contain at less then 150 character")
|
||||
.notRequired(),
|
||||
adminComment: yup.string().notRequired(),
|
||||
});
|
||||
|
||||
const DeletionRequestApprove = ({
|
||||
@@ -66,6 +68,7 @@ const DeletionRequestApprove = ({
|
||||
const {
|
||||
register,
|
||||
reset,
|
||||
watch,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
} = useForm({
|
||||
@@ -73,6 +76,8 @@ const DeletionRequestApprove = ({
|
||||
mode: "all",
|
||||
});
|
||||
|
||||
const { refetch } = useGetDeleteRequestQuery();
|
||||
|
||||
useEffect(() => {
|
||||
reset({
|
||||
comment: fileredData?.comment,
|
||||
@@ -101,9 +106,12 @@ const DeletionRequestApprove = ({
|
||||
toast({
|
||||
render: () => <ToastBox message={res?.data?.message} />,
|
||||
});
|
||||
refetch();
|
||||
heandleOnClose();
|
||||
}
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
};
|
||||
|
||||
const onReject = () => {};
|
||||
@@ -184,6 +192,13 @@ const DeletionRequestApprove = ({
|
||||
{errors.adminComment.message}
|
||||
</Text>
|
||||
)}
|
||||
<FormHelperText fontSize="xs" color="gray.500">
|
||||
<Text as={"span"} me={2}>
|
||||
{" "}
|
||||
Maximum length should be 200 characters. You have entered
|
||||
</Text>
|
||||
{watch("adminComment")?.length || 0} characters.
|
||||
</FormHelperText>
|
||||
</FormControl>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
@@ -196,6 +211,7 @@ const DeletionRequestApprove = ({
|
||||
variant={"ghost"}
|
||||
onClick={() => setIsReject(true)}
|
||||
isLoading={isBtnLoadingReject}
|
||||
fontWeight={500}
|
||||
>
|
||||
Reject
|
||||
</Button>
|
||||
|
||||
@@ -117,6 +117,7 @@ const BankDepositRequest = () => {
|
||||
"Last Name",
|
||||
"Country",
|
||||
"Phone Number",
|
||||
"Deposit Amount",
|
||||
"Action",
|
||||
];
|
||||
|
||||
@@ -212,16 +213,30 @@ const BankDepositRequest = () => {
|
||||
</Box>
|
||||
),
|
||||
Country: (
|
||||
<Box w={"80px"} isTruncated={true}>
|
||||
<Box isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.countryName}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Phone Number": (
|
||||
<Box w={"80px"} isTruncated={true}>
|
||||
<Box isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.mobileNumber}
|
||||
{item?.ISDCode} {item?.mobileNumber}
|
||||
{/* {item?.ISDcode + " " + item?.mobileNumber} */}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Deposit Amount": (
|
||||
<Box isTruncated={true} display={"flex"} justifyContent={"end"}>
|
||||
<Text as={"span"} color={"teal.900"} textAlign={"right"}>
|
||||
{parseFloat(item?.investorAmount || 0).toLocaleString(undefined, {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})}
|
||||
<Badge ms={1} colorScheme="green">
|
||||
{item?.currencyCode}
|
||||
</Badge>
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
|
||||
@@ -37,6 +37,7 @@ const ApproveHistory = () => {
|
||||
const [actionId, setActionId] = useState(false);
|
||||
const [mouseEntered, setMouseEntered] = useState(false);
|
||||
const [mouseEnteredId, setMouseEnteredId] = useState("");
|
||||
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
|
||||
|
||||
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
|
||||
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
|
||||
@@ -60,12 +61,31 @@ const ApproveHistory = () => {
|
||||
onClose: onRejectClose,
|
||||
} = useDisclosure();
|
||||
|
||||
// Debounce the search term to avoid making a request on every keystroke
|
||||
useEffect(() => {
|
||||
const handler = setTimeout(() => {
|
||||
setDebouncedSearchTerm(searchTerm);
|
||||
}, 500); // Adjust delay as needed
|
||||
return () => {
|
||||
clearTimeout(handler);
|
||||
};
|
||||
}, [searchTerm]);
|
||||
|
||||
const {
|
||||
data,
|
||||
isLoading: drawalRequestLoading,
|
||||
error,
|
||||
refetch,
|
||||
} = useGetApproveHistoryQuery();
|
||||
} = useGetApproveHistoryQuery(
|
||||
{
|
||||
page: debouncedSearchTerm ? undefined : currentPage, // Omit pagination for search
|
||||
size: debouncedSearchTerm ? undefined : pageSize, // Omit pagination for search
|
||||
searchTerm: debouncedSearchTerm,
|
||||
},
|
||||
{
|
||||
skip: debouncedSearchTerm === "" && searchTerm !== "", // Skip if search is empty and it's not the initial request
|
||||
}
|
||||
);
|
||||
|
||||
console.log(data?.data?.rows);
|
||||
|
||||
@@ -84,6 +104,15 @@ const ApproveHistory = () => {
|
||||
return () => clearTimeout(timer);
|
||||
}, []);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const handler = setTimeout(() => {
|
||||
setDebouncedSearchTerm(searchTerm);
|
||||
}, 500); // Adjust delay as needed
|
||||
return () => {
|
||||
clearTimeout(handler);
|
||||
};
|
||||
}, [searchTerm]);
|
||||
// ====================================================[Table Filter]================================================================
|
||||
const filteredData = data?.data?.rows?.filter((item) => {
|
||||
// Filter by name (case insensitive)
|
||||
@@ -117,7 +146,7 @@ const ApproveHistory = () => {
|
||||
"Status",
|
||||
];
|
||||
|
||||
const extractedArray = filteredData?.map((item, idx) => ({
|
||||
const extractedArray = data?.data?.rows?.map((item, idx) => ({
|
||||
// id: item?.id,
|
||||
"Sr.no": (
|
||||
<Text
|
||||
@@ -172,11 +201,7 @@ const ApproveHistory = () => {
|
||||
</Box>
|
||||
),
|
||||
"Deposit Date": (
|
||||
<Box
|
||||
w={"100px"}
|
||||
isTruncated={true}
|
||||
display={"flex"}
|
||||
>
|
||||
<Box w={"100px"} isTruncated={true} display={"flex"}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{formatDate(item?.transaction_date)}
|
||||
</Text>
|
||||
@@ -202,28 +227,27 @@ const ApproveHistory = () => {
|
||||
fontWeight={"500"}
|
||||
className="d-flex align-items-center web-text-small"
|
||||
>
|
||||
{item?.spportFile_path&&<Badge
|
||||
px={2}
|
||||
py={0.5}
|
||||
textTransform={"inherit"}
|
||||
fontWeight={500}
|
||||
colorScheme={"forestGreen"}
|
||||
>
|
||||
<Link
|
||||
href={import.meta.env.VITE_IMAGE_URL + item?.spportFile_path}
|
||||
isExternal
|
||||
display={"flex"}
|
||||
alignItems={"center"}
|
||||
{item?.spportFile_path && (
|
||||
<Badge
|
||||
px={2}
|
||||
py={0.5}
|
||||
textTransform={"inherit"}
|
||||
fontWeight={500}
|
||||
colorScheme={"forestGreen"}
|
||||
>
|
||||
<Box me={"1px"}
|
||||
as="span"
|
||||
cursor={"pointer"}
|
||||
<Link
|
||||
href={import.meta.env.VITE_IMAGE_URL + item?.spportFile_path}
|
||||
isExternal
|
||||
display={"flex"}
|
||||
alignItems={"center"}
|
||||
>
|
||||
View
|
||||
</Box>
|
||||
<ExternalLinkIcon />
|
||||
</Link>
|
||||
</Badge>}
|
||||
<Box me={"1px"} as="span" cursor={"pointer"}>
|
||||
View
|
||||
</Box>
|
||||
<ExternalLinkIcon />
|
||||
</Link>
|
||||
</Badge>
|
||||
)}
|
||||
</Text>
|
||||
),
|
||||
Status: (
|
||||
@@ -236,12 +260,12 @@ const ApproveHistory = () => {
|
||||
rounded={4}
|
||||
colorScheme={
|
||||
item?.transactionStatus === "Approved"
|
||||
? "green"
|
||||
: item?.transactionStatus === "Pending"
|
||||
? "yellow"
|
||||
: item?.transactionStatus === "Reject"
|
||||
? "red"
|
||||
: "gray" // default border color if status doesn't match any condition
|
||||
? "green"
|
||||
: item?.transactionStatus === "Pending"
|
||||
? "yellow"
|
||||
: item?.transactionStatus === "Reject"
|
||||
? "red"
|
||||
: "gray" // default border color if status doesn't match any condition
|
||||
}
|
||||
>
|
||||
{item.transactionStatus}
|
||||
|
||||
@@ -140,7 +140,7 @@ const RequestApproveModal = ({ isOpen, onClose, firstField ,id}) => {
|
||||
rounded={"md"}
|
||||
resize={"none"}
|
||||
maxLength={200}
|
||||
/>
|
||||
/>
|
||||
{errors.checkerComment && (
|
||||
<Text fontSize="xs" color="red">
|
||||
{errors.checkerComment.message}
|
||||
|
||||
@@ -130,6 +130,7 @@ const ReversalFawateerDeposit = () => {
|
||||
"First Name",
|
||||
"Last Name",
|
||||
"Phone Number",
|
||||
"Deposit Amount (BHD)",
|
||||
"Action",
|
||||
];
|
||||
|
||||
@@ -188,7 +189,21 @@ const ReversalFawateerDeposit = () => {
|
||||
"Phone Number": (
|
||||
<Box w={"100px"} isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"}>
|
||||
{item?.principal?.mobileNumber}
|
||||
{/* {item?.principal?.ISDcode} {item?.principal?.mobileNumber} */}
|
||||
{item?.principal?.ISDcode + " " + item?.principal?.mobileNumber}
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
"Deposit Amount (BHD)": (
|
||||
<Box isTruncated={true}>
|
||||
<Text as={"span"} color={"teal.900"} textAlign={"right"}>
|
||||
{parseFloat(item?.transaction_details?.investorAmount || 0).toLocaleString(undefined, {
|
||||
minimumFractionDigits: 2,
|
||||
maximumFractionDigits: 2,
|
||||
})}
|
||||
<Badge ms={1} colorScheme="green">
|
||||
{item?.currencyCode}
|
||||
</Badge>
|
||||
</Text>
|
||||
</Box>
|
||||
),
|
||||
|
||||
@@ -9,7 +9,7 @@ import { baseQuery } from "./token.serivce";
|
||||
export const fawateerRequest = createApi({
|
||||
reducerPath: "fawateerRequest",
|
||||
baseQuery: baseQuery,
|
||||
tagTypes: ["getFawateerRequest" ,"getApproveHistory","getApproveComment","getRejectComment","getFawateerMakerRequest"],
|
||||
tagTypes: ["getFawateerRequest", "getApproveHistory", "getApproveComment", "getRejectComment", "getFawateerMakerRequest"],
|
||||
endpoints: (builder) => ({
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ export const fawateerRequest = createApi({
|
||||
}),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
getFawateerForMakerRequest: builder.query({
|
||||
query: ({ page, size, searchTerm }) => {
|
||||
@@ -50,8 +50,19 @@ export const fawateerRequest = createApi({
|
||||
providesTags: ["getFawateerMakerRequest"],
|
||||
}),
|
||||
|
||||
// getApproveHistory: builder.query({
|
||||
// query: () => `/fawateer/admin/getAll`,
|
||||
// providesTags: ["getApproveHistory"],
|
||||
// }),
|
||||
|
||||
getApproveHistory: builder.query({
|
||||
query: () => `/fawateer/admin/getAll`,
|
||||
query: ({ page, size, searchTerm }) => {
|
||||
let baseURL = `/fawateer/admin/getAll?search=${searchTerm || ""}`;
|
||||
if (page !== undefined && size !== undefined) {
|
||||
baseURL += `&page=${page}&size=${size}`; // Only add pagination if both are defined
|
||||
}
|
||||
return baseURL;
|
||||
},
|
||||
providesTags: ["getApproveHistory"],
|
||||
}),
|
||||
|
||||
@@ -72,16 +83,16 @@ export const fawateerRequest = createApi({
|
||||
}),
|
||||
invalidatesTags: ["getFawateerRequest"],
|
||||
}),
|
||||
|
||||
|
||||
}),
|
||||
});
|
||||
|
||||
// Export hooks for usage in functional components
|
||||
export const {
|
||||
useGetFawateerRequestQuery,
|
||||
useGetApproveHistoryQuery,
|
||||
useApproveCommentMutation,
|
||||
useRejectCommentMutation,
|
||||
useGetFawateerForMakerRequestQuery,
|
||||
useGetFawateerInvestorsQuery
|
||||
useGetFawateerRequestQuery,
|
||||
useGetApproveHistoryQuery,
|
||||
useApproveCommentMutation,
|
||||
useRejectCommentMutation,
|
||||
useGetFawateerForMakerRequestQuery,
|
||||
useGetFawateerInvestorsQuery
|
||||
} = fawateerRequest;
|
||||
|
||||
Reference in New Issue
Block a user