diff --git a/actions/index.js b/actions/index.js index 8d110ab1..f02dc4b5 100644 --- a/actions/index.js +++ b/actions/index.js @@ -77,6 +77,19 @@ export const azureHeaders = (access_token) => { }; }; +export const azureHeadersNoOdata = (access_token) => { + return { + headers: { + //"OData-MaxVersion": "4.0", + //"OData-Version": "4.0", + //"Accept": "application/json;odata.metadata=none", + //"Prefer": 'odata.include-annotations="*",return=representation', + "Content-Type": "application/json", + "Authorization": "Bearer " + access_token, + }, + }; +}; + export const azureHeadersPaged = (access_token) => { return { headers: { @@ -145,6 +158,22 @@ export const getBasicSearch = (searchString) => { }); }; +export const getPartSavedAppeal = (searchString) => { + return axios + .get( + BASE_URL + + "/api/endpoint/getpartsavedappeal_api?searchString=" + + searchString + ) + .then((res) => { + return res.data; + }) + .catch((error) => { + console.log(error); + return error.response; + }); +}; + export const getBasicDNSURLSearch = (searchString) => { return axios .get( @@ -322,6 +351,38 @@ export const getBasicSearchDetails = ( }); }; +export const getBasicPartSavedDetails = ( + appealTypeName, + caseReference, + primaryIdAttribute, + incidentID +) => { + console.log( + "///////api call: ", + BASE_URL + + "/api/endpoint/getbasicpartsaveddetails_api?appealTypeName=" + + appealTypeName + + "&primaryIdAttribute=" + + primaryIdAttribute + + "&incidentID=" + + incidentID + ); + return axios + .get( + BASE_URL + + "/api/endpoint/getbasicpartsaveddetails_api?appealTypeName=" + + appealTypeName + + "&primaryIdAttribute=" + + primaryIdAttribute + + "&incidentID=" + + incidentID + ) + .then((res) => res.data) + .catch((error) => { + console.log("this error", error); + }); +}; + export const getBasicSearchDetailsPaged = ( appealTypeName, caseReference, @@ -670,13 +731,20 @@ export const getAwaitingSubmission = (loggedInUserId) => { }; export const getPortalModuleDetails = (appealType, caseReference) => { + console.log( + BASE_URL + + "/api/endpoint/getportalmoduledetails_api?appealType=" + + appealType + + "&caseReference=" + + encodeURI(caseReference) + ); return axios .get( BASE_URL + "/api/endpoint/getportalmoduledetails_api?appealType=" + appealType + "&caseReference=" + - caseReference + encodeURI(caseReference) ) .then((res) => res.data) .catch((error) => { @@ -904,3 +972,36 @@ export const createAccount = (formValues) => { console.log("this serror", error); }); }; + +export const uploadFiles = (formValues) => { + var data = formValues; + var queryUrl = "/api/uploads"; + var config = { + method: "post", + url: queryUrl, + data: data, + }; + + // const config = { + // method: "post", + // url: queryUrl, + // data: data, + // headers: { "content-type": "multipart/form-data" }, + // onUploadProgress: (event) => { + // console.log( + // `Current progress:`, + // Math.round((event.loaded * 100) / event.total) + // ); + // }, + // }; + + console.log(config); + return axios(config) + .then((res) => { + // console.log("posted ", res.data); + return res.data; + }) + .catch((error) => { + console.log("this serror", error); + }); +}; diff --git a/actions/selectQueryTypes.js b/actions/selectQueryTypes.js index bd5d87bd..edf9ae11 100644 --- a/actions/selectQueryTypes.js +++ b/actions/selectQueryTypes.js @@ -19,7 +19,7 @@ export const getSelectQuery = (appealTypeName) => { case "pinswg_compulsorypurchaseorderses": return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddresscounty,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_proofsofevidencewrittenstatementsofeviden,pinswg_questionnaireduedate,pinswg_relevantauthorityname,pinswg_startdate,statuscode"; case "pinswg_dnses": - return "&$select=pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage"; + return "&$select=pinswg_anticipatedgridreferenceeastingtext,pinswg_anticipatedgridreferencenorthingtext,_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_addresscounty,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_choiceofprocedure,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofdecision,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,_pinswg_dnsids_value"; case "pinswg_electricityacts": return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_addressline1,pinswg_addressline2,pinswg_postcode,pinswg_addresstown,_pinswg_associatedlpa_value,pinswg_applicationacceptedasvalid,pinswg_applicationrejectedasinvalid,pinswg_confirmrequesttovaryapplication,pinswg_dateeventrequested,pinswg_dateofrequesttovarytheapplication,pinswg_dateofsubmissionofapplication,pinswg_dateprojectpublishedonwebsite,pinswg_deadlineforsubmissionofapplication,pinswg_decision,pinswg_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode"; case "pinswg_householderappealhases": diff --git a/components/case.js b/components/case.js index f6c2ab0a..09b602c3 100644 --- a/components/case.js +++ b/components/case.js @@ -35,6 +35,7 @@ const Case = (props) => { searchDetailsObj={props.searchDetailsObj} searchString={props.searchString} incidentid={props.incidentid} + showMap={props.showMap} /> { setCurrentLinkedCases, linkedCasesReference, setCurrentReference, + showMap, } = props; const noRepresentationLink = [ @@ -414,6 +415,7 @@ const CaseSummary = (props) => { formatDates={formatDates} linkedCasesList={linkedCasesList} currentView={props.currentView} + showMap={showMap} /> ); break; diff --git a/components/case/summaryTypes/pinswg_dnsid.js b/components/case/summaryTypes/pinswg_dnsid.js index 530f418b..bba52130 100644 --- a/components/case/summaryTypes/pinswg_dnsid.js +++ b/components/case/summaryTypes/pinswg_dnsid.js @@ -13,7 +13,8 @@ import OSPoint from "ospoint"; const Pinswg_dnsid = (props) => { let { t } = useTranslation(); - const { casesObj, detailsObj, formatDates, linkedCasesList } = props; + const { casesObj, detailsObj, formatDates, linkedCasesList, showMap } = + props; const router = useRouter(); const { locale } = router; @@ -44,7 +45,13 @@ const Pinswg_dnsid = (props) => { {detailsObj.pinswg_projectdescription != null ? (
-
+

{t("case:summary-project-details-label")}

@@ -80,22 +87,22 @@ const Pinswg_dnsid = (props) => { : ""}

*/}
- {/* {process.env.SHOWMAPS == "true" && ( */} -
-
- - {/* */} + {showMap == "true" && ( +
+
+ + {/* */} +
-
- {/* )} */} + )}
) : ( @@ -153,23 +160,6 @@ const Pinswg_dnsid = (props) => { ] || ""}
-
-
- {t( - "case:summary-case-officer-label" - )} -
-
- {" "} - {/* {casesObj.caseDetails.caseOfficer || - ""} */} - {_.has(casesObj, "_ownerid_value") - ? casesObj[ - "_ownerid_value@OData.Community.Display.V1.FormattedValue" - ] - : ""} -
-
{t("case:summary-procedure-label")} @@ -186,7 +176,10 @@ const Pinswg_dnsid = (props) => { ) : detailsObj[ "pinswg_choiceofprocedure@OData.Community.Display.V1.FormattedValue" - ] || ""} + ] || + t( + "case:summary-to-be-confirmed-label" + )}
@@ -207,7 +200,47 @@ const Pinswg_dnsid = (props) => { "statuscode@OData.Community.Display.V1.FormattedValue" ] || t( - "case:summary-no-date-entered-label" + "case:summary-to-be-confirmed-label" + )} + +
+
+
+ {t( + "case:summary-case-officer-label" + )} +
+
+ {" "} + {/* {casesObj.caseDetails.caseOfficer || + ""} */} + {_.has(casesObj, "_ownerid_value") + ? casesObj[ + "_ownerid_value@OData.Community.Display.V1.FormattedValue" + ] + : ""} +
+
+
+
+ {t("case:summary-event-date-label")} +
+
+ {_.has( + detailsObj, + "pinswg_dateeventrequested" + ) + ? !_.isEmpty( + detailsObj.pinswg_dateeventrequested + ) + ? formatDates( + detailsObj.pinswg_dateeventrequested + ) + : t( + "case:summary-to-be-confirmed-label" + ) + : t( + "case:summary-to-be-confirmed-label" )}
@@ -229,7 +262,7 @@ const Pinswg_dnsid = (props) => { "pinswg_decision@OData.Community.Display.V1.FormattedValue" ] || t( - "case:summary-no-date-entered-label" + "case:summary-no-information-to-date-label" )}
@@ -241,6 +274,31 @@ const Pinswg_dnsid = (props) => { */}
+
+
+ {t( + "case:summary-decision-date-label" + )} +
+
+ {_.has( + detailsObj, + "pinswg_casedecisiondate" + ) + ? !_.isEmpty( + detailsObj.pinswg_casedecisiondate + ) + ? formatDates( + detailsObj.pinswg_casedecisiondate + ) + : t( + "case:summary-no-information-to-date-label" + ) + : t( + "case:summary-no-information-to-date-label" + )} +
+
{casesObj.numberofchildincidents > 0 && (
@@ -283,7 +341,7 @@ const Pinswg_dnsid = (props) => { ) : ( "" )} -
+ {/*
{t( "case:summary-case-recommendation-label" @@ -299,7 +357,7 @@ const Pinswg_dnsid = (props) => { ) : detailsObj.pinswg_recommendation} -
+ */} {detailsObj.pinswg_webaddress != null && (
@@ -353,53 +411,104 @@ const Pinswg_dnsid = (props) => {
- {t("case:summary-event-date-label")} -
+ {t( + "case:summary-valid-notice-of-intention-to-submit-an-application" + )} + {" "}
{_.has( detailsObj, - "pinswg_dateeventrequested" + "pinswg_validnoticeofintentiontosubmitanapplicati" ) ? !_.isEmpty( - detailsObj.pinswg_dateeventrequested + detailsObj.pinswg_validnoticeofintentiontosubmitanapplicati ) ? formatDates( - detailsObj.pinswg_dateeventrequested + detailsObj.pinswg_validnoticeofintentiontosubmitanapplicati ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" )}
{t( - "case:summary-decision-date-label" + "case:summary-written-acceptance-of-notice" )}
{_.has( detailsObj, - "pinswg_casedecisiondate" + "pinswg_writtenacceptanceofnotification" ) ? !_.isEmpty( - detailsObj.pinswg_casedecisiondate + detailsObj.pinswg_writtenacceptanceofnotification ) ? formatDates( - detailsObj.pinswg_casedecisiondate + detailsObj.pinswg_writtenacceptanceofnotification ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" + )} +
+
+
+
+ {t( + "case:summary-deadline-for-submission-of-application" + )} +
+
+ {_.has( + detailsObj, + "pinswg_deadlineforsubmissionofapplication" + ) + ? !_.isEmpty( + detailsObj.pinswg_deadlineforsubmissionofapplication + ) + ? formatDates( + detailsObj.pinswg_deadlineforsubmissionofapplication + ) + : t( + "case:summary-awaiting-information-label" + ) + : t( + "case:summary-awaiting-information-label" + )} +
+
+
+
+ {t( + "case:summary-date-of-submission-of-application" + )} +
+
+ {_.has( + detailsObj, + "pinswg_dateofsubmissionofapplication" + ) + ? !_.isEmpty( + detailsObj.pinswg_dateofsubmissionofapplication + ) + ? formatDates( + detailsObj.pinswg_dateofsubmissionofapplication + ) + : t( + "case:summary-awaiting-information-label" + ) + : t( + "case:summary-awaiting-information-label" )}
-
{t( @@ -418,10 +527,10 @@ const Pinswg_dnsid = (props) => { detailsObj.pinswg_applicationacceptedasvalid ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" )}
@@ -443,10 +552,60 @@ const Pinswg_dnsid = (props) => { detailsObj.pinswg_applicationrejectedasinvalid ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" + )} + +
+
+
+ {t( + "case:summary-end-of-representation-period" + )} +
+
+ {_.has( + detailsObj, + "pinswg_endofrepresentationperiod" + ) + ? !_.isEmpty( + detailsObj.pinswg_endofrepresentationperiod + ) + ? formatDates( + detailsObj.pinswg_endofrepresentationperiod + ) + : t( + "case:summary-awaiting-information-label" + ) + : t( + "case:summary-awaiting-information-label" + )} +
+
+
+
+ {t( + "case:summary-date-of-request-to-vary" + )} +
+
+ {_.has( + detailsObj, + "pinswg_dateofrequesttovarytheapplication" + ) + ? !_.isEmpty( + detailsObj.pinswg_dateofrequesttovarytheapplication + ) + ? formatDates( + detailsObj.pinswg_dateofrequesttovarytheapplication + ) + : t( + "case:summary-awaiting-information-label" + ) + : t( + "case:summary-awaiting-information-label" )}
@@ -468,14 +627,64 @@ const Pinswg_dnsid = (props) => { detailsObj.pinswg_confirmrequesttovaryapplication ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" )}
+
+ {t( + "case:summary-reject-request-to-vary-application" + )} +
+
+ {_.has( + detailsObj, + "pinswg_rejectrequesttovaryapplication" + ) + ? !_.isEmpty( + detailsObj.pinswg_rejectrequesttovaryapplication + ) + ? formatDates( + detailsObj.pinswg_rejectrequesttovaryapplication + ) + : t( + "case:summary-awaiting-information-label" + ) + : t( + "case:summary-awaiting-information-label" + )} +
+
+
+
+ {t( + "case:summary-suspension-start-dates" + )} +
+
+ {_.has( + detailsObj, + "pinswg_suspensionstartdates" + ) + ? !_.isEmpty( + detailsObj.pinswg_suspensionstartdates + ) + ? formatDates( + detailsObj.pinswg_suspensionstartdates + ) + : t( + "case:summary-awaiting-information-label" + ) + : t( + "case:summary-awaiting-information-label" + )} +
+
+ {/*
{t( "case:summary-date-of-decisions" @@ -499,58 +708,9 @@ const Pinswg_dnsid = (props) => { "case:summary-no-date-entered-label" )} -
-
-
- {t( - "case:summary-date-of-request-to-vary" - )} -
-
- {_.has( - detailsObj, - "pinswg_dateofrequesttovarytheapplication" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateofrequesttovarytheapplication - ) - ? formatDates( - detailsObj.pinswg_dateofrequesttovarytheapplication - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} -
-
-
-
- {t( - "case:summary-date-of-submission-of-application" - )} -
-
- {_.has( - detailsObj, - "pinswg_dateofsubmissionofapplication" - ) - ? !_.isEmpty( - detailsObj.pinswg_dateofsubmissionofapplication - ) - ? formatDates( - detailsObj.pinswg_dateofsubmissionofapplication - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} -
-
-
+
*/} + + {/*
{t( "case:summary-date-project-published-to-website" @@ -574,83 +734,8 @@ const Pinswg_dnsid = (props) => { "case:summary-no-date-entered-label" )} -
-
-
- {t( - "case:summary-deadline-for-submission-of-application" - )} -
-
- {_.has( - detailsObj, - "pinswg_deadlineforsubmissionofapplication" - ) - ? !_.isEmpty( - detailsObj.pinswg_deadlineforsubmissionofapplication - ) - ? formatDates( - detailsObj.pinswg_deadlineforsubmissionofapplication - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} -
-
-
-
- {t( - "case:summary-end-of-representation-period" - )} -
-
- {_.has( - detailsObj, - "pinswg_endofrepresentationperiod" - ) - ? !_.isEmpty( - detailsObj.pinswg_endofrepresentationperiod - ) - ? formatDates( - detailsObj.pinswg_endofrepresentationperiod - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} -
-
-
-
- {t( - "case:summary-inspector-report-submission-to-welsh-government" - )} -
-
- {_.has( - detailsObj, - "pinswg_inspectorreportsubmittedtowelshgovernment" - ) - ? !_.isEmpty( - detailsObj.pinswg_inspectorreportsubmittedtowelshgovernment - ) - ? formatDates( - detailsObj.pinswg_inspectorreportsubmittedtowelshgovernment - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} -
-
-
+
*/} + {/*
{t( "case:summary-procedure-confirmed" @@ -674,29 +759,30 @@ const Pinswg_dnsid = (props) => { "case:summary-no-date-entered-label" )} -
+ */} +
{t( - "case:summary-reject-request-to-vary-application" + "case:summary-suspension-end-dates" )}
{_.has( detailsObj, - "pinswg_rejectrequesttovaryapplication" + "pinswg_suspensionenddates" ) ? !_.isEmpty( - detailsObj.pinswg_rejectrequesttovaryapplication + detailsObj.pinswg_suspensionenddates ) ? formatDates( - detailsObj.pinswg_rejectrequesttovaryapplication + detailsObj.pinswg_suspensionenddates ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" )}
@@ -716,14 +802,14 @@ const Pinswg_dnsid = (props) => { detailsObj.pinswg_reportdueby ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" )} -
+ {/*
{t("case:summary-suspension-dates")}
@@ -745,79 +831,29 @@ const Pinswg_dnsid = (props) => { "case:summary-no-date-entered-label" )} -
+
*/}
{t( - "case:summary-suspension-end-dates" + "case:summary-inspector-report-submission-to-welsh-government" )}
{_.has( detailsObj, - "pinswg_suspensionenddates" + "pinswg_inspectorreportsubmittedtowelshgovernment" ) ? !_.isEmpty( - detailsObj.pinswg_suspensionenddates + detailsObj.pinswg_inspectorreportsubmittedtowelshgovernment ) ? formatDates( - detailsObj.pinswg_suspensionenddates + detailsObj.pinswg_inspectorreportsubmittedtowelshgovernment ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" ) : t( - "case:summary-no-date-entered-label" - )} -
-
-
-
- {t( - "case:summary-suspension-start-dates" - )} -
-
- {_.has( - detailsObj, - "pinswg_suspensionstartdates" - ) - ? !_.isEmpty( - detailsObj.pinswg_suspensionstartdates - ) - ? formatDates( - detailsObj.pinswg_suspensionstartdates - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" - )} -
-
-
-
- {t( - "case:summary-valid-notice-of-intention-to-submit-an-application" - )} -
{" "} -
- {_.has( - detailsObj, - "pinswg_validnoticeofintentiontosubmitanapplicati" - ) - ? !_.isEmpty( - detailsObj.pinswg_validnoticeofintentiontosubmitanapplicati - ) - ? formatDates( - detailsObj.pinswg_validnoticeofintentiontosubmitanapplicati - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" )}
@@ -837,35 +873,10 @@ const Pinswg_dnsid = (props) => { detailsObj.pinswg_withdrawndate ) : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" ) : t( - "case:summary-no-date-entered-label" - )} - - -
-
- {t( - "case:summary-written-acceptance-of-notice" - )} -
-
- {_.has( - detailsObj, - "pinswg_writtenacceptanceofnotification" - ) - ? !_.isEmpty( - detailsObj.pinswg_writtenacceptanceofnotification - ) - ? formatDates( - detailsObj.pinswg_writtenacceptanceofnotification - ) - : t( - "case:summary-no-date-entered-label" - ) - : t( - "case:summary-no-date-entered-label" + "case:summary-awaiting-information-label" )}
diff --git a/components/dnssearchresults.js b/components/dnssearchresults.js index 4b4f1943..8824721f 100644 --- a/components/dnssearchresults.js +++ b/components/dnssearchresults.js @@ -7,7 +7,8 @@ import DNSSearchResults from "./search/dnssearchresults"; import CRMError from "./crmError"; export default function Search(props) { - const { searchString, searchResultsObj, myportal, watchedCases } = props; + const { searchString, searchResultsObj, myportal, watchedCases, showMap } = + props; let { t } = useTranslation(); const router = useRouter(); @@ -42,6 +43,7 @@ export default function Search(props) { dnsCoords={searchResultsObj.dnsCoordsObj.value} myportal={myportal} watchedCases={watchedCases} + showMap={showMap} /> diff --git a/components/elements/index.js b/components/elements/index.js index 5074f000..4552a5c5 100644 --- a/components/elements/index.js +++ b/components/elements/index.js @@ -22,6 +22,7 @@ import { subYears, subMonths, subDays, + parseISO, } from "date-fns"; const RenderTextfield = ({ @@ -344,20 +345,29 @@ const RenderDatePicker = ({ {errorMsg} )} + + {/* {value} +
+ {moment(value).format("DD/MM/YY")} +
*/} + @@ -558,6 +568,7 @@ const RenderYesNo = ({ type="radio" className="govuk-radios__input" value={options[key]} + //checked={value == options[key]} onChange={(e) => { let docListObj = custom.documentList; if ( @@ -694,6 +705,10 @@ const RenderRadio = ({ type="radio" className="govuk-radios__input" value={options[key].split("|")[0]} + // checked={ + // value == + // parseInt(options[key].split("|")[0]) + // } onChange={(e) => { let docListObj = custom.documentList; if ( @@ -752,15 +767,23 @@ export function Radiofield(props) { .split(","); //parentFieldShowOnValue - var showIfHasParentShowValue = - parentField != false && - !_.isEmpty(formProps[form]) && - _.has(formProps[form].values, parentField) && - parentFieldShowOnValue.indexOf( - formProps[form].values[parentField].toString() - ) > -1; + var showIfHasParentShowValue = parentField != false; + //debugger; + // parentField != false && + // !_.isEmpty(formProps[form]) && + // _.has(formProps[form].values, parentField) && + // parentFieldShowOnValue.indexOf( + // formProps[form].values[parentField].toString() + // ) > -1; - // console.log(showIfHasParentShowValue); + (showIfHasParentShowValue == parentField) != false && + showIfHasParentShowValue; + + console.log( + datafieldname, + showIfHasParentShowValue, + formProps[form].values[parentField] + ); return ( <> diff --git a/components/myportal/topthree.js b/components/myportal/topthree.js index 6787d384..b0094833 100644 --- a/components/myportal/topthree.js +++ b/components/myportal/topthree.js @@ -175,6 +175,11 @@ const TopThree = (props) => { className="govuk-link--no-underline" data-id={index} onClick={() => { + topThreeType == "awaitingSubmission" && + console.log( + "appealDetails" + // props.props.awaitingSubmission + ); setCurrentReference({ "currentReference": topThreeType != "watchedCases" @@ -209,7 +214,7 @@ const TopThree = (props) => { ] : showTopThreeArr[key][ "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" - ]} + ]}{" "} diff --git a/components/myportal/viewall.js b/components/myportal/viewall.js index 49b4cd58..a59bf55f 100644 --- a/components/myportal/viewall.js +++ b/components/myportal/viewall.js @@ -46,7 +46,7 @@ const ViewAllResults = (props) => { resultsArr.map((item, key) => { let detailsObj = jsonpath.query( searchDetailsObj, - "$..value[?(@.pinswg_name=='" + item.pinswg_title + "')]" + '$..value[?(@.pinswg_name=="' + item.pinswg_title + '")]' ); detailsObj = detailsObj[0]; diff --git a/components/newappeal/buildsection.js b/components/newappeal/buildsection.js index 28edc2f6..0ee9b9e7 100644 --- a/components/newappeal/buildsection.js +++ b/components/newappeal/buildsection.js @@ -12,6 +12,8 @@ import { setCurrentSection, setDocumentsList, } from "../../store/appealType/action"; +import { getFormCollectionByID } from "../utils"; +import { updateCase, patchCase } from "../../actions"; import { FieldsTranslations } from "../elements"; @@ -32,6 +34,9 @@ let BuildSection = (props) => { sectionCount, onSubmit, handleSubmit, + load, + pristine, + reset, formTitle, setCurrentSection, refno, @@ -62,7 +67,64 @@ let BuildSection = (props) => { const handleParam = (setValue) => (e) => setValue(e.target.value); + const updateCaseProgress = (values) => { + let incidentId = props.appealType.caseReference.incidentid; + let updateBody = values || {}; + + let appTypeCollection = getFormCollectionByID( + props.appealType.appealTypeID + ); + let updateBindAppealTypeToIncident = + appTypeCollection.NavigationProperty; + + Object.assign(updateBody, { + "pinswg_Appellant@odata.bind": + "/contacts(" + props.props.accountDetails.loggedinUserId + ")", + "pinswg_name": props.appealType.caseReference.ticketnumber, + [updateBindAppealTypeToIncident + "@odata.bind"]: + "/incidents(" + incidentId + ")", + }); + + updateBody = JSON.stringify(updateBody); + updateBody = updateBody.replace(/:"Yes"/gm, `:true`); + updateBody = updateBody.replace(/:"No"/gm, `:false`); + updateBody = JSON.parse(updateBody); + + Object.keys(updateBody).forEach((key) => { + if (updateBody[key] === null) { + delete updateBody[key]; + } + if (key.indexOf("_") == 0) { + delete updateBody[key]; + } + }); + + console.log(updateBody); + + let updateFormCollection = appTypeCollection.LogicalCollectionName; + let primaryAttribute = appTypeCollection.PrimaryIdAttribute; + + console.log( + incidentId, + updateBody, + updateFormCollection, + primaryAttribute, + props.appealType.caseReference.ticketnumber + ); + updateCase( + incidentId, + updateBody, + updateFormCollection, + primaryAttribute, + props.appealType.caseReference.ticketnumber + ); + //console.log("patching////////"); + //patchCase(incidentId); + }; + const onHandleSubmit = (values) => { + //alert(1); + //updateCaseProgress(values); setCurrentSection(currentSection + 1); }; @@ -198,86 +260,116 @@ let BuildSection = (props) => {
- - - {Object.keys(documentListObj).length > 0 && ( -
-

- {t("newappeal:new-appeal-documentlist-nav")}: +
+
- )} + + + {Object.keys(documentListObj).length > 0 && ( +
+

+ {t("newappeal:new-appeal-documentlist-nav")}: +

+
+
    +
      +
    • +
        + {Object.entries( + documentListObj + ).map(([key, value]) => { + return ( +
      1. {value}
      2. + ); + })} +
      +
    • +
    +
+
+ )} +
+ +

); @@ -289,6 +381,7 @@ const mapStateToProps = (state) => { searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, + initialValues: state.appealType.caseReference.caseDetails, //form: state.form, }; }; @@ -316,5 +409,6 @@ export default connect( reduxForm({ form: "appealForm", destroyOnUnmount: false, + enableReinitialize: true, // this is needed!! })(BuildSection) ); diff --git a/components/search/dnssearchresults.js b/components/search/dnssearchresults.js index e9f3c952..e4f9ab6a 100644 --- a/components/search/dnssearchresults.js +++ b/components/search/dnssearchresults.js @@ -53,6 +53,7 @@ const DNSSearchResults = (props) => { watchedCases, setWatchedCases, setWatchedCasesDetails, + showMap, } = props; let { t } = useTranslation(); @@ -302,9 +303,9 @@ const DNSSearchResults = (props) => { resultsArr.map((item, key) => { let detailsObj = jsonpath.query( searchDetailsObj, - "$..value[?(@.pinswg_name=='" + + '$..value[?(@.pinswg_name=="' + item.title + - "')]" + '")]' ); detailsObj = detailsObj[0]; @@ -339,6 +340,7 @@ const DNSSearchResults = (props) => { item.incidentid, "appealType": item.pinswg_appealcasetype, + "showMap": showMap, }); }} > @@ -619,7 +621,13 @@ const DNSSearchResults = (props) => { <>
-
+

{t("dnsApplications:page-title")}

@@ -644,37 +652,37 @@ const DNSSearchResults = (props) => {
- {/* {process.env.SHOWMAPS == "true" && ( */} -
-
- +
- ModelsMap(map, maps) - } - /> + > + + ModelsMap(map, maps) + } + /> +
-
- {/* )} */} + )}
{searchResultsObj["@odata.count"] > 5 && ( diff --git a/components/search/searchresults.js b/components/search/searchresults.js index 9acda3a0..926d9d26 100644 --- a/components/search/searchresults.js +++ b/components/search/searchresults.js @@ -247,9 +247,9 @@ const SearchResults = (props) => { resultsArr.map((item, key) => { let detailsObj = jsonpath.query( searchDetailsObj, - "$..value[?(@.pinswg_name=='" + + '$..value[?(@.pinswg_name=="' + item.title + - "')]" + '")]' ); detailsObj = detailsObj[0]; return ( diff --git a/components/utils/index.js b/components/utils/index.js index 14530bd4..2c8d8a23 100644 --- a/components/utils/index.js +++ b/components/utils/index.js @@ -3,6 +3,7 @@ import data from "../../data/collections.json"; import { getBasicSearchDetails, getBasicSearchDetailsPaged, + getBasicPartSavedDetails, } from "../../actions"; /* @@ -69,6 +70,37 @@ export const getSearchDetails = (searchResultsObj) => { return Promise.all(detailsArr); }; +/* + * Get the partially saved details of a case from the appeal type + * @param object searchResultsObj + */ +export const getPartSavedDetails = (searchResultsObj) => { + //console.log(searchResultsObj); + + let detailsArr = []; + searchResultsObj = searchResultsObj.value; + const detailsObj = searchResultsObj.map((searchDetail, index) => { + if (searchDetail.pinswg_appealcasetype == null) { + console.log(searchDetail.title); + } else { + let formMeta = getFormCollectionByID( + searchDetail.pinswg_appealcasetype + ); + console.log(formMeta); + detailsArr.push( + getBasicPartSavedDetails( + formMeta.LogicalCollectionName, + searchDetail.title, + formMeta.PrimaryIdAttribute, + searchDetail.incidentid + ) + ); + } + }); + //console.log(detailsArr); + return Promise.all(detailsArr); +}; + /* * Get the details of a case from the appeal type * @param object searchResultsObj diff --git a/locales/cy/case.json b/locales/cy/case.json index 47a1c822..1675e417 100644 --- a/locales/cy/case.json +++ b/locales/cy/case.json @@ -24,6 +24,9 @@ "summary-linked-cases-label": "Achosion cysylltiedig", "summary-dates-label": "Dyddiadau", "summary-no-date-entered-label": "dim dyddiad wedi'i nodi", + "summary-no-information-to-date-label": "Dim gwybodaeth hyd yma", + "summary-awaiting-information-label": "Aros am wybodaeth", + "summary-to-be-confirmed-label": "I gael ei gadarnhau", "summary-start-date-label": "Dyddiad Dechrau", "summary-questionnaire-due-date-label": "Holiadur i ddod", "summary-statement-due-date-label": "Datganiad(au) i ddod", diff --git a/locales/en/case.json b/locales/en/case.json index dd3ccdae..1f7fd05c 100644 --- a/locales/en/case.json +++ b/locales/en/case.json @@ -24,6 +24,9 @@ "summary-linked-cases-label": "Linked Cases", "summary-dates-label": "Dates", "summary-no-date-entered-label": "no date entered", + "summary-no-information-to-date-label": "No information to date", + "summary-awaiting-information-label": "Awaiting information", + "summary-to-be-confirmed-label": "To be confirmed", "summary-start-date-label": "Start Date", "summary-questionnaire-due-date-label": "Questionnaire due", "summary-statement-due-date-label": "Statement(s) due", diff --git a/pages/api/endpoint/getappealtypes_api.js b/pages/api/endpoint/getappealtypes_api.js index 3165624e..13c7c874 100644 --- a/pages/api/endpoint/getappealtypes_api.js +++ b/pages/api/endpoint/getappealtypes_api.js @@ -34,7 +34,8 @@ export default async function ApiProxy(req, res) { var token = await getToken(); var queryUrl = - "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Developments of National Significance' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc"; + "stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc"; + //"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Developments of National Significance' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc"; console.log(queryUrl); return axios diff --git a/pages/api/endpoint/getbasicpartsaveddetails_api.js b/pages/api/endpoint/getbasicpartsaveddetails_api.js new file mode 100644 index 00000000..31b1d9a2 --- /dev/null +++ b/pages/api/endpoint/getbasicpartsaveddetails_api.js @@ -0,0 +1,50 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import { getToken, azureHeadersNoOdata } from "../../../actions"; +import { getSelectQuery } from "../../../actions/selectQueryTypes"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var appealTypeName = req.query.appealTypeName; + var primaryIdAttribute = req.query.primaryIdAttribute; + var incidentID = req.query.incidentID; + var token = await getToken(); + + var queryUrl = + appealTypeName + + "?$filter=_" + + primaryIdAttribute + + "s_value eq " + + incidentID + + "&$count=true"; + + queryUrl = queryUrl; //+ getSelectQuery(appealTypeName); + + //console.log("query: ", queryUrl, "<<< { + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }); +} diff --git a/pages/api/endpoint/getbasicsearch_api.js b/pages/api/endpoint/getbasicsearch_api.js index ac577c1b..90ccf283 100644 --- a/pages/api/endpoint/getbasicsearch_api.js +++ b/pages/api/endpoint/getbasicsearch_api.js @@ -32,7 +32,7 @@ export default async function ApiProxy(req, res) { searchString + "')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true"; - // console.log("basic search ", queryUrl); + console.log("basic search ", queryUrl); var apiResponse = _.isEmpty(req.query) ? res.status(400).json() diff --git a/pages/api/endpoint/getpartsavedappeal_api.js b/pages/api/endpoint/getpartsavedappeal_api.js new file mode 100644 index 00000000..4479de78 --- /dev/null +++ b/pages/api/endpoint/getpartsavedappeal_api.js @@ -0,0 +1,63 @@ +import axios from "axios"; +import CryptoJS from "crypto-js"; +import _ from "lodash"; +import { getToken, azureHeadersPaged } from "../../../actions"; + +const WORDKEY = process.env.HASHKEY; + +const WEBAPI_URL = + process.env.RELAY_ROOT || + "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/"; + +const hashAPIPath = (queryPath) => { + var hashlink = CryptoJS.HmacSHA256( + queryPath, + CryptoJS.enc.Hex.parse(WORDKEY) + ); + hashlink = hashlink.toString(CryptoJS.enc.Hex); + + //return "&hash=" + hashlink; + + return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink; +}; + +export default async function ApiProxy(req, res) { + var searchString = req.query.searchString; + var token = await getToken(); + + var queryUrl = + "incidents?$select=description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" + + searchString + + "') or contains(ticketnumber, '" + + searchString + + "')) and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true"; + + console.log("basic search ", queryUrl); + + var apiResponse = _.isEmpty(req.query) + ? res.status(400).json() + : searchString.length > 0 + ? axios + .get( + WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), + azureHeadersPaged(token.access_token) + ) + .then(({ data }) => { + var dataStr; + // dataStr = dataStr.replace(/: true/gm, `: "Yes"`); + // dataStr = dataStr.replace(/: false/gm, `: "No"`); + + // console.log("replaced strinig:", dataStr); + + _.has(data, "@odata.nextLink") == true && + ((dataStr = JSON.stringify(data["@odata.nextLink"])), + (data["@odata.nextLink"] = dataStr.split("/v8.2/")[1])); + res.status(200).json(data); + }) + .catch(({ err }) => { + res.status(400).json(err); + }) + : res.status(400).json(); + + return apiResponse; +} diff --git a/pages/api/endpoint/getportalmoduledetails_api.js b/pages/api/endpoint/getportalmoduledetails_api.js index 4b6401d7..c0fda940 100644 --- a/pages/api/endpoint/getportalmoduledetails_api.js +++ b/pages/api/endpoint/getportalmoduledetails_api.js @@ -20,9 +20,11 @@ const hashAPIPath = (queryPath) => { export default async function ApiProxy(req, res) { var appealType = req.query.appealType; - var caseReference = req.query.caseReference; + var caseReference = req.query.caseReference.split("'").join("''"); var token = await getToken(); + //console.log("the case:", caseReference); + var queryUrl = appealType + "?$filter=pinswg_name eq '" + @@ -31,6 +33,8 @@ export default async function ApiProxy(req, res) { queryUrl = queryUrl + getSelectQuery(appealType); + //console.log("test:", queryUrl); + return axios .get( WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), diff --git a/pages/api/uploads.js b/pages/api/uploads.js new file mode 100644 index 00000000..377d6f70 --- /dev/null +++ b/pages/api/uploads.js @@ -0,0 +1,36 @@ +import nextConnect from "next-connect"; +import multer from "multer"; + +const upload = multer({ + storage: multer.diskStorage({ + destination: "./public/uploads", + filename: (req, file, cb) => cb(null, file.originalname), + }), +}); + +const apiRoute = nextConnect({ + onError(error, req, res) { + console.log("booo", req.data); + + res.status(501).json({ + error: `Sorry something Happened! ${error.message}`, + }); + }, + onNoMatch(req, res) { + res.status(405).json({ error: `Method '${req.method}' Not Allowed` }); + }, +}); + +apiRoute.use(upload.array("fileList")); + +apiRoute.post((req, res) => { + res.status(200).json({ data: "success" }); +}); + +export default apiRoute; + +export const config = { + api: { + bodyParser: false, // Disallow body parsing, consume as stream + }, +}; diff --git a/pages/dnsapplications.js b/pages/dnsapplications.js index f5a85e83..e679b141 100644 --- a/pages/dnsapplications.js +++ b/pages/dnsapplications.js @@ -18,7 +18,7 @@ import { import { wrapper } from "../store/store"; const Home = (props) => { - const { footerLinks, pages } = props; + const { footerLinks, pages, showMap } = props; let { t, lang } = useTranslation(); const router = useRouter(); @@ -99,6 +99,7 @@ const Home = (props) => {
@@ -129,12 +130,17 @@ export const getServerSideProps = wrapper.getServerSideProps( } : searchResultsObj; + const showMapCheck = process.env.SHOWMAPS || false; + const searchDetailsObj = await getSearchDetails(searchResultsObj); const dnsCoords = await getDNSCoords(); store.dispatch(setSearchResults(searchResultsObj)); store.dispatch(setSearchDetails(searchDetailsObj)); store.dispatch(setSearch("DNS")); store.dispatch(setDNSCoords(dnsCoords)); + return { + props: { showMap: showMapCheck }, + }; } ); diff --git a/pages/dnsdetails.js b/pages/dnsdetails.js index 38c29962..264a4cdb 100644 --- a/pages/dnsdetails.js +++ b/pages/dnsdetails.js @@ -9,7 +9,7 @@ import Footer from "../components/footer"; import Header from "../components/header"; const Home = (props) => { - const { footerLinks, pages } = props; + const { footerLinks, pages, showMap } = props; let { t, lang } = useTranslation(); const router = useRouter(); @@ -63,6 +63,7 @@ const Home = (props) => { appealTypeID={ props.currentView.caseReference.appealType } + showMap={props.currentView.caseReference.showMap} />