[update] - finalise
This commit is contained in:
@@ -7,8 +7,11 @@ VITE_CHECKER="Checker"
|
||||
# Role Encryption key
|
||||
VITE_ROLE_ENCRYPTION_KEY="export"
|
||||
|
||||
# Super Admin
|
||||
VITE_SUPER_ADMIN_ID=1
|
||||
|
||||
# BaseURL
|
||||
VITE_BAS_URL="http://localhost:5000/api/v1"
|
||||
VITE_BAS_URL="your_base_url"
|
||||
|
||||
# BaseURL for Images
|
||||
VITE_IMAGE_URL="https://sprint9.tanami.betadelivery.com/"
|
||||
VITE_IMAGE_URL="your_base_url"
|
||||
@@ -5,7 +5,7 @@ import { ChevronLeftIcon, ChevronRightIcon } from "@chakra-ui/icons";
|
||||
const Pagination = ({
|
||||
pageSize,
|
||||
setPageSize,
|
||||
totalItems,
|
||||
totalItems = 1,
|
||||
isLoading,
|
||||
setCurrentPage,
|
||||
currentPage,
|
||||
@@ -84,7 +84,7 @@ const Pagination = ({
|
||||
onClick={paginationNext}
|
||||
className="link pointer"
|
||||
isDisabled={currentPage === totalPages}
|
||||
aria-label="Next Page"
|
||||
aria-label="Next Page"
|
||||
/>
|
||||
</HStack>
|
||||
</HStack>
|
||||
|
||||
@@ -4,7 +4,7 @@ import * as XLSX from 'xlsx';
|
||||
import CryptoJS from "crypto-js";
|
||||
|
||||
|
||||
export const generateSerialNumber = (index, currentPage, pageSize) => {
|
||||
export const generateSerialNumber = (index, currentPage = 1, pageSize = 1) => {
|
||||
return (currentPage - 1) * pageSize + (index + 1);
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ export function getTomorrowDate() {
|
||||
const today = new Date();
|
||||
const tomorrow = new Date(today);
|
||||
tomorrow.setDate(today.getDate() + 1);
|
||||
|
||||
|
||||
// Format the date as YYYY-MM-DD (ISO 8601)
|
||||
return tomorrow.toISOString().split('T')[0];
|
||||
}
|
||||
@@ -34,7 +34,7 @@ export function removeTrailingZeros(value) {
|
||||
}
|
||||
|
||||
|
||||
export function getCountdownTimer(utcDateString) {
|
||||
export function getCountdownTimer(utcDateString) {
|
||||
// Parse the UTC datetime string into a Date object
|
||||
const targetDate = new Date(utcDateString);
|
||||
const now = new Date();
|
||||
@@ -57,7 +57,7 @@ export function removeTrailingZeros(value) {
|
||||
const remainingMinutes = minutes % 60;
|
||||
const remainingSeconds = seconds % 60;
|
||||
|
||||
return `${remainingDays === 0 ? "": remainingDays+"d"} ${remainingHours === 0 ? "": remainingHours+"h"} ${remainingMinutes}m ${remainingSeconds}s `;
|
||||
return `${remainingDays === 0 ? "" : remainingDays + "d"} ${remainingHours === 0 ? "" : remainingHours + "h"} ${remainingMinutes}m ${remainingSeconds}s `;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,28 +97,28 @@ export function debounce(func, delay) {
|
||||
|
||||
async function resolveMx(domain, recordType) {
|
||||
return new Promise((resolve, reject) => {
|
||||
dns.resolveMx(domain, (err, mxRecords) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
const addresses = mxRecords.map((mxRecord) => mxRecord.exchange);
|
||||
resolve(addresses);
|
||||
});
|
||||
dns.resolveMx(domain, (err, mxRecords) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
const addresses = mxRecords.map((mxRecord) => mxRecord.exchange);
|
||||
resolve(addresses);
|
||||
});
|
||||
});
|
||||
}
|
||||
// Async function to check email address validity
|
||||
export async function checkEmailValidity(email) {
|
||||
try {
|
||||
const domain = email?.split("@")[1];
|
||||
const addresses = await resolveMx(domain, "MX");
|
||||
const domain = email?.split("@")[1];
|
||||
const addresses = await resolveMx(domain, "MX");
|
||||
|
||||
if (addresses && addresses?.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false; // No MX record exists
|
||||
if (addresses && addresses?.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false; // No MX record exists
|
||||
} catch (err) {
|
||||
return false; // Error occurred
|
||||
return false; // Error occurred
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,15 +126,15 @@ export async function checkEmailValidity(email) {
|
||||
// Function to convert timestamp to readable date format in Gulf timezone
|
||||
export function formatTimestampInGulfTimezone(timestamp) {
|
||||
const date = new Date(timestamp);
|
||||
const options = {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
timeZone: 'Asia/Dubai', // Gulf Standard Time (GST) timezone
|
||||
timeZoneName: 'short'
|
||||
const options = {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit',
|
||||
timeZone: 'Asia/Dubai', // Gulf Standard Time (GST) timezone
|
||||
timeZoneName: 'short'
|
||||
};
|
||||
return date.toLocaleDateString('en-GB', options);
|
||||
}
|
||||
@@ -164,7 +164,7 @@ const getNestedValue = (obj, key) => {
|
||||
export const exportToExcel = (data, headers) => {
|
||||
const flattenedData = data.map((item) => {
|
||||
const newItem = {};
|
||||
|
||||
|
||||
// Loop through customHeaders and get the correct values
|
||||
headers.forEach((header) => {
|
||||
newItem[header.label] = getNestedValue(item, header.key); // Use the helper function
|
||||
@@ -175,7 +175,7 @@ export const exportToExcel = (data, headers) => {
|
||||
|
||||
// Now pass flattenedData to your Excel library to generate the file
|
||||
// Assuming you're using a library like `xlsx` for this part:
|
||||
|
||||
|
||||
const worksheet = XLSX.utils.json_to_sheet(flattenedData);
|
||||
const workbook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
|
||||
@@ -233,4 +233,8 @@ export const decryptString = (ciphertext) => {
|
||||
const bytes = CryptoJS.AES.decrypt(ciphertext, import.meta.env.VITE_ROLE_ENCRYPTION_KEY);
|
||||
const originalText = bytes.toString(CryptoJS.enc.Utf8);
|
||||
return originalText;
|
||||
};
|
||||
};
|
||||
|
||||
export const SUPER_ADMIN_ID = import.meta.env.VITE_SUPER_ADMIN_ID || 1
|
||||
export const MAKER_ID = import.meta.env.VITE_MAKER_ID || 1
|
||||
export const CHECKER_ID = import.meta.env.VITE_CHECKER_ID || 2
|
||||
@@ -1,2 +1,2 @@
|
||||
export const TABLE_PAGINATION = { page: 1, size:20 }
|
||||
export const TABLE_PAGINATION = { page: 1, size: 20 }
|
||||
export const IMAGE_URI = import.meta.env.VITE_API_IMAGE_URL
|
||||
@@ -1,27 +1,25 @@
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
HStack,
|
||||
Input,
|
||||
Select,
|
||||
Switch,
|
||||
Text,
|
||||
useDisclosure,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useContext, useEffect, useState, useRef } from "react";
|
||||
import { Link, Link as RouterLink, useNavigate } from "react-router-dom";
|
||||
import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
|
||||
import { debounce } from "../../../Master/Sponser/AddSponser";
|
||||
import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
|
||||
import NormalTable from "../../../../Components/DataTable/NormalTable";
|
||||
import React, { useContext, useEffect, useRef, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
|
||||
import Pagination from "../../../../Components/Pagination";
|
||||
import NormalTable from "../../../../Components/DataTable/NormalTable";
|
||||
import ToastBox from "../../../../Components/ToastBox";
|
||||
import ReasonBanModal from "./ReasonBanModal";
|
||||
import { useGetbanInvestorQuery } from "../../../../Services/ban.investor.service";
|
||||
import { TABLE_PAGINATION } from "../../../../Constants/Paginations";
|
||||
import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
|
||||
import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
|
||||
import { useGetbanInvestorQuery } from "../../../../Services/ban.investor.service";
|
||||
import { debounce } from "../../../Master/Sponser/AddSponser";
|
||||
import ReasonBanModal from "./ReasonBanModal";
|
||||
import Pagination from "../../../../Components/Pagination";
|
||||
|
||||
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
|
||||
|
||||
@@ -233,8 +231,6 @@ const BankInvestor = () => {
|
||||
),
|
||||
}));
|
||||
|
||||
console.log(extractedArray);
|
||||
|
||||
const handleDelete = () => {
|
||||
const updatedInvestorDetails = InvestorDetails.filter(
|
||||
(sponsor) => sponsor.id !== actionId
|
||||
@@ -278,6 +274,14 @@ const BankInvestor = () => {
|
||||
/>
|
||||
|
||||
<HStack display={"flex"} alignItems={"center"}>
|
||||
<Pagination
|
||||
isLoading={unbanLoading}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalItems={data?.data?.totalItems}
|
||||
/>
|
||||
{/* <Select
|
||||
focusBorderColor="green.500"
|
||||
size={"sm"}
|
||||
|
||||
@@ -1,31 +1,26 @@
|
||||
import {
|
||||
Avatar,
|
||||
Badge,
|
||||
Box,
|
||||
HStack,
|
||||
Input,
|
||||
Select,
|
||||
Switch,
|
||||
Text,
|
||||
useDisclosure,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useContext, useEffect, useState, useRef } from "react";
|
||||
import { Link, Link as RouterLink, useNavigate } from "react-router-dom";
|
||||
import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
|
||||
import { debounce } from "../../../Master/Sponser/AddSponser";
|
||||
import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
|
||||
import DataTable from "../../../../Components/DataTable/NormalTable";
|
||||
import React, { useContext, useEffect, useRef, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import CustomAlertDialog from "../../../../Components/CustomAlertDialog";
|
||||
import Pagination from "../../../../Components/Pagination";
|
||||
import DataTable from "../../../../Components/DataTable/NormalTable";
|
||||
import ToastBox from "../../../../Components/ToastBox";
|
||||
import ReasonBanModal from "./ReasonBanModal";
|
||||
import {
|
||||
useGetInvestorQuery,
|
||||
useGetUnbanInvestorQuery,
|
||||
} from "../../../../Services/ban.investor.service";
|
||||
import { generateSerialNumber } from "../../../../Constants/Constants";
|
||||
import { TABLE_PAGINATION } from "../../../../Constants/Paginations";
|
||||
import GlobalStateContext from "../../../../Contexts/GlobalStateContext";
|
||||
import { OPACITY_ON_LOAD } from "../../../../Layout/animations";
|
||||
import { useGetUnbanInvestorQuery } from "../../../../Services/ban.investor.service";
|
||||
import { debounce } from "../../../Master/Sponser/AddSponser";
|
||||
import ReasonBanModal from "./ReasonBanModal";
|
||||
import Pagination from "../../../../Components/Pagination";
|
||||
|
||||
const formatDate = (date) => new Date(date).toLocaleDateString(); // Simple date formatter
|
||||
|
||||
@@ -270,6 +265,14 @@ const UnbanInvestor = () => {
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
/>
|
||||
<HStack display={"flex"} alignItems={"center"}>
|
||||
<Pagination
|
||||
isLoading={unbanLoading}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalItems={data?.data?.totalItems}
|
||||
/>
|
||||
{/* <Select
|
||||
focusBorderColor="green.500"
|
||||
size={"sm"}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AddIcon, DeleteIcon, EditIcon } from "@chakra-ui/icons";
|
||||
import {
|
||||
Badge,
|
||||
Box,
|
||||
@@ -9,24 +10,24 @@ import {
|
||||
Tooltip,
|
||||
useToast,
|
||||
} from "@chakra-ui/react";
|
||||
import React, { useContext, useEffect, useState } from "react";
|
||||
import { Link, Link as RouterLink } from "react-router-dom";
|
||||
import { AddIcon, DeleteIcon, EditIcon } from "@chakra-ui/icons";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import NormalTable from "../../Components/DataTable/NormalTable";
|
||||
import Pagination from "../../Components/Pagination";
|
||||
import GlobalStateContext from "../../Contexts/GlobalStateContext";
|
||||
import React, { useContext, useState } from "react";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import CustomAlertDialog from "../../Components/CustomAlertDialog";
|
||||
import NormalTable from "../../Components/DataTable/NormalTable";
|
||||
import ToastBox from "../../Components/ToastBox";
|
||||
import { TABLE_PAGINATION } from "../../Constants/Paginations";
|
||||
import { generateSerialNumber } from "../../Constants/Constants";
|
||||
import { useGetSponserMasterQuery } from "../../Services/io.service";
|
||||
import {
|
||||
CHECKER_ID,
|
||||
generateSerialNumber,
|
||||
MAKER_ID,
|
||||
SUPER_ADMIN_ID,
|
||||
} from "../../Constants/Constants";
|
||||
import GlobalStateContext from "../../Contexts/GlobalStateContext";
|
||||
import { OPACITY_ON_LOAD } from "../../Layout/animations";
|
||||
import {
|
||||
useDeleteUserMutation,
|
||||
useGetSubAdminMasterQuery,
|
||||
useToggleStatusMutation,
|
||||
} from "../../Services/subadmin.service";
|
||||
import RoleSwitchButton from "../../Components/RoleSwitchButton";
|
||||
|
||||
export const formatDate = (date) => {
|
||||
const d = new Date(date);
|
||||
@@ -46,31 +47,28 @@ const SubAdmin = () => {
|
||||
const [mouseEntered, setMouseEntered] = useState(false);
|
||||
const [mouseEnteredId, setMouseEnteredId] = useState("");
|
||||
// const [deleteSponser] = useDeleteSponserMutation();
|
||||
const { sponser, setSponser, slideFromRight } =
|
||||
useContext(GlobalStateContext);
|
||||
const { slideFromRight } = useContext(GlobalStateContext);
|
||||
|
||||
// =========================== [Use State] =============================
|
||||
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
|
||||
const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
|
||||
// const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
|
||||
// const [currentPage, setCurrentPage] = useState(TABLE_PAGINATION?.page);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
|
||||
const [isSwitchOn, setIsSwitchOn] = useState(true);
|
||||
// const [debouncedSearchTerm, setDebouncedSearchTerm] = useState("");
|
||||
|
||||
// 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]);
|
||||
// useEffect(() => {
|
||||
// const handler = setTimeout(() => {
|
||||
// setDebouncedSearchTerm(searchTerm);
|
||||
// }, 500); // Adjust delay as needed
|
||||
// return () => {
|
||||
// clearTimeout(handler);
|
||||
// };
|
||||
// }, [searchTerm]);
|
||||
|
||||
const {
|
||||
data: subAdmin,
|
||||
error,
|
||||
isLoading: isSponserLoading,
|
||||
} = useGetSubAdminMasterQuery();
|
||||
const { data: subAdmin, isLoading: isSponserLoading } =
|
||||
useGetSubAdminMasterQuery();
|
||||
|
||||
const [deleteUser] = useDeleteUserMutation();
|
||||
|
||||
const [toggleStatus] = useToggleStatusMutation();
|
||||
|
||||
@@ -91,13 +89,13 @@ const SubAdmin = () => {
|
||||
});
|
||||
|
||||
const handleToggleStatus = async (isMaker, id) => {
|
||||
console.log("hit");
|
||||
// console.log("hit");
|
||||
const data = {
|
||||
role_xid: isMaker ? "2" : "1",
|
||||
role_xid: isMaker ? CHECKER_ID : MAKER_ID,
|
||||
};
|
||||
console.log("=======================",data)
|
||||
console.log("=======================", data);
|
||||
try {
|
||||
const res = await toggleStatus({id, data});
|
||||
const res = await toggleStatus({ id, data });
|
||||
if (res?.error) {
|
||||
toast({
|
||||
render: () => (
|
||||
@@ -137,7 +135,7 @@ const SubAdmin = () => {
|
||||
"Action",
|
||||
];
|
||||
|
||||
const extractedArray = subAdmin?.data?.map((item, index) => ({
|
||||
const extractedArray = filteredData?.map((item, index) => ({
|
||||
"Sr No": (
|
||||
<Text
|
||||
w={"24px"}
|
||||
@@ -147,7 +145,7 @@ const SubAdmin = () => {
|
||||
className="d-flex align-items-center fw-bold web-text-small"
|
||||
>
|
||||
{/* {item.id} */}
|
||||
{generateSerialNumber(index, currentPage, pageSize)}
|
||||
{generateSerialNumber(index)}
|
||||
</Text>
|
||||
),
|
||||
"First Name": (
|
||||
@@ -180,13 +178,13 @@ const SubAdmin = () => {
|
||||
</Box>
|
||||
),
|
||||
Role: (
|
||||
<Box isTruncated={true} >
|
||||
<Box isTruncated={true}>
|
||||
<Badge
|
||||
py={"2px"}
|
||||
me={2}
|
||||
fontWeight={600}
|
||||
bg={item?.role[0]?.role === "Maker" ? "#00ffcc" : "#b3ff99"}
|
||||
px={item?.role[0]?.role === "Maker" ? "12px" : "5px"}
|
||||
px={item?.role[0]?.role === "Maker" ? "12px" : "5px"}
|
||||
>
|
||||
{item?.role[0]?.role}
|
||||
</Badge>
|
||||
@@ -231,7 +229,7 @@ const SubAdmin = () => {
|
||||
</Button>
|
||||
</Tooltip>
|
||||
|
||||
{/* <Tooltip
|
||||
<Tooltip
|
||||
rounded={"sm"}
|
||||
fontSize={"xs"}
|
||||
label="Delete"
|
||||
@@ -240,12 +238,14 @@ const SubAdmin = () => {
|
||||
placement="top"
|
||||
>
|
||||
<Button
|
||||
isDisabled={item?.id === SUPER_ADMIN_ID}
|
||||
onClick={() => {
|
||||
setActionId(item?.id);
|
||||
setDeleteAlert(true);
|
||||
}}
|
||||
// _hover={{ color: "red.500" }}
|
||||
// color="red"
|
||||
// disabled={true}
|
||||
rounded={"sm"}
|
||||
size={"xs"}
|
||||
colorScheme="red"
|
||||
@@ -253,46 +253,42 @@ const SubAdmin = () => {
|
||||
>
|
||||
<DeleteIcon />
|
||||
</Button>
|
||||
</Tooltip> */}
|
||||
</Tooltip>
|
||||
</Box>
|
||||
),
|
||||
}));
|
||||
|
||||
// =========================== [ Delete Function ] =================================
|
||||
|
||||
// const handleDelete = async () => {
|
||||
// console.log(actionId);
|
||||
// setIsLoading(true);
|
||||
// try {
|
||||
// const response = await deleteSponser(actionId);
|
||||
// console.log(response?.data);
|
||||
// if (response?.error?.data?.code === 400) {
|
||||
// toast({
|
||||
// render: () => (
|
||||
// <ToastBox
|
||||
// message={response?.error?.data?.message}
|
||||
// status={"error"}
|
||||
// />
|
||||
// ),
|
||||
// });
|
||||
// setIsLoading(false);
|
||||
// setDeleteAlert(false);
|
||||
// } else if (
|
||||
// response?.data?.statusCode === 201 ||
|
||||
// response?.data?.statusCode === 200
|
||||
// ) {
|
||||
// toast({
|
||||
// render: () => (
|
||||
// <ToastBox message={response?.data?.message} status={"success"} />
|
||||
// ),
|
||||
// });
|
||||
// setIsLoading(false);
|
||||
// setDeleteAlert(false);
|
||||
// }
|
||||
// } catch (error) {}
|
||||
// };
|
||||
|
||||
console.log(isSponserLoading);
|
||||
const handleDelete = async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const response = await deleteUser(actionId);
|
||||
if (response?.error?.data?.code === 400) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox
|
||||
message={response?.error?.data?.message}
|
||||
status={"error"}
|
||||
/>
|
||||
),
|
||||
});
|
||||
setIsLoading(false);
|
||||
setDeleteAlert(false);
|
||||
} else if (
|
||||
response?.data?.statusCode === 201 ||
|
||||
response?.data?.statusCode === 200
|
||||
) {
|
||||
toast({
|
||||
render: () => (
|
||||
<ToastBox message={response?.data?.message} status={"success"} />
|
||||
),
|
||||
});
|
||||
setIsLoading(false);
|
||||
setDeleteAlert(false);
|
||||
}
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
return (
|
||||
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={38}>
|
||||
@@ -322,14 +318,14 @@ const SubAdmin = () => {
|
||||
<HStack display={"flex"} alignItems={"center"}>
|
||||
{/* ====================[Pagination]===================== */}
|
||||
|
||||
<Pagination
|
||||
{/* <Pagination
|
||||
isLoading={isSponserLoading}
|
||||
pageSize={pageSize}
|
||||
setPageSize={setPageSize}
|
||||
currentPage={currentPage}
|
||||
setCurrentPage={setCurrentPage}
|
||||
totalItems={subAdmin?.data?.totalItems}
|
||||
/>
|
||||
/> */}
|
||||
|
||||
{/* =====================[Add Button]===================== */}
|
||||
|
||||
@@ -366,8 +362,8 @@ const SubAdmin = () => {
|
||||
<CustomAlertDialog
|
||||
onClose={() => setDeleteAlert(false)}
|
||||
isOpen={deleteAlert}
|
||||
message={"Are you sure you want to delete sponers?"}
|
||||
// alertHandler={handleDelete}
|
||||
message={"Are you sure you want to delete sub-admin?"}
|
||||
alertHandler={handleDelete}
|
||||
isLoading={isLoading}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -29,7 +29,7 @@ export const sabAdminMaster = createApi({
|
||||
method: "POST",
|
||||
body: data,
|
||||
}),
|
||||
invalidatesTags: ["getSubAdmin","prePopulate"],
|
||||
invalidatesTags: ["getSubAdmin", "prePopulate"],
|
||||
}),
|
||||
|
||||
// // ========[Update Sponser]========
|
||||
@@ -50,7 +50,7 @@ export const sabAdminMaster = createApi({
|
||||
// // ========[Toggle Status]========
|
||||
|
||||
toggleStatus: builder.mutation({
|
||||
query: ({id, data}) => ({
|
||||
query: ({ id, data }) => ({
|
||||
url: `/subadmin/admin/toggle-role/${id}`,
|
||||
method: "PATCH",
|
||||
body: data,
|
||||
@@ -58,6 +58,17 @@ export const sabAdminMaster = createApi({
|
||||
invalidatesTags: ["getSubAdmin"],
|
||||
}),
|
||||
|
||||
|
||||
// ==========[Delete User] ==========
|
||||
deleteUser: builder.mutation({
|
||||
query: (id) => ({
|
||||
url: `/subadmin/admin/${id}`,
|
||||
method: "DELETE",
|
||||
}),
|
||||
invalidatesTags: ["getSubAdmin"],
|
||||
}),
|
||||
|
||||
|
||||
// // ========[Get Active]========
|
||||
|
||||
// getActiveSponserMaster: builder.query({
|
||||
@@ -90,9 +101,10 @@ export const sabAdminMaster = createApi({
|
||||
|
||||
// Export hooks for usage in functional components
|
||||
export const {
|
||||
useGetSubAdminMasterQuery,
|
||||
useCreateSubAdminMutation,
|
||||
useUpdateSubAdminMutation,
|
||||
useGetSubAdminByIdQuery,
|
||||
useToggleStatusMutation
|
||||
useGetSubAdminMasterQuery,
|
||||
useCreateSubAdminMutation,
|
||||
useUpdateSubAdminMutation,
|
||||
useGetSubAdminByIdQuery,
|
||||
useToggleStatusMutation,
|
||||
useDeleteUserMutation,
|
||||
} = sabAdminMaster;
|
||||
|
||||
Reference in New Issue
Block a user