diff --git a/src/api/send-mail/index.tsx b/src/api/send-mail/index.tsx index bf1229b..a87d9e5 100644 --- a/src/api/send-mail/index.tsx +++ b/src/api/send-mail/index.tsx @@ -15,7 +15,7 @@ function EmailSender({ const [userResponse, setUserResponse] = useState(""); let basePath = "contact"; - if (window.location.pathname.includes("contribute")) { + if (window.location.pathname.includes("contributionpage")) { basePath = "contribute"; } else if (window.location.pathname.includes("apioperations")) { basePath = "contribute_productions"; @@ -33,7 +33,7 @@ function EmailSender({ const dataForBrevo = { sender: { email: "mihoub.debache@enseignementsup.gouv.fr", - name: "Debache ", + name: `${selectedProfile} de l'équipe scanR`, }, to: [ { @@ -41,7 +41,7 @@ function EmailSender({ name: "Mihoub mihoub", }, ], - subject: `${selectedProfile} de l'équipe scanR`, + subject: `Réponse à votre contribution`, htmlContent: userResponse, }; @@ -59,7 +59,8 @@ function EmailSender({ } const dataForScanR = { - comment: userResponse, + mailSent: userResponse, + mailSentDate: new Date(), responseFrom: selectedProfile, }; @@ -99,7 +100,7 @@ function EmailSender({ onClick={sendEmail} size="sm" > - {contribution.comment ? "Renvoyer un mail" : "Répondre"} + {contribution.mailSent ? "Renvoyer un mail" : "Répondre"} diff --git a/src/components/edit-modal/index.tsx b/src/components/edit-modal/index.tsx index 97f40c4..b28eedf 100644 --- a/src/components/edit-modal/index.tsx +++ b/src/components/edit-modal/index.tsx @@ -26,6 +26,7 @@ const EditModal: React.FC = ({ isOpen, data, onClose }) => { status: data.status, tag: "", idRef: "", + comment: "", }); useEffect(() => { @@ -34,6 +35,7 @@ const EditModal: React.FC = ({ isOpen, data, onClose }) => { status: "treated", tag: "", idRef: "", + comment: "", }); }, [data, user]); @@ -48,6 +50,10 @@ const EditModal: React.FC = ({ isOpen, data, onClose }) => { const newTag = event.target.value; setInputs((prevInputs) => ({ ...prevInputs, tag: newTag })); }; + const handleCommentChange = (event) => { + const newComment = event.target.value; + setInputs((prevInputs) => ({ ...prevInputs, comment: newComment })); + }; const handleIdRefChange = (event) => { const newIdref = event.target.value; @@ -56,7 +62,7 @@ const EditModal: React.FC = ({ isOpen, data, onClose }) => { let basePath = "contact"; - if (window.location.pathname.includes("contribute")) { + if (window.location.pathname.includes("contributionpage")) { basePath = "contribute"; } else if (window.location.pathname.includes("apioperations")) { basePath = "contribute_productions"; @@ -73,6 +79,7 @@ const EditModal: React.FC = ({ isOpen, data, onClose }) => { status: inputs.status, tag: inputs.tag, idref: inputs.idRef, + comment: inputs.comment, }), } ); @@ -140,6 +147,21 @@ const EditModal: React.FC = ({ isOpen, data, onClose }) => { /> + + +