This commit is contained in:
YasinShaikh123
2024-07-23 16:32:35 +05:30
14 changed files with 449 additions and 240 deletions

View File

@@ -63,6 +63,7 @@ const FormField = ({
rules={rules}
render={({ field }) => {
if (type === "select") {
return (
<Select
focusBorderColor="forestGreen.300"

View File

@@ -1,4 +1,4 @@
import { Box, Spinner } from "@chakra-ui/react";
import { Box, Spinner, Text } from "@chakra-ui/react";
import React from "react";
const FullscreenLoaders = () => {
@@ -6,11 +6,19 @@ const FullscreenLoaders = () => {
<Box
display={"flex"}
justifyContent={"center"}
flexDirection={'column'}
alignItems={"center"}
w={"100%"}
h={"70vh"}
>
<Spinner color='green.700' />
h={"100vh"}
gap={4}
><Spinner
thickness='3px'
speed='0.65s'
emptyColor='green.100'
color='#004717'
size='lg'
/>
<Text color='#004717' fontSize={'md'} fontWeight={500}>Loading...</Text>
</Box>
);
};

View File

@@ -0,0 +1,4 @@
export const getFileNameFromPath = (filePath) => {
const parts = filePath.split('/');
return parts[parts.length - 1];
};

View File

@@ -118,19 +118,23 @@ const IODetails = ({ enableNextTab, index }) => {
const [creatIO] = useCreateIOMutation();
const [updateIO] = useUpdateIOMutation();
console.log(IObyID?.data);
// ======================[ Selector filter ]
const investmentTypeOptions = investmentTypes?.data?.rows?.map(
({ investmentTypeName, id }) => {
console.log(id);
return {
label: investmentTypeName,
value: id,
value: Number(id),
};
}
);
const sponserNameOption = activeSponsers?.data?.map(({ sponsorName, id }) => {
return {
label: sponsorName,
value: id,
value: Number(id),
};
});
@@ -146,7 +150,7 @@ const IODetails = ({ enableNextTab, index }) => {
});
useEffect(() => {
setIODetails(IObyID?.data);
// setIODetails(IObyID?.data);
if (IObyID?.data) {
reset({
investmentNameEnglish: IObyID?.data?.investmentNameEnglish,
@@ -204,6 +208,26 @@ const IODetails = ({ enableNextTab, index }) => {
section: " ",
width: "49%",
},
{
label: "Investment Type",
placeHolder: "Select option",
name: "investmentType",
type: "select",
isRequired: true,
section: " ",
width: "32.3%",
options: investmentTypeOptions,
},
{
label: "Sponsorer Name",
placeHolder: "Select option",
name: "sponserName",
type: "select",
isRequired: true,
options: sponserNameOption,
section: " ",
width: "32.3%",
},
{
label: "Goal Amount",
placeHolder: "$00.00",
@@ -230,6 +254,15 @@ const IODetails = ({ enableNextTab, index }) => {
section: " ",
width: "32.3%",
},
{
label: "Expected Return Estimated",
placeHolder: "$00.00",
name: "expectedReturn",
type: "number",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Minimum Investment Amount",
placeHolder: "$00.00",
@@ -256,36 +289,7 @@ const IODetails = ({ enableNextTab, index }) => {
width: "32.3%",
},
{
label: "Expected Return Estimated",
placeHolder: "$00.00",
name: "expectedReturn",
type: "number",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Investment Type",
placeHolder: "Select option",
name: "investmentType",
type: "select",
isRequired: true,
section: " ",
width: "32.3%",
options: investmentTypeOptions,
},
{
label: "Sponsorer Name",
placeHolder: "Select option",
name: "sponserName",
type: "select",
isRequired: true,
options: sponserNameOption,
section: " ",
width: "32.3%",
},
{
label: "Comment",
placeHolder: "Enter comment here",
@@ -463,8 +467,17 @@ const IODetails = ({ enableNextTab, index }) => {
const onSubmit = async (data) => {
setIsLoading(true)
console.log(data);
const formData = {
...data,
investmentType_xid: Number(data.investmentType),
sponsor_xid: Number(data.sponserName),
};
console.log(formData);
if (id) {
const res = await updateIO({ data, id });
const res = await updateIO({ data : formData, id });
if (res?.error?.status === 400 || res?.error?.status===500 ) {
setIsLoading(false)
toast({
@@ -472,16 +485,18 @@ const IODetails = ({ enableNextTab, index }) => {
<ToastBox message={res?.error?.data?.message} status={"error"} />
),
});
setIsLoading(false)
}
} else {
try {
const res = await creatIO(data);
const res = await creatIO(formData);
if (res?.data?.statusCode === 200) {
setIsLoading(false)
toast({
render: () => <ToastBox message={res?.data?.message} />,
});
navigate(`/create-io/${res?.data?.data}`);
navigate(`/view-io/${res?.data?.data}`);
enableNextTab(index);
}
} catch (error) {

View File

@@ -9,7 +9,7 @@ import {
useToast,
} from "@chakra-ui/react";
import React, { useContext, useEffect, useRef, useState } from "react";
import { useNavigate } from "react-router-dom";
import { useNavigate, useParams } from "react-router-dom";
import InvestmentDocuments from "../InvestmentDocuments";
import DataTable from "../../../Components/DataTable/DataTable";
import CustomAlertDialog from "../../../Components/CustomAlertDialog";
@@ -26,14 +26,58 @@ import { GrDocumentPdf } from "react-icons/gr";
import { AiOutlineFileGif } from "react-icons/ai";
import InvestmentView from "../ViewIO/InvestmentView";
import InvestmentEdit from "../EditIO/InvestmentEdit";
import { useDeleteIODocsMutation, useGetInvestmentDocumentsQuery } from "../../../Services/io.service";
import ToastBox from "../../../Components/ToastBox";
import { getFileNameFromPath } from "../../../Constants/Constants";
const downloadFile = (filePath, fileName) => {
console.log("https://admin.tanami.betadelivery.com/" + filePath);
fetch("https://admin.tanami.betadelivery.com/" + filePath)
.then((response) => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.blob();
})
.then((blob) => {
// Create a new Blob object with the correct MIME type
const fileBlob = new Blob([blob], { type: blob.type });
// Create a URL for the Blob object
const url = window.URL.createObjectURL(fileBlob);
// Create a link element to trigger the download
const link = document.createElement("a");
link.href = url;
// Set the download attribute with the specified file name
link.setAttribute("download", fileName);
// Append the link to the document and trigger the download
document.body.appendChild(link);
link.click();
// Clean up by revoking the URL and removing the link element
window.URL.revokeObjectURL(url);
document.body.removeChild(link);
})
.catch((error) => {
console.error("There was a problem with the file download:", error);
});
};
const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
const params = useParams()
const id = params?.id
const { slideFromRight, create, setCreate } = useContext(GlobalStateContext);
const firstField = useRef();
const secondField = useRef();
const thirdField = useRef();
const [searchTerm, setSearchTerm] = useState("");
const [isLoading, setIsLoading] = useState(true);
const [isLoading, setIsLoading] = useState(false);
const [deleteAlert, setDeleteAlert] = useState(false);
const [mouseEntered, setMouseEntered] = useState(false);
const [mouseEnteredId, setMouseEnteredId] = useState("");
@@ -52,13 +96,32 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
const navigate = useNavigate();
const toast = useToast();
useEffect(() => {
const timer = setTimeout(() => {
setIsLoading(false);
}, 1500);
return () => clearTimeout(timer);
}, []);
const [ deleteIODocs] = useDeleteIODocsMutation()
console.log(id);
const {
data,
error,
isLoading : isIODocLoading
} = useGetInvestmentDocumentsQuery(id)
console.log(error);
console.log(data?.data);
const tableHeadRow = ["Sr.no", "Type", "File Name", "Document", "Action"];
@@ -77,20 +140,10 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
});
}, 300);
const filteredData = create.filter((item) =>
item?.fileName?.toLowerCase().includes(searchTerm.toLowerCase())
const filteredData = data?.data?.filter((item) =>
item?.documentName?.toLowerCase().includes(searchTerm.toLowerCase())
);
const handleDelete = () => {
const updatedCreate = create.filter((create) => create.id !== actionId);
setTimeout(() => {
setCreate(updatedCreate);
setDeleteAlert(false);
setIsLoading(false);
}, 100);
setIsLoading(true);
};
const handleView = (id) => {
setActionId(id);
onViewOpen();
@@ -101,7 +154,36 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
onEditOpen();
};
const extractedArray = filteredData.map((item, index) => ({
const handleDelete = async () => {
setIsLoading(true)
try {
const res = await deleteIODocs(actionId)
if (res?.data?.statusCode === 200) {
toast({
render: () => (
<ToastBox message={res?.data?.message} />
),
});
setIsLoading(false)
setDeleteAlert(false)
}else if(res?.error) {
toast({
render: () => (
<ToastBox message={res?.error?.data?.message} status={"error"} />
),
});
setIsLoading(false)
setDeleteAlert(false)
}
} catch (error) {
console.log(error);
}
}
const extractedArray = filteredData?.map((item, index) => ({
"Sr.no": (
<Text
justifyContent={slideFromRight ? "right" : "left"}
@@ -122,13 +204,13 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
className="d-flex align-items-center"
fontSize={"xl"}
>
{item.Type}
{item.documentType === "application/pdf" ? <GrDocumentPdf /> : <AiOutlineFileGif fontSize={25} />}
</Text>
),
"File Name": (
<Box w="200px" isTruncated>
<Text as="span" color="teal.900" fontWeight="500">
{item.fileName}
{item.documentName}
</Text>
</Box>
),
@@ -140,7 +222,7 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
fontWeight="500"
className="d-flex align-items-center web-text-small"
>
{item.document}
{getFileNameFromPath(item?.documentType)}
</Text>
),
Action: (
@@ -194,6 +276,7 @@ const InvestmentDocument = ({ control, errors, enableNextTab, index }) => {
color="blue.400"
rounded="sm"
size="xs"
onClick={()=>downloadFile(item?.documentPath, item?.documentName)}
>
<DownloadIcon />
</Button>

View File

@@ -126,11 +126,20 @@ const KeyMerits = ({ enableNextTab, index }) => {
</Box>
),
Icon: (
<Image
src={`${import.meta.env.VITE_API_IMAGE_URL}/${item?.iconFilePath}`}
item.iconFilePath && <Image
rounded={'md'}
bg={"#003B14"}
display={'flex'}
p={1}
justifyContent={'center'}
alignItems={'center'}
src={" https://admin.tanami.betadelivery.com/"+item.iconFilePath}
w={8}
h={8}
/>
// https://admin.tanami.betadelivery.com/public/icons/linkedin.png
),
Action: (

View File

@@ -23,8 +23,6 @@ const SetDisplayOrder = ({data,}) => {
const tableHeadRow = ["", "Title", "Icon", ];
console.log(data);
const [ extractedArray, setExtractedArray] = useState(data?.map((item, index) => ({
id:item?.id,
@@ -46,12 +44,20 @@ const SetDisplayOrder = ({data,}) => {
</Text></Box>
),
Icon: (
<HStack justify={'center'}>
<Image
src={`${import.meta.env.VITE_API_IMAGE_URL}/${item?.iconFilePath}`}
item.iconFilePath && <Image
rounded={'md'}
bg={"#003B14"}
display={'flex'}
p={1}
justifyContent={'center'}
alignItems={'center'}
src={" https://admin.tanami.betadelivery.com/"+item.iconFilePath}
w={8}
h={8}
/></HStack>
/>
// https://admin.tanami.betadelivery.com/public/icons/linkedin.png
),
})))

View File

@@ -12,6 +12,7 @@ import {
FormLabel,
Input,
Text,
useToast,
} from "@chakra-ui/react";
import * as yup from "yup";
import React, { useContext, useState } from "react";
@@ -26,7 +27,8 @@ import { TbFileTypeDocx } from "react-icons/tb";
import { AiOutlineFileGif } from "react-icons/ai";
import GlobalStateContext from "../../Contexts/GlobalStateContext";
import InvestmentDocument from "./CreateIO/InvestmentDocument";
import { useCreateInvestmentDocumentsMutation } from "../../Services/investment.documents.service";
import { useCreateInvestmentDocumentsMutation } from "../../Services/io.service";
import ToastBox from "../../Components/ToastBox";
export const bytesToMB = (bytes) => {
if (bytes === 0) return "0 MB";
@@ -56,6 +58,7 @@ export const investmentDocSchema = yup.object().shape({
});
const InvestmentDocuments = ({ isOpen, onClose, firstField, create, setCreate }) => {
const toast = useToast()
const params = useParams()
const [file, setFile] = useState(null);
@@ -95,7 +98,23 @@ const InvestmentDocuments = ({ isOpen, onClose, firstField, create, setCreate })
try {
const res = await createInvestmentDocument({ data: formData, id })
console.log(res);
console.log(res?.data?.statusCode);
if (res?.error) {
toast({
render: () => (
<ToastBox message={res?.error?.data?.message} status={"error"} />
),
});
}else if(res?.data?.statusCode === 201){
toast({
render: () => (
<ToastBox message={res?.data?.message} />
),
});
onClose()
}
} catch (error) {
console.log(error);

View File

@@ -94,6 +94,8 @@ const ViewIOTable = () => {
return nameMatches && statusMatches;
});
console.log(filteredData);
const extractedArray = filteredData?.map((item, index) => ({
"IO ID": (
<Box w={"auto"} isTruncated={true}>
@@ -112,14 +114,14 @@ const ViewIOTable = () => {
Sponsorer: (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
{item.sponsor ? item.sponsor : "---"}
{item?.sponsor?.sponsorName ? item.sponsor?.sponsorName : "---"}
</Text>
</Box>
),
"Investment Type": (
<Box w={"auto"} isTruncated={true}>
<Text as={"span"} color={"teal.900"} fontWeight={"500"}>
{item.investmentType ? item.investmentType : "---"}
{item?.investmentType?.investmentTypeName ? item.investmentType?.investmentTypeName : "---"}
</Text>
</Box>
),
@@ -240,7 +242,7 @@ const ViewIOTable = () => {
const handleDelete = () => {};
// console.log(IOisLoading);
console.log(extractedArray);
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={38}>

View File

@@ -12,7 +12,6 @@ import * as yup from "yup";
import { yupResolver } from "@hookform/resolvers/yup";
import { formatDate } from "../../Master/Sponser/Sponsers";
const schema = yup.object().shape({
investmentNameEnglish: yup
.string()
@@ -75,9 +74,9 @@ const schema = yup.object().shape({
});
const ViewIOdetails = () => {
const navigate = useNavigate()
const navigate = useNavigate();
const params = useParams();
const id = params?.id
const id = params?.id;
const { IODetails, setIODetails } = useContext(GlobalStateContext);
const {
@@ -86,10 +85,6 @@ const ViewIOdetails = () => {
error: IObyIDerror,
} = useGetIOByIdQuery(id, { skip: !id });
// ======================[ Validator filter ]
const {
control,
@@ -101,8 +96,7 @@ const ViewIOdetails = () => {
resolver: yupResolver(schema),
});
useEffect(() => {
setIODetails(IObyID?.data);
// setIODetails(IObyID?.data);
if (IObyID?.data) {
reset({
investmentNameEnglish: IObyID?.data?.investmentNameEnglish,
@@ -122,150 +116,167 @@ const ViewIOdetails = () => {
});
}
}, [id, IObyID]);
console.log(IObyID);
//=======================[ Editor ]
const formFields = [
{
label: "IO Name",
value: IObyID?.data?.investmentNameEnglish
? IObyID?.data?.investmentNameEnglish
: "---",
name: "investmentNameEnglish",
type: "text",
section: " ",
width: "32.2%",
isRequired: true,
},
{
label: "IO Name (Arabic)",
name: "investmentNameArabic",
type: "text",
value: IObyID?.data?.investmentNameArabic
? IObyID?.data?.investmentNameArabic
: "---",
isRequired: true,
arabic: true,
section: " ",
width: "32.2%",
},
{
label: "Description",
name: "descriptionEnglish",
value: IObyID?.data?.descriptionEnglish
? IObyID?.data?.descriptionEnglish
: "---",
type: "textarea",
isRequired: true,
section: " ",
width: "32.2%",
},
{
label: "Description (Arabic)",
name: "descriptionArabic",
value: IObyID?.data?.descriptionArabic
? IObyID?.data?.descriptionArabic
: "---",
type: "textarea",
isRequired: true,
arabic: true,
section: " ",
width: "32.2%",
},
//=======================[ Editor ]
const formFields = [
{
label: "IO Name",
value: IObyID?.data?.investmentNameEnglish ? IObyID?.data?.investmentNameEnglish : "---",
name: "investmentNameEnglish",
type: "text",
section: " ",
width: "49%",
isRequired: true,
},
{
label: "IO Name (Arabic)",
name: "investmentNameArabic",
type: "text",
value: IObyID?.data?.investmentNameArabic ? IObyID?.data?.investmentNameArabic : "---",
isRequired: true,
arabic: true,
section: " ",
width: "49%",
},
{
label: "Description",
name: "descriptionEnglish",
value: IObyID?.data?.descriptionEnglish ? IObyID?.data?.descriptionEnglish : "---",
type: "textarea",
isRequired: true,
section: " ",
width: "49%",
},
{
label: "Description (Arabic)",
name: "descriptionArabic",
value: IObyID?.data?.descriptionArabic ? IObyID?.data?.descriptionArabic : "---",
type: "textarea",
isRequired: true,
arabic: true,
section: " ",
width: "49%",
},
{
label: "Goal Amount",
placeHolder: "$00.00",
value: IObyID?.data?.goalAmount ? IObyID?.data?.goalAmount : "---",
name: "goalAmount",
type: "number",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Closing Date",
name: "closingDate",
type: "date",
isRequired: true,
value: IObyID?.data?.closingDate ? formatDate(IObyID?.data?.closingDate) : "---",
section: " ",
width: "32.3%",
},
{
label: "Holding Period",
name: "holdingPeriod",
value: IObyID?.data?.holdingPeriod?IObyID?.data?.holdingPeriod:"---",
type: "number",
isRequired: true,
placeHolder: "1Y",
section: " ",
width: "32.3%",
},
{
label: "Minimum Investment Amount",
placeHolder: "$00.00",
name: "minInvestmentAmount",
value: IObyID?.data?.minInvestmentAmount?IObyID?.data?.minInvestmentAmount:'---',
type: "number",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "ISIN",
placeHolder: "$00.00",
name: "ISIN",
value: IObyID?.data?.ISIN?IObyID?.data?.ISIN:"---",
type: "number",
section: " ",
width: "32.3%",
},
{
label: "Investment Details",
placeHolder: "",
name: "InvestmentDetails",
value: IObyID?.data?.InvestmentDetails?IObyID?.data?.InvestmentDetails:"---",
type: "text",
section: " ",
width: "32.3%",
},
{
label: "Expected Return Estimated",
placeHolder: "$00.00",
name: "expectedReturn",
type: "number",
isRequired: true,
value: IObyID?.data?.expectedReturn?IObyID?.data?.expectedReturn:'---',
section: " ",
width: "32.3%",
},
{
label: "Investment Type",
placeHolder: "Select option",
value: IObyID?.data?.investmentType_xid?IObyID?.data?.investmentType_xid:"---",
name: "investmentType_xid",
type: "select",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Sponsorer Name",
placeHolder: "Select option",
name: "sponsor_xid",
type: "select",
// options: sponserNameOption,
value: IObyID?.data?.sponsor_xid?IObyID?.data?.sponsor_xid:"---",
section: " ",
isRequired: true,
width: "32.3%",
},
{
label: "Comment",
placeHolder: "Enter comment here",
name: "comment",
type: "textarea",
value: IObyID?.data?.comment?IObyID?.data?.comment:"---",
section: " ",
width: "100%",
},
];
{
label: "Goal Amount",
placeHolder: "$00.00",
value: IObyID?.data?.goalAmount ? IObyID?.data?.goalAmount : "---",
name: "goalAmount",
type: "number",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Closing Date",
name: "closingDate",
type: "date",
isRequired: true,
value: IObyID?.data?.closingDate
? formatDate(IObyID?.data?.closingDate)
: "---",
section: " ",
width: "32.3%",
},
{
label: "Holding Period",
name: "holdingPeriod",
value: IObyID?.data?.holdingPeriod ? IObyID?.data?.holdingPeriod : "---",
type: "number",
isRequired: true,
placeHolder: "1Y",
section: " ",
width: "32.3%",
},
{
label: "Minimum Investment Amount",
placeHolder: "$00.00",
name: "minInvestmentAmount",
value: IObyID?.data?.minInvestmentAmount
? IObyID?.data?.minInvestmentAmount
: "---",
type: "number",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "ISIN",
placeHolder: "$00.00",
name: "ISIN",
value: IObyID?.data?.ISIN ? IObyID?.data?.ISIN : "---",
type: "number",
section: " ",
width: "32.3%",
},
{
label: "Investment Details",
placeHolder: "",
name: "InvestmentDetails",
value: IObyID?.data?.InvestmentDetails
? IObyID?.data?.InvestmentDetails
: "---",
type: "text",
section: " ",
width: "32.3%",
},
{
label: "Expected Return Estimated",
placeHolder: "$00.00",
name: "expectedReturn",
type: "number",
isRequired: true,
value: IObyID?.data?.expectedReturn
? IObyID?.data?.expectedReturn
: "---",
section: " ",
width: "32.3%",
},
{
label: "Investment Type",
placeHolder: "Select option",
value: IObyID?.data?.investmentType_xid
? IObyID?.data?.investmentType_xid
: "---",
name: "investmentType_xid",
type: "select",
isRequired: true,
section: " ",
width: "32.3%",
},
{
label: "Sponsorer Name",
placeHolder: "Select option",
name: "sponsor_xid",
type: "select",
// options: sponserNameOption,
value: IObyID?.data?.sponsor_xid ? IObyID?.data?.sponsor_xid : "---",
section: " ",
isRequired: true,
width: "32.3%",
},
{
label: "Comment",
placeHolder: "Enter comment here",
name: "comment",
type: "textarea",
value: IObyID?.data?.comment ? IObyID?.data?.comment : "---",
section: " ",
width: "100%",
},
];
const groupedFields = formFields.reduce((groups, field) => {
const { section } = field;
@@ -277,11 +288,26 @@ const ViewIOdetails = () => {
}, {});
if (!IObyID?.data) {
return <FullscreenLoaders/>;
return <FullscreenLoaders />;
}
return <Box position={'relative'} >
<Button position={'absolute'} right={0} onClick={()=> navigate(`/create-io/${params?.id}`)} ps={4} pe={4} colorScheme="green" rounded={"sm"} size={'xs'}>Edit IO</Button> <FormInputView groupedFields={groupedFields} /> </Box>;
return (
<Box position={"relative"}>
<Button
position={"absolute"}
right={0}
onClick={() => navigate(`/create-io/${params?.id}`)}
ps={4}
pe={4}
colorScheme="green"
rounded={"sm"}
size={"xs"}
>
Edit IO
</Button>{" "}
<FormInputView groupedFields={groupedFields} />{" "}
</Box>
);
};
export default ViewIOdetails;

View File

@@ -222,6 +222,11 @@ const AddSponser = () => {
}
};
if (isLoading) {
return <FullscreenLoaders />;
}
return (
<Box {...OPACITY_ON_LOAD} overflowY={"scroll"} height={"100vh"} pb={14}>
<FormInputMain

View File

@@ -44,13 +44,14 @@ const Sponser = () => {
const toast = useToast();
const [pageSize, setPageSize] = useState(TABLE_PAGINATION?.size);
const [currentPage, setCurrentPage] = useState(1);
const {
data: sponsors,
error,
isLoading: isSponserLoading,
} = useGetSponserMasterQuery({ page: 1, size: 10 });
} = useGetSponserMasterQuery({ page: 1, size: 20 });
const [displayRange, setDisplayRange] = useState({
start: TABLE_PAGINATION?.page,

View File

@@ -11,13 +11,11 @@ export const ioService = createApi({
endpoints: (builder) => ({
// =====[get]
getInvestmentDocuments: builder.query({
query: ({ page, size }) => `/io/admin?page=${page}&size=${size}`,
providesTags: ["getInvestmentDocuments"],
}),
getInvestmentDocumentsById: builder.query({
query: (id) => ({ url: `/io/admin/${id}` }),
query: ({id}) => `/io/admin/document/${id}`,
providesTags: ["getInvestmentDocuments"],
}),
// =====[create]
createInvestmentDocuments: builder.mutation({

View File

@@ -7,8 +7,11 @@ const baseUrl = api?.defaults.baseURL;
export const ioService = createApi({
reducerPath: "ioService",
baseQuery: fetchBaseQuery({ baseUrl }),
tagTypes: ["getIO", "getKeyMerits", "getArtifacts"],
tagTypes: ["getIO", "getKeyMerits", "getArtifacts", "getInvestmentDocuments"],
endpoints: (builder) => ({
// =====[get]
getIOs: builder.query({
query: ({ page, size }) => `/io/admin?page=${page}&size=${size}`,
@@ -72,9 +75,6 @@ export const ioService = createApi({
}),
invalidatesTags: ["getKeyMerits"],
}),
updateKeyMerits: builder.mutation({
query: ({ data, id }) => ({ url: `/io/admin/key-merits/byId/${id}` ,
method: "PATCH",
@@ -84,6 +84,34 @@ export const ioService = createApi({
}),
// =====[getIODocument]
createInvestmentDocuments: builder.mutation({
query: ({data, id}) => ({
url: `/io/admin/document/${id}`,
method: "POST",
body: data,
}),
invalidatesTags: ["getInvestmentDocuments"],
}),
getInvestmentDocuments: builder.query({
query: (id) => `/io/admin/document/${id}`,
providesTags: ["getInvestmentDocuments"],
}),
deleteIODocs: builder.mutation({
query: (id) => ({
url: `/io/admin/document/hard-delete/${id}`,
method: "DELETE",
}),
invalidatesTags: ["getInvestmentDocuments"],
}),
@@ -114,6 +142,10 @@ export const {
useDeleteKeyMeritsMutation,
useUpdateKeyMeritsMutation,
useGetInvestmentDocumentsQuery,
useCreateInvestmentDocumentsMutation,
useDeleteIODocsMutation,
useGetArtifactsQuery,
} =