refactor(actions): complete priority-1 consumer import migration pass

This commit is contained in:
2026-03-12 13:26:48 +00:00
parent a0a633a9ea
commit c4ad9ab7a2
13 changed files with 232 additions and 220 deletions
+57 -57
View File
@@ -15,177 +15,177 @@ import { sendGAEvent } from "@next/third-parties/google";
import { import {
getSearchDocumentDetails, getSearchDocumentDetails,
getSearchDocumentDetailsPaged, getSearchDocumentDetailsPaged,
getSearchDocumentTypes, getSearchDocumentTypes
getNewDocumentsPaged, } from "../../../actions/services/searchService";
} from "../../../actions"; import { getNewDocumentsPaged } from "../../../actions/services/adminService";
import { setCurrentPage } from "../../../store/currentView/action"; import { setCurrentPage } from "../../../store/currentView/action";
import { setDocumentDetails } from "../../../store/searchOutput/action"; import { setDocumentDetails } from "../../../store/searchOutput/action";
const getDocumentTypes = [ const getDocumentTypes = [
{ {
"Value": 846040009, "Value": 846040009,
"Label": "Main Party - Pre-Submission Docs", "Label": "Main Party - Pre-Submission Docs"
}, },
{ {
"Value": 846040000, "Value": 846040000,
"Label": "Main Party - Submission Document", "Label": "Main Party - Submission Document"
}, },
{ {
"Value": 846040001, "Value": 846040001,
"Label": "Main Party - Questionnaire", "Label": "Main Party - Questionnaire"
}, },
{ {
"Value": 846040002, "Value": 846040002,
"Label": "Main Party - Statements", "Label": "Main Party - Statements"
}, },
{ {
"Value": 846040003, "Value": 846040003,
"Label": "Main Party - Comments", "Label": "Main Party - Comments"
}, },
{ {
"Value": 846040004, "Value": 846040004,
"Label": "Main Party - Written Statements of Evidence", "Label": "Main Party - Written Statements of Evidence"
}, },
{ {
"Value": 846040010, "Value": 846040010,
"Label": "Main Party - Environmental Statements", "Label": "Main Party - Environmental Statements"
}, },
{ {
"Value": 846040005, "Value": 846040005,
"Label": "Interested Party Representations", "Label": "Interested Party Representations"
}, },
{ {
"Value": 846040006, "Value": 846040006,
"Label": "Correspondence", "Label": "Correspondence"
}, },
{ {
"Value": 846040008, "Value": 846040008,
"Label": "Inspector Notes", "Label": "Inspector Notes"
}, },
{ {
"Value": 846040007, "Value": 846040007,
"Label": "Final Decision/Report", "Label": "Final Decision/Report"
}, },
{ {
"Value": 846040011, "Value": 846040011,
"Label": "Post Decision Correspondence", "Label": "Post Decision Correspondence"
}, },
{ {
"Value": 846040012, "Value": 846040012,
"Label": "High Court Challenge Correspondence", "Label": "High Court Challenge Correspondence"
}, },
{ {
"Value": 846040013, "Value": 846040013,
"Label": "Event - Correspondence", "Label": "Event - Correspondence"
}, },
{ {
"Value": 846040014, "Value": 846040014,
"Label": "Event - Documents", "Label": "Event - Documents"
}, },
{ {
"Value": 846040015, "Value": 846040015,
"Label": "Pre-Application - General", "Label": "Pre-Application - General"
}, },
{ {
"Value": 846040016, "Value": 846040016,
"Label": "Pre-Application - EIA Screening", "Label": "Pre-Application - EIA Screening"
}, },
{ {
"Value": 846040017, "Value": 846040017,
"Label": "Pre-Application - EIA Scoping", "Label": "Pre-Application - EIA Scoping"
}, },
{ {
"Value": 846040018, "Value": 846040018,
"Label": "EIA Screening", "Label": "EIA Screening"
}, },
{ {
"Value": 846040019, "Value": 846040019,
"Label": "EIA Scoping", "Label": "EIA Scoping"
}, },
{ {
"Value": 846040020, "Value": 846040020,
"Label": "Pre-Application Services Documents", "Label": "Pre-Application Services Documents"
}, },
{ {
"Value": 846040021, "Value": 846040021,
"Label": "Notification", "Label": "Notification"
}, },
{ {
"Value": 846040022, "Value": 846040022,
"Label": "Label":
"Submission - Environmental Statement - written statement and NTS", "Submission - Environmental Statement - written statement and NTS"
}, },
{ {
"Value": 846040023, "Value": 846040023,
"Label": "Submission - Environmental Statement - Appendices", "Label": "Submission - Environmental Statement - Appendices"
}, },
{ {
"Value": 846040024, "Value": 846040024,
"Label": "Submission - Environmental Statement - Figures", "Label": "Submission - Environmental Statement - Figures"
}, },
{ {
"Value": 846040025, "Value": 846040025,
"Label": "Submission - Draft Infrastructure Consent Orders", "Label": "Submission - Draft Infrastructure Consent Orders"
}, },
{ {
"Value": 846040026, "Value": 846040026,
"Label": "Submission - Compulsory Acquisition Information", "Label": "Submission - Compulsory Acquisition Information"
}, },
{ {
"Value": 846040027, "Value": 846040027,
"Label": "Submission - Application Documents", "Label": "Submission - Application Documents"
}, },
{ {
"Value": 846040028, "Value": 846040028,
"Label": "Examination Notices", "Label": "Examination Notices"
}, },
{ {
"Value": 846040029, "Value": 846040029,
"Label": "Local/Marine Impact Reports", "Label": "Local/Marine Impact Reports"
}, },
{ {
"Value": 846040030, "Value": 846040030,
"Label": "Submission - Further Information", "Label": "Submission - Further Information"
}, },
{ {
"Value": 846040031, "Value": 846040031,
"Label": "Formal Variation requests", "Label": "Formal Variation requests"
}, },
{ {
"Value": 846040032, "Value": 846040032,
"Label": "Further Information - Interested Party Representations", "Label": "Further Information - Interested Party Representations"
}, },
{ {
"Value": 846040033, "Value": 846040033,
"Label": "Hearing Statements", "Label": "Hearing Statements"
}, },
{ {
"Value": 846040034, "Value": 846040034,
"Label": "Events - Recordings", "Label": "Events - Recordings"
}, },
{ {
"Value": 846040035, "Value": 846040035,
"Label": "Internal Correspondence", "Label": "Internal Correspondence"
}, },
{ {
"Value": 846040036, "Value": 846040036,
"Label": "Consultation Response", "Label": "Consultation Response"
}, }
]; ];
const getOrigin = [ const getOrigin = [
{ {
"Value": 846040000, "Value": 846040000,
"Label": "MDU", "Label": "MDU"
}, },
{ {
"Value": 846040001, "Value": 846040001,
"Label": "Portal", "Label": "Portal"
}, },
{ {
"Value": 846040002, "Value": 846040002,
"Label": "Manual", "Label": "Manual"
}, }
]; ];
const DocumentsTab = (props) => { const DocumentsTab = (props) => {
@@ -200,7 +200,7 @@ const DocumentsTab = (props) => {
setDocumentDetails, setDocumentDetails,
setCurrentPage, setCurrentPage,
docsOffline, docsOffline,
showFilteredDocs, showFilteredDocs
} = props; } = props;
const router = useRouter(); const router = useRouter();
@@ -236,7 +236,7 @@ const DocumentsTab = (props) => {
setCheckedItems((prev) => ({ setCheckedItems((prev) => ({
...prev, ...prev,
[name]: checked, [name]: checked
})); }));
setSelectAll(false); setSelectAll(false);
}; };
@@ -246,7 +246,7 @@ const DocumentsTab = (props) => {
setCheckedOriginItems((prev) => ({ setCheckedOriginItems((prev) => ({
...prev, ...prev,
[name]: checked, [name]: checked
})); }));
setSelectOriginAll(false); setSelectOriginAll(false);
}; };
@@ -404,7 +404,7 @@ const DocumentsTab = (props) => {
item.Label + item.Label +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item.Label || : item.Label ||
t( t(
@@ -477,7 +477,7 @@ const DocumentsTab = (props) => {
item.Label + item.Label +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item.Label || : item.Label ||
t( t(
@@ -496,7 +496,7 @@ const DocumentsTab = (props) => {
const checkedValues = [ const checkedValues = [
...document.querySelectorAll( ...document.querySelectorAll(
".govuk-checkboxes__input:checked" ".govuk-checkboxes__input:checked"
), )
].map((e) => e.value); ].map((e) => e.value);
const origins = checkedValues const origins = checkedValues
@@ -697,7 +697,7 @@ const DocumentsTab = (props) => {
incidentid + incidentid +
"')]", "')]",
json: item, json: item,
eval: true, eval: true
}); });
detailsObj = item; detailsObj = item;
return ( return (
@@ -831,7 +831,7 @@ const DocumentsTab = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: detailsObj[ : detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -946,7 +946,7 @@ const DocumentsTab = (props) => {
selectedDocumentType, selectedDocumentType,
selectedWeeks, selectedWeeks,
selectedDocumentOrigin, selectedDocumentOrigin,
props.setDocumentDetails, props.setDocumentDetails
] ]
); );
@@ -1081,7 +1081,7 @@ const DocumentsTab = (props) => {
getOrigin, getOrigin,
getDocumentResults, getDocumentResults,
lang, lang,
selectedWeeks, selectedWeeks
]); ]);
function countFieldValue(obj, field, targetValue) { function countFieldValue(obj, field, targetValue) {
@@ -1166,7 +1166,7 @@ const DocumentsTab = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
...state, ...state
}; };
}; };
@@ -1177,7 +1177,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
+11 -11
View File
@@ -4,9 +4,9 @@ import Link from "next/link";
import { bytesToSize } from "../../../components/utils"; import { bytesToSize } from "../../../components/utils";
import { import {
deleteMyRepresentationsFromBlob, deleteMyRepresentationsFromBlob,
deleteAwaitingSubmissionsFromBlob, deleteAwaitingSubmissionsFromBlob
sendRepCompleteMessage, } from "../../../actions/services/documentService";
} from "../../../actions"; import { sendRepCompleteMessage } from "../../../actions/services/portalService";
import { formatBlobDates } from "../utils/adminHelper"; import { formatBlobDates } from "../utils/adminHelper";
@@ -74,9 +74,9 @@ export default function StorageTab({ data, repCompleteCount }) {
showRepJson && folder.hasRepJson showRepJson && folder.hasRepJson
? { display: "block" } ? { display: "block" }
: showTmpFile && : showTmpFile &&
folder.hasTmpFile folder.hasTmpFile
? { display: "block" } ? { display: "block" }
: { display: "none" } : { display: "none" }
} }
> >
<h4>{folder.folderPath || "Root"}</h4> <h4>{folder.folderPath || "Root"}</h4>
@@ -150,7 +150,7 @@ export default function StorageTab({ data, repCompleteCount }) {
headers: headers:
{ {
"Content-Type": "Content-Type":
"application/json", "application/json"
}, },
body: JSON.stringify( body: JSON.stringify(
{ {
@@ -159,18 +159,18 @@ export default function StorageTab({ data, repCompleteCount }) {
blobName: blobName:
folder folder
.repJsonBlob .repJsonBlob
.name, .name
} }
), )
} }
); );
const result = const result =
await response.json(); await response.json();
if (response.ok) { if (response.ok) {
alert( (alert(
"repComplete removed!" "repComplete removed!"
), ),
window.location.reload(); window.location.reload());
// Optionally refresh the page or update UI state here // Optionally refresh the page or update UI state here
} else { } else {
alert( alert(
+4 -4
View File
@@ -67,7 +67,7 @@ export async function fetchAdminStorageData() {
const blobWithHash = { const blobWithHash = {
...blob, ...blob,
hashedfilepath, hashedfilepath,
isTmpFile, isTmpFile
}; };
let folderGroup = acc.find( let folderGroup = acc.find(
@@ -80,7 +80,7 @@ export async function fetchAdminStorageData() {
hasRepJson: false, hasRepJson: false,
repJsonBlob: null, repJsonBlob: null,
repComplete: false, repComplete: false,
hasTmpFile: false, hasTmpFile: false
}; };
acc.push(folderGroup); acc.push(folderGroup);
} }
@@ -137,7 +137,7 @@ export async function fetchAdminStorageData() {
? { ? {
id: user.id, id: user.id,
email: user.email, email: user.email,
containers: containersWithHashes, containers: containersWithHashes
} }
: null; : null;
}) })
@@ -150,7 +150,7 @@ export async function fetchAdminStorageData() {
.map((user) => ({ .map((user) => ({
id: user.id, id: user.id,
email: user.email, email: user.email,
created: user.emailVerified?.toLocaleString("en-GB") || "", created: user.emailVerified?.toLocaleString("en-GB") || ""
})); }));
let repCompleteCount = 0; let repCompleteCount = 0;
+19 -19
View File
@@ -12,8 +12,8 @@ import { sendGAEvent } from "@next/third-parties/google";
import { import {
getSearchDocumentDetails, getSearchDocumentDetails,
getSearchDocumentDetailsPaged, getSearchDocumentDetailsPaged,
getSearchDocumentTypes, getSearchDocumentTypes
} from "../../actions"; } from "../../actions/services/searchService";
import { setCurrentPage } from "../../store/currentView/action"; import { setCurrentPage } from "../../store/currentView/action";
import { setDocumentDetails } from "../../store/searchOutput/action"; import { setDocumentDetails } from "../../store/searchOutput/action";
@@ -32,7 +32,7 @@ const DocumentDetails = (props) => {
setDocumentDetails, setDocumentDetails,
setCurrentPage, setCurrentPage,
docsOffline, docsOffline,
showFilteredDocs, showFilteredDocs
} = props; } = props;
const router = useRouter(); const router = useRouter();
@@ -57,7 +57,7 @@ const DocumentDetails = (props) => {
setCheckedItems((prev) => ({ setCheckedItems((prev) => ({
...prev, ...prev,
[name]: checked, [name]: checked
})); }));
setSelectAll(false); setSelectAll(false);
}; };
@@ -132,7 +132,7 @@ const DocumentDetails = (props) => {
? jsonpath({ ? jsonpath({
path: '$..[?(@ && @.value=="All")].value_cy', path: '$..[?(@ && @.value=="All")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: "All"} : "All"}
</option> </option>
@@ -151,7 +151,7 @@ const DocumentDetails = (props) => {
item.pinswg_isharedocumentlocationsLabel + item.pinswg_isharedocumentlocationsLabel +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item.pinswg_isharedocumentlocationsLabel || : item.pinswg_isharedocumentlocationsLabel ||
t( t(
@@ -298,7 +298,7 @@ const DocumentDetails = (props) => {
incidentid + incidentid +
"')]", "')]",
json: item, json: item,
sanbox: {}, sanbox: {}
}); });
detailsObj = item; detailsObj = item;
return ( return (
@@ -330,7 +330,7 @@ const DocumentDetails = (props) => {
} }
key={key} key={key}
onClick={() => { onClick={() => {
toggleDownLoadLink(key), (toggleDownLoadLink(key),
sendGAEvent( sendGAEvent(
"event", "event",
"DownloadedFile", "DownloadedFile",
@@ -338,9 +338,9 @@ const DocumentDetails = (props) => {
caseReference: caseReference:
props.caseReference, props.caseReference,
filename: filename:
detailsObj.pinswg_name, detailsObj.pinswg_name
} }
); ));
}} }}
> >
<span className="results-visually-hidden"> <span className="results-visually-hidden">
@@ -388,7 +388,7 @@ const DocumentDetails = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: detailsObj[ : detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -554,7 +554,7 @@ const DocumentDetails = (props) => {
item.pinswg_isharedocumentlocationsLabel + item.pinswg_isharedocumentlocationsLabel +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item.pinswg_isharedocumentlocationsLabel || : item.pinswg_isharedocumentlocationsLabel ||
t( t(
@@ -574,7 +574,7 @@ const DocumentDetails = (props) => {
const data = [ const data = [
...document.querySelectorAll( ...document.querySelectorAll(
".govuk-checkboxes__input:checked" ".govuk-checkboxes__input:checked"
), )
].map((e) => e.value); ].map((e) => e.value);
setSelectedDocumentType(data); setSelectedDocumentType(data);
setCurrentPage(1); setCurrentPage(1);
@@ -710,7 +710,7 @@ const DocumentDetails = (props) => {
incidentid + incidentid +
"')]", "')]",
json: item, json: item,
eval: true, eval: true
}); });
detailsObj = item; detailsObj = item;
return ( return (
@@ -827,7 +827,7 @@ const DocumentDetails = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: detailsObj[ : detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -905,7 +905,7 @@ const DocumentDetails = (props) => {
props.incidentid, props.incidentid,
selectedOption, selectedOption,
selectedDocumentType, selectedDocumentType,
setDocumentDetails, setDocumentDetails
] ]
); );
@@ -1029,7 +1029,7 @@ const DocumentDetails = (props) => {
orderByState, orderByState,
getDocumentTypes, getDocumentTypes,
getDocumentResults, getDocumentResults,
lang, lang
]); ]);
return ( return (
<div className="govuk-grid-row"> <div className="govuk-grid-row">
@@ -1059,7 +1059,7 @@ const DocumentDetails = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
...state, ...state
}; };
}; };
@@ -1070,7 +1070,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
@@ -7,10 +7,10 @@ import { connect } from "react-redux";
import { useDropzone } from "react-dropzone"; import { useDropzone } from "react-dropzone";
import { import {
createWatchedCases, createWatchedCases,
sendEmail,
sendRepCompleteMessage, sendRepCompleteMessage,
setRepInvolvment, setRepInvolvment
} from "../../../actions"; } from "../../../actions/services/portalService";
import { sendEmail } from "../../../actions/services/notifyService";
import { setRepresentationReset } from "../../../store/currentView/action"; import { setRepresentationReset } from "../../../store/currentView/action";
const RepComplete = (props) => { const RepComplete = (props) => {
@@ -27,7 +27,7 @@ const RepComplete = (props) => {
setSubmitBack, setSubmitBack,
setRepresentationSubmitConfirmation, setRepresentationSubmitConfirmation,
setRepresentationMessageSent, setRepresentationMessageSent,
repFormData, repFormData
} = props; } = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => ( const files = acceptedFiles.map((file) => (
@@ -55,10 +55,10 @@ const RepComplete = (props) => {
"emailAddress": "emailAddress":
props.props.props.props.accountDetails.accountDetails props.props.props.props.accountDetails.accountDetails
.emailaddress1, .emailaddress1,
"linkExpiry": 10 * 60, "linkExpiry": 10 * 60
}; };
props.props.currentView.representationMessageSent != true && (props.props.currentView.representationMessageSent != true &&
(setRepInvolvment( (setRepInvolvment(
props.props.currentView.caseReference.incidentid, props.props.currentView.caseReference.incidentid,
props.props.props.props.accountDetails.accountDetails.contactid props.props.props.props.accountDetails.accountDetails.contactid
@@ -89,10 +89,10 @@ const RepComplete = (props) => {
? props.props.currentView.caseReference.repDetails ? props.props.currentView.caseReference.repDetails
.representationType .representationType
: props.props.currentView.caseReference : props.props.currentView.caseReference
.representationType, .representationType
}), }),
setRepresentationMessageSent(true)), setRepresentationMessageSent(true)),
window.scrollTo({ top: 0, behavior: "smooth" }); window.scrollTo({ top: 0, behavior: "smooth" }));
}); });
return ( return (
<div id="rep-appellant"> <div id="rep-appellant">
@@ -130,7 +130,7 @@ const mapStateToProps = (state) => {
currentView: state.currentView, currentView: state.currentView,
myRepresentations: state.myRepresentations, myRepresentations: state.myRepresentations,
initialValues: state.currentView.caseReference.repDetails, initialValues: state.currentView.caseReference.repDetails,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
//form: state.form, //form: state.form,
}; };
}; };
@@ -14,7 +14,7 @@ import {
deleteRepBlob, deleteRepBlob,
getFilesFromBlobHashed, getFilesFromBlobHashed,
getFilesFromBlobproxy getFilesFromBlobproxy
} from "../../../actions"; } from "../../../actions/services/documentService";
const LoadingMessage = () => <div>Loading the editor...</div>; const LoadingMessage = () => <div>Loading the editor...</div>;
+1 -1
View File
@@ -15,7 +15,7 @@ import {
getFilesFromBlobHashed, getFilesFromBlobHashed,
uploadSingleFile, uploadSingleFile,
getFilesFromBlobproxy getFilesFromBlobproxy
} from "../../actions"; } from "../../actions/services/documentService";
import fieldLookup from "../../data/crmfieldlookuptranslations.json"; import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import pickListLookup from "../../data/picklistLookups.json"; import pickListLookup from "../../data/picklistLookups.json";
@@ -7,7 +7,7 @@ import { connect } from "react-redux";
import { import {
deleteAwaitingSubmissionsFromBlob, deleteAwaitingSubmissionsFromBlob,
getAwaitingSubmissionFromBlobProxy getAwaitingSubmissionFromBlobProxy
} from "../../actions"; } from "../../actions/services/documentService";
import { getFormCollectionByID } from "../../components/utils"; import { getFormCollectionByID } from "../../components/utils";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
+58 -52
View File
@@ -10,22 +10,22 @@ import {
deleteWatchedCases, deleteWatchedCases,
getAwaitingSubmissionProxy, getAwaitingSubmissionProxy,
getPortalModuleDetailsProxy, getPortalModuleDetailsProxy,
getWatchedCasesProxy, getWatchedCasesProxy
} from "../../actions"; } from "../../actions/services/portalService";
import { getFormCollectionByID, getDetailsProxy } from "../../components/utils"; import { getFormCollectionByID, getDetailsProxy } from "../../components/utils";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
setAwaitingSubmission, setAwaitingSubmission,
setAwaitingSubmissionDetails, setAwaitingSubmissionDetails
} from "../../store/awaitingSubmission/action"; } from "../../store/awaitingSubmission/action";
import { setCurrentReference } from "../../store/currentView/action"; import { setCurrentReference } from "../../store/currentView/action";
import { import {
setSearchDetails, setSearchDetails,
setSearchResults, setSearchResults
} from "../../store/searchOutput/action"; } from "../../store/searchOutput/action";
import { import {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { planningappeals78_pdf } from "../../components/pdftemplates/planningappeals78_pdf"; import { planningappeals78_pdf } from "../../components/pdftemplates/planningappeals78_pdf";
@@ -47,7 +47,7 @@ const TopThree = (props) => {
setAwaitingSubmissionDetails, setAwaitingSubmissionDetails,
setSearchResults, setSearchResults,
setSearchDetails, setSearchDetails,
showLoginCheck, showLoginCheck
} = props; } = props;
const router = useRouter(); const router = useRouter();
@@ -132,19 +132,19 @@ const TopThree = (props) => {
let newObj = {}; let newObj = {};
return Object.assign(newObj, { return Object.assign(newObj, {
"@odata.count": required.length, "@odata.count": required.length,
"value": required, "value": required
}); });
}; };
let filteredWatchedCases = showWatchedCases(data); let filteredWatchedCases = showWatchedCases(data);
setWatchedCases(filteredWatchedCases), (setWatchedCases(filteredWatchedCases),
getDetailsProxy( getDetailsProxy(
filteredWatchedCases, filteredWatchedCases,
"myWatchedCases" "myWatchedCases"
).then((data) => { ).then((data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
}); }));
}); });
}); });
@@ -156,7 +156,7 @@ const TopThree = (props) => {
.then(() => { .then(() => {
getAwaitingSubmissionProxy(cookies.pinsUser).then( getAwaitingSubmissionProxy(cookies.pinsUser).then(
(data) => { (data) => {
setAwaitingSubmission(data), (setAwaitingSubmission(data),
getDetailsProxy( getDetailsProxy(
data, data,
"awaitingSubmission" "awaitingSubmission"
@@ -166,7 +166,7 @@ const TopThree = (props) => {
// data // data
// ); // );
setAwaitingSubmissionDetails(data); setAwaitingSubmissionDetails(data);
}); }));
} }
); );
}); });
@@ -196,7 +196,7 @@ const TopThree = (props) => {
const res = await fetch("/api/file/generateappealpdfcopy", { const res = await fetch("/api/file/generateappealpdfcopy", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ docProps }), body: JSON.stringify({ docProps })
}); });
if (!res.ok) throw new Error("PDF generation failed"); if (!res.ok) throw new Error("PDF generation failed");
@@ -287,25 +287,25 @@ const TopThree = (props) => {
"&inid=" + "&inid=" +
showTopThreeArr[key].incidentid showTopThreeArr[key].incidentid
: router.locale == "cy" : router.locale == "cy"
? "/fymhorth/achos/" + ? "/fymhorth/achos/" +
showTopThreeArr[key].ticketnumber + showTopThreeArr[key].ticketnumber +
"?key=" + "?key=" +
topThreeType + topThreeType +
"&appealType=" + "&appealType=" +
showTopThreeArr[key] showTopThreeArr[key]
.pinswg_appealcasetype .pinswg_appealcasetype
: "/myportal/case/" + : "/myportal/case/" +
showTopThreeArr[key].ticketnumber + showTopThreeArr[key].ticketnumber +
"?key=" + "?key=" +
topThreeType + topThreeType +
"&appealType=" + "&appealType=" +
showTopThreeArr[key] showTopThreeArr[key]
.pinswg_appealcasetype .pinswg_appealcasetype
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
data-id={index} data-id={index}
onClick={() => { onClick={() => {
setSearchResults( (setSearchResults(
props.props[topThreeType][topThreeType] props.props[topThreeType][topThreeType]
), ),
setSearchDetails( setSearchDetails(
@@ -337,8 +337,8 @@ const TopThree = (props) => {
"appealType": "appealType":
showTopThreeArr[key] showTopThreeArr[key]
.pinswg_appealcasetype, .pinswg_appealcasetype
}); }));
}} }}
> >
{showTopThreeArr[key].pinswg_title} {showTopThreeArr[key].pinswg_title}
@@ -423,7 +423,7 @@ const TopThree = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key][ : showTopThreeArr[key][
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
@@ -436,26 +436,32 @@ const TopThree = (props) => {
{_.isEmpty(showTopThreeArr[key]) {_.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: _.isEmpty(showTopThreeArr[key]) : _.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: _.isEmpty(showTopThreeArr[key]) : _.isEmpty(showTopThreeArr[key])
? t("myportal:case-address-not-entered") ? t("myportal:case-address-not-entered")
: _.isEmpty( : _.isEmpty(
showTopThreeArr[key].pinswg_siteaddressline1 showTopThreeArr[key]
) .pinswg_siteaddressline1
? t("myportal:case-address-not-entered") )
: showTopThreeArr[key].pinswg_siteaddressline1 + ? t("myportal:case-address-not-entered")
(!_.isEmpty( : showTopThreeArr[key]
showTopThreeArr[key].pinswg_siteaddressline2 .pinswg_siteaddressline1 +
) (!_.isEmpty(
? ", " + showTopThreeArr[key]
showTopThreeArr[key].pinswg_siteaddressline2 .pinswg_siteaddressline2
: "") + )
(!_.isEmpty( ? ", " +
showTopThreeArr[key].pinswg_siteaddresstown showTopThreeArr[key]
) .pinswg_siteaddressline2
? ", " + : "") +
showTopThreeArr[key].pinswg_siteaddresstown (!_.isEmpty(
: "")} showTopThreeArr[key]
.pinswg_siteaddresstown
)
? ", " +
showTopThreeArr[key]
.pinswg_siteaddresstown
: "")}
</div> </div>
{showTopThreeArr[key].pinswg_appellantagent != null && ( {showTopThreeArr[key].pinswg_appellantagent != null && (
<div className="cardModuleReference"> <div className="cardModuleReference">
@@ -495,7 +501,7 @@ const TopThree = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key][ : showTopThreeArr[key][
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -591,7 +597,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setSearchDetails: (searchDetails) => { setSearchDetails: (searchDetails) => {
dispatch(setSearchDetails(searchDetails)); dispatch(setSearchDetails(searchDetails));
}, }
}; };
}; };
+45 -43
View File
@@ -6,30 +6,32 @@ import { parseCookies } from "nookies";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { import {
deleteAwaitingSubmissions, deleteAwaitingSubmissions,
deleteMyRepresentationsFromBlob,
deleteWatchedCases, deleteWatchedCases,
getAwaitingSubmissionProxy, getAwaitingSubmissionProxy,
getPortalModuleDetailsProxy, getWatchedCasesProxy
getRepsFromBlobProxy, } from "../../actions/services/portalService";
getWatchedCasesProxy, import {
} from "../../actions"; deleteMyRepresentationsFromBlob,
getRepsFromBlobProxy
} from "../../actions/services/documentService";
import { consoleLogger } from "../../actions/core/logger";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
setAwaitingSubmission, setAwaitingSubmission,
setAwaitingSubmissionDetails, setAwaitingSubmissionDetails
} from "../../store/awaitingSubmission/action"; } from "../../store/awaitingSubmission/action";
import { import {
setCurrentReference, setCurrentReference,
setCurrentView, setCurrentView,
setRepresentationCapacity, setRepresentationCapacity
} from "../../store/currentView/action"; } from "../../store/currentView/action";
import { import {
setMyRepresentations, setMyRepresentations,
setMyRepresentationsDetails, setMyRepresentationsDetails
} from "../../store/myRepresentations/action"; } from "../../store/myRepresentations/action";
import { import {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails
} from "../../store/watchedCases/action"; } from "../../store/watchedCases/action";
import { getFormCollectionByID, getDetailsProxy } from "../utils"; import { getFormCollectionByID, getDetailsProxy } from "../utils";
@@ -46,7 +48,7 @@ const TopThree = (props) => {
setAwaitingSubmissionDetails, setAwaitingSubmissionDetails,
setMyRepresentations, setMyRepresentations,
setMyRepresentationsDetails, setMyRepresentationsDetails,
setRepresentationCapacity, setRepresentationCapacity
} = props; } = props;
const router = useRouter(); const router = useRouter();
@@ -80,12 +82,12 @@ const TopThree = (props) => {
.then((data) => data) .then((data) => data)
.then(() => { .then(() => {
getWatchedCasesProxy(cookies.pinsUser).then((data) => { getWatchedCasesProxy(cookies.pinsUser).then((data) => {
setWatchedCases(data), (setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then( getDetailsProxy(data, "myWatchedCases").then(
(data) => { (data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
} }
); ));
}); });
}); });
@@ -97,7 +99,7 @@ const TopThree = (props) => {
.then(() => { .then(() => {
getAwaitingSubmissionProxy(cookies.pinsUser).then( getAwaitingSubmissionProxy(cookies.pinsUser).then(
(data) => { (data) => {
setAwaitingSubmission(data), (setAwaitingSubmission(data),
getDetailsProxy( getDetailsProxy(
data, data,
"awaitingSubmission" "awaitingSubmission"
@@ -107,7 +109,7 @@ const TopThree = (props) => {
// data // data
// ); // );
setAwaitingSubmissionDetails(data); setAwaitingSubmissionDetails(data);
}); }));
} }
); );
}); });
@@ -136,12 +138,12 @@ const TopThree = (props) => {
}) })
.catch((error) => { .catch((error) => {
consoleLogger(error); consoleLogger(error);
res.status(400).json(error); return null;
}) })
.then(() => { .then(() => {
setCurrentView({ setCurrentView({
"viewName": "My Representations", "viewName": "My Representations",
"viewKey": "myRepresentations", "viewKey": "myRepresentations"
}); });
}); });
}); });
@@ -211,7 +213,7 @@ const TopThree = (props) => {
style={{ style={{
color: "#0360a6", color: "#0360a6",
cursor: "pointer", cursor: "pointer",
fontWeight: "bold", fontWeight: "bold"
}} }}
data-id={index} data-id={index}
onClick={() => { onClick={() => {
@@ -225,7 +227,7 @@ const TopThree = (props) => {
showTopThreeArr[key].incidentID, showTopThreeArr[key].incidentID,
"appealType": "appealType":
showTopThreeArr[key].appealType, showTopThreeArr[key].appealType,
"repDetails": showTopThreeArr[key], "repDetails": showTopThreeArr[key]
}); });
isLPA && setRepresentationCapacity("LPA"); isLPA && setRepresentationCapacity("LPA");
router.push({ router.push({
@@ -239,8 +241,8 @@ const TopThree = (props) => {
state: "edit", state: "edit",
created: created:
showTopThreeArr[key] showTopThreeArr[key]
.repfile_name, .repfile_name
}, }
}); });
}} }}
> >
@@ -294,7 +296,7 @@ const TopThree = (props) => {
showTopThreeArr[key].representationType + showTopThreeArr[key].representationType +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key].representationType || ""} : showTopThreeArr[key].representationType || ""}
</div> </div>
@@ -312,27 +314,27 @@ const TopThree = (props) => {
.representationCapacity + .representationCapacity +
'" )].value_cy', '" )].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: jsonpath({ : jsonpath({
path: path:
'$..[?(@ && @.value_cy=="' + '$..[?(@ && @.value_cy=="' +
showTopThreeArr[key] showTopThreeArr[key]
.representationCapacity + .representationCapacity +
'")].value', '")].value',
json: transLookup, json: transLookup,
eval: true, eval: true
}).length > 0 }).length > 0
? jsonpath({ ? jsonpath({
path: path:
'$..[?(@ && @.value_cy=="' + '$..[?(@ && @.value_cy=="' +
showTopThreeArr[key] showTopThreeArr[key]
.representationCapacity + .representationCapacity +
'")].value', '")].value',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key].representationCapacity} : showTopThreeArr[key].representationCapacity}
</div> </div>
<div className="cardModuleReference"> <div className="cardModuleReference">
<b>{t("myportal:date-raised")}:</b> <b>{t("myportal:date-raised")}:</b>
@@ -352,7 +354,7 @@ const TopThree = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: showTopThreeArr[key][ : showTopThreeArr[key][
"_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue"
@@ -400,7 +402,7 @@ const TopThree = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
// currentView: state.currentView, // currentView: state.currentView,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
// search: state.search, // search: state.search,
// searchResultsObj: state.searchResultsObj, // searchResultsObj: state.searchResultsObj,
}; };
@@ -431,7 +433,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setRepresentationCapacity: (representationCapacity) => { setRepresentationCapacity: (representationCapacity) => {
dispatch(setRepresentationCapacity(representationCapacity)); dispatch(setRepresentationCapacity(representationCapacity));
}, }
}; };
}; };
+4 -2
View File
@@ -3,10 +3,12 @@ import { v4 as uuidv4 } from "uuid";
import { import {
getBasicPartSavedDetails, getBasicPartSavedDetails,
getBasicSearchDetails, getBasicSearchDetails,
getBasicSearchDetailsPaged, getBasicSearchDetailsPaged
} from "../../actions/services/searchService";
import {
getPortalModuleDetailsProxy, getPortalModuleDetailsProxy,
getPortalModuleDetails getPortalModuleDetails
} from "../../actions"; } from "../../actions/services/caseService";
import data from "../../data/collections.json"; import data from "../../data/collections.json";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
+13 -11
View File
@@ -2,14 +2,16 @@
import { getSession } from "next-auth/react"; import { getSession } from "next-auth/react";
import { import {
getAppealsTypesForNewAppeal, getAppealsTypesForNewAppeal,
getMandatoryFields,
getPickLists
} from "../../actions/services/referenceDataService";
import {
getAwaitingSubmissionFromBlob, getAwaitingSubmissionFromBlob,
getFilesFromBlob, getFilesFromBlob,
getIP, getProgressFromBlob
getMandatoryFields, } from "../../actions/services/documentService";
getPickLists, import { getPersonalAccount } from "../../actions/services/accountService";
getProgressFromBlob, import { getIP } from "../../actions/core/logger";
getPersonalAccount,
} from "../../actions";
import { readFormXml } from "../forms/readFormXml"; import { readFormXml } from "../forms/readFormXml";
import { requireQueryParams } from "../routing/requireQueryParams"; import { requireQueryParams } from "../routing/requireQueryParams";
@@ -27,7 +29,7 @@ export async function loadMyPortalAppealPage(ctx) {
const required = requireQueryParams(query, [ const required = requireQueryParams(query, [
"appealtypes", "appealtypes",
"apt", "apt",
"casereference", "casereference"
]); ]);
if (!required.ok) { if (!required.ok) {
return { redirect: required.redirect }; return { redirect: required.redirect };
@@ -38,8 +40,8 @@ export async function loadMyPortalAppealPage(ctx) {
return { return {
redirect: { redirect: {
destination: "/auth/signin", destination: "/auth/signin",
permanent: false, permanent: false
}, }
}; };
} }
@@ -56,7 +58,7 @@ export async function loadMyPortalAppealPage(ctx) {
getAppealsTypesForNewAppeal(), getAppealsTypesForNewAppeal(),
getMandatoryFields(query.appealtypes), getMandatoryFields(query.appealtypes),
getPickLists(query.appealtypes), getPickLists(query.appealtypes),
getFilesFromBlob(loggedInUserIdent, query.casereference), getFilesFromBlob(loggedInUserIdent, query.casereference)
]); ]);
const blobProgress = await getProgressFromBlob( const blobProgress = await getProgressFromBlob(
@@ -86,6 +88,6 @@ export async function loadMyPortalAppealPage(ctx) {
blobProgress, blobProgress,
accountDetails, accountDetails,
awaitingSubmissionFromBlob, awaitingSubmissionFromBlob,
xmlStr, xmlStr
}; };
} }
+9 -9
View File
@@ -2,12 +2,12 @@
import { getSession } from "next-auth/react"; import { getSession } from "next-auth/react";
import { import {
getAppealsTypesForNewAppeal, getAppealsTypesForNewAppeal,
getIP,
getMandatoryFields, getMandatoryFields,
getPickLists, getPickLists
getProgressFromBlob, } from "../../actions/services/referenceDataService";
getPersonalAccount, import { getProgressFromBlob } from "../../actions/services/documentService";
} from "../../actions"; import { getPersonalAccount } from "../../actions/services/accountService";
import { getIP } from "../../actions/core/logger";
import { readFormXml } from "../forms/readFormXml"; import { readFormXml } from "../forms/readFormXml";
import { requireQueryParams } from "../routing/requireQueryParams"; import { requireQueryParams } from "../routing/requireQueryParams";
@@ -32,8 +32,8 @@ export async function loadNewAppealPage(ctx) {
return { return {
redirect: { redirect: {
destination: "/auth/signin", destination: "/auth/signin",
permanent: false, permanent: false
}, }
}; };
} }
@@ -46,7 +46,7 @@ export async function loadNewAppealPage(ctx) {
await Promise.all([ await Promise.all([
getAppealsTypesForNewAppeal(), getAppealsTypesForNewAppeal(),
getMandatoryFields(query.appealtypes), getMandatoryFields(query.appealtypes),
getPickLists(query.appealtypes), getPickLists(query.appealtypes)
]); ]);
const blobProgress = await getProgressFromBlob(loggedInUserIdent, query.id); const blobProgress = await getProgressFromBlob(loggedInUserIdent, query.id);
@@ -64,6 +64,6 @@ export async function loadNewAppealPage(ctx) {
pickListData, pickListData,
blobProgress, blobProgress,
accountDetails, accountDetails,
xmlStr, xmlStr
}; };
} }