From 2a11fed4f08782cefdcf587e85cfb4ed91677796 Mon Sep 17 00:00:00 2001 From: "Siddhesh.More" Date: Wed, 7 Aug 2024 20:18:36 +0530 Subject: [PATCH] UPDATED 070824 --- src/App.jsx | 12 +- .../IO_Management/CreateIO/AddCashDetails.jsx | 243 ++++++++++++++++++ src/Pages/IO_Management/CreateIO/CreateIO.jsx | 7 +- .../IO_Management/CreateIO/IOCashDetails.jsx | 31 ++- .../IO_Management/CreateIO/IODetails.jsx | 1 - .../IO_Management/ViewIO/ViewIOTable.jsx | 8 +- src/Pages/IO_Management/ViewIO/ViewIOdata.jsx | 2 +- .../IO_Management/ViewIO/ViewIOdataHeader.jsx | 198 +++++--------- src/Pages/Login.jsx | 109 +++++--- .../Master/ExchangeRate/EditExchangeRate.jsx | 4 +- .../Master/ExchangeRate/ExchangeRate.jsx | 30 +-- src/Pages/Welcome.jsx | 22 +- src/Services/Key.merits.service.js | 7 +- src/Services/bank.details.service.js | 7 +- src/Services/contact.service.js | 7 +- src/Services/deposit.request.service.js | 7 +- src/Services/exchange.rate.service.js | 7 +- src/Services/investment.documents.service.js | 7 +- src/Services/investment.type.service.js | 7 +- src/Services/investor.details.service.js | 7 +- src/Services/investor.transaction.service.js | 5 +- src/Services/io.service.js | 7 +- src/Services/sponser.service.js | 9 +- src/Services/token.serivce.js | 47 ++++ src/Store/Store.js | 9 +- src/Validations/Validations.js | 2 +- 26 files changed, 550 insertions(+), 252 deletions(-) create mode 100644 src/Pages/IO_Management/CreateIO/AddCashDetails.jsx create mode 100644 src/Services/token.serivce.js diff --git a/src/App.jsx b/src/App.jsx index 4efe6e0..227dfc3 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -37,12 +37,12 @@ const App = () => { }; }, []); - const PrivateRoute = ({ children }) => { - if (!isAuthenticate && isAuthenticatedInCookie !== "true") { - return ; - } - return children; - }; + // const PrivateRoute = ({ children }) => { + // if (!isAuthenticate && isAuthenticatedInCookie !== "true") { + // return ; + // } + // return children; + // }; return ( diff --git a/src/Pages/IO_Management/CreateIO/AddCashDetails.jsx b/src/Pages/IO_Management/CreateIO/AddCashDetails.jsx new file mode 100644 index 0000000..521eb5c --- /dev/null +++ b/src/Pages/IO_Management/CreateIO/AddCashDetails.jsx @@ -0,0 +1,243 @@ +import { + Box, + Button, + Drawer, + DrawerBody, + DrawerCloseButton, + DrawerContent, + DrawerFooter, + DrawerHeader, + DrawerOverlay, + FormControl, + FormErrorMessage, + FormLabel, + Input, + Stack, + Textarea, + useToast, + } from "@chakra-ui/react"; + import * as yup from "yup"; + import React, { useState, useEffect } from "react"; + import { useForm, Controller } from "react-hook-form"; + import { yupResolver } from "@hookform/resolvers/yup"; + import CustomAlertDialog from "../../../Components/CustomAlertDialog"; + import { v4 as uuidv4 } from "uuid"; + import { useCreateVideoArtifactsMutation, useUpdateVideoArtifactsMutation } from "../../../Services/io.service"; + import { useParams } from "react-router-dom"; + import ToastBox from "../../../Components/ToastBox"; + + const investmentVideoSchema = yup.object().shape({ + transactionDate: yup.string().required("Artifact name is required"), + ioTransType_xid: yup.number().required("Artifact name is required"), + transactionAmount: yup.number().required("Artifact name is required"), + comments: yup.string().notRequired(), + }); + + const AddCashDetails = ({ isOpen, onClose, firstField, actionId, setActionId, data}) => { + const params = useParams() + const id = params?.id + const [file, setFile] = useState(""); + const [fileName, setFileName] = useState(""); + const [ isLoading, setIsLoading] = useState(false) + const [alert, setAlert] = useState(false); + const toast = useToast(); + + + const found = data?.find((item) => item?.id === actionId); + console.log(found); + + const [ createArtifactsVideo ] = useCreateVideoArtifactsMutation() + const [ updateVideoArtifacts ] = useUpdateVideoArtifactsMutation() + // const { + // data + // } = useGetArtifactsQuery(id) + + const { + control, + handleSubmit, + watch, + reset, + formState: { errors }, + } = useForm({ + resolver: yupResolver(investmentVideoSchema), + }); + + + + + const onSubmit = async (data) => { + console.log(data); + + // setIsLoading(true) + + + + // try { + + + // if (found) { + // const res = await updateVideoArtifacts({data, id: found?.id}) + // if (res?.data?.statusCode === 200) { + // toast({ + // render: () => , + // }); + // setAlert(false); + // setIsLoading(false) + // handleClose(); + // } + // } else { + + // const res = await createArtifactsVideo({data, id}) + // if (res?.data?.statusCode === 200) { + // toast({ + // render: () => , + // }); + // setAlert(false); + // setIsLoading(false) + // handleClose(); + // } + + // } + + + // } catch (error) { + // console.log(error); + + // } + + }; + + + + const handleConfirm = () => { + handleSubmit(onSubmit)(); + }; + + const handleSave = () => { + handleSubmit(onSubmit)(); + }; + + const handleClose = () => { + onClose() + reset() + } + + return ( + <> + + + + + IO Cash Details + + + + + Date Selection + ( + + )} + /> + + {errors.transactionDate?.message} + + + + + Cash transaction + ( + + )} + /> + + {errors.ioTransType_xid?.message} + + + + + + + + Transaction Amount + ( + + )} + /> + + {errors.transactionAmount?.message} + + + + + + + Comments + ( +