fix: design of sent mail message,change variable name emailCount to emailList

This commit is contained in:
RaktimaNXG
2023-12-05 13:08:42 +05:30
parent ac0cdd28cf
commit 428bb3b7c3
4 changed files with 43 additions and 42 deletions
@@ -20,14 +20,14 @@ function EmailComponent({
pdfName,
sender
}) {
const [emailCount, setEmailCount] = useState([]);
const [emailList, setEmailList] = useState([]);
const [emailValue, setEmailValue] = useState();
const [isLoading, setIsLoading] = useState(false);
//function for send email
const sendEmail = async () => {
setIsLoading(true);
let sendMail;
for (let i = 0; i < emailCount.length; i++) {
for (let i = 0; i < emailList.length; i++) {
try {
const imgPng =
"https://qikinnovation.ams3.digitaloceanspaces.com/logo.png";
@@ -44,7 +44,7 @@ function EmailComponent({
let params = {
pdfName: pdfName,
url: pdfUrl,
recipient: emailCount[i],
recipient: emailList[i],
subject: `${sender.name} has signed the doc - ${pdfName}`,
from: sender.email,
html:
@@ -69,7 +69,7 @@ function EmailComponent({
if (sendMail.data.result.status === "success") {
setIsEmail(false);
setEmailValue("");
setEmailCount("");
setEmailList([]);
setSuccessEmail(true);
setTimeout(() => {
setSuccessEmail(false);
@@ -87,8 +87,8 @@ function EmailComponent({
//function for remove email
const removeChip = (index) => {
const updateEmailCount = emailCount.filter((data, key) => key !== index);
setEmailCount(updateEmailCount);
const updateEmailCount = emailList.filter((data, key) => key !== index);
setEmailList(updateEmailCount);
};
//function for get email value
const handleEmailValue = (e) => {
@@ -99,10 +99,10 @@ function EmailComponent({
//function for save email in array after press enter
const handleEnterPress = (e) => {
if (e.key === "Enter" && emailValue) {
setEmailCount((prev) => [...prev, emailValue]);
setEmailList((prev) => [...prev, emailValue]);
setEmailValue("");
} else if (e === "add" && emailValue) {
setEmailCount((prev) => [...prev, emailValue]);
setEmailList((prev) => [...prev, emailValue]);
setEmailValue("");
}
};
@@ -253,7 +253,7 @@ function EmailComponent({
>
Recipients added here will get a copy of the signed document.
</p>
{emailCount.length > 0 ? (
{emailList.length > 0 ? (
<>
<div className="addEmail">
<div
@@ -264,7 +264,7 @@ function EmailComponent({
flexWrap: "wrap"
}}
>
{emailCount.map((data, ind) => {
{emailList.map((data, ind) => {
return (
<div
className="emailChip"
@@ -297,7 +297,7 @@ function EmailComponent({
);
})}
</div>
{emailCount.length <= 9 && (
{emailList.length <= 9 && (
<input
type="text"
value={emailValue}
@@ -370,19 +370,19 @@ function EmailComponent({
onClick={() => {
setIsEmail(false);
setEmailValue("");
setEmailCount("");
setEmailList([]);
}}
>
Close
</button>
<button
disabled={emailCount.length === 0 && true}
disabled={emailList.length === 0 && true}
style={{
background: themeColor(),
color: "white"
}}
type="button"
className={emailCount.length === 0 ? "defaultBtn" : "finishBtn"}
className={emailList.length === 0 ? "defaultBtn" : "finishBtn"}
onClick={() => sendEmail()}
>
Send