Merged PR 1835: merge in PH2 work

Related work items: #17344, #17346, #17392, #17466, #17552, #17592, #17728, #18356
This commit is contained in:
Robert Bond
2025-08-20 11:14:26 +00:00
71 changed files with 1683 additions and 443 deletions
+63 -40
View File
@@ -13,31 +13,31 @@ HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136
# CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
# //New Dev oauth ESNR
# CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
# CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
# RELAY_ROOT = https://ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net/ar-hc-lz-pedw-dev-uks-01/
# RELAYURI = "ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-dev-uks-01"
# CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
CLIENT_ID = 9b834097-03d7-409b-b038-ecfec31a394a
CLIENT_SECRET = .Jf8Q~tKMObCJjhh_hy3J5AIctFrBalU4FS~tdxk
RELAY_ROOT = https://ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net/ar-hc-lz-pedw-dev-uks-01/
RELAYURI = "ar-ns-lz-pedw-dev-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-dev-uks-01"
CRMURL = "devcrm2016.llcdt.gov.wales/DVPINS"
# //New Test
# CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
# CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
# RELAY_ROOT = https://ar-ns-lz-pedw-test-uks-01.servicebus.windows.net/ar-hc-lz-pedw-test-uks-01/
# RELAYURI = "ar-ns-lz-pedw-test-uks-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
# CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS"
CLIENT_ID = d40b9373-96c2-4b04-8bd8-c2a2fe6444c1
CLIENT_SECRET = 6hT8Q~glL~jloWpGmvXw3UY37QFwjUE0r._jobEM
RELAY_ROOT = https://ar-ns-lz-pedw-test-uks-01.servicebus.windows.net/ar-hc-lz-pedw-test-uks-01/
RELAYURI = "ar-ns-lz-pedw-test-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-test-uks-01"
CRMURL = "tscrm2016.llcdt.gov.wales/UATPINS"
# //New PreProd
CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
CLIENT_SECRET = V288Q~P1lFMvvX9Xnkx2pLixK~GOREH983Owqc1E
RELAY_ROOT = https://ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-uks-01/
RELAYURI = "ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net"
RELAYPATH = "ar-hc-lz-pedw-ppe-uks-01"
# RELAY_ROOT = https://ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-ukw-01/
# RELAYURI = "ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-ppe-ukw-01"
CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales"
# # //New PreProd
# CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
# CLIENT_SECRET = V288Q~P1lFMvvX9Xnkx2pLixK~GOREH983Owqc1E
# RELAY_ROOT = https://ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-uks-01/
# RELAYURI = "ar-ns-lz-pedw-ppe-uks-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-ppe-uks-01"
# # RELAY_ROOT = https://ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net/ar-hc-lz-pedw-ppe-ukw-01/
# # RELAYURI = "ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net"
# # RELAYPATH = "ar-hc-lz-pedw-ppe-ukw-01"
# CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales"
# //Prod Oauth WGO
@@ -48,6 +48,17 @@ CRMURL = "ppcrm2016.llcdt.gov.wales/PPPINSWales"
# RELAYPATH = "prod-pedw-hc"
# CRMURL = "crm2016.llc.gov.wales/PEDW"
# //New Prod
# CLIENT_ID = 3e4141a3-1fbd-454e-98f0-7f3a4f14a3cc
# CLIENT_SECRET = tFk8Q~E.R-HFjROTu1sRKqwb_ONzy05uPYoF6awR
# RELAY_ROOT = https://ar-ns-lz-pedw-prod-uks-01.servicebus.windows.net/ar-hc-lz-pedw-prod-uks-01/
# RELAYURI = "ar-ns-lz-pedw-prod-uks-01.servicebus.windows.net"
# RELAYPATH = "ar-hc-lz-pedw-prod-uks-01"
# # RELAY_ROOT = https://ar-ns-lz-pedw-ppe-ukw-01.servicebus.windows.net/ar-hc-lz-pedw-prod-ukw-01/
# # RELAYURI = "ar-ns-lz-pedw-prod-ukw-01.servicebus.windows.net"
# # RELAYPATH = "ar-hc-lz-pedw-prod-ukw-01"
# CRMURL = "crm2016.llcdt.gov.wales/PEDW"
//GOOGLE_TAG_MANAGER = GTM-T78CBC3
GOOGLE_TAG_MANAGER = G-GTWW3JT03Z
@@ -58,8 +69,9 @@ SHOWMAPS = false
API_ROOT = "http://localhost:3000"
CY_API_ROOT = "http://cymru.local:3000"
I18N_DOMAIN = "cymru.local"
DOCAPI_OFFLINE = "12:00:00,14:00:00"
SHOWFILTERDOCS = false
# DOCAPI_OFFLINE = "12:00:00,14:00:00"
DOCAPI_OFFLINE = "02:00:00,04:00:00"
SHOWFILTERDOCS = true
// Next Auth vars
@@ -68,18 +80,20 @@ NEXTAUTH_URL_INTERNAL = $API_ROOT
NEXTAUTH_SECRET = SuperSecret
// CNR sql server
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
DATABASE_URL = sqlserver://sql-srv-plt-pedw-cnr-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
// dev test sql server
# DATABASE_URL = sqlserver://pedw-dev-test-sql-svr.database.windows.net:1433;database=PEDWDev;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-dev-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
DATABASE_URL = sqlserver://sql-srv-plt-pedw-dev-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
// Pre prod sql server
DATABASE_URL = sqlserver://sql-srv-plt-pedw-ppe-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustservercertificate=true;hostnameincertificate=*.database.windows.net;logintimeout=30;authentication=SqlPassword
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-ppe-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustservercertificate=true;hostnameincertificate=*.database.windows.net;logintimeout=30;authentication=SqlPassword
// Prod sql server
# DATABASE_URL = sqlserver://pp-pedw-sql.database.windows.net:1433;database=PEDWPreProd;user=RobBondSQL;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
// Prod sql server
# DATABASE_URL = sqlserver://sql-srv-plt-pedw-prod-uks-01.database.windows.net:1433;database=PEDW;user=PedwSqlAdmin;password=GhWKr62F5sQ69dZx;encrypt=true;trustServerCertificate=true;hostNameInCertificate=*.database.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword
SECRET = SuperSecret
@@ -91,24 +105,24 @@ AZURE_TENANT_ID = $TENANT
AZURE_CLIENT_SECRET = $CLIENT_SECRET
// CNR key
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwcnruks"
# AZURE_STORAGE_ACCOUNT_KEY = hRffHq4IwctpaTKdS/U33Xq6nyTDF1t++WJgIwsw7gzstktZin/rRwbTIAL9KKqesVsK7EHrTTG6+ASt4+7skw==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwcnruks.blob.core.windows.net
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwcnruks"
AZURE_STORAGE_ACCOUNT_KEY = hRffHq4IwctpaTKdS/U33Xq6nyTDF1t++WJgIwsw7gzstktZin/rRwbTIAL9KKqesVsK7EHrTTG6+ASt4+7skw==
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwcnruks.blob.core.windows.net
// new dev key
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwdevuks"
# AZURE_STORAGE_ACCOUNT_KEY = MmrsrCjBfop9pI2oImsP/+lJUWU2DrXsAB8nq5bOVROTmPovSGxjCjKw9+TAFr00k8WDUK9r6mVx+AStcMLyAA==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwdevuks"
AZURE_STORAGE_ACCOUNT_KEY = MmrsrCjBfop9pI2oImsP/+lJUWU2DrXsAB8nq5bOVROTmPovSGxjCjKw9+TAFr00k8WDUK9r6mVx+AStcMLyAA==
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwdevuks.blob.core.windows.net
// New test key
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks"
# AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwtestuks"
AZURE_STORAGE_ACCOUNT_KEY = bqJAz5pYQVGee8dnVhlsqW+xHwinNTjgY2AmojNyB+d4uAotMR20WcO4Op13yB+9dFaXAkkjtIA4+AStHT/IYg==
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwtestuks.blob.core.windows.net
// New preprod key
AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwppeuks"
AZURE_STORAGE_ACCOUNT_KEY = B4GRKr+cA9b9mNM/GHFivzhzflJIZltG8bMmooXlYvGYySPAspTTHistAT30sHipnR+hh6dqUc9q+ASttAjPRQ==
AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwppeuks"
# AZURE_STORAGE_ACCOUNT_KEY = B4GRKr+cA9b9mNM/GHFivzhzflJIZltG8bMmooXlYvGYySPAspTTHistAT30sHipnR+hh6dqUc9q+ASttAjPRQ==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net
// PROD key
@@ -116,6 +130,11 @@ AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwppeuks.blob.core.windows.net
# AZURE_STORAGE_ACCOUNT_KEY = koZ46STRqapSa2Dod8MLL6aju1eYLhhyJ6DXpCLMTnFLJvbDT6CHUv/jwr5U/Ta8a60MWzwToHQy+AStADO7sg==
# AZURE_PEDW_STORAGE_ENDPOINT = https://pedwprod.blob.core.windows.net
# // New PROD key
# AZURE_STORAGE_ACCOUNT_NAME = "sapltpedwproduks"
# AZURE_STORAGE_ACCOUNT_KEY = OfV9MFqXcLLPam9GhEdMWadIOwIzhc5hd5TUqzIuQoswFdtV4ybaemjatSv+Kht0Ny1qQKjLplwY+AStUTZJrg==
# AZURE_PEDW_STORAGE_ENDPOINT = https://sapltpedwproduks.blob.core.windows.net
AZURE_PEDW_CONTAINER = "pedwapplications"
AZURE_PEDW_QUEUE_ENDPOINT = https://$AZURE_STORAGE_ACCOUNT_NAME.queue.core.windows.net
@@ -146,4 +165,8 @@ NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=a41b91bf-f7dc-4f44-bb66-a67df4eee43
//NEXT_PUBLIC_APP_INSIGHT = InstrumentationKey=61f358c2-8075-4164-b897-17bc6dd31fee;IngestionEndpoint=https://ukwest-0.in.applicationinsights.azure.com/;LiveEndpoint=https://ukwest.livediagnostics.monitor.azure.com/;ApplicationId=0c297349-396b-4dc6-8b56-85f5c680adc6
HIDEERRORLOGS = false
HIDEERRORLOGS = false
SHOWSIPS = true
ALLOWED_IPS=::1,203.0.113.42,198.51.100.17
+1 -1
View File
@@ -11,7 +11,7 @@
"command": "npm run dev"
},
{"name": "Launch Chrome against localhost",
"type": "pwa-chrome",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
+99 -2
View File
@@ -309,7 +309,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
const tags = {
containerid: containerName,
caseID: formContent.caseRef,
caseID: formContent.ticketnumber,
blobType: "Representation",
};
@@ -317,7 +317,7 @@ export const createRepBlob = async (formContent, containerName, caseref) => {
const withTags = await blockBlobClient.setTags(tags);
const withMeta = await blockBlobClient.setMetadata(tags);
return formContent.pinswg_name;
return formContent.ticketnumber;
};
export const createAppealPDFBlob = async (
@@ -1702,3 +1702,100 @@ export const listBlobHierarchical = async (
}
}
};
function formatTimeSince(date) {
if (!date) return "Unknown date";
const now = new Date();
const diffMs = now - date;
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
if (diffDays < 7) {
return `${diffDays} day${diffDays !== 1 ? "s" : ""} ago`;
} else {
const diffWeeks = Math.floor(diffDays / 7);
return `${diffWeeks} week${diffWeeks !== 1 ? "s" : ""} ago`;
}
}
function formatDateDisplay(date) {
return date
? `${date.toLocaleString("en-GB")} (${formatTimeSince(date)})`
: "Unknown";
}
export async function listBlobHierarchicalForUser(containerClient) {
const blobNames = [];
for await (const blob of containerClient.listBlobsFlat()) {
const lastModifiedDate = blob.properties?.lastModified || null;
const createdOnDate = blob.properties?.createdOn || null;
let displayDate = "";
if (createdOnDate && lastModifiedDate) {
if (
createdOnDate.toDateString() === lastModifiedDate.toDateString()
) {
// Same day — show just one
displayDate = `Date: ${formatDateDisplay(lastModifiedDate)}`;
} else {
// Different days — show both
displayDate = `Created: ${formatDateDisplay(
createdOnDate
)}, Modified: ${formatDateDisplay(lastModifiedDate)}`;
}
} else if (lastModifiedDate) {
displayDate = `Modified: ${formatDateDisplay(lastModifiedDate)}`;
} else if (createdOnDate) {
displayDate = `Created: ${formatDateDisplay(createdOnDate)}`;
} else {
displayDate = "Unknown date";
}
blobNames.push({
name: blob.name,
size: blob.properties.contentLength || 0,
lastModified: lastModifiedDate
? lastModifiedDate.toISOString()
: null,
createdOn: createdOnDate ? createdOnDate.toISOString() : null,
displayDate,
});
}
return blobNames;
}
export async function listContainersForUser(
blobServiceClient,
containerNamePrefix,
emailAddress
) {
const options = {
includeDeleted: false,
includeMetadata: true,
includeSystem: true,
prefix: containerNamePrefix,
};
const results = [];
for await (const containerItem of blobServiceClient.listContainers(
options
)) {
const containerClient = blobServiceClient.getContainerClient(
containerItem.name
);
const blobNames = await listBlobHierarchicalForUser(
containerClient
).catch(console.error);
if (blobNames && blobNames.length > 0) {
results.push({
container: containerItem.name,
blobs: blobNames,
});
}
}
return results; // array of non-empty containers
}
+7 -9
View File
@@ -1492,7 +1492,7 @@ export const deleteMyRepresentationsFromBlob = (
});
};
export const deleteWatchedCases = (watchedCaseID) => {
export const deleteWatchedCases = async (watchedCaseID) => {
var queryUrl =
"/api/endpoint/deletewatchedcasesproxy_api?watchedCaseID=" +
watchedCaseID;
@@ -1501,14 +1501,12 @@ export const deleteWatchedCases = (watchedCaseID) => {
url: queryUrl,
};
return axios(config)
.then((res) => {
//console.log("deleted ", res.data);
return res.data;
})
.catch((error) => {
consoleLogger(error);
});
try {
const res = await axios(config);
return res.data;
} catch (error) {
consoleLogger(error);
}
};
export const createAccount = (formValues) => {
+30 -29
View File
@@ -497,20 +497,27 @@ const Breadcrumbs = (props) => {
</Link>
</li>
<li className="govuk-breadcrumbs__list-item">
{viewAllKey ==
{(currentView.currentView.viewKey ||
router.query.key) ==
"awaitingSubmissionDetails" &&
t(
"myportal:awatitingsubmission-card-title"
)}
{viewAllKey == "watchedCases" &&
{(currentView.currentView.viewKey ||
router.query.key) == "watchedCases" &&
t("myportal:watchedcases-card-title")}
{viewAllKey == "myCases" &&
{(currentView.currentView.viewKey ||
router.query.key) == "myCases" &&
t("myportal:mycases-card-title")}
{viewAllKey == "myRepresentations" &&
{(currentView.currentView.viewKey ||
router.query.key) ==
"myRepresentations" &&
t(
"myportal:myrepresentations-card-title"
)}
{viewAllKey == "mySubmittedReps" &&
{(currentView.currentView.viewKey ||
router.query.key) ==
"mySubmittedReps" &&
"Submitted representations"}
</li>
</>
@@ -545,19 +552,13 @@ const Breadcrumbs = (props) => {
<li className="govuk-breadcrumbs__list-item">
<Link
href={
router.locale != "en"
? router.locale +
"/searchresults?q=" +
props.props.search
.searchString
: "/searchresults?q=" +
props.props.search
.searchString
"/searchresults?q=" +
props.props.search.searchString
}
onClick={() => {
// spinnerState();
router.back();
}}
// onClick={() => {
// // spinnerState();
// router.back();
// }}
className="govuk-breadcrumbs__link"
>
{t("common:breadcrumb-search-results")}
@@ -724,10 +725,10 @@ const Breadcrumbs = (props) => {
</li>
<li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-case-reference")}:{" "}
{
props.props.currentView.caseReference
.currentReference
}
{props.props.currentView.caseReference
.currentReference ||
props.props.searchResultsObj
.searchResultsObj.value[0].title}
</li>
</>
)}
@@ -811,10 +812,10 @@ const Breadcrumbs = (props) => {
</li>
<li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-case-reference")}:{" "}
{
props.props.currentView.caseReference
.currentReference
}
{props.props.currentView.caseReference
.currentReference ||
props.props.searchResultsObj
.searchResultsObj.value[0].title}
</li>
</>
)}
@@ -1075,10 +1076,10 @@ const Breadcrumbs = (props) => {
</li>
<li className="govuk-breadcrumbs__list-item">
{t("common:breadcrumb-case-reference")}:{" "}
{
props.props.currentView.caseReference
.currentReference
}
{props.props.currentView.caseReference
.currentReference ||
props.props.searchResultsObj
.searchResultsObj.value[0].title}
</li>
</>
)}
+1
View File
@@ -27,6 +27,7 @@ const Case = (props) => {
watchedCasesDetails={props.watchedCasesDetails}
awaitingSubmission={props.awaitingSubmission}
caseReference={props.caseReference}
ticketnumber={props.ticketnumber}
currentType={props.currentType}
appealTypeID={props.appealTypeID}
searchResultsObj={props.searchResultsObj}
+7 -6
View File
@@ -19,7 +19,7 @@ import { setCurrentPage } from "../../store/currentView/action";
import { setDocumentDetails } from "../../store/searchOutput/action";
const DocumentDetails = (props) => {
let { t } = useTranslation();
let { t, lang } = useTranslation();
const firstRender = useRef(false);
const {
incidentid,
@@ -419,7 +419,7 @@ const DocumentDetails = (props) => {
] +
'")].value_cy',
json: transLookup,
sanbox: {},
eval: true,
})
: detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -507,7 +507,7 @@ const DocumentDetails = (props) => {
</p>
<div>
<button onClick={clearCheckboxes}>
{t("case:documents-clear-filter-label")}
{t("search:clear-filter-button-label")}
</button>
</div>
<div className="govuk-checkboxes govuk-checkboxes--small">
@@ -584,8 +584,8 @@ const DocumentDetails = (props) => {
'$..[?(@ && @.value=="' +
item.pinswg_isharedocumentlocationsLabel +
'")].value_cy',
jsonL: transLookup,
sanbox: {},
json: transLookup,
eval: true,
})
: item.pinswg_isharedocumentlocationsLabel ||
t(
@@ -611,7 +611,7 @@ const DocumentDetails = (props) => {
setCurrentPage(1);
}}
>
{t("case:documents-filter-button")}
{t("search:filter-documents-label")}
</button>
</div>
{documentDetailsObj["@odata.count"] > 5 && (
@@ -1068,6 +1068,7 @@ const DocumentDetails = (props) => {
orderByState,
getDocumentTypes,
getDocumentResults,
lang,
]);
return (
<div className="govuk-grid-row">
+27
View File
@@ -65,6 +65,7 @@ let MakeRepresentation = (props) => {
showQuestionnaireSection,
initialValues,
setCurrentReference,
ticketnumber,
} = props;
const formObj = props.props.form;
let setCaseQueryObj = props[currentType] || {};
@@ -427,6 +428,12 @@ let MakeRepresentation = (props) => {
currentType={currentType}
casesObj={casesObj}
caseReference={caseReference}
ticketnumber={ticketnumber}
setRepFileName={setRepFileName}
updateRepresentation={updateRepresentation}
setSavingStatus={setSavingStatus}
savingStatus={savingStatus}
setCurrentReference={setCurrentReference}
/>
);
}
@@ -590,6 +597,26 @@ let MakeRepresentation = (props) => {
return deduplicate(mergedFiles);
};
const buildAddressStr = (detailsObj) => {
const toTitleCase = (str) =>
str.toLowerCase().replace(/\b\w/g, (char) => char.toUpperCase());
return [
detailsObj?.pinswg_siteaddressline1 ||
detailsObj?.pinswg_addressline1,
detailsObj?.pinswg_siteaddressline2 ||
detailsObj?.pinswg_addressline2,
detailsObj?.pinswg_siteaddresstown ||
detailsObj?.pinswg_addresstown,
detailsObj?.pinswg_siteaddresspostcode ||
detailsObj?.pinswg_postcode,
detailsObj?.pinswg_siteaddresscounty ||
detailsObj?.pinswg_addresscounty,
]
.filter((v) => !!v && v.trim()) // remove empty/whitespace-only values
.map((v) => toTitleCase(v.trim())) // title-case each segment
.join(" ");
};
const updateRepresentation = async (
values,
sendSavedEmail,
@@ -197,7 +197,8 @@ const RepAgent = (props) => {
"myrepresentations:add-files-label"
)}
ticketnumber={
props.props.caseReference
props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"}
fileList={
@@ -189,7 +189,10 @@ const RepAppellant = (props) => {
label={t(
"myrepresentations:add-files-label"
)}
ticketnumber={props.props.caseReference}
ticketnumber={
props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"}
fileList={
props.currentView.fileList
@@ -36,6 +36,9 @@ let RepCapacitySelection = (props) => {
currentType={currentType}
casesObj={casesObj}
caseReference={props.props.caseReference}
ticketnumber={
props.props.currentView.caseReference.ticketnumber
}
searchResultsObj={props.props.searchResultsObj}
myRepresentations={props.props.myRepresentations}
props={props}
@@ -65,7 +65,7 @@ const RepComplete = (props) => {
),
sendRepCompleteMessage(
props.props.props.props.accountDetails.containerID,
props.props.currentView.caseReference.currentReference,
props.props.currentView.caseReference.ticketnumber,
props.repFormData.repfile_name
),
sendEmail(templateId, emailAddress, personalisation, reference),
@@ -10,7 +10,7 @@ const RepDetails = (props) => {
const { currentType, casesObj, appealType } = props;
let { caseReference } = props;
let { caseReference, ticketnumber } = props;
let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit"
@@ -29,7 +29,7 @@ const RepDetails = (props) => {
: caseReference;
detailsObj = jsonpath({
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseDetailsObj,
eval: true,
});
@@ -189,7 +189,8 @@ const RepInterestedPartyPerson = (props) => {
"myrepresentations:add-files-label"
)}
ticketnumber={
props.props.caseReference
props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"}
fileList={
@@ -354,7 +354,7 @@ let RepLPA = (props) => {
"myrepresentations:add-files-label"
)}
ticketnumber={
props.props.caseReference
props.currentView.caseReference.ticketnumber
}
hint={"sdsd"}
fileList={
@@ -34,6 +34,7 @@ let RepLPACapacitySelection = (props) => {
casesObj={casesObj}
detailsObj={detailsObj}
caseReference={props.props.caseReference}
ticketnumber={props.props.ticketnumber}
searchResultsObj={props.props.searchResultsObj}
props={props.props}
/>{" "}
@@ -8,7 +8,7 @@ const RepLPADetails = (props) => {
const router = useRouter();
const { locale } = router;
const { currentType, casesObj, caseReference } = props;
const { currentType, casesObj, caseReference, ticketnumber } = props;
let setCaseDetailsObj = router.query.hasOwnProperty("state")
? router.query.state == "edit"
@@ -21,7 +21,7 @@ const RepLPADetails = (props) => {
var detailsObj = {};
detailsObj = jsonpath({
path: '$..[?(@ && @.pinswg_name=="' + caseReference + '")]',
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseDetailsObj,
eval: true,
});
@@ -84,7 +84,10 @@ const RepLandOwner = (props) => {
label={t(
"myrepresentations:add-files-label"
)}
ticketnumber={props.props.caseReference}
ticketnumber={
props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"}
fileList={[]}
setFilesForRepresentation={[]}
@@ -1213,7 +1213,10 @@ let Enforcement_Questionnaire = (props) => {
name={"representationDocuments"}
id={"representationDocuments"}
label={t("myrepresentations:add-files-label")}
ticketnumber={props.props.props.caseReference}
ticketnumber={
props.props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"}
fileList={
props.currentView.fileList
@@ -1022,7 +1022,10 @@ let S78_Questionnaire = (props) => {
name={"representationDocuments"}
id={"representationDocuments"}
label={t("myrepresentations:add-files-label")}
ticketnumber={props.props.props.caseReference}
ticketnumber={
props.props.currentView.caseReference
.ticketnumber
}
hint={"sdsd"}
fileList={
props.currentView.fileList
+14 -6
View File
@@ -76,6 +76,7 @@ const CaseSummary = (props) => {
currentView,
messagesObj,
docsOffline,
ticketnumber,
} = props;
let appealTypeID = props.appealTypeID || router.query.appealType;
@@ -233,13 +234,13 @@ const CaseSummary = (props) => {
currentType == "searchResultsObj"
? (casesObj = jsonpath({
path: '$..[?(@ && @.title=="' + caseReference + '")]',
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: searchResultsObj,
eval: true,
}))
: currentType == "watchedCases"
? (casesObj = jsonpath({
path: '$..[?(@ && @.pinswg_title=="' + caseReference + '")]',
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseQueryObj,
eval: true,
}))
@@ -251,7 +252,7 @@ const CaseSummary = (props) => {
}))
: currentType == "directResultsObj"
? (casesObj = jsonpath({
path: '$..[?(@ && @.ticketnumber=="' + caseReference + '")]',
path: '$..[?(@ && @.ticketnumber=="' + ticketnumber + '")]',
json: setCaseQueryObj,
eval: true,
}))
@@ -1867,7 +1868,10 @@ const CaseSummary = (props) => {
id="case-documents"
>
<Documents
incidentid={props.incidentid}
incidentid={
props.incidentid ||
setCaseQueryObj.value[0].incidentid
}
caseReference={props.caseReference}
searchResultsObj={props.searchResultsObj}
searchDetailsObj={props.searchDetailsObj}
@@ -1937,7 +1941,9 @@ const CaseSummary = (props) => {
currentView,
showMap
) {
const id = getFormCollectionByID(appealTypeID).PrimaryIdAttribute;
const id = getFormCollectionByID(
appealTypeID || setCaseQueryObj.value[0].pinswg_appealcasetype
).PrimaryIdAttribute;
const Component = CaseTypes[capitalizeFirstLetter(id)];
@@ -1955,7 +1961,9 @@ const CaseSummary = (props) => {
useEffect(() => {
const linkCaseObj = async () => {
let docObj = await getLinkedCases(incidentid).then((data) => {
let docObj = await getLinkedCases(
incidentid || setCaseQueryObj.value[0].incidentid
).then((data) => {
//console.log(data);
setCurrentLinkedCases(data);
return data;
@@ -129,7 +129,6 @@ const Pinswg_dnsid = (props) => {
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy',
json: transLookup,
eval: true,
})
+9 -2
View File
@@ -4,8 +4,14 @@ import CRMError from "./crmError";
import DNSSearchResults from "./search/dnssearchresults";
export default function Search(props) {
const { searchString, searchResultsObj, myportal, watchedCases, showMap } =
props;
const {
searchString,
searchResultsObj,
myportal,
watchedCases,
showMap,
showLoginCheck,
} = props;
let { t } = useTranslation();
const router = useRouter();
@@ -41,6 +47,7 @@ export default function Search(props) {
myportal={myportal}
watchedCases={watchedCases}
showMap={showMap}
showLoginCheck={showLoginCheck}
/>
</div>
</div>
+2 -20
View File
@@ -8,17 +8,7 @@ export default function CaseComment() {
const { locale } = router;
return (
<div id="casescomment-card">
<div className="card-body card-body govuk-!-padding-top-0">
<h3 className="heading-small card-heading">
{t("home:casescomment-card-title")}
</h3>
<p className="gouk-body-s">
{t("home:casescomment-card-paragraph-three")}
</p>
<p className="gouk-body-s">
{t("home:casescomment-card-paragraph-four")}
</p>
<div className="card-body card-body govuk-!-padding-top-4">
<p className="govuk-body-s">
{t("home:casescomment-card-paragraph-one")}{" "}
<a
@@ -28,15 +18,7 @@ export default function CaseComment() {
{t("home:login-contact-email")}
</a>
</p>
<p className="govuk-body-s">
{t("home:casescomment-card-paragraph-two")}
</p>
<h3 className="heading-small card-heading">
{t("home:watch-case-card-title")}
</h3>
<p className="govuk-body-s">
{t("home:watch-case-paragraph-one")}
</p>
{/* <p className="govuk-body-s">
{t("home:casescomment-card-paragraph-two")}
</p> */}
+27 -44
View File
@@ -78,49 +78,24 @@ let Login = (props) => {
<p className="govuk-body-s">
{t("home:signin-benefits-paragraph")}
</p>
<h3 className="heading-small card-heading">
{/* {t("home:login-card-title")} */}
{t("home:login-card-title-temp")}
</h3>{" "}
{/* <div className="govuk-form-group govuk-!-margin-top-4">
<div className="govuk-body">
{session && "Signed in as " + session.user?.email}
</div>
<br />
{!session && (
<button
className="govuk-button withChevron govuk-button-cta"
type="button"
onClick={
() => signInButton()
// signIn("email", {
// callbackUrl:
// (router.locale != "en"
// ? "/cy"
// : "") + "/",
// })
}
>
{t("home:login-via-nextuth-label")}
</button>
)}
{session && (
<button
className="govuk-button"
type="button"
onClick={() => signOut()}
>
Magic Link Sign Out
</button>
)}
</div> */}
<p className="govuk-body-s">
{t("home:login-comingsoon-temp-1")}{" "}
</p>
{/* <p className="govuk-body-s">
{t("home:login-comingsoon-temp-1a")}{" "}
</p> */}
<ul className="cardList-nobullet">
<li className="govuk-body-s">
{" "}
<strong>
{" "}
{t("home:login-card-title-temp")}{" "}
</strong>{" "}
{t("home:login-comingsoon-temp-1")}
</li>
<li>
<strong>{t("home:casescomment-card-title")}</strong>{" "}
{t("home:casescomment-card-paragraph-two")}
</li>
<li>
<strong> {t("home:watch-case-card-title")}</strong>{" "}
{t("home:watch-case-paragraph-one")}
</li>
</ul>
<div className="govuk-form-group govuk-!-margin-top-4">
<p className="govuk-body-s">
{t("home:login-comingsoon-temp-2")}
@@ -178,9 +153,17 @@ let Login = (props) => {
</a>
</li>
</ul>
<p className="govuk-body-s">
{t("home:casescomment-card-paragraph-one")}{" "}
<a
href={"mailto:" + t("home:login-contact-email")}
className="govuk-link--no-underline"
>
{t("home:login-contact-email")}
</a>
</p>
</div>
</div>
<CaseComment />
</div>
</>
);
+1
View File
@@ -168,6 +168,7 @@ const MyPortal = (props) => {
watchedCases={props.watchedCases}
isLPA={isLPA}
myReps={false}
accountDetails={props.accountDetails}
/>
)}
{props.myRepresentations.hasOwnProperty(
+2 -3
View File
@@ -37,9 +37,8 @@ const AwaitingSubmission = (props) => {
(router.locale != "en"
? "/" +
router.locale +
"/fymhorth/gweldpopeth"
: "/myportal/viewall") +
"?viewKey=awaitingSubmission"
"/fymhorth/gweldpopeth?key=awaitingSubmission"
: "/myportal/viewall?key=awaitingSubmission"
}
className="govuk-link--no-underline"
onClick={() => {
@@ -351,12 +351,11 @@ const AwaitingSubmissionFromBlob = (props) => {
<div className="cardVieAll">
<Link
href={
(router.locale != "en"
router.locale != "en"
? "/" +
router.locale +
"/fymhorth/gweldpopeth"
: "/myportal/viewall") +
"?viewKey=awaitingSubmissionDetails"
"/fymhorth/gweldpopeth?key=awaitingSubmissionDetails"
: "/myportal/viewall?key=awaitingSubmissionDetails"
}
className="govuk-link--no-underline"
onClick={() => {
+3 -3
View File
@@ -29,11 +29,11 @@ const MyCases = (props) => {
<div className="cardVieAll">
<Link
href={
(router.locale != "en"
router.locale != "en"
? "/" +
router.locale +
"/fymhorth/gweldpopeth"
: "/myportal/viewall") + "?viewKey=myCases"
"/fymhorth/gweldpopeth?key=myCases"
: "/myportal/viewall?key=myCases"
}
className="govuk-link--no-underline"
onClick={() => {
+3 -4
View File
@@ -34,12 +34,11 @@ const MyRepresentations = (props) => {
<div className="cardVieAll">
<Link
href={
(router.locale != "en"
router.locale != "en"
? "/" +
router.locale +
"/fymhorth/gweldpopeth"
: "/myportal/viewall") +
"?viewKey=myRepresentations"
"/fymhorth/gweldpopeth?key=myRepresentations"
: "/myportal/viewall?key=myRepresentations"
}
className="govuk-link--no-underline"
onClick={() => {
@@ -36,9 +36,8 @@ const MyRepresentations = (props) => {
(router.locale != "en"
? "/" +
router.locale +
"/fymhorth/gweldpopeth"
: "/myportal/viewall") +
"?viewKey=myRepresentations"
"/fymhorth/gweldpopeth?key=myRepresentations"
: "/myportal/viewall?key=myRepresentations"
}
className="govuk-link--no-underline"
onClick={() => {
@@ -40,12 +40,11 @@ const MySubmittedReps = (props) => {
<div className="cardVieAll">
<Link
href={
(router.locale != "en"
router.locale != "en"
? "/" +
router.locale +
"/fymhorth/gweldpopeth"
: "/myportal/viewall") +
"?viewKey=mySubmittedReps"
"/fymhorth/gweldpopeth?key=mySubmittedReps"
: "/myportal/viewall?key=mySubmittedReps"
}
className="govuk-link--no-underline"
onClick={() => {
+10
View File
@@ -43,6 +43,11 @@ const ServiceBanner = (props) => {
{portalLogoLink.includes(router.pathname) ? (
<Link href={"/myportal"}>
<img
className={
router.locale == "cy"
? "serviceTitle cy"
: "serviceTitle"
}
src={
router.locale == "cy"
? "/assets/images/planning-casework-cy.svg"
@@ -57,6 +62,11 @@ const ServiceBanner = (props) => {
</Link>
) : (
<img
className={
router.locale == "cy"
? "serviceTitle cy"
: "serviceTitle"
}
src={
router.locale == "cy"
? "/assets/images/planning-casework-cy.svg"
+19 -19
View File
@@ -119,7 +119,9 @@ const TopThree = (props) => {
deleteWatchedCases(caseID)
.then((data) => data)
.then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
getWatchedCasesProxy(
props.accountDetails.loggedinUserId
).then((data) => {
let showWatchedCases = (submittedArr) => {
const required = submittedArr.value.filter((el) => {
return (
@@ -134,19 +136,15 @@ const TopThree = (props) => {
});
};
data = showWatchedCases(data);
let filteredWatchedCases = showWatchedCases(data);
data.value.sort(function compare(a, b) {
var dateA = new Date(a.createdon);
var dateB = new Date(b.createdon);
return dateB - dateA;
});
setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then(
(data) => {
setWatchedCasesDetails(data);
}
);
setWatchedCases(filteredWatchedCases),
getDetailsProxy(
filteredWatchedCases,
"myWatchedCases"
).then((data) => {
setWatchedCasesDetails(data);
});
});
});
@@ -328,9 +326,8 @@ const TopThree = (props) => {
: showTopThreeArr[key][
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
]
: showTopThreeArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
],
: showTopThreeArr[key]
.ticketnumber,
"currentType": topThreeType,
"incidentid": getIncidentId(
@@ -344,15 +341,18 @@ const TopThree = (props) => {
});
}}
>
{topThreeType != "watchedCases"
{showTopThreeArr[key].pinswg_title}
{/* {topThreeType != "watchedCases"
? topThreeType != "myRepresentations"
? showTopThreeArr[key].ticketnumber
? topThreeType == "mySubmittedReps"
? showTopThreeArr[key].pinswg_title
: showTopThreeArr[key].ticketnumber
: showTopThreeArr[key][
"_pinswg_case_value@OData.Community.Display.V1.FormattedValue"
]
: showTopThreeArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]}{" "}
]}{" "} */}
</Link>
)}
{topThreeType == "watchedCases" && !props.myReps && (
+36 -17
View File
@@ -193,21 +193,26 @@ const TopThree = (props) => {
{showTopThreeArr[key].hasOwnProperty("repComplete") ? (
<b>{showTopThreeArr[key].pinswg_name}</b>
) : (
<Link
<span
// href="#"
href={{
pathname:
router.locale == "cy"
? "/fymhorth/representation"
: "/myportal/representation",
query: {
case: showTopThreeArr[key].caseRef,
state: "edit",
created:
showTopThreeArr[key].repfile_name,
},
}}
// href={{
// pathname:
// router.locale == "cy"
// ? "/fymhorth/representation"
// : "/myportal/representation",
// query: {
// case: showTopThreeArr[key].ticketnumber,
// state: "edit",
// created:
// showTopThreeArr[key].repfile_name,
// },
// }}
className="govuk-link--no-underline"
style={{
color: "#0360a6",
cursor: "pointer",
fontWeight: "bold",
}}
data-id={index}
onClick={() => {
setCurrentReference({
@@ -223,10 +228,24 @@ const TopThree = (props) => {
"repDetails": showTopThreeArr[key],
});
isLPA && setRepresentationCapacity("LPA");
router.push({
pathname:
router.locale == "cy"
? "/fymhorth/representation"
: "/myportal/representation",
query: {
case: showTopThreeArr[key]
.ticketnumber,
state: "edit",
created:
showTopThreeArr[key]
.repfile_name,
},
});
}}
>
{showTopThreeArr[key].pinswg_name}
</Link>
</span>
)}
{!showTopThreeArr[key].hasOwnProperty(
"repComplete"
@@ -234,13 +253,13 @@ const TopThree = (props) => {
<div className="deleteCase">
<button
title={t(
"case:do-you-want-to-delete-case-label"
"case:do-you-want-to-delete-rep-label"
)}
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
onClick={() => {
confirm(
t(
"case:do-you-want-to-delete-case-label"
"case:do-you-want-to-delete-rep-label"
) +
showTopThreeArr[key]
.pinswg_name +
@@ -253,7 +272,7 @@ const TopThree = (props) => {
props.accountDetails
.containerID,
showTopThreeArr[key]
.pinswg_name,
.ticketnumber,
showTopThreeArr[key]
.repfile_name
);
+111 -129
View File
@@ -78,21 +78,23 @@ const ViewAllResults = (props) => {
return dateObj.toLocaleString();
};
let currentView = props.currentView.currentView;
//console.log("viewAllKey:", typeof viewAllKey);
let viewKeyFromUrl = router.query.key;
// typeof viewAllKey == "undefined"
let currentView = props.currentView.currentView;
//console.log("currentViewKey:", typeof currentViewKey);
// typeof currentViewKey == "undefined"
// ? console.log("no currentview")
// : console.log("has currentview");
var viewAllKey = currentView?.viewKey || router.query.viewKey;
let currentViewKey = currentView.viewKey || viewKeyFromUrl;
var resultsArr =
viewAllKey == "awaitingSubmissionDetails"
currentViewKey == "awaitingSubmissionDetails"
? props["awaitingSubmission"].awaitingSubmissionDetails.case
: viewAllKey == "mySubmittedReps"
? props[viewAllKey][viewAllKey]
: props[viewAllKey][viewAllKey].value || [];
: currentViewKey == "mySubmittedReps"
? props[currentViewKey][currentViewKey]
: props[currentViewKey][currentViewKey].value || [];
const [orderByState, setOrderbyState] = useState("createdon");
const [fieldSortState, setfieldSortState] = useState("asc");
@@ -109,11 +111,11 @@ const ViewAllResults = (props) => {
}
var searchDetailsObj =
viewAllKey == "awaitingSubmissionDetails"
currentViewKey == "awaitingSubmissionDetails"
? props["awaitingSubmission"].awaitingSubmissionDetails.value
: viewAllKey == "myRepresentations"
: currentViewKey == "myRepresentations"
? props["myRepresentations"].myRepresentations.value
: props[viewAllKey][viewAllKey + "Details"] || [];
: props[currentViewKey][currentViewKey + "Details"] || [];
let resultsRowArr = [];
@@ -145,13 +147,13 @@ const ViewAllResults = (props) => {
let detailsObj = jsonpath({
path:
"$" +
(viewAllKey == "myRepresentations" ? "" : "..value") +
(currentViewKey == "myRepresentations" ? "" : "..value") +
'[?(@ && @.pinswg_name=="' +
(viewAllKey == "awaitingSubmissionDetails"
(currentViewKey == "awaitingSubmissionDetails"
? item.title
: viewAllKey == "watchedCases"
: currentViewKey == "watchedCases"
? item.ticketnumber
: viewAllKey == "myRepresentations"
: currentViewKey == "myRepresentations"
? item.pinswg_name
: item.pinswg_title) +
'")]',
@@ -163,7 +165,7 @@ const ViewAllResults = (props) => {
//console.log(searchDetailsObj[key]);
// searchDetailsObj[key] =
// viewAllKey == "myRepresentations"
// currentViewKey == "myRepresentations"
// ? searchDetailsObj[key].value[0]
// : searchDetailsObj[key];
@@ -171,7 +173,7 @@ const ViewAllResults = (props) => {
resultsRowArr.push(
<div className="govuk-summary-list__row" key={key}>
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
{viewAllKey == "myCases" &&
{currentViewKey == "myCases" &&
resultsArr[key].pinswg_publishtoweb === false ? (
<>
<div className="cardModuleReference">
@@ -210,7 +212,7 @@ const ViewAllResults = (props) => {
<>
<Link
href={
viewAllKey == "myRepresentations"
currentViewKey == "myRepresentations"
? {
pathname:
"/myportal/representation",
@@ -223,7 +225,7 @@ const ViewAllResults = (props) => {
.repfile_name,
},
}
: viewAllKey ==
: currentViewKey ==
"awaitingSubmissionDetails"
? router.locale == "cy"
? "/fymhorth/parhauigyflwyno"
@@ -245,25 +247,25 @@ const ViewAllResults = (props) => {
"&inid=" +
resultsArr[key].incidentid +
"&key=" +
viewAllKey
currentViewKey
: router.locale == "cy"
? myportal == true
? "/fymhorth/achos" +
resultsArr[key].ticketnumber +
"?key=" +
currentView.viewKey
currentViewKey
: "/achos" +
resultsArr[key].ticketnumber
: myportal == true
? "/myportal/case/" +
resultsArr[key].ticketnumber +
"?key=" +
viewAllKey
currentViewKey
: "/case/" +
resultsArr[key].ticketnumber
}
onClick={() => {
viewAllKey == "watchedCases" &&
currentViewKey == "watchedCases" &&
setSearchResults(
props.watchedCases.watchedCases
),
@@ -276,8 +278,9 @@ const ViewAllResults = (props) => {
resultsArr[key]
.ticketnumber,
"currentReference":
viewAllKey != "watchedCases"
? viewAllKey ==
currentViewKey !=
"watchedCases"
? currentViewKey ==
"myRepresentations"
? resultsArr[key]
.caseRef
@@ -287,9 +290,10 @@ const ViewAllResults = (props) => {
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
],
"currentType": viewAllKey,
"currentType": currentViewKey,
"incidentid":
viewAllKey != "watchedCases"
currentViewKey !=
"watchedCases"
? resultsArr[key]
.incidentid
: resultsArr[key][
@@ -300,14 +304,14 @@ const ViewAllResults = (props) => {
resultsArr[key]
.pinswg_appealcasetype,
"repDetails":
viewAllKey ==
currentViewKey ==
"myRepresentations" &&
resultsArr[key],
}),
setCurrentView({
"viewName":
currentView.viewName,
"viewKey": viewAllKey,
"viewKey": currentViewKey,
});
}}
>
@@ -317,35 +321,25 @@ const ViewAllResults = (props) => {
)}
:
</span>
{viewAllKey != "watchedCases"
? viewAllKey == "myRepresentations"
{currentViewKey != "watchedCases"
? currentViewKey == "myRepresentations"
? resultsArr[key].caseRef
: resultsArr[key].ticketnumber
: currentViewKey ==
"awaitingSubmissionDetails"
? resultsArr[key].title
: resultsArr[key].pinswg_title
: resultsArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]}
</Link>
<RepsOnResults
detailsObj={detailsObj}
appealType={item.pinswg_appealcasetype}
/>
{viewAllKey == "myRepresentations" && (
{currentViewKey == "myRepresentations" && (
<>
<span className="govuk-body govuk-!-font-size-14">
<br />
<span>
{resultsArr[key].representationType}
</span>
</>
)}
{viewAllKey == "mySubmittedReps" && (
<>
<span className="govuk-body govuk-!-font-size-14">
{item.pinswg_representationtype}{" "}
{formatDates(
item.pinswg_representationsubmitted
)}
</span>
</>
)}
</>
)}
</dd>
@@ -354,14 +348,14 @@ const ViewAllResults = (props) => {
{t("search:searchresults-site-address-label")}:
</span>
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
? searchDetailsObj[key].pinswg_siteaddressline1
: ""}
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline1
: ""}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
_.has(searchDetailsObj[key].pinswg_siteaddressline1)
? searchDetailsObj[key].value[0]
.pinswg_siteaddressline1
@@ -369,14 +363,14 @@ const ViewAllResults = (props) => {
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline1
: ""}
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(
searchDetailsObj[key],
"pinswg_siteaddressline1"
) &&
searchDetailsObj[key].pinswg_siteaddressline1 !=
null && <br />}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].pinswg_siteaddressline1
) &&
@@ -386,25 +380,25 @@ const ViewAllResults = (props) => {
detailsObj.pinswg_siteaddressline1 != null && (
<br />
)}
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddressline1")
? searchDetailsObj[key].pinswg_siteaddressline2
: ""}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
_.has(searchDetailsObj[key].pinswg_siteaddressline1)
? searchDetailsObj[key].pinswg_siteaddressline2
: ""}
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline2
: ""}
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(
searchDetailsObj[key],
"pinswg_siteaddressline2"
) &&
searchDetailsObj[key].pinswg_siteaddressline2 !=
null && <br />}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key].pinswg_siteaddressline2
) &&
@@ -414,25 +408,25 @@ const ViewAllResults = (props) => {
detailsObj.pinswg_siteaddressline2 != null && (
<br />
)}
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresstown")
? searchDetailsObj[key].pinswg_siteaddresstown
: ""}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresstown")
? searchDetailsObj[key].pinswg_siteaddresstown
: ""}
{_.has(detailsObj, "pinswg_siteaddresstown")
? detailsObj.pinswg_siteaddresstown
: ""}
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(
searchDetailsObj[key],
"pinswg_siteaddresstown"
) &&
searchDetailsObj[key].pinswg_siteaddresstown !=
null && <br />}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
_.has(
searchDetailsObj[key],
"pinswg_siteaddresstown"
@@ -441,18 +435,18 @@ const ViewAllResults = (props) => {
null && <br />}
{_.has(detailsObj, "pinswg_siteaddresstown") &&
detailsObj.pinswg_siteaddresstown != null && <br />}
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresscounty")
? searchDetailsObj[key].pinswg_siteaddresscounty
: ""}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
_.has(searchDetailsObj[key], "pinswg_siteaddresscounty")
? searchDetailsObj[key].pinswg_siteaddresscounty
: ""}
{_.has(detailsObj, "pinswg_siteaddresscounty")
? detailsObj.pinswg_siteaddresscounty
: ""}
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(
searchDetailsObj[key],
"pinswg_siteaddresscounty"
@@ -463,7 +457,7 @@ const ViewAllResults = (props) => {
detailsObj.pinswg_siteaddresscounty != null && (
<br />
)}
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(
searchDetailsObj[key],
"pinswg_siteaddresspostcode"
@@ -494,9 +488,9 @@ const ViewAllResults = (props) => {
"pinswg_projectlocation",
].map((field, idx) => {
const isAwaitingSubmission =
viewAllKey === "awaitingSubmissionDetails";
currentViewKey === "awaitingSubmissionDetails";
const isMyRepresentations =
viewAllKey === "myRepresentations";
currentViewKey === "myRepresentations";
const searchValue = _.get(
searchDetailsObj,
`${key}.${field} `
@@ -524,11 +518,11 @@ const ViewAllResults = (props) => {
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
{viewAllKey == "awaitingSubmissionDetails"
{currentViewKey == "awaitingSubmissionDetails"
? t("search:searchresults-created-on-label")
: t("search:searchresults-applicant-label")}
</span>
{viewAllKey == "awaitingSubmissionDetails"
{currentViewKey == "awaitingSubmissionDetails"
? formatDates(item.createdon)
: _.has(detailsObj, [
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
@@ -536,7 +530,7 @@ const ViewAllResults = (props) => {
? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]
: viewAllKey == "myRepresentations"
: currentViewKey == "myRepresentations"
? searchDetailsObj[key][
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]
@@ -548,7 +542,7 @@ const ViewAllResults = (props) => {
<span className="results-visually-hidden">
{t("search:searchresults-authority-label")}:
</span>
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
_.has(resultsArr[key], "pinswg_lpaname")
? router.locale == "cy"
? jsonpath({
@@ -593,7 +587,7 @@ const ViewAllResults = (props) => {
json: transLookup,
eval: true,
})
: viewAllKey == "myRepresentations"
: currentViewKey == "myRepresentations"
? searchDetailsObj[key].value
: searchDetailsObj[key].value[0][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
@@ -616,10 +610,10 @@ const ViewAllResults = (props) => {
: resultsArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
] ||
(viewAllKey == "myRepresentations"
(currentViewKey == "myRepresentations"
? ""
: "N/A")
: viewAllKey == "myRepresentations" &&
: currentViewKey == "myRepresentations" &&
router.locale == "cy" &&
jsonpath({
path:
@@ -637,7 +631,7 @@ const ViewAllResults = (props) => {
{t("search:searchresults-case-type-label")}:
</span>
{viewAllKey == "awaitingSubmissionDetails"
{currentViewKey == "awaitingSubmissionDetails"
? router.locale == "cy"
? jsonpath({
path:
@@ -666,9 +660,11 @@ const ViewAllResults = (props) => {
: item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] ||
(viewAllKey == "myRepresentations" ? "" : "N/A")}
(currentViewKey == "myRepresentations"
? ""
: "N/A")}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
(router.locale == "cy"
? jsonpath({
path:
@@ -690,13 +686,13 @@ const ViewAllResults = (props) => {
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
{viewAllKey == "myRepresentations"
{currentViewKey == "myRepresentations"
? "Created"
: t("search:searchresults-status-label")}
:
</span>
{viewAllKey == "awaitingSubmissionDetails"
{currentViewKey == "awaitingSubmissionDetails"
? router.locale == "cy"
? jsonpath({
path:
@@ -714,7 +710,7 @@ const ViewAllResults = (props) => {
json: transLookup,
eval: true,
}) || "N/A"
: viewAllKey == "myRepresentations"
: currentViewKey == "myRepresentations"
? repRaisedDate(item.repfile_name) // ? router.locale == "cy"
: // ? jsonpath({path:
//
@@ -752,13 +748,13 @@ const ViewAllResults = (props) => {
"statuscode@OData.Community.Display.V1.FormattedValue"
] || "N/A"}
</dd>
{viewAllKey == "awaitingSubmissionDetails" && (
{currentViewKey == "awaitingSubmissionDetails" && (
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
<button
title={t(
"case:do-you-want-to-delete-case-label"
)}
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
className=" cardModuleRemoveCase govuk-summary-list__actionLink"
onClick={() => {
confirm(
t(
@@ -780,13 +776,13 @@ const ViewAllResults = (props) => {
</button>
</dd>
)}
{viewAllKey == "myRepresentations" && (
{currentViewKey == "myRepresentations" && (
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
<button
title={t(
"case:do-you-want-to-delete-case-label"
"case:do-you-want-to-delete-rep-label"
)}
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
className=" cardModuleRemoveCase govuk-summary-list__actionLink "
onClick={() => {
confirm(
t(
@@ -810,14 +806,13 @@ const ViewAllResults = (props) => {
</dd>
)}
{viewAllKey == "watchedCases" && (
<dd
className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem govuk-!-font-size-14 govuk-summary-list__action"
style={{ display: "flex", flexDirection: "column" }}
>
{currentViewKey == "watchedCases" && (
<dd className="govuk-summary-list__value govuk-!-font-size-16 cardModuleItem ">
<button
title={t("case:stop-watching-case-link")}
className=" govuk-summary-list__actionLink watched_link"
title={t(
"case:do-you-want-to-delete-case-label"
)}
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
onClick={() => {
confirm(
t(
@@ -996,27 +991,6 @@ const ViewAllResults = (props) => {
.then((data) => data)
.then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
let showWatchedCases = (submittedArr) => {
const required = submittedArr.value.filter((el) => {
return (
el.pinswg_representationsubmitted == null
);
});
let newObj = {};
return Object.assign(newObj, {
"@odata.count": required.length,
"value": required,
});
};
data = showWatchedCases(data);
data.value.sort(function compare(a, b) {
var dateA = new Date(a.createdon);
var dateB = new Date(b.createdon);
return dateB - dateA;
});
setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases")
.then((data) => {
@@ -1109,15 +1083,15 @@ const ViewAllResults = (props) => {
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<h1 className="govuk-heading-xl govuk-!-margin-bottom-7">
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
t("myportal:awatitingsubmission-card-title")}
{viewAllKey == "watchedCases" &&
{currentViewKey == "watchedCases" &&
t("myportal:watchedcases-card-title")}
{viewAllKey == "myCases" &&
{currentViewKey == "myCases" &&
t("myportal:mycases-card-title")}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
t("myportal:myrepresentations-card-title")}
{viewAllKey == "mySubmittedReps" &&
{currentViewKey == "mySubmittedReps" &&
"Submitted representations"}
</h1>
@@ -1125,13 +1099,13 @@ const ViewAllResults = (props) => {
<h3>
{" "}
There are no{" "}
{viewAllKey == "awaitingSubmissionDetails" &&
{currentViewKey == "awaitingSubmissionDetails" &&
t("myportal:awatitingsubmission-card-title")}
{viewAllKey == "watchedCases" &&
{currentViewKey == "watchedCases" &&
t("myportal:watchedcases-card-title")}
{viewAllKey == "myCases" &&
{currentViewKey == "myCases" &&
t("myportal:mycases-card-title")}
{viewAllKey == "myRepresentations" &&
{currentViewKey == "myRepresentations" &&
t("myportal:myrepresentations-card-title")}{" "}
records
</h3>
@@ -1143,7 +1117,7 @@ const ViewAllResults = (props) => {
type="button"
onClick={() =>
sortDataBy(
viewAllKey ==
currentViewKey ==
"awaitingSubmissionDetails"
? "title"
: "pinswg_title"
@@ -1151,7 +1125,7 @@ const ViewAllResults = (props) => {
}
className={
orderByState ==
(viewAllKey ==
(currentViewKey ==
"awaitingSubmissionDetails"
? "title"
: "pinswg_title")
@@ -1171,7 +1145,8 @@ const ViewAllResults = (props) => {
"search:searchresults-site-address-label"
)}
</dd>
{viewAllKey == "awaitingSubmissionDetails" ? (
{currentViewKey ==
"awaitingSubmissionDetails" ? (
<dd className="govuk-summary-list__key govuk-!-font-size-16">
<button
type="button"
@@ -1203,7 +1178,7 @@ const ViewAllResults = (props) => {
type="button"
onClick={() =>
sortDataBy(
viewAllKey ==
currentViewKey ==
"awaitingSubmissionDetails"
? "pinswg_lpaname"
: "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -1211,7 +1186,7 @@ const ViewAllResults = (props) => {
}
className={
orderByState ==
(viewAllKey ==
(currentViewKey ==
"awaitingSubmissionDetails"
? "pinswg_lpaname"
: "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue")
@@ -1227,7 +1202,7 @@ const ViewAllResults = (props) => {
</button>
</dd>
<dd className="govuk-summary-list__key govuk-!-font-size-16">
{viewAllKey !=
{currentViewKey !=
"awaitingSubmissionDetails" ? (
<button
type="button"
@@ -1238,7 +1213,7 @@ const ViewAllResults = (props) => {
}
className={
orderByState ==
(viewAllKey ==
(currentViewKey ==
"awaitingSubmissionDetails"
? "pinswg_lpaname"
: "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue")
@@ -1259,7 +1234,7 @@ const ViewAllResults = (props) => {
)}{" "}
</dd>
<dd className="govuk-summary-list__key govuk-!-font-size-16">
{viewAllKey == "myRepresentations" ? (
{currentViewKey == "myRepresentations" ? (
<button
type="button"
onClick={() =>
@@ -1279,6 +1254,13 @@ const ViewAllResults = (props) => {
t("search:searchresults-status-label")
)}
</dd>
{(currentViewKey == "watchedCases" ||
currentViewKey ==
"awaitingSubmissionDetails" ||
currentViewKey == "myRepresentations") && (
<dd className="govuk-summary-list__key govuk-!-font-size-16 govuk-summary-list__action"></dd>
)}
</div>
{showSpinnerState == true ? (
<div className="govuk-summary-list__row">
+4 -4
View File
@@ -31,6 +31,7 @@ const WatchedCases = (props) => {
currentView={props.currentView}
myReps={props.myReps}
props={props}
accountDetails={props.accountDetails}
/>
</div>
@@ -40,12 +41,11 @@ const WatchedCases = (props) => {
<div className="cardVieAll">
<Link
href={
(router.locale != "en"
router.locale != "en"
? "/" +
router.locale +
"/fymhorth/gweldpopeth"
: "/myportal/viewall") +
"?viewKey=watchedCases"
"/fymhorth/gweldpopeth?key=watchedCases"
: "/myportal/viewall?key=watchedCases"
}
className="govuk-link--no-underline"
onClick={() => {
+1
View File
@@ -22,6 +22,7 @@ const CaseRepresentation = (props) => {
watchedCases={props.watchedCases}
awaitingSubmission={props.awaitingSubmission}
caseReference={props.caseReference}
ticketnumber={props.ticketnumber}
currentType={props.currentType}
searchResultsObj={props.searchResultsObj}
searchDetailsObj={props.searchDetailsObj}
+2 -2
View File
@@ -311,8 +311,8 @@ const SearchResults = (props) => {
resultsArrPaged.map((item, key) => {
let detailsObj = jsonpath({
path:
'$..value[?(@ && @.pinswg_name=="' +
item.pinswg_name +
'$..value[?(@ && @.ticketnumber=="' +
item.ticketnumber +
'")]',
json: searchDetailsObj,
+52 -2
View File
@@ -32,6 +32,7 @@ import {
setWatchedCasesDetails,
} from "../../store/watchedCases/action";
import { getDetailsProxy, getSearchDetailsPaged } from "../utils";
import { signIn, useSession } from "next-auth/react";
const DNSSearchResults = (props) => {
const {
@@ -48,11 +49,13 @@ const DNSSearchResults = (props) => {
setWatchedCases,
setWatchedCasesDetails,
showMap,
showLoginCheck,
} = props;
let { t } = useTranslation();
const router = useRouter();
const { locale } = router;
const { data: session } = useSession();
var resultsArr = searchResultsObj.value || [];
@@ -378,8 +381,8 @@ const DNSSearchResults = (props) => {
resultsArr.map((item, key) => {
let detailsObj = jsonpath({
path:
'$..value[?(@ && @.pinswg_name=="' +
item.title +
'$..value[?(@ && @.ticketnumber=="' +
item.ticketnumber +
'")]',
json: searchDetailsObj,
eval: true,
@@ -443,6 +446,8 @@ const DNSSearchResults = (props) => {
"appealType":
item.pinswg_appealcasetype,
"showMap": showMap,
"showLoginCheck":
props.showLoginCheck,
});
}}
>
@@ -744,6 +749,51 @@ const DNSSearchResults = (props) => {
)}
</dd>
)}
{(showLoginCheck == "true" ||
showLoginCheck == true) &&
!session && (
<dd className="govuk-summary-list__value govuk-!-font-size-14 govuk-summary-list__action">
<span className="results-visually-hidden">
{t(
"case:watch-this-case-link"
)}
</span>
<button
className="govuk-summary-list__actionLink watchLink"
onClick={() => {
confirm(
t(
"case:trying-to-watch-case-label"
) +
item.title +
"\n\n" +
t(
"case:trying-to-watch-case-redirect-label"
)
) &&
// signIn("email");
signIn(
undefined,
{
callbackUrl:
"/myportal/searchresults?q=" +
searchString +
"&toWatch=" +
item.incidentid +
"_" +
item.pinswg_appealcasetype,
}
);
}}
title={t(
"case:watch-this-case-link"
)}
>
<span className="eye"></span>
</button>
</dd>
)}
</div>
);
})
+2 -2
View File
@@ -331,8 +331,8 @@ const SearchResults = (props) => {
resultsArr.map((item, key) => {
let detailsObj = jsonpath({
path:
'$..value[?(@ && @.pinswg_name=="' +
item.title +
'$..value[?(@ && @.ticketnumber=="' +
item.ticketnumber +
'")]',
json: searchDetailsObj,
eval: true,
+5 -1
View File
@@ -18,7 +18,11 @@ export default function ServiceBanner(props) {
<div className="servicebanner">
<h1>
<img
className="govuk-!-margin-top-4"
className={
router.locale == "cy"
? "govuk-!-margin-top-4 serviceTitle cy"
: "govuk-!-margin-top-4 serviceTitle"
}
src={
router.locale == "cy"
? "/assets/images/planning-casework-cy.svg"
+9
View File
@@ -34,6 +34,15 @@ export const getFormCollectionByID = (appealTypeID) => {
return collectionName[0];
};
export const getNavigationPropertyByPrimaryAttribute = (primaryAttribute) => {
const collectionName = jsonpath({
path: "$..[?(@ && @.PrimaryIdAttribute =='" + primaryAttribute + "')]",
json: data,
eval: true,
});
return collectionName[0];
};
export const getFormIDByLogicalName = (appealTypeLogicalName) => {
const collectionName = jsonpath({
path: "$..[?(@ && @.LogicalName =='" + appealTypeLogicalName + "')]",
+1 -1
View File
@@ -378,7 +378,7 @@
"UrlName": "sips",
"MetadataId": "8d31911b-b8ea-ef11-ab08-00224800be9c",
"appealTypeID": "846040002",
"NavigationProperty": "pinswg_SIPSIds",
"NavigationProperty": "pinswg_sipscase",
"value": "SIP"
}
]
+1
View File
@@ -109,6 +109,7 @@
"trying-to-watch-case-redirect-label": "Fe'ch anogir nawr i fewngofnodi",
"you-have-stopped-watching-label": "Ydych chi am roi'r gorau i wylio achos ",
"do-you-want-to-delete-case-label": "Ydych chi am ddileu achos",
"do-you-want-to-delete-rep-label": "Ydych chi eisiau dileu cynrychiolaeth sy'n aros i'w chyflwyno",
"do-you-want-to-delete-case-disclaimer-label": "Ar ôl dileu, bydd yr holl wybodaeth a gyflwynwyd gennych yn cael ei cholli.",
"representation-date-passed-label": "Mae'r cyfnod cyflwyno sylwadau ar gyfer yr apêl hon rhwng {{startDate}} a {{endDate}}",
"representation-date-passed-additional-label": "Gallwch wneud sylw drwy e-bostio,",
+9 -9
View File
@@ -1,8 +1,8 @@
{
"login-card-title-temp": "Apeliadau neu geisiadau newydd",
"login-comingsoon-temp-1": "Mae'r gwasanaeth hwn yn cael ei ddatblygu i gefnogi apeliadau a cheisiadau ar-lein.",
"login-card-title-temp": "Cyflwyno apêl newydd",
"login-comingsoon-temp-1": "yn erbyn gwrthodiad eich Awdurdod Cynllunio Lleol i roi caniatâd cynllunio neu fethiant i benderfynu ar gais cynllunio mewn pryd.",
"login-comingsoon-temp-1a": "Ar hyn o bryd, gallwch gyflwyno Apeliadau Cynllunio a78, Apeliadau Cydsyniad Adeilad Rhestredig ac Ardal Gadwraeth, Apeliadau Deiliaid Tai a Mân Apeliadau Masnachol - HAS/CAS, Apeliadau Hysbysebion a Barnu'n Annilys.",
"login-comingsoon-temp-2": "Wrth i ni ddatblygur gwasanaeth ar-lein, dewch o hyd i:",
"login-comingsoon-temp-2": "Mae'r gwasanaeth hwn ar agor ar hyn o bryd i gyflwyno apeliadau newydd yn erbyn gwrthod caniatâd cynllunio neu fethu â phenderfynu ar gais cynllunio mewn pryd (apeliadau adran 78). Mae'r gwasanaeth yn cael ei ddatblygu i gefnogi apeliadau a cheisiadau ar-lein eraill. Yn y cyfamser, gallwch ddod o hyd i'r ffurflenni yma",
"login-comingsoon-forms-link-1": "https://llyw.cymru/ffurflenni-apelio",
"login-comingsoon-forms-label-1": "ffurflenni apêl cynllunio a ffurflenni cais cynllunio",
"login-comingsoon-forms-link-2": "https://llyw.cymru/trwyddedau-amgylcheddol",
@@ -32,9 +32,9 @@
"casesearch-card-advanced-link": "Chwiliad uwch",
"casesearch-search-validation-required": "Angenrheidiol",
"casesearch-search-validation-minlength": "Rhaid iddo gynnwys 4 nod neu fwy",
"casescomment-card-title": "Rhowch sylwadau ar apêl",
"casescomment-card-paragraph-one": "Rhowch sylwadau ar apêl (ac eithrio apêl deiliaid tai neu fasnachol) drwy e-bostio ",
"casescomment-card-paragraph-two": "Ni all partïon â buddiant wneud sylwadau ar apeliadau deiliaid tai a masnachol yn ystod y cam apelio. Bydd unrhyw sylwadau a wnaed yn ystod y cam ymgeisio yn cael eu darparu gan yr awdurdod cynllunio lleol a'u hystyried gan yr Arolygydd.",
"casescomment-card-title": "Sylwadau ar apeliadau neu geisiadau",
"casescomment-card-paragraph-one": "Fel arall, gallwch ofyn am ffurflenni neu wneud sylwadau ar apêl yn ystod y cyfnod cynrychioliadau drwy e-bostio ",
"casescomment-card-paragraph-two": "yn ystod y cyfnod cynrychioliadau neu gyflwyno datganiadau achos. Cyfeiriwch at y dyddiadau cau penodol i'r achos. Ar gyfer apeliadau deiliaid tai a masnachol, ni all partïon â diddordeb wneud sylwadau yn ystod y cam apelio. Bydd unrhyw sylwadau a wneir yn ystod y cam ymgeisio yn cael eu darparu gan yr Awdurdod Cynllunio Lleol a'u hystyried gan yr Arolygydd.",
"inspectorate-card-visit-label": "Ymweld â'r Arolygiaeth Gynllunio",
"inspectorate-card-visit-link": "Hafan",
"inspectorate-card-alt-text": "Yr Arolygiaeth Gynllunio",
@@ -48,9 +48,9 @@
"completed-uploading-files-label": "{{number}} ffeil wedi'u huwchlwytho",
"remove-this-file-label": "Tynnu'r ffeil hon",
"watch-case-card-title": "Gwylio achos",
"watch-case-paragraph-one": "Os oes gennych ddiddordeb mewn achos, dewiswch ei wylio o'ch dangosfwrdd.",
"watch-case-paragraph-one": "i gadw golwg ar y camau nesaf a chanlyniad yr apêl.",
"casescomment-card-paragraph-three": "Gallwch wneud sylwadau ar apeliadau a cheisiadau yn ystod y cyfnod cynrychioli neu gyflwyno datganiadau achos neu'r Holiadur LPA.",
"casescomment-card-paragraph-four": "Cyfeiriwch at y dyddiadau cau ar gyfer cynrychioli achosion unigol ar gyfer datganiadau a sylwadau.",
"signin-benefits-title": "Buddion mewngofnodi",
"signin-benefits-paragraph": "Mae cofrestru ar y porth Gwaith Achos Cynllunio yn caniatáu ichi:"
"signin-benefits-title": "Mewngofnodwch i'ch porth",
"signin-benefits-paragraph": "Drwy fewngofnodi gyda'r botwm Mewngofnodi, byddwch yn gallu:"
}
+3 -1
View File
@@ -67,5 +67,7 @@
"searchresults-show-records-label-a": "Dangos",
"searchresults-show-records-label-b": "cofnodion",
"searchresults-created-on-label": "Crëwyd ar",
"address-search-appellant-validation": "Mae angen rhan o'r cyfeiriad i chwilio gydag enw"
"address-search-appellant-validation": "Mae angen rhan o'r cyfeiriad i chwilio gydag enw",
"filter-documents-label": "Hidlo dogfennau",
"clear-filter-button-label": "Clirio'r hidlydd"
}
+1
View File
@@ -110,6 +110,7 @@
"trying-to-watch-case-redirect-label": "You will now be prompted to sign in",
"you-have-stopped-watching-label": "Do you want to stop watching case ",
"do-you-want-to-delete-case-label": "Do you want to delete case ",
"do-you-want-to-delete-rep-label": "Do you want to delete representation awaiting submission",
"do-you-want-to-delete-case-disclaimer-label": "Once deleted all information you have submited, will be lost.",
"representation-date-passed-label": "The representation period for this appeal is between {{startDate}} and {{endDate}}",
"representation-date-passed-additional-label": "You can make a representation by emailing,",
+7 -7
View File
@@ -2,7 +2,7 @@
"login-card-title-temp": "Submit a new appeal",
"login-comingsoon-temp-1": "This service is being developed to support online appeals and applications. You can currently raise planning appeals.",
"login-comingsoon-temp-1a": "You can currently raise Planning Appeals s78.",
"login-comingsoon-temp-2": "While we develop the online service, find:",
"login-comingsoon-temp-2": "This service is currently open to submit new appeals against refusal of planning permission or failure to determine a planning application in time (section 78 appeals). The service is being developed to support other online appeals and applications. In the meantime, you can find the forms here",
"login-comingsoon-forms-link-1": "https://gov.wales/planning-appeal-forms",
"login-comingsoon-forms-label-1": "planning appeal and application forms",
"login-comingsoon-forms-link-2": "https://gov.wales/environmental-permits",
@@ -32,9 +32,9 @@
"casesearch-card-advanced-link": "Advanced search",
"casesearch-search-validation-required": "Required",
"casesearch-search-validation-minlength": "Must be 4 characters or more",
"casescomment-card-title": "Comment on an appeal or application",
"casescomment-card-paragraph-one": "Alternatively you can comment on an appeal (excluding householder or commercial) by emailing ",
"casescomment-card-paragraph-two": "For householder and commercial appeals, interested parties are unable to comment at appeal stage. Any comments made at application stage will be provided by the Local Planning Authority and considered by the inspector.",
"casescomment-card-title": "Comment on appeals or applications",
"casescomment-card-paragraph-one": "Alternatively, you can request forms or comment on an appeal during the representation period by emailing ",
"casescomment-card-paragraph-two": "during the representation period or submit statements of case. Please refer to the case specific deadlines. For householder and commercial appeals, interested parties are unable to comment at appeal stage. Any comments made at application stage will be provided by the Local Planning Authority and considered by the Inspector.",
"inspectorate-card-visit-label": "Visit the Planning Inspectorate",
"inspectorate-card-visit-link": "Home",
"inspectorate-card-alt-text": "The Planning Inspectorate",
@@ -48,9 +48,9 @@
"completed-uploading-files-label": "{{number}} files uploaded",
"remove-this-file-label": "Remove this file",
"watch-case-card-title": "Watch a case",
"watch-case-paragraph-one": "If you are interested in a case you can select to watch it from your dashboard.",
"watch-case-paragraph-one": "to keep track of the next steps and outcome of the appeal.",
"casescomment-card-paragraph-three": "You can make comments on appeals and applications during the representation period or submit statements of case or the LPA Questionnaire.",
"casescomment-card-paragraph-four": "Please refer to the individual case representation deadlines for statements and comments.",
"signin-benefits-title": "Sign in benefits",
"signin-benefits-paragraph": "Registering on the Planning Casework portal allows you to:"
"signin-benefits-title": "Sign in to your portal",
"signin-benefits-paragraph": "By signing in with the Sign in button, you will be able to:"
}
+3 -1
View File
@@ -67,5 +67,7 @@
"searchresults-show-records-label-a": "Show",
"searchresults-show-records-label-b": "records",
"searchresults-created-on-label": "Created on",
"address-search-appellant-validation": "Need part of the address to search with a name"
"address-search-appellant-validation": "Need part of the address to search with a name",
"filter-documents-label": "Filter documents",
"clear-filter-button-label": "Clear filter"
}
+1 -2
View File
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
+2 -2
View File
@@ -37,7 +37,7 @@ export default async function ApiProxy(req, res) {
var queryUrl =
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' " +
(process.env.SHOWSIPS !== "true"
? "and pinswg_appealcasetype ne 846040002"
? "and attributevalue ne 846040002"
: "") +
"&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
@@ -47,7 +47,7 @@ export default async function ApiProxy(req, res) {
// "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
//"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Developments of National Significance' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
//console.log(queryUrl);
console.log(queryUrl);
return axios
.get(
+1 -1
View File
@@ -51,7 +51,7 @@ export default async function ApiProxy(req, res) {
searchString +
"')) and pinswg_appealcasetype ne null " +
(process.env.SHOWSIPS !== "true"
? "and pinswg_appealcasetype ne 846040002"
? "and pinswg_appealcasetype ne 846040002 "
: "") +
"and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
@@ -306,7 +306,7 @@ export default async function ApiProxy(req, res) {
"MetadataId": "8d31911b-b8ea-ef11-ab08-00224800be9c",
"appealTypeID": "846040002",
"tmpNav": "pinswg_sipsid",
"NavigationProperty": "pinswg_SIPSids",
"NavigationProperty": "pinswg_sipscase",
"value": "SIP",
},
@@ -33,7 +33,7 @@ import axios from "axios";
import CryptoJS from "crypto-js";
import { azureHeaders, consoleLogger, getToken } from "../../../actions";
import { getSelectQuery } from "../../../actions/selectQueryTypes";
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -55,6 +55,11 @@ export default async function ApiProxy(req, res) {
var incidentID = req.query.incidentID;
var token = await getToken();
let navigationProperty =
getNavigationPropertyByPrimaryAttribute(
primaryIdAttribute
).NavigationProperty;
var queryUrl =
appealTypeName +
"?$filter=_" +
@@ -63,7 +68,11 @@ export default async function ApiProxy(req, res) {
: primaryIdAttribute + "s_value ") +
" eq " +
incidentID +
"&$count=true";
"&$count=true" +
"&$expand=" +
navigationProperty +
"($select=ticketnumber)";
//" and statuscode eq 1&$count=true";
// queryUrl =
@@ -91,6 +100,13 @@ export default async function ApiProxy(req, res) {
azureHeaders(token.access_token)
)
.then(({ data }) => {
let flattened = data.value.map((r) => ({
...r,
ticketnumber: r[navigationProperty]?.ticketnumber || null,
}));
data.value = flattened;
res.status(200).json(data);
})
.catch((error) => {
@@ -34,7 +34,7 @@ import CryptoJS from "crypto-js";
import _ from "lodash";
import { azureHeadersPaged, consoleLogger, getToken } from "../../../actions";
import { getSelectQuery } from "../../../actions/selectQueryTypes";
import { getNavigationPropertyByPrimaryAttribute } from "../../../components/utils";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -59,6 +59,11 @@ export default async function ApiProxy(req, res) {
var incidentID = req.query.incidentID;
var token = await getToken();
let navigationProperty =
getNavigationPropertyByPrimaryAttribute(
primaryIdAttribute
).NavigationProperty;
var queryUrl =
appealTypeName +
"?$filter=_" +
@@ -67,7 +72,11 @@ export default async function ApiProxy(req, res) {
: primaryIdAttribute + "s_value ") +
" eq " +
incidentID +
"&$count=true";
"&$count=true" +
"&$expand=" +
navigationProperty +
"($select=ticketnumber)";
//" and statuscode eq 1&$count=true";
queryUrl =
@@ -86,10 +95,18 @@ export default async function ApiProxy(req, res) {
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
let flattened = data.value.map((r) => ({
...r,
ticketnumber: r[navigationProperty]?.ticketnumber || null,
}));
data.value = flattened;
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch((error) => {
@@ -85,7 +85,7 @@ export default async function ApiProxy(req, res) {
searchString +
"')) and pinswg_appealcasetype ne null " +
(process.env.SHOWSIPS !== "true"
? "and pinswg_appealcasetype ne 846040002"
? "and pinswg_appealcasetype ne 846040002 "
: "") +
"and pinswg_publishtoweb eq true&$orderby=" +
orderby +
+28 -25
View File
@@ -48,7 +48,9 @@ export default async function ApiProxy(req, res) {
// "&$select=pinswg_emailnotifications,modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
var queryUrl =
"/api/endpoint/getwatchedcases_api?loggedInUserId=" + loggedInUserId;
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
loggedInUserId +
"&$select=modifiedon,pinswg_appealcasetype,pinswg_watchlistid,_pinswg_watchedcase_value,statuscode,pinswg_representationsubmitted,pinswg_representationtype&$count=true&$orderby=createdon desc&$expand=pinswg_WatchedCase($select=pinswg_AssociatedLPA)";
return axios
.get(
@@ -56,32 +58,33 @@ export default async function ApiProxy(req, res) {
azureHeaders(token.access_token)
)
.then(({ data }) => {
// data.value.forEach(function (element) {
// element.ticketnumber = element.pinswg_WatchedCase?.ticketnumber;
// element.pinswg_title =
// element[
// "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
// ];
data.value.forEach(function (element) {
element.ticketnumber = element.pinswg_WatchedCase.ticketnumber;
element.pinswg_title =
element[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
];
// element[
// "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
// ] =
// element.pinswg_WatchedCase?.[
// "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
// ];
// element._pinswg_associatedlpa_value =
// element.pinswg_WatchedCase?._pinswg_associatedlpa_value;
// element[
// "_ownerid_value@OData.Community.Display.V1.FormattedValue"
// ] =
// element.pinswg_WatchedCase?.[
// "_ownerid_value@OData.Community.Display.V1.FormattedValue"
// ];
// element._ownerid_value =
// element.pinswg_WatchedCase?._ownerid_value;
element[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
] =
element.pinswg_WatchedCase[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
];
element._pinswg_associatedlpa_value =
element.pinswg_WatchedCase._pinswg_associatedlpa_value;
element[
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
] =
element.pinswg_WatchedCase[
"_ownerid_value@OData.Community.Display.V1.FormattedValue"
];
element._ownerid_value =
element.pinswg_WatchedCase._ownerid_value;
delete element.pinswg_WatchedCase;
});
// delete element.pinswg_WatchedCase;
// });
res.status(200).json(data);
})
.catch((error) => {
+10 -1
View File
@@ -24,10 +24,19 @@ ApiProxy.get(async (req, res) => {
"&blobname=" +
blobName.trim();
// console.log(checkquerypath);
// console.log(hashAPIPath(checkquerypath));
// console.log(req.query);
if (hashAPIPath(checkquerypath) == "&hash=" + checkHash) {
const bloblocation =
casefolderID + (blobName.indexOf(".json") > 0 ? "/" : "/files/");
const downloaded = await downloadFile(
containerName,
casefolderID + "/files/" + decodeURI(blobName)
bloblocation + decodeURI(blobName)
);
res.setHeader(
+83
View File
@@ -0,0 +1,83 @@
import { DefaultAzureCredential } from "@azure/identity";
import { BlobServiceClient } from "@azure/storage-blob";
export default async function handler(req, res) {
if (req.method !== "POST") {
res.status(405).json({ error: "Method not allowed" });
return;
}
const { container, blobName } = req.body;
if (!container || !blobName) {
res.status(400).json({ error: "Missing container or blobName" });
return;
}
try {
const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;
const creds = new DefaultAzureCredential();
const blobServiceClient = new BlobServiceClient(
`https://${accountName}.blob.core.windows.net`,
creds
);
const containerClient = blobServiceClient.getContainerClient(container);
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
// Download blob content
const downloadResponse = await blockBlobClient.download(0);
const downloaded = await streamToString(
downloadResponse.readableStreamBody
);
// Parse JSON
const json = JSON.parse(downloaded);
// Remove repComplete element if it exists
if ("repComplete" in json) {
delete json.repComplete;
}
const tags = {
containerid: json.containerID,
caseID: json.ticketnumber,
blobType: "Representation",
};
// Convert back to string
const updatedContent = JSON.stringify(json, null, 2);
// Upload updated content (overwrite)
await blockBlobClient.upload(
updatedContent,
Buffer.byteLength(updatedContent),
{
blobHTTPHeaders: { blobContentType: "application/json" },
}
);
console.log("the tags:", tags);
const withTags = await blockBlobClient.setTags(tags);
const withMeta = await blockBlobClient.setMetadata(tags);
res.status(200).json({ message: "repComplete removed successfully" });
} catch (error) {
console.error("Error editing rep.json:", error);
res.status(500).json({ error: "Failed to edit rep.json" });
}
}
// Helper function to read stream to string
async function streamToString(readableStream) {
return new Promise((resolve, reject) => {
const chunks = [];
readableStream.on("data", (data) => {
chunks.push(data.toString());
});
readableStream.on("end", () => {
resolve(chunks.join(""));
});
readableStream.on("error", reject);
});
}
+1 -1
View File
@@ -166,7 +166,7 @@ export default async function handler(req, res) {
var containerID = reqBodyobj.containerID;
var casefolderID = reqBodyobj.casefolderID;
var caseRef = reqBodyobj.caseRef;
var caseRef = reqBodyobj.ticketnumber;
var representationType = reqBodyobj.representationType;
var repRaiser = reqBodyobj.lastname;
var localeSelect = reqBodyobj.locale;
+29
View File
@@ -207,6 +207,35 @@ const SignIn = (props) => {
};
export async function getServerSideProps(context) {
const { query, req, res } = context;
// Load allowed IPs from env and trim spaces
const ALLOWED_IPS = process.env.ALLOWED_IPS
? process.env.ALLOWED_IPS.split(",").map((ip) => ip.trim())
: [];
// Always allow localhost addresses
const LOCALHOST_IPS = ["127.0.0.1", "::1"];
// Get IP address from headers or socket
const forwarded = req.headers["x-forwarded-for"];
const ip =
typeof forwarded === "string"
? forwarded.split(",")[0]
: req.socket.remoteAddress;
console.log("Visitor IP:", ip);
// Check whitelist + localhost
if (![...ALLOWED_IPS, ...LOCALHOST_IPS].includes(ip)) {
return {
redirect: {
destination: "/403", // custom "Access Denied" page
permanent: false,
},
};
}
if (process.env.SHOWLOGIN == false) {
return {
redirect: {
+7
View File
@@ -85,6 +85,13 @@ const CaseHome = (props) => {
props.searchResultsObj.searchResultsObj.value[0]
.ticketnumber
}
ticketnumber={
props.currentView.caseReference.ticketnumber
}
ticketnumber={
props.searchResultsObj.searchResultsObj.value[0]
.ticketnumber
}
currentType={props.currentType}
appealTypeID={
props.searchResultsObj.searchResultsObj.value[0]
+10 -1
View File
@@ -46,7 +46,9 @@ const CaseHome = (props) => {
<Head>
<title>
Reference:{" "}
{props.currentView.caseReference.currentReference}{" "}
{props.currentView.caseReference.currentReference ||
props.searchResultsObj.searchResultsObj.value[0]
.title}{" "}
Developments of National Significance
</title>
</Head>
@@ -81,9 +83,16 @@ const CaseHome = (props) => {
props.awaitingSubmission.awaitingSubmission
}
caseReference={
props.searchResultsObj.searchResultsObj.value[0]
.caseReference
}
ticketnumber={
props.searchResultsObj.searchResultsObj.value[0]
.ticketnumber
}
// ticketnumber={
// props.currentView.caseReference.ticketnumber
// }
currentType={props.currentType}
appealTypeID={
props.searchResultsObj.searchResultsObj.value[0]
+7 -2
View File
@@ -20,7 +20,7 @@ import { wrapper } from "../store/store";
import ServiceBanner from "../components/servicebanner";
const Home = (props) => {
const { footerLinks, pages, showMap } = props;
const { footerLinks, pages, showMap, showLoginCheck } = props;
let { t, lang } = useTranslation();
const router = useRouter();
@@ -105,6 +105,7 @@ const Home = (props) => {
showMap={showMap}
searchString="DNS"
searchResultsObj={props.searchResultsObj}
showLoginCheck={showLoginCheck}
/>
</div>
<Footer footerLinks={footerLinks} ticketnumber={props} />
@@ -134,6 +135,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
}
: searchResultsObj;
const showLoginCheck = process.env.SHOWLOGIN || false;
const showMapCheck = process.env.SHOWMAPS || false;
if (_.has(searchResultsObj, "status") == true) {
@@ -156,7 +158,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
}
return {
props: { showMap: showMapCheck },
props: {
showMap: showMapCheck,
showLoginCheck: showLoginCheck,
},
};
}
);
+14 -13
View File
@@ -70,7 +70,9 @@ const CaseHome = (props) => {
<Head>
<title>
Reference:{" "}
{props.currentView.caseReference.currentReference}{" "}
{props.currentView.caseReference.currentReference ||
props.searchResultsObj.searchResultsObj.value[0]
.title}{" "}
</title>
</Head>
<div id="page_wrapper">
@@ -107,6 +109,10 @@ const CaseHome = (props) => {
props.searchResultsObj.searchResultsObj.value[0]
.ticketnumber
}
ticketnumber={
props.currentView.caseReference.ticketnumber ||
router.query.ticketnumber
}
currentType={props.currentType}
appealTypeID={
props.searchResultsObj.searchResultsObj.value[0]
@@ -129,9 +135,7 @@ const CaseHome = (props) => {
<Footer
footerLinks={footerLinks}
props={props}
ticketnumber={
props.currentView.caseReference.currentReference
}
ticketnumber={props.currentView.caseReference.ticketnumber}
/>
<TimeOut />
</div>
@@ -182,10 +186,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setLoggedInUserId(loggedInUser));
let developmentQuery =
query.ticketnumber.indexOf("CAS-") == 0
? query.ticketnumber
: query.ticketnumber.split("-").join(" ");
let developmentQuery = query.ticketnumber;
const pattern = /CAS-\d{5}-[A-Z0-9]{6}/;
const match = query.ticketnumber.match(pattern);
@@ -220,10 +221,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setSearch(developmentQuery));
console.log(
searchResultsObj["@odata.count"] > 1 ||
searchResultsObj["@odata.count"] < 1
);
// console.log(
// searchResultsObj["@odata.count"] > 1 ||
// searchResultsObj["@odata.count"] < 1
// );
if (searchResultsObj["@odata.count"] < 1) {
return {
@@ -432,7 +433,6 @@ const getDetails = (resultsObj, detailsType) => {
case "myCases":
caseID = data.pinswg_title;
break;
case "myWatchedCases":
case "mySubmittedReps":
caseID =
data[
@@ -440,6 +440,7 @@ const getDetails = (resultsObj, detailsType) => {
];
break;
case "awaitingSubmission":
case "myWatchedCases":
case "myRepresentations":
caseID = data.ticketnumber;
break;
+7 -1
View File
@@ -46,7 +46,9 @@ const CaseHome = (props) => {
<Head>
<title>
Reference:{" "}
{props.currentView.caseReference.currentReference}{" "}
{props.currentView.caseReference.currentReference ||
props.searchResultsObj.searchResultsObj.value[0]
.title}{" "}
Developments of National Significance
</title>
</Head>
@@ -81,6 +83,10 @@ const CaseHome = (props) => {
props.awaitingSubmission.awaitingSubmission
}
caseReference={
props.searchResultsObj.searchResultsObj.value[0]
.caseReference
}
ticketnumber={
props.searchResultsObj.searchResultsObj.value[0]
.ticketnumber
}
+3
View File
@@ -190,6 +190,9 @@ const RepresentationF = (props) => {
caseReference={
props.currentView.caseReference.currentReference
}
ticketnumber={
props.currentView.caseReference.ticketnumber
}
currentType={
props.currentView.caseReference.currentType
}
+759
View File
@@ -0,0 +1,759 @@
import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer";
import Header from "../components/header";
import { DefaultAzureCredential } from "@azure/identity";
import { BlobServiceClient, ContainerClient } from "@azure/storage-blob";
import { v4 as uuidv4 } from "uuid";
import {
createContainerSas,
listContainers,
listBlobHierarchical,
listContainersForUser,
} from "../actions/azurestorage";
import Head from "next/head";
import Link from "next/link";
import { PrismaClient } from "@prisma/client";
import {
bytesToSize,
getThumbnailIconByExtension,
updateLinks,
} from "../components/utils";
import {
consoleLogger,
getIP,
sendRepCompleteMessage,
deleteMyRepresentationsFromBlob,
deleteAwaitingSubmissionsFromBlob,
} from "../actions";
import CryptoJS from "crypto-js";
import { useState } from "react";
function getUpToLastSlash(url) {
let lastSlash = url.lastIndexOf("/");
url = url.substring(0, lastSlash);
url =
url.lastIndexOf("/files") > 0
? url.substring(0, url.lastIndexOf("/files"))
: url;
return url;
}
async function streamToString(readableStream) {
return new Promise((resolve, reject) => {
const chunks = [];
readableStream.on("data", (data) => {
chunks.push(data.toString());
});
readableStream.on("end", () => {
resolve(chunks.join(""));
});
readableStream.on("error", reject);
});
}
function formatTimeSince(date) {
if (!date) return "Unknown date";
const now = new Date();
const diffMs = now - date;
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
if (diffDays < 7) {
return `${diffDays} day${diffDays !== 1 ? "s" : ""} ago`;
} else {
const diffWeeks = Math.floor(diffDays / 7);
return `${diffWeeks} week${diffWeeks !== 1 ? "s" : ""} ago`;
}
}
function formatBlobDates(blob) {
const created = blob.createdOn ? new Date(blob.createdOn) : null;
const modified = blob.lastModified ? new Date(blob.lastModified) : null;
if (!created && !modified) return "Unknown";
// If both exist and are the same
if (created && modified && created.getTime() === modified.getTime()) {
return `${created.toLocaleString("en-GB")} (${formatTimeSince(
created
)})`;
}
// If modified exists and is newer than created
if (created && modified && modified.getTime() > created.getTime()) {
return `Created: ${created.toLocaleString("en-GB")} (${formatTimeSince(
created
)}), Modified: ${modified.toLocaleString("en-GB")} (${formatTimeSince(
modified
)})`;
}
// Only one date exists
const date = modified || created;
return `${date.toLocaleString("en-GB")} (${formatTimeSince(date)})`;
}
const deleteRepItem = (containerID, caseID, repfile) => {
deleteMyRepresentationsFromBlob(containerID, caseID, repfile).then(
(data) => {
console.log("======== rep deleted =========");
return data;
}
);
};
// const deleteCaseItem = (containerID, caseID) => {
// deleteAwaitingSubmissionsFromBlob(containerID, caseID).then((data) => {
// return data;
// });
// };
const deleteCaseItem = async (containerID, caseID, setData) => {
const result = await deleteAwaitingSubmissionsFromBlob(containerID, caseID);
if (result) {
setData((prevData) =>
prevData.map((user) => ({
...user,
containers: user.containers.map((c) =>
c.container === containerID
? {
...c,
folders: c.folders.filter(
(f) => f.folderPath !== caseID
),
}
: c
),
}))
);
}
};
export default function StoragePage(props) {
const { userData, repCompleteCount } = props;
const [data, setData] = useState(props.data);
const [showRepJson, setShowRepJson] = useState(true);
const [showTmpFile, setShowTmpFile] = useState(true);
const [whichTab, setWhichTab] = useState("storage");
const toggleAll = () => {
const newState = !(showRepJson || showTmpFile);
setShowRepJson(newState);
setShowTmpFile(newState);
};
return (
<div>
<Head>
<title>Storage Account Browser</title>
</Head>
<div id="page_wrapper">
<CookieBanner />
<Header />
<div className="govuk-width-container">
<div className="js-enabled govuk-template__body govuk-frontend-supported">
<div className="govuk-tabs" data-module="govuk-tabs">
<h2 className="govuk-tabs__title">Contents</h2>
<ul className="govuk-tabs__list">
<li
className={
whichTab == "storage"
? "govuk-tabs__list-item govuk-tabs__list-item--selected"
: "govuk-tabs__list-item "
}
>
<a
className="govuk-tabs__tab"
href="#storage"
onClick={() => setWhichTab("storage")}
>
Storage Account
</a>
</li>
<li
className={
whichTab == "accounts"
? "govuk-tabs__list-item govuk-tabs__list-item--selected"
: "govuk-tabs__list-item "
}
>
<a
className="govuk-tabs__tab"
href="#accounts"
onClick={() => setWhichTab("accounts")}
>
User Accounts
</a>
</li>
</ul>
<div
className={
whichTab == "storage"
? "govuk-tabs__panel "
: "govuk-tabs__panel govuk-tabs__panel--hidden"
}
id="storage"
>
<h1>Storage Account Contents</h1>
{repCompleteCount > 0 && (
<p>
Number of Orphaned Reps:{" "}
{repCompleteCount}
</p>
)}
{/* Toggle buttons */}
<div style={{ marginBottom: "0.2rem" }}>
<button
className="govuk-button govuk-button--secondary"
onClick={() =>
setShowRepJson(!showRepJson)
}
>
{showRepJson
? "Hide Reps"
: "Show Reps"}
</button>
<button
className="govuk-button govuk-button--secondary"
onClick={() =>
setShowTmpFile(!showTmpFile)
}
style={{ marginLeft: "0.5rem" }}
>
{showTmpFile
? "Hide Temp Appeal"
: "Show Temp Appeal"}
</button>
<button
className="govuk-button govuk-button--secondary"
onClick={toggleAll}
style={{ marginLeft: "0.5rem" }}
>
Show/Hide All
</button>
</div>
{data.map((user) => (
<div
key={user.id}
className="govuk-grid-row"
>
{user.containers.map((c) => (
<div
key={c.container}
className="card"
>
<div className="card-body">
<h3>
{c.container} -{" "}
<Link
href={
"/auth/signin2?email=" +
user.email
}
>
{user.email}
</Link>
</h3>
{c.folders.map((folder) => (
<div
key={
folder.folderPath
}
style={
showRepJson &&
folder.hasRepJson
? {
display:
"block",
}
: showTmpFile &&
folder.hasTmpFile
? {
display:
"block",
}
: {
display:
"none",
}
}
>
<h4>
{folder.folderPath ||
"Root"}
</h4>
{/* {folder.hasRepJson && (
<p>
rep.json file found:{" "}
{folder.repJsonBlob.name}
</p>
)} */}
{folder.hasTmpFile && (
<>
<button
onClick={() => {
confirm(
"Do you want to remove this unsubmitted appeal " +
folder.folderPath +
"?\n"
) &&
(deleteCaseItem(
c.container,
folder.folderPath,
setData
),
alert(
"Temp case Deleted!"
));
}}
>
Delete
this TMP
appeal
</button>
</>
)}
{folder.hasRepJson && (
<div>
{" "}
<button
title={
"Do you want to delete rep"
}
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
onClick={() => {
confirm(
"Do you want tyo delete rep " +
folder.repJsonBlob.name.split(
"/"
)[0] +
"?\n"
) &&
(deleteRepItem(
c.container,
folder.repJsonBlob.name.split(
"/"
)[0],
folder.repJsonBlob.name.split(
"/"
)[1]
),
alert(
"Rep Deleted!"
),
window.location.reload());
}}
>
Delete
Rep
</button>
{folder.repComplete && (
<button
onClick={async () => {
const response =
await fetch(
"/api/file/editRepJson",
{
method: "POST",
headers:
{
"Content-Type":
"application/json",
},
body: JSON.stringify(
{
container:
c.container,
blobName:
folder
.repJsonBlob
.name,
}
),
}
);
const result =
await response.json();
if (
response.ok
) {
alert(
"repComplete removed!"
),
window.location.reload();
// Optionally refresh the page or update UI state here
} else {
alert(
"Error: " +
result.error
);
}
}}
>
Remove
repComplete
</button>
)}
{folder.repComplete && (
<button
onClick={async () => {
confirm(
"Do you want resend the rep queue message " +
folder.repJsonBlob.name.split(
"/"
)[0] +
" --- " +
folder.repJsonBlob.name.split(
"/"
)[1]
) &&
(sendRepCompleteMessage(
c.container,
folder.repJsonBlob.name.split(
"/"
)[0],
folder.repJsonBlob.name.split(
"/"
)[1]
),
alert(
"rep queue message sent!"
),
window.location.reload());
}}
>
Recreate
Queue
Message
</button>
)}
</div>
)}
<ul>
{folder.blobs.map(
(blob) => (
<li
key={
blob.name
}
>
<Link
scroll={
false
}
href={
"/api/file/downloadblob?container=" +
c.container +
"&casefolderID=" +
folder.folderPath +
"&blobname=" +
blob.name
.substring(
blob.name.lastIndexOf(
"/"
) +
1
)
.trim() +
"&hash=" +
blob.hashedfilepath
}
className="govuk-body govuk-!-font-size-14 govuk-link"
>
{
blob.name
}{" "}
(
{bytesToSize(
blob.contentLength ||
blob.size
)}
)
</Link>{" "}
{blob.lastModified && (
<span className="govuk-!-font-size-14">
{/* {
blob.displayDate
} */}
{formatBlobDates(
blob
)}
</span>
)}
</li>
)
)}
</ul>
</div>
))}
</div>
</div>
))}
</div>
))}
</div>
<div
className={
whichTab == "accounts"
? "govuk-tabs__panel "
: "govuk-tabs__panel govuk-tabs__panel--hidden"
}
id="accounts"
>
<h1>User Accounts </h1>
<p>
Number of accounts created:{" "}
{userData.length}
</p>
<dl className=" govuk-summary-list govuk-!-margin-bottom-9 results">
<div class="govuk-summary-list__row results-headings">
<dd className="govuk-summary-list__key govuk-!-font-size-16 ">
Name
</dd>
<dd className="govuk-summary-list__key govuk-!-font-size-16">
Last accessed
</dd>
</div>
{userData.map((user) => (
<div
key={user.id}
className=" govuk-summary-list__row"
>
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
<Link
target="_blank"
href={
"/auth/signin2?email=" +
user.email
}
>
{user.email}
</Link>
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
Last accessed: {user.created}{" "}
</dd>
</div>
))}
</dl>
</div>
</div>
</div>
</div>
<Footer />
</div>
</div>
);
}
export async function getServerSideProps({ req }) {
// Load allowed IPs from env and trim spaces
const ALLOWED_IPS = process.env.ALLOWED_IPS
? process.env.ALLOWED_IPS.split(",").map((ip) => ip.trim())
: [];
// Always allow localhost addresses
const LOCALHOST_IPS = ["127.0.0.1", "::1"];
// Get IP address from headers or socket
const forwarded = req.headers["x-forwarded-for"];
const ip =
typeof forwarded === "string"
? forwarded.split(",")[0]
: req.socket.remoteAddress;
console.log("Visitor IP:", ip);
// Check whitelist + localhost
if (![...ALLOWED_IPS, ...LOCALHOST_IPS].includes(ip)) {
return {
redirect: {
destination: "/403", // custom "Access Denied" page
permanent: false,
},
};
}
const accountName = process.env.AZURE_STORAGE_ACCOUNT_NAME;
const creds = new DefaultAzureCredential();
const globalForPrisma = global;
const prisma = globalForPrisma.prisma || new PrismaClient();
const blobServiceClient = new BlobServiceClient(
`https://${accountName}.blob.core.windows.net`,
creds
);
const users = await prisma.user.findMany();
const hashAPIPath = (queryPath, WORDKEY) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
return hashlink;
};
let data = await Promise.all(
users.map(async (user) => {
const containers = await listContainersForUser(
blobServiceClient,
`${user.id}`,
user.email
);
const containersWithHashes = await Promise.all(
containers.map(async (container) => {
const groupedByFolder = await container.blobs.reduce(
async (accP, blob) => {
// Because we'll do async read, reduce needs to be async, so accP is a Promise
const acc = await accP;
const folderPath =
getUpToLastSlash(blob.name.trim()) || "";
const hashedfilepath = hashAPIPath(
"/api/file/downloadblob?container=" +
container.container +
"&casefolderID=" +
folderPath +
"&blobname=" +
blob.name
.substring(
blob.name.lastIndexOf("/") + 1
)
.trim(),
process.env.HASHKEY
);
const fileNameOnly = blob.name.substring(
blob.name.lastIndexOf("/") + 1
);
const isTmpFile = fileNameOnly.startsWith("TMP-");
const blobWithHash = {
...blob,
hashedfilepath,
isTmpFile,
};
let folderGroup = acc.find(
(f) => f.folderPath === folderPath
);
if (!folderGroup) {
folderGroup = {
folderPath,
blobs: [],
hasRepJson: false,
repJsonBlob: null,
repComplete: false,
hasTmpFile: false,
};
acc.push(folderGroup);
}
folderGroup.blobs.push(blobWithHash);
if (isTmpFile) {
folderGroup.hasTmpFile = true;
}
// If this blob ends with rep.json, fetch and parse JSON
if (blob.name.toLowerCase().endsWith("rep.json")) {
folderGroup.hasRepJson = true;
folderGroup.repJsonBlob = blobWithHash;
// Read blob content from Azure Storage
const containerClient =
blobServiceClient.getContainerClient(
container.container
);
const blockBlobClient =
containerClient.getBlockBlobClient(
blob.name
);
try {
const downloadResponse =
await blockBlobClient.download(0);
const downloaded = await streamToString(
downloadResponse.readableStreamBody
);
const json = JSON.parse(downloaded);
folderGroup.repComplete = Boolean(
json.repComplete
);
} catch (err) {
console.error(
"Error reading or parsing rep.json",
err
);
folderGroup.repComplete = false;
}
}
return acc;
},
Promise.resolve([])
);
return {
...container,
folders: groupedByFolder,
};
})
);
return containersWithHashes.length > 0
? {
id: user.id,
email: user.email,
containers: containersWithHashes,
}
: null;
})
);
let userData = await Promise.all(
users
.filter((user) => user.email && user.email.trim() !== "")
.map(async (user) => ({
id: user.id,
email: user.email,
created: user.emailVerified?.toLocaleString("en-GB") || "",
}))
);
let repCompleteCount = 0;
data = data.filter(Boolean);
data.forEach((user) => {
user.containers.forEach((container) => {
container.folders.forEach((folder) => {
if (folder.repComplete === true) {
repCompleteCount++;
}
});
});
});
return {
props: {
data: data,
userData: userData,
repCompleteCount,
},
};
}
+14
View File
@@ -84,6 +84,8 @@ html[data-useragent*="MSIE 10.0"] .flex-container {
font-size: 1.17rem;
}
.card-body {
//border-bottom: 1px solid $govuk-border-colour; //$panel-colour;
padding: 40px 20px;
@@ -327,4 +329,16 @@ div.cardModuleItem:last-of-type {
// box-shadow: 0 2px 0 #0b0c0c;
}
}
}
.card {
.cardList-nobullet {
list-style-type: none;
padding-left: 20px;
li {
margin-bottom: 10px;
}
}
}
+58
View File
@@ -300,6 +300,17 @@ a.longLinkBreak {
}
@media screen and (max-width: 670px) {
img {
&.serviceTitle {
width: 236px;
&.cy {
width: 238px;
}
}
}
flex-direction: column-reverse;
align-items: flex-start;
@@ -1506,6 +1517,14 @@ textarea,
.govuk-summary-list__key {
width: 45%;
}
}
#login-card {
.heading-small {
font-size: 1rem;
}
}
.react-datepicker__input-container input {
@@ -2576,6 +2595,45 @@ dd.govuk-summary-list__value.govuk-\!-font-size-14.govuk-summary-list__action {
& .cardModuleRemoveCase {
border: 1px solid $red;
padding: 5px;
height: 20px;
padding-top: 0px;
padding-bottom: 0px;
border-radius: 5px;
width: auto;
color: white !important;
font-weight: bold;
background-color: $red;
font-size: 15px;
cursor: pointer;
&:active {
top: 2px;
}
&:hover {
background-color: $lightred;
color: $white !important;
text-decoration: none;
}
&:focus {
border-color: #ffdd00;
outline: 3px solid transparent;
-webkit-box-shadow: inset 0 0 0 1px #ffdd00;
box-shadow: inset 0 0 0 1px #ffdd00;
}
&:focus:not(:active):not(:hover) {
border-color: #ffdd00;
color: #0b0c0c;
// background-color: #ffdd00;
// -webkit-box-shadow: 0 2px 0 #0b0c0c;
// box-shadow: 0 2px 0 #0b0c0c;
}
}
}