refactor phase 3a components chunk 1 targeted actions imports

This commit is contained in:
2026-03-12 12:13:29 +00:00
parent be59237ec9
commit a0a633a9ea
14 changed files with 208 additions and 186 deletions
+5 -5
View File
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import React, { useState } from "react"; import React, { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Field, formValueSelector, reduxForm } from "redux-form"; import { Field, formValueSelector, reduxForm } from "redux-form";
import { updatePassword } from "../../actions"; import { updatePassword } from "../../actions/services/accountService";
const RenderTextfield = ({ const RenderTextfield = ({
id, id,
@@ -60,7 +60,7 @@ const ChangePassword = (props) => {
handleSubmit, handleSubmit,
value, value,
setPasswordUpdated, setPasswordUpdated,
passwordUpdated, passwordUpdated
} = props; } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
@@ -158,7 +158,7 @@ const mapStateToProps = (state) => {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
//form: state.form, //form: state.form,
}; };
}; };
@@ -167,7 +167,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentSection: (currentSection) => { setCurrentSection: (currentSection) => {
dispatch(setCurrentSection(currentSection)); dispatch(setCurrentSection(currentSection));
}, }
}; };
}; };
@@ -179,6 +179,6 @@ export default connect(
)( )(
reduxForm({ reduxForm({
form: "changepasswordForm", form: "changepasswordForm",
destroyOnUnmount: false, destroyOnUnmount: false
})(ChangePassword) })(ChangePassword)
); );
@@ -3,7 +3,7 @@ import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { updateAccount } from "../../actions"; import { updateAccount } from "../../actions/services/accountService";
import { setCookie } from "nookies"; import { setCookie } from "nookies";
const PersonalDetailsComplete = (props) => { const PersonalDetailsComplete = (props) => {
@@ -11,7 +11,7 @@ const PersonalDetailsComplete = (props) => {
handleSubmit, handleSubmit,
value, value,
setRegisterFormComplete, setRegisterFormComplete,
setAccountCreatedComplete, setAccountCreatedComplete
} = props; } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
@@ -41,7 +41,7 @@ const PersonalDetailsComplete = (props) => {
console.log("=============== pref lang", prefLang); console.log("=============== pref lang", prefLang);
setCookie(null, "pedw_locale", userLang, { setCookie(null, "pedw_locale", userLang, {
path: "/", path: "/",
maxAge: 60 * 60 * 24 * 365, maxAge: 60 * 60 * 24 * 365
}); });
console.log("Set cookie to:", userLang); console.log("Set cookie to:", userLang);
@@ -79,7 +79,7 @@ const mapStateToProps = (state) => {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
//form: state.form, //form: state.form,
}; };
}; };
@@ -88,7 +88,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentSection: (currentSection) => { setCurrentSection: (currentSection) => {
dispatch(setCurrentSection(currentSection)); dispatch(setCurrentSection(currentSection));
}, }
}; };
}; };
+10 -7
View File
@@ -8,7 +8,10 @@ import { connect } from "react-redux";
import { setAccCr, setLogout } from "../../store/accountDetails/action"; import { setAccCr, setLogout } from "../../store/accountDetails/action";
import { createAccount, getEmailAccountCheck } from "../../actions"; import {
createAccount,
getEmailAccountCheck
} from "../../actions/services/accountService";
const RegisterComplete = (props) => { const RegisterComplete = (props) => {
const { const {
@@ -18,7 +21,7 @@ const RegisterComplete = (props) => {
value, value,
setRegisterFormComplete, setRegisterFormComplete,
setAccountCreatedComplete, setAccountCreatedComplete,
setAccCr, setAccCr
} = props; } = props;
let { t, lang } = useTranslation(); let { t, lang } = useTranslation();
@@ -34,7 +37,7 @@ const RegisterComplete = (props) => {
// was an appellant "pinswg_typeofinvolvement": 846040001, // was an appellant "pinswg_typeofinvolvement": 846040001,
Object.assign(accountBody, { Object.assign(accountBody, {
"pinswg_typeofinvolvement": 846040061, "pinswg_typeofinvolvement": 846040061
}); });
accountBody = _.omit(accountBody, ["custom_password_check"]); accountBody = _.omit(accountBody, ["custom_password_check"]);
@@ -105,9 +108,9 @@ const RegisterComplete = (props) => {
<p className="govuk-body"> <p className="govuk-body">
<a <a
onClick={() => { onClick={() => {
setRegisterFormComplete(false), (setRegisterFormComplete(false),
setAccountCreatedComplete(false), setAccountCreatedComplete(false),
setAccCr(false); setAccCr(false));
}} }}
className="govuk-link" className="govuk-link"
> >
@@ -130,7 +133,7 @@ const mapStateToProps = (state) => {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
accountDetails: state.accountDetails, accountDetails: state.accountDetails
//form: state.form, //form: state.form,
}; };
}; };
@@ -142,7 +145,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setLogout: () => { setLogout: () => {
dispatch(setLogout()); dispatch(setLogout());
}, }
}; };
}; };
+31 -30
View File
@@ -9,14 +9,15 @@ import { connect } from "react-redux";
import { import {
setSearchResults, setSearchResults,
setSearchDetails, setSearchDetails
} from "../../../store/searchOutput/action"; } from "../../../store/searchOutput/action";
import { getDetailsProxy, getSearchDetailsPaged } from "../../utils"; import { getDetailsProxy, getSearchDetailsPaged } from "../../utils";
import { getAdvancedSearchPaged, getNewAppealsPage } from "../../../actions"; import { getAdvancedSearchPaged } from "../../../actions/services/searchService";
import { getNewAppealsPage } from "../../../actions/services/adminService";
import { import {
setCurrentPage, setCurrentPage,
setCurrentReference, setCurrentReference
} from "../../../store/currentView/action"; } from "../../../store/currentView/action";
function AppealsTab(props) { function AppealsTab(props) {
@@ -86,7 +87,7 @@ function AppealsTab(props) {
searchString, searchString,
selectedOption, selectedOption,
props.setSearchDetails, props.setSearchDetails,
props.setSearchResults, props.setSearchResults
] ]
); );
@@ -105,7 +106,7 @@ function AppealsTab(props) {
orderByState, orderByState,
searchLoaded, searchLoaded,
getSearchPageResults, getSearchPageResults,
router.query, router.query
]); ]);
const ResultsView = (resultsArr) => { const ResultsView = (resultsArr) => {
@@ -225,7 +226,7 @@ function AppealsTab(props) {
item.ticketnumber + item.ticketnumber +
'")]', '")]',
json: searchDetailsObj, json: searchDetailsObj,
eval: true, eval: true
}); });
detailsObj = detailsObj[0] || {}; detailsObj = detailsObj[0] || {};
@@ -246,8 +247,8 @@ function AppealsTab(props) {
? "/fymhorth/achos" ? "/fymhorth/achos"
: "/achos" : "/achos"
: myportal == true : myportal == true
? "/myportal/case" ? "/myportal/case"
: "/case") + : "/case") +
"/" + "/" +
item.ticketnumber item.ticketnumber
} }
@@ -272,10 +273,10 @@ function AppealsTab(props) {
) )
? detailsObj.pinswg_speacialistcaseprocess ? detailsObj.pinswg_speacialistcaseprocess
: detailsObj.hasOwnProperty( : detailsObj.hasOwnProperty(
"pinswg_specialistcaseprocess" "pinswg_specialistcaseprocess"
) )
? detailsObj.pinswg_specialistcaseprocess ? detailsObj.pinswg_specialistcaseprocess
: "", : ""
}); });
}} }}
> >
@@ -314,12 +315,12 @@ function AppealsTab(props) {
) < 0 ) < 0
? detailsObj.pinswg_projectlocation ? detailsObj.pinswg_projectlocation
: router.locale == "cy" : router.locale == "cy"
? detailsObj.pinswg_projectlocation.split( ? detailsObj.pinswg_projectlocation.split(
";" ";"
)[1] )[1]
: detailsObj.pinswg_projectlocation.split( : detailsObj.pinswg_projectlocation.split(
";" ";"
)[0] )[0]
: "" : ""
: ""} : ""}
{_.has( {_.has(
@@ -396,12 +397,12 @@ function AppealsTab(props) {
" " + " " +
item.pinswg_appellantlastname item.pinswg_appellantlastname
: _.has(detailsObj, [ : _.has(detailsObj, [
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue", "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]) ])
? detailsObj[ ? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
] ]
: ""} : ""}
</dd> </dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16"> <dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden"> <span className="results-visually-hidden">
@@ -411,7 +412,7 @@ function AppealsTab(props) {
: :
</span> </span>
{_.has(item, [ {_.has(item, [
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
]) ])
? router.locale == "cy" ? router.locale == "cy"
? jsonpath({ ? jsonpath({
@@ -422,7 +423,7 @@ function AppealsTab(props) {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -445,7 +446,7 @@ function AppealsTab(props) {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
@@ -468,7 +469,7 @@ function AppealsTab(props) {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"statuscode@OData.Community.Display.V1.FormattedValue" "statuscode@OData.Community.Display.V1.FormattedValue"
@@ -555,13 +556,13 @@ const mapDispatchToProps = (dispatch) => {
}, },
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj
}; };
}; };
+5 -1
View File
@@ -6,7 +6,11 @@ import { connect } from "react-redux";
import { reduxForm } from "redux-form"; import { reduxForm } from "redux-form";
import { useSession } from "next-auth/react"; import { useSession } from "next-auth/react";
import { generateRepPDF, sendEmail, uploadRepFiles } from "../../../actions"; import {
generateRepPDF,
uploadRepFiles
} from "../../../actions/services/documentService";
import { sendEmail } from "../../../actions/services/notifyService";
import { formatDates, updateLinks } from "../../../components/utils"; import { formatDates, updateLinks } from "../../../components/utils";
import { import {
setRepresentationCapacity, setRepresentationCapacity,
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import { useState } from "react"; import { useState } from "react";
import { useDropzone } from "react-dropzone"; import { useDropzone } from "react-dropzone";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { generateRepPDF } from "../../../actions"; import { generateRepPDF } from "../../../actions/services/documentService";
import RepComplete from "./representationComplete"; import RepComplete from "./representationComplete";
import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement"; import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement";
import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78"; import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78";
+5 -5
View File
@@ -6,7 +6,7 @@ import { useEffect, useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { getRepresentations } from "../../actions"; import { getRepresentations } from "../../actions/services/portalService";
import { setRepresentations } from "../../store/searchOutput/action"; import { setRepresentations } from "../../store/searchOutput/action";
import { formatDates } from "../utils"; import { formatDates } from "../utils";
@@ -63,7 +63,7 @@ const RepresentationList = (props) => {
incidentid + incidentid +
"')]", "')]",
json: item, json: item,
eval: true, eval: true
}); });
detailsObj = item; detailsObj = item;
@@ -97,7 +97,7 @@ const RepresentationList = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
sanbox: {}, sanbox: {}
}) })
: detailsObj[ : detailsObj[
"pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue"
@@ -216,7 +216,7 @@ const RepresentationList = (props) => {
const mapStateToProps = (state) => { const mapStateToProps = (state) => {
return { return {
...state, ...state
}; };
}; };
@@ -224,7 +224,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setRepresentations: (representationObj) => { setRepresentations: (representationObj) => {
dispatch(setRepresentations(representationObj)); dispatch(setRepresentations(representationObj));
}, }
}; };
}; };
+12 -12
View File
@@ -4,7 +4,7 @@ import { useMemo, useState } from "react";
import Dropzone from "react-dropzone"; import Dropzone from "react-dropzone";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Field, reduxForm } from "redux-form"; import { Field, reduxForm } from "redux-form";
import { uploadFiles } from "../../actions"; import { uploadFiles } from "../../actions/services/documentService";
import { bytesToSize } from "../utils"; import { bytesToSize } from "../utils";
const required = (errorMsg) => (value) => const required = (errorMsg) => (value) =>
@@ -79,25 +79,25 @@ const baseStyle = {
color: "#bdbdbd", color: "#bdbdbd",
transition: "border .3s ease-in-out", transition: "border .3s ease-in-out",
width: "80%", width: "80%",
margin: "20px auto 30px", margin: "20px auto 30px"
}; };
const activeStyle = { const activeStyle = {
borderColor: "#2196f3", borderColor: "#2196f3"
}; };
const acceptStyle = { const acceptStyle = {
borderColor: "#00e676", borderColor: "#00e676"
}; };
const rejectStyle = { const rejectStyle = {
borderColor: "#ff1744", borderColor: "#ff1744"
}; };
const RenderFileUpload = (field) => { const RenderFileUpload = (field) => {
const files = field.input.value; const files = field.input.value;
const style = useMemo( const style = useMemo(
() => ({ () => ({
...baseStyle, ...baseStyle
// ...(isDragActive ? activeStyle : {}), // ...(isDragActive ? activeStyle : {}),
// ...(isDragAccept ? acceptStyle : {}), // ...(isDragAccept ? acceptStyle : {}),
// ...(isDragReject ? rejectStyle : {}), // ...(isDragReject ? rejectStyle : {}),
@@ -220,7 +220,7 @@ const RenderFileUpload = (field) => {
field.documentTypeCode field.documentTypeCode
)}_${file.name}`, )}_${file.name}`,
{ {
type: file.type, type: file.type
} }
) )
); );
@@ -323,7 +323,7 @@ let UploadFile = (props) => {
t( t(
"myportal:searchcases-validation-minlength" "myportal:searchcases-validation-minlength"
) )
), )
]} ]}
className="govuk-input" className="govuk-input"
component={RenderTextfield} component={RenderTextfield}
@@ -428,11 +428,11 @@ const mapStateToProps = (state) => {
"pinswg_developmentdescription": "something to go here", "pinswg_developmentdescription": "something to go here",
"pinswg_agriculturalholding": 846040000, "pinswg_agriculturalholding": 846040000,
"_pinswg_planningappeals78ids_value": "_pinswg_planningappeals78ids_value":
"50b533aa-43f1-ec11-aade-00224800be9c", "50b533aa-43f1-ec11-aade-00224800be9c"
}, },
initialValues: { initialValues: {
caseReference: "CAS-00764-L0Q9W2", caseReference: "CAS-00764-L0Q9W2"
}, }
}; };
}; };
@@ -447,6 +447,6 @@ export default connect(
reduxForm({ reduxForm({
form: "uploadFileForm", form: "uploadFileForm",
destroyOnUnmount: false, destroyOnUnmount: false,
enableReinitialize: true, // this is needed!! enableReinitialize: true // this is needed!!
})(UploadFile) })(UploadFile)
); );
+11 -10
View File
@@ -9,16 +9,17 @@ import xpath from "xpath";
import fieldLookup from "../../data/crmfieldlookuptranslations.json"; import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import { import {
setCurrentSection, setCurrentSection,
setFormComplete, setFormComplete
} from "../../store/appealType/action"; } from "../../store/appealType/action";
import BuildCheckRow from "./buildcheckrow"; import BuildCheckRow from "./buildcheckrow";
import { generateAppealPDF, sendCaseCompleteMessage } from "../../actions"; import { generateAppealPDF } from "../../actions/services/documentService";
import { sendCaseCompleteMessage } from "../../actions/services/portalService";
import { import {
bytesToSize, bytesToSize,
getThumbnailIconByExtension, getThumbnailIconByExtension,
updateLinks, updateLinks,
getDocLink, getDocLink
} from "../utils"; } from "../utils";
let BuildCheckSection = (props) => { let BuildCheckSection = (props) => {
@@ -40,7 +41,7 @@ let BuildCheckSection = (props) => {
setCurrentSection, setCurrentSection,
updateCurrentSection, updateCurrentSection,
mandatoryFieldsData, mandatoryFieldsData,
docsOffline, docsOffline
} = props; } = props;
const parser = new DOMParser(); const parser = new DOMParser();
@@ -118,7 +119,7 @@ let BuildCheckSection = (props) => {
Object.assign(pdfObj, { Object.assign(pdfObj, {
"filesList": buildAppealFilesArray, "filesList": buildAppealFilesArray,
"containerID": props.props.accountDetails.containerID, "containerID": props.props.accountDetails.containerID,
"casefolderID": props.appealType.caseReference.ticketnumber, "casefolderID": props.appealType.caseReference.ticketnumber
}); });
const [confirmSections, setConfirmSections] = useState(false); const [confirmSections, setConfirmSections] = useState(false);
@@ -132,7 +133,7 @@ let BuildCheckSection = (props) => {
let formObj = jsonpath({ let formObj = jsonpath({
path: "$['" + appealtypes + "']", path: "$['" + appealtypes + "']",
json: fieldLookup, json: fieldLookup,
eval: true, eval: true
}); });
let labelTrans = let labelTrans =
@@ -140,7 +141,7 @@ let BuildCheckSection = (props) => {
? jsonpath({ ? jsonpath({
path: '$..[?(@ && @.value=="' + label + '")].value_cy', path: '$..[?(@ && @.value=="' + label + '")].value_cy',
json: formObj, json: formObj,
eval: true, eval: true
}) })
: label; : label;
return labelTrans; return labelTrans;
@@ -393,7 +394,7 @@ const mapStateToProps = (state) => {
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
form: state.form, form: state.form
}; };
}; };
@@ -405,7 +406,7 @@ const mapDispatchToProps = (dispatch) => {
updateCurrentSection: (whichSection) => { updateCurrentSection: (whichSection) => {
dispatch(setCurrentSection(whichSection)); dispatch(setCurrentSection(whichSection));
dispatch(setFormComplete("true")); dispatch(setFormComplete("true"));
}, }
}; };
}; };
@@ -424,6 +425,6 @@ export default connect(
reduxForm({ reduxForm({
form: "appealForm", form: "appealForm",
destroyOnUnmount: false, destroyOnUnmount: false,
enableReinitialize: true, // this is needed!! enableReinitialize: true // this is needed!!
})(BuildCheckSection) })(BuildCheckSection)
); );
+12 -11
View File
@@ -5,13 +5,14 @@ import { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { formValueSelector, reduxForm } from "redux-form"; import { formValueSelector, reduxForm } from "redux-form";
import xpath from "xpath"; import xpath from "xpath";
import { sendEmail, uploadFiles } from "../../actions"; import { uploadFiles } from "../../actions/services/documentService";
import { sendEmail } from "../../actions/services/notifyService";
import { import {
setCurrentSection, setCurrentSection,
setDocumentsList, setDocumentsList,
setFilesForAppeal, setFilesForAppeal,
setNewAppealProgress, setNewAppealProgress,
setFileCount, setFileCount
} from "../../store/appealType/action"; } from "../../store/appealType/action";
import { getFormCollectionByID, getProgressObj, updateLinks } from "../utils"; import { getFormCollectionByID, getProgressObj, updateLinks } from "../utils";
import BuildRow from "./buildrow"; import BuildRow from "./buildrow";
@@ -48,7 +49,7 @@ let BuildSection = (props) => {
setCurrentSection, setCurrentSection,
refno, refno,
gotoSection, gotoSection,
mandatoryFieldsData, mandatoryFieldsData
} = props; } = props;
const documentListObj = props.appealType.documentList; const documentListObj = props.appealType.documentList;
@@ -159,7 +160,7 @@ let BuildSection = (props) => {
typeof filesUploadObj[key][j].name != "undefined" && typeof filesUploadObj[key][j].name != "undefined" &&
buildAppealFilesArray.push({ buildAppealFilesArray.push({
"name": filesUploadObj[key][j].name, "name": filesUploadObj[key][j].name,
"size": filesUploadObj[key][j].size, "size": filesUploadObj[key][j].size
}); });
} }
} }
@@ -220,7 +221,7 @@ let BuildSection = (props) => {
"/contacts(" + props.props.accountDetails.loggedinUserId + ")", "/contacts(" + props.props.accountDetails.loggedinUserId + ")",
"pinswg_name": props.appealType.caseReference.ticketnumber, "pinswg_name": props.appealType.caseReference.ticketnumber,
[updateBindAppealTypeToIncident + "@odata.bind"]: [updateBindAppealTypeToIncident + "@odata.bind"]:
"/incidents(" + incidentId + ")", "/incidents(" + incidentId + ")"
}); });
updateBody = JSON.stringify(updateBody); updateBody = JSON.stringify(updateBody);
@@ -261,7 +262,7 @@ let BuildSection = (props) => {
props.appealType.caseReference.ticketnumber + props.appealType.caseReference.ticketnumber +
"&inid=" + "&inid=" +
props.appealType.caseReference.incidentid, props.appealType.caseReference.incidentid,
"linkExpiry": 10 * 60, "linkExpiry": 10 * 60
}; };
// console.log( // console.log(
@@ -316,7 +317,7 @@ let BuildSection = (props) => {
for (let j in filesUploadObj[key]) { for (let j in filesUploadObj[key]) {
buildAppealFilesArray.push({ buildAppealFilesArray.push({
"name": filesUploadObj[key][j].name, "name": filesUploadObj[key][j].name,
"size": filesUploadObj[key][j].size, "size": filesUploadObj[key][j].size
}); });
} }
} }
@@ -665,14 +666,14 @@ const mapStateToProps = (state, ownProps) => {
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
initialValues: state.appealType.caseReference.caseDetails, initialValues: state.appealType.caseReference.caseDetails,
currentView: state.currentView, currentView: state.currentView
} }
: { : {
search: state.search, search: state.search,
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType,
currentView: state.currentView, currentView: state.currentView
//form: state.form, //form: state.form,
}; };
}; };
@@ -696,7 +697,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
setFileCount: (fileCount) => { setFileCount: (fileCount) => {
dispatch(setFileCount(fileCount)); dispatch(setFileCount(fileCount));
}, }
}; };
}; };
@@ -758,6 +759,6 @@ export default connect(
form: "appealForm", form: "appealForm",
destroyOnUnmount: false, destroyOnUnmount: false,
enableReinitialize: true, // this is needed!! enableReinitialize: true, // this is needed!!
validate, validate
})(BuildSection) })(BuildSection)
); );
+7 -7
View File
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import { useEffect } from "react"; import { useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { formValueSelector } from "redux-form"; import { formValueSelector } from "redux-form";
import { sendEmail } from "../../actions"; import { sendEmail } from "../../actions/services/notifyService";
import { setCurrentSection } from "../../store/appealType/action"; import { setCurrentSection } from "../../store/appealType/action";
import { getFormCollectionByID } from "../utils"; import { getFormCollectionByID } from "../utils";
@@ -28,7 +28,7 @@ let CompleteAppeal = (props) => {
"/accounts(" + props.appealType.appealLPA + ")", "/accounts(" + props.appealType.appealLPA + ")",
"pinswg_name": props.appealType.caseReference.ticketnumber, "pinswg_name": props.appealType.caseReference.ticketnumber,
[updateBindAppealTypeToIncident + "@odata.bind"]: [updateBindAppealTypeToIncident + "@odata.bind"]:
"/incidents(" + incidentId + ")", "/incidents(" + incidentId + ")"
}); });
updateBody = JSON.stringify(updateBody); updateBody = JSON.stringify(updateBody);
@@ -53,7 +53,7 @@ let CompleteAppeal = (props) => {
const personalisation = { const personalisation = {
"caseReference": props.appealType.caseReference.ticketnumber, "caseReference": props.appealType.caseReference.ticketnumber,
"emailAddress": props.props.accountDetails.loggedinUserEmail, "emailAddress": props.props.accountDetails.loggedinUserEmail,
"linkExpiry": 10 * 60, "linkExpiry": 10 * 60
}; };
sendEmail(templateId, emailAddress, personalisation, reference); sendEmail(templateId, emailAddress, personalisation, reference);
@@ -73,7 +73,7 @@ let CompleteAppeal = (props) => {
props.props.accountDetails.loggedinUserId, props.props.accountDetails.loggedinUserId,
props.appealType.appealTypeID, props.appealType.appealTypeID,
props.props.accountDetails.loggedinUserEmail, props.props.accountDetails.loggedinUserEmail,
props.props.accountDetails.containerID, props.props.accountDetails.containerID
]); ]);
let { t } = useTranslation(); let { t } = useTranslation();
@@ -87,7 +87,7 @@ let CompleteAppeal = (props) => {
onSubmit, onSubmit,
handleSubmit, handleSubmit,
formTitle, formTitle,
setCurrentSection, setCurrentSection
} = props; } = props;
const currentSection = props.appealType.currentSection; const currentSection = props.appealType.currentSection;
@@ -157,7 +157,7 @@ const mapStateToProps = (state) => {
search: state.search, search: state.search,
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType
//form: state.form, //form: state.form,
}; };
}; };
@@ -166,7 +166,7 @@ const mapDispatchToProps = (dispatch) => {
return { return {
setCurrentSection: (currentSection) => { setCurrentSection: (currentSection) => {
dispatch(setCurrentSection(currentSection)); dispatch(setCurrentSection(currentSection));
}, }
}; };
}; };
+38 -33
View File
@@ -5,12 +5,13 @@ import { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Field, formValueSelector, reduxForm } from "redux-form"; import { Field, formValueSelector, reduxForm } from "redux-form";
import { consoleLogger, createNewCaseBlob } from "../../actions"; import { consoleLogger } from "../../actions/core/logger";
import { createNewCaseBlob } from "../../actions/services/caseService";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
setAppealLPA, setAppealLPA,
setAppealTypeID, setAppealTypeID,
setAppealTypeTitle, setAppealTypeTitle
} from "../../store/appealType/action"; } from "../../store/appealType/action";
import { getFormCollectionByID } from "../utils"; import { getFormCollectionByID } from "../utils";
import Aboutyou from "./aboutyou"; import Aboutyou from "./aboutyou";
@@ -21,7 +22,7 @@ const RenderLPAList = ({
optionsObj, optionsObj,
meta: { touched, error }, meta: { touched, error },
label, label,
errorMsg, errorMsg
}) => { }) => {
let { t } = useTranslation(); let { t } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -71,7 +72,7 @@ const RenderLPAList = ({
optionsObj[key].name + optionsObj[key].name +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: optionsObj[key].name} : optionsObj[key].name}
</option> </option>
@@ -90,7 +91,7 @@ const RenderAppealTypeList = ({
optionsObj, optionsObj,
meta: { touched, error }, meta: { touched, error },
label, label,
errorMsg, errorMsg
}) => { }) => {
let { t } = useTranslation(); let { t } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -133,31 +134,35 @@ const RenderAppealTypeList = ({
_.isEmpty(optionsObj[key]) _.isEmpty(optionsObj[key])
? "" ? ""
: _.isEmpty(optionsObj[key]) : _.isEmpty(optionsObj[key])
? "" ? ""
: _.isEmpty( : _.isEmpty(
optionsObj[key].value optionsObj[key]
) .value
? "" )
: optionsObj[key] ? ""
.attributevalue : optionsObj[key]
.attributevalue
} }
> >
{_.isEmpty(optionsObj[key]) {_.isEmpty(optionsObj[key])
? "" ? ""
: _.isEmpty(optionsObj[key]) : _.isEmpty(optionsObj[key])
? "" ? ""
: _.isEmpty(optionsObj[key].value) : _.isEmpty(
? "" optionsObj[key].value
: router.locale == "cy" )
? jsonpath({ ? ""
path: : router.locale == "cy"
'$..[?(@ && @.value=="' + ? jsonpath({
optionsObj[key].value + path:
'")].value_cy', '$..[?(@ && @.value=="' +
json: transLookup, optionsObj[key]
eval: true, .value +
}) '")].value_cy',
: optionsObj[key].value} json: transLookup,
eval: true
})
: optionsObj[key].value}
</option> </option>
); );
})} })}
@@ -255,7 +260,7 @@ const RenderRadio = ({
{ {
["documentCheckList_" + ["documentCheckList_" +
id]: id]:
custom.requiredDocumentLabel, custom.requiredDocumentLabel
} }
)) ))
: delete docListObj[ : delete docListObj[
@@ -289,7 +294,7 @@ function Radiofield(props) {
form, form,
formProps, formProps,
parentFieldShowOnValue, parentFieldShowOnValue,
validation, validation
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
const router = useRouter(); const router = useRouter();
@@ -401,9 +406,9 @@ let CreateCase = (props) => {
values.appealTypes == "846040004" && values.confirmHASCAS == "true" values.appealTypes == "846040004" && values.confirmHASCAS == "true"
? "846040004" ? "846040004"
: values.appealTypes == "846040004" && : values.appealTypes == "846040004" &&
values.confirmHASCAS == "false" values.confirmHASCAS == "false"
? "846040000" ? "846040000"
: values.appealTypes; : values.appealTypes;
var whichAppealType = whichAppealType; var whichAppealType = whichAppealType;
@@ -570,7 +575,7 @@ const mapStateToProps = (state) => {
search: state.search, search: state.search,
searchResultsObj: state.searchResultsObj, searchResultsObj: state.searchResultsObj,
formData: state.formData, formData: state.formData,
appealType: state.appealType, appealType: state.appealType
//form: state.form, //form: state.form,
}; };
}; };
@@ -587,7 +592,7 @@ const mapDispatchToProps = (dispatch) => {
}, },
onChangeSelectLPA: (lpaId) => { onChangeSelectLPA: (lpaId) => {
dispatch(setAppealLPA(lpaId)); dispatch(setAppealLPA(lpaId));
}, }
}; };
}; };
@@ -599,6 +604,6 @@ export default connect(
)( )(
reduxForm({ reduxForm({
form: "caseForm", form: "caseForm",
destroyOnUnmount: false, destroyOnUnmount: false
})(CreateCase) })(CreateCase)
); );
+61 -57
View File
@@ -9,7 +9,10 @@ import transLookup from "../../data/lookuptranslations.json";
import PaginationControl from "./pagination"; import PaginationControl from "./pagination";
import RepsOnResults from "./repsonresults"; import RepsOnResults from "./repsonresults";
import { getBasicDNSSearchPaged, getDNSCoords } from "../../actions"; import {
getBasicDNSSearchPaged,
getDNSCoords
} from "../../actions/services/searchService";
import GoogleMapReact from "google-map-react"; import GoogleMapReact from "google-map-react";
import { parseCookies } from "nookies"; import { parseCookies } from "nookies";
@@ -17,19 +20,19 @@ import OSPoint from "ospoint";
import { import {
createWatchedCases, createWatchedCases,
deleteWatchedCases, deleteWatchedCases,
getWatchedCasesProxy, getWatchedCasesProxy
} from "../../actions"; } from "../../actions/services/portalService";
import { import {
setCurrentPage, setCurrentPage,
setCurrentReference, setCurrentReference
} from "../../store/currentView/action"; } 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 { getDetailsProxy, getSearchDetailsPaged } from "../utils"; import { getDetailsProxy, getSearchDetailsPaged } from "../utils";
import { signIn, useSession } from "next-auth/react"; import { signIn, useSession } from "next-auth/react";
@@ -49,7 +52,7 @@ const DNSSearchResults = (props) => {
setWatchedCases, setWatchedCases,
setWatchedCasesDetails, setWatchedCasesDetails,
showMap, showMap,
showLoginCheck, showLoginCheck
} = props; } = props;
let { t } = useTranslation(); let { t } = useTranslation();
@@ -159,17 +162,17 @@ const DNSSearchResults = (props) => {
let updateBody = { let updateBody = {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType, "pinswg_appealcasetype": +appealType
}; };
createWatchedCases(updateBody) createWatchedCases(updateBody)
.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((data) => { getDetailsProxy(data, "myWatchedCases").then((data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
}); }));
}); });
}); });
}; };
@@ -184,7 +187,7 @@ const DNSSearchResults = (props) => {
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
"pinswg_appealcasetype": +appealType, "pinswg_appealcasetype": +appealType,
"pinswg_emailnotifications": true, "pinswg_emailnotifications": true
}; };
console.log("Email signed up"); console.log("Email signed up");
@@ -193,12 +196,12 @@ const DNSSearchResults = (props) => {
.then(() => { .then(() => {
getWatchedCasesProxy(props.accountDetails.loggedinUserId).then( getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
(data) => { (data) => {
setWatchedCases(data), (setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then( getDetailsProxy(data, "myWatchedCases").then(
(data) => { (data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
} }
); ));
} }
); );
}); });
@@ -211,7 +214,7 @@ const DNSSearchResults = (props) => {
whichIncident + whichIncident +
"')]", "')]",
json: watchedCases, json: watchedCases,
eval: true, eval: true
}); });
return isWatched; return isWatched;
@@ -225,7 +228,7 @@ const DNSSearchResults = (props) => {
"' && @.pinswg_emailnotifications==true)]", "' && @.pinswg_emailnotifications==true)]",
json: watchedCases, json: watchedCases,
eval: true, eval: true
}); });
return isEmail; return isEmail;
}; };
@@ -247,7 +250,7 @@ const DNSSearchResults = (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
}); });
}; };
@@ -258,12 +261,12 @@ const DNSSearchResults = (props) => {
var dateB = new Date(b.createdon); var dateB = new Date(b.createdon);
return dateB - dateA; return dateB - dateA;
}); });
setWatchedCases(data), (setWatchedCases(data),
getDetailsProxy(data, "myWatchedCases").then( getDetailsProxy(data, "myWatchedCases").then(
(data) => { (data) => {
setWatchedCasesDetails(data); setWatchedCasesDetails(data);
} }
); ));
}); });
}); });
}; };
@@ -385,7 +388,7 @@ const DNSSearchResults = (props) => {
item.ticketnumber + item.ticketnumber +
'")]', '")]',
json: searchDetailsObj, json: searchDetailsObj,
eval: true, eval: true
}); });
detailsObj = detailsObj[0]; detailsObj = detailsObj[0];
@@ -399,7 +402,7 @@ const DNSSearchResults = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
@@ -427,10 +430,10 @@ const DNSSearchResults = (props) => {
: "/dns/" + : "/dns/" +
item.ticketnumber item.ticketnumber
: myportal == true : myportal == true
? "/myportal/dns/" + ? "/myportal/dns/" +
item.ticketnumber item.ticketnumber
: "/dns/" + : "/dns/" +
item.ticketnumber item.ticketnumber
} }
className="govuk-link--no-underline" className="govuk-link--no-underline"
onClick={() => { onClick={() => {
@@ -447,7 +450,7 @@ const DNSSearchResults = (props) => {
item.pinswg_appealcasetype, item.pinswg_appealcasetype,
"showMap": showMap, "showMap": showMap,
"showLoginCheck": "showLoginCheck":
props.showLoginCheck, props.showLoginCheck
}); });
}} }}
> >
@@ -484,32 +487,33 @@ const DNSSearchResults = (props) => {
) < 0 ) < 0
? detailsObj.pinswg_projectlocation ? detailsObj.pinswg_projectlocation
: router.locale == "cy" : router.locale == "cy"
? detailsObj.pinswg_projectlocation.split( ? detailsObj.pinswg_projectlocation.split(
";" ";"
)[1] )[1]
: detailsObj.pinswg_projectlocation.split( : detailsObj.pinswg_projectlocation.split(
";" ";"
)[0] )[0]
: "" : ""
: hasValidKey( : hasValidKey(
item, item,
"pinswg_caseaddress" "pinswg_caseaddress"
) )
? item.pinswg_caseaddress != ? item.pinswg_caseaddress !=
null null
? item.pinswg_caseaddress.indexOf( ? item.pinswg_caseaddress.indexOf(
";" ";"
) < 0 ) < 0
? item.pinswg_caseaddress ? item.pinswg_caseaddress
: router.locale == "cy" : router.locale ==
? item.pinswg_caseaddress.split( "cy"
";" ? item.pinswg_caseaddress.split(
)[1] ";"
: item.pinswg_caseaddress.split( )[1]
";" : item.pinswg_caseaddress.split(
)[0] ";"
: "" )[0]
: ""} : ""
: ""}
{_.has( {_.has(
detailsObj, detailsObj,
@@ -574,7 +578,7 @@ const DNSSearchResults = (props) => {
: :
</span> </span>
{_.has(detailsObj, [ {_.has(detailsObj, [
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue", "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]) ])
? detailsObj[ ? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
@@ -589,7 +593,7 @@ const DNSSearchResults = (props) => {
: :
</span> </span>
{_.has(detailsObj, [ {_.has(detailsObj, [
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
]) ])
? router.locale == "cy" ? router.locale == "cy"
? jsonpath({ ? jsonpath({
@@ -600,7 +604,7 @@ const DNSSearchResults = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: detailsObj[ : detailsObj[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
@@ -623,7 +627,7 @@ const DNSSearchResults = (props) => {
] + ] +
'")].value_cy', '")].value_cy',
json: transLookup, json: transLookup,
eval: true, eval: true
}) })
: item[ : item[
"statuscode@OData.Community.Display.V1.FormattedValue" "statuscode@OData.Community.Display.V1.FormattedValue"
@@ -782,7 +786,7 @@ const DNSSearchResults = (props) => {
"&toWatch=" + "&toWatch=" +
item.incidentid + item.incidentid +
"_" + "_" +
item.pinswg_appealcasetype, item.pinswg_appealcasetype
} }
); );
}} }}
@@ -886,7 +890,7 @@ const DNSSearchResults = (props) => {
fieldSortState, fieldSortState,
orderByState, orderByState,
searchLoaded, searchLoaded,
getSearchPageResults, getSearchPageResults
]); ]);
return ( return (
<> <>
@@ -1058,14 +1062,14 @@ const mapDispatchToProps = (dispatch) => {
}, },
setCurrentPage: (currentPage) => { setCurrentPage: (currentPage) => {
dispatch(setCurrentPage(currentPage)); dispatch(setCurrentPage(currentPage));
}, }
}; };
}; };
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,
}; };
+5 -2
View File
@@ -5,7 +5,10 @@ import Link from "next/link";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
import { useCallback, useState } from "react"; import { useCallback, useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { getAdvancedSearchPaged, getBasicSearchPaged } from "../../actions"; import {
getAdvancedSearchPaged,
getBasicSearchPaged
} from "../../actions/services/searchService";
import transLookup from "../../data/lookuptranslations.json"; import transLookup from "../../data/lookuptranslations.json";
import { import {
setCurrentPage, setCurrentPage,
@@ -32,7 +35,7 @@ import {
createWatchedCases, createWatchedCases,
deleteWatchedCases, deleteWatchedCases,
getWatchedCasesProxy getWatchedCasesProxy
} from "../../actions"; } from "../../actions/services/portalService";
import { sendGAEvent } from "@next/third-parties/google"; import { sendGAEvent } from "@next/third-parties/google";
import RepsOnResults from "./repsonresults"; import RepsOnResults from "./repsonresults";