diff --git a/components/account/changepassword.js b/components/account/changepassword.js index 8b53860e..760be8a8 100644 --- a/components/account/changepassword.js +++ b/components/account/changepassword.js @@ -4,7 +4,7 @@ import { useRouter } from "next/router"; import React, { useState } from "react"; import { connect } from "react-redux"; import { Field, formValueSelector, reduxForm } from "redux-form"; -import { updatePassword } from "../../actions"; +import { updatePassword } from "../../actions/services/accountService"; const RenderTextfield = ({ id, @@ -60,7 +60,7 @@ const ChangePassword = (props) => { handleSubmit, value, setPasswordUpdated, - passwordUpdated, + passwordUpdated } = props; let { t, lang } = useTranslation(); @@ -158,7 +158,7 @@ const mapStateToProps = (state) => { searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, - accountDetails: state.accountDetails, + accountDetails: state.accountDetails //form: state.form, }; }; @@ -167,7 +167,7 @@ const mapDispatchToProps = (dispatch) => { return { setCurrentSection: (currentSection) => { dispatch(setCurrentSection(currentSection)); - }, + } }; }; @@ -179,6 +179,6 @@ export default connect( )( reduxForm({ form: "changepasswordForm", - destroyOnUnmount: false, + destroyOnUnmount: false })(ChangePassword) ); diff --git a/components/account/personaldetailsComplete.js b/components/account/personaldetailsComplete.js index 14562320..6a50ef86 100644 --- a/components/account/personaldetailsComplete.js +++ b/components/account/personaldetailsComplete.js @@ -3,7 +3,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import React, { useEffect } from "react"; import { connect } from "react-redux"; -import { updateAccount } from "../../actions"; +import { updateAccount } from "../../actions/services/accountService"; import { setCookie } from "nookies"; const PersonalDetailsComplete = (props) => { @@ -11,7 +11,7 @@ const PersonalDetailsComplete = (props) => { handleSubmit, value, setRegisterFormComplete, - setAccountCreatedComplete, + setAccountCreatedComplete } = props; let { t, lang } = useTranslation(); @@ -41,7 +41,7 @@ const PersonalDetailsComplete = (props) => { console.log("=============== pref lang", prefLang); setCookie(null, "pedw_locale", userLang, { path: "/", - maxAge: 60 * 60 * 24 * 365, + maxAge: 60 * 60 * 24 * 365 }); console.log("Set cookie to:", userLang); @@ -79,7 +79,7 @@ const mapStateToProps = (state) => { searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, - accountDetails: state.accountDetails, + accountDetails: state.accountDetails //form: state.form, }; }; @@ -88,7 +88,7 @@ const mapDispatchToProps = (dispatch) => { return { setCurrentSection: (currentSection) => { dispatch(setCurrentSection(currentSection)); - }, + } }; }; diff --git a/components/account/registerComplete.js b/components/account/registerComplete.js index 8d69ac35..1f9d9eec 100644 --- a/components/account/registerComplete.js +++ b/components/account/registerComplete.js @@ -8,7 +8,10 @@ import { connect } from "react-redux"; import { setAccCr, setLogout } from "../../store/accountDetails/action"; -import { createAccount, getEmailAccountCheck } from "../../actions"; +import { + createAccount, + getEmailAccountCheck +} from "../../actions/services/accountService"; const RegisterComplete = (props) => { const { @@ -18,7 +21,7 @@ const RegisterComplete = (props) => { value, setRegisterFormComplete, setAccountCreatedComplete, - setAccCr, + setAccCr } = props; let { t, lang } = useTranslation(); @@ -34,7 +37,7 @@ const RegisterComplete = (props) => { // was an appellant "pinswg_typeofinvolvement": 846040001, Object.assign(accountBody, { - "pinswg_typeofinvolvement": 846040061, + "pinswg_typeofinvolvement": 846040061 }); accountBody = _.omit(accountBody, ["custom_password_check"]); @@ -105,9 +108,9 @@ const RegisterComplete = (props) => {

{ - setRegisterFormComplete(false), + (setRegisterFormComplete(false), setAccountCreatedComplete(false), - setAccCr(false); + setAccCr(false)); }} className="govuk-link" > @@ -130,7 +133,7 @@ const mapStateToProps = (state) => { searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, - accountDetails: state.accountDetails, + accountDetails: state.accountDetails //form: state.form, }; }; @@ -142,7 +145,7 @@ const mapDispatchToProps = (dispatch) => { }, setLogout: () => { dispatch(setLogout()); - }, + } }; }; diff --git a/components/admin/tabs/appeals.js b/components/admin/tabs/appeals.js index bfa2115e..58cab489 100644 --- a/components/admin/tabs/appeals.js +++ b/components/admin/tabs/appeals.js @@ -9,14 +9,15 @@ import { connect } from "react-redux"; import { setSearchResults, - setSearchDetails, + setSearchDetails } from "../../../store/searchOutput/action"; import { getDetailsProxy, getSearchDetailsPaged } from "../../utils"; -import { getAdvancedSearchPaged, getNewAppealsPage } from "../../../actions"; +import { getAdvancedSearchPaged } from "../../../actions/services/searchService"; +import { getNewAppealsPage } from "../../../actions/services/adminService"; import { setCurrentPage, - setCurrentReference, + setCurrentReference } from "../../../store/currentView/action"; function AppealsTab(props) { @@ -86,7 +87,7 @@ function AppealsTab(props) { searchString, selectedOption, props.setSearchDetails, - props.setSearchResults, + props.setSearchResults ] ); @@ -105,7 +106,7 @@ function AppealsTab(props) { orderByState, searchLoaded, getSearchPageResults, - router.query, + router.query ]); const ResultsView = (resultsArr) => { @@ -225,7 +226,7 @@ function AppealsTab(props) { item.ticketnumber + '")]', json: searchDetailsObj, - eval: true, + eval: true }); detailsObj = detailsObj[0] || {}; @@ -246,8 +247,8 @@ function AppealsTab(props) { ? "/fymhorth/achos" : "/achos" : myportal == true - ? "/myportal/case" - : "/case") + + ? "/myportal/case" + : "/case") + "/" + item.ticketnumber } @@ -272,10 +273,10 @@ function AppealsTab(props) { ) ? detailsObj.pinswg_speacialistcaseprocess : detailsObj.hasOwnProperty( - "pinswg_specialistcaseprocess" - ) - ? detailsObj.pinswg_specialistcaseprocess - : "", + "pinswg_specialistcaseprocess" + ) + ? detailsObj.pinswg_specialistcaseprocess + : "" }); }} > @@ -314,12 +315,12 @@ function AppealsTab(props) { ) < 0 ? detailsObj.pinswg_projectlocation : router.locale == "cy" - ? detailsObj.pinswg_projectlocation.split( - ";" - )[1] - : detailsObj.pinswg_projectlocation.split( - ";" - )[0] + ? detailsObj.pinswg_projectlocation.split( + ";" + )[1] + : detailsObj.pinswg_projectlocation.split( + ";" + )[0] : "" : ""} {_.has( @@ -396,12 +397,12 @@ function AppealsTab(props) { " " + item.pinswg_appellantlastname : _.has(detailsObj, [ - "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue", - ]) - ? detailsObj[ - "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" - ] - : ""} + "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" + ]) + ? detailsObj[ + "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" + ] + : ""}

@@ -411,7 +412,7 @@ function AppealsTab(props) { : {_.has(item, [ - "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", + "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" ]) ? router.locale == "cy" ? jsonpath({ @@ -422,7 +423,7 @@ function AppealsTab(props) { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : item[ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" @@ -445,7 +446,7 @@ function AppealsTab(props) { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : item[ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" @@ -468,7 +469,7 @@ function AppealsTab(props) { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : item[ "statuscode@OData.Community.Display.V1.FormattedValue" @@ -555,13 +556,13 @@ const mapDispatchToProps = (dispatch) => { }, setCurrentPage: (currentPage) => { dispatch(setCurrentPage(currentPage)); - }, + } }; }; const mapStateToProps = (state) => { return { - searchResultsObj: state.searchResultsObj, + searchResultsObj: state.searchResultsObj }; }; diff --git a/components/case/representation/index.js b/components/case/representation/index.js index d35c7d81..e4a94631 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -6,7 +6,11 @@ import { connect } from "react-redux"; import { reduxForm } from "redux-form"; 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 { setRepresentationCapacity, diff --git a/components/case/representation/representationCompleteSubmit.js b/components/case/representation/representationCompleteSubmit.js index 7a572ca4..bb69ed02 100644 --- a/components/case/representation/representationCompleteSubmit.js +++ b/components/case/representation/representationCompleteSubmit.js @@ -4,7 +4,7 @@ import { useRouter } from "next/router"; import { useState } from "react"; import { useDropzone } from "react-dropzone"; import { connect } from "react-redux"; -import { generateRepPDF } from "../../../actions"; +import { generateRepPDF } from "../../../actions/services/documentService"; import RepComplete from "./representationComplete"; import RepLPAQuestionnaireCheck_enforcement from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_enforcement"; import RepLPAQuestionnaireCheck_s78 from "./representationQuestionnairesCheck/representationLPAQuestionnaireCheck_s78"; diff --git a/components/case/representationList.js b/components/case/representationList.js index 13f81d5f..14518414 100644 --- a/components/case/representationList.js +++ b/components/case/representationList.js @@ -6,7 +6,7 @@ import { useEffect, useState } from "react"; import { connect } from "react-redux"; import transLookup from "../../data/lookuptranslations.json"; -import { getRepresentations } from "../../actions"; +import { getRepresentations } from "../../actions/services/portalService"; import { setRepresentations } from "../../store/searchOutput/action"; import { formatDates } from "../utils"; @@ -63,7 +63,7 @@ const RepresentationList = (props) => { incidentid + "')]", json: item, - eval: true, + eval: true }); detailsObj = item; @@ -97,7 +97,7 @@ const RepresentationList = (props) => { ] + '")].value_cy', json: transLookup, - sanbox: {}, + sanbox: {} }) : detailsObj[ "pinswg_isharedocumentlocations@OData.Community.Display.V1.FormattedValue" @@ -216,7 +216,7 @@ const RepresentationList = (props) => { const mapStateToProps = (state) => { return { - ...state, + ...state }; }; @@ -224,7 +224,7 @@ const mapDispatchToProps = (dispatch) => { return { setRepresentations: (representationObj) => { dispatch(setRepresentations(representationObj)); - }, + } }; }; diff --git a/components/myportal/uploadFile.js b/components/myportal/uploadFile.js index 492c8b84..db7fff76 100644 --- a/components/myportal/uploadFile.js +++ b/components/myportal/uploadFile.js @@ -4,7 +4,7 @@ import { useMemo, useState } from "react"; import Dropzone from "react-dropzone"; import { connect } from "react-redux"; import { Field, reduxForm } from "redux-form"; -import { uploadFiles } from "../../actions"; +import { uploadFiles } from "../../actions/services/documentService"; import { bytesToSize } from "../utils"; const required = (errorMsg) => (value) => @@ -79,25 +79,25 @@ const baseStyle = { color: "#bdbdbd", transition: "border .3s ease-in-out", width: "80%", - margin: "20px auto 30px", + margin: "20px auto 30px" }; const activeStyle = { - borderColor: "#2196f3", + borderColor: "#2196f3" }; const acceptStyle = { - borderColor: "#00e676", + borderColor: "#00e676" }; const rejectStyle = { - borderColor: "#ff1744", + borderColor: "#ff1744" }; const RenderFileUpload = (field) => { const files = field.input.value; const style = useMemo( () => ({ - ...baseStyle, + ...baseStyle // ...(isDragActive ? activeStyle : {}), // ...(isDragAccept ? acceptStyle : {}), // ...(isDragReject ? rejectStyle : {}), @@ -220,7 +220,7 @@ const RenderFileUpload = (field) => { field.documentTypeCode )}_${file.name}`, { - type: file.type, + type: file.type } ) ); @@ -323,7 +323,7 @@ let UploadFile = (props) => { t( "myportal:searchcases-validation-minlength" ) - ), + ) ]} className="govuk-input" component={RenderTextfield} @@ -428,11 +428,11 @@ const mapStateToProps = (state) => { "pinswg_developmentdescription": "something to go here", "pinswg_agriculturalholding": 846040000, "_pinswg_planningappeals78ids_value": - "50b533aa-43f1-ec11-aade-00224800be9c", + "50b533aa-43f1-ec11-aade-00224800be9c" }, initialValues: { - caseReference: "CAS-00764-L0Q9W2", - }, + caseReference: "CAS-00764-L0Q9W2" + } }; }; @@ -447,6 +447,6 @@ export default connect( reduxForm({ form: "uploadFileForm", destroyOnUnmount: false, - enableReinitialize: true, // this is needed!! + enableReinitialize: true // this is needed!! })(UploadFile) ); diff --git a/components/newappeal/buildchecksection.js b/components/newappeal/buildchecksection.js index 6f18f630..a3a6b5e5 100644 --- a/components/newappeal/buildchecksection.js +++ b/components/newappeal/buildchecksection.js @@ -9,16 +9,17 @@ import xpath from "xpath"; import fieldLookup from "../../data/crmfieldlookuptranslations.json"; import { setCurrentSection, - setFormComplete, + setFormComplete } from "../../store/appealType/action"; import BuildCheckRow from "./buildcheckrow"; -import { generateAppealPDF, sendCaseCompleteMessage } from "../../actions"; +import { generateAppealPDF } from "../../actions/services/documentService"; +import { sendCaseCompleteMessage } from "../../actions/services/portalService"; import { bytesToSize, getThumbnailIconByExtension, updateLinks, - getDocLink, + getDocLink } from "../utils"; let BuildCheckSection = (props) => { @@ -40,7 +41,7 @@ let BuildCheckSection = (props) => { setCurrentSection, updateCurrentSection, mandatoryFieldsData, - docsOffline, + docsOffline } = props; const parser = new DOMParser(); @@ -118,7 +119,7 @@ let BuildCheckSection = (props) => { Object.assign(pdfObj, { "filesList": buildAppealFilesArray, "containerID": props.props.accountDetails.containerID, - "casefolderID": props.appealType.caseReference.ticketnumber, + "casefolderID": props.appealType.caseReference.ticketnumber }); const [confirmSections, setConfirmSections] = useState(false); @@ -132,7 +133,7 @@ let BuildCheckSection = (props) => { let formObj = jsonpath({ path: "$['" + appealtypes + "']", json: fieldLookup, - eval: true, + eval: true }); let labelTrans = @@ -140,7 +141,7 @@ let BuildCheckSection = (props) => { ? jsonpath({ path: '$..[?(@ && @.value=="' + label + '")].value_cy', json: formObj, - eval: true, + eval: true }) : label; return labelTrans; @@ -393,7 +394,7 @@ const mapStateToProps = (state) => { searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, - form: state.form, + form: state.form }; }; @@ -405,7 +406,7 @@ const mapDispatchToProps = (dispatch) => { updateCurrentSection: (whichSection) => { dispatch(setCurrentSection(whichSection)); dispatch(setFormComplete("true")); - }, + } }; }; @@ -424,6 +425,6 @@ export default connect( reduxForm({ form: "appealForm", destroyOnUnmount: false, - enableReinitialize: true, // this is needed!! + enableReinitialize: true // this is needed!! })(BuildCheckSection) ); diff --git a/components/newappeal/buildsection.js b/components/newappeal/buildsection.js index 7825cd50..fd374474 100644 --- a/components/newappeal/buildsection.js +++ b/components/newappeal/buildsection.js @@ -5,13 +5,14 @@ import { useState } from "react"; import { connect } from "react-redux"; import { formValueSelector, reduxForm } from "redux-form"; import xpath from "xpath"; -import { sendEmail, uploadFiles } from "../../actions"; +import { uploadFiles } from "../../actions/services/documentService"; +import { sendEmail } from "../../actions/services/notifyService"; import { setCurrentSection, setDocumentsList, setFilesForAppeal, setNewAppealProgress, - setFileCount, + setFileCount } from "../../store/appealType/action"; import { getFormCollectionByID, getProgressObj, updateLinks } from "../utils"; import BuildRow from "./buildrow"; @@ -48,7 +49,7 @@ let BuildSection = (props) => { setCurrentSection, refno, gotoSection, - mandatoryFieldsData, + mandatoryFieldsData } = props; const documentListObj = props.appealType.documentList; @@ -159,7 +160,7 @@ let BuildSection = (props) => { typeof filesUploadObj[key][j].name != "undefined" && buildAppealFilesArray.push({ "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 + ")", "pinswg_name": props.appealType.caseReference.ticketnumber, [updateBindAppealTypeToIncident + "@odata.bind"]: - "/incidents(" + incidentId + ")", + "/incidents(" + incidentId + ")" }); updateBody = JSON.stringify(updateBody); @@ -261,7 +262,7 @@ let BuildSection = (props) => { props.appealType.caseReference.ticketnumber + "&inid=" + props.appealType.caseReference.incidentid, - "linkExpiry": 10 * 60, + "linkExpiry": 10 * 60 }; // console.log( @@ -316,7 +317,7 @@ let BuildSection = (props) => { for (let j in filesUploadObj[key]) { buildAppealFilesArray.push({ "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, appealType: state.appealType, initialValues: state.appealType.caseReference.caseDetails, - currentView: state.currentView, + currentView: state.currentView } : { search: state.search, searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, - currentView: state.currentView, + currentView: state.currentView //form: state.form, }; }; @@ -696,7 +697,7 @@ const mapDispatchToProps = (dispatch) => { }, setFileCount: (fileCount) => { dispatch(setFileCount(fileCount)); - }, + } }; }; @@ -758,6 +759,6 @@ export default connect( form: "appealForm", destroyOnUnmount: false, enableReinitialize: true, // this is needed!! - validate, + validate })(BuildSection) ); diff --git a/components/newappeal/complete.js b/components/newappeal/complete.js index 648980c2..96c6eddc 100644 --- a/components/newappeal/complete.js +++ b/components/newappeal/complete.js @@ -4,7 +4,7 @@ import { useRouter } from "next/router"; import { useEffect } from "react"; import { connect } from "react-redux"; import { formValueSelector } from "redux-form"; -import { sendEmail } from "../../actions"; +import { sendEmail } from "../../actions/services/notifyService"; import { setCurrentSection } from "../../store/appealType/action"; import { getFormCollectionByID } from "../utils"; @@ -28,7 +28,7 @@ let CompleteAppeal = (props) => { "/accounts(" + props.appealType.appealLPA + ")", "pinswg_name": props.appealType.caseReference.ticketnumber, [updateBindAppealTypeToIncident + "@odata.bind"]: - "/incidents(" + incidentId + ")", + "/incidents(" + incidentId + ")" }); updateBody = JSON.stringify(updateBody); @@ -53,7 +53,7 @@ let CompleteAppeal = (props) => { const personalisation = { "caseReference": props.appealType.caseReference.ticketnumber, "emailAddress": props.props.accountDetails.loggedinUserEmail, - "linkExpiry": 10 * 60, + "linkExpiry": 10 * 60 }; sendEmail(templateId, emailAddress, personalisation, reference); @@ -73,7 +73,7 @@ let CompleteAppeal = (props) => { props.props.accountDetails.loggedinUserId, props.appealType.appealTypeID, props.props.accountDetails.loggedinUserEmail, - props.props.accountDetails.containerID, + props.props.accountDetails.containerID ]); let { t } = useTranslation(); @@ -87,7 +87,7 @@ let CompleteAppeal = (props) => { onSubmit, handleSubmit, formTitle, - setCurrentSection, + setCurrentSection } = props; const currentSection = props.appealType.currentSection; @@ -157,7 +157,7 @@ const mapStateToProps = (state) => { search: state.search, searchResultsObj: state.searchResultsObj, formData: state.formData, - appealType: state.appealType, + appealType: state.appealType //form: state.form, }; }; @@ -166,7 +166,7 @@ const mapDispatchToProps = (dispatch) => { return { setCurrentSection: (currentSection) => { dispatch(setCurrentSection(currentSection)); - }, + } }; }; diff --git a/components/newappeal/createCase.js b/components/newappeal/createCase.js index 8162e03b..c9dba63a 100644 --- a/components/newappeal/createCase.js +++ b/components/newappeal/createCase.js @@ -5,12 +5,13 @@ import { useState } from "react"; import { connect } from "react-redux"; 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 { setAppealLPA, setAppealTypeID, - setAppealTypeTitle, + setAppealTypeTitle } from "../../store/appealType/action"; import { getFormCollectionByID } from "../utils"; import Aboutyou from "./aboutyou"; @@ -21,7 +22,7 @@ const RenderLPAList = ({ optionsObj, meta: { touched, error }, label, - errorMsg, + errorMsg }) => { let { t } = useTranslation(); const router = useRouter(); @@ -71,7 +72,7 @@ const RenderLPAList = ({ optionsObj[key].name + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : optionsObj[key].name} @@ -90,7 +91,7 @@ const RenderAppealTypeList = ({ optionsObj, meta: { touched, error }, label, - errorMsg, + errorMsg }) => { let { t } = useTranslation(); const router = useRouter(); @@ -133,31 +134,35 @@ const RenderAppealTypeList = ({ _.isEmpty(optionsObj[key]) ? "" : _.isEmpty(optionsObj[key]) - ? "" - : _.isEmpty( - optionsObj[key].value - ) - ? "" - : optionsObj[key] - .attributevalue + ? "" + : _.isEmpty( + optionsObj[key] + .value + ) + ? "" + : optionsObj[key] + .attributevalue } > {_.isEmpty(optionsObj[key]) ? "" : _.isEmpty(optionsObj[key]) - ? "" - : _.isEmpty(optionsObj[key].value) - ? "" - : router.locale == "cy" - ? jsonpath({ - path: - '$..[?(@ && @.value=="' + - optionsObj[key].value + - '")].value_cy', - json: transLookup, - eval: true, - }) - : optionsObj[key].value} + ? "" + : _.isEmpty( + optionsObj[key].value + ) + ? "" + : router.locale == "cy" + ? jsonpath({ + path: + '$..[?(@ && @.value=="' + + optionsObj[key] + .value + + '")].value_cy', + json: transLookup, + eval: true + }) + : optionsObj[key].value} ); })} @@ -255,7 +260,7 @@ const RenderRadio = ({ { ["documentCheckList_" + id]: - custom.requiredDocumentLabel, + custom.requiredDocumentLabel } )) : delete docListObj[ @@ -289,7 +294,7 @@ function Radiofield(props) { form, formProps, parentFieldShowOnValue, - validation, + validation } = props; let { t } = useTranslation(); const router = useRouter(); @@ -401,9 +406,9 @@ let CreateCase = (props) => { values.appealTypes == "846040004" && values.confirmHASCAS == "true" ? "846040004" : values.appealTypes == "846040004" && - values.confirmHASCAS == "false" - ? "846040000" - : values.appealTypes; + values.confirmHASCAS == "false" + ? "846040000" + : values.appealTypes; var whichAppealType = whichAppealType; @@ -570,7 +575,7 @@ const mapStateToProps = (state) => { search: state.search, searchResultsObj: state.searchResultsObj, formData: state.formData, - appealType: state.appealType, + appealType: state.appealType //form: state.form, }; }; @@ -587,7 +592,7 @@ const mapDispatchToProps = (dispatch) => { }, onChangeSelectLPA: (lpaId) => { dispatch(setAppealLPA(lpaId)); - }, + } }; }; @@ -599,6 +604,6 @@ export default connect( )( reduxForm({ form: "caseForm", - destroyOnUnmount: false, + destroyOnUnmount: false })(CreateCase) ); diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js index 7a920e78..2ea31c88 100644 --- a/components/search/dnssearchresults.js +++ b/components/search/dnssearchresults.js @@ -9,7 +9,10 @@ import transLookup from "../../data/lookuptranslations.json"; import PaginationControl from "./pagination"; import RepsOnResults from "./repsonresults"; -import { getBasicDNSSearchPaged, getDNSCoords } from "../../actions"; +import { + getBasicDNSSearchPaged, + getDNSCoords +} from "../../actions/services/searchService"; import GoogleMapReact from "google-map-react"; import { parseCookies } from "nookies"; @@ -17,19 +20,19 @@ import OSPoint from "ospoint"; import { createWatchedCases, deleteWatchedCases, - getWatchedCasesProxy, -} from "../../actions"; + getWatchedCasesProxy +} from "../../actions/services/portalService"; import { setCurrentPage, - setCurrentReference, + setCurrentReference } from "../../store/currentView/action"; import { setSearchDetails, - setSearchResults, + setSearchResults } from "../../store/searchOutput/action"; import { setWatchedCases, - setWatchedCasesDetails, + setWatchedCasesDetails } from "../../store/watchedCases/action"; import { getDetailsProxy, getSearchDetailsPaged } from "../utils"; import { signIn, useSession } from "next-auth/react"; @@ -49,7 +52,7 @@ const DNSSearchResults = (props) => { setWatchedCases, setWatchedCasesDetails, showMap, - showLoginCheck, + showLoginCheck } = props; let { t } = useTranslation(); @@ -159,17 +162,17 @@ const DNSSearchResults = (props) => { let updateBody = { "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", - "pinswg_appealcasetype": +appealType, + "pinswg_appealcasetype": +appealType }; createWatchedCases(updateBody) .then((data) => data) .then(() => { getWatchedCasesProxy(cookies.pinsUser).then((data) => { - setWatchedCases(data), + (setWatchedCases(data), getDetailsProxy(data, "myWatchedCases").then((data) => { setWatchedCasesDetails(data); - }); + })); }); }); }; @@ -184,7 +187,7 @@ const DNSSearchResults = (props) => { "pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")", "pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")", "pinswg_appealcasetype": +appealType, - "pinswg_emailnotifications": true, + "pinswg_emailnotifications": true }; console.log("Email signed up"); @@ -193,12 +196,12 @@ const DNSSearchResults = (props) => { .then(() => { getWatchedCasesProxy(props.accountDetails.loggedinUserId).then( (data) => { - setWatchedCases(data), + (setWatchedCases(data), getDetailsProxy(data, "myWatchedCases").then( (data) => { setWatchedCasesDetails(data); } - ); + )); } ); }); @@ -211,7 +214,7 @@ const DNSSearchResults = (props) => { whichIncident + "')]", json: watchedCases, - eval: true, + eval: true }); return isWatched; @@ -225,7 +228,7 @@ const DNSSearchResults = (props) => { "' && @.pinswg_emailnotifications==true)]", json: watchedCases, - eval: true, + eval: true }); return isEmail; }; @@ -247,7 +250,7 @@ const DNSSearchResults = (props) => { let newObj = {}; return Object.assign(newObj, { "@odata.count": required.length, - "value": required, + "value": required }); }; @@ -258,12 +261,12 @@ const DNSSearchResults = (props) => { var dateB = new Date(b.createdon); return dateB - dateA; }); - setWatchedCases(data), + (setWatchedCases(data), getDetailsProxy(data, "myWatchedCases").then( (data) => { setWatchedCasesDetails(data); } - ); + )); }); }); }; @@ -385,7 +388,7 @@ const DNSSearchResults = (props) => { item.ticketnumber + '")]', json: searchDetailsObj, - eval: true, + eval: true }); detailsObj = detailsObj[0]; @@ -399,7 +402,7 @@ const DNSSearchResults = (props) => { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : item[ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" @@ -427,10 +430,10 @@ const DNSSearchResults = (props) => { : "/dns/" + item.ticketnumber : myportal == true - ? "/myportal/dns/" + - item.ticketnumber - : "/dns/" + - item.ticketnumber + ? "/myportal/dns/" + + item.ticketnumber + : "/dns/" + + item.ticketnumber } className="govuk-link--no-underline" onClick={() => { @@ -447,7 +450,7 @@ const DNSSearchResults = (props) => { item.pinswg_appealcasetype, "showMap": showMap, "showLoginCheck": - props.showLoginCheck, + props.showLoginCheck }); }} > @@ -484,32 +487,33 @@ const DNSSearchResults = (props) => { ) < 0 ? detailsObj.pinswg_projectlocation : router.locale == "cy" - ? detailsObj.pinswg_projectlocation.split( - ";" - )[1] - : detailsObj.pinswg_projectlocation.split( - ";" - )[0] + ? detailsObj.pinswg_projectlocation.split( + ";" + )[1] + : detailsObj.pinswg_projectlocation.split( + ";" + )[0] : "" : hasValidKey( - item, - "pinswg_caseaddress" - ) - ? item.pinswg_caseaddress != - null - ? item.pinswg_caseaddress.indexOf( - ";" - ) < 0 - ? item.pinswg_caseaddress - : router.locale == "cy" - ? item.pinswg_caseaddress.split( - ";" - )[1] - : item.pinswg_caseaddress.split( - ";" - )[0] - : "" - : ""} + item, + "pinswg_caseaddress" + ) + ? item.pinswg_caseaddress != + null + ? item.pinswg_caseaddress.indexOf( + ";" + ) < 0 + ? item.pinswg_caseaddress + : router.locale == + "cy" + ? item.pinswg_caseaddress.split( + ";" + )[1] + : item.pinswg_caseaddress.split( + ";" + )[0] + : "" + : ""} {_.has( detailsObj, @@ -574,7 +578,7 @@ const DNSSearchResults = (props) => { : {_.has(detailsObj, [ - "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue", + "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ]) ? detailsObj[ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" @@ -589,7 +593,7 @@ const DNSSearchResults = (props) => { : {_.has(detailsObj, [ - "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", + "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" ]) ? router.locale == "cy" ? jsonpath({ @@ -600,7 +604,7 @@ const DNSSearchResults = (props) => { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : detailsObj[ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" @@ -623,7 +627,7 @@ const DNSSearchResults = (props) => { ] + '")].value_cy', json: transLookup, - eval: true, + eval: true }) : item[ "statuscode@OData.Community.Display.V1.FormattedValue" @@ -782,7 +786,7 @@ const DNSSearchResults = (props) => { "&toWatch=" + item.incidentid + "_" + - item.pinswg_appealcasetype, + item.pinswg_appealcasetype } ); }} @@ -886,7 +890,7 @@ const DNSSearchResults = (props) => { fieldSortState, orderByState, searchLoaded, - getSearchPageResults, + getSearchPageResults ]); return ( <> @@ -1058,14 +1062,14 @@ const mapDispatchToProps = (dispatch) => { }, setCurrentPage: (currentPage) => { dispatch(setCurrentPage(currentPage)); - }, + } }; }; const mapStateToProps = (state) => { return { // currentView: state.currentView, - accountDetails: state.accountDetails, + accountDetails: state.accountDetails // search: state.search, // searchResultsObj: state.searchResultsObj, }; diff --git a/components/search/searchresults.js b/components/search/searchresults.js index b2e72d4c..fdb13543 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -5,7 +5,10 @@ import Link from "next/link"; import { useRouter } from "next/router"; import { useCallback, useState } from "react"; import { connect } from "react-redux"; -import { getAdvancedSearchPaged, getBasicSearchPaged } from "../../actions"; +import { + getAdvancedSearchPaged, + getBasicSearchPaged +} from "../../actions/services/searchService"; import transLookup from "../../data/lookuptranslations.json"; import { setCurrentPage, @@ -32,7 +35,7 @@ import { createWatchedCases, deleteWatchedCases, getWatchedCasesProxy -} from "../../actions"; +} from "../../actions/services/portalService"; import { sendGAEvent } from "@next/third-parties/google"; import RepsOnResults from "./repsonresults";