From 5fc16b58ea25f15fa8a7b9f2a05fb01002fcc944 Mon Sep 17 00:00:00 2001 From: YasinShaikh123 <123150391+YasinShaikh123@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:04:20 +0530 Subject: [PATCH] =?UTF-8?q?working=20tabs=F0=9F=91=B7=E2=80=8D=E2=99=82?= =?UTF-8?q?=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CreateIO/IOCashDetails/AddApproved.jsx | 487 +++++++++--------- .../CreateIO/IOCashDetails/AddPending.jsx | 487 +++++++++--------- .../CreateIO/IOCashDetails/AddRejected.jsx | 482 ++++++++--------- .../CreateIO/IOCashDetails/Approved.jsx | 39 +- .../CreateIO/IOCashDetails/Pending.jsx | 33 +- .../CreateIO/IOCashDetails/Rejected.jsx | 41 +- .../CreateIO/IONAVDetails/AddApproved.jsx | 251 +++++++++ .../CreateIO/IONAVDetails/AddPending.jsx | 251 +++++++++ .../CreateIO/IONAVDetails/AddRejected.jsx | 251 +++++++++ .../CreateIO/IONAVDetails/Approved.jsx | 85 ++- .../IO_Management/ViewIO/HeaderModal/Exit.jsx | 2 +- .../ViewIO/HeaderModal/UpdateIONav.jsx | 2 +- src/Services/io.service.js | 3 +- 13 files changed, 1655 insertions(+), 759 deletions(-) create mode 100644 src/Pages/IO_Management/CreateIO/IONAVDetails/AddApproved.jsx create mode 100644 src/Pages/IO_Management/CreateIO/IONAVDetails/AddPending.jsx create mode 100644 src/Pages/IO_Management/CreateIO/IONAVDetails/AddRejected.jsx diff --git a/src/Pages/IO_Management/CreateIO/IOCashDetails/AddApproved.jsx b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddApproved.jsx index 17bddef..5685ce1 100644 --- a/src/Pages/IO_Management/CreateIO/IOCashDetails/AddApproved.jsx +++ b/src/Pages/IO_Management/CreateIO/IOCashDetails/AddApproved.jsx @@ -1,254 +1,251 @@ import { - Box, - Button, - Drawer, - DrawerBody, - DrawerCloseButton, - DrawerContent, - DrawerFooter, - DrawerHeader, - DrawerOverlay, - FormControl, - FormErrorMessage, - FormLabel, - Input, - Select, - Stack, - Textarea, - useToast, - } from "@chakra-ui/react"; - import * as yup from "yup"; - import React, { useState, useEffect, useContext } from "react"; - import { useForm, Controller } from "react-hook-form"; - import { yupResolver } from "@hookform/resolvers/yup"; - import { v4 as uuidv4 } from "uuid"; -// import { useCreateIoCashMutation, useCreateVideoArtifactsMutation, useUpdateVideoArtifactsMutation } from "../../../Services/io.service"; - import { useParams } from "react-router-dom"; + Box, + Button, + Drawer, + DrawerBody, + DrawerCloseButton, + DrawerContent, + DrawerFooter, + DrawerHeader, + DrawerOverlay, + FormControl, + FormErrorMessage, + FormLabel, + Input, + Select, + Stack, + Textarea, + useToast, +} from "@chakra-ui/react"; +import * as yup from "yup"; +import React, { useState, useEffect, useContext } from "react"; +import { useForm, Controller } from "react-hook-form"; +import { yupResolver } from "@hookform/resolvers/yup"; +import { v4 as uuidv4 } from "uuid"; +import { useParams } from "react-router-dom"; import CustomAlertDialog from "../../../../Components/CustomAlertDialog"; +import { useCreateIoCashMutation, useCreateVideoArtifactsMutation, useUpdateVideoArtifactsMutation } from "../../../../Services/io.service"; import ToastBox from "../../../../Components/ToastBox"; import GlobalStateContext from "../../../../Contexts/GlobalStateContext"; import CurrencyInput from "../../../../Components/CurrencyInput"; - - const cashDetails = yup.object().shape({ - transactionDate: yup.string().required("Date is required"), - ioTransType_xid: yup.number().required("Cash transaction is required"), - transactionAmount: yup.number().required("Transaction Amount is required"), - comments: yup.string().notRequired(), + +const cashDetails = yup.object().shape({ + transactionDate: yup.string().required("Date is required"), + ioTransType_xid: yup.number().required("Cash transaction is required"), + transactionAmount: yup.number().required("Transaction Amount is required"), + comments: yup.string().notRequired(), +}); + +const AddApproved = ({ 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(); + + + + // ======================[ Cotext Api ] + const { IODetails } = useContext(GlobalStateContext); + const found = data?.find((item) => item?.id === actionId); + + + const [createArtifactsVideo] = useCreateVideoArtifactsMutation() + const [updateVideoArtifacts] = useUpdateVideoArtifactsMutation() + // const { + // data + // } = useGetArtifactsQuery(id) + + const { + control, + handleSubmit, + watch, + reset, + formState: { errors }, + } = useForm({ + resolver: yupResolver(cashDetails), }); - - const AddApproved = ({ 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(); - - - - // ======================[ Cotext Api ] - const { IODetails } = useContext(GlobalStateContext); - const found = data?.find((item) => item?.id === actionId); - - - // const [createArtifactsVideo] = useCreateVideoArtifactsMutation() - // const [updateVideoArtifacts] = useUpdateVideoArtifactsMutation() - // const { - // data - // } = useGetArtifactsQuery(id) - - const { - control, - handleSubmit, - watch, - reset, - formState: { errors }, - } = useForm({ - resolver: yupResolver(cashDetails), - }); - - - // const [createIoCash] = useCreateIoCashMutation() - - - const onSubmit = async (data) => { - - setIsLoading(true) - - try { - - const res = await createIoCash({ data, id }) - if (res?.data?.statusCode === 200) { - setIsLoading(false); - toast({ - render: () => , - }); - handleClose() - }else if(res?.error?.status === 400){ - setIsLoading(false); - toast({ - render: () => , - }); - } - - - } catch (error) { - console.log(error); - + + + const [createIoCash] = useCreateIoCashMutation() + + + const onSubmit = async (data) => { + + setIsLoading(true) + + try { + + const res = await createIoCash({ data, id }) + if (res?.data?.statusCode === 200) { + setIsLoading(false); + toast({ + render: () => , + }); + handleClose() + }else if(res?.error?.status === 400){ + setIsLoading(false); + toast({ + render: () => , + }); } - - }; - - - - const handleConfirm = () => { - handleSubmit(onSubmit)(); - }; - - const handleSave = () => { - handleSubmit(onSubmit)(); - }; - - const handleClose = () => { - setAlert(false) - onClose() - reset({ - transactionAmount:"" - }) + + } catch (error) { + console.log(error); } - - return ( - <> - - - - - IO Cash Details - - - - - Date Selection - ( - - )} - /> - - {errors.transactionDate?.message} - - - - - - Cash transaction - ( - - )} - /> - - {errors.ioTransType_xid?.message} - - - - - - - - Amount - ( - - )} - /> - - {errors.transactionAmount?.message} - - - - - - - Comments - ( -