diff --git a/actions/index.js b/actions/index.js index b37476b1..a660af8c 100644 --- a/actions/index.js +++ b/actions/index.js @@ -998,17 +998,18 @@ export const createNewCaseBlob = ( "&contactid=" + contactid + "&containername=" + - containerName + - hashAPIPath( - "/api/file/createcase_api?appealTypeId=" + - appealTypeId + - "&lpaID=" + - lpaID + - "&contactid=" + - contactid + - "&containername=" + - containerName - ); + containerName; + //+ + // hashAPIPath( + // "/api/file/createcase_api?appealTypeId=" + + // appealTypeId + + // "&lpaID=" + + // lpaID + + // "&contactid=" + + // contactid + + // "&containername=" + + // containerName + // ); var config = { method: "post", diff --git a/actions/selectQueryTypes.js b/actions/selectQueryTypes.js index aa1e657d..19cfb3d4 100644 --- a/actions/selectQueryTypes.js +++ b/actions/selectQueryTypes.js @@ -48,7 +48,7 @@ export const getSelectQuery = (appealTypeName) => { return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_sitepostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_starttimeofevent,pinswg_typeofevent"; break; case "pinswg_planningappeals78s": - return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_representation_period_end_date,pinswg_extend_representation_date,pinswg_typeofevent"; + return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_localplanningauthority_value,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_representation_period_end_date,pinswg_extend_representation_date,pinswg_typeofevent"; break; case "pinswg_planningconditionss73s79s": return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdateofevent,pinswg_typeofevent"; diff --git a/components/case/representation/index.js b/components/case/representation/index.js index d8aaa898..adf952b0 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -278,6 +278,8 @@ let MakeRepresentation = (props) => { "_" + props.props.accountDetails.accountDetails.lastname, "containerID": props.props.accountDetails.containerID, + "appealType": props.props.currentView.caseReference.appealType, + "incidentID": props.props.currentView.caseReference.incidentid, }); updateBody = JSON.stringify(updateBody); diff --git a/components/checkanswers.js b/components/checkanswers.js index 3ce9038f..77ca5ecc 100644 --- a/components/checkanswers.js +++ b/components/checkanswers.js @@ -19,7 +19,6 @@ const CheckAnswers = (props) => { id="main-content" role="main" > - sss { return dd + "/" + mm + "/" + yyyy; } - // console.log( - // currentView.viewKey, - // props[currentView.viewKey], - // props[currentView.viewKey][currentView.viewKey].value - // ); - var searchDetailsObj = currentView.viewKey == "awaitingSubmissionDetails" ? props["awaitingSubmission"].awaitingSubmissionDetails.value + : currentView.viewKey == "myRepresentations" + ? props["myRepresentations"]["myRepresentationsDetails"] : props[currentView.viewKey][currentView.viewKey + "Details"] || []; let resultsRowArr = []; @@ -54,6 +50,13 @@ const ViewAllResults = (props) => { ); detailsObj = detailsObj[0]; + //console.log(searchDetailsObj[key]); + + // searchDetailsObj[key] = + // currentView.viewKey == "myRepresentations" + // ? searchDetailsObj[key].value[0] + // : searchDetailsObj[key]; + resultsRowArr.push(
@@ -110,11 +113,13 @@ const ViewAllResults = (props) => { }} > - Case Reference: + {t("search:searchresults-case-reference-label")} + : - {currentView.viewKey != "watchedCases" - ? resultsArr[key].ticketnumber + ? currentView.viewKey == "myRepresentations" + ? resultsArr[key].casereference + : resultsArr[key].ticketnumber : resultsArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" ]} @@ -139,16 +144,23 @@ const ViewAllResults = (props) => { )[0] : "" : ""} */} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddressline1") ? searchDetailsObj[key].pinswg_siteaddressline1 : ""} - {_.has(detailsObj, "pinswg_siteaddressline1") ? detailsObj.pinswg_siteaddressline1 : ""} - + {currentView.viewKey == "myRepresentations" && + _.has( + searchDetailsObj[key].value[0], + "pinswg_siteaddressline1" + ) + ? searchDetailsObj[key].value[0].pinswg_siteaddressline1 + : ""} + {_.has(detailsObj, "pinswg_siteaddressline1") + ? detailsObj.pinswg_siteaddressline1 + : ""} {currentView.viewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], @@ -156,15 +168,26 @@ const ViewAllResults = (props) => { ) && searchDetailsObj[key].pinswg_siteaddressline1 != null &&
} - + {currentView.viewKey == "myRepresentations" && + _.has( + searchDetailsObj[key].value[0], + "pinswg_siteaddressline1" + ) && + searchDetailsObj[key].value[0] + .pinswg_siteaddressline1 != null &&
} {_.has(detailsObj, "pinswg_siteaddressline1") && detailsObj.pinswg_siteaddressline1 != null &&
} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddressline1") ? searchDetailsObj[key].pinswg_siteaddressline2 : ""} - + {currentView.viewKey == "myRepresentations" && + _.has( + searchDetailsObj[key].value[0], + "pinswg_siteaddressline1" + ) + ? searchDetailsObj[key].value[0].pinswg_siteaddressline2 + : ""} {_.has(detailsObj, "pinswg_siteaddressline1") ? detailsObj.pinswg_siteaddressline2 : ""} @@ -176,18 +199,30 @@ const ViewAllResults = (props) => { searchDetailsObj[key].pinswg_siteaddressline2 != null &&
} + {currentView.viewKey == "myRepresentations" && + _.has( + searchDetailsObj[key].value[0], + "pinswg_siteaddressline2" + ) && + searchDetailsObj[key].value[0] + .pinswg_siteaddressline2 != null &&
} + {_.has(detailsObj, "pinswg_siteaddressline2") && detailsObj.pinswg_siteaddressline2 != null &&
} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddresstown") ? searchDetailsObj[key].pinswg_siteaddresstown : ""} - + {currentView.viewKey == "myRepresentations" && + _.has( + searchDetailsObj[key].value[0], + "pinswg_siteaddresstown" + ) + ? searchDetailsObj[key].value[0].pinswg_siteaddresstown + : ""} {_.has(detailsObj, "pinswg_siteaddresstown") ? detailsObj.pinswg_siteaddresstown : ""} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], @@ -196,18 +231,31 @@ const ViewAllResults = (props) => { searchDetailsObj[key].pinswg_siteaddresstown != null &&
} + {currentView.viewKey == "myRepresentations" && + _.has( + searchDetailsObj[key].value[0], + "pinswg_siteaddresstown" + ) && + searchDetailsObj[key].value[0].pinswg_siteaddresstown != + null &&
} + {_.has(detailsObj, "pinswg_siteaddresstown") && detailsObj.pinswg_siteaddresstown != null &&
} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddresscounty") ? searchDetailsObj[key].pinswg_siteaddresscounty : ""} - + {currentView.viewKey == "myRepresentations" && + _.has( + searchDetailsObj[key].value[0], + "pinswg_siteaddresscounty" + ) + ? searchDetailsObj[key].value[0] + .pinswg_siteaddresscounty + : ""} {_.has(detailsObj, "pinswg_siteaddresscounty") ? detailsObj.pinswg_siteaddresscounty : ""} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has( searchDetailsObj[key], @@ -215,15 +263,12 @@ const ViewAllResults = (props) => { ) && searchDetailsObj[key].pinswg_siteaddresscounty != null &&
} - {_.has(detailsObj, "pinswg_siteaddresscounty") && detailsObj.pinswg_siteaddresscounty != null &&
} - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(searchDetailsObj[key], "pinswg_siteaddresspostcode") ? searchDetailsObj[key].pinswg_siteaddresspostcode : ""} - {_.has(detailsObj, "pinswg_siteaddresspostcode") ? detailsObj.pinswg_siteaddresspostcode : ""} @@ -234,7 +279,6 @@ const ViewAllResults = (props) => { ? t("search:searchresults-created-on-label") : t("search:searchresults-applicant-label")} - {currentView.viewKey == "awaitingSubmissionDetails" ? formatDates(item.createdon) : _.has(detailsObj, [ @@ -243,6 +287,10 @@ const ViewAllResults = (props) => { ? detailsObj[ "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" ] + : currentView.viewKey == "myRepresentations" + ? searchDetailsObj[key].value[0][ + "_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue" + ] : resultsArr[key][ "_customerid_value@OData.Community.Display.V1.FormattedValue" ]} @@ -251,7 +299,6 @@ const ViewAllResults = (props) => { {t("search:searchresults-authority-label")}: - {currentView.viewKey == "awaitingSubmissionDetails" && _.has(resultsArr[key], "pinswg_lpaname") ? router.locale == "cy" @@ -263,7 +310,6 @@ const ViewAllResults = (props) => { ) : resultsArr[key].pinswg_lpaname || "N/A" : ""} - {_.has(resultsArr[key], [ "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue", ]) @@ -280,6 +326,51 @@ const ViewAllResults = (props) => { "_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue" ] || "N/A" : ""} + {_.has(searchDetailsObj[key], [ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue", + ]) + ? router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + searchDetailsObj[key].value[0][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValuee" + ] + + '")].value_cy' + ) + : searchDetailsObj[key].value[0][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] || "N/A" + : ""} + {_.has(resultsArr[key], [ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue", + ]) + ? router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + resultsArr[key][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValuee" + ] + + '")].value_cy' + ) + : resultsArr[key][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] || + (currentView.viewKey == "myRepresentations" + ? "" + : "N/A") + : currentView.viewKey == "myRepresentations" && + router.locale == "cy" && + jsonpath.query( + transLookup, + '$..[?(@.value=="' + + searchDetailsObj[key].value[0][ + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + )} + qqq
@@ -309,7 +400,32 @@ const ViewAllResults = (props) => { ) : item[ "pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue" - ] || "N/A"} + ] || + (currentView.viewKey == "myRepresentations" + ? "" + : "N/A")} + + {currentView.viewKey == "myRepresentations" && + (router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + getFormCollectionByID( + searchDetailsObj[key].value[0][ + "pinswg_procedure" + ] + ).value + + '")].value_cy' + )[0] + : getFormCollectionByID( + searchDetailsObj[key].value[0][ + "pinswg_procedure" + ] + ).value)} + {_.has( + searchDetailsObj[key], + "_pinswg_localplanningauthority_value@OData.Community.Display.V1.FormattedValue" + )}
@@ -330,6 +446,19 @@ const ViewAllResults = (props) => { item.statuscode + '")].value' ) || "N/A" + : currentView.viewKey == "myRepresentations" + ? router.locale == "cy" + ? jsonpath.query( + transLookup, + '$..[?(@.value=="' + + searchDetailsObj[key].value[0][ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] + + '")].value_cy' + ) + : searchDetailsObj[key].value[0][ + "statuscode@OData.Community.Display.V1.FormattedValue" + ] || "N/A" : router.locale == "cy" ? jsonpath.query( transLookup, diff --git a/components/myportal/watchedcases.js b/components/myportal/watchedcases.js index 1d871c80..b5345be3 100644 --- a/components/myportal/watchedcases.js +++ b/components/myportal/watchedcases.js @@ -51,7 +51,7 @@ const WatchedCases = (props) => { const mapDispatchToProps = (dispatch) => { return { setCurrentView: (currentView) => { - console.log(currentView); + //console.log(currentView); dispatch(setCurrentView(currentView)); }, }; diff --git a/pages/myportal/index.js b/pages/myportal/index.js index 8e4558b5..fd52a788 100644 --- a/pages/myportal/index.js +++ b/pages/myportal/index.js @@ -219,10 +219,12 @@ export const getServerSideProps = wrapper.getServerSideProps( myCasesDetails, watchedCasesDetails, awaitingSubmissionDetails, + myRepresentationsDetails, ] = await Promise.all([ await getDetails(myCases, "myCases"), await getDetails(watchedCases, "myWatchedCases"), await getDetails(awaitingSubmission, "awaitingSubmission"), + await getDetails(myRepresentations, "myRepresentations"), ]); store.dispatch(setAccountDetails(accountDetails)); @@ -230,6 +232,9 @@ export const getServerSideProps = wrapper.getServerSideProps( store.dispatch(setMyCases(myCases)); store.dispatch(setMyCasesDetails(myCasesDetails)); store.dispatch(setMyRepresentations(myRepresentations)); + store.dispatch( + setMyRepresentationsDetails(myRepresentationsDetails) + ); store.dispatch(setWatchedCases(watchedCases)); store.dispatch(setWatchedCasesDetails(watchedCasesDetails)); @@ -256,11 +261,11 @@ export const getServerSideProps = wrapper.getServerSideProps( const getDetails = (resultsObj, detailsType) => { let detailsArr = []; resultsObj = resultsObj.value; - if (detailsType == "myRepresentations") { const repsObj = resultsObj.map((searchDetail, index) => { + console.log("==== ", searchDetail["_pinswg_case_value"]); detailsArr.push( - getCase(searchDetail["_pinswg_case_value"]).then((data) => { + getCase(searchDetail["incidentID"]).then((data) => { return getPortalModuleDetails( getFormCollectionByID(data.pinswg_appealcasetype) .LogicalCollectionName,