diff --git a/src/Components/DataTable/NormalTable.jsx b/src/Components/DataTable/NormalTable.jsx index af3155f..a08a134 100644 --- a/src/Components/DataTable/NormalTable.jsx +++ b/src/Components/DataTable/NormalTable.jsx @@ -58,7 +58,6 @@ const NormalTable = ({ }; - const handleCheckboxChange = (value) => { if (radio) { // If radio is true, select only one option diff --git a/src/Components/Popups/ConfirmReversalPopups.jsx b/src/Components/Popups/ConfirmReversalPopups.jsx new file mode 100644 index 0000000..b6e7183 --- /dev/null +++ b/src/Components/Popups/ConfirmReversalPopups.jsx @@ -0,0 +1,202 @@ +import { + Box, + Button, + Checkbox, + FormControl, + FormLabel, + Input, + Modal, + ModalBody, + ModalCloseButton, + ModalContent, + ModalFooter, + ModalHeader, + ModalOverlay, + Text, + Textarea, + useBoolean, +} from "@chakra-ui/react"; +import React, { useEffect, useState } from "react"; +import PropTypes from "prop-types"; + +import * as yup from "yup"; +import { yupResolver } from "@hookform/resolvers/yup"; +import { useForm } from "react-hook-form"; +import ReactQuill from "react-quill"; + +export const conformModalSchema = yup.object().shape({ + comment: yup + .string() + .min(2, "Minimum length should be 2 characters.") + .max(150, "Maximum length should be 150 characters.") + // .matches(/^[^\d]+$/, "Sponsor Name cannot contain numbers") + .required("Comment is required"), + subject: yup.string().notRequired(), + emailTemplate: yup.string().notRequired(), +}); + +const ConfirmReversalPopups = ({ + isOpen, + onClose, + handleConfirm, + isLoading, +}) => { + const { + watch, + register, + reset, + handleSubmit, + setValue, + formState: { errors }, + } = useForm({ + resolver: yupResolver(conformModalSchema), + mode: "all", + }); + + const [richTextValue, setRichTextValue] = useState(""); + + useEffect(() => { + setValue("emailTemplate", richTextValue); + }, [richTextValue]); + + // Reset the form when the modal closes + useEffect(() => { + if (!isOpen) { + reset(); // Clear the form state + } + }, [isOpen, reset]); + + const [emailApproval, setEmailApproval] = useBoolean(false); + + const modules = { + toolbar: [ + // [{ header: "1" }, { header: "2" }, + // // { font: [] } + // ], + // [{ size: [] }], + ["bold", "italic", "underline", "strike", "blockquote"], + [{ list: "ordered" }, { list: "bullet" }], + ["clean"], + ], + }; + + return ( + + + + Approve + + { + handleConfirm(data); + reset(); + onClose(); + })} + > + + + Comment +