Bug fixes
This commit is contained in:
@@ -78,35 +78,47 @@ const AgencyMaster = () => {
|
||||
};
|
||||
|
||||
const filteredData = localData?.filter((agency) =>
|
||||
agency?.name.toLowerCase().includes(searchTerm.toLowerCase())
|
||||
agency?.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
agency?.rc_number.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
agency?.state.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
agency?.registered_office.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
agency?.domain_name.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
agency?.gst_number.toLowerCase().includes(searchTerm.toLowerCase())
|
||||
);
|
||||
|
||||
const managepost = filteredData?.map((agency: any, index: number) => ({
|
||||
'id': agency.id,
|
||||
"Sr. No": (currentPage - 1) * (data?.data.per_page ?? 0) + index + 1,
|
||||
"Agency Name": agency.name,
|
||||
"RC no.": agency.rc_number,
|
||||
"State": agency.state,
|
||||
"RC Status": agency.rc_status,
|
||||
"Registered Office Address": agency.registered_office,
|
||||
"Website/Domain": agency.domain_name,
|
||||
"GST no.": agency.gst_number,
|
||||
"is_active": agency.is_active,
|
||||
"Action": (
|
||||
<HStack justifyContent="center">
|
||||
<ViewAgencyMaster agency={localData} id={agency.id} />
|
||||
{/* <EditAgencyMaster editData={{ id: agency.id, name: agency.name, domain_name: agency.domain_name, gst_number: agency.gst_number, rc_number: agency.rc_number, rc_status: agency.rc_status, registered_office: agency.registered_office, state: agency.state }} refetch={refetch} /> */}
|
||||
<Box>
|
||||
<Switch
|
||||
colorPalette={"teal"}
|
||||
size={"xs"}
|
||||
onChange={() => handleToggle(agency.id.toString(), Number(agency.is_active))}
|
||||
checked={Boolean(Number(agency.is_active))}
|
||||
/>
|
||||
</Box>
|
||||
</HStack>
|
||||
),
|
||||
}));
|
||||
const activeCount = filteredData?.filter((a: any) => a.is_active === 1).length ?? 0;
|
||||
|
||||
const managepost = filteredData?.map((agency: any, index: number) => {
|
||||
const isOnlyActive = activeCount === 1 && agency.is_active === 1;
|
||||
|
||||
return {
|
||||
id: agency.id,
|
||||
"Sr. No": (currentPage - 1) * (data?.data.per_page ?? 0) + index + 1,
|
||||
"Agency Name": agency.name,
|
||||
"RC no.": agency.rc_number,
|
||||
"State": agency.state,
|
||||
"RC Status": agency.rc_status,
|
||||
"Registered Office Address": agency.registered_office,
|
||||
"Website/Domain": agency.domain_name,
|
||||
"GST no.": agency.gst_number,
|
||||
"is_active": agency.is_active,
|
||||
Action: (
|
||||
<HStack justifyContent="center">
|
||||
<ViewAgencyMaster agency={localData} id={agency.id} />
|
||||
<Box>
|
||||
<Switch
|
||||
colorPalette={"teal"}
|
||||
size={"xs"}
|
||||
onChange={() => handleToggle(agency.id.toString(), Number(agency.is_active))}
|
||||
checked={Boolean(Number(agency.is_active))}
|
||||
disabled={isOnlyActive}
|
||||
/>
|
||||
</Box>
|
||||
</HStack>
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (data?.data?.data) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { DialogBody, DialogCloseTrigger, DialogContent, DialogFooter, DialogHead
|
||||
import { Field, Input, Stack, Text } from "@chakra-ui/react"
|
||||
import { IoMdAdd } from "react-icons/io"
|
||||
import { Button } from "../../../components/ui/button"
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { PostCountry, useCreateCountryPostMutation } from "../../../Redux/Service/country.master";
|
||||
import { Toaster, toaster } from "../../../components/ui/toaster";
|
||||
|
||||
@@ -19,12 +19,26 @@ function CountryAddModel() {
|
||||
currency_symbol: '',
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!isOpen) {
|
||||
setCountryName({
|
||||
en_name: '',
|
||||
country_code: '',
|
||||
phonecode: '',
|
||||
capital: '',
|
||||
currency: '',
|
||||
currency_name: '',
|
||||
currency_symbol: '',
|
||||
});
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
const handleOpenModal = () => {
|
||||
setIsOpen(true); // Open modal when clicking "Add"
|
||||
};
|
||||
|
||||
const handleSubmit = async () => {
|
||||
if (countryName.en_name === "") {
|
||||
if (countryName.en_name === "" || countryName.country_code === "" || countryName.phonecode === "" || countryName.capital === "" || countryName.currency === "" || countryName.currency_name === "" || countryName.currency_symbol === "") {
|
||||
toaster.create({
|
||||
title: "Error",
|
||||
description: "Input fields cannot be empty",
|
||||
@@ -98,7 +112,7 @@ function CountryAddModel() {
|
||||
<Field.Root>
|
||||
<Field.Label color="black" pt={1} fontSize="12px">Country</Field.Label>
|
||||
<Input
|
||||
placeholder=""
|
||||
placeholder="Enter Country Name"
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
@@ -111,7 +125,7 @@ function CountryAddModel() {
|
||||
|
||||
<Field.Label color="black" pt={1} fontSize="12px">Country Code</Field.Label>
|
||||
<Input
|
||||
placeholder=""
|
||||
placeholder="Please enter country code ex: IN, US"
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
@@ -124,7 +138,7 @@ function CountryAddModel() {
|
||||
|
||||
<Field.Label color="black" pt={1} fontSize="12px">Phone Code</Field.Label>
|
||||
<Input
|
||||
placeholder=""
|
||||
placeholder="Please enter phone code ex: +91, +1"
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
@@ -136,7 +150,7 @@ function CountryAddModel() {
|
||||
/>
|
||||
<Field.Label color="black" pt={1} fontSize="12px">Capital</Field.Label>
|
||||
<Input
|
||||
placeholder=""
|
||||
placeholder="Enter Capital City"
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
@@ -148,7 +162,7 @@ function CountryAddModel() {
|
||||
/>
|
||||
<Field.Label color="black" pt={1} fontSize="12px">Currency</Field.Label>
|
||||
<Input
|
||||
placeholder=""
|
||||
placeholder="Enter Currency"
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
@@ -160,7 +174,7 @@ function CountryAddModel() {
|
||||
/>
|
||||
<Field.Label color="black" pt={1} fontSize="12px">Currency name</Field.Label>
|
||||
<Input
|
||||
placeholder=""
|
||||
placeholder="Enter Currency Name"
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
@@ -172,7 +186,7 @@ function CountryAddModel() {
|
||||
/>
|
||||
<Field.Label color="black" pt={1} fontSize="12px">Currency Symbol</Field.Label>
|
||||
<Input
|
||||
placeholder=""
|
||||
placeholder="Enter Currency Symbol"
|
||||
bgColor="#EEEEEE"
|
||||
color="black"
|
||||
border="none"
|
||||
|
||||
@@ -19,7 +19,7 @@ import { useState } from "react";
|
||||
// import { FaRegEdit } from "react-icons/fa";
|
||||
import Edit from "../../../components/ActionIcons/Edit";
|
||||
import { Toaster, toaster } from "../../../components/ui/toaster";
|
||||
import { Template } from "../../../Redux/Service/template.master.service";
|
||||
// import { Template } from "../../../Redux/Service/template.master.service";
|
||||
import axios from "axios";
|
||||
|
||||
const IMGURL = import.meta.env.VITE_IMG_TEMPLATES
|
||||
@@ -33,10 +33,10 @@ function EditTemplateModel({ id, localData, refetch }: { id: number, localData:
|
||||
// const [objectURLs, setObjectURLs] = useState<string[]>([]); // Store object URLs separately
|
||||
// const [updateTemplateMaster] = useUpdateTemplateMasterMutation()
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [selectedTemplate, setSelectedTemplate] = useState<Template | null>(null);
|
||||
// const [selectedTemplate, setSelectedTemplate] = useState<Template | null>(null);
|
||||
const token = localStorage.getItem("token");
|
||||
|
||||
console.log(selectedTemplate);
|
||||
console.log(images);
|
||||
|
||||
const handleImageChange = async (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
if (event.target.files) {
|
||||
@@ -57,7 +57,7 @@ function EditTemplateModel({ id, localData, refetch }: { id: number, localData:
|
||||
const handleOpenModal = () => {
|
||||
const template = localData?.find((item: any) => item.id === id);
|
||||
if (template) {
|
||||
setSelectedTemplate(template);
|
||||
// setSelectedTemplate(template);
|
||||
setTitle(template.post_template_translate.length > 0 ? template.post_template_translate[0].title : "");
|
||||
setSubTitle(template.post_template_translate.length > 0 ? template.post_template_translate[0].sub_title : "");
|
||||
setUserType(template.principle_type_xid?.toString() || "");
|
||||
@@ -90,9 +90,9 @@ function EditTemplateModel({ id, localData, refetch }: { id: number, localData:
|
||||
return;
|
||||
}
|
||||
|
||||
const newImages = images.filter((image) => image instanceof File);
|
||||
// const newImages = images.filter((image) => image instanceof File);
|
||||
|
||||
if (newImages.length === 0) {
|
||||
if (images.length === 0) {
|
||||
toaster.create({
|
||||
title: "Error",
|
||||
description: "Please upload at least one image.",
|
||||
@@ -107,8 +107,10 @@ function EditTemplateModel({ id, localData, refetch }: { id: number, localData:
|
||||
formData.append("title", title);
|
||||
formData.append("sub_title", subTitle);
|
||||
|
||||
newImages.forEach((image, index) => {
|
||||
formData.append(`image_name[${index}]`, image, image.name);
|
||||
images.forEach((image, index) => {
|
||||
if (image instanceof File) {
|
||||
formData.append(`image_name[${index}]`, image, image.name);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Box, Field, Input, Stack, Text } from "@chakra-ui/react"
|
||||
import { IoMdAdd } from "react-icons/io"
|
||||
import { Button } from "../../../components/ui/button"
|
||||
import { FiUpload } from "react-icons/fi";
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
// import { useCreateTemplatePostMutation } from "../../../Redux/Service/template.master.service";
|
||||
import { Toaster, toaster } from "../../../components/ui/toaster"
|
||||
import axios from "axios";
|
||||
@@ -18,11 +18,21 @@ function TemplateAddModel({ refetch }: { refetch: VoidFunction }) {
|
||||
// const [createTemplatePost] = useCreateTemplatePostMutation()
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const token = localStorage.getItem("token");
|
||||
|
||||
useEffect(() => {
|
||||
if (!isOpen) {
|
||||
setTitle("");
|
||||
setSubTitle("");
|
||||
setUserType("");
|
||||
setImages([]);
|
||||
}
|
||||
}, [isOpen]);
|
||||
|
||||
if (!token) {
|
||||
console.error("No token found in localStorage!");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
const handleOpenModal = () => {
|
||||
setIsOpen(true); // Open modal when clicking "Add"
|
||||
};
|
||||
@@ -112,7 +122,7 @@ function TemplateAddModel({ refetch }: { refetch: VoidFunction }) {
|
||||
}
|
||||
};
|
||||
|
||||
// console.log("Token stored:", window.localStorage.getItem("token"));
|
||||
// console.log("Token stored:", window.localStorage.getItem("token"))
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@@ -17,6 +17,7 @@ const APIURL = import.meta.env.VITE_IMG_TEMPLATES
|
||||
const tableHeadRow = [
|
||||
"Sr. No",
|
||||
"Title",
|
||||
"User Type",
|
||||
"Images",
|
||||
"Action"
|
||||
];
|
||||
@@ -92,11 +93,12 @@ const TemplateMaster = () => {
|
||||
"Title": agency.post_template_translate.length > 0
|
||||
? agency.post_template_translate[0].title
|
||||
: "N/A",
|
||||
"User Type": agency.principle_type_xid === 2 ? 'Recruiter' : 'Job Seeker',
|
||||
"Images": (
|
||||
// <Image w={50} src={img} />
|
||||
<HStack key={agency.id}>
|
||||
{agency.post_template_image.map((img) => (
|
||||
<Image rounded={'lg'} w={100} h={50} src={`${APIURL}${img.image_name}`} />
|
||||
<Image key={img.id} rounded={'lg'} w={100} h={50} src={`${APIURL}${img.image_name}`} />
|
||||
))}
|
||||
|
||||
{/* <Image rounded={'lg'} w={100} h={50} src={Templateimg} /> */}
|
||||
|
||||
@@ -88,7 +88,9 @@ const WorkspaceMode = () => {
|
||||
const managepost = filteredData?.map((agency: any, index: number) => ({
|
||||
'id': agency.id,
|
||||
"Sr. No": (currentPage - 1) * (data?.data.per_page ?? 0) + index + 1,
|
||||
"Title": agency.en_name,
|
||||
"Title": agency.en_name.length > 12
|
||||
? agency.en_name.slice(0, 12) + '...'
|
||||
: agency.en_name,
|
||||
"is_active": agency.is_active,
|
||||
"Action": (
|
||||
<HStack justifyContent="center">
|
||||
|
||||
@@ -27,6 +27,7 @@ interface PaginationData {
|
||||
export interface Template {
|
||||
id: number;
|
||||
is_active: boolean;
|
||||
principle_type_xid: number;
|
||||
post_template_translate: PostTemplateTranslate[];
|
||||
post_template_image: PostTemplateImage[];
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ export const workspaceMode = createApi({
|
||||
endpoints: (builder) => ({
|
||||
createWorkspacePost: builder.mutation<PostDepartment, Partial<PostDepartment>>({
|
||||
query: (data) => ({
|
||||
url: "/department-master-store",
|
||||
url: "/workspace-create",
|
||||
method: "POST",
|
||||
body: data,
|
||||
}),
|
||||
|
||||
@@ -108,7 +108,7 @@ const DataTable: React.FC<TableProps> = ({
|
||||
<Box textAlign={"center"} py={20} position={'absolute'} w={'84%'}>
|
||||
<Image src={EmptyFile} alt="No data" maxW="65px" mx="auto" />
|
||||
<Text fontSize={"18px"} fontWeight={500} mt={2}>
|
||||
We do not have any records
|
||||
No records found — they’ll appear here if available.
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
Reference in New Issue
Block a user