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;
|
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 = {
|
const teamMap = {
|
||||||
|
plq: "ec48450c-7e26-ec11-a97f-00224800e98c", //PET
|
||||||
ipq: "7fb9e598-7d26-ec11-a97f-00224800e98c", // Infrastructure
|
ipq: "7fb9e598-7d26-ec11-a97f-00224800e98c", // Infrastructure
|
||||||
pcpq: "8ffabad9-7c26-ec11-a97f-00224800e98c", // Casework
|
pcpq: "8ffabad9-7c26-ec11-a97f-00224800e98c", // Casework
|
||||||
pi: "5554882f-4606-ec11-a97f-00224800d374", // Digital Support Team
|
pi: "5554882f-4606-ec11-a97f-00224800d374", // Digital Support Team
|
||||||
appadvice: "5554882f-4606-ec11-a97f-00224800d374",
|
appadvice: "cc3d987e-7c26-ec11-a97f-00224800e98c",
|
||||||
repadvice: "5554882f-4606-ec11-a97f-00224800d374",
|
repadvice: "cc3d987e-7c26-ec11-a97f-00224800e98c",
|
||||||
ceq: "4fddd7e8-7d26-ec11-a97f-00224800e98c", // Inspector Scheduling
|
ceq: "4fddd7e8-7d26-ec11-a97f-00224800e98c", // Inspector Scheduling
|
||||||
other: "8ffabad9-7c26-ec11-a97f-00224800e98c",
|
other: "8ffabad9-7c26-ec11-a97f-00224800e98c", // Casework
|
||||||
postdec: "cc3d987e-7c26-ec11-a97f-00224800e98c", // SLT Team
|
postdec: "1357e457-7e26-ec11-a97f-00224800e98c", // SLT Team
|
||||||
comp: "cc3d987e-7c26-ec11-a97f-00224800e98c",
|
comp: "1357e457-7e26-ec11-a97f-00224800e98c", // SLT Team
|
||||||
};
|
};
|
||||||
|
|
||||||
let teamId = teamMap[contactValue];
|
let teamId = teamMap[contactValue];
|
||||||
|
|||||||
+31
-2
@@ -7,7 +7,6 @@ import Footer from "../components/footer";
|
|||||||
import Header from "../components/header";
|
import Header from "../components/header";
|
||||||
import ServiceBanner from "../components/servicebanner";
|
import ServiceBanner from "../components/servicebanner";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { PickList } from "../components/elements";
|
|
||||||
import {
|
import {
|
||||||
Field,
|
Field,
|
||||||
change,
|
change,
|
||||||
@@ -296,6 +295,8 @@ let ContactUs = (props) => {
|
|||||||
// Only called if validation passes
|
// Only called if validation passes
|
||||||
sendContactEmail(formValues);
|
sendContactEmail(formValues);
|
||||||
createCRMTask(formValues);
|
createCRMTask(formValues);
|
||||||
|
formValues.typeOfContact == "plq" &&
|
||||||
|
sendPETEmail(formValues, props.petEmail);
|
||||||
console.log("Form submitted:", formValues);
|
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 (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Head>
|
<Head>
|
||||||
@@ -339,7 +367,7 @@ let ContactUs = (props) => {
|
|||||||
<Header />
|
<Header />
|
||||||
<div className="govuk-width-container">
|
<div className="govuk-width-container">
|
||||||
<Breadcrumbs />
|
<Breadcrumbs />
|
||||||
<ServiceBanner />
|
<ServiceBanner props={props} />
|
||||||
<main
|
<main
|
||||||
className="govuk-main-wrapper govuk-!-padding-top-9 govuk-main-wrapper--auto-spacing"
|
className="govuk-main-wrapper govuk-!-padding-top-9 govuk-main-wrapper--auto-spacing"
|
||||||
id="main-content"
|
id="main-content"
|
||||||
@@ -468,6 +496,7 @@ const mapStateToProps = (state) => {
|
|||||||
return {
|
return {
|
||||||
typeOfContactValue,
|
typeOfContactValue,
|
||||||
initialValues: email ? { contactEmail: email } : {},
|
initialValues: email ? { contactEmail: email } : {},
|
||||||
|
petEmail: process.env.NEXT_PUBLIC_PETEMAIL,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user