Merge branch 'dev-rohit' of http://git.wdipl.com/Siddhesh.More/SSA-Admin-Panel into testing
This commit is contained in:
@@ -82,7 +82,7 @@ define(['./workbox-54d0af47'], (function (workbox) { 'use strict';
|
|||||||
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
"revision": "3ca0b8505b4bec776b69afdba2768812"
|
||||||
}, {
|
}, {
|
||||||
"url": "index.html",
|
"url": "index.html",
|
||||||
"revision": "0.p75md0vraj"
|
"revision": "0.73grfmd27h8"
|
||||||
}], {});
|
}], {});
|
||||||
workbox.cleanupOutdatedCaches();
|
workbox.cleanupOutdatedCaches();
|
||||||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
|
||||||
|
|||||||
@@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="referrer" content="strict-origin-when-cross-origin" />
|
<meta charset="UTF-8" name="referrer" content="strict-origin-when-cross-origin" />
|
||||||
<link rel="icon" type="image/png+xml" href="/src/assets/favicon.png" />
|
<!-- <link rel="icon" type="image/png+xml" href="/src/assets/favicon.png" /> -->
|
||||||
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>SEO Admin</title>
|
<title>SEO Admin</title>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ const FAQ = () => {
|
|||||||
handleDeleteFaq(selectedFaqId);
|
handleDeleteFaq(selectedFaqId);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Box>
|
<Box>
|
||||||
<Switch
|
<Switch
|
||||||
colorPalette={'teal'}
|
colorPalette={'teal'}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ function FaqAddModel({ refetch }: { refetch: VoidFunction }) {
|
|||||||
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
||||||
Add
|
Add
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<DialogBody bg="white">
|
<DialogBody bg="white">
|
||||||
<Stack py={3}>
|
<Stack py={3}>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Badge, HStack, Text, VStack } from "@chakra-ui/react";
|
import { Badge, HStack, Stack, Text, VStack } from "@chakra-ui/react";
|
||||||
import { useGetPrivacyPolicyQuery } from "../../../Redux/Service/privacy.policy.service";
|
import { useGetPrivacyPolicyQuery } from "../../../Redux/Service/privacy.policy.service";
|
||||||
import MainFrame from "../../../components/MainFrame";
|
import MainFrame from "../../../components/MainFrame";
|
||||||
import { Spinner } from "../../../components/Sipnner/Spinner";
|
import { Spinner } from "../../../components/Sipnner/Spinner";
|
||||||
@@ -6,54 +6,77 @@ import PrivacyPolicyAddModel from "./PrivacyPolicyAddModel";
|
|||||||
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
|
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
|
||||||
import { useContext, useEffect } from "react";
|
import { useContext, useEffect } from "react";
|
||||||
|
|
||||||
|
|
||||||
const PrivacyPolicy = () => {
|
const PrivacyPolicy = () => {
|
||||||
const { data, isLoading, isFetching, refetch } = useGetPrivacyPolicyQuery();
|
const { data, isLoading, isFetching, refetch } = useGetPrivacyPolicyQuery();
|
||||||
|
|
||||||
console.log('PRIVACY', data?.data);
|
console.log("PRIVACY", data?.data);
|
||||||
|
|
||||||
|
|
||||||
const context = useContext(GlobalStateContext);
|
const context = useContext(GlobalStateContext);
|
||||||
if (!context) throw new Error('App must be used within a GlobalStateProvider');
|
if (!context)
|
||||||
|
throw new Error("App must be used within a GlobalStateProvider");
|
||||||
|
|
||||||
const { setIsBarLoading } = context;
|
const { setIsBarLoading } = context;
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setIsBarLoading(isFetching)
|
setIsBarLoading(isFetching);
|
||||||
}, [data])
|
}, [data]);
|
||||||
|
|
||||||
console.log('Privacy Policy Data:', data?.data);
|
console.log("Privacy Policy Data:", data?.data);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MainFrame transperant={true}>
|
<MainFrame transperant={true}>
|
||||||
<VStack gap={4} pb={4} pt={0}>
|
<Stack bg={"#fff"} w={"100%"} p={4} borderRadius={4} mb={4}>
|
||||||
{isLoading || isFetching ?
|
<Text color={"black"} textAlign={"left"} fontWeight={"600"}>
|
||||||
<Spinner /> : data?.data?.map(({ id, content, privacy_language }) => <VStack bg={'#fff'}
|
Privacy Policy
|
||||||
boxShadow={'rgba(99, 99, 99, 0.2) 0px 2px 8px 0px'} rounded={'lg'} p={3} key={id}>
|
</Text>
|
||||||
<HStack
|
</Stack>
|
||||||
w={"100%"}
|
<VStack gap={4} pb={4} pt={0}>
|
||||||
justifyContent={"space-between"}
|
{isLoading || isFetching ? (
|
||||||
|
<Spinner />
|
||||||
py={0}
|
) : (
|
||||||
px={0}
|
data?.data?.map(({ id, content, privacy_language }) => (
|
||||||
|
<VStack
|
||||||
|
bg={"#fff"}
|
||||||
|
boxShadow={"rgba(99, 99, 99, 0.2) 0px 2px 8px 0px"}
|
||||||
|
rounded={"lg"}
|
||||||
|
p={3}
|
||||||
|
key={id}
|
||||||
>
|
>
|
||||||
<Text as={"span"} fontSize={"sm"} fontWeight={500} color={"#000"}>
|
<HStack w={"100%"} justifyContent={"space-between"} py={0} px={0}>
|
||||||
Privacy Policy <Badge variant={'surface'} colorPalette="cyan" ms={2} size={'sm'} fontSize={'xs'} px={2}>🎓 {privacy_language?.language_name}</Badge>
|
<Text
|
||||||
</Text>
|
as={"span"}
|
||||||
|
fontSize={"sm"}
|
||||||
|
fontWeight={500}
|
||||||
|
color={"#000"}
|
||||||
|
>
|
||||||
|
<Badge
|
||||||
|
variant={"surface"}
|
||||||
|
colorPalette="cyan"
|
||||||
|
size={"sm"}
|
||||||
|
fontSize={"xs"}
|
||||||
|
px={2}
|
||||||
|
>
|
||||||
|
🎓 {privacy_language?.language_name}
|
||||||
|
</Badge>
|
||||||
|
</Text>
|
||||||
|
|
||||||
<PrivacyPolicyAddModel policyData={{ id, content, privacy_language }} refetch={refetch} />
|
<PrivacyPolicyAddModel
|
||||||
</HStack>
|
policyData={{ id, content, privacy_language }}
|
||||||
<Text
|
refetch={refetch}
|
||||||
as="p"
|
/>
|
||||||
fontSize="sm"
|
</HStack>
|
||||||
fontWeight={400}
|
<Text
|
||||||
color="#1D1D1D"
|
as="p"
|
||||||
dangerouslySetInnerHTML={{ __html: content }}
|
fontSize="sm"
|
||||||
/>
|
fontWeight={400}
|
||||||
|
color="#1D1D1D"
|
||||||
</VStack>)}
|
dangerouslySetInnerHTML={{ __html: content }}
|
||||||
|
/>
|
||||||
|
</VStack>
|
||||||
|
))
|
||||||
|
)}
|
||||||
</VStack>
|
</VStack>
|
||||||
</MainFrame>
|
</MainFrame>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default PrivacyPolicy;
|
export default PrivacyPolicy;
|
||||||
|
|||||||
@@ -1,59 +1,67 @@
|
|||||||
import { Badge, HStack, Spinner, Stack, Text, VStack } from "@chakra-ui/react";
|
import { Badge, HStack, Spinner, Stack, Text, VStack } from "@chakra-ui/react";
|
||||||
import MainFrame from "../../../components/MainFrame"
|
import MainFrame from "../../../components/MainFrame";
|
||||||
import TermsAndConditionsAddModel from "./TermsAndConditionsAddModel";
|
import TermsAndConditionsAddModel from "./TermsAndConditionsAddModel";
|
||||||
import { useGetTermsQuery } from "../../../Redux/Service/terms.and.condition.service";
|
import { useGetTermsQuery } from "../../../Redux/Service/terms.and.condition.service";
|
||||||
|
|
||||||
|
|
||||||
const TermsAndConditions = () => {
|
const TermsAndConditions = () => {
|
||||||
const { data, refetch, isLoading, isFetching } = useGetTermsQuery()
|
const { data, refetch, isLoading, isFetching } = useGetTermsQuery();
|
||||||
|
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<MainFrame transperant={true}>
|
||||||
|
<VStack gap={4} pb={4} pt={0}>
|
||||||
|
<Stack bg={"#fff"} w={"100%"} mt={2} p={4} borderRadius={4}>
|
||||||
|
<Text color={"black"} textAlign={"left"} fontWeight={"600"}>
|
||||||
|
Terms and Conditions
|
||||||
|
</Text>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
<MainFrame>
|
{isLoading || isFetching ? (
|
||||||
<MainFrame transperant={true}>
|
<Spinner />
|
||||||
<VStack gap={4} pb={4} pt={0}>
|
) : (
|
||||||
<Stack bg={"#fff"} w={"100%"} mt={2} p={4} borderRadius={4}><Text color={"black"} textAlign={"left"} fontWeight={"600"} >Terms and Conditions
|
data?.data?.map(({ id, content, terms_cond_language }) => (
|
||||||
</Text></Stack>
|
<VStack
|
||||||
|
bg={"#fff"}
|
||||||
{isLoading || isFetching ? (
|
boxShadow={"rgba(99, 99, 99, 0.2) 0px 2px 8px 0px"}
|
||||||
<Spinner />
|
rounded={"lg"}
|
||||||
) : (
|
p={3}
|
||||||
data?.data?.map(({ id, content, terms_cond_language }) => (
|
key={id}
|
||||||
<VStack
|
>
|
||||||
bg={"#fff"}
|
<HStack w={"100%"} justifyContent={"space-between"} py={0} px={0}>
|
||||||
boxShadow={"rgba(99, 99, 99, 0.2) 0px 2px 8px 0px"}
|
<Text
|
||||||
rounded={"lg"}
|
as={"span"}
|
||||||
p={3}
|
fontSize={"sm"}
|
||||||
key={id}
|
fontWeight={500}
|
||||||
>
|
color={"#000"}
|
||||||
|
>
|
||||||
<HStack w={"100%"} justifyContent={"space-between"} py={0} px={0}>
|
<Badge
|
||||||
<Text as={"span"} fontSize={"sm"} fontWeight={500} color={"#000"}>
|
variant={"surface"}
|
||||||
<Badge
|
colorPalette="cyan"
|
||||||
variant={"surface"}
|
ms={2}
|
||||||
colorPalette="cyan"
|
size={"sm"}
|
||||||
ms={2}
|
fontSize={"xs"}
|
||||||
size={"sm"}
|
px={2}
|
||||||
fontSize={"xs"}
|
>
|
||||||
px={2}
|
🎓 {terms_cond_language?.language_name}
|
||||||
>
|
</Badge>
|
||||||
🎓 {terms_cond_language?.language_name}
|
|
||||||
</Badge>
|
|
||||||
</Text>
|
|
||||||
|
|
||||||
{/* Pass Data to AboutUsAddModel */}
|
|
||||||
<TermsAndConditionsAddModel termsData={{ id, content, terms_cond_language }} refetch={refetch} />
|
|
||||||
</HStack>
|
|
||||||
<Text as="p" fontSize="sm" fontWeight={400} color="#1D1D1D">
|
|
||||||
{/* {content} */}
|
|
||||||
<div dangerouslySetInnerHTML={{ __html: content }} />
|
|
||||||
</Text>
|
</Text>
|
||||||
</VStack>
|
|
||||||
))
|
{/* Pass Data to AboutUsAddModel */}
|
||||||
)}
|
<TermsAndConditionsAddModel
|
||||||
</VStack>
|
termsData={{ id, content, terms_cond_language }}
|
||||||
</MainFrame>
|
refetch={refetch}
|
||||||
</MainFrame >
|
/>
|
||||||
)
|
</HStack>
|
||||||
}
|
<Text as="p" fontSize="sm" fontWeight={400} color="#1D1D1D">
|
||||||
export default TermsAndConditions
|
{/* {content} */}
|
||||||
|
<div dangerouslySetInnerHTML={{ __html: content }} />
|
||||||
|
</Text>
|
||||||
|
</VStack>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</VStack>
|
||||||
|
</MainFrame>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
export default TermsAndConditions;
|
||||||
|
|||||||
@@ -1,38 +1,77 @@
|
|||||||
import { Box, HStack, Input, Text } from "@chakra-ui/react";
|
import { Box, HStack, Input, Text } from "@chakra-ui/react";
|
||||||
import MainFrame from "../../components/MainFrame"
|
import MainFrame from "../../components/MainFrame";
|
||||||
import PendingRequests from "../../Pages/ManageContact/PendingRequests"
|
import PendingRequests from "../../Pages/ManageContact/PendingRequests";
|
||||||
import { InputGroup } from "../../components/ui/input-group";
|
import { InputGroup } from "../../components/ui/input-group";
|
||||||
import { LuSearch } from "react-icons/lu";
|
import { LuSearch } from "react-icons/lu";
|
||||||
import DataTable from "../../components/DataTable";
|
import DataTable from "../../components/DataTable";
|
||||||
|
import { useGetContactQuery } from "../../Redux/Service/manage.contactus.service";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Spinner } from "../../components/Sipnner/Spinner";
|
||||||
|
|
||||||
// table data
|
// table data
|
||||||
|
const tableHeadRow = ["Sr. No", "Email id", "Name", "Date", "Action"];
|
||||||
|
|
||||||
const tableHeadRow = [
|
const ManageContact = () => {
|
||||||
"Sr. No",
|
const { data, isLoading, isError } = useGetContactQuery();
|
||||||
"Email id",
|
const [localData, setLocalData] = useState([]);
|
||||||
"Name",
|
|
||||||
"Date",
|
|
||||||
"Action",
|
|
||||||
];
|
|
||||||
|
|
||||||
const managepost: any[] = [
|
useEffect(() => {
|
||||||
...Array.from({ length: 12 }, (_, i) => ({
|
if (data) {
|
||||||
"Sr. No": i + 1,
|
setLocalData((data as any)?.data?.data || []);
|
||||||
"Email id": "ABC@gmail.com",
|
}
|
||||||
"Name": "Pooja",
|
}, [data]);
|
||||||
"Date": "11/02/1989",
|
|
||||||
"Action": (
|
const formatDateOfBirth = (dob: string): string => {
|
||||||
|
return new Date(dob).toLocaleDateString("en-GB", {
|
||||||
|
day: "2-digit",
|
||||||
|
month: "2-digit",
|
||||||
|
year: "numeric",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const managepost = localData?.map((agency: any, index: number) => ({
|
||||||
|
"Sr. No": index + 1, // Typically Sr. No starts from 1, not using id which might not be sequential
|
||||||
|
"Email id": agency?.email || "-",
|
||||||
|
Name: agency?.first_name || "-",
|
||||||
|
Date: formatDateOfBirth(agency?.created_at) || "-",
|
||||||
|
Action: (
|
||||||
<HStack justifyContent="center">
|
<HStack justifyContent="center">
|
||||||
<PendingRequests />
|
<PendingRequests />
|
||||||
</HStack>
|
</HStack>
|
||||||
),
|
),
|
||||||
})),
|
}));
|
||||||
];
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<MainFrame>
|
||||||
|
<Box
|
||||||
|
display="flex"
|
||||||
|
justifyContent="center"
|
||||||
|
alignItems="center"
|
||||||
|
height="100%"
|
||||||
|
>
|
||||||
|
<Spinner />
|
||||||
|
</Box>
|
||||||
|
</MainFrame>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isError) {
|
||||||
|
return (
|
||||||
|
<MainFrame>
|
||||||
|
<Box
|
||||||
|
display="flex"
|
||||||
|
justifyContent="center"
|
||||||
|
alignItems="center"
|
||||||
|
height="100%"
|
||||||
|
>
|
||||||
|
<Text>Error loading data</Text>
|
||||||
|
</Box>
|
||||||
|
</MainFrame>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const ManageContact = () => {
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<MainFrame>
|
<MainFrame>
|
||||||
<Box>
|
<Box>
|
||||||
<HStack
|
<HStack
|
||||||
@@ -43,13 +82,16 @@ const ManageContact = () => {
|
|||||||
px={3}
|
px={3}
|
||||||
>
|
>
|
||||||
<Text as={"span"} fontSize={"sm"} fontWeight={500} color={"#000"}>
|
<Text as={"span"} fontSize={"sm"} fontWeight={500} color={"#000"}>
|
||||||
Contact Requests
|
Contact Requests
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<HStack >
|
<HStack>
|
||||||
<InputGroup
|
<InputGroup
|
||||||
startElement={
|
startElement={
|
||||||
<LuSearch fontSize={"xs"} style={{ position: 'relative', left: '10px' }} />
|
<LuSearch
|
||||||
|
fontSize={"xs"}
|
||||||
|
style={{ position: "relative", left: "10px" }}
|
||||||
|
/>
|
||||||
}
|
}
|
||||||
color={"#000"}
|
color={"#000"}
|
||||||
>
|
>
|
||||||
@@ -63,20 +105,20 @@ const ManageContact = () => {
|
|||||||
size={"xs"}
|
size={"xs"}
|
||||||
fontSize={"sm"}
|
fontSize={"sm"}
|
||||||
placeholder="Search..."
|
placeholder="Search..."
|
||||||
bgColor={'#EEEEEE'}
|
bgColor={"#EEEEEE"}
|
||||||
ps={8}
|
ps={8}
|
||||||
/>
|
/>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
{/* <Button bgColor={'#EEEEEE'} pl={3} pr={3}><IoMdAdd /> <Text>Add</Text></Button> */}
|
|
||||||
</HStack>
|
</HStack>
|
||||||
</HStack>
|
</HStack>
|
||||||
<DataTable
|
<DataTable
|
||||||
sortableColumns={["Name", "Registration Date "]}
|
sortableColumns={["Name", "Registration Date "]}
|
||||||
tableHeadRow={tableHeadRow}
|
tableHeadRow={tableHeadRow}
|
||||||
data={managepost}
|
data={managepost || []} // Ensure an empty array is passed if managepost is undefined
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</MainFrame>
|
</MainFrame>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
export default ManageContact
|
|
||||||
|
export default ManageContact;
|
||||||
|
|||||||
@@ -48,6 +48,9 @@ const managepost: any[] = [
|
|||||||
),
|
),
|
||||||
})),
|
})),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const ManageGroups = () => {
|
const ManageGroups = () => {
|
||||||
return (
|
return (
|
||||||
<MainFrame>
|
<MainFrame>
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import {
|
import {
|
||||||
Box, HStack,
|
Box,
|
||||||
// Image,
|
HStack,
|
||||||
Input, Text
|
Image,
|
||||||
|
// Image,
|
||||||
|
Input,
|
||||||
|
Text,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import { LuSearch } from "react-icons/lu";
|
import { LuSearch } from "react-icons/lu";
|
||||||
// import { RiDeleteBin5Line } from "react-icons/ri";
|
// import { RiDeleteBin5Line } from "react-icons/ri";
|
||||||
@@ -11,6 +14,15 @@ import MainFrame from "../../components/MainFrame";
|
|||||||
import { InputGroup } from "../../components/ui/input-group";
|
import { InputGroup } from "../../components/ui/input-group";
|
||||||
import ManageJobsAdd from "./ManageJobsAdd";
|
import ManageJobsAdd from "./ManageJobsAdd";
|
||||||
import ViewManageJob from "./ViewManageJob";
|
import ViewManageJob from "./ViewManageJob";
|
||||||
|
import {
|
||||||
|
useDeleteJobsPostMutation,
|
||||||
|
useGetManageJobsQuery,
|
||||||
|
} from "../../Redux/Service/manage.jobs.service";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Spinner } from "../../components/Sipnner/Spinner";
|
||||||
|
import Delete from "../../components/ActionIcons/Delete";
|
||||||
|
import { toaster } from "../../components/ui/toaster";
|
||||||
|
import AlertDailog from "../../components/AlertDailog";
|
||||||
// import { useState } from "react";
|
// import { useState } from "react";
|
||||||
// import { useGetManageJobsQuery } from "../../Redux/Service/manage.jobs.service";
|
// import { useGetManageJobsQuery } from "../../Redux/Service/manage.jobs.service";
|
||||||
// import Delete from "../../components/ActionIcons/Delete";
|
// import Delete from "../../components/ActionIcons/Delete";
|
||||||
@@ -27,36 +39,93 @@ const tableHeadRow = [
|
|||||||
"Action",
|
"Action",
|
||||||
];
|
];
|
||||||
|
|
||||||
const managepost: any[] = [
|
const ManageJobs = () => {
|
||||||
...Array.from({ length: 12 }, (_, i) => ({
|
const [currentPage] = useState(1);
|
||||||
"Sr. No": i + 1,
|
const [localData, setLocalData] = useState([]);
|
||||||
"Job Title": "Freelance content writer",
|
const { data, refetch, isLoading } = useGetManageJobsQuery(currentPage);
|
||||||
"Workspace mode": "Onsite",
|
const [deleteJobsPost] = useDeleteJobsPostMutation();
|
||||||
Category: "IT",
|
const [deleteModal, setDeleteModal] = useState(false);
|
||||||
"Sub-category": "Flutter dev",
|
const [selectedJobsId, setSelectedJobsId] = useState<number | null>(null);
|
||||||
Salary: "3.5 LPA",
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (data) {
|
||||||
|
setLocalData((data as any)?.data?.data || []);
|
||||||
|
}
|
||||||
|
}, [data]);
|
||||||
|
console.log(data?.data.data);
|
||||||
|
|
||||||
|
const handleDeleteJobs = async (jobsId: number) => {
|
||||||
|
try {
|
||||||
|
const response = await deleteJobsPost({ id: jobsId }).unwrap();
|
||||||
|
if (response?.status === "success") {
|
||||||
|
toaster.create({
|
||||||
|
title: "Success",
|
||||||
|
description: "Jobs deleted successfully",
|
||||||
|
type: "Success",
|
||||||
|
});
|
||||||
|
refetch();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error deleting FAQ:", error);
|
||||||
|
toaster.create({
|
||||||
|
title: "Error",
|
||||||
|
description: "Something went wrong",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const managepost = localData?.map((agency: any, index: number) => ({
|
||||||
|
"Sr. No": index + 1,
|
||||||
|
"Job Title": agency?.job_title,
|
||||||
|
"Workspace mode": agency?.workspace?.en_name,
|
||||||
|
Category: agency?.industry?.en_name,
|
||||||
|
"Sub-category": agency?.department?.en_name,
|
||||||
|
Salary: agency?.ctc_amount,
|
||||||
Action: (
|
Action: (
|
||||||
<HStack justifyContent="center">
|
<HStack justifyContent="center">
|
||||||
<ViewManageJob />
|
<ViewManageJob />
|
||||||
<ManageJobsAdd />
|
<ManageJobsAdd />
|
||||||
{/* <AlertDailog
|
<AlertDailog
|
||||||
AltertTiggerIcon={() => <Delete />}
|
isOpen={deleteModal}
|
||||||
alertText="Delete Users"
|
AltertTiggerIcon={() => (
|
||||||
|
<Delete
|
||||||
|
onClick={() => {
|
||||||
|
setSelectedJobsId(agency.id);
|
||||||
|
setDeleteModal(true);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
alertText="Delete FAQ"
|
||||||
alertIcon={<Image src={"DeleteIcon"} h={"39px"} />}
|
alertIcon={<Image src={"DeleteIcon"} h={"39px"} />}
|
||||||
alertCaption="are you sure you want to delete ?"
|
alertCaption="are you sure you want to delete ?"
|
||||||
|
onClose={() => setDeleteModal(false)}
|
||||||
onConfirm={() => {
|
onConfirm={() => {
|
||||||
console.log("User deleted:", i + 1);
|
// console.log("Deleting FAQ with ID:", selectedFaqId); // Correct ID
|
||||||
|
if (selectedJobsId) {
|
||||||
|
setDeleteModal(false);
|
||||||
|
handleDeleteJobs(selectedJobsId);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/> */}
|
/>
|
||||||
</HStack>
|
</HStack>
|
||||||
),
|
),
|
||||||
})),
|
}));
|
||||||
];
|
|
||||||
|
|
||||||
const ManageJobs = () => {
|
if (isLoading) {
|
||||||
// const [currentPage, setCurrentPage] = useState(1);
|
return (
|
||||||
// const { data, refetch } = useGetManageJobsQuery(currentPage)
|
<MainFrame>
|
||||||
// console.log(data?.data.data);
|
<Box
|
||||||
|
display="flex"
|
||||||
|
justifyContent="center"
|
||||||
|
alignItems="center"
|
||||||
|
height="100%"
|
||||||
|
>
|
||||||
|
<Spinner />
|
||||||
|
</Box>
|
||||||
|
</MainFrame>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MainFrame>
|
<MainFrame>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import {
|
|||||||
SelectTrigger,
|
SelectTrigger,
|
||||||
} from "../../components/ui/select";
|
} from "../../components/ui/select";
|
||||||
import View from "../../components/ActionIcons/View";
|
import View from "../../components/ActionIcons/View";
|
||||||
|
import { useLazyViewJobsQuery } from "../../Redux/Service/manage.jobs.service";
|
||||||
|
|
||||||
const frameworks = createListCollection({
|
const frameworks = createListCollection({
|
||||||
items: [
|
items: [
|
||||||
@@ -37,238 +38,258 @@ const frameworks = createListCollection({
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
function ViewManageJob() {
|
function ViewManageJob() {
|
||||||
|
const [ data ] = useLazyViewJobsQuery();
|
||||||
|
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
// const handleView = () => {
|
||||||
|
// trigger(id);
|
||||||
|
// };
|
||||||
|
|
||||||
|
// const viewJobs = data;
|
||||||
|
|
||||||
|
console.log();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogRoot placement="center">
|
<DialogRoot placement="center">
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
<Span><View /></Span>
|
<Span>
|
||||||
|
<View />
|
||||||
|
</Span>
|
||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
|
|
||||||
<DialogContent
|
{/* {viewJobs?.map((data: any) => ( */}
|
||||||
bg={"#fff"}
|
<DialogContent
|
||||||
// w={{ lg: "60%", md: "230px" }}
|
bg={"#fff"}
|
||||||
w={{ base: "90%", md: "400px" }}
|
// w={{ lg: "60%", md: "230px" }}
|
||||||
height={"80vh"}
|
w={{ base: "90%", md: "400px" }}
|
||||||
overflow={"scroll"}
|
height={"80vh"}
|
||||||
overflowX="hidden"
|
overflow={"scroll"}
|
||||||
p={3} // Reduced padding
|
overflowX="hidden"
|
||||||
bgSize={"md"}
|
p={3} // Reduced padding
|
||||||
>
|
bgSize={"md"}
|
||||||
<DialogHeader bg="white">
|
>
|
||||||
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
<DialogHeader bg="white">
|
||||||
Add Details
|
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
||||||
</DialogTitle>
|
Add Details
|
||||||
</DialogHeader>
|
</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
|
||||||
<DialogBody bg="white">
|
<DialogBody bg="white">
|
||||||
<Stack py={3}>
|
<Stack py={3}>
|
||||||
<Field.Root>
|
<Field.Root>
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
Job title
|
Job title
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder="Enter the Job Title"
|
placeholder="Enter the Job Title"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
|
||||||
</Field.Root>
|
|
||||||
<Field.Root>
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
|
||||||
Workspace mode
|
|
||||||
</Field.Label>
|
|
||||||
<Input
|
|
||||||
placeholder="Enter the Workspace Mode"
|
|
||||||
bgColor="#EEEEEE"
|
|
||||||
color="black"
|
|
||||||
border="none"
|
|
||||||
pl={1}
|
|
||||||
fontSize="12px"
|
|
||||||
height="30px"
|
|
||||||
/>
|
|
||||||
</Field.Root>
|
|
||||||
<Field.Root>
|
|
||||||
<Field.Label pt={1} color="black" fontSize="12px">
|
|
||||||
Category
|
|
||||||
</Field.Label>
|
|
||||||
<Input
|
|
||||||
placeholder="Enter the Category"
|
|
||||||
bgColor="#EEEEEE"
|
|
||||||
color="black"
|
|
||||||
border="none"
|
|
||||||
pl={1}
|
|
||||||
fontSize="12px"
|
|
||||||
height="30px"
|
|
||||||
/>
|
|
||||||
</Field.Root>
|
|
||||||
<Field.Root>
|
|
||||||
<Field.Label pt={1} color="black" fontSize="12px">
|
|
||||||
Sub-Category
|
|
||||||
</Field.Label>
|
|
||||||
<Input
|
|
||||||
placeholder="Enter the Sub-Category"
|
|
||||||
bgColor="#EEEEEE"
|
|
||||||
color="black"
|
|
||||||
border="none"
|
|
||||||
pl={1}
|
|
||||||
fontSize="12px"
|
|
||||||
height="30px"
|
|
||||||
/>
|
|
||||||
</Field.Root>
|
|
||||||
<Field.Root>
|
|
||||||
<Field.Label pt={1} color="black" fontSize="12px">
|
|
||||||
Salary
|
|
||||||
</Field.Label>
|
|
||||||
<Input
|
|
||||||
placeholder="Enter the Salary"
|
|
||||||
bgColor="#EEEEEE"
|
|
||||||
color="black"
|
|
||||||
border="none"
|
|
||||||
pl={1}
|
|
||||||
fontSize="12px"
|
|
||||||
height="30px"
|
|
||||||
/>
|
|
||||||
</Field.Root>
|
|
||||||
<Field.Root>
|
|
||||||
<Field.Label pt={1} color="black" fontSize="12px">
|
|
||||||
Experience
|
|
||||||
</Field.Label>
|
|
||||||
<Input
|
|
||||||
placeholder="Enter the Experience"
|
|
||||||
bgColor="#EEEEEE"
|
|
||||||
color="black"
|
|
||||||
border="none"
|
|
||||||
pl={1}
|
|
||||||
fontSize="12px"
|
|
||||||
height="30px"
|
|
||||||
/>
|
|
||||||
</Field.Root>
|
|
||||||
<Field.Root>
|
|
||||||
<Field.Label pt={1} color="black" fontSize="12px">
|
|
||||||
Job Location
|
|
||||||
</Field.Label>
|
|
||||||
<Input
|
|
||||||
placeholder="Enter the Job Location"
|
|
||||||
bgColor="#EEEEEE"
|
|
||||||
color="black"
|
|
||||||
border="none"
|
|
||||||
pl={1}
|
|
||||||
fontSize="12px"
|
|
||||||
height="30px"
|
|
||||||
/>
|
|
||||||
</Field.Root>
|
|
||||||
{/* <Field.Label pt={1} color="black" fontSize="12px">Country Selection</Field.Label>
|
|
||||||
<Input placeholder="Enter the Country Selection" /> */}
|
|
||||||
<SelectRoot collection={frameworks} size="sm" w={"100%"}>
|
|
||||||
<SelectLabel pt={1} color="black" fontSize="12px">
|
|
||||||
Country Selection
|
|
||||||
</SelectLabel>
|
|
||||||
<SelectTrigger
|
|
||||||
bgColor="#EEEEEE"
|
|
||||||
color="black"
|
|
||||||
border="none"
|
|
||||||
pl={1}
|
|
||||||
fontSize="12px"
|
|
||||||
height="30px"
|
|
||||||
borderRadius={"5px"}
|
|
||||||
>
|
|
||||||
<SelectValueText
|
|
||||||
placeholder="Enter the Country Selection"
|
|
||||||
pb={"6px"}
|
|
||||||
fontSize={"12px"}
|
|
||||||
/>
|
/>
|
||||||
</SelectTrigger>
|
</Field.Root>
|
||||||
<SelectContent position={"relative"} zIndex={"9999"} bg={"#fff"}>
|
<Field.Root>
|
||||||
{frameworks.items.map((movie) => (
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
<SelectItem
|
Workspace mode
|
||||||
item={movie}
|
</Field.Label>
|
||||||
key={movie.value}
|
<Input
|
||||||
color={"black"}
|
placeholder="Enter the Workspace Mode"
|
||||||
pl={2}
|
bgColor="#EEEEEE"
|
||||||
p={1}
|
color="black"
|
||||||
_hover={{ bg: "#F0F0F0" }} // Light grey background on hover
|
border="none"
|
||||||
fontSize="12px"
|
pl={1}
|
||||||
>
|
fontSize="12px"
|
||||||
{movie.label}
|
height="30px"
|
||||||
</SelectItem>
|
/>
|
||||||
))}
|
</Field.Root>
|
||||||
</SelectContent>
|
<Field.Root>
|
||||||
</SelectRoot>
|
<Field.Label pt={1} color="black" fontSize="12px">
|
||||||
|
Category
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter the Category"
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
/>
|
||||||
|
</Field.Root>
|
||||||
|
<Field.Root>
|
||||||
|
<Field.Label pt={1} color="black" fontSize="12px">
|
||||||
|
Sub-Category
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter the Sub-Category"
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
/>
|
||||||
|
</Field.Root>
|
||||||
|
<Field.Root>
|
||||||
|
<Field.Label pt={1} color="black" fontSize="12px">
|
||||||
|
Salary
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter the Salary"
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
/>
|
||||||
|
</Field.Root>
|
||||||
|
<Field.Root>
|
||||||
|
<Field.Label pt={1} color="black" fontSize="12px">
|
||||||
|
Experience
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter the Experience"
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
/>
|
||||||
|
</Field.Root>
|
||||||
|
<Field.Root>
|
||||||
|
<Field.Label pt={1} color="black" fontSize="12px">
|
||||||
|
Job Location
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter the Job Location"
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
/>
|
||||||
|
</Field.Root>
|
||||||
|
{/* <Field.Label pt={1} color="black" fontSize="12px">Country Selection</Field.Label>
|
||||||
|
<Input placeholder="Enter the Country Selection" /> */}
|
||||||
|
<SelectRoot collection={frameworks} size="sm" w={"100%"}>
|
||||||
|
<SelectLabel pt={1} color="black" fontSize="12px">
|
||||||
|
Country Selection
|
||||||
|
</SelectLabel>
|
||||||
|
<SelectTrigger
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
borderRadius={"5px"}
|
||||||
|
>
|
||||||
|
<SelectValueText
|
||||||
|
placeholder="Enter the Country Selection"
|
||||||
|
pb={"6px"}
|
||||||
|
fontSize={"12px"}
|
||||||
|
/>
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent
|
||||||
|
position={"relative"}
|
||||||
|
zIndex={"9999"}
|
||||||
|
bg={"#fff"}
|
||||||
|
>
|
||||||
|
{frameworks.items.map((movie) => (
|
||||||
|
<SelectItem
|
||||||
|
item={movie}
|
||||||
|
key={movie.value}
|
||||||
|
color={"black"}
|
||||||
|
pl={2}
|
||||||
|
p={1}
|
||||||
|
_hover={{ bg: "#F0F0F0" }} // Light grey background on hover
|
||||||
|
fontSize="12px"
|
||||||
|
>
|
||||||
|
{movie.label}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</SelectRoot>
|
||||||
|
|
||||||
<Field.Root>
|
<Field.Root>
|
||||||
<Field.Label pt={1} color="black" fontSize="12px">
|
<Field.Label pt={1} color="black" fontSize="12px">
|
||||||
Job type
|
Job type
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder="Enter the Job Type"
|
placeholder="Enter the Job Type"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
/>
|
||||||
</Field.Root>
|
</Field.Root>
|
||||||
<Field.Root>
|
<Field.Root>
|
||||||
<Field.Label pt={1} color="black" fontSize="12px">
|
<Field.Label pt={1} color="black" fontSize="12px">
|
||||||
Skills required
|
Skills required
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder="Enter the Skills Required"
|
placeholder="Enter the Skills Required"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
/>
|
||||||
</Field.Root>
|
</Field.Root>
|
||||||
<Field.Root>
|
<Field.Root>
|
||||||
<Field.Label pt={1} color="black" fontSize="12px">
|
<Field.Label pt={1} color="black" fontSize="12px">
|
||||||
Job Description*
|
Job Description*
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder="Enter the Job Description"
|
placeholder="Enter the Job Description"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
/>
|
||||||
</Field.Root>
|
</Field.Root>
|
||||||
<Field.Root>
|
<Field.Root>
|
||||||
<Field.Label pt={1} color="black" fontSize="12px">
|
<Field.Label pt={1} color="black" fontSize="12px">
|
||||||
Upload Image
|
Upload Image
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder="Upload Image"
|
placeholder="Upload Image"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
/>
|
||||||
</Field.Root>
|
</Field.Root>
|
||||||
</Stack>
|
</Stack>
|
||||||
</DialogBody>
|
</DialogBody>
|
||||||
<DialogFooter display="flex" justifyContent="center" pt={"2"}>
|
<DialogFooter display="flex" justifyContent="center" pt={"2"}>
|
||||||
<Button
|
<Button
|
||||||
w="100%"
|
w="100%"
|
||||||
bg="#02A0A0"
|
bg="#02A0A0"
|
||||||
color={"#fff"}
|
color={"#fff"}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
>
|
>
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
|
|
||||||
<DialogCloseTrigger color="black" />
|
<DialogCloseTrigger color="black" />
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
|
{/* ))} */}
|
||||||
</DialogRoot>
|
</DialogRoot>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,121 @@
|
|||||||
import { Box, HStack, Input, Text } from "@chakra-ui/react";
|
import { Box, HStack, Text } from "@chakra-ui/react";
|
||||||
import MainFrame from "../../../components/MainFrame";
|
import MainFrame from "../../../components/MainFrame";
|
||||||
import DataTable from "../../../components/DataTable";
|
import DataTable from "../../../components/DataTable";
|
||||||
import { Switch } from "../../../components/ui/switch";
|
import { Switch } from "../../../components/ui/switch";
|
||||||
import { InputGroup } from "../../../components/ui/input-group";
|
// import { InputGroup } from "../../../components/ui/input-group";
|
||||||
import { LuSearch } from "react-icons/lu";
|
// import { LuSearch } from "react-icons/lu";
|
||||||
|
// import { useGetContactQuery } from "../../../Redux/Service/deactivated.account.service";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { Spinner } from "../../../components/Sipnner/Spinner";
|
||||||
|
import { useGetDeactivateUserQuery, useUserDeactivateToggleMutation } from "../../../Redux/Service/manage.user";
|
||||||
|
import SearchComponent from "../../../components/SearchComponent";
|
||||||
|
|
||||||
const tableHeadRow = [
|
const tableHeadRow = [
|
||||||
"Sr. No",
|
"Sr. No",
|
||||||
"First Name",
|
"First Name",
|
||||||
"Last Name",
|
"Last Name",
|
||||||
"Company name",
|
"User Type",
|
||||||
"Activate/Deactivate",
|
"Activate/Deactivate",
|
||||||
];
|
];
|
||||||
|
|
||||||
const manageUser: any[] = [
|
const DeactivatedAccounts = () => {
|
||||||
...Array.from({ length: 12 }, (_, i) => ({
|
const [currentPage, setCurrentPage] = useState(1);
|
||||||
"Sr. No": i + 1,
|
const { data, isLoading, refetch } = useGetDeactivateUserQuery(currentPage);
|
||||||
"First Name": "Ritesh",
|
const [localData, setLocalData] = useState<any[]>([]);
|
||||||
"Last Name": "akanksha@gmail.com",
|
const [searchTerm, setSearchTerm] = useState("");
|
||||||
"Company name": "9876543210",
|
const [userDeactivateToggle] = useUserDeactivateToggleMutation()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (data) {
|
||||||
|
setLocalData((data as any)?.data?.data || []);
|
||||||
|
}
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
|
const handlePageChange = (page: number) => {
|
||||||
|
setCurrentPage(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
const filteredData = localData?.filter((agency) => {
|
||||||
|
const searchLower = searchTerm.toLowerCase();
|
||||||
|
const firstName = agency.first_name?.toLowerCase().includes(searchLower);
|
||||||
|
const lastName = agency.last_name?.toLowerCase().includes(searchLower);
|
||||||
|
// const email = agency.capital?.toLowerCase().includes(searchLower);
|
||||||
|
return firstName || lastName;
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleToggle = async (agencyId: number, currentStatus: string) => {
|
||||||
|
const newStatus = currentStatus === '1' ? '0' : '1';
|
||||||
|
|
||||||
|
setLocalData((prevData) =>
|
||||||
|
prevData.map((agency) =>
|
||||||
|
agency.id === agencyId ? { ...agency, is_active: newStatus } : agency
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await userDeactivateToggle({ id: agencyId, is_active: newStatus }).unwrap();
|
||||||
|
refetch()
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error updating privacy policy:", error);
|
||||||
|
setLocalData((prevData) =>
|
||||||
|
prevData.map((agency) =>
|
||||||
|
agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const manageUser = filteredData?.map((agency: any, index: number) => ({
|
||||||
|
"Sr. No": index + 1,
|
||||||
|
"First Name": agency?.first_name,
|
||||||
|
"Last Name": agency?.last_name,
|
||||||
|
"User Type": agency?.principal_type_xid === 3 ? "JobSeeker" : "Recruiter",
|
||||||
"Activate/Deactivate": (
|
"Activate/Deactivate": (
|
||||||
<Box display={'flex'} justifyContent={'center'}>
|
<Box display={"flex"} justifyContent={"center"}>
|
||||||
<Switch size={'sm'} colorPalette={'teal'} />
|
<Switch
|
||||||
|
size={"sm"}
|
||||||
|
colorPalette={"teal"}
|
||||||
|
checked={agency.is_active === true}
|
||||||
|
onChange={() => handleToggle(agency.id, agency.is_active ? "1" : "0")}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
),
|
),
|
||||||
})),
|
}));
|
||||||
];
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<MainFrame>
|
||||||
|
<Box
|
||||||
|
display="flex"
|
||||||
|
justifyContent="center"
|
||||||
|
alignItems="center"
|
||||||
|
height="100%"
|
||||||
|
>
|
||||||
|
<Spinner />
|
||||||
|
</Box>
|
||||||
|
</MainFrame>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (isError) {
|
||||||
|
// return (
|
||||||
|
// <MainFrame>
|
||||||
|
// <Box
|
||||||
|
// display="flex"
|
||||||
|
// justifyContent="center"
|
||||||
|
// alignItems="center"
|
||||||
|
// height="100%"
|
||||||
|
// >
|
||||||
|
// <Text>Error loading data</Text>
|
||||||
|
// </Box>
|
||||||
|
// </MainFrame>
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
const DeactivatedAccounts = () => {
|
|
||||||
return (
|
return (
|
||||||
<MainFrame>
|
<MainFrame>
|
||||||
<Box>
|
<Box>
|
||||||
<HStack
|
<HStack
|
||||||
w={"100%"}
|
w={"100%"}
|
||||||
justifyContent={"space-between"}
|
justifyContent={"space-between"}
|
||||||
mb={4}
|
mb={4}
|
||||||
@@ -39,36 +123,31 @@ const DeactivatedAccounts = () => {
|
|||||||
px={3}
|
px={3}
|
||||||
>
|
>
|
||||||
<Text as={"span"} fontSize={"sm"} fontWeight={500} color={"#000"}>
|
<Text as={"span"} fontSize={"sm"} fontWeight={500} color={"#000"}>
|
||||||
Deactivated User Accounts
|
Deactivated User Accounts
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<HStack>
|
<HStack>
|
||||||
<InputGroup
|
<SearchComponent
|
||||||
startElement={
|
value={searchTerm}
|
||||||
<LuSearch fontSize={"xs"} style={{position:'relative',left:'10px'}} />
|
onChange={(value) => {
|
||||||
}
|
setSearchTerm(value);
|
||||||
color={"#000"}
|
// setCurrentPage(1);
|
||||||
>
|
refetch()
|
||||||
<Input
|
}}
|
||||||
p={4}
|
/>
|
||||||
w={300}
|
|
||||||
bg={"#fff"}
|
|
||||||
colorPalette={"blue"}
|
|
||||||
_focus={{ border: "1px solid #02A0A0" }}
|
|
||||||
rounded={"md"}
|
|
||||||
size={"2xs"}
|
|
||||||
fontSize={"sm"}
|
|
||||||
placeholder="Search..."
|
|
||||||
bgColor={'#EEEEEE'}
|
|
||||||
ps={8}
|
|
||||||
/>
|
|
||||||
</InputGroup>
|
|
||||||
</HStack>
|
</HStack>
|
||||||
</HStack>
|
</HStack>
|
||||||
<DataTable
|
<DataTable
|
||||||
sortableColumns={["Name", "Registration Date "]}
|
sortableColumns={["Name", "Registration Date "]}
|
||||||
tableHeadRow={tableHeadRow}
|
tableHeadRow={tableHeadRow}
|
||||||
data={manageUser}
|
data={manageUser}
|
||||||
|
paginationData={{
|
||||||
|
current_page: data?.data.current_page || 1,
|
||||||
|
last_page: data?.data.last_page || 1,
|
||||||
|
per_page: data?.data.per_page || 10,
|
||||||
|
total: data?.data.total || 0
|
||||||
|
}}
|
||||||
|
onPageChange={handlePageChange}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</MainFrame>
|
</MainFrame>
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// import { MdOutlineRemoveRedEye } from "react-icons/md";
|
// import { MdOutlineRemoveRedEye } from "react-icons/md";
|
||||||
import { Field, Input, Span, Stack } from "@chakra-ui/react";
|
import { Field, Input, Stack } from "@chakra-ui/react";
|
||||||
import {
|
import {
|
||||||
DialogActionTrigger,
|
|
||||||
DialogBody,
|
DialogBody,
|
||||||
DialogCloseTrigger,
|
DialogCloseTrigger,
|
||||||
DialogContent,
|
DialogContent,
|
||||||
@@ -15,95 +14,197 @@ import {
|
|||||||
import { Button } from "../../../components/ui/button";
|
import { Button } from "../../../components/ui/button";
|
||||||
// import { TbEdit } from "react-icons/tb";
|
// import { TbEdit } from "react-icons/tb";
|
||||||
import Edit from "../../../components/ActionIcons/Edit";
|
import Edit from "../../../components/ActionIcons/Edit";
|
||||||
|
import { UserData, useUpdateUserMutation } from "../../../Redux/Service/manage.user";
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Toaster, toaster } from "../../../components/ui/toaster";
|
||||||
|
|
||||||
|
function EditRegisterUsers({ data, refetch }: { data: UserData, refetch: () => void }) {
|
||||||
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const [formData, setFormData] = useState<UserData>({
|
||||||
|
id: data?.id,
|
||||||
|
first_name: data?.first_name || '',
|
||||||
|
last_name: data?.last_name || '',
|
||||||
|
principal_type_xid: data?.principal_type_xid,
|
||||||
|
phone_number: data?.phone_number || '',
|
||||||
|
gender: data?.gender || '',
|
||||||
|
date_of_birth: data?.date_of_birth || '',
|
||||||
|
principal_type: data?.principal_type,
|
||||||
|
is_active: data?.is_active ?? true,
|
||||||
|
principle_language_links: data?.principle_language_links ?? [],
|
||||||
|
});
|
||||||
|
const [updateUser] = useUpdateUserMutation();
|
||||||
|
|
||||||
|
const handleOpenModal = () => {
|
||||||
|
setIsOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async (event: React.FormEvent) => {
|
||||||
|
event.preventDefault();
|
||||||
|
if (formData.first_name === '' || formData.last_name === '' || formData.phone_number === '' || formData.gender === '' || formData.date_of_birth === '') {
|
||||||
|
toaster.create({
|
||||||
|
title: "Error",
|
||||||
|
description: "Input fields cannot be empty",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const languageData = formData?.principle_language_links.map(link => link.language_xid);
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
id: formData?.id,
|
||||||
|
principal_type_xid: formData?.principal_type_xid,
|
||||||
|
principal_source_xid: formData?.id,
|
||||||
|
first_name: formData?.first_name,
|
||||||
|
last_name: formData?.last_name,
|
||||||
|
gender: formData?.gender,
|
||||||
|
date_of_birth: formData?.date_of_birth,
|
||||||
|
language_xid: languageData,
|
||||||
|
};
|
||||||
|
|
||||||
|
// console.log('payload', payload)
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await updateUser(payload).unwrap();
|
||||||
|
if (response?.status === "success") {
|
||||||
|
toaster.create({
|
||||||
|
title: "Success",
|
||||||
|
description: "Country updated successfully",
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
setIsOpen(false);
|
||||||
|
refetch()
|
||||||
|
} else {
|
||||||
|
toaster.create({
|
||||||
|
title: "Error",
|
||||||
|
description: "Failed to update Country",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error updating template:", error);
|
||||||
|
// alert("Failed to update template");
|
||||||
|
toaster.create({
|
||||||
|
title: "Error",
|
||||||
|
description: "Something went wrong",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function EditRegisterUsers() {
|
|
||||||
return (
|
return (
|
||||||
<DialogRoot placement="center">
|
<>
|
||||||
<DialogTrigger asChild>
|
<DialogRoot placement="center" key={formData.id} open={isOpen} onOpenChange={({ open }) => setIsOpen(open)}>
|
||||||
<Span>
|
<DialogTrigger asChild>
|
||||||
|
{/* <Span>
|
||||||
<Edit />
|
<Edit />
|
||||||
</Span>
|
</Span> */}
|
||||||
</DialogTrigger>
|
<Button bg="transparent" color={"black"} h={"18px"} onClick={handleOpenModal}><Edit /></Button>
|
||||||
|
</DialogTrigger>
|
||||||
|
|
||||||
<DialogContent
|
<DialogContent
|
||||||
bg={"#fff"}
|
bg={"#fff"}
|
||||||
w={{ base: "90%", md: "400px" }}
|
w={{ base: "90%", md: "400px" }}
|
||||||
height={"80vh"}
|
height={"80vh"}
|
||||||
overflow={"scroll"}
|
overflow={"scroll"}
|
||||||
overflowX="hidden"
|
overflowX="hidden"
|
||||||
p={3} // Reduced padding
|
p={3} // Reduced padding
|
||||||
bgSize={"md"}
|
bgSize={"md"}
|
||||||
>
|
>
|
||||||
<DialogHeader bg="white" p={0}>
|
<DialogHeader bg="white" p={0}>
|
||||||
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
||||||
Edit user Accounts
|
Edit user Accounts
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
|
|
||||||
<DialogBody bg="white">
|
<DialogBody bg="white">
|
||||||
<Stack py={3}>
|
<Stack py={3}>
|
||||||
<Field.Root>
|
<Field.Root>
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
First Name
|
First Name
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
value={formData.first_name}
|
||||||
|
onChange={(e) => setFormData({ ...formData, first_name: e.target.value })}
|
||||||
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
Last Name
|
Last Name
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
value={formData.last_name}
|
||||||
|
onChange={(e) => setFormData({ ...formData, last_name: e.target.value })}
|
||||||
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
Gender
|
Gender
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
value={formData.gender}
|
||||||
|
onChange={(e) => setFormData({ ...formData, gender: e.target.value })}
|
||||||
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
DOB
|
DOB
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
value={formData.date_of_birth ? new Date(formData.date_of_birth).toLocaleDateString('en-GB').replace(/\//g, '-') : 'N/A'}
|
||||||
|
onChange={(e) => setFormData({ ...formData, date_of_birth: e.target.value })}
|
||||||
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
OTP Verified
|
Mobile Number
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
value={formData.phone_number || ''}
|
||||||
|
onChange={(e) => setFormData({ ...formData, phone_number: e.target.value })}
|
||||||
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
|
Type Of User
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
value={formData.principal_type?.principal_type_title || 'N/A'}
|
||||||
|
onChange={(e) => setFormData({ ...formData, principal_type: { ...formData.principal_type, principal_type_title: e.target.value } })}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* <Field.Label color="black" pt={1} fontSize="12px">
|
||||||
Language
|
Language
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
@@ -113,20 +214,20 @@ function EditRegisterUsers() {
|
|||||||
pl={1}
|
pl={1}
|
||||||
fontSize="12px"
|
fontSize="12px"
|
||||||
height="30px"
|
height="30px"
|
||||||
/>
|
/> */}
|
||||||
</Field.Root>
|
</Field.Root>
|
||||||
</Stack>
|
</Stack>
|
||||||
</DialogBody>
|
</DialogBody>
|
||||||
<DialogFooter mt={5}>
|
<DialogFooter mt={5}>
|
||||||
<DialogActionTrigger asChild>
|
<Button rounded={"md"} w={"100%"} size={"sm"} bg={"#02A0A0"} onClick={handleSubmit}>
|
||||||
<Button rounded={"md"} w={"100%"} size={"sm"} bg={"#02A0A0"}>
|
|
||||||
Save
|
Save
|
||||||
</Button>
|
</Button>
|
||||||
</DialogActionTrigger>
|
</DialogFooter>
|
||||||
</DialogFooter>
|
<DialogCloseTrigger color="black" />
|
||||||
<DialogCloseTrigger color="black" />
|
</DialogContent>
|
||||||
</DialogContent>
|
</DialogRoot>
|
||||||
</DialogRoot>
|
<Toaster />
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -119,10 +119,12 @@ const RegisterUsers = () => {
|
|||||||
"Action": (
|
"Action": (
|
||||||
<HStack justifyContent="center">
|
<HStack justifyContent="center">
|
||||||
<EditRegisterUsers
|
<EditRegisterUsers
|
||||||
// rowData={{ id: agency.id, en_name: agency.en_name, country_code: agency.country_code, phonecode: agency.phonecode, capital: agency.capital, currency: agency.currency, currency_name: agency.currency_name, currency_symbol: agency.currency_symbol }}
|
// rowData={{ id: agency.id, en_name: agency.en_name, country_code: agency.country_code, phonecode: agency.phonecode, capital: agency.capital, currency: agency.currency, currency_name: agency.currency_name, currency_symbol: agency.currency_symbol }}
|
||||||
// refetch={refetch}
|
// refetch={refetch}
|
||||||
|
data={agency}
|
||||||
|
refetch={refetch}
|
||||||
/>
|
/>
|
||||||
<ViewRegisterUsers />
|
<ViewRegisterUsers data={agency} />
|
||||||
<Box>
|
<Box>
|
||||||
<Switch
|
<Switch
|
||||||
colorPalette={'teal'}
|
colorPalette={'teal'}
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ import {
|
|||||||
DialogTitle,
|
DialogTitle,
|
||||||
DialogTrigger,
|
DialogTrigger,
|
||||||
} from "../../../components/ui/dialog";
|
} from "../../../components/ui/dialog";
|
||||||
|
import { UserData } from "../../../Redux/Service/manage.user";
|
||||||
|
|
||||||
function ViewRegisterUsers() {
|
function ViewRegisterUsers({ data }: { data: UserData }) {
|
||||||
return (
|
return (
|
||||||
<DialogRoot placement="center">
|
<DialogRoot placement="center">
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild>
|
||||||
@@ -18,13 +19,13 @@ function ViewRegisterUsers() {
|
|||||||
</DialogTrigger>
|
</DialogTrigger>
|
||||||
|
|
||||||
<DialogContent
|
<DialogContent
|
||||||
bg={"#fff"}
|
bg={"#fff"}
|
||||||
w={{ base: '90%', md: '400px' }}
|
w={{ base: '90%', md: '400px' }}
|
||||||
height={'80vh'}
|
height={'80vh'}
|
||||||
overflow={'scroll'}
|
overflow={'scroll'}
|
||||||
overflowX="hidden"
|
overflowX="hidden"
|
||||||
p={3} // Reduced padding
|
p={3} // Reduced padding
|
||||||
bgSize={'md'}
|
bgSize={'md'}
|
||||||
>
|
>
|
||||||
<DialogHeader bg="white">
|
<DialogHeader bg="white">
|
||||||
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
||||||
@@ -39,14 +40,24 @@ function ViewRegisterUsers() {
|
|||||||
First Name
|
First Name
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px"
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
value={data?.first_name || ''}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
Last Name
|
Last Name
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px"
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none" pl={1}
|
||||||
|
fontSize="12px" height="30px"
|
||||||
|
value={data?.last_name || ''}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
@@ -54,6 +65,7 @@ function ViewRegisterUsers() {
|
|||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px"
|
bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px"
|
||||||
|
value={data?.gender || ''}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
@@ -61,21 +73,41 @@ function ViewRegisterUsers() {
|
|||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px"
|
bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px"
|
||||||
|
value={data?.date_of_birth ? new Date(data.date_of_birth).toLocaleDateString('en-GB').replace(/\//g, '-') : 'N/A'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
OTP Verified
|
Mobile Number
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px"
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
value={data?.phone_number || ''}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
|
Type Of User
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
value={data?.principal_type?.principal_type_title || 'N/A'}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/* <Field.Label color="black" pt={1} fontSize="12px">
|
||||||
Language
|
Language
|
||||||
</Field.Label>
|
</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px"
|
bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px"
|
||||||
/>
|
/> */}
|
||||||
</Field.Root>
|
</Field.Root>
|
||||||
</Stack>
|
</Stack>
|
||||||
</DialogBody>
|
</DialogBody>
|
||||||
|
|||||||
@@ -78,35 +78,47 @@ const AgencyMaster = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const filteredData = localData?.filter((agency) =>
|
const filteredData = localData?.filter((agency) =>
|
||||||
agency?.name.toLowerCase().includes(searchTerm.toLowerCase())
|
agency?.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
|
agency?.rc_number.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
|
agency?.state.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
|
agency?.registered_office.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
|
agency?.domain_name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||||
|
agency?.gst_number.toLowerCase().includes(searchTerm.toLowerCase())
|
||||||
);
|
);
|
||||||
|
|
||||||
const managepost = filteredData?.map((agency: any, index: number) => ({
|
const activeCount = filteredData?.filter((a: any) => a.is_active === 1).length ?? 0;
|
||||||
'id': agency.id,
|
|
||||||
"Sr. No": (currentPage - 1) * (data?.data.per_page ?? 0) + index + 1,
|
const managepost = filteredData?.map((agency: any, index: number) => {
|
||||||
"Agency Name": agency.name,
|
const isOnlyActive = activeCount === 1 && agency.is_active === 1;
|
||||||
"RC no.": agency.rc_number,
|
|
||||||
"State": agency.state,
|
return {
|
||||||
"RC Status": agency.rc_status,
|
id: agency.id,
|
||||||
"Registered Office Address": agency.registered_office,
|
"Sr. No": (currentPage - 1) * (data?.data.per_page ?? 0) + index + 1,
|
||||||
"Website/Domain": agency.domain_name,
|
"Agency Name": agency.name,
|
||||||
"GST no.": agency.gst_number,
|
"RC no.": agency.rc_number,
|
||||||
"is_active": agency.is_active,
|
"State": agency.state,
|
||||||
"Action": (
|
"RC Status": agency.rc_status,
|
||||||
<HStack justifyContent="center">
|
"Registered Office Address": agency.registered_office,
|
||||||
<ViewAgencyMaster agency={localData} id={agency.id} />
|
"Website/Domain": agency.domain_name,
|
||||||
{/* <EditAgencyMaster editData={{ id: agency.id, name: agency.name, domain_name: agency.domain_name, gst_number: agency.gst_number, rc_number: agency.rc_number, rc_status: agency.rc_status, registered_office: agency.registered_office, state: agency.state }} refetch={refetch} /> */}
|
"GST no.": agency.gst_number,
|
||||||
<Box>
|
"is_active": agency.is_active,
|
||||||
<Switch
|
Action: (
|
||||||
colorPalette={"teal"}
|
<HStack justifyContent="center">
|
||||||
size={"xs"}
|
<ViewAgencyMaster agency={localData} id={agency.id} />
|
||||||
onChange={() => handleToggle(agency.id.toString(), Number(agency.is_active))}
|
<Box>
|
||||||
checked={Boolean(Number(agency.is_active))}
|
<Switch
|
||||||
/>
|
colorPalette={"teal"}
|
||||||
</Box>
|
size={"xs"}
|
||||||
</HStack>
|
onChange={() => handleToggle(agency.id.toString(), Number(agency.is_active))}
|
||||||
),
|
checked={Boolean(Number(agency.is_active))}
|
||||||
}));
|
disabled={isOnlyActive}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</HStack>
|
||||||
|
),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (data?.data?.data) {
|
if (data?.data?.data) {
|
||||||
@@ -175,7 +187,7 @@ const AgencyMaster = () => {
|
|||||||
}}
|
}}
|
||||||
onPageChange={handlePageChange}
|
onPageChange={handlePageChange}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</MainFrame>
|
</MainFrame>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function ViewAgencyAddModel({ refetch }: { refetch: VoidFunction }) {
|
|||||||
...prev,
|
...prev,
|
||||||
[name]: value,
|
[name]: value,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
console.log("New Data:", formData);
|
console.log("New Data:", formData);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHead
|
|||||||
import { Field, Input, Stack, Text } from "@chakra-ui/react"
|
import { Field, Input, Stack, Text } from "@chakra-ui/react"
|
||||||
import { IoMdAdd } from "react-icons/io"
|
import { IoMdAdd } from "react-icons/io"
|
||||||
import { Button } from "../../../components/ui/button"
|
import { Button } from "../../../components/ui/button"
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { PostCountry, useCreateCountryPostMutation } from "../../../Redux/Service/country.master";
|
import { PostCountry, useCreateCountryPostMutation } from "../../../Redux/Service/country.master";
|
||||||
import { Toaster, toaster } from "../../../components/ui/toaster";
|
import { Toaster, toaster } from "../../../components/ui/toaster";
|
||||||
|
|
||||||
@@ -19,12 +19,26 @@ function CountryAddModel() {
|
|||||||
currency_symbol: '',
|
currency_symbol: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isOpen) {
|
||||||
|
setCountryName({
|
||||||
|
en_name: '',
|
||||||
|
country_code: '',
|
||||||
|
phonecode: '',
|
||||||
|
capital: '',
|
||||||
|
currency: '',
|
||||||
|
currency_name: '',
|
||||||
|
currency_symbol: '',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [isOpen]);
|
||||||
|
|
||||||
const handleOpenModal = () => {
|
const handleOpenModal = () => {
|
||||||
setIsOpen(true); // Open modal when clicking "Add"
|
setIsOpen(true); // Open modal when clicking "Add"
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
if (countryName.en_name === "") {
|
if (countryName.en_name === "" || countryName.country_code === "" || countryName.phonecode === "" || countryName.capital === "" || countryName.currency === "" || countryName.currency_name === "" || countryName.currency_symbol === "") {
|
||||||
toaster.create({
|
toaster.create({
|
||||||
title: "Error",
|
title: "Error",
|
||||||
description: "Input fields cannot be empty",
|
description: "Input fields cannot be empty",
|
||||||
@@ -98,7 +112,7 @@ function CountryAddModel() {
|
|||||||
<Field.Root>
|
<Field.Root>
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">Country</Field.Label>
|
<Field.Label color="black" pt={1} fontSize="12px">Country</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder=""
|
placeholder="Enter Country Name"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
@@ -111,7 +125,7 @@ function CountryAddModel() {
|
|||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">Country Code</Field.Label>
|
<Field.Label color="black" pt={1} fontSize="12px">Country Code</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder=""
|
placeholder="Please enter country code ex: IN, US"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
@@ -124,7 +138,7 @@ function CountryAddModel() {
|
|||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">Phone Code</Field.Label>
|
<Field.Label color="black" pt={1} fontSize="12px">Phone Code</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder=""
|
placeholder="Please enter phone code ex: +91, +1"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
@@ -136,7 +150,7 @@ function CountryAddModel() {
|
|||||||
/>
|
/>
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">Capital</Field.Label>
|
<Field.Label color="black" pt={1} fontSize="12px">Capital</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder=""
|
placeholder="Enter Capital City"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
@@ -148,7 +162,7 @@ function CountryAddModel() {
|
|||||||
/>
|
/>
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">Currency</Field.Label>
|
<Field.Label color="black" pt={1} fontSize="12px">Currency</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder=""
|
placeholder="Enter Currency"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
@@ -160,7 +174,7 @@ function CountryAddModel() {
|
|||||||
/>
|
/>
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">Currency name</Field.Label>
|
<Field.Label color="black" pt={1} fontSize="12px">Currency name</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder=""
|
placeholder="Enter Currency Name"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
@@ -172,7 +186,7 @@ function CountryAddModel() {
|
|||||||
/>
|
/>
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">Currency Symbol</Field.Label>
|
<Field.Label color="black" pt={1} fontSize="12px">Currency Symbol</Field.Label>
|
||||||
<Input
|
<Input
|
||||||
placeholder=""
|
placeholder="Enter Currency Symbol"
|
||||||
bgColor="#EEEEEE"
|
bgColor="#EEEEEE"
|
||||||
color="black"
|
color="black"
|
||||||
border="none"
|
border="none"
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { useState } from "react";
|
|||||||
// import { FaRegEdit } from "react-icons/fa";
|
// import { FaRegEdit } from "react-icons/fa";
|
||||||
import Edit from "../../../components/ActionIcons/Edit";
|
import Edit from "../../../components/ActionIcons/Edit";
|
||||||
import { Toaster, toaster } from "../../../components/ui/toaster";
|
import { Toaster, toaster } from "../../../components/ui/toaster";
|
||||||
import { Template } from "../../../Redux/Service/template.master.service";
|
// import { Template } from "../../../Redux/Service/template.master.service";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
const IMGURL = import.meta.env.VITE_IMG_TEMPLATES
|
const IMGURL = import.meta.env.VITE_IMG_TEMPLATES
|
||||||
@@ -33,10 +33,10 @@ function EditTemplateModel({ id, localData, refetch }: { id: number, localData:
|
|||||||
// const [objectURLs, setObjectURLs] = useState<string[]>([]); // Store object URLs separately
|
// const [objectURLs, setObjectURLs] = useState<string[]>([]); // Store object URLs separately
|
||||||
// const [updateTemplateMaster] = useUpdateTemplateMasterMutation()
|
// const [updateTemplateMaster] = useUpdateTemplateMasterMutation()
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const [selectedTemplate, setSelectedTemplate] = useState<Template | null>(null);
|
// const [selectedTemplate, setSelectedTemplate] = useState<Template | null>(null);
|
||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
|
|
||||||
console.log(selectedTemplate);
|
console.log(images);
|
||||||
|
|
||||||
const handleImageChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleImageChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
if (event.target.files) {
|
if (event.target.files) {
|
||||||
@@ -57,7 +57,7 @@ function EditTemplateModel({ id, localData, refetch }: { id: number, localData:
|
|||||||
const handleOpenModal = () => {
|
const handleOpenModal = () => {
|
||||||
const template = localData?.find((item: any) => item.id === id);
|
const template = localData?.find((item: any) => item.id === id);
|
||||||
if (template) {
|
if (template) {
|
||||||
setSelectedTemplate(template);
|
// setSelectedTemplate(template);
|
||||||
setTitle(template.post_template_translate.length > 0 ? template.post_template_translate[0].title : "");
|
setTitle(template.post_template_translate.length > 0 ? template.post_template_translate[0].title : "");
|
||||||
setSubTitle(template.post_template_translate.length > 0 ? template.post_template_translate[0].sub_title : "");
|
setSubTitle(template.post_template_translate.length > 0 ? template.post_template_translate[0].sub_title : "");
|
||||||
setUserType(template.principle_type_xid?.toString() || "");
|
setUserType(template.principle_type_xid?.toString() || "");
|
||||||
@@ -90,9 +90,9 @@ function EditTemplateModel({ id, localData, refetch }: { id: number, localData:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newImages = images.filter((image) => image instanceof File);
|
// const newImages = images.filter((image) => image instanceof File);
|
||||||
|
|
||||||
if (newImages.length === 0) {
|
if (images.length === 0) {
|
||||||
toaster.create({
|
toaster.create({
|
||||||
title: "Error",
|
title: "Error",
|
||||||
description: "Please upload at least one image.",
|
description: "Please upload at least one image.",
|
||||||
@@ -107,8 +107,10 @@ function EditTemplateModel({ id, localData, refetch }: { id: number, localData:
|
|||||||
formData.append("title", title);
|
formData.append("title", title);
|
||||||
formData.append("sub_title", subTitle);
|
formData.append("sub_title", subTitle);
|
||||||
|
|
||||||
newImages.forEach((image, index) => {
|
images.forEach((image, index) => {
|
||||||
formData.append(`image_name[${index}]`, image, image.name);
|
if (image instanceof File) {
|
||||||
|
formData.append(`image_name[${index}]`, image, image.name);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Box, Field, Input, Stack, Text } from "@chakra-ui/react"
|
|||||||
import { IoMdAdd } from "react-icons/io"
|
import { IoMdAdd } from "react-icons/io"
|
||||||
import { Button } from "../../../components/ui/button"
|
import { Button } from "../../../components/ui/button"
|
||||||
import { FiUpload } from "react-icons/fi";
|
import { FiUpload } from "react-icons/fi";
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
// import { useCreateTemplatePostMutation } from "../../../Redux/Service/template.master.service";
|
// import { useCreateTemplatePostMutation } from "../../../Redux/Service/template.master.service";
|
||||||
import { Toaster, toaster } from "../../../components/ui/toaster"
|
import { Toaster, toaster } from "../../../components/ui/toaster"
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
@@ -18,11 +18,21 @@ function TemplateAddModel({ refetch }: { refetch: VoidFunction }) {
|
|||||||
// const [createTemplatePost] = useCreateTemplatePostMutation()
|
// const [createTemplatePost] = useCreateTemplatePostMutation()
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
const token = localStorage.getItem("token");
|
const token = localStorage.getItem("token");
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isOpen) {
|
||||||
|
setTitle("");
|
||||||
|
setSubTitle("");
|
||||||
|
setUserType("");
|
||||||
|
setImages([]);
|
||||||
|
}
|
||||||
|
}, [isOpen]);
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
console.error("No token found in localStorage!");
|
console.error("No token found in localStorage!");
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleOpenModal = () => {
|
const handleOpenModal = () => {
|
||||||
setIsOpen(true); // Open modal when clicking "Add"
|
setIsOpen(true); // Open modal when clicking "Add"
|
||||||
};
|
};
|
||||||
@@ -112,7 +122,7 @@ function TemplateAddModel({ refetch }: { refetch: VoidFunction }) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// console.log("Token stored:", window.localStorage.getItem("token"));
|
// console.log("Token stored:", window.localStorage.getItem("token"))
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const APIURL = import.meta.env.VITE_IMG_TEMPLATES
|
|||||||
const tableHeadRow = [
|
const tableHeadRow = [
|
||||||
"Sr. No",
|
"Sr. No",
|
||||||
"Title",
|
"Title",
|
||||||
|
"User Type",
|
||||||
"Images",
|
"Images",
|
||||||
"Action"
|
"Action"
|
||||||
];
|
];
|
||||||
@@ -92,11 +93,12 @@ const TemplateMaster = () => {
|
|||||||
"Title": agency.post_template_translate.length > 0
|
"Title": agency.post_template_translate.length > 0
|
||||||
? agency.post_template_translate[0].title
|
? agency.post_template_translate[0].title
|
||||||
: "N/A",
|
: "N/A",
|
||||||
|
"User Type": agency.principle_type_xid === 2 ? 'Recruiter' : 'Job Seeker',
|
||||||
"Images": (
|
"Images": (
|
||||||
// <Image w={50} src={img} />
|
// <Image w={50} src={img} />
|
||||||
<HStack key={agency.id}>
|
<HStack key={agency.id}>
|
||||||
{agency.post_template_image.map((img) => (
|
{agency.post_template_image.map((img) => (
|
||||||
<Image rounded={'lg'} w={100} h={50} src={`${APIURL}${img.image_name}`} />
|
<Image key={img.id} rounded={'lg'} w={100} h={50} src={`${APIURL}${img.image_name}`} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{/* <Image rounded={'lg'} w={100} h={50} src={Templateimg} /> */}
|
{/* <Image rounded={'lg'} w={100} h={50} src={Templateimg} /> */}
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ const WorkspaceMode = () => {
|
|||||||
const managepost = filteredData?.map((agency: any, index: number) => ({
|
const managepost = filteredData?.map((agency: any, index: number) => ({
|
||||||
'id': agency.id,
|
'id': agency.id,
|
||||||
"Sr. No": (currentPage - 1) * (data?.data.per_page ?? 0) + index + 1,
|
"Sr. No": (currentPage - 1) * (data?.data.per_page ?? 0) + index + 1,
|
||||||
"Title": agency.en_name,
|
"Title": agency.en_name.length > 12
|
||||||
|
? agency.en_name.slice(0, 12) + '...'
|
||||||
|
: agency.en_name,
|
||||||
"is_active": agency.is_active,
|
"is_active": agency.is_active,
|
||||||
"Action": (
|
"Action": (
|
||||||
<HStack justifyContent="center">
|
<HStack justifyContent="center">
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Center,
|
Center,
|
||||||
HStack,
|
HStack,
|
||||||
IconButton,
|
IconButton,
|
||||||
Image,
|
Image,
|
||||||
Input,
|
Input,
|
||||||
Stack,
|
Stack,
|
||||||
Text,
|
Text,
|
||||||
VStack,
|
VStack,
|
||||||
} from "@chakra-ui/react";
|
} from "@chakra-ui/react";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
@@ -19,154 +19,179 @@ import { InputGroup } from "../components/ui/input-group";
|
|||||||
import { LuEye, LuEyeOff } from "react-icons/lu";
|
import { LuEye, LuEyeOff } from "react-icons/lu";
|
||||||
|
|
||||||
const SetNewPassword = () => {
|
const SetNewPassword = () => {
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [confirmPassword, setConfirmPassword] = useState("");
|
const [confirmPassword, setConfirmPassword] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const queryParams = new URLSearchParams(window.location.search);
|
const queryParams = new URLSearchParams(window.location.search);
|
||||||
const id = queryParams.get("id");
|
const id = queryParams.get("id");
|
||||||
const [showOldPassword, setShowOldPassword] = useState(false);
|
const [showOldPassword, setShowOldPassword] = useState(false);
|
||||||
const [showNewPassword, setShowNewPassword] = useState(false);
|
const [showNewPassword, setShowNewPassword] = useState(false);
|
||||||
|
|
||||||
const handlePasswordSubmit = async () => {
|
const handlePasswordSubmit = async () => {
|
||||||
// Validation
|
// Validation
|
||||||
if (password.length < 8) {
|
if (password.length < 8) {
|
||||||
toaster.create({
|
toaster.create({
|
||||||
title: "Password must be at least 8 characters long",
|
title: "Password must be at least 8 characters long",
|
||||||
type: "error",
|
type: "error",
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (password !== confirmPassword) {
|
||||||
|
toaster.create({
|
||||||
|
title: "Passwords do not match",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsLoading(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await axios.post(
|
||||||
|
`${import.meta.env.VITE_API_URL}/update-password`,
|
||||||
|
{
|
||||||
|
password: password,
|
||||||
|
confirm_password: confirmPassword,
|
||||||
|
id: Number(id),
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
|
||||||
if (password !== confirmPassword) {
|
if (res.data.status === "success") {
|
||||||
toaster.create({
|
toaster.create({
|
||||||
title: "Passwords do not match",
|
title: "Password updated successfully",
|
||||||
type: "error",
|
type: "success",
|
||||||
});
|
});
|
||||||
return;
|
navigate("/login"); // Redirect to login page
|
||||||
}
|
} else {
|
||||||
|
toaster.create({
|
||||||
|
title: res.data.message || "Failed to update password",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error: any) {
|
||||||
|
toaster.create({
|
||||||
|
title: error.response?.data?.message || "Something went wrong",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
setIsLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
setIsLoading(true);
|
return (
|
||||||
|
<VStack w="100%" h="100vh" bg="#ffffff">
|
||||||
|
<HStack
|
||||||
|
boxShadow="rgba(99, 99, 99, 0.2) 0px 2px 8px 0px"
|
||||||
|
w="100%"
|
||||||
|
ps={8}
|
||||||
|
h="7%"
|
||||||
|
justifyContent="flex-start"
|
||||||
|
>
|
||||||
|
<Image w={50} src={logo} />
|
||||||
|
</HStack>
|
||||||
|
|
||||||
try {
|
<Center w="100%" h="93%" p={8}>
|
||||||
const res = await axios.post(`${import.meta.env.VITE_API_URL}/update-password`, {
|
<Box p={8} borderWidth={1} borderRadius="lg" boxShadow="lg" w={"400px"}>
|
||||||
password: password,
|
<Text
|
||||||
confirm_password: confirmPassword,
|
fontSize="20px"
|
||||||
id: Number(id)
|
fontWeight="bold"
|
||||||
});
|
color="#313039"
|
||||||
|
marginBottom={"20px"}
|
||||||
|
>
|
||||||
|
Create a Password
|
||||||
|
</Text>
|
||||||
|
|
||||||
if (res.data.status === 'success') {
|
<Stack>
|
||||||
toaster.create({
|
<Box mb={3}>
|
||||||
title: "Password updated successfully",
|
<Text color="black" fontSize="12px" mb={2}>
|
||||||
type: "success",
|
New password
|
||||||
});
|
</Text>
|
||||||
navigate("/login"); // Redirect to login page
|
<InputGroup
|
||||||
} else {
|
width={"100%"}
|
||||||
toaster.create({
|
endElement={
|
||||||
title: res.data.message || "Failed to update password",
|
<IconButton
|
||||||
type: "error",
|
aria-label={
|
||||||
});
|
showOldPassword ? "Hide password" : "Show password"
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
size="sm"
|
||||||
toaster.create({
|
onClick={() => setShowOldPassword(!showOldPassword)}
|
||||||
title: error.response?.data?.message || "Something went wrong",
|
// _hover={{ bg: "transparent" }}
|
||||||
type: "error",
|
bg={"transparent"}
|
||||||
});
|
color={"#000"}
|
||||||
} finally {
|
height={"fit-content"}
|
||||||
setIsLoading(false);
|
mr={2}
|
||||||
}
|
>
|
||||||
};
|
{showOldPassword ? <LuEye /> : <LuEyeOff />}
|
||||||
|
</IconButton>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
color="black"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
type={showOldPassword ? "password" : "text"}
|
||||||
|
border="1px solid grey"
|
||||||
|
value={password}
|
||||||
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
|
size={"sm"}
|
||||||
|
/>
|
||||||
|
</InputGroup>
|
||||||
|
</Box>
|
||||||
|
|
||||||
return (
|
<Box>
|
||||||
<VStack w="100%" h="100vh" bg="#ffffff">
|
<Text color="black" mb={2} fontSize="12px">
|
||||||
<HStack
|
Confirm password
|
||||||
boxShadow="rgba(99, 99, 99, 0.2) 0px 2px 8px 0px"
|
</Text>
|
||||||
w="100%"
|
<InputGroup
|
||||||
ps={8}
|
width={"100%"}
|
||||||
h="7%"
|
endElement={
|
||||||
justifyContent="flex-start"
|
<IconButton
|
||||||
>
|
aria-label={
|
||||||
<Image w={50} src={logo} />
|
showNewPassword ? "Hide password" : "Show password"
|
||||||
</HStack>
|
}
|
||||||
|
size="sm"
|
||||||
|
// variant="outline"
|
||||||
|
onClick={() => setShowNewPassword(!showNewPassword)}
|
||||||
|
bg={"transparent"}
|
||||||
|
color={"#000"}
|
||||||
|
mr={2}
|
||||||
|
>
|
||||||
|
{showNewPassword ? <LuEye /> : <LuEyeOff />}
|
||||||
|
</IconButton>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
color="black"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
type={showNewPassword ? "password" : "text"}
|
||||||
|
border="1px solid grey"
|
||||||
|
value={confirmPassword}
|
||||||
|
onChange={(e) => setConfirmPassword(e.target.value)}
|
||||||
|
size={"sm"}
|
||||||
|
/>
|
||||||
|
</InputGroup>
|
||||||
|
</Box>
|
||||||
|
</Stack>
|
||||||
|
|
||||||
<Center w="100%" h="93%" p={8}>
|
<Button
|
||||||
<Box p={8} borderWidth={1} borderRadius="lg" boxShadow="lg">
|
loading={isLoading}
|
||||||
<Text fontSize="24px" fontWeight="bold" color="#313039" textAlign="center">
|
mt={6}
|
||||||
Create a Password
|
w="100%"
|
||||||
</Text>
|
bg="#02A0A0"
|
||||||
|
color="white"
|
||||||
|
onClick={handlePasswordSubmit}
|
||||||
|
>
|
||||||
|
Confirm Password
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Center>
|
||||||
|
|
||||||
<Stack p={2}>
|
<Toaster />
|
||||||
<Text color="black" pt={1} fontSize="12px">New password</Text>
|
</VStack>
|
||||||
<InputGroup
|
);
|
||||||
width={'100%'}
|
|
||||||
endElement={
|
|
||||||
<IconButton
|
|
||||||
aria-label={showOldPassword ? "Hide password" : "Show password"}
|
|
||||||
size="sm"
|
|
||||||
// variant="outline"
|
|
||||||
onClick={() => setShowOldPassword(!showOldPassword)}
|
|
||||||
_hover={{ bg: "transparent" }}
|
|
||||||
height={'fit-content'}
|
|
||||||
mr={2}
|
|
||||||
>
|
|
||||||
{showOldPassword ? <LuEye /> : <LuEyeOff />}
|
|
||||||
</IconButton>
|
|
||||||
}>
|
|
||||||
<Input
|
|
||||||
color="black"
|
|
||||||
pl={1}
|
|
||||||
fontSize="12px"
|
|
||||||
type={showOldPassword ? "password" : "text"}
|
|
||||||
border="1px solid grey"
|
|
||||||
value={password}
|
|
||||||
onChange={(e) => setPassword(e.target.value)}
|
|
||||||
/>
|
|
||||||
</InputGroup>
|
|
||||||
|
|
||||||
<Text color="black" pt={1} fontSize="12px">Confirm password</Text>
|
|
||||||
<InputGroup
|
|
||||||
width={'100%'}
|
|
||||||
endElement={
|
|
||||||
<IconButton
|
|
||||||
aria-label={showNewPassword ? "Hide password" : "Show password"}
|
|
||||||
size="sm"
|
|
||||||
// variant="outline"
|
|
||||||
onClick={() => setShowNewPassword(!showNewPassword)}
|
|
||||||
_hover={{ bg: "transparent" }}
|
|
||||||
height={'fit-content'}
|
|
||||||
mr={2}
|
|
||||||
>
|
|
||||||
{showNewPassword ? <LuEye /> : <LuEyeOff />}
|
|
||||||
</IconButton>
|
|
||||||
}>
|
|
||||||
<Input
|
|
||||||
color="black"
|
|
||||||
pl={1}
|
|
||||||
fontSize="12px"
|
|
||||||
type={showNewPassword ? "password" : "text"}
|
|
||||||
border="1px solid grey"
|
|
||||||
value={confirmPassword}
|
|
||||||
onChange={(e) => setConfirmPassword(e.target.value)}
|
|
||||||
/>
|
|
||||||
</InputGroup>
|
|
||||||
</Stack>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
loading={isLoading}
|
|
||||||
mt={6}
|
|
||||||
w="100%"
|
|
||||||
bg="#02A0A0"
|
|
||||||
color="white"
|
|
||||||
onClick={handlePasswordSubmit}
|
|
||||||
>
|
|
||||||
Confirm Password
|
|
||||||
</Button>
|
|
||||||
</Box>
|
|
||||||
</Center>
|
|
||||||
|
|
||||||
<Toaster />
|
|
||||||
</VStack>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SetNewPassword;
|
export default SetNewPassword;
|
||||||
|
|||||||
@@ -1,80 +1,233 @@
|
|||||||
import { Button } from "../../components/ui/button"
|
import { Button } from "../../components/ui/button";
|
||||||
import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHeader, DialogRoot, DialogTitle, DialogTrigger } from "../../components/ui/dialog"
|
import {
|
||||||
import { Field, Grid, Heading, Input, Stack, Text } from "@chakra-ui/react"
|
DialogBody,
|
||||||
import { IoMdAdd } from "react-icons/io"
|
DialogCloseTrigger,
|
||||||
import { Checkbox } from "../../components/ui/checkbox"
|
DialogContent,
|
||||||
|
DialogFooter,
|
||||||
|
DialogHeader,
|
||||||
|
DialogRoot,
|
||||||
|
DialogTitle,
|
||||||
|
DialogTrigger,
|
||||||
|
} from "../../components/ui/dialog";
|
||||||
|
import { Field, Grid, Heading, Input, Stack, Text } from "@chakra-ui/react";
|
||||||
|
import { IoMdAdd } from "react-icons/io";
|
||||||
|
import { Checkbox } from "../../components/ui/checkbox";
|
||||||
|
import { useCreateSubAdminPostMutation } from "../../Redux/Service/manage.subadmin.service";
|
||||||
|
import { toaster } from "../../components/ui/toaster";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
function AddModel() {
|
function AddModel({ refetch }: { refetch: VoidFunction }) {
|
||||||
return (
|
const [createSubAdminPost] = useCreateSubAdminPostMutation();
|
||||||
|
|
||||||
<DialogRoot placement="center">
|
// State fields
|
||||||
<DialogTrigger asChild>
|
const [firstName, setFirstName] = useState("");
|
||||||
{/* <Button bg={"transparent"} size="sm">
|
const [lastName, setLastName] = useState("");
|
||||||
<MdOutlineRemoveRedEye style={{ cursor: "pointer", fontSize: "16px" }} />
|
const [userName, setUserName] = useState("");
|
||||||
</Button> */}
|
const [dateOfBirth, setDateOfBirth] = useState("");
|
||||||
<Button rounded={'md'} px={4} py={2} size={"xs"} bg={"#02A0A0"}><IoMdAdd /> Add</Button>
|
const [gender, setGender] = useState("");
|
||||||
|
// const [ setIsOpen] = useState(false);
|
||||||
|
|
||||||
</DialogTrigger>
|
const handleSubmit = async () => {
|
||||||
|
if (
|
||||||
|
!firstName.trim() ||
|
||||||
|
!lastName.trim() ||
|
||||||
|
!userName.trim() ||
|
||||||
|
!dateOfBirth.trim() ||
|
||||||
|
!gender.trim()
|
||||||
|
) {
|
||||||
|
toaster.create({
|
||||||
|
title: "Error",
|
||||||
|
description: "Please fill in all required fields",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
<DialogContent
|
const payload = {
|
||||||
bg={"#fff"}
|
principal_type_xid: 4,
|
||||||
// w={{ lg: "60%", md: "230px" }}
|
principal_source_xid: 1,
|
||||||
w={{ base: '90%', md: '400px' }}
|
user_name: userName,
|
||||||
height={'80vh'}
|
first_name: firstName,
|
||||||
overflow={'scroll'}
|
last_name: lastName,
|
||||||
overflowX="hidden"
|
date_of_birth: dateOfBirth,
|
||||||
p={3} // Reduced padding
|
gender: gender,
|
||||||
bgSize={'md'}
|
email_address: "example@yopmail.com", // Hardcoded
|
||||||
>
|
phone_number: "9876543210", // Hardcoded
|
||||||
<DialogHeader bg="white" >
|
created_by: 1,
|
||||||
<DialogTitle alignSelf="center" color="black" fontSize="14px"
|
};
|
||||||
>Add Sub Admin Account</DialogTitle>
|
|
||||||
</DialogHeader>
|
|
||||||
|
|
||||||
<DialogBody bg="white">
|
try {
|
||||||
<Stack py={3} >
|
const response = await createSubAdminPost(payload).unwrap();
|
||||||
|
if (response) {
|
||||||
|
toaster.create({
|
||||||
|
title: "Success",
|
||||||
|
description: "Sub-admin created successfully",
|
||||||
|
type: "success",
|
||||||
|
});
|
||||||
|
refetch();
|
||||||
|
// setIsOpen(false);
|
||||||
|
setFirstName("");
|
||||||
|
setLastName("");
|
||||||
|
setUserName("");
|
||||||
|
setDateOfBirth("");
|
||||||
|
setGender("");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error creating sub-admin:", error);
|
||||||
|
toaster.create({
|
||||||
|
title: "Error",
|
||||||
|
description: "Failed to create sub-admin",
|
||||||
|
type: "error",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
<Field.Root>
|
return (
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">First Name</Field.Label>
|
<DialogRoot placement="center">
|
||||||
<Input placeholder="Enter the First Name" bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px" />
|
<DialogTrigger asChild>
|
||||||
|
<Button rounded={"md"} px={4} py={2} size={"xs"} bg={"#02A0A0"}>
|
||||||
|
<IoMdAdd /> Add
|
||||||
|
</Button>
|
||||||
|
</DialogTrigger>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">Last Name</Field.Label>
|
<DialogContent
|
||||||
<Input placeholder="Enter the Last Name" bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px" />
|
bg={"#fff"}
|
||||||
|
w={{ base: "90%", md: "400px" }}
|
||||||
|
height={"80vh"}
|
||||||
|
overflow={"scroll"}
|
||||||
|
overflowX="hidden"
|
||||||
|
p={3}
|
||||||
|
bgSize={"md"}
|
||||||
|
>
|
||||||
|
<DialogHeader bg="white">
|
||||||
|
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
||||||
|
Add Sub Admin Account
|
||||||
|
</DialogTitle>
|
||||||
|
</DialogHeader>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">DOB</Field.Label>
|
<DialogBody bg="white">
|
||||||
<Input placeholder="Enter the DOB" bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px" />
|
<Stack py={3}>
|
||||||
|
<Field.Root>
|
||||||
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
|
First Name
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter the First Name"
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
value={firstName}
|
||||||
|
onChange={(e) => setFirstName(e.target.value)}
|
||||||
|
/>
|
||||||
|
|
||||||
<Field.Label color="black" pt={1} fontSize="12px">Gender</Field.Label>
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
<Input placeholder="Enter the Gender" bgColor="#EEEEEE" color="black" border="none" pl={1} fontSize="12px" height="30px" />
|
Last Name
|
||||||
<Heading mt={5} color={'#000'} fontSize={'sm'}>Permissions</Heading>
|
</Field.Label>
|
||||||
</Field.Root>
|
<Input
|
||||||
<Grid templateColumns="repeat(2, 1fr)" gap={4}>
|
placeholder="Enter the Last Name"
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>Dashboard</Text></Checkbox>
|
bgColor="#EEEEEE"
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>Manage contact us</Text></Checkbox>
|
color="black"
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>manage User</Text></Checkbox>
|
border="none"
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>Manage CMS</Text></Checkbox>
|
pl={1}
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>Manage Post</Text></Checkbox>
|
fontSize="12px"
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>Manage Reports</Text></Checkbox>
|
height="30px"
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>manage Sub-Admin</Text></Checkbox>
|
value={lastName}
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>My profile</Text></Checkbox>
|
onChange={(e) => setLastName(e.target.value)}
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>Manage Jobs</Text> </Checkbox>
|
/>
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}> manage feedbacks</Text></Checkbox>
|
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}>Manage community</Text> </Checkbox>
|
|
||||||
<Checkbox size={'sm'} color={"black"} ><Text fontSize={12}> Notification</Text></Checkbox>
|
|
||||||
</Grid>
|
|
||||||
</Stack>
|
|
||||||
</DialogBody>
|
|
||||||
<DialogFooter display="flex" justifyContent="center" pt={"2"}>
|
|
||||||
<Button size={'xs'} w="100%" bg="#02A0A0" color={"#fff"}>
|
|
||||||
Save
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
|
|
||||||
<DialogCloseTrigger color="black" />
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
</DialogContent>
|
Username
|
||||||
</DialogRoot >
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter the Username"
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
value={userName}
|
||||||
|
onChange={(e) => setUserName(e.target.value)}
|
||||||
|
/>
|
||||||
|
|
||||||
)
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
|
DOB
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter the DOB"
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
type="date"
|
||||||
|
value={dateOfBirth}
|
||||||
|
onChange={(e) => setDateOfBirth(e.target.value)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Field.Label color="black" pt={1} fontSize="12px">
|
||||||
|
Gender
|
||||||
|
</Field.Label>
|
||||||
|
<Input
|
||||||
|
placeholder="Enter the Gender"
|
||||||
|
bgColor="#EEEEEE"
|
||||||
|
color="black"
|
||||||
|
border="none"
|
||||||
|
pl={1}
|
||||||
|
fontSize="12px"
|
||||||
|
height="30px"
|
||||||
|
value={gender}
|
||||||
|
onChange={(e) => setGender(e.target.value)}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Heading mt={5} color={"#000"} fontSize={"sm"}>
|
||||||
|
Permissions
|
||||||
|
</Heading>
|
||||||
|
</Field.Root>
|
||||||
|
|
||||||
|
<Grid templateColumns="repeat(2, 1fr)" gap={4}>
|
||||||
|
{[
|
||||||
|
"Dashboard",
|
||||||
|
"Manage contact us",
|
||||||
|
"manage User",
|
||||||
|
"Manage CMS",
|
||||||
|
"Manage Post",
|
||||||
|
"Manage Reports",
|
||||||
|
"manage Sub-Admin",
|
||||||
|
"My profile",
|
||||||
|
"Manage Jobs",
|
||||||
|
"manage feedbacks",
|
||||||
|
"Manage community",
|
||||||
|
"Notification",
|
||||||
|
].map((permission) => (
|
||||||
|
<Checkbox size="sm" color="black" key={permission}>
|
||||||
|
<Text fontSize={12}>{permission}</Text>
|
||||||
|
</Checkbox>
|
||||||
|
))}
|
||||||
|
</Grid>
|
||||||
|
</Stack>
|
||||||
|
</DialogBody>
|
||||||
|
|
||||||
|
<DialogFooter display="flex" justifyContent="center" pt={"2"}>
|
||||||
|
<Button
|
||||||
|
size={"xs"}
|
||||||
|
w="100%"
|
||||||
|
bg="#02A0A0"
|
||||||
|
color={"#fff"}
|
||||||
|
onClick={handleSubmit}
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
|
||||||
|
<DialogCloseTrigger color="black" />
|
||||||
|
</DialogContent>
|
||||||
|
</DialogRoot>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default AddModel
|
export default AddModel;
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ const SubAdmin = () => {
|
|||||||
/>
|
/>
|
||||||
</InputGroup>
|
</InputGroup>
|
||||||
{/* <Button bgColor={'#EEEEEE'} pl={3} pr={3}><IoMdAdd /> <Text>Add</Text></Button> */}
|
{/* <Button bgColor={'#EEEEEE'} pl={3} pr={3}><IoMdAdd /> <Text>Add</Text></Button> */}
|
||||||
<AddModel />
|
<AddModel refetch={refetch}/>
|
||||||
</HStack>
|
</HStack>
|
||||||
</HStack>
|
</HStack>
|
||||||
<DataTable
|
<DataTable
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function ViewSubAdmin({ id }: { id: number }) {
|
|||||||
const handleView = () => {
|
const handleView = () => {
|
||||||
trigger(id)
|
trigger(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
const viewSubAdmin = data?.data
|
const viewSubAdmin = data?.data
|
||||||
|
|
||||||
const formatDateOfBirth = (dob: string): string => {
|
const formatDateOfBirth = (dob: string): string => {
|
||||||
|
|||||||
@@ -99,3 +99,4 @@ export const {
|
|||||||
useAgencyMasterToggleMutation,
|
useAgencyMasterToggleMutation,
|
||||||
useUpdateAgencyMasterMutation,
|
useUpdateAgencyMasterMutation,
|
||||||
} = agencyMasterModule;
|
} = agencyMasterModule;
|
||||||
|
|
||||||
@@ -1,26 +1,30 @@
|
|||||||
import { createApi } from "@reduxjs/toolkit/query";
|
import { createApi } from "@reduxjs/toolkit/query/react"; // add /react for auto-generated hooks
|
||||||
import { baseQueryWithReauth } from "./apiSlice";
|
import { baseQueryWithReauth } from "./apiSlice";
|
||||||
|
|
||||||
|
interface DeactivatedData {
|
||||||
|
id: number;
|
||||||
|
email: string;
|
||||||
|
first_name: string;
|
||||||
|
created_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ApiResponse {
|
||||||
|
data: {
|
||||||
|
data: DeactivatedData[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export const deactivatedAccounts = createApi({
|
export const deactivatedAccounts = createApi({
|
||||||
reducerPath: "deactivatedAccounts",
|
reducerPath: "deactivatedAccounts",
|
||||||
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
baseQuery: baseQueryWithReauth,
|
||||||
endpoints: (builder) => ({
|
tagTypes: ["Deactivated"],
|
||||||
|
endpoints: (builder) => ({
|
||||||
|
getContact: builder.query<ApiResponse, void>({
|
||||||
|
query: () => "/manage-user-deactivate-list",
|
||||||
getPosts: builder.query<Post[], void>({ query: () => "/posts" }),
|
providesTags: ["Deactivated"],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}),
|
}),
|
||||||
});
|
}),
|
||||||
|
});
|
||||||
export const { } = deactivatedAccounts;
|
|
||||||
|
// ✅ Export the auto-generated hook
|
||||||
export type Post = {
|
export const { useGetContactQuery } = deactivatedAccounts;
|
||||||
id: number;
|
|
||||||
title: string;
|
|
||||||
body: string;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ export const faqs = createApi({
|
|||||||
body: { id, is_active },
|
body: { id, is_active },
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
||||||
deleteFaqPost: builder.mutation<{ status: string; message: string }, { id: number }>({
|
deleteFaqPost: builder.mutation<{ status: string; message: string }, { id: number }>({
|
||||||
query: ({ id }) => ({
|
query: ({ id }) => ({
|
||||||
|
|||||||
@@ -1,26 +1,33 @@
|
|||||||
import { createApi } from "@reduxjs/toolkit/query";
|
import { createApi } from "@reduxjs/toolkit/query/react";
|
||||||
import { baseQueryWithReauth } from "./apiSlice";
|
import { baseQueryWithReauth } from "./apiSlice";
|
||||||
|
|
||||||
|
interface ContactData {
|
||||||
|
id: number;
|
||||||
|
email: string;
|
||||||
|
first_name: string;
|
||||||
|
created_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ApiResponse {
|
||||||
|
data: {
|
||||||
|
data: ContactData[];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
export const manageContactUs = createApi({
|
export const manageContactUs = createApi({
|
||||||
reducerPath: "manageContactUs",
|
reducerPath: "manageContactUs",
|
||||||
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
||||||
endpoints: (builder) => ({
|
tagTypes: ["Contact"],
|
||||||
|
endpoints: (builder) => ({
|
||||||
|
|
||||||
|
|
||||||
getPosts: builder.query<Post[], void>({ query: () => "/posts" }),
|
getContact: builder.query<ApiResponse, void>({
|
||||||
|
query: () => "/contact-us",
|
||||||
|
providesTags: ["Contact"],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}),
|
}),
|
||||||
});
|
|
||||||
|
|
||||||
export const { } = manageContactUs;
|
}),
|
||||||
|
});
|
||||||
export type Post = {
|
|
||||||
id: number;
|
export const { useGetContactQuery } = manageContactUs;
|
||||||
title: string;
|
|
||||||
body: string;
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export interface CountryEdit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export type PostJobStatus = {
|
export type PostJobStatus = {
|
||||||
title: string
|
title: string
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -70,15 +70,27 @@ export const manageJobs = createApi({
|
|||||||
reducerPath: "manageJobs",
|
reducerPath: "manageJobs",
|
||||||
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
||||||
endpoints: (builder) => ({
|
endpoints: (builder) => ({
|
||||||
|
|
||||||
getManageJobs: builder.query<ApiResponse, number>({
|
getManageJobs: builder.query<ApiResponse, number>({
|
||||||
query: (page = 1) => `/manage-jobs-list?page=${page}`,
|
query: (page = 1) => `/manage-jobs-list?page=${page}`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
viewJobs: builder.query<ApiResponse, number>({
|
||||||
|
query: (id) => `/manage-jobs-list/${id}`,
|
||||||
|
}),
|
||||||
|
|
||||||
|
deleteJobsPost: builder.mutation<{ status: string; message: string }, { id: number }>({
|
||||||
|
query: ({ id }) => ({
|
||||||
|
url: `/manage-jobs-delete`,
|
||||||
|
method: "POST",
|
||||||
|
body: { id },
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const { useGetManageJobsQuery } = manageJobs;
|
export const { useGetManageJobsQuery,useLazyViewJobsQuery,useDeleteJobsPostMutation } = manageJobs;
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ interface ApiResponse {
|
|||||||
data: PaginatedData;
|
data: PaginatedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// export type SubAdminPost = {
|
// export type SubAdminPost = {
|
||||||
// id: number;
|
// id: number;
|
||||||
// first_name: string,
|
// first_name: string,
|
||||||
@@ -80,12 +79,32 @@ interface SubAdminView {
|
|||||||
data: SubAdmin[];
|
data: SubAdmin[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface CreateSubAdminPayload {
|
||||||
|
principal_type_xid: number;
|
||||||
|
principal_source_xid: number;
|
||||||
|
user_name: string;
|
||||||
|
first_name: string;
|
||||||
|
last_name: string;
|
||||||
|
date_of_birth: string;
|
||||||
|
gender: string;
|
||||||
|
email_address: string;
|
||||||
|
phone_number: string;
|
||||||
|
created_by: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CreateSubAdminResponse {
|
||||||
|
status: string;
|
||||||
|
status_code: number;
|
||||||
|
message: string;
|
||||||
|
data: UserData;
|
||||||
|
}
|
||||||
|
|
||||||
export const manageSubAdmin = createApi({
|
export const manageSubAdmin = createApi({
|
||||||
reducerPath: "manageSubAdmin",
|
reducerPath: "manageSubAdmin",
|
||||||
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
||||||
tagTypes: ['SubAdmin'],
|
tagTypes: ["SubAdmin"],
|
||||||
endpoints: (builder) => ({
|
endpoints: (builder) => ({
|
||||||
|
|
||||||
createFaqPost: builder.mutation<Post, Partial<Post>>({
|
createFaqPost: builder.mutation<Post, Partial<Post>>({
|
||||||
query: (data) => ({
|
query: (data) => ({
|
||||||
url: "/faq-store",
|
url: "/faq-store",
|
||||||
@@ -93,12 +112,13 @@ export const manageSubAdmin = createApi({
|
|||||||
body: data,
|
body: data,
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getSubAdmin: builder.query<ApiResponse, void>({
|
getSubAdmin: builder.query<ApiResponse, void>({
|
||||||
query: () => `/sub-admin`
|
query: () => `/sub-admin`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
viewSubAdmin: builder.query<SubAdminView, number>({
|
viewSubAdmin: builder.query<SubAdminView, number>({
|
||||||
query: (id) => `/sub-admin-view/${id}`
|
query: (id) => `/sub-admin-view/${id}`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
updateSubAdmin: builder.mutation({
|
updateSubAdmin: builder.mutation({
|
||||||
@@ -109,6 +129,18 @@ export const manageSubAdmin = createApi({
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
createSubAdminPost: builder.mutation<
|
||||||
|
CreateSubAdminResponse,
|
||||||
|
CreateSubAdminPayload
|
||||||
|
>({
|
||||||
|
query: (data) => ({
|
||||||
|
url: "/sub-admin-create",
|
||||||
|
method: "POST",
|
||||||
|
body: data,
|
||||||
|
}),
|
||||||
|
invalidatesTags: ["SubAdmin"], // Add this to invalidate cache
|
||||||
|
}),
|
||||||
|
|
||||||
faqToggle: builder.mutation({
|
faqToggle: builder.mutation({
|
||||||
query: ({ id, is_active }) => ({
|
query: ({ id, is_active }) => ({
|
||||||
url: `/faq-status`,
|
url: `/faq-status`,
|
||||||
@@ -131,10 +163,11 @@ export const {
|
|||||||
useLazyViewSubAdminQuery,
|
useLazyViewSubAdminQuery,
|
||||||
useUpdateSubAdminMutation,
|
useUpdateSubAdminMutation,
|
||||||
useDeleteSubAdminPostMutation,
|
useDeleteSubAdminPostMutation,
|
||||||
|
useCreateSubAdminPostMutation,
|
||||||
} = manageSubAdmin;
|
} = manageSubAdmin;
|
||||||
|
|
||||||
export type Post = {
|
export type Post = {
|
||||||
id: number;
|
id: number;
|
||||||
title: string;
|
title: string;
|
||||||
body: string;
|
body: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,15 @@ export interface UserData {
|
|||||||
id: number;
|
id: number;
|
||||||
principal_type_title: string;
|
principal_type_title: string;
|
||||||
},
|
},
|
||||||
principle_language_links:[]
|
principle_language_links:{
|
||||||
|
id: number;
|
||||||
|
language_xid: number;
|
||||||
|
iam_principal_xid: number;
|
||||||
|
language: {
|
||||||
|
id: number,
|
||||||
|
language_name: string;
|
||||||
|
}
|
||||||
|
}[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ApiResponse {
|
interface ApiResponse {
|
||||||
@@ -55,7 +63,7 @@ export const registerUser = createApi({
|
|||||||
reducerPath: "registerUser",
|
reducerPath: "registerUser",
|
||||||
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
|
||||||
endpoints: (builder) => ({
|
endpoints: (builder) => ({
|
||||||
createCountryPost: builder.mutation<PostCountry, Partial<PostCountry>>({
|
createUser: builder.mutation<PostCountry, Partial<PostCountry>>({
|
||||||
query: (data) => ({
|
query: (data) => ({
|
||||||
url: "/country-add",
|
url: "/country-add",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -67,13 +75,13 @@ export const registerUser = createApi({
|
|||||||
query: (page = 1) => `/manage-user-list?page=${page}`,
|
query: (page = 1) => `/manage-user-list?page=${page}`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
getCountryMasterEdit: builder.query<CountryEdit, number>({
|
getDeactivateUser: builder.query<ApiResponse, number>({
|
||||||
query: (id) => `/country-edit/${id}`,
|
query: (page = 1) => `/manage-user-deactivate-list?page=${page}`,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
updateCountry: builder.mutation({
|
updateUser: builder.mutation({
|
||||||
query: (updatedData) => ({
|
query: (updatedData) => ({
|
||||||
url: "/country-update",
|
url: "/manage-user-update",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: updatedData,
|
body: updatedData,
|
||||||
}),
|
}),
|
||||||
@@ -87,6 +95,14 @@ export const registerUser = createApi({
|
|||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
userDeactivateToggle: builder.mutation({
|
||||||
|
query: ({ id, is_active }) => ({
|
||||||
|
url: `/manage-user-deactivate-status`,
|
||||||
|
method: "POST",
|
||||||
|
body: { id, is_active },
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
|
||||||
// deleteFaqPost: builder.mutation<{ status: string; message: string }, { id: number }>({
|
// deleteFaqPost: builder.mutation<{ status: string; message: string }, { id: number }>({
|
||||||
// query: ({ id }) => ({
|
// query: ({ id }) => ({
|
||||||
// url: `/faq-delete`,
|
// url: `/faq-delete`,
|
||||||
@@ -100,9 +116,10 @@ export const registerUser = createApi({
|
|||||||
|
|
||||||
export const {
|
export const {
|
||||||
useGetManageUserQuery,
|
useGetManageUserQuery,
|
||||||
useGetCountryMasterEditQuery,
|
useCreateUserMutation,
|
||||||
useCreateCountryPostMutation,
|
useUpdateUserMutation,
|
||||||
useUpdateCountryMutation,
|
|
||||||
useUserToggleMutation,
|
useUserToggleMutation,
|
||||||
|
useGetDeactivateUserQuery,
|
||||||
|
useUserDeactivateToggleMutation,
|
||||||
// useDeleteFaqPostMutation
|
// useDeleteFaqPostMutation
|
||||||
} = registerUser;
|
} = registerUser;
|
||||||
@@ -27,6 +27,7 @@ interface PaginationData {
|
|||||||
export interface Template {
|
export interface Template {
|
||||||
id: number;
|
id: number;
|
||||||
is_active: boolean;
|
is_active: boolean;
|
||||||
|
principle_type_xid: number;
|
||||||
post_template_translate: PostTemplateTranslate[];
|
post_template_translate: PostTemplateTranslate[];
|
||||||
post_template_image: PostTemplateImage[];
|
post_template_image: PostTemplateImage[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const workspaceMode = createApi({
|
|||||||
endpoints: (builder) => ({
|
endpoints: (builder) => ({
|
||||||
createWorkspacePost: builder.mutation<PostDepartment, Partial<PostDepartment>>({
|
createWorkspacePost: builder.mutation<PostDepartment, Partial<PostDepartment>>({
|
||||||
query: (data) => ({
|
query: (data) => ({
|
||||||
url: "/department-master-store",
|
url: "/workspace-create",
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: data,
|
body: data,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -40,8 +40,9 @@ const AlertDailog: React.FC<DeleteConfirmationDialogProps> = ({
|
|||||||
size={"xs"}
|
size={"xs"}
|
||||||
role="alertdialog"
|
role="alertdialog"
|
||||||
open={isOpen}
|
open={isOpen}
|
||||||
|
|
||||||
>
|
>
|
||||||
<DialogTrigger asChild>
|
<DialogTrigger asChild >
|
||||||
{button ? (
|
{button ? (
|
||||||
button
|
button
|
||||||
) : (
|
) : (
|
||||||
@@ -134,3 +135,16 @@ const AlertDailog: React.FC<DeleteConfirmationDialogProps> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default AlertDailog;
|
export default AlertDailog;
|
||||||
|
|
||||||
|
|
||||||
|
// import React from 'react'
|
||||||
|
|
||||||
|
// const AlertDailog = () => {
|
||||||
|
// return (
|
||||||
|
// <div>
|
||||||
|
|
||||||
|
// </div>
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
|
||||||
|
// export default AlertDailog
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ const DataTable: React.FC<TableProps> = ({
|
|||||||
<Box textAlign={"center"} py={20} position={'absolute'} w={'84%'}>
|
<Box textAlign={"center"} py={20} position={'absolute'} w={'84%'}>
|
||||||
<Image src={EmptyFile} alt="No data" maxW="65px" mx="auto" />
|
<Image src={EmptyFile} alt="No data" maxW="65px" mx="auto" />
|
||||||
<Text fontSize={"18px"} fontWeight={500} mt={2}>
|
<Text fontSize={"18px"} fontWeight={500} mt={2}>
|
||||||
We do not have any records
|
No records found — they’ll appear here if available.
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user