Merged PR 1660: unsub issue and 14626
Related work items: #14626, #17025
This commit is contained in:
@@ -82,7 +82,7 @@ export const getSelectQuery = (appealTypeName) => {
|
||||
return "&$select=pinswg_eiarequired,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_endofrepresentationperiod,pinswg_inspectorreportsubmittedtowelshgovernment,pinswg_procedureconfirmed,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,pinswg_rejectrequesttovaryapplication,pinswg_reportdueby,pinswg_suspensiondates,pinswg_suspensionenddates,pinswg_suspensionstartdate,pinswg_validnoticeofintentiontosubmitanapplicati,pinswg_webaddress,pinswg_withdrawndate,pinswg_writtenacceptanceofnotification,statuscode,pinswg_casestage,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
case "pinswg_sipses":
|
||||
// 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,pinswg_startdateofevent,pinswg_typeofevent";
|
||||
return "&$select=_pinswg_projecttype_value,pinswg_eiarequired,pinswg_anticipatedgridrefeasting,pinswg_anticipatedgridrefnorthing,_pinswg_appellant_value,pinswg_name,_pinswg_associatedlpa_value,pinswg_choiceofprocedure,pinswg_decision,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,statuscode,pinswg_casestage,_pinswg_sipscase_value,pinswg_writtenacceptanceofnotification,pinswg_validnoticeofintentiontosubmit,pinswg_deadlineforsubmissionofapplication,pinswg_screeningstartdate,pinswg_eiatargetdate,pinswg_targetextended,pinswg_directionissueddate,pinswg_eiarequired,pinswg_scopingstartdate,pinswg_scopingtargetdate,pinswg_scopingtargetextended,pinswg_scopingoutcomeissueddate,pinswg_essubmitted,pinswg_deemedmarinelicenseappliedfor,pinswg_validationdeadlineextension,pinswg_casesuspensionstartdate,pinswg_casesuspensionenddate,pinswg_consultationopen,pinswg_consultationclose";
|
||||
return "&$select=_pinswg_projecttype_value,pinswg_eiarequired,pinswg_anticipatedgridrefeasting,pinswg_anticipatedgridrefnorthing,_pinswg_appellant_value,pinswg_name,_pinswg_associatedlpa_value,pinswg_choiceofprocedure,pinswg_decision,pinswg_projectdescription,pinswg_projectlocation,pinswg_recommendation,statuscode,pinswg_casestage,_pinswg_sipscase_value,pinswg_writtenacceptanceofnotification,pinswg_validnoticeofintentiontosubmit,pinswg_deadlineforsubmissionofapplication,pinswg_screeningstartdate,pinswg_eiatargetdate,pinswg_targetextended,pinswg_directionissueddate,pinswg_eiarequired,pinswg_scopingstartdate,pinswg_scopingtargetdate,pinswg_scopingtargetextended,pinswg_scopingoutcomeissueddate,pinswg_essubmitted,pinswg_deemedmarinelicenseappliedfor,pinswg_validationdeadlineextension,pinswg_casesuspensionstartdate,pinswg_casesuspensionenddate,pinswg_consultationopen,pinswg_consultationclose,pinswg_reportissuedtowelshministers,pinswg_decisionissuedtoapplicant,pinswg_decisionoutcome";
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
|
||||
@@ -187,6 +187,27 @@ const CaseSummary = (props) => {
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
let showWatchedCases = (submittedArr) => {
|
||||
const required = submittedArr.value.filter((el) => {
|
||||
return (
|
||||
el.pinswg_representationsubmitted == null
|
||||
);
|
||||
});
|
||||
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
});
|
||||
};
|
||||
|
||||
data = showWatchedCases(data);
|
||||
|
||||
data.value.sort(function compare(a, b) {
|
||||
var dateA = new Date(a.createdon);
|
||||
var dateB = new Date(b.createdon);
|
||||
return dateB - dateA;
|
||||
});
|
||||
setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
@@ -1266,12 +1287,44 @@ const CaseSummary = (props) => {
|
||||
{t(
|
||||
"case:watch-this-case-link"
|
||||
)}
|
||||
</button>{" "}
|
||||
<button
|
||||
className="govuk-link watchCase"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
"case:summary-subscribe-mail-label"
|
||||
) +
|
||||
" " +
|
||||
props
|
||||
.currentView
|
||||
.caseReference
|
||||
.currentReference +
|
||||
"?"
|
||||
) &&
|
||||
setCookie(
|
||||
null,
|
||||
"pedwWatchCase",
|
||||
currentType ==
|
||||
"searchResultsObj"
|
||||
? detailsObj.pinswg_name
|
||||
: currentType ==
|
||||
"directResultsObj"
|
||||
? casesObj.title
|
||||
: casesObj.reference,
|
||||
{
|
||||
path: "/",
|
||||
expires:
|
||||
expDate,
|
||||
}
|
||||
),
|
||||
signIn();
|
||||
}}
|
||||
>
|
||||
{t(
|
||||
"case:send-email-notifications"
|
||||
)}
|
||||
</button>
|
||||
{/* <button
|
||||
onClick={handleOpenModal}
|
||||
>
|
||||
Open Modal
|
||||
</button> */}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -499,7 +499,9 @@ const Pinswg_sipscase = (props) => {
|
||||
{t("case:summary-dates-label")}
|
||||
</h3>
|
||||
<h4 className="govuk-heading-s ">
|
||||
Pre Submission
|
||||
{t(
|
||||
"case:summary-pre-submission-sub-title"
|
||||
)}
|
||||
</h4>
|
||||
<dl className="govuk-summary-list govuk-!-font-size-16 govuk-!-margin-bottom-9">
|
||||
<div className="govuk-summary-list__row">
|
||||
@@ -579,7 +581,6 @@ const Pinswg_sipscase = (props) => {
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
{(hasValidKey(
|
||||
detailsObj,
|
||||
"pinswg_validationdeadlineextension"
|
||||
@@ -595,6 +596,9 @@ const Pinswg_sipscase = (props) => {
|
||||
<div>
|
||||
<h4 className="govuk-heading-s ">
|
||||
Submission
|
||||
{t(
|
||||
"case:summary-submission-sub-title"
|
||||
)}
|
||||
</h4>
|
||||
|
||||
<dl className="govuk-summary-list govuk-!-font-size-16 govuk-!-margin-bottom-9">
|
||||
@@ -604,8 +608,9 @@ const Pinswg_sipscase = (props) => {
|
||||
) && (
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
Validation - Deadline
|
||||
extension
|
||||
{t(
|
||||
"case:summary-validation-deadline-extension"
|
||||
)}
|
||||
</dt>{" "}
|
||||
<dd className="govuk-summary-list__value">
|
||||
{_.has(
|
||||
@@ -633,8 +638,9 @@ const Pinswg_sipscase = (props) => {
|
||||
) && (
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
Case Suspension Start
|
||||
Date
|
||||
{t(
|
||||
"case:summary-case-suspension-start-date"
|
||||
)}
|
||||
</dt>{" "}
|
||||
<dd className="govuk-summary-list__value">
|
||||
{_.has(
|
||||
@@ -662,7 +668,9 @@ const Pinswg_sipscase = (props) => {
|
||||
) && (
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
Case Suspension End Date
|
||||
{t(
|
||||
"case:summary-case-suspension-end-date"
|
||||
)}
|
||||
</dt>{" "}
|
||||
<dd className="govuk-summary-list__value">
|
||||
{_.has(
|
||||
@@ -687,6 +695,119 @@ const Pinswg_sipscase = (props) => {
|
||||
</dl>
|
||||
</div>
|
||||
)}
|
||||
{(hasValidKey(
|
||||
detailsObj,
|
||||
"pinswg_reportissuedtowelshministers"
|
||||
) ||
|
||||
hasValidKey(
|
||||
detailsObj,
|
||||
"pinswg_decisionissuedtoapplicant"
|
||||
) ||
|
||||
hasValidKey(
|
||||
detailsObj,
|
||||
"pinswg_decisionoutcome"
|
||||
)) && (
|
||||
<div>
|
||||
<h4 className="govuk-heading-s ">
|
||||
{t(
|
||||
"case:summary-reporting-decision-sub-title"
|
||||
)}
|
||||
</h4>
|
||||
|
||||
<dl className="govuk-summary-list govuk-!-font-size-16 govuk-!-margin-bottom-9">
|
||||
{hasValidKey(
|
||||
detailsObj,
|
||||
"pinswg_reportissuedtowelshministers"
|
||||
) && (
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t(
|
||||
"case:summary-report-issued-to-welsh-ministers"
|
||||
)}
|
||||
</dt>{" "}
|
||||
<dd className="govuk-summary-list__value">
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_reportissuedtowelshministers"
|
||||
)
|
||||
? !_.isEmpty(
|
||||
detailsObj.pinswg_reportissuedtowelshministers
|
||||
)
|
||||
? formatDates(
|
||||
detailsObj.pinswg_reportissuedtowelshministers
|
||||
)
|
||||
: t(
|
||||
"case:summary-awaiting-information-label"
|
||||
)
|
||||
: t(
|
||||
"case:summary-awaiting-information-label"
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
{hasValidKey(
|
||||
detailsObj,
|
||||
"pinswg_decisionissuedtoapplicant"
|
||||
) && (
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t(
|
||||
"case:summary-decision-issued-to-applicant"
|
||||
)}
|
||||
</dt>{" "}
|
||||
<dd className="govuk-summary-list__value">
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_decisionissuedtoapplicant"
|
||||
)
|
||||
? !_.isEmpty(
|
||||
detailsObj.pinswg_decisionissuedtoapplicant
|
||||
)
|
||||
? formatDates(
|
||||
detailsObj.pinswg_decisionissuedtoapplicant
|
||||
)
|
||||
: t(
|
||||
"case:summary-awaiting-information-label"
|
||||
)
|
||||
: t(
|
||||
"case:summary-awaiting-information-label"
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
{hasValidKey(
|
||||
detailsObj,
|
||||
"pinswg_decisionoutcome"
|
||||
) && (
|
||||
<div className="govuk-summary-list__row">
|
||||
<dt className="govuk-summary-list__key">
|
||||
{t(
|
||||
"case:summary-decision-outcome"
|
||||
)}
|
||||
</dt>{" "}
|
||||
<dd className="govuk-summary-list__value">
|
||||
{_.has(
|
||||
detailsObj,
|
||||
"pinswg_decisionoutcome"
|
||||
)
|
||||
? !_.isEmpty(
|
||||
detailsObj.pinswg_decisionoutcome
|
||||
)
|
||||
? formatDates(
|
||||
detailsObj.pinswg_decisionoutcome
|
||||
)
|
||||
: t(
|
||||
"case:summary-awaiting-information-label"
|
||||
)
|
||||
: t(
|
||||
"case:summary-awaiting-information-label"
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
</div>
|
||||
)}
|
||||
{/* <div>
|
||||
<h4 className="govuk-heading-s ">
|
||||
EIA Screening
|
||||
|
||||
@@ -759,9 +759,7 @@ const ViewAllResults = (props) => {
|
||||
style={{ display: "flex", flexDirection: "column" }}
|
||||
>
|
||||
<button
|
||||
title={t(
|
||||
"case:do-you-want-to-delete-case-label"
|
||||
)}
|
||||
title={t("case:stop-watching-case-link")}
|
||||
className=" govuk-summary-list__actionLink watched_link"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
@@ -778,15 +776,17 @@ const ViewAllResults = (props) => {
|
||||
);
|
||||
}}
|
||||
>
|
||||
—
|
||||
<span className="eye"></span>
|
||||
</button>
|
||||
{item.pinswg_emailnotifications == true ? (
|
||||
<button
|
||||
className="govuk-summary-list__actionLink mailLink watched_link"
|
||||
title="Unsubscribe to email updates"
|
||||
title={t("common:unsubscribe-title-label")}
|
||||
onClick={() => {
|
||||
confirm(
|
||||
" Do you want to unsubscribe to email updates for " +
|
||||
t(
|
||||
"case:summary-unsubscribe-mail-label"
|
||||
) +
|
||||
item.pinswg_title +
|
||||
"?"
|
||||
) &&
|
||||
@@ -807,10 +807,12 @@ const ViewAllResults = (props) => {
|
||||
) : (
|
||||
<button
|
||||
className="govuk-summary-list__actionLink mailLink"
|
||||
title="Email about changes"
|
||||
title={t("common:subscribe-title-label")}
|
||||
onClick={() => {
|
||||
confirm(
|
||||
" Do you want to be sent email updates for " +
|
||||
t(
|
||||
"case:summary-subscribe-mail-label"
|
||||
) +
|
||||
item.pinswg_title +
|
||||
"?"
|
||||
) &&
|
||||
@@ -937,6 +939,27 @@ const ViewAllResults = (props) => {
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
let showWatchedCases = (submittedArr) => {
|
||||
const required = submittedArr.value.filter((el) => {
|
||||
return (
|
||||
el.pinswg_representationsubmitted == null
|
||||
);
|
||||
});
|
||||
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
});
|
||||
};
|
||||
|
||||
data = showWatchedCases(data);
|
||||
|
||||
data.value.sort(function compare(a, b) {
|
||||
var dateA = new Date(a.createdon);
|
||||
var dateB = new Date(b.createdon);
|
||||
return dateB - dateA;
|
||||
});
|
||||
setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases")
|
||||
.then((data) => {
|
||||
|
||||
@@ -94,6 +94,36 @@ const SearchResults = (props) => {
|
||||
});
|
||||
};
|
||||
|
||||
const selectEmailNotifications = (
|
||||
emailaddress,
|
||||
loggedInUser,
|
||||
incidentID,
|
||||
appealType
|
||||
) => {
|
||||
let updateBody = {
|
||||
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
||||
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
|
||||
"pinswg_appealcasetype": +appealType,
|
||||
"pinswg_emailnotifications": true,
|
||||
};
|
||||
|
||||
console.log("Email signed up");
|
||||
createWatchedCases(updateBody)
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
|
||||
(data) => {
|
||||
setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const isWatchedCase = (whichIncident) => {
|
||||
let isWatched = jsonpath({
|
||||
path:
|
||||
@@ -107,6 +137,19 @@ const SearchResults = (props) => {
|
||||
return isWatched;
|
||||
};
|
||||
|
||||
const isEmailSignUp = (whichIncident) => {
|
||||
let isEmail = jsonpath({
|
||||
path:
|
||||
"$..value[?(@ && @._pinswg_watchedcase_value=='" +
|
||||
whichIncident +
|
||||
"' && @.pinswg_emailnotifications==true)]",
|
||||
|
||||
json: watchedCases,
|
||||
eval: true,
|
||||
});
|
||||
return isEmail;
|
||||
};
|
||||
|
||||
const deleteItem = (caseID, topThreeType) => {
|
||||
let cookies = parseCookies();
|
||||
topThreeType == "watchedCases" &&
|
||||
@@ -116,6 +159,27 @@ const SearchResults = (props) => {
|
||||
getWatchedCasesProxy(
|
||||
props.accountDetails.loggedinUserId
|
||||
).then((data) => {
|
||||
let showWatchedCases = (submittedArr) => {
|
||||
const required = submittedArr.value.filter((el) => {
|
||||
return (
|
||||
el.pinswg_representationsubmitted == null
|
||||
);
|
||||
});
|
||||
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
});
|
||||
};
|
||||
|
||||
data = showWatchedCases(data);
|
||||
|
||||
data.value.sort(function compare(a, b) {
|
||||
var dateA = new Date(a.createdon);
|
||||
var dateB = new Date(b.createdon);
|
||||
return dateB - dateA;
|
||||
});
|
||||
setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
@@ -594,6 +658,61 @@ const SearchResults = (props) => {
|
||||
<span className="eye"></span>
|
||||
</button>
|
||||
)}
|
||||
{isEmailSignUp(item.incidentid)
|
||||
.length >
|
||||
0 ==
|
||||
true ? (
|
||||
<button
|
||||
className="govuk-summary-list__actionLink mailLink watched_link"
|
||||
title="Unsubscribe to email updates"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
"case:summary-unsubscribe-mail-label"
|
||||
) +
|
||||
item.title +
|
||||
"?"
|
||||
) &&
|
||||
deleteItem(
|
||||
isEmailSignUp(
|
||||
item.incidentid
|
||||
)[0]
|
||||
.pinswg_watchlistid,
|
||||
|
||||
"watchedCases"
|
||||
);
|
||||
}}
|
||||
>
|
||||
<span className="mailicon icon"></span>
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-summary-list__actionLink mailLink"
|
||||
title="Email about changes"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
"case:summary-subscribe-mail-label"
|
||||
) +
|
||||
item.title +
|
||||
"?"
|
||||
) &&
|
||||
selectEmailNotifications(
|
||||
props
|
||||
.accountDetails
|
||||
.accountDetails
|
||||
.emailaddress1,
|
||||
props
|
||||
.accountDetails
|
||||
.loggedinUserId,
|
||||
item.incidentid,
|
||||
item.pinswg_appealcasetype
|
||||
);
|
||||
}}
|
||||
>
|
||||
<span className="mailicon icon"></span>
|
||||
</button>
|
||||
)}
|
||||
</dd>
|
||||
)}
|
||||
|
||||
@@ -639,6 +758,34 @@ const SearchResults = (props) => {
|
||||
>
|
||||
<span className="eye"></span>
|
||||
</button>
|
||||
<button
|
||||
className="govuk-summary-list__actionLink mailLink"
|
||||
title={t(
|
||||
"common:subscribe-title-label"
|
||||
)}
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
"case:summary-subscribe-mail-label"
|
||||
) +
|
||||
item.pinswg_name +
|
||||
"?"
|
||||
) &&
|
||||
signIn(undefined, {
|
||||
callbackUrl:
|
||||
"/myportal/addresssearchresults?" +
|
||||
new URLSearchParams(
|
||||
searchString
|
||||
) +
|
||||
"&toWatch=" +
|
||||
item.incidentid +
|
||||
"_" +
|
||||
item.pinswg_appealcasetype,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<span className="mailicon icon"></span>
|
||||
</button>
|
||||
</dd>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -170,6 +170,36 @@ const DNSSearchResults = (props) => {
|
||||
});
|
||||
};
|
||||
|
||||
const selectEmailNotifications = (
|
||||
emailaddress,
|
||||
loggedInUser,
|
||||
incidentID,
|
||||
appealType
|
||||
) => {
|
||||
let updateBody = {
|
||||
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
||||
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
|
||||
"pinswg_appealcasetype": +appealType,
|
||||
"pinswg_emailnotifications": true,
|
||||
};
|
||||
|
||||
console.log("Email signed up");
|
||||
createWatchedCases(updateBody)
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(props.accountDetails.loggedinUserId).then(
|
||||
(data) => {
|
||||
setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const isWatchedCase = (whichIncident) => {
|
||||
let isWatched = jsonpath({
|
||||
path:
|
||||
@@ -183,6 +213,19 @@ const DNSSearchResults = (props) => {
|
||||
return isWatched;
|
||||
};
|
||||
|
||||
const isEmailSignUp = (whichIncident) => {
|
||||
let isEmail = jsonpath({
|
||||
path:
|
||||
"$..value[?(@ && @._pinswg_watchedcase_value=='" +
|
||||
whichIncident +
|
||||
"' && @.pinswg_emailnotifications==true)]",
|
||||
|
||||
json: watchedCases,
|
||||
eval: true,
|
||||
});
|
||||
return isEmail;
|
||||
};
|
||||
|
||||
const deleteItem = (caseID, topThreeType) => {
|
||||
let cookies = parseCookies();
|
||||
topThreeType == "watchedCases" &&
|
||||
@@ -190,6 +233,27 @@ const DNSSearchResults = (props) => {
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
let showWatchedCases = (submittedArr) => {
|
||||
const required = submittedArr.value.filter((el) => {
|
||||
return (
|
||||
el.pinswg_representationsubmitted == null
|
||||
);
|
||||
});
|
||||
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
});
|
||||
};
|
||||
|
||||
data = showWatchedCases(data);
|
||||
|
||||
data.value.sort(function compare(a, b) {
|
||||
var dateA = new Date(a.createdon);
|
||||
var dateB = new Date(b.createdon);
|
||||
return dateB - dateA;
|
||||
});
|
||||
setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
@@ -566,7 +630,7 @@ const DNSSearchResults = (props) => {
|
||||
.length >
|
||||
0 ==
|
||||
true ? (
|
||||
<span
|
||||
<button
|
||||
className="govuk-summary-list__actionLink watched_link"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
@@ -590,9 +654,9 @@ const DNSSearchResults = (props) => {
|
||||
)}
|
||||
>
|
||||
<span className="eye"></span>
|
||||
</span>
|
||||
</button>
|
||||
) : (
|
||||
<span
|
||||
<button
|
||||
className="govuk-summary-list__actionLink watchLink"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
@@ -613,7 +677,61 @@ const DNSSearchResults = (props) => {
|
||||
)}
|
||||
>
|
||||
<span className="eye"></span>
|
||||
</span>
|
||||
</button>
|
||||
)}
|
||||
{isEmailSignUp(item.incidentid)
|
||||
.length >
|
||||
0 ==
|
||||
true ? (
|
||||
<button
|
||||
className="govuk-summary-list__actionLink mailLink watched_link"
|
||||
title="Unsubscribe to email updates"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
"case:summary-unsubscribe-mail-label"
|
||||
) +
|
||||
item.title +
|
||||
"?"
|
||||
) &&
|
||||
deleteItem(
|
||||
isEmailSignUp(
|
||||
item.incidentid
|
||||
)[0]
|
||||
.pinswg_watchlistid,
|
||||
|
||||
"watchedCases"
|
||||
);
|
||||
}}
|
||||
>
|
||||
<span className="mailicon icon"></span>
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
className="govuk-summary-list__actionLink mailLink"
|
||||
title="Email about changes"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
t(
|
||||
"case:summary-subscribe-mail-label"
|
||||
) +
|
||||
item.title +
|
||||
"?"
|
||||
) &&
|
||||
selectEmailNotifications(
|
||||
props
|
||||
.accountDetails
|
||||
.emailaddress1,
|
||||
props
|
||||
.accountDetails
|
||||
.loggedinUserId,
|
||||
item.incidentid,
|
||||
item.pinswg_appealcasetype
|
||||
);
|
||||
}}
|
||||
>
|
||||
<span className="mailicon icon"></span>
|
||||
</button>
|
||||
)}
|
||||
</dd>
|
||||
)}
|
||||
@@ -868,4 +986,13 @@ const mapDispatchToProps = (dispatch) => {
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(null, mapDispatchToProps)(DNSSearchResults);
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
// currentView: state.currentView,
|
||||
accountDetails: state.accountDetails,
|
||||
// search: state.search,
|
||||
// searchResultsObj: state.searchResultsObj,
|
||||
};
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(DNSSearchResults);
|
||||
|
||||
@@ -180,6 +180,27 @@ const SearchResults = (props) => {
|
||||
getWatchedCasesProxy(
|
||||
props.accountDetails.loggedinUserId
|
||||
).then((data) => {
|
||||
let showWatchedCases = (submittedArr) => {
|
||||
const required = submittedArr.value.filter((el) => {
|
||||
return (
|
||||
el.pinswg_representationsubmitted == null
|
||||
);
|
||||
});
|
||||
|
||||
let newObj = {};
|
||||
return Object.assign(newObj, {
|
||||
"@odata.count": required.length,
|
||||
"value": required,
|
||||
});
|
||||
};
|
||||
|
||||
data = showWatchedCases(data);
|
||||
|
||||
data.value.sort(function compare(a, b) {
|
||||
var dateA = new Date(a.createdon);
|
||||
var dateB = new Date(b.createdon);
|
||||
return dateB - dateA;
|
||||
});
|
||||
setWatchedCases(data),
|
||||
getDetailsProxy(data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
@@ -690,7 +711,9 @@ const SearchResults = (props) => {
|
||||
title="Email about changes"
|
||||
onClick={() => {
|
||||
confirm(
|
||||
" Do you want to be sent email updates for " +
|
||||
t(
|
||||
"case:summary-subscribe-mail-label"
|
||||
) +
|
||||
item.title +
|
||||
"?"
|
||||
) &&
|
||||
@@ -754,10 +777,14 @@ const SearchResults = (props) => {
|
||||
</button>
|
||||
<button
|
||||
className="govuk-summary-list__actionLink mailLink"
|
||||
title="Email about changes"
|
||||
title={t(
|
||||
"common:subscribe-title-label"
|
||||
)}
|
||||
onClick={() => {
|
||||
confirm(
|
||||
" Do you want to be sent email updates for " +
|
||||
t(
|
||||
"case:summary-subscribe-mail-label"
|
||||
) +
|
||||
item.title +
|
||||
"?"
|
||||
) &&
|
||||
|
||||
@@ -22,7 +22,12 @@ module.exports = {
|
||||
"/myportal/searchresults": ["search", "myportal", "case"],
|
||||
"/myportal/case": ["case"],
|
||||
"/myportal/case/[ticketnumber]": ["case"],
|
||||
"/myportal/dnsapplications": ["search", "dnsCommon", "dnsApplications"],
|
||||
"/myportal/dnsapplications": [
|
||||
"search",
|
||||
"dnsCommon",
|
||||
"dnsApplications",
|
||||
"case",
|
||||
],
|
||||
"/myportal/dnsdetails": [
|
||||
"case",
|
||||
"search",
|
||||
@@ -61,7 +66,7 @@ module.exports = {
|
||||
"/dns": ["dnsCommon", "dnsHome"],
|
||||
"/dns/applications": ["dnsCommon", "dnsApplications"],
|
||||
"/dns/application-view": ["dnsCommon", "dnsApplicationView"],
|
||||
"/dnsapplications": ["search", "dnsCommon", "dnsApplications"],
|
||||
"/dnsapplications": ["search", "dnsCommon", "dnsApplications", "case"],
|
||||
"/dnsdetails": ["case", "search", "dnsCommon", "dnsApplications"],
|
||||
"/help/cookies": ["common", "cookies"],
|
||||
"/account/register": ["common", "account"],
|
||||
|
||||
+10
-1
@@ -124,5 +124,14 @@
|
||||
"summary-subscribe-mail-label": "Ydych chi eisiau derbyn diweddariadau e-bost ar gyfer ",
|
||||
"summary-unsubscribe-mail-label": "Ydych chi eisiau dad-danysgrifio i ddiweddariadau e-bost ar gyfer ",
|
||||
"send-email-notifications": "Anfon hysbysiadau e-bost am ddiweddariadau i'r achos hwn",
|
||||
"stop-sending-email-notifications": "Stopio anfon diweddariadau e-bost"
|
||||
"stop-sending-email-notifications": "Stopio anfon diweddariadau e-bost",
|
||||
"summary-pre-submission-sub-title": "Cyn-gyflwyno",
|
||||
"summary-submission-sub-title": "Cyflwyniad",
|
||||
"summary-validation-deadline-extension": "Dilysu - Estyniad dyddiad cau",
|
||||
"summary-case-suspension-start-date": "Dyddiad Dechrau Atal Achos",
|
||||
"summary-case-suspension-end-date": "Dyddiad Gorffen Atal Achos",
|
||||
"summary-reporting-decision-sub-title": "Adrodd/Penderfyniad",
|
||||
"summary-report-issued-to-welsh-ministers": "Adroddiad a Gyhoeddwyd i Weinidogion Cymru",
|
||||
"summary-decision-issued-to-applicant": "Penderfyniad a Gyhoeddwyd i'r Ymgeisydd",
|
||||
"summary-decision-outcome": "Canlyniad y Penderfyniad"
|
||||
}
|
||||
@@ -113,5 +113,7 @@
|
||||
"contact-us-select-ceq": "Ymholiad Digwyddiadau Gwaith Achos",
|
||||
"contact-us-select-other": "Unrhyw Ymholiadau Eraill",
|
||||
"contact-us-select-postdec": "Ar ôl Penderfyniad",
|
||||
"contact-us-select-comp": "Cwynion/Canmoliaethau"
|
||||
"contact-us-select-comp": "Cwynion/Canmoliaethau",
|
||||
"unsubscribe-title-label": "Dad-danysgrifio i ddiweddariadau e-bost",
|
||||
"subscribe-title-label": "Tanysgrifio i ddiweddariadau e-bost"
|
||||
}
|
||||
+10
-1
@@ -125,5 +125,14 @@
|
||||
"summary-subscribe-mail-label": "Do you want to be sent email updates for ",
|
||||
"summary-unsubscribe-mail-label": "Do you want to unsubscribe to email updates for ",
|
||||
"send-email-notifications": "Send email notifications for updates to this case",
|
||||
"stop-sending-email-notifications": "Stop sending email updates"
|
||||
"stop-sending-email-notifications": "Stop sending email updates",
|
||||
"summary-pre-submission-sub-title": "Pre Submission",
|
||||
"summary-submission-sub-title": "Submission",
|
||||
"summary-validation-deadline-extension": "Validation - Deadline extension",
|
||||
"summary-case-suspension-start-date": "Case Suspension Start Date",
|
||||
"summary-case-suspension-end-date": "Case Suspension End Date",
|
||||
"summary-reporting-decision-sub-title": "Reporting/Decision",
|
||||
"summary-report-issued-to-welsh-ministers": "Report Issued to Welsh Ministers",
|
||||
"summary-decision-issued-to-applicant": "Decision Issued to Applicant",
|
||||
"summary-decision-outcome": "Decision Outcome"
|
||||
}
|
||||
@@ -113,5 +113,7 @@
|
||||
"contact-us-select-ceq": "Casework Events Query",
|
||||
"contact-us-select-other": "Any Other Enquiries",
|
||||
"contact-us-select-postdec": "Post Decision",
|
||||
"contact-us-select-comp": "Complaints/Complements"
|
||||
"contact-us-select-comp": "Complaints/Complements",
|
||||
"unsubscribe-title-label": "Unsubscribe to email updates",
|
||||
"subscribe-title-label": "Subscribe to email updates"
|
||||
}
|
||||
@@ -121,6 +121,7 @@ const Home = (props) => {
|
||||
<div className="govuk-width-container">
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
<ServiceBanner props={props} />
|
||||
|
||||
<DNSSearchResults
|
||||
showMap={showMap}
|
||||
searchString="DNS"
|
||||
|
||||
Reference in New Issue
Block a user