diff --git a/src/Contexts/GlobalStateProvider.jsx b/src/Contexts/GlobalStateProvider.jsx index 2649016..aac69de 100644 --- a/src/Contexts/GlobalStateProvider.jsx +++ b/src/Contexts/GlobalStateProvider.jsx @@ -1731,7 +1731,7 @@ const GlobalStateProvider = ({ children }) => { // ==============[ prod state ]=============================== const [IODetails, setIODetails] = useState(null); - const [ IOStatus, setIoStatus ] = useState(null) + const [ isIOloading, setIOloading ] = useState(false) return ( { setIOArtifactsTwo, - - - IOStatus, - setIoStatus + isIOloading, + setIOloading }} > {children} diff --git a/src/Layout/DefaultLayout.jsx b/src/Layout/DefaultLayout.jsx index b657b98..2995343 100644 --- a/src/Layout/DefaultLayout.jsx +++ b/src/Layout/DefaultLayout.jsx @@ -391,7 +391,7 @@ const DashboardLayout = ({ isOnline }) => { // onMouseOver={() => setIsDrawerOpen(true)} // onMouseLeave={() => setIsDrawerOpen(false)} style={{ - width: isDrawerOpen || openDrawerClick ? 255 : 74, + width: isDrawerOpen || openDrawerClick ? 230 : 74, transition: "width 0.3s ease-in-out", // Smooth transition for width change // overflow: "hidden", backgroundColor: "#0041180A", @@ -631,7 +631,7 @@ const DashboardLayout = ({ isOnline }) => {
{ + 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 [createIoNav] = useCreateIoNavMutation() + // const { + // data + // } = useGetArtifactsQuery(id) + + const { + control, + handleSubmit, + watch, + reset, + formState: { errors }, + } = useForm({ + resolver: yupResolver(ioNav), + }); + + + const [createIoCash] = useCreateIoCashMutation() + + + const onSubmit = async (data) => { + + setIsLoading(true) + + try { + + const res = await createIoNav({ data, id }) + if (res?.data?.statusCode === 201) { + setIsLoading(false); + toast({ + render: () => , + }); + handleClose() + }else if(res?.error?.status === 400){ + setIsLoading(false); + toast({ + render: () => , + }); + } + + + } catch (error) { + console.log(error); + + } + + }; + + + + const handleConfirm = () => { + handleSubmit(onSubmit)(); + }; + + const handleSave = () => { + handleSubmit(onSubmit)(); + }; + + const handleClose = () => { + setAlert(false) + onClose() + reset({ + transactionDate:"", + transactionAmount:"", + comments:"" + }) + } + + + + +const today = formatDatee(new Date(), 'yyyy-MM-dd'); + + + + return ( + <> + + + + + IO Nav Details + + + + + Date Selection + ( + + )} + /> + + {errors.transactionDate?.message} + + + + + + + Transaction Amount + ( + + )} + /> + + {errors.transactionAmount?.message} + + + + + + + Comments + ( +