16493 routing for PET team send email
This commit is contained in:
@@ -71,76 +71,17 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
let contactValue = createTaskBody.typeOfContact;
|
||||
|
||||
// const whichTeam = (contactValue) => {
|
||||
// switch (contactValue) {
|
||||
// case "plq":
|
||||
// //Questions about Planning legislation or policy
|
||||
// //PD - Via Email - Planning.Directorate@gov.wales
|
||||
|
||||
// return;
|
||||
// break;
|
||||
// case "ipq":
|
||||
// //Questions or comments about applications for major infrastructure projects
|
||||
// //Infrastructure
|
||||
// return "7fb9e598-7d26-ec11-a97f-00224800e98c";
|
||||
// break;
|
||||
// case "pcpq":
|
||||
// //Questions or comments about planning and environmental appeals
|
||||
// //Casework
|
||||
// return "8ffabad9-7c26-ec11-a97f-00224800e98c";
|
||||
// break;
|
||||
// case "pi":
|
||||
// //Query about using the Casework Portal
|
||||
// // Digital Support Team - PEDW
|
||||
// return "5554882f-4606-ec11-a97f-00224800d374";
|
||||
// break;
|
||||
// case "appadvice":
|
||||
// //Advice How to submit an appeal
|
||||
// //R&D
|
||||
// return "5554882f-4606-ec11-a97f-00224800d374";
|
||||
// break;
|
||||
// case "repadvice":
|
||||
// //Advice How to comment on an appeal or application
|
||||
// //R&D
|
||||
// return "5554882f-4606-ec11-a97f-00224800d374";
|
||||
// break;
|
||||
// case "ceq":
|
||||
// //Queries about forthcoming Hearing or Inquiry event
|
||||
// //Inspector Scheduling
|
||||
// return "4fddd7e8-7d26-ec11-a97f-00224800e98c";
|
||||
// break;
|
||||
// case "other":
|
||||
// //Other enquiry for PEDW
|
||||
// //Casework
|
||||
// return "8ffabad9-7c26-ec11-a97f-00224800e98c";
|
||||
// break;
|
||||
// case "postdec":
|
||||
// //Issues or questions about a case after the decision is issued
|
||||
// //SLT Team
|
||||
// return "cc3d987e-7c26-ec11-a97f-00224800e98c";
|
||||
// break;
|
||||
// case "comp":
|
||||
// //General Complaints of Compliments
|
||||
// //SLT Team
|
||||
// return "cc3d987e-7c26-ec11-a97f-00224800e98c";
|
||||
|
||||
// break;
|
||||
// default:
|
||||
// // code block
|
||||
// }
|
||||
// };
|
||||
// let teamId = whichTeam(contactValue);
|
||||
|
||||
const teamMap = {
|
||||
plq: "ec48450c-7e26-ec11-a97f-00224800e98c", //PET
|
||||
ipq: "7fb9e598-7d26-ec11-a97f-00224800e98c", // Infrastructure
|
||||
pcpq: "8ffabad9-7c26-ec11-a97f-00224800e98c", // Casework
|
||||
pi: "5554882f-4606-ec11-a97f-00224800d374", // Digital Support Team
|
||||
appadvice: "5554882f-4606-ec11-a97f-00224800d374",
|
||||
repadvice: "5554882f-4606-ec11-a97f-00224800d374",
|
||||
appadvice: "cc3d987e-7c26-ec11-a97f-00224800e98c",
|
||||
repadvice: "cc3d987e-7c26-ec11-a97f-00224800e98c",
|
||||
ceq: "4fddd7e8-7d26-ec11-a97f-00224800e98c", // Inspector Scheduling
|
||||
other: "8ffabad9-7c26-ec11-a97f-00224800e98c",
|
||||
postdec: "cc3d987e-7c26-ec11-a97f-00224800e98c", // SLT Team
|
||||
comp: "cc3d987e-7c26-ec11-a97f-00224800e98c",
|
||||
other: "8ffabad9-7c26-ec11-a97f-00224800e98c", // Casework
|
||||
postdec: "1357e457-7e26-ec11-a97f-00224800e98c", // SLT Team
|
||||
comp: "1357e457-7e26-ec11-a97f-00224800e98c", // SLT Team
|
||||
};
|
||||
|
||||
let teamId = teamMap[contactValue];
|
||||
|
||||
+31
-2
@@ -7,7 +7,6 @@ import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
import Link from "next/link";
|
||||
import { PickList } from "../components/elements";
|
||||
import {
|
||||
Field,
|
||||
change,
|
||||
@@ -296,6 +295,8 @@ let ContactUs = (props) => {
|
||||
// Only called if validation passes
|
||||
sendContactEmail(formValues);
|
||||
createCRMTask(formValues);
|
||||
formValues.typeOfContact == "plq" &&
|
||||
sendPETEmail(formValues, props.petEmail);
|
||||
console.log("Form submitted:", formValues);
|
||||
};
|
||||
|
||||
@@ -329,6 +330,33 @@ let ContactUs = (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
const sendPETEmail = async (formValues, petEmail) => {
|
||||
const reference = "PEDW-CONTACT-US-PET";
|
||||
const templateId = "56bbdcf9-d63d-48e9-a794-3e253dd7498b";
|
||||
const templateIdCY = "00b794d3-29aa-434d-b696-0ef0b0337d79";
|
||||
|
||||
console.log(petEmail);
|
||||
|
||||
try {
|
||||
const res = await sendEmail(
|
||||
templateId,
|
||||
petEmail,
|
||||
formValues,
|
||||
reference
|
||||
);
|
||||
|
||||
console.log("Email sent successfully.");
|
||||
setFormSubmitted(true);
|
||||
} catch (error) {
|
||||
console.error("Email sending failed:", error);
|
||||
alert("Something went wrong. Please try again later.");
|
||||
// Required: inform redux-form this is a submit error
|
||||
throw new SubmissionError({
|
||||
_error: "Failed to send email. Please try again later.",
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
@@ -339,7 +367,7 @@ let ContactUs = (props) => {
|
||||
<Header />
|
||||
<div className="govuk-width-container">
|
||||
<Breadcrumbs />
|
||||
<ServiceBanner />
|
||||
<ServiceBanner props={props} />
|
||||
<main
|
||||
className="govuk-main-wrapper govuk-!-padding-top-9 govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
@@ -468,6 +496,7 @@ const mapStateToProps = (state) => {
|
||||
return {
|
||||
typeOfContactValue,
|
||||
initialValues: email ? { contactEmail: email } : {},
|
||||
petEmail: process.env.NEXT_PUBLIC_PETEMAIL,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user