Bug fixes and updates
This commit is contained in:
@@ -1,19 +1,26 @@
|
||||
import { Box, HStack, Input, Text } from "@chakra-ui/react";
|
||||
import { Box, HStack, Text } from "@chakra-ui/react";
|
||||
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 { 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";
|
||||
import { useDebounce } from "../../components/Hooks/useDebounce";
|
||||
import SearchComponent from "../../components/SearchComponent";
|
||||
|
||||
// table data
|
||||
const tableHeadRow = ["Sr. No", "Email id", "Name", "Date", "Action"];
|
||||
|
||||
const ManageContact = () => {
|
||||
const { data, isLoading, isError } = useGetContactQuery();
|
||||
const [localData, setLocalData] = useState([]);
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [localData, setLocalData] = useState<any[]>([]);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const debouncedSearchTerm = useDebounce(searchTerm, 500);
|
||||
const queryArgs = debouncedSearchTerm ? { page: currentPage, search: debouncedSearchTerm } : { page: currentPage };
|
||||
const { data, isLoading, isError, refetch, isFetching } = useGetContactQuery(queryArgs);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
@@ -21,6 +28,20 @@ const ManageContact = () => {
|
||||
}
|
||||
}, [data]);
|
||||
|
||||
const handlePageChange = (page: number) => {
|
||||
setCurrentPage(page);
|
||||
};
|
||||
|
||||
const handleSearchChange = (value: string) => {
|
||||
setSearchTerm(value);
|
||||
setCurrentPage(1);
|
||||
};
|
||||
|
||||
const filteredData = localData?.filter((agency) =>
|
||||
agency?.first_name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
agency?.email.toLowerCase().includes(searchTerm.toLowerCase())
|
||||
);
|
||||
|
||||
const formatDateOfBirth = (dob: string): string => {
|
||||
return new Date(dob).toLocaleDateString("en-GB", {
|
||||
day: "2-digit",
|
||||
@@ -29,14 +50,15 @@ const ManageContact = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const managepost = localData?.map((agency: any, index: number) => ({
|
||||
const managepost = filteredData?.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">
|
||||
<PendingRequests />
|
||||
Action: (
|
||||
<HStack justifyContent="center" cursor={agency.response_status === 0 ? 'pointer' : 'default'}>
|
||||
{agency.response_status === 0 ? <PendingRequests data={agency} refetch={refetch} /> : 'Resolved'}
|
||||
{/* <PendingRequests data={agency} refetch={refetch} /> */}
|
||||
</HStack>
|
||||
),
|
||||
}));
|
||||
@@ -86,35 +108,25 @@ const ManageContact = () => {
|
||||
</Text>
|
||||
|
||||
<HStack>
|
||||
<InputGroup
|
||||
startElement={
|
||||
<LuSearch
|
||||
fontSize={"xs"}
|
||||
style={{ position: "relative", left: "10px" }}
|
||||
/>
|
||||
}
|
||||
color={"#000"}
|
||||
>
|
||||
<Input
|
||||
p={3}
|
||||
w={300}
|
||||
bg={"#fff"}
|
||||
colorPalette={"blue"}
|
||||
_focus={{ border: "1px solid #02A0A0" }}
|
||||
rounded={"md"}
|
||||
size={"xs"}
|
||||
fontSize={"sm"}
|
||||
placeholder="Search..."
|
||||
bgColor={"#EEEEEE"}
|
||||
ps={8}
|
||||
/>
|
||||
</InputGroup>
|
||||
<SearchComponent
|
||||
value={searchTerm}
|
||||
onChange={handleSearchChange}
|
||||
/>
|
||||
</HStack>
|
||||
</HStack>
|
||||
<DataTable
|
||||
sortableColumns={["Name", "Registration Date "]}
|
||||
tableHeadRow={tableHeadRow}
|
||||
data={managepost || []} // Ensure an empty array is passed if managepost is undefined
|
||||
paginationData={{
|
||||
current_page: (data?.data as any)?.current_page || 1,
|
||||
last_page: (data?.data as any)?.last_page || 1,
|
||||
per_page: (data?.data as any)?.per_page || 10,
|
||||
total: (data?.data as any)?.total || 0
|
||||
}}
|
||||
onPageChange={handlePageChange}
|
||||
isLoading={isFetching}
|
||||
isError={isError}
|
||||
/>
|
||||
</Box>
|
||||
</MainFrame>
|
||||
|
||||
@@ -10,95 +10,158 @@ import {
|
||||
DialogTrigger,
|
||||
} from "../../components/ui/dialog";
|
||||
import { Badge, Field, HStack, Input, Stack, Textarea } from "@chakra-ui/react";
|
||||
function PendingRequests() {
|
||||
import { usePendingRequestMutation } from "../../Redux/Service/manage.contactus.service";
|
||||
import { useState } from "react";
|
||||
import { Toaster, toaster } from "../../components/ui/toaster";
|
||||
|
||||
function PendingRequests({ data, refetch }: { data: any, refetch: VoidFunction }) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [res, setRes] = useState({
|
||||
contact_us_xid: data.id,
|
||||
message: data.message,
|
||||
solution: '',
|
||||
})
|
||||
const [pendingRequest] = usePendingRequestMutation()
|
||||
|
||||
const handleOpenModal = () => {
|
||||
setIsOpen(true);
|
||||
};
|
||||
|
||||
|
||||
const handleSubmit = async (status: string) => {
|
||||
const payload = { ...res, response_status: status };
|
||||
|
||||
if(res.solution === ''){
|
||||
toaster.create({
|
||||
title: "Error",
|
||||
description: "All fields are required",
|
||||
type: "error",
|
||||
});
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const response = await pendingRequest(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) {
|
||||
toaster.create({
|
||||
title: "Error",
|
||||
description: "Something went wrong",
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<DialogRoot placement="center">
|
||||
<DialogTrigger asChild>
|
||||
<Badge fontSize={"xs"} px={2} bg={'#02a0a01f'}>
|
||||
Answer request
|
||||
</Badge>
|
||||
</DialogTrigger>
|
||||
<>
|
||||
<DialogRoot placement="center" key={data.id} open={isOpen} onOpenChange={({ open }) => setIsOpen(open)}>
|
||||
<DialogTrigger asChild>
|
||||
<Badge fontSize={"xs"} px={2} bg={'#02a0a01f'} onClick={handleOpenModal}>
|
||||
Answer request
|
||||
</Badge>
|
||||
</DialogTrigger>
|
||||
|
||||
<DialogContent
|
||||
bg={"#fff"}
|
||||
w={{ base: "90%", md: "400px" }}
|
||||
height={"auto"}
|
||||
p={3} // Reduced padding
|
||||
bgSize={"md"}
|
||||
>
|
||||
<DialogHeader bg="white">
|
||||
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
||||
Pending Requests
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<DialogBody bg="white">
|
||||
<Stack py={3}>
|
||||
<Field.Root>
|
||||
<Field.Label color="black" pt={1} fontSize="12px">
|
||||
Request Type
|
||||
</Field.Label>
|
||||
<Input
|
||||
placeholder="Message"
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
pl={1}
|
||||
fontSize="12px"
|
||||
height="30px"
|
||||
/>
|
||||
|
||||
<Field.Label color="black" pt={1} fontSize="12px">
|
||||
Solution
|
||||
</Field.Label>
|
||||
<Textarea
|
||||
placeholder=""
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
pl={1}
|
||||
fontSize="12px"
|
||||
height="80px"
|
||||
pt={1.5}
|
||||
/>
|
||||
</Field.Root>
|
||||
</Stack>
|
||||
</DialogBody>
|
||||
<DialogFooter
|
||||
display={{ base: "block", md: "flex" }}
|
||||
justifyContent="center"
|
||||
gap={1}
|
||||
pt={2}
|
||||
<DialogContent
|
||||
bg={"#fff"}
|
||||
w={{ base: "90%", md: "400px" }}
|
||||
height={"auto"}
|
||||
p={3} // Reduced padding
|
||||
bgSize={"md"}
|
||||
>
|
||||
<HStack mt={2} mb={3} width={"100%"} justifyContent={"space-between"}>
|
||||
<Button
|
||||
width={"48%"}
|
||||
color="black"
|
||||
_hover={{ bgColor: "white" }}
|
||||
variant="outline"
|
||||
borderRadius="sm"
|
||||
border="1px solid #02A0A0"
|
||||
size={"xs"}
|
||||
>
|
||||
Unresolved
|
||||
</Button>
|
||||
<Button
|
||||
width={"48%"}
|
||||
borderRadius="sm"
|
||||
// bgColor="#007F33"
|
||||
bgColor={"#02A0A0"}
|
||||
color="white"
|
||||
// colorPalette="#007F33"
|
||||
size={"xs"}
|
||||
>
|
||||
Resolved
|
||||
</Button>
|
||||
</HStack>
|
||||
</DialogFooter>
|
||||
<DialogHeader bg="white">
|
||||
<DialogTitle alignSelf="center" color="black" fontSize="14px">
|
||||
Pending Requests
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
|
||||
<DialogCloseTrigger color="black" />
|
||||
</DialogContent>
|
||||
</DialogRoot>
|
||||
<DialogBody bg="white">
|
||||
<Stack py={3}>
|
||||
<Field.Root>
|
||||
<Field.Label color="black" pt={1} fontSize="12px">
|
||||
Request Type
|
||||
</Field.Label>
|
||||
<Input
|
||||
placeholder="Message"
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
pl={1}
|
||||
fontSize="12px"
|
||||
height="30px"
|
||||
value={res.message}
|
||||
disabled
|
||||
// onChange={(e) => setRes({ ...res, message: e.target.value })}
|
||||
/>
|
||||
|
||||
<Field.Label color="black" pt={1} fontSize="12px">
|
||||
Solution
|
||||
</Field.Label>
|
||||
<Textarea
|
||||
placeholder=""
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
pl={1}
|
||||
fontSize="12px"
|
||||
height="80px"
|
||||
pt={1.5}
|
||||
onChange={(e) => setRes({ ...res, solution: e.target.value })}
|
||||
/>
|
||||
</Field.Root>
|
||||
</Stack>
|
||||
</DialogBody>
|
||||
<DialogFooter
|
||||
display={{ base: "block", md: "flex" }}
|
||||
justifyContent="center"
|
||||
gap={1}
|
||||
pt={2}
|
||||
>
|
||||
<HStack mt={2} mb={3} width={"100%"} justifyContent={"space-between"}>
|
||||
<Button
|
||||
width={"48%"}
|
||||
color="black"
|
||||
_hover={{ bgColor: "white" }}
|
||||
variant="outline"
|
||||
borderRadius="sm"
|
||||
border="1px solid #02A0A0"
|
||||
size={"xs"}
|
||||
onClick={() => handleSubmit('1')}
|
||||
>
|
||||
Unresolved
|
||||
</Button>
|
||||
<Button
|
||||
width={"48%"}
|
||||
borderRadius="sm"
|
||||
// bgColor="#007F33"
|
||||
bgColor={"#02A0A0"}
|
||||
color="white"
|
||||
// colorPalette="#007F33"
|
||||
size={"xs"}
|
||||
onClick={() => handleSubmit('0')}
|
||||
>
|
||||
Resolved
|
||||
</Button>
|
||||
</HStack>
|
||||
</DialogFooter>
|
||||
|
||||
<DialogCloseTrigger color="black" />
|
||||
</DialogContent>
|
||||
</DialogRoot>
|
||||
<Toaster />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,21 @@ import {
|
||||
} from "../../../components/ui/dialog";
|
||||
import { Button } from "../../../components/ui/button";
|
||||
import { IoMdAdd } from "react-icons/io";
|
||||
// import { useCreateUserMutation } from "../../../Redux/Service/manage.user";
|
||||
// import { useState } from "react";
|
||||
|
||||
function AddRegisterUsers() {
|
||||
// const [createUser] = useCreateUserMutation();
|
||||
|
||||
// const [user, setUser] = useState({
|
||||
// first_name: '',
|
||||
// last_name: '',
|
||||
// date_of_birth: '',
|
||||
// gender: '',
|
||||
// date_of_birth: '',
|
||||
// principle_language_linkss: [],
|
||||
// });
|
||||
|
||||
return (
|
||||
<DialogRoot placement="center">
|
||||
<DialogTrigger asChild>
|
||||
@@ -65,7 +78,7 @@ function AddRegisterUsers() {
|
||||
DOB
|
||||
</Field.Label>
|
||||
<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" type="date"
|
||||
/>
|
||||
|
||||
<Field.Label color="black" pt={1} fontSize="12px">
|
||||
|
||||
@@ -30,7 +30,7 @@ function EditRegisterUsers({ data, refetch }: { data: UserData, refetch: () => v
|
||||
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 ?? [],
|
||||
principle_language_linkss: data?.principle_language_linkss ?? [],
|
||||
});
|
||||
const [updateUser] = useUpdateUserMutation();
|
||||
|
||||
@@ -49,7 +49,7 @@ function EditRegisterUsers({ data, refetch }: { data: UserData, refetch: () => v
|
||||
return;
|
||||
}
|
||||
|
||||
const languageData = formData?.principle_language_links.map(link => link.language_xid);
|
||||
const languageData = formData?.principle_language_linkss?.language_xid;
|
||||
|
||||
const payload = {
|
||||
id: formData?.id,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
Box, HStack,
|
||||
// Image,
|
||||
Text
|
||||
Text,
|
||||
} from "@chakra-ui/react";
|
||||
import MainFrame from "../../../components/MainFrame";
|
||||
// import AlertDailog from "../../../components/AlertDailog";
|
||||
@@ -24,7 +24,7 @@ const tableHeadRow = [
|
||||
"DOB",
|
||||
"Type Of User",
|
||||
"Language",
|
||||
"Activate/Deactivate",
|
||||
"Active/Deactive",
|
||||
"Action",
|
||||
];
|
||||
|
||||
@@ -115,7 +115,8 @@ const RegisterUsers = () => {
|
||||
"Gender": agency.gender,
|
||||
"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',
|
||||
"Language": agency.principle_language_linkss.language.language_name,
|
||||
"Active/Deactive": agency.is_active === true ? 'Active' : 'Inactive',
|
||||
"Action": (
|
||||
<HStack justifyContent="center">
|
||||
<EditRegisterUsers
|
||||
|
||||
@@ -113,6 +113,7 @@ const AgencyMaster = () => {
|
||||
Action: (
|
||||
<HStack justifyContent="center">
|
||||
<ViewAgencyMaster agency={localData} id={agency.id} />
|
||||
{/* <EditAgencyMaster editData={agency} refetch={refetch} /> */}
|
||||
<Box>
|
||||
<Switch
|
||||
colorPalette={"teal"}
|
||||
|
||||
@@ -15,34 +15,47 @@ import { useEffect, useState } from "react";
|
||||
import { useUpdateAgencyMasterMutation } from "../../../Redux/Service/agency.master.module.service";
|
||||
import { Toaster, toaster } from "../../../components/ui/toaster";
|
||||
|
||||
interface Organization {
|
||||
id: number;
|
||||
raid?: string;
|
||||
// interface Organization {
|
||||
// id: number;
|
||||
// raid?: string;
|
||||
// name: string;
|
||||
// auth_signatory?: string;
|
||||
// state: string;
|
||||
// district?: string;
|
||||
// rc_number: number;
|
||||
// contact_details?: string;
|
||||
// registered_office: string;
|
||||
// branch_office?: string;
|
||||
// registered_email?: string;
|
||||
// other_email?: string;
|
||||
// registered_contact?: string;
|
||||
// website?: string;
|
||||
// domain_name: string;
|
||||
// staff_domain_name?: string;
|
||||
// gst_number: string;
|
||||
// rc_status?: "Active" | "Inactive"; // Assuming it's a status with limited values
|
||||
// }
|
||||
|
||||
type AgencyFormData = {
|
||||
id: string;
|
||||
name: string;
|
||||
auth_signatory?: string;
|
||||
state: string;
|
||||
district?: string;
|
||||
rc_number: number;
|
||||
contact_details?: string;
|
||||
rc_number: string;
|
||||
registered_office: string;
|
||||
branch_office?: string;
|
||||
registered_email?: string;
|
||||
other_email?: string;
|
||||
registered_contact?: string;
|
||||
website?: string;
|
||||
domain_name: string;
|
||||
staff_domain_name?: string;
|
||||
gst_number: string;
|
||||
rc_status?: "Active" | "Inactive"; // Assuming it's a status with limited values
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function EditAgencyMaster({ editData, refetch }: { editData: Organization, refetch: VoidFunction }) {
|
||||
|
||||
function EditAgencyMaster<T extends AgencyFormData>({ editData, refetch }: { editData: T, refetch: VoidFunction }) {
|
||||
|
||||
const [formData, setFormData] = useState(editData);
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [updateAgencyMaster] = useUpdateAgencyMasterMutation()
|
||||
|
||||
console.log("Edit Data", editData);
|
||||
|
||||
useEffect(() => {
|
||||
setFormData(editData);
|
||||
}, [editData]);
|
||||
@@ -104,11 +117,11 @@ function EditAgencyMaster({ editData, refetch }: { editData: Organization, refet
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error("Error updating template:", error);
|
||||
toaster.create({
|
||||
title: "Error",
|
||||
description: "Something went wrong.",
|
||||
description: `${error.data.message || "Failed to update"}`,
|
||||
type: "error",
|
||||
});
|
||||
// alert("Failed to update template");
|
||||
|
||||
@@ -6,7 +6,7 @@ import DataTable from "../../../components/DataTable";
|
||||
import { Switch } from "../../../components/ui/switch";
|
||||
import JobAddModel from "./JobAddModel";
|
||||
import EditJobeModel from "./EditJobModel";
|
||||
import { JobTypeData, useGetJobTypeQuery } from "../../../Redux/Service/job.type.service";
|
||||
import { JobTypeData, useGetJobTypeQuery, useJobTypeToggleMutation } from "../../../Redux/Service/job.type.service";
|
||||
import { useEffect, useState } from "react";
|
||||
import SearchComponent from "../../../components/SearchComponent";
|
||||
|
||||
@@ -41,7 +41,7 @@ const JobType = () => {
|
||||
const { data, refetch } = useGetJobTypeQuery(currentPage)
|
||||
const [localData, setLocalData] = useState<any[]>([]);
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
// const [templateMasterToggle] = useTemplateMasterToggleMutation()
|
||||
const [jobTypeToggle] = useJobTypeToggleMutation()
|
||||
console.log('DATA', data?.data.data);
|
||||
|
||||
|
||||
@@ -61,25 +61,25 @@ const JobType = () => {
|
||||
return title;
|
||||
});
|
||||
|
||||
// const handleToggle = async (agencyId: string, currentStatus: number) => {
|
||||
// const newStatus = currentStatus ? 0 : 1;
|
||||
// setLocalData((prevData) =>
|
||||
// prevData.map((agency) =>
|
||||
// agency.id === agencyId ? { ...agency, is_active: newStatus } : agency
|
||||
// )
|
||||
// );
|
||||
// try {
|
||||
// await templateMasterToggle({ 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 handleToggle = async (agencyId: string, currentStatus: number) => {
|
||||
const newStatus = currentStatus ? 0 : 1;
|
||||
setLocalData((prevData) =>
|
||||
prevData.map((agency) =>
|
||||
agency.id === agencyId ? { ...agency, is_active: newStatus } : agency
|
||||
)
|
||||
);
|
||||
try {
|
||||
await jobTypeToggle({ 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 managepost = filteredData?.map((agency: JobTypeData, index: number) => ({
|
||||
@@ -94,7 +94,7 @@ const JobType = () => {
|
||||
<Switch
|
||||
colorPalette={'teal'}
|
||||
size={"xs"}
|
||||
// onChange={() => handleToggle(agency.id, Number(agency.is_active))}
|
||||
onChange={() => handleToggle(agency.id.toString(), Number(agency.is_active))}
|
||||
checked={Boolean(Number(agency.is_active))}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { DialogBody, DialogContent, DialogFooter, DialogHeader, DialogRoot, Dial
|
||||
// import EnterPassword from "./EnterPassword";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { useEffect, useState } from "react";
|
||||
import { toaster } from "../../components/ui/toaster";
|
||||
import { toaster, Toaster } from "../../components/ui/toaster";
|
||||
import { useNewPasswordSetMutation } from "../../Redux/Service/profile.password";
|
||||
import { LuEye, LuEyeOff } from "react-icons/lu";
|
||||
import { InputGroup } from "../../components/ui/input-group";
|
||||
@@ -203,7 +203,7 @@ function Changepassword({ onClose, isOpen }: EnterPasswordProps) {
|
||||
pl={1}
|
||||
fontSize="12px"
|
||||
height="30px"
|
||||
type= {showNewPassword ? "text" : "password"}
|
||||
type={showNewPassword ? "text" : "password"}
|
||||
border={errors.confirm_password ? "1px solid red" : "1px solid grey"}
|
||||
{...register("confirm_password", {
|
||||
required: "Please confirm your password",
|
||||
@@ -240,6 +240,7 @@ function Changepassword({ onClose, isOpen }: EnterPasswordProps) {
|
||||
<DialogCloseTrigger color="black" />
|
||||
</DialogContent>
|
||||
</DialogRoot >
|
||||
<Toaster />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Field, Grid, Heading, Input, Stack, Text } from "@chakra-ui/react";
|
||||
// import { TbEdit } from "react-icons/tb";
|
||||
import { Button } from "./ui/button";
|
||||
import { Checkbox } from "./ui/checkbox";
|
||||
import { Button } from "../../components/ui/button";
|
||||
import { Checkbox } from "../../components/ui/checkbox";
|
||||
import {
|
||||
DialogBody,
|
||||
DialogCloseTrigger,
|
||||
@@ -11,11 +11,11 @@ import {
|
||||
DialogRoot,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "./ui/dialog";
|
||||
import Edit from "./ActionIcons/Edit";
|
||||
import { PermissionResponse, useLazyViewSubAdminQuery, useUpdateSubAdminMutation } from "../Redux/Service/manage.subadmin.service";
|
||||
} from "../../components/ui/dialog";
|
||||
import Edit from "../../components/ActionIcons/Edit";
|
||||
import { PermissionResponse, useLazyViewSubAdminQuery, useUpdateSubAdminMutation } from "../../Redux/Service/manage.subadmin.service";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Toaster, toaster } from "../components/ui/toaster";
|
||||
import { Toaster, toaster } from "../../components/ui/toaster";
|
||||
|
||||
const resourceIdToLabel: { [key: number]: string } = {
|
||||
1: 'Dashboard',
|
||||
@@ -73,16 +73,16 @@ function EditSubAdmin({ id, refetch, allPermissions }: { id: number, refetch: Vo
|
||||
.filter((perm: any) => perm.is_active)
|
||||
.map((perm: any) => perm.app_resource_xid);
|
||||
|
||||
const mergedPermissions: ResourceActionLink[] = allPermissions.data.permission.map((perm) => ({
|
||||
const mergedPermissions: ResourceActionLink[] = allPermissions.data.permission.map((perm) => ({
|
||||
id: perm.id,
|
||||
app_resource_xid: perm.id,
|
||||
is_active: activePermissionIds.includes(perm.id),
|
||||
app_resource: {
|
||||
id: perm.id,
|
||||
app_resource_xid: perm.id,
|
||||
is_active: activePermissionIds.includes(perm.id),
|
||||
app_resource: {
|
||||
id: perm.id,
|
||||
app_resource_title: perm.app_resource_title,
|
||||
},
|
||||
}));
|
||||
|
||||
app_resource_title: perm.app_resource_title,
|
||||
},
|
||||
}));
|
||||
|
||||
|
||||
// Map the API response to editData
|
||||
setEditData({
|
||||
@@ -333,7 +333,7 @@ function EditSubAdmin({ id, refetch, allPermissions }: { id: number, refetch: Vo
|
||||
</DialogFooter>
|
||||
<DialogCloseTrigger color="black" onClick={() => setIsOpen(false)} />
|
||||
</DialogContent>
|
||||
<Toaster/>
|
||||
<Toaster />
|
||||
</DialogRoot>
|
||||
);
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import DataTable from "../../components/DataTable"
|
||||
import AlertDailog from "../../components/AlertDailog";
|
||||
// import { RiDeleteBin5Line } from "react-icons/ri";
|
||||
import AddModel from "./AddModel"
|
||||
import EditSubAdmin from "../../components/EditSubAdmin"
|
||||
import EditSubAdmin from "./EditSubAdmin"
|
||||
import ViewSubAdmin from "./ViewSubAdmin"
|
||||
import Delete from "../../components/ActionIcons/Delete"
|
||||
import { PermissionResponse, useDeleteSubAdminPostMutation, useGetPermissionQuery, useGetSubAdminQuery } from "../../Redux/Service/manage.subadmin.service"
|
||||
@@ -64,9 +64,9 @@ const SubAdmin = () => {
|
||||
const [allPermissions, setAllPermissions] = useState<PermissionResponse>();
|
||||
const [deleteModal, setDeleteModal] = useState(false)
|
||||
const [deleteSubAdminPost] = useDeleteSubAdminPostMutation()
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const debouncedSearchTerm = useDebounce(searchTerm, 500);
|
||||
const queryArgs = debouncedSearchTerm ? { page: currentPage, search: debouncedSearchTerm } : { page: currentPage };
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const debouncedSearchTerm = useDebounce(searchTerm, 500);
|
||||
const queryArgs = debouncedSearchTerm ? { page: currentPage, search: debouncedSearchTerm } : { page: currentPage };
|
||||
const { data, refetch, isError, isFetching } = useGetSubAdminQuery(queryArgs);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -75,7 +75,7 @@ const SubAdmin = () => {
|
||||
setAllPermissions(permissions);
|
||||
}
|
||||
}, [data, permissions]);
|
||||
|
||||
|
||||
console.log("============================", allPermissions);
|
||||
console.log('localData', localData);
|
||||
|
||||
@@ -88,7 +88,7 @@ const SubAdmin = () => {
|
||||
setCurrentPage(1);
|
||||
};
|
||||
|
||||
const handleDeleteAdmin = async (faqId: number) => {
|
||||
const handleDeleteAdmin = async (faqId: number) => {
|
||||
try {
|
||||
const response = await deleteSubAdminPost(faqId).unwrap();
|
||||
if (response.success) {
|
||||
@@ -176,11 +176,11 @@ const SubAdmin = () => {
|
||||
|
||||
<HStack>
|
||||
<SearchComponent
|
||||
value={searchTerm}
|
||||
onChange={handleSearchChange}
|
||||
/>
|
||||
value={searchTerm}
|
||||
onChange={handleSearchChange}
|
||||
/>
|
||||
{/* <Button bgColor={'#EEEEEE'} pl={3} pr={3}><IoMdAdd /> <Text>Add</Text></Button> */}
|
||||
{allPermissions && <AddModel refetch={refetch} allPermissions={allPermissions}/>}
|
||||
{allPermissions && <AddModel refetch={refetch} allPermissions={allPermissions} />}
|
||||
</HStack>
|
||||
</HStack>
|
||||
<DataTable
|
||||
@@ -197,7 +197,8 @@ const SubAdmin = () => {
|
||||
isLoading={isFetching}
|
||||
isError={isError}
|
||||
/>
|
||||
</Box> </MainFrame>
|
||||
</Box>
|
||||
</MainFrame>
|
||||
)
|
||||
}
|
||||
export default SubAdmin
|
||||
@@ -71,9 +71,9 @@ export const jobType = createApi({
|
||||
}),
|
||||
}),
|
||||
|
||||
templateMasterToggle: builder.mutation({
|
||||
jobTypeToggle: builder.mutation({
|
||||
query: ({ id, is_active }) => ({
|
||||
url: `/template-status`,
|
||||
url: `/job-type-status`,
|
||||
method: "POST",
|
||||
body: { id, is_active },
|
||||
}),
|
||||
@@ -86,5 +86,5 @@ export const {
|
||||
useGetJobTypeQuery,
|
||||
useCreateJobTypePostMutation,
|
||||
useUpdateJobTypeMutation,
|
||||
useTemplateMasterToggleMutation,
|
||||
useJobTypeToggleMutation,
|
||||
} = jobType;
|
||||
|
||||
@@ -20,14 +20,26 @@ export const manageContactUs = createApi({
|
||||
tagTypes: ["Contact"],
|
||||
endpoints: (builder) => ({
|
||||
|
||||
|
||||
getContact: builder.query<ApiResponse, void>({
|
||||
query: () => "/contact-us",
|
||||
|
||||
getContact: builder.query<ApiResponse, { page?: number; search?: string }>({
|
||||
query: ({ page, search }) => {
|
||||
const params = new URLSearchParams();
|
||||
if (page) params.append("page", page.toString());
|
||||
if (search) params.append("search", search);
|
||||
return `/contact-us?${params.toString()}`;
|
||||
},
|
||||
providesTags: ["Contact"],
|
||||
}),
|
||||
|
||||
|
||||
pendingRequest: builder.mutation({
|
||||
query: (body) => ({
|
||||
url: `/contact-us-response`,
|
||||
method: "POST",
|
||||
body,
|
||||
}),
|
||||
invalidatesTags: ["Contact"],
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
export const { useGetContactQuery } = manageContactUs;
|
||||
export const { useGetContactQuery, usePendingRequestMutation } = manageContactUs;
|
||||
|
||||
@@ -14,7 +14,7 @@ export interface UserData {
|
||||
id: number;
|
||||
principal_type_title: string;
|
||||
},
|
||||
principle_language_links:{
|
||||
principle_language_linkss:{
|
||||
id: number;
|
||||
language_xid: number;
|
||||
iam_principal_xid: number;
|
||||
@@ -22,7 +22,7 @@ export interface UserData {
|
||||
id: number,
|
||||
language_name: string;
|
||||
}
|
||||
}[]
|
||||
}
|
||||
}
|
||||
|
||||
interface ApiResponse {
|
||||
@@ -65,7 +65,7 @@ export const registerUser = createApi({
|
||||
endpoints: (builder) => ({
|
||||
createUser: builder.mutation<PostCountry, Partial<PostCountry>>({
|
||||
query: (data) => ({
|
||||
url: "/country-add",
|
||||
url: "/manage-user-store",
|
||||
method: "POST",
|
||||
body: data,
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user