This commit is contained in:
rockyeverlast
2025-09-12 17:59:15 +05:30
19 changed files with 363 additions and 208 deletions

View File

@@ -7,6 +7,8 @@ export interface GlobalStateContextType {
setIsAuthenticate: Dispatch<SetStateAction<boolean>>; setIsAuthenticate: Dispatch<SetStateAction<boolean>>;
isBarLoading: boolean; isBarLoading: boolean;
setIsBarLoading: Dispatch<SetStateAction<boolean>>; setIsBarLoading: Dispatch<SetStateAction<boolean>>;
userAccess: string[];
setUserAccess: Dispatch<SetStateAction<string[]>>;
} }
// Create the context with a default value of `undefined` // Create the context with a default value of `undefined`
const GlobalStateContext = createContext<GlobalStateContextType | undefined>(undefined); const GlobalStateContext = createContext<GlobalStateContextType | undefined>(undefined);

View File

@@ -6,6 +6,10 @@ import GlobalStateContext from "./GlobalStateContext";
const GlobalStateProvider = ({ children }: { children: ReactNode }) => { const GlobalStateProvider = ({ children }: { children: ReactNode }) => {
const [isAuthenticate, setIsAuthenticate] = useState<boolean>(true); const [isAuthenticate, setIsAuthenticate] = useState<boolean>(true);
const [isBarLoading, setIsBarLoading] = useState<boolean>(false); // ✅ Fixed typo const [isBarLoading, setIsBarLoading] = useState<boolean>(false); // ✅ Fixed typo
const [userAccess, setUserAccess] = useState<string[]>(() => {
const stored = sessionStorage.getItem('userAccess');
return stored ? JSON.parse(stored) : [];
});
@@ -15,6 +19,8 @@ const GlobalStateProvider = ({ children }: { children: ReactNode }) => {
setIsAuthenticate, setIsAuthenticate,
isBarLoading, isBarLoading,
setIsBarLoading, // ✅ Fixed typo setIsBarLoading, // ✅ Fixed typo
userAccess,
setUserAccess
}}> }}>
{children} {children}
</GlobalStateContext.Provider> </GlobalStateContext.Provider>

View File

@@ -25,9 +25,13 @@ const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => {
if (!context) { if (!context) {
throw new Error('App must be used within a GlobalStateProvider'); throw new Error('App must be used within a GlobalStateProvider');
} }
const { setIsAuthenticate, isBarLoading } = context; const { setIsAuthenticate, isBarLoading, userAccess } = context;
const [logOutAdmin] = useLogOutMutation() const [logOutAdmin] = useLogOutMutation()
const filteredNav = nav.filter(item =>
userAccess.includes('*') || !item.resourceTitle || userAccess.includes(item.resourceTitle)
);
// Logout function // Logout function
const handleLogout = async () => { const handleLogout = async () => {
@@ -57,7 +61,7 @@ const DefaultLayout: FC<{ children: React.ReactNode }> = ({ children }) => {
<Image w={55} src={logo} /> <Image w={55} src={logo} />
</HStack> </HStack>
<VStack w={'100%'} p={2} pt={0}> <VStack w={'100%'} p={2} pt={0}>
{nav?.map(({ title, path, Icon, type, children, initPath }, index) => type === 'single' ? {filteredNav?.map(({ title, path, Icon, type, children, initPath }, index) => type === 'single' ?
<NavLink className="link" key={index} to={path || ''} style={{ cursor: 'pointer', borderRadius: '8px', padding: '6px', width: '100%', display: 'flex', alignItems: 'center', gap: 6, border: '1px solid #ffffff', backgroundColor: '#fff', color: '#000', boxShadow: 'rgba(99, 99, 99, 0.2) 0px 2px 8px 0px' }} ><Icon style={{ fontSize: '20px' }} /> <Text fontSize={'xs'} w={'100%'}>{title}</Text></NavLink> : <NavLink className="link" key={index} to={path || ''} style={{ cursor: 'pointer', borderRadius: '8px', padding: '6px', width: '100%', display: 'flex', alignItems: 'center', gap: 6, border: '1px solid #ffffff', backgroundColor: '#fff', color: '#000', boxShadow: 'rgba(99, 99, 99, 0.2) 0px 2px 8px 0px' }} ><Icon style={{ fontSize: '20px' }} /> <Text fontSize={'xs'} w={'100%'}>{title}</Text></NavLink> :
<AccordionRoot border={location?.pathname.startsWith(initPath ?? path) ? "1px solid #02A0A0" : '1px'} key={index} bg={'#fff'} rounded={'lg'} collapsible> <AccordionRoot border={location?.pathname.startsWith(initPath ?? path) ? "1px solid #02A0A0" : '1px'} key={index} bg={'#fff'} rounded={'lg'} collapsible>
<AccordionItem rounded={'lg'} bg={'#fff'} boxShadow={'rgba(99, 99, 99, 0.2) 0px 2px 8px 0px'} borderBottom={'none'} p={0} key={index} value={title}> <AccordionItem rounded={'lg'} bg={'#fff'} boxShadow={'rgba(99, 99, 99, 0.2) 0px 2px 8px 0px'} borderBottom={'none'} p={0} key={index} value={title}>

View File

@@ -34,7 +34,7 @@ const Login = () => {
if (!context) { if (!context) {
throw new Error("App must be used within a GlobalStateProvider"); throw new Error("App must be used within a GlobalStateProvider");
} }
const { setIsAuthenticate } = context; const { setIsAuthenticate, setUserAccess } = context;
const { const {
register, register,
handleSubmit, handleSubmit,
@@ -43,10 +43,10 @@ const Login = () => {
const onSubmit = handleSubmit(async (data) => { const onSubmit = handleSubmit(async (data) => {
setIsLoading(true); setIsLoading(true);
// Encode Basic Auth Credentials
const username = import.meta.env.VITE_USER_NAME || ""; // Replace with actual username const username = import.meta.env.VITE_USER_NAME || "";
const password = import.meta.env.VITE_PASSWORD || ""; // Replace with actual password const password = import.meta.env.VITE_PASSWORD || "";
const basicAuth = `${username}:${password}`; // Encode to Base64 const basicAuth = `${username}:${password}`;
try { try {
const res = await axios.post( const res = await axios.post(
@@ -62,35 +62,36 @@ const Login = () => {
}, },
} }
); );
console.log("============", res);
const loginData = res.data?.data;
const { principal_type_xid, role_permission } = loginData;
const isAdmin = principal_type_xid === 1;
const allowedTitles = isAdmin
? ['*']
: role_permission?.get_resource_action_link
?.filter((link: unknown) => (link as any).is_active)
.map((link: unknown) => (link as any).app_resource.app_resource_title) ?? [];
setIsAuthenticate(true);
setUserAccess(allowedTitles);
dispatch(setToken(String(loginData["access-token"])));
sessionStorage.setItem('userAccess', JSON.stringify(allowedTitles));
navigate("/dashboard");
setIsLoading(false);
if (res.data) {
setIsAuthenticate(true);
console.log("====================================");
console.log(res.data?.data);
console.log("====================================");
navigate("/dashboard");
dispatch(setToken(String(res.data?.data["access-token"])));
} else {
console.log("====================================");
console.log(res);
console.log("====================================");
}
} catch (error: any) { } catch (error: any) {
console.log('error', error.response.data.message); console.log('error', error?.response?.data?.message);
toaster.create({
if (error) { title: "Error",
toaster.create({ description: error?.response?.data?.message || "Login failed",
title: error?.response?.data?.message, type: "error",
// title: "Something Went Wrong", });
type: "info", setIsLoading(false);
})
// console.log("Login failed", error?.response?.data?.message);
setIsLoading(false);
}
} }
}); });
// console.log("User Access in Context:", userAccess);
return ( return (

View File

@@ -85,9 +85,21 @@ const FAQ = () => {
try { try {
await faqToggle({ id: agencyId, is_active: newStatus }).unwrap(); await faqToggle({ id: agencyId, is_active: newStatus }).unwrap();
refetch() toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
setTimeout(() => {
refetch();
}, 500);
} catch (error) { } catch (error) {
console.error("Error updating privacy policy:", error); console.error("Error updating privacy policy:", error);
toaster.create({
title: "Error",
description: "Someting went wrong.",
type: "error",
});
setLocalData((prevData) => setLocalData((prevData) =>
prevData.map((agency) => prevData.map((agency) =>
agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency
@@ -160,7 +172,7 @@ const FAQ = () => {
handleDeleteFaq(selectedFaqId); handleDeleteFaq(selectedFaqId);
} }
}} }}
/> />
<Box> <Box>
<Switch <Switch
colorPalette={'teal'} colorPalette={'teal'}

View File

@@ -175,10 +175,9 @@ const ManagePost = () => {
), ),
Description: ( Description: (
<Text> <Text>
{`${translation?.content}`.slice( {translation?.content?.length > 30
0, ? `${translation.content.slice(0, 30)}...`
30 : translation?.content}
) + "..."}
</Text> </Text>
), ),
"Publish Data": formatAPIDate(agency.created_at), "Publish Data": formatAPIDate(agency.created_at),

View File

@@ -18,11 +18,13 @@ import SearchComponent from "../../../components/SearchComponent";
import AlertDailog from "../../../components/AlertDailog"; import AlertDailog from "../../../components/AlertDailog";
import { toaster } from "../../../components/ui/toaster"; import { toaster } from "../../../components/ui/toaster";
import Delete from "../../../components/ActionIcons/Delete"; import Delete from "../../../components/ActionIcons/Delete";
import { delay } from "../../../components/Utils";
// import Delete from "../../../components/ActionIcons/Delete"; // import Delete from "../../../components/ActionIcons/Delete";
const tableHeadRow = [ const tableHeadRow = [
"Sr. No", "Sr. No",
"First Name", "First Name",
"Last Name",
"Mobile Number", "Mobile Number",
"Gender", "Gender",
"DOB", "DOB",
@@ -105,9 +107,20 @@ const RegisterUsers = () => {
try { try {
await userToggle({ id: agencyId, is_active: newStatus }).unwrap(); await userToggle({ id: agencyId, is_active: newStatus }).unwrap();
toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
await delay(500);
refetch() refetch()
} catch (error) { } catch (error) {
console.error("Error updating privacy policy:", error); console.error("Error updating privacy policy:", error);
toaster.create({
title: "Error",
description: "Someting went wrong.",
type: "error",
});
setLocalData((prevData) => setLocalData((prevData) =>
prevData.map((agency) => prevData.map((agency) =>
agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency
@@ -142,6 +155,7 @@ const RegisterUsers = () => {
const managepost = filteredData?.flatMap((agency: UserData, index: number) => ({ const managepost = filteredData?.flatMap((agency: UserData, index: number) => ({
"Sr. No": (currentPage - 1) * (data?.data.per_page ?? 0) + index + 1, "Sr. No": (currentPage - 1) * (data?.data.per_page ?? 0) + index + 1,
"First Name": agency.first_name, "First Name": agency.first_name,
"Last Name": agency.last_name,
"Mobile Number": agency.phone_number, "Mobile Number": agency.phone_number,
"Gender": agency.gender, "Gender": agency.gender,
"DOB": agency.date_of_birth ? new Date(agency.date_of_birth).toLocaleDateString('en-GB').replace(/\//g, '-') : 'N/A', "DOB": agency.date_of_birth ? new Date(agency.date_of_birth).toLocaleDateString('en-GB').replace(/\//g, '-') : 'N/A',

View File

@@ -9,6 +9,8 @@ import { useAgencyMasterToggleMutation, useGetAgencyMasterQuery } from "../../..
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import SearchComponent from "../../../components/SearchComponent"; import SearchComponent from "../../../components/SearchComponent";
import { useDebounce } from "../../../components/Hooks/useDebounce"; import { useDebounce } from "../../../components/Hooks/useDebounce";
import { toaster, Toaster } from "../../../components/ui/toaster";
import { delay } from "../../../components/Utils";
// table data // table data
@@ -65,6 +67,12 @@ const AgencyMaster = () => {
); );
try { try {
await agencyMasterToggle({ id: agencyId, is_active: newStatus }).unwrap(); await agencyMasterToggle({ id: agencyId, is_active: newStatus }).unwrap();
toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
await delay(500);
refetch() refetch()
} catch (error) { } catch (error) {
console.error("Error updating privacy policy:", error); console.error("Error updating privacy policy:", error);
@@ -73,6 +81,11 @@ const AgencyMaster = () => {
agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency
) )
); );
toaster.create({
title: "Error",
description: "Please try again later",
type: "error",
});
} }
}; };
@@ -120,7 +133,7 @@ const AgencyMaster = () => {
size={"xs"} size={"xs"}
onChange={() => handleToggle(agency.id.toString(), Number(agency.is_active))} onChange={() => handleToggle(agency.id.toString(), Number(agency.is_active))}
checked={Boolean(Number(agency.is_active))} checked={Boolean(Number(agency.is_active))}
// disabled={isOnlyActive} // disabled={isOnlyActive}
/> />
</Box> </Box>
</HStack> </HStack>
@@ -199,6 +212,7 @@ const AgencyMaster = () => {
isError={isError} isError={isError}
/> />
</Box> </Box>
<Toaster />
</MainFrame> </MainFrame>
) )
} }

View File

@@ -8,6 +8,8 @@ import { CountryData, useCountryToggleMutation, useGetCountryMasterQuery } from
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import SearchComponent from "../../../components/SearchComponent"; import SearchComponent from "../../../components/SearchComponent";
import { useDebounce } from "../../../components/Hooks/useDebounce"; import { useDebounce } from "../../../components/Hooks/useDebounce";
import { toaster, Toaster } from "../../../components/ui/toaster";
import { delay } from "../../../components/Utils";
@@ -79,9 +81,20 @@ const Country = () => {
try { try {
await countryToggle({ id: agencyId, is_active: newStatus }).unwrap(); await countryToggle({ id: agencyId, is_active: newStatus }).unwrap();
toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
await delay(500);
refetch() refetch()
} catch (error) { } catch (error) {
console.error("Error updating privacy policy:", error); console.error("Error updating privacy policy:", error);
toaster.create({
title: "Error",
description: "Please try again later.",
type: "error",
});
setLocalData((prevData) => setLocalData((prevData) =>
prevData.map((agency) => prevData.map((agency) =>
agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency
@@ -107,7 +120,7 @@ const Country = () => {
</HStack> </HStack>
), ),
})) }))
return ( return (
@@ -173,6 +186,7 @@ const Country = () => {
isError={isError} isError={isError}
/> />
</Box> </Box>
<Toaster />
</MainFrame> </MainFrame>
) )
} }

View File

@@ -10,6 +10,8 @@ import { useDepartmentToggleMutation, useGetDepartmentMasterQuery } from "../../
import AddDepartmentMaster from "./AddDepartmentMaster"; import AddDepartmentMaster from "./AddDepartmentMaster";
import EditDepartmentMaster from "./EditDepartmentMaster"; import EditDepartmentMaster from "./EditDepartmentMaster";
import { useDebounce } from "../../../components/Hooks/useDebounce"; import { useDebounce } from "../../../components/Hooks/useDebounce";
import { Toaster, toaster } from "../../../components/ui/toaster";
import { delay } from "../../../components/Utils";
// table data // table data
@@ -58,9 +60,20 @@ const DepartmentMasterList = () => {
); );
try { try {
await departmentToggle({ id: agencyId, is_active: newStatus }).unwrap(); await departmentToggle({ id: agencyId, is_active: newStatus }).unwrap();
toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
await delay(500);
refetch() refetch()
} catch (error) { } catch (error) {
console.error("Error updating privacy policy:", error); console.error("Error updating privacy policy:", error);
toaster.create({
title: "Error",
description: "Someting went wrong.",
type: "error",
});
setLocalData((prevData) => setLocalData((prevData) =>
prevData.map((agency) => prevData.map((agency) =>
agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency
@@ -142,6 +155,7 @@ const DepartmentMasterList = () => {
isError={isError} isError={isError}
/> />
</Box> </Box>
<Toaster />
</MainFrame> </MainFrame>
) )
} }

View File

@@ -10,6 +10,8 @@ import EditIndustryMaster from "./EditIndustryMaster";
import AddIndustryMaster from "./AddIndustryMaster"; import AddIndustryMaster from "./AddIndustryMaster";
import SearchComponent from "../../../components/SearchComponent"; import SearchComponent from "../../../components/SearchComponent";
import { useDebounce } from "../../../components/Hooks/useDebounce"; import { useDebounce } from "../../../components/Hooks/useDebounce";
import { Toaster, toaster } from "../../../components/ui/toaster";
import { delay } from "../../../components/Utils";
// table data // table data
@@ -61,7 +63,7 @@ const IndustryMasterList = () => {
const handleSearchChange = (value: string) => { const handleSearchChange = (value: string) => {
setSearchTerm(value); setSearchTerm(value);
setCurrentPage(1); setCurrentPage(1);
}; };
const handlePageChange = (page: number) => { const handlePageChange = (page: number) => {
setCurrentPage(page); setCurrentPage(page);
@@ -76,9 +78,20 @@ const IndustryMasterList = () => {
); );
try { try {
await industryMasterToggle({ id: agencyId, is_active: newStatus }).unwrap(); await industryMasterToggle({ id: agencyId, is_active: newStatus }).unwrap();
toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
await delay(500);
refetch() refetch()
} catch (error) { } catch (error) {
console.error("Error updating privacy policy:", error); console.error("Error updating privacy policy:", error);
toaster.create({
title: "Error",
description: "Someting went wrong.",
type: "error",
});
setLocalData((prevData) => setLocalData((prevData) =>
prevData.map((agency) => prevData.map((agency) =>
agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency
@@ -160,6 +173,7 @@ const IndustryMasterList = () => {
isError={isError} isError={isError}
/> />
</Box> </Box>
<Toaster />
</MainFrame> </MainFrame>
) )
} }

View File

@@ -7,8 +7,9 @@ import EditJobStatusModel from "./EditJobStatusModel";
import { useGetJobStatusQuery, useJobStatusToggleMutation } from "../../../Redux/Service/job.status"; import { useGetJobStatusQuery, useJobStatusToggleMutation } from "../../../Redux/Service/job.status";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import SearchComponent from "../../../components/SearchComponent"; import SearchComponent from "../../../components/SearchComponent";
import { toaster } from "../../../components/ui/toaster"; import { toaster, Toaster } from "../../../components/ui/toaster";
import { useDebounce } from "../../../components/Hooks/useDebounce"; import { useDebounce } from "../../../components/Hooks/useDebounce";
import { delay } from "../../../components/Utils";
@@ -70,6 +71,12 @@ const JobStatus = () => {
); );
try { try {
await jobStatusToggle({ id: agencyId, is_active: newStatus }).unwrap(); await jobStatusToggle({ id: agencyId, is_active: newStatus }).unwrap();
toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
await delay(500);
refetch() refetch()
} catch (error) { } catch (error) {
console.error("Error updating:", error); console.error("Error updating:", error);
@@ -154,6 +161,7 @@ const JobStatus = () => {
isError={isError} isError={isError}
/> />
</Box> </Box>
<Toaster />
</MainFrame> </MainFrame>
) )
} }

View File

@@ -9,6 +9,8 @@ import EditJobeModel from "./EditJobModel";
import { JobTypeData, useGetJobTypeQuery, useJobTypeToggleMutation } from "../../../Redux/Service/job.type.service"; import { JobTypeData, useGetJobTypeQuery, useJobTypeToggleMutation } from "../../../Redux/Service/job.type.service";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import SearchComponent from "../../../components/SearchComponent"; import SearchComponent from "../../../components/SearchComponent";
import { toaster, Toaster } from "../../../components/ui/toaster";
import { delay } from "../../../components/Utils";
@@ -70,6 +72,12 @@ const JobType = () => {
); );
try { try {
await jobTypeToggle({ id: agencyId, is_active: newStatus }).unwrap(); await jobTypeToggle({ id: agencyId, is_active: newStatus }).unwrap();
toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
await delay(500);
refetch() refetch()
} catch (error) { } catch (error) {
console.error("Error updating privacy policy:", error); console.error("Error updating privacy policy:", error);
@@ -78,6 +86,11 @@ const JobType = () => {
agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency
) )
); );
toaster.create({
title: "Error",
description: "Please try again later",
type: "error",
});
} }
}; };
@@ -144,6 +157,7 @@ const JobType = () => {
onPageChange={handlePageChange} onPageChange={handlePageChange}
/> />
</Box> </Box>
<Toaster />
</MainFrame> </MainFrame>
) )
} }

View File

@@ -9,6 +9,8 @@ import EditTemplateModel from "./EditTemplateModel";
import { Template, useGetTemplateMasterQuery, useTemplateMasterToggleMutation } from "../../../Redux/Service/template.master.service"; import { Template, useGetTemplateMasterQuery, useTemplateMasterToggleMutation } from "../../../Redux/Service/template.master.service";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import SearchComponent from "../../../components/SearchComponent"; import SearchComponent from "../../../components/SearchComponent";
import { toaster, Toaster } from "../../../components/ui/toaster";
import { delay } from "../../../components/Utils";
const APIURL = import.meta.env.VITE_IMG_TEMPLATES const APIURL = import.meta.env.VITE_IMG_TEMPLATES
@@ -72,6 +74,12 @@ const TemplateMaster = () => {
); );
try { try {
await templateMasterToggle({ id: agencyId, is_active: newStatus }).unwrap(); await templateMasterToggle({ id: agencyId, is_active: newStatus }).unwrap();
toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
await delay(500);
refetch() refetch()
} catch (error) { } catch (error) {
console.error("Error updating privacy policy:", error); console.error("Error updating privacy policy:", error);
@@ -80,6 +88,11 @@ const TemplateMaster = () => {
agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency agency.id === agencyId ? { ...agency, is_active: currentStatus } : agency
) )
); );
toaster.create({
title: "Error",
description: "Please try again later",
type: "error",
});
} }
}; };
@@ -124,7 +137,8 @@ const TemplateMaster = () => {
</Box> </Box>
</HStack> </HStack>
) )
}}); }
});
return ( return (
@@ -182,6 +196,7 @@ const TemplateMaster = () => {
onPageChange={handlePageChange} onPageChange={handlePageChange}
/> />
</Box> </Box>
<Toaster />
</MainFrame> </MainFrame>
) )
} }

View File

@@ -63,12 +63,17 @@ const WorkspaceMode = () => {
); );
try { try {
await workspaceToggle({ id: agencyId, is_active: newStatus }).unwrap(); await workspaceToggle({ id: agencyId, is_active: newStatus }).unwrap();
toaster.create({
title: "Success",
description: "Status updated successfully",
type: "success",
});
refetch() refetch()
} catch (error) { } catch (error) {
console.error("Error updating privacy policy:", error); console.error("Error updating privacy policy:", error);
toaster.create({ toaster.create({
title: "Error", title: "Error",
description: "Someting went wrong.", description: "Please try again later.",
type: "error", type: "error",
}); });
setLocalData((prevData) => setLocalData((prevData) =>
@@ -133,7 +138,7 @@ const WorkspaceMode = () => {
}} }}
/> />
{/* <Button bgColor={'#EEEEEE'} pl={3} pr={3}><IoMdAdd /> <Text>Add</Text></Button> */} {/* <Button bgColor={'#EEEEEE'} pl={3} pr={3}><IoMdAdd /> <Text>Add</Text></Button> */}
<WorkAddModel refetch={refetch}/> <WorkAddModel refetch={refetch} />
</HStack> </HStack>
</HStack> </HStack>
<DataTable <DataTable

View File

@@ -123,7 +123,7 @@ const SetNewPassword = () => {
height={"fit-content"} height={"fit-content"}
mr={2} mr={2}
> >
{showOldPassword ? <LuEye /> : <LuEyeOff />} {showOldPassword ? <LuEyeOff /> : <LuEye />}
</IconButton> </IconButton>
} }
> >
@@ -158,7 +158,7 @@ const SetNewPassword = () => {
color={"#000"} color={"#000"}
mr={2} mr={2}
> >
{showNewPassword ? <LuEye /> : <LuEyeOff />} {showNewPassword ? <LuEyeOff /> : <LuEye />}
</IconButton> </IconButton>
} }
> >

View File

@@ -1,5 +1,5 @@
import { LuBriefcaseBusiness} from "react-icons/lu"; import { LuBriefcaseBusiness } from "react-icons/lu";
import { MdHeadsetMic, MdOutlineDashboard} from "react-icons/md"; import { MdHeadsetMic, MdOutlineDashboard } from "react-icons/md";
import { GoDotFill } from "react-icons/go"; import { GoDotFill } from "react-icons/go";
import { HiOutlinePencilSquare } from "react-icons/hi2"; import { HiOutlinePencilSquare } from "react-icons/hi2";
import { BiUser, BiUserPin } from "react-icons/bi"; import { BiUser, BiUserPin } from "react-icons/bi";
@@ -8,146 +8,156 @@ import { BsBoxes, BsPersonBadge } from "react-icons/bs";
import { AiOutlineFileText } from "react-icons/ai"; import { AiOutlineFileText } from "react-icons/ai";
export const nav = [ export const nav = [
{ {
title: "Dashboard", title: "Dashboard",
path: "/", path: "/",
Icon: MdOutlineDashboard, Icon: MdOutlineDashboard,
type:'single' type: 'single',
}, resourceTitle: 'Dashboard'
{ },
title: "Manage Users", {
initPath: "/manage-users", title: "Manage Users",
Icon: BiUserPin, initPath: "/manage-users",
type:'multiple', Icon: BiUserPin,
children: [ type: 'multiple',
{ resourceTitle: 'Manage Users',
title: "Register Users", children: [
path: "/manage-users/register-users", {
Icon: GoDotFill, title: "Register Users",
}, path: "/manage-users/register-users",
{ Icon: GoDotFill,
title: "Deactivated Accounts", },
path: "/manage-users/deactivated-accounts", {
Icon: GoDotFill, title: "Deactivated Accounts",
}, path: "/manage-users/deactivated-accounts",
], Icon: GoDotFill,
}, },
{ ],
title: "Manage Post", },
path: "/manage-post", {
Icon: HiOutlinePencilSquare, title: "Manage Post",
type:'single' path: "/manage-post",
}, Icon: HiOutlinePencilSquare,
{ type: 'single',
title: "Manage Sub-Admin", resourceTitle: 'Manage Post'
path: "/sub-admin", },
Icon: BiUser, {
type:'single' title: "Manage Sub-Admin",
}, path: "/sub-admin",
{ Icon: BiUser,
title: "Manage Jobs", type: 'single',
path: "/manage-jobs", resourceTitle: 'Manage Subadmin'
Icon: LuBriefcaseBusiness, },
type:'single' {
}, title: "Manage Jobs",
{ path: "/manage-jobs",
title: "Manage Groups", Icon: LuBriefcaseBusiness,
path: "/manage-groups", type: 'single',
Icon: PiUsersThree, resourceTitle: 'Manage Jobs'
type:'single' },
}, {
{ title: "Manage Groups",
title: "Manage Contact Us", path: "/manage-groups",
path: "/manage-contact", Icon: PiUsersThree,
Icon: MdHeadsetMic , type: 'single',
type:'single' resourceTitle: 'Manage Groups'
}, },
{ {
title: "Manage CMS", title: "Manage Contact Us",
initPath: "/manage-cms", path: "/manage-contact",
Icon: AiOutlineFileText, Icon: MdHeadsetMic,
type:'multiple', type: 'single',
children: [ resourceTitle: 'Manage Contact Us'
{ },
title: "FAQs", {
path: "/manage-cms/faq", title: "Manage CMS",
Icon: GoDotFill, initPath: "/manage-cms",
}, Icon: AiOutlineFileText,
{ type: 'multiple',
title: "About Us", resourceTitle: 'Manage CMS',
path: "/manage-cms/about-us", children: [
Icon: GoDotFill, {
}, title: "FAQs",
{ path: "/manage-cms/faq",
title: "Privacy Policy", Icon: GoDotFill,
path: "/manage-cms/privacy-policy", },
Icon: GoDotFill, {
}, title: "About Us",
{ path: "/manage-cms/about-us",
title: "Terms And Conditions", Icon: GoDotFill,
path: "/manage-cms/terms-conditions", },
Icon: GoDotFill, {
}, title: "Privacy Policy",
// { path: "/manage-cms/privacy-policy",
// title: "Privacy", Icon: GoDotFill,
// path: "/manage-cms/privacy", },
// Icon: GoDotFill, {
// }, title: "Terms And Conditions",
], path: "/manage-cms/terms-conditions",
}, Icon: GoDotFill,
{ },
title: "My Profile", // {
path: "/profile", // title: "Privacy",
Icon: BsPersonBadge, // path: "/manage-cms/privacy",
type:'single' // Icon: GoDotFill,
}, // },
{ ],
title: "Master Module", },
initPath: "/master-module", {
Icon: BsBoxes, title: "My Profile",
type:'multiple', path: "/profile",
children: [ Icon: BsPersonBadge,
{ type: 'single',
title: "Agency Master", resourceTitle: 'My Profile'
path: "/master-module/agency-master", },
Icon: GoDotFill, {
}, title: "Master Module",
{ initPath: "/master-module",
title: "Template Master", Icon: BsBoxes,
path: "/master-module/template-master", type: 'multiple',
Icon: GoDotFill, resourceTitle: 'Master Module',
}, children: [
{ {
title: "Job Type", title: "Agency Master",
path: "/master-module/job-type", path: "/master-module/agency-master",
Icon: GoDotFill, Icon: GoDotFill,
}, },
{ {
title: "Workspace Mode", title: "Template Master",
path: "/master-module/workspace-mode", path: "/master-module/template-master",
Icon: GoDotFill, Icon: GoDotFill,
}, },
{ {
title: "Country", title: "Job Type",
path: "/master-module/country", path: "/master-module/job-type",
Icon: GoDotFill, Icon: GoDotFill,
}, },
{ {
title: "Job Status", title: "Workspace Mode",
path: "/master-module/job-status", path: "/master-module/workspace-mode",
Icon: GoDotFill, Icon: GoDotFill,
}, },
{ {
title: "Industry Master", title: "Country",
path: "/master-module/industry-master", path: "/master-module/country",
Icon: GoDotFill, Icon: GoDotFill,
}, },
{ {
title: "Department Master", title: "Job Status",
path: "/master-module/department-master", path: "/master-module/job-status",
Icon: GoDotFill, Icon: GoDotFill,
}, },
], {
}, title: "Industry Master",
]; path: "/master-module/industry-master",
Icon: GoDotFill,
},
{
title: "Department Master",
path: "/master-module/department-master",
Icon: GoDotFill,
},
],
},
];

View File

@@ -135,23 +135,29 @@ const DataTable: React.FC<TableProps> = ({
key={index} key={index}
bg={index % 2 === 0 ? "#fff" : "#007F3310"} bg={index % 2 === 0 ? "#fff" : "#007F3310"}
> >
{tableHeadRow.map((heading, colIndex) => ( {tableHeadRow.map((heading, colIndex) => {
<Table.Cell const cellContent = item[heading];
px={4} const words = typeof cellContent === 'string'
p={2} ? cellContent.split(" ")
key={`${index}-${colIndex}`} : cellContent?.toString().split(" ") || [];
fontSize={"xs"}
fontWeight={500} const truncated = words.length > 15
border={"none"} ? `${words.slice(0, 15).join(" ")}...`
> : cellContent;
{(() => {
const words = item[heading]?.toString().split(" ") || []; return (
return words.length > 5 <Table.Cell
? `${words.slice(0, 5).join(" ")}...` px={4}
: item[heading]; p={2}
})()} key={`${index}-${colIndex}`}
</Table.Cell> fontSize="xs"
))} fontWeight={500}
border="none"
>
{truncated}
</Table.Cell>
);
})}
</Table.Row> </Table.Row>
))} ))}
</Table.Body> </Table.Body>

3
src/components/Utils.ts Normal file
View File

@@ -0,0 +1,3 @@
export const delay = (ms: number) => new Promise(res => setTimeout(res, ms));