@@ -304,7 +304,7 @@ const RepInterestedPartyPerson = (props) => {
|
|||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("common:save-exit-button")}sssss
|
{t("common:save-exit-button")}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+3
-1
@@ -11,7 +11,9 @@
|
|||||||
"start3": "NODE_ENV=production next start",
|
"start3": "NODE_ENV=production next start",
|
||||||
"start": "NODE_ENV=production node_modules/next/dist/bin/next start",
|
"start": "NODE_ENV=production node_modules/next/dist/bin/next start",
|
||||||
"lint": "next lint",
|
"lint": "next lint",
|
||||||
"prisma:generate": "prisma generate"
|
"prisma:generate": "prisma generate",
|
||||||
|
"test:reps": "cd '../../welsh government/Playwright/Playwright' && npx playwright test tests/loggedin/raiserep.spec.js --headed",
|
||||||
|
"test:newappeal": "cd '../../welsh government/Playwright/Playwright' && npx playwright test tests/loggedin/newappeal.spec.js --headed"
|
||||||
},
|
},
|
||||||
"browser": {
|
"browser": {
|
||||||
"child_process": false
|
"child_process": false
|
||||||
|
|||||||
+34
-31
@@ -86,15 +86,13 @@ const buildNotifyPayloads = (watchlistByEmail) => {
|
|||||||
const ref = doc.pinswg_isharedocumentreference || t.noRef;
|
const ref = doc.pinswg_isharedocumentreference || t.noRef;
|
||||||
const name = doc.pinswg_name || t.untitled;
|
const name = doc.pinswg_name || t.untitled;
|
||||||
const date =
|
const date =
|
||||||
formatDates(
|
formatDates(doc.pinswg_documentpublisheddate, language) ||
|
||||||
doc.pinswg_documentpublisheddate?.split("T")[0],
|
t.noDate;
|
||||||
language
|
|
||||||
) || t.noDate;
|
|
||||||
const link =
|
const link =
|
||||||
(process.env.NEXTAUTH_URL || "") + doc.pinswg_hashlink ||
|
(process.env.NEXTAUTH_URL || "") + doc.pinswg_hashlink ||
|
||||||
"[No Link]";
|
"[No Link]";
|
||||||
|
|
||||||
return ` - ${name} (${date})\n ${t.link}: ${link}`;
|
return ` - [${name} (${date})](${link})`;
|
||||||
})
|
})
|
||||||
.join("\n");
|
.join("\n");
|
||||||
};
|
};
|
||||||
@@ -119,11 +117,12 @@ const buildNotifyPayloads = (watchlistByEmail) => {
|
|||||||
.map((event) => {
|
.map((event) => {
|
||||||
const name = event.pinswg_name || t.unnamed;
|
const name = event.pinswg_name || t.unnamed;
|
||||||
const date =
|
const date =
|
||||||
formatDates(
|
formatDates(event.pinswg_dateeventrequested, false) ||
|
||||||
event.pinswg_dateeventrequested?.split("T")[0],
|
t.noDate;
|
||||||
language
|
const time =
|
||||||
) || t.noDate;
|
formatDates(event.pinswg_dateeventrequested, true) ||
|
||||||
return ` - ${name} ${t.on} ${date}`;
|
t.noDate;
|
||||||
|
return ` - ${name} ${t.on} ${date} ${time}`;
|
||||||
})
|
})
|
||||||
.join("\n");
|
.join("\n");
|
||||||
};
|
};
|
||||||
@@ -149,15 +148,9 @@ const buildNotifyPayloads = (watchlistByEmail) => {
|
|||||||
return reps
|
return reps
|
||||||
.map((rep) => {
|
.map((rep) => {
|
||||||
const start =
|
const start =
|
||||||
formatDates(
|
formatDates(rep.pinswg_consultationopen, false) || t.na;
|
||||||
rep.pinswg_consultationopen?.split("T")[0],
|
|
||||||
language
|
|
||||||
) || t.na;
|
|
||||||
const end =
|
const end =
|
||||||
formatDates(
|
formatDates(rep.pinswg_consultationclose, false) || t.na;
|
||||||
rep.pinswg_consultationclose?.split("T")[0],
|
|
||||||
language
|
|
||||||
) || t.na;
|
|
||||||
|
|
||||||
return ` - ${t.open}: ${start} ${t.to} ${t.close}: ${end}`;
|
return ` - ${t.open}: ${start} ${t.to} ${t.close}: ${end}`;
|
||||||
})
|
})
|
||||||
@@ -197,28 +190,33 @@ const buildNotifyPayloads = (watchlistByEmail) => {
|
|||||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||||
] || "Unknown Case";
|
] || "Unknown Case";
|
||||||
|
|
||||||
|
const appealType =
|
||||||
|
entry[
|
||||||
|
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||||
|
] || "";
|
||||||
|
|
||||||
const docSection = entry.documents?.length
|
const docSection = entry.documents?.length
|
||||||
? `Documents added or updated:\n${formatDocuments(
|
? `### Documents added or updated:\n${formatDocuments(
|
||||||
entry.documents,
|
entry.documents,
|
||||||
"en"
|
"en"
|
||||||
)}\n`
|
)}\n`
|
||||||
: "";
|
: "";
|
||||||
const sipSection = entry.sipEvents?.length
|
const sipSection = entry.sipEvents?.length
|
||||||
? `SIP Events created:\n${formatSipEvents(
|
? `### SIP Events created:\n${formatSipEvents(
|
||||||
entry.sipEvents
|
entry.sipEvents
|
||||||
)}\n`
|
)}\n`
|
||||||
: "";
|
: "";
|
||||||
const repsSection = entry.repsPeriods?.length
|
const repsSection = entry.repsPeriods?.length
|
||||||
? `Consultation Periods:\n${formatReps(
|
? `### Consultation Periods:\n${formatReps(
|
||||||
entry.repsPeriods
|
entry.repsPeriods
|
||||||
)}\n`
|
)}\n`
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
const caseUnsubscribelink = `Unsubscribe to updates on this case ${process.env.NEXTAUTH_URL}/unsubscribe/${entry.pinswg_watchlistid}`;
|
const caseUnsubscribelink = `[Unsubscribe](${process.env.NEXTAUTH_URL}/unsubscribe/${entry.pinswg_watchlistid}) to updates on this case `;
|
||||||
|
|
||||||
return `Case: ${caseRef}\nLink to case:${
|
return `---\n## Case: [${caseRef}](${
|
||||||
process.env.NEXTAUTH_URL
|
process.env.NEXTAUTH_URL
|
||||||
}/case/${caseRef}\n\n${[
|
}/case/${caseRef}) - ${appealType}\n\n${[
|
||||||
docSection,
|
docSection,
|
||||||
sipSection,
|
sipSection,
|
||||||
repsSection,
|
repsSection,
|
||||||
@@ -228,9 +226,9 @@ const buildNotifyPayloads = (watchlistByEmail) => {
|
|||||||
.join("\n")}`;
|
.join("\n")}`;
|
||||||
})
|
})
|
||||||
.join("\n\n"),
|
.join("\n\n"),
|
||||||
unsubscribeLink: `Unsubscribe by selecting this link if you no longer want to receive any updates ${
|
unsubscribeLink: `[Unsubscribe](${
|
||||||
process.env.NEXTAUTH_URL + "/unsubscribeall/" + contactId
|
process.env.NEXTAUTH_URL + "/unsubscribeall/" + contactId
|
||||||
}`
|
}) by selecting this link if you no longer want to receive any updates `
|
||||||
};
|
};
|
||||||
|
|
||||||
const personalisationCY = {
|
const personalisationCY = {
|
||||||
@@ -242,6 +240,11 @@ const buildNotifyPayloads = (watchlistByEmail) => {
|
|||||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||||
] || "Achos Anhysbys";
|
] || "Achos Anhysbys";
|
||||||
|
|
||||||
|
const appealType =
|
||||||
|
entry[
|
||||||
|
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
|
||||||
|
] || "";
|
||||||
|
|
||||||
const docSection = entry.documents?.length
|
const docSection = entry.documents?.length
|
||||||
? `Dogfennau wedi'u hychwanegu neu eu diweddaru:\n${formatDocuments(
|
? `Dogfennau wedi'u hychwanegu neu eu diweddaru:\n${formatDocuments(
|
||||||
entry.documents,
|
entry.documents,
|
||||||
@@ -261,11 +264,11 @@ const buildNotifyPayloads = (watchlistByEmail) => {
|
|||||||
)}\n`
|
)}\n`
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
const caseUnsubscribelink = `Dad-danysgrifio i ddiweddariadau ar yr achos hwn ${process.env.NEXTAUTH_URL}/unsubscribe/${entry.pinswg_watchlistid}`;
|
const caseUnsubscribelink = `[Dad-danysgrifio](${process.env.NEXTAUTH_URL}/cy/unsubscribe/${entry.pinswg_watchlistid}) i ddiweddariadau ar yr achos hwn `;
|
||||||
|
|
||||||
return `Achos: ${caseRef}\nDolen i'r achos: ${
|
return `## Achos: [${caseRef}](${
|
||||||
process.env.NEXTAUTH_URL
|
process.env.NEXTAUTH_URL
|
||||||
}/case/${caseRef}\n\n${[
|
}/cy/case/${caseRef}) - ${appealType}\n\n${[
|
||||||
docSection,
|
docSection,
|
||||||
sipSection,
|
sipSection,
|
||||||
repsSection,
|
repsSection,
|
||||||
@@ -276,7 +279,7 @@ const buildNotifyPayloads = (watchlistByEmail) => {
|
|||||||
})
|
})
|
||||||
.join("\n\n"),
|
.join("\n\n"),
|
||||||
unsubscribeLink: `Dad-danysgrifiwch drwy ddewis y ddolen hon os nad ydych chi eisiau derbyn unrhyw ddiweddariadau mwyach ${
|
unsubscribeLink: `Dad-danysgrifiwch drwy ddewis y ddolen hon os nad ydych chi eisiau derbyn unrhyw ddiweddariadau mwyach ${
|
||||||
process.env.NEXTAUTH_URL + "/unsubscribeall/" + contactId
|
process.env.NEXTAUTH_URL + "/cy/unsubscribeall/" + contactId
|
||||||
}`
|
}`
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -304,7 +307,7 @@ export default async function CombinedApiProxy(req, res) {
|
|||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
|
|
||||||
// Step 1: Fetch all watchlist entries
|
// Step 1: Fetch all watchlist entries
|
||||||
const watchlistQuery = `pinswg_watchlists?$count=true&$filter=pinswg_emailnotifications ne null&$expand=pinswg_Contact($select=contactid,emailaddress1,firstname,lastname,pinswg_preferredlanguage)&$select=pinswg_emailnotifications,_pinswg_watchedcase_value`;
|
const watchlistQuery = `pinswg_watchlists?$count=true&$filter=pinswg_emailnotifications ne null&$expand=pinswg_Contact($select=contactid,emailaddress1,firstname,lastname,pinswg_preferredlanguage)&$select=pinswg_emailnotifications,_pinswg_watchedcase_value,pinswg_appealcasetype`;
|
||||||
const watchlistRes = await axios.get(
|
const watchlistRes = await axios.get(
|
||||||
WEBAPI_URL + watchlistQuery + hashAPIPath(watchlistQuery),
|
WEBAPI_URL + watchlistQuery + hashAPIPath(watchlistQuery),
|
||||||
azureHeaders(token.access_token)
|
azureHeaders(token.access_token)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export default async function ApiProxy(req, res) {
|
|||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
|
|
||||||
const queryUrl =
|
const queryUrl =
|
||||||
"pinswg_watchlists?$count=true&$filter=pinswg_emailnotifications ne null&$expand=pinswg_Contact($select=contactid,emailaddress1)&$select=pinswg_emailnotifications,_pinswg_watchedcase_value";
|
"pinswg_watchlists?$count=true&$filter=pinswg_emailnotifications ne null&$expand=pinswg_Contact($select=contactid,emailaddress1)&$select=pinswg_emailnotifications,_pinswg_watchedcase_value,pinswg_appealcasetype";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { data } = await axios.get(
|
const { data } = await axios.get(
|
||||||
|
|||||||
Reference in New Issue
Block a user