From 021eb6e4dbc7e65c3a7a89f7b540b384b242211b Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Fri, 6 Jun 2025 20:10:40 +0530
Subject: [PATCH 1/2] [ update ]
---
src/Pages/SubAdmin/AddModel.tsx | 342 +++++++++++++++----
src/Redux/Service/faqs.service.ts | 1 +
src/Redux/Service/manage.subadmin.service.ts | 38 ++-
3 files changed, 309 insertions(+), 72 deletions(-)
diff --git a/src/Pages/SubAdmin/AddModel.tsx b/src/Pages/SubAdmin/AddModel.tsx
index 03472cb..ce5b260 100644
--- a/src/Pages/SubAdmin/AddModel.tsx
+++ b/src/Pages/SubAdmin/AddModel.tsx
@@ -1,80 +1,288 @@
-import { Button } from "../../components/ui/button"
-import { DialogBody, DialogCloseTrigger, 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 { useState } from "react";
+import { Button } from "../../components/ui/button";
+import {
+ DialogBody,
+ DialogCloseTrigger,
+ 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";
-function AddModel() {
- return (
+function AddModel({ refetch }: { refetch: VoidFunction }) {
+ const [createSubAdminPost, { isLoading }] = useCreateSubAdminPostMutation();
-
-
- {/* */}
-
+ const [formData, setFormData] = useState({
+ firstName: "",
+ lastName: "",
+ dob: "",
+ gender: "",
+ email: "",
+ phone: ""
+ });
-
+ const [isOpen, setIsOpen] = useState(false);
-
-
- Add Sub Admin Account
-
+ const handleChange = (e: React.ChangeEvent) => {
+ const { name, value } = e.target;
+ setFormData(prev => ({
+ ...prev,
+ [name]: value
+ }));
+ };
-
-
+ const handleSubmit = async () => {
+ const { firstName, lastName, dob, gender, email, phone } = formData;
+
+ if (!firstName || !lastName || !dob || !gender || !email || !phone) {
+ toaster.create({
+ title: "Error",
+ description: "Please fill in all required fields",
+ type: "error",
+ });
+ return;
+ }
-
- First Name
-
+ const payload = {
+ // principal_type_xid: 4,
+ // principal_source_xid: 1,
+ // user_name: `${firstName} ${lastName}`,
+ first_name: firstName,
+ last_name: lastName,
+ date_of_birth: dob,
+ gender,
+ email_address: email,
+ phone_number: phone,
+ created_by: 1,
+ };
- Last Name
-
+ try {
+ const response = await createSubAdminPost(payload).unwrap();
+
+ if (response.status === "success") {
+ toaster.create({
+ title: "Success",
+ description: response.message || "Sub-admin added successfully",
+ type: "success",
+ });
+ refetch();
+ setIsOpen(false);
+ }
+ } catch (error: any) {
+ toaster.create({
+ title: "Error",
+ description: error?.data?.message || "Failed to create sub-admin",
+ type: "error",
+ });
+ }
+ };
- DOB
-
+ return (
+ setIsOpen(details.open)}
+ placement="center"
+ >
+
+
+
- Gender
-
- Permissions
-
-
- Dashboard
- Manage contact us
- manage User
- Manage CMS
- Manage Post
- Manage Reports
- manage Sub-Admin
- My profile
- Manage Jobs
- manage feedbacks
- Manage community
- Notification
-
-
-
-
-
-
+
+
+
+ Add Sub Admin Account
+
+
-
-
-
+
+
+
+
+ First Name
+
+
- )
+
+ Last Name
+
+
+
+
+ DOB
+
+
+
+
+ Gender
+
+
+
+
+ Email
+
+
+
+
+ Phone Number
+
+
+
+
+ Permissions
+
+
+
+
+
+ Dashboard
+
+
+ Manage contact us
+
+
+ Manage User
+
+
+ Manage CMS
+
+
+ Manage Post
+
+
+ Manage Reports
+
+
+ Manage Sub-Admin
+
+
+ My Profile
+
+
+ Manage Jobs
+
+
+ Manage Feedbacks
+
+
+ Manage Community
+
+
+ Notification
+
+
+
+
+
+
+
+
+
+
+
+
+ );
}
-export default AddModel
\ No newline at end of file
+export default AddModel;
diff --git a/src/Redux/Service/faqs.service.ts b/src/Redux/Service/faqs.service.ts
index 332b87c..2d72f23 100644
--- a/src/Redux/Service/faqs.service.ts
+++ b/src/Redux/Service/faqs.service.ts
@@ -69,6 +69,7 @@ export const faqs = createApi({
body: { id, is_active },
}),
}),
+
deleteFaqPost: builder.mutation<{ status: string; message: string }, { id: number }>({
query: ({ id }) => ({
diff --git a/src/Redux/Service/manage.subadmin.service.ts b/src/Redux/Service/manage.subadmin.service.ts
index d10fbe6..a975d62 100644
--- a/src/Redux/Service/manage.subadmin.service.ts
+++ b/src/Redux/Service/manage.subadmin.service.ts
@@ -40,7 +40,6 @@ interface ApiResponse {
data: PaginatedData;
}
-
// export type SubAdminPost = {
// id: number;
// first_name: string,
@@ -80,11 +79,30 @@ interface SubAdminView {
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({
reducerPath: "manageSubAdmin",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
- tagTypes: ['SubAdmin'],
+ tagTypes: ["SubAdmin"],
endpoints: (builder) => ({
createFaqPost: builder.mutation>({
query: (data) => ({
@@ -94,11 +112,11 @@ export const manageSubAdmin = createApi({
}),
}),
getSubAdmin: builder.query({
- query: () => `/sub-admin`
+ query: () => `/sub-admin`,
}),
viewSubAdmin: builder.query({
- query: (id) => `/sub-admin-view/${id}`
+ query: (id) => `/sub-admin-view/${id}`,
}),
updateSubAdmin: builder.mutation({
@@ -109,6 +127,15 @@ export const manageSubAdmin = createApi({
}),
}),
+ createSubAdminPost: builder.mutation({
+ query: (data) => ({
+ url: "/sub-admin-create",
+ method: "POST",
+ body: data,
+ }),
+ invalidatesTags: ["SubAdmin"], // Add this to invalidate cache
+ }),
+
faqToggle: builder.mutation({
query: ({ id, is_active }) => ({
url: `/faq-status`,
@@ -131,10 +158,11 @@ export const {
useLazyViewSubAdminQuery,
useUpdateSubAdminMutation,
useDeleteSubAdminPostMutation,
+ useCreateSubAdminPostMutation
} = manageSubAdmin;
export type Post = {
id: number;
title: string;
body: string;
-};
\ No newline at end of file
+};
From 0531684c73f0ec11886cdc327adb6153d1b3a004 Mon Sep 17 00:00:00 2001
From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com>
Date: Wed, 18 Jun 2025 15:34:32 +0530
Subject: [PATCH 2/2] [ update changes ]
---
.env | 4 +-
index.html | 3 +-
src/Pages/ManageCMS/FAQ/FAQ.tsx | 2 +-
src/Pages/ManageCMS/FAQ/FaqAddModel.tsx | 2 +-
.../ManageCMS/PrivacyPolicy/PrivacyPolicy.tsx | 89 ++--
.../TermsAndConditions/TermsAndConditions.tsx | 108 ++--
src/Pages/ManageContact/ManageContact.tsx | 106 ++--
src/Pages/ManageGroups/ManageGroups.tsx | 3 +
src/Pages/ManageJobs/ManageJobs.tsx | 113 ++++-
src/Pages/ManageJobs/ViewManageJob.tsx | 467 +++++++++---------
.../DeactivatedAccounts.tsx | 81 ++-
.../RegisterUsers/RegisterUsers.tsx | 2 +-
.../AgencyMaster/AgencyMaster.tsx | 2 +-
.../AgencyMaster/ViewAgencyAddModel.tsx | 2 +-
src/Pages/SetNewPassword.tsx | 321 ++++++------
src/Pages/SubAdmin/AddModel.tsx | 213 +++-----
src/Pages/SubAdmin/ViewSubAdmin.tsx | 2 +-
.../Service/agency.master.module.service.ts | 1 +
.../Service/deactivated.account.service.ts | 48 +-
src/Redux/Service/faqs.service.ts | 2 +-
src/Redux/Service/manage.contactus.service.ts | 51 +-
src/Redux/Service/manage.jobs.service.ts | 16 +-
src/Redux/Service/manage.subadmin.service.ts | 21 +-
src/components/AlertDailog.tsx | 16 +-
24 files changed, 952 insertions(+), 723 deletions(-)
diff --git a/.env b/.env
index 5f21366..7328291 100644
--- a/.env
+++ b/.env
@@ -4,8 +4,8 @@
# VITE_PASSWORD="71%@L%es^bUX94`J9XT*@bh,._WWM{$%^^&&"
# VITE_APP_NAME=MyViteApp
# VITE_IMG_TEMPLATES='https://ssa.betadelivery.com/storage/app/public/uploads/post_templates/'
-# VITE_API_URL='https://ssa.betadelivery.com/testing/apia/v1'
-VITE_API_URL='https://ssa.betadelivery.com/apia/v1'
+VITE_API_URL='https://ssa.betadelivery.com/testing/apia/v1'
+# VITE_API_URL='https://ssa.betadelivery.com/apia/v1'
VITE_USER_NAME="Admin"
VITE_PASSWORD="71%@L%es^bUX94`J9XT*@bh,._WWM{$%^^&&"
# VITE_PASSWORD="71%@L%es^bUX94`J9XT*%4&^%tUU^%Q^ffgt"
diff --git a/index.html b/index.html
index 58b50b9..cd3d9f3 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,8 @@
-
+
+
SEO Admin
diff --git a/src/Pages/ManageCMS/FAQ/FAQ.tsx b/src/Pages/ManageCMS/FAQ/FAQ.tsx
index c1def1d..c146c8a 100644
--- a/src/Pages/ManageCMS/FAQ/FAQ.tsx
+++ b/src/Pages/ManageCMS/FAQ/FAQ.tsx
@@ -160,7 +160,7 @@ const FAQ = () => {
handleDeleteFaq(selectedFaqId);
}
}}
- />
+ />
Add
-
+
diff --git a/src/Pages/ManageCMS/PrivacyPolicy/PrivacyPolicy.tsx b/src/Pages/ManageCMS/PrivacyPolicy/PrivacyPolicy.tsx
index 5d0e1eb..ea303e5 100644
--- a/src/Pages/ManageCMS/PrivacyPolicy/PrivacyPolicy.tsx
+++ b/src/Pages/ManageCMS/PrivacyPolicy/PrivacyPolicy.tsx
@@ -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 MainFrame from "../../../components/MainFrame";
import { Spinner } from "../../../components/Sipnner/Spinner";
@@ -6,54 +6,77 @@ import PrivacyPolicyAddModel from "./PrivacyPolicyAddModel";
import GlobalStateContext from "../../../Contexts/GlobalStateContext";
import { useContext, useEffect } from "react";
-
const PrivacyPolicy = () => {
const { data, isLoading, isFetching, refetch } = useGetPrivacyPolicyQuery();
- console.log('PRIVACY', data?.data);
-
+ console.log("PRIVACY", data?.data);
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;
useEffect(() => {
- setIsBarLoading(isFetching)
- }, [data])
+ setIsBarLoading(isFetching);
+ }, [data]);
-console.log('Privacy Policy Data:', data?.data);
+ console.log("Privacy Policy Data:", data?.data);
return (
-
- {isLoading || isFetching ?
- : data?.data?.map(({ id, content, privacy_language }) =>
-
+
+ Privacy Policy
+
+
+
+ {isLoading || isFetching ? (
+
+ ) : (
+ data?.data?.map(({ id, content, privacy_language }) => (
+
-
- Privacy Policy 🎓 {privacy_language?.language_name}
-
+
+
+
+ 🎓 {privacy_language?.language_name}
+
+
-
-
-
-
- )}
+
+
+
+
+ ))
+ )}
);
};
-export default PrivacyPolicy;
\ No newline at end of file
+export default PrivacyPolicy;
diff --git a/src/Pages/ManageCMS/TermsAndConditions/TermsAndConditions.tsx b/src/Pages/ManageCMS/TermsAndConditions/TermsAndConditions.tsx
index cff201b..16b796a 100644
--- a/src/Pages/ManageCMS/TermsAndConditions/TermsAndConditions.tsx
+++ b/src/Pages/ManageCMS/TermsAndConditions/TermsAndConditions.tsx
@@ -1,59 +1,67 @@
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 { useGetTermsQuery } from "../../../Redux/Service/terms.and.condition.service";
-
const TermsAndConditions = () => {
- const { data, refetch, isLoading, isFetching } = useGetTermsQuery()
+ const { data, refetch, isLoading, isFetching } = useGetTermsQuery();
+
+ console.log(data);
return (
+
+
+
+
+ Terms and Conditions
+
+
-
-
-
- Terms and Conditions
-
-
- {isLoading || isFetching ? (
-
- ) : (
- data?.data?.map(({ id, content, terms_cond_language }) => (
-
-
-
-
-
- 🎓 {terms_cond_language?.language_name}
-
-
-
- {/* Pass Data to AboutUsAddModel */}
-
-
-
- {/* {content} */}
-
+ {isLoading || isFetching ? (
+
+ ) : (
+ data?.data?.map(({ id, content, terms_cond_language }) => (
+
+
+
+
+ 🎓 {terms_cond_language?.language_name}
+
-
- ))
- )}
-
-
-
- )
-}
-export default TermsAndConditions
\ No newline at end of file
+
+ {/* Pass Data to AboutUsAddModel */}
+
+
+
+ {/* {content} */}
+
+
+
+ ))
+ )}
+
+
+ );
+};
+export default TermsAndConditions;
diff --git a/src/Pages/ManageContact/ManageContact.tsx b/src/Pages/ManageContact/ManageContact.tsx
index 9861955..259e6c7 100644
--- a/src/Pages/ManageContact/ManageContact.tsx
+++ b/src/Pages/ManageContact/ManageContact.tsx
@@ -1,38 +1,77 @@
import { Box, HStack, Input, Text } from "@chakra-ui/react";
-import MainFrame from "../../components/MainFrame"
-import PendingRequests from "../../Pages/ManageContact/PendingRequests"
+import MainFrame from "../../components/MainFrame";
+import PendingRequests from "../../Pages/ManageContact/PendingRequests";
import { InputGroup } from "../../components/ui/input-group";
import { LuSearch } from "react-icons/lu";
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
+const tableHeadRow = ["Sr. No", "Email id", "Name", "Date", "Action"];
-const tableHeadRow = [
- "Sr. No",
- "Email id",
- "Name",
- "Date",
- "Action",
-];
+const ManageContact = () => {
+ const { data, isLoading, isError } = useGetContactQuery();
+ const [localData, setLocalData] = useState([]);
-const managepost: any[] = [
- ...Array.from({ length: 12 }, (_, i) => ({
- "Sr. No": i + 1,
- "Email id": "ABC@gmail.com",
- "Name": "Pooja",
- "Date": "11/02/1989",
- "Action": (
+ useEffect(() => {
+ if (data) {
+ setLocalData((data as any)?.data?.data || []);
+ }
+ }, [data]);
+
+ 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: (
),
- })),
-];
+ }));
+
+ if (isLoading) {
+ return (
+
+
+
+
+
+ );
+ }
+
+ if (isError) {
+ return (
+
+
+ Error loading data
+
+
+ );
+ }
-const ManageContact = () => {
return (
-
{
px={3}
>
- Contact Requests
+ Contact Requests
-
-
+
+
}
color={"#000"}
>
@@ -63,20 +105,20 @@ const ManageContact = () => {
size={"xs"}
fontSize={"sm"}
placeholder="Search..."
- bgColor={'#EEEEEE'}
+ bgColor={"#EEEEEE"}
ps={8}
/>
- {/* */}
-
+
- )
-}
-export default ManageContact
\ No newline at end of file
+ );
+};
+
+export default ManageContact;
diff --git a/src/Pages/ManageGroups/ManageGroups.tsx b/src/Pages/ManageGroups/ManageGroups.tsx
index 86f0570..fc57d8b 100644
--- a/src/Pages/ManageGroups/ManageGroups.tsx
+++ b/src/Pages/ManageGroups/ManageGroups.tsx
@@ -48,6 +48,9 @@ const managepost: any[] = [
),
})),
];
+
+
+
const ManageGroups = () => {
return (
diff --git a/src/Pages/ManageJobs/ManageJobs.tsx b/src/Pages/ManageJobs/ManageJobs.tsx
index 744fd6e..ce55ef5 100644
--- a/src/Pages/ManageJobs/ManageJobs.tsx
+++ b/src/Pages/ManageJobs/ManageJobs.tsx
@@ -1,7 +1,10 @@
import {
- Box, HStack,
- // Image,
- Input, Text
+ Box,
+ HStack,
+ Image,
+ // Image,
+ Input,
+ Text,
} from "@chakra-ui/react";
import { LuSearch } from "react-icons/lu";
// import { RiDeleteBin5Line } from "react-icons/ri";
@@ -11,6 +14,15 @@ import MainFrame from "../../components/MainFrame";
import { InputGroup } from "../../components/ui/input-group";
import ManageJobsAdd from "./ManageJobsAdd";
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 { useGetManageJobsQuery } from "../../Redux/Service/manage.jobs.service";
// import Delete from "../../components/ActionIcons/Delete";
@@ -27,36 +39,93 @@ const tableHeadRow = [
"Action",
];
-const managepost: any[] = [
- ...Array.from({ length: 12 }, (_, i) => ({
- "Sr. No": i + 1,
- "Job Title": "Freelance content writer",
- "Workspace mode": "Onsite",
- Category: "IT",
- "Sub-category": "Flutter dev",
- Salary: "3.5 LPA",
+const ManageJobs = () => {
+ const [currentPage] = useState(1);
+ const [localData, setLocalData] = useState([]);
+ const { data, refetch, isLoading } = useGetManageJobsQuery(currentPage);
+ const [deleteJobsPost] = useDeleteJobsPostMutation();
+ const [deleteModal, setDeleteModal] = useState(false);
+ const [selectedJobsId, setSelectedJobsId] = useState(null);
+
+ 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: (
- {/* }
- alertText="Delete Users"
+ (
+ {
+ setSelectedJobsId(agency.id);
+ setDeleteModal(true);
+ }}
+ />
+ )}
+ alertText="Delete FAQ"
alertIcon={}
alertCaption="are you sure you want to delete ?"
+ onClose={() => setDeleteModal(false)}
onConfirm={() => {
- console.log("User deleted:", i + 1);
+ // console.log("Deleting FAQ with ID:", selectedFaqId); // Correct ID
+ if (selectedJobsId) {
+ setDeleteModal(false);
+ handleDeleteJobs(selectedJobsId);
+ }
}}
- /> */}
+ />
),
- })),
-];
+ }));
-const ManageJobs = () => {
- // const [currentPage, setCurrentPage] = useState(1);
- // const { data, refetch } = useGetManageJobsQuery(currentPage)
- // console.log(data?.data.data);
+ if (isLoading) {
+ return (
+
+
+
+
+
+ );
+ }
return (
diff --git a/src/Pages/ManageJobs/ViewManageJob.tsx b/src/Pages/ManageJobs/ViewManageJob.tsx
index bb3edc4..951f1ed 100644
--- a/src/Pages/ManageJobs/ViewManageJob.tsx
+++ b/src/Pages/ManageJobs/ViewManageJob.tsx
@@ -27,6 +27,7 @@ import {
SelectTrigger,
} from "../../components/ui/select";
import View from "../../components/ActionIcons/View";
+import { useLazyViewJobsQuery } from "../../Redux/Service/manage.jobs.service";
const frameworks = createListCollection({
items: [
@@ -37,238 +38,258 @@ const frameworks = createListCollection({
],
});
function ViewManageJob() {
+ const [trigger, { data }] = useLazyViewJobsQuery();
+
+ console.log(data);
+
+ // const handleView = () => {
+ // trigger(id);
+ // };
+
+ const viewJobs = data;
+
+ console.log();
+
return (
-
+
+
+
-
-
-
- Add Details
-
-
+ {/* {viewJobs?.map((data: any) => ( */}
+
+
+
+ Add Details
+
+
-
-
-
-
- Job title
-
-
-
-
-
- Workspace mode
-
-
-
-
-
- Category
-
-
-
-
-
- Sub-Category
-
-
-
-
-
- Salary
-
-
-
-
-
- Experience
-
-
-
-
-
- Job Location
-
-
-
- {/* Country Selection
- */}
-
-
- Country Selection
-
-
-
+
+
+
+ Job title
+
+
-
-
- {frameworks.items.map((movie) => (
-
- {movie.label}
-
- ))}
-
-
+
+
+
+ Workspace mode
+
+
+
+
+
+ Category
+
+
+
+
+
+ Sub-Category
+
+
+
+
+
+ Salary
+
+
+
+
+
+ Experience
+
+
+
+
+
+ Job Location
+
+
+
+ {/* Country Selection
+ */}
+
+
+ Country Selection
+
+
+
+
+
+ {frameworks.items.map((movie) => (
+
+ {movie.label}
+
+ ))}
+
+
-
-
- Job type
-
-
-
-
-
- Skills required
-
-
-
-
-
- Job Description*
-
-
-
-
-
- Upload Image
-
-
-
-
-
-
-
-
+
+
+ Job type
+
+
+
+
+
+ Skills required
+
+
+
+
+
+ Job Description*
+
+
+
+
+
+ Upload Image
+
+
+
+
+
+
+
+
-
-
+
+
+ {/* ))} */}
);
}
diff --git a/src/Pages/ManageUsers/DeactivatedAccounts/DeactivatedAccounts.tsx b/src/Pages/ManageUsers/DeactivatedAccounts/DeactivatedAccounts.tsx
index 93c5727..2548e24 100644
--- a/src/Pages/ManageUsers/DeactivatedAccounts/DeactivatedAccounts.tsx
+++ b/src/Pages/ManageUsers/DeactivatedAccounts/DeactivatedAccounts.tsx
@@ -4,34 +4,80 @@ import DataTable from "../../../components/DataTable";
import { Switch } from "../../../components/ui/switch";
import { InputGroup } from "../../../components/ui/input-group";
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";
const tableHeadRow = [
"Sr. No",
"First Name",
"Last Name",
- "Company name",
+ "User Type",
"Activate/Deactivate",
];
-const manageUser: any[] = [
- ...Array.from({ length: 12 }, (_, i) => ({
- "Sr. No": i + 1,
- "First Name": "Ritesh",
- "Last Name": "akanksha@gmail.com",
- "Company name": "9876543210",
+const DeactivatedAccounts = () => {
+ const { data ,isLoading} = useGetContactQuery();
+ const [localData, setLocalData] = useState([]);
+
+ useEffect(() => {
+ if (data) {
+ setLocalData((data as any)?.data?.data || []);
+ }
+ }, [data]);
+
+
+ const manageUser = localData?.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": (
-
-
+
+ handleToggle(agency.id, agency.is_active ? "1" : "0")}
+ />
),
- })),
-];
+ }));
+
+ if (isLoading) {
+ return (
+
+
+
+
+
+ );
+ }
+
+ // if (isError) {
+ // return (
+ //
+ //
+ // Error loading data
+ //
+ //
+ // );
+ // }
-const DeactivatedAccounts = () => {
return (
- {
px={3}
>
- Deactivated User Accounts
+ Deactivated User Accounts
+
}
color={"#000"}
>
@@ -59,7 +108,7 @@ const DeactivatedAccounts = () => {
size={"2xs"}
fontSize={"sm"}
placeholder="Search..."
- bgColor={'#EEEEEE'}
+ bgColor={"#EEEEEE"}
ps={8}
/>
diff --git a/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx b/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx
index 484953f..f21de9e 100644
--- a/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx
+++ b/src/Pages/ManageUsers/RegisterUsers/RegisterUsers.tsx
@@ -116,7 +116,7 @@ const RegisterUsers = () => {
"DOB": agency.date_of_birth ? new Date(agency.date_of_birth).toLocaleDateString('en-GB').replace(/\//g, '-') : 'N/A',
"Type Of User": agency.principal_type?.principal_type_title || 'N/A',
// "Language": agency.principle_language_links.map(lang => lang.language_name).join(', ') || 'N/A',
- "Action": (
+ "Action": (
{
}}
onPageChange={handlePageChange}
/>
-
+
)
}
diff --git a/src/Pages/MasterModule/AgencyMaster/ViewAgencyAddModel.tsx b/src/Pages/MasterModule/AgencyMaster/ViewAgencyAddModel.tsx
index ccb782f..5658426 100644
--- a/src/Pages/MasterModule/AgencyMaster/ViewAgencyAddModel.tsx
+++ b/src/Pages/MasterModule/AgencyMaster/ViewAgencyAddModel.tsx
@@ -28,7 +28,7 @@ function ViewAgencyAddModel({ refetch }: { refetch: VoidFunction }) {
...prev,
[name]: value,
}));
- }
+ }
const handleSubmit = async () => {
console.log("New Data:", formData);
diff --git a/src/Pages/SetNewPassword.tsx b/src/Pages/SetNewPassword.tsx
index 46f66e8..cb2d940 100644
--- a/src/Pages/SetNewPassword.tsx
+++ b/src/Pages/SetNewPassword.tsx
@@ -1,13 +1,13 @@
import {
- Box,
- Center,
- HStack,
- IconButton,
- Image,
- Input,
- Stack,
- Text,
- VStack,
+ Box,
+ Center,
+ HStack,
+ IconButton,
+ Image,
+ Input,
+ Stack,
+ Text,
+ VStack,
} from "@chakra-ui/react";
import axios from "axios";
import { useState } from "react";
@@ -19,154 +19,179 @@ import { InputGroup } from "../components/ui/input-group";
import { LuEye, LuEyeOff } from "react-icons/lu";
const SetNewPassword = () => {
- const [password, setPassword] = useState("");
- const [confirmPassword, setConfirmPassword] = useState("");
- const [isLoading, setIsLoading] = useState(false);
- const navigate = useNavigate();
- const queryParams = new URLSearchParams(window.location.search);
- const id = queryParams.get("id");
- const [showOldPassword, setShowOldPassword] = useState(false);
- const [showNewPassword, setShowNewPassword] = useState(false);
+ const [password, setPassword] = useState("");
+ const [confirmPassword, setConfirmPassword] = useState("");
+ const [isLoading, setIsLoading] = useState(false);
+ const navigate = useNavigate();
+ const queryParams = new URLSearchParams(window.location.search);
+ const id = queryParams.get("id");
+ const [showOldPassword, setShowOldPassword] = useState(false);
+ const [showNewPassword, setShowNewPassword] = useState(false);
- const handlePasswordSubmit = async () => {
- // Validation
- if (password.length < 8) {
- toaster.create({
- title: "Password must be at least 8 characters long",
- type: "error",
- });
- return;
+ const handlePasswordSubmit = async () => {
+ // Validation
+ if (password.length < 8) {
+ toaster.create({
+ title: "Password must be at least 8 characters long",
+ type: "error",
+ });
+ 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) {
- toaster.create({
- title: "Passwords do not match",
- type: "error",
- });
- return;
- }
+ if (res.data.status === "success") {
+ toaster.create({
+ title: "Password updated successfully",
+ type: "success",
+ });
+ 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 (
+
+
+
+
- try {
- const res = await axios.post(`${import.meta.env.VITE_API_URL}/update-password`, {
- password: password,
- confirm_password: confirmPassword,
- id: Number(id)
- });
+
+
+
+ Create a Password
+
- if (res.data.status === 'success') {
- toaster.create({
- title: "Password updated successfully",
- type: "success",
- });
- 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);
- }
- };
+
+
+
+ New password
+
+ setShowOldPassword(!showOldPassword)}
+ // _hover={{ bg: "transparent" }}
+ bg={"transparent"}
+ color={"#000"}
+ height={"fit-content"}
+ mr={2}
+ >
+ {showOldPassword ? : }
+
+ }
+ >
+ setPassword(e.target.value)}
+ size={"sm"}
+ />
+
+
- return (
-
-
-
-
+
+
+ Confirm password
+
+ setShowNewPassword(!showNewPassword)}
+ bg={"transparent"}
+ color={"#000"}
+ mr={2}
+ >
+ {showNewPassword ? : }
+
+ }
+ >
+ setConfirmPassword(e.target.value)}
+ size={"sm"}
+ />
+
+
+
-
-
-
- Create a Password
-
+
+
+
-
- New password
- setShowOldPassword(!showOldPassword)}
- _hover={{ bg: "transparent" }}
- height={'fit-content'}
- mr={2}
- >
- {showOldPassword ? : }
-
- }>
- setPassword(e.target.value)}
- />
-
-
- Confirm password
- setShowNewPassword(!showNewPassword)}
- _hover={{ bg: "transparent" }}
- height={'fit-content'}
- mr={2}
- >
- {showNewPassword ? : }
-
- }>
- setConfirmPassword(e.target.value)}
- />
-
-
-
-
-
-
-
-
-
- );
+
+
+ );
};
export default SetNewPassword;
diff --git a/src/Pages/SubAdmin/AddModel.tsx b/src/Pages/SubAdmin/AddModel.tsx
index ce5b260..d644cac 100644
--- a/src/Pages/SubAdmin/AddModel.tsx
+++ b/src/Pages/SubAdmin/AddModel.tsx
@@ -1,4 +1,3 @@
-import { useState } from "react";
import { Button } from "../../components/ui/button";
import {
DialogBody,
@@ -10,45 +9,32 @@ import {
DialogTitle,
DialogTrigger,
} from "../../components/ui/dialog";
-import {
- Field,
- Grid,
- Heading,
- Input,
- Stack,
- Text,
-} from "@chakra-ui/react";
+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({ refetch }: { refetch: VoidFunction }) {
- const [createSubAdminPost, { isLoading }] = useCreateSubAdminPostMutation();
+ const [createSubAdminPost] = useCreateSubAdminPostMutation();
- const [formData, setFormData] = useState({
- firstName: "",
- lastName: "",
- dob: "",
- gender: "",
- email: "",
- phone: ""
- });
-
- const [isOpen, setIsOpen] = useState(false);
-
- const handleChange = (e: React.ChangeEvent) => {
- const { name, value } = e.target;
- setFormData(prev => ({
- ...prev,
- [name]: value
- }));
- };
+ // State fields
+ const [firstName, setFirstName] = useState("");
+ const [lastName, setLastName] = useState("");
+ const [userName, setUserName] = useState("");
+ const [dateOfBirth, setDateOfBirth] = useState("");
+ const [gender, setGender] = useState("");
+ const [ setIsOpen] = useState(false);
const handleSubmit = async () => {
- const { firstName, lastName, dob, gender, email, phone } = formData;
-
- if (!firstName || !lastName || !dob || !gender || !email || !phone) {
+ if (
+ !firstName.trim() ||
+ !lastName.trim() ||
+ !userName.trim() ||
+ !dateOfBirth.trim() ||
+ !gender.trim()
+ ) {
toaster.create({
title: "Error",
description: "Please fill in all required fields",
@@ -58,45 +44,46 @@ function AddModel({ refetch }: { refetch: VoidFunction }) {
}
const payload = {
- // principal_type_xid: 4,
- // principal_source_xid: 1,
- // user_name: `${firstName} ${lastName}`,
+ principal_type_xid: 4,
+ principal_source_xid: 1,
+ user_name: userName,
first_name: firstName,
last_name: lastName,
- date_of_birth: dob,
- gender,
- email_address: email,
- phone_number: phone,
+ date_of_birth: dateOfBirth,
+ gender: gender,
+ email_address: "example@yopmail.com", // Hardcoded
+ phone_number: "9876543210", // Hardcoded
created_by: 1,
};
try {
const response = await createSubAdminPost(payload).unwrap();
-
- if (response.status === "success") {
+ if (response) {
toaster.create({
title: "Success",
- description: response.message || "Sub-admin added successfully",
+ description: "Sub-admin created successfully",
type: "success",
});
refetch();
setIsOpen(false);
+ setFirstName("");
+ setLastName("");
+ setUserName("");
+ setDateOfBirth("");
+ setGender("");
}
- } catch (error: any) {
+ } catch (error) {
+ console.error("Error creating sub-admin:", error);
toaster.create({
title: "Error",
- description: error?.data?.message || "Failed to create sub-admin",
+ description: "Failed to create sub-admin",
type: "error",
});
}
};
return (
- setIsOpen(details.open)}
- placement="center"
- >
+
diff --git a/src/Pages/SubAdmin/ViewSubAdmin.tsx b/src/Pages/SubAdmin/ViewSubAdmin.tsx
index 55840a7..63ab141 100644
--- a/src/Pages/SubAdmin/ViewSubAdmin.tsx
+++ b/src/Pages/SubAdmin/ViewSubAdmin.tsx
@@ -30,7 +30,7 @@ function ViewSubAdmin({ id }: { id: number }) {
const handleView = () => {
trigger(id)
}
-
+
const viewSubAdmin = data?.data
const formatDateOfBirth = (dob: string): string => {
diff --git a/src/Redux/Service/agency.master.module.service.ts b/src/Redux/Service/agency.master.module.service.ts
index f96d017..65fa22f 100644
--- a/src/Redux/Service/agency.master.module.service.ts
+++ b/src/Redux/Service/agency.master.module.service.ts
@@ -99,3 +99,4 @@ export const {
useAgencyMasterToggleMutation,
useUpdateAgencyMasterMutation,
} = agencyMasterModule;
+
\ No newline at end of file
diff --git a/src/Redux/Service/deactivated.account.service.ts b/src/Redux/Service/deactivated.account.service.ts
index da76c97..b355471 100644
--- a/src/Redux/Service/deactivated.account.service.ts
+++ b/src/Redux/Service/deactivated.account.service.ts
@@ -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";
+interface DeactivatedData {
+ id: number;
+ email: string;
+ first_name: string;
+ created_at: string;
+}
+
+interface ApiResponse {
+ data: {
+ data: DeactivatedData[];
+ };
+}
+
export const deactivatedAccounts = createApi({
- reducerPath: "deactivatedAccounts",
- baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
- endpoints: (builder) => ({
-
-
-
- getPosts: builder.query({ query: () => "/posts" }),
-
-
-
-
-
+ reducerPath: "deactivatedAccounts",
+ baseQuery: baseQueryWithReauth,
+ tagTypes: ["Deactivated"],
+ endpoints: (builder) => ({
+ getContact: builder.query({
+ query: () => "/manage-user-deactivate-list",
+ providesTags: ["Deactivated"],
}),
- });
-
- export const { } = deactivatedAccounts;
-
- export type Post = {
- id: number;
- title: string;
- body: string;
- };
\ No newline at end of file
+ }),
+});
+
+// ✅ Export the auto-generated hook
+export const { useGetContactQuery } = deactivatedAccounts;
diff --git a/src/Redux/Service/faqs.service.ts b/src/Redux/Service/faqs.service.ts
index 2d72f23..239089f 100644
--- a/src/Redux/Service/faqs.service.ts
+++ b/src/Redux/Service/faqs.service.ts
@@ -69,7 +69,7 @@ export const faqs = createApi({
body: { id, is_active },
}),
}),
-
+
deleteFaqPost: builder.mutation<{ status: string; message: string }, { id: number }>({
query: ({ id }) => ({
diff --git a/src/Redux/Service/manage.contactus.service.ts b/src/Redux/Service/manage.contactus.service.ts
index 20b3890..546d4a8 100644
--- a/src/Redux/Service/manage.contactus.service.ts
+++ b/src/Redux/Service/manage.contactus.service.ts
@@ -1,26 +1,33 @@
-import { createApi } from "@reduxjs/toolkit/query";
+import { createApi } from "@reduxjs/toolkit/query/react";
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({
- reducerPath: "manageContactUs",
- baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
- endpoints: (builder) => ({
-
-
-
- getPosts: builder.query({ query: () => "/posts" }),
-
-
-
-
-
+ reducerPath: "manageContactUs",
+ baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
+ tagTypes: ["Contact"],
+ endpoints: (builder) => ({
+
+
+ getContact: builder.query({
+ query: () => "/contact-us",
+ providesTags: ["Contact"],
}),
- });
-
- export const { } = manageContactUs;
-
- export type Post = {
- id: number;
- title: string;
- body: string;
- };
\ No newline at end of file
+
+
+ }),
+});
+
+export const { useGetContactQuery } = manageContactUs;
diff --git a/src/Redux/Service/manage.jobs.service.ts b/src/Redux/Service/manage.jobs.service.ts
index 0ce6b24..728b3a1 100644
--- a/src/Redux/Service/manage.jobs.service.ts
+++ b/src/Redux/Service/manage.jobs.service.ts
@@ -62,7 +62,7 @@ export interface CountryEdit {
}
-export type PostJobStatus = {
+export type PostJobStatus = {
title: string
};
@@ -70,15 +70,27 @@ export const manageJobs = createApi({
reducerPath: "manageJobs",
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
endpoints: (builder) => ({
+
getManageJobs: builder.query({
query: (page = 1) => `/manage-jobs-list?page=${page}`,
}),
+ viewJobs: builder.query({
+ 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;
diff --git a/src/Redux/Service/manage.subadmin.service.ts b/src/Redux/Service/manage.subadmin.service.ts
index a975d62..082a66b 100644
--- a/src/Redux/Service/manage.subadmin.service.ts
+++ b/src/Redux/Service/manage.subadmin.service.ts
@@ -104,6 +104,7 @@ export const manageSubAdmin = createApi({
baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
tagTypes: ["SubAdmin"],
endpoints: (builder) => ({
+
createFaqPost: builder.mutation>({
query: (data) => ({
url: "/faq-store",
@@ -111,6 +112,7 @@ export const manageSubAdmin = createApi({
body: data,
}),
}),
+
getSubAdmin: builder.query({
query: () => `/sub-admin`,
}),
@@ -127,14 +129,17 @@ export const manageSubAdmin = createApi({
}),
}),
- createSubAdminPost: builder.mutation({
- query: (data) => ({
- url: "/sub-admin-create",
- method: "POST",
- body: data,
+ createSubAdminPost: builder.mutation<
+ CreateSubAdminResponse,
+ CreateSubAdminPayload
+ >({
+ query: (data) => ({
+ url: "/sub-admin-create",
+ method: "POST",
+ body: data,
+ }),
+ invalidatesTags: ["SubAdmin"], // Add this to invalidate cache
}),
- invalidatesTags: ["SubAdmin"], // Add this to invalidate cache
- }),
faqToggle: builder.mutation({
query: ({ id, is_active }) => ({
@@ -158,7 +163,7 @@ export const {
useLazyViewSubAdminQuery,
useUpdateSubAdminMutation,
useDeleteSubAdminPostMutation,
- useCreateSubAdminPostMutation
+ useCreateSubAdminPostMutation,
} = manageSubAdmin;
export type Post = {
diff --git a/src/components/AlertDailog.tsx b/src/components/AlertDailog.tsx
index 916cf99..3b536dd 100644
--- a/src/components/AlertDailog.tsx
+++ b/src/components/AlertDailog.tsx
@@ -40,8 +40,9 @@ const AlertDailog: React.FC = ({
size={"xs"}
role="alertdialog"
open={isOpen}
+
>
-
+
{button ? (
button
) : (
@@ -134,3 +135,16 @@ const AlertDailog: React.FC = ({
};
export default AlertDailog;
+
+
+// import React from 'react'
+
+// const AlertDailog = () => {
+// return (
+//
+
+//
+// )
+// }
+
+// export default AlertDailog