Added service stage status and delete functions

This commit is contained in:
2022-01-25 10:09:11 +00:00
parent 10f2baa7be
commit f347a0d73b
27 changed files with 575 additions and 125 deletions
+10 -1
View File
@@ -75,6 +75,16 @@ const CaseSummary = (props) => {
searchResultsObj,
'$..[?(@.title=="' + caseReference + '")]'
))
: currentType == "watchedCases"
? (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.pinswg_title=="' + caseReference + '")]'
))
: currentType == "myCases"
? (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.pinswg_title=="' + caseReference + '")]'
))
: (casesObj = jsonpath.query(
setCaseQueryObj,
'$..[?(@.reference=="' + caseReference + '")]'
@@ -232,7 +242,6 @@ const CaseSummary = (props) => {
</div>
</div>
</div>
{showSummary(casesObj, detailsObj)}
</div>
) : (
@@ -201,10 +201,14 @@ const Pinswg_miscellaneouscasewordid = (props) => {
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
detailsObj.pinswg_relevantauthorityname +
detailsObj[
"pinswg_relevantauthorityname@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy'
)
: detailsObj.pinswg_relevantauthorityname ||
: detailsObj[
"pinswg_relevantauthorityname@OData.Community.Display.V1.FormattedValue"
] ||
t(
"case:summary-no-date-entered-label"
)}
+1 -5
View File
@@ -20,11 +20,7 @@ export default function MakeNewAppeal() {
{t("myportal:makenewappeal-card-paragraph-two")}
</p>
<div>
<Link
href={
router.locale == "cy" ? "/apelnewydd" : "/newappeal"
}
>
<Link href={"/newappeal"}>
<a className="govuk-button">
{t("myportal:makenewappeal-card-button-label")}
</a>
+64 -3
View File
@@ -9,12 +9,18 @@ import {
getWatchedCasesProxy,
getPortalModuleDetailsProxy,
deleteWatchedCases,
deleteAwaitingSubmissions,
getAwaitingSubmissionProxy,
} from "../../actions";
import {
setWatchedCases,
setWatchedCasesDetails,
} from "../../store/watchedCases/action";
import {
setAwaitingSubmission,
setAwaitingSubmissionDetails,
} from "../../store/awaitingSubmission/action";
import { getFormCollectionByID } from "../../components/utils";
const TopThree = (props) => {
@@ -26,6 +32,8 @@ const TopThree = (props) => {
topThreeType,
setWatchedCases,
setWatchedCasesDetails,
setAwaitingSubmission,
setAwaitingSubmissionDetails,
} = props;
const router = useRouter();
@@ -37,6 +45,7 @@ const TopThree = (props) => {
const deleteItem = (caseID, topThreeType) => {
let cookies = parseCookies();
//console.log("sssss", caseID, topThreeType);
topThreeType == "watchedCases" &&
deleteWatchedCases(caseID)
.then((data) => data)
@@ -48,6 +57,32 @@ const TopThree = (props) => {
});
});
});
topThreeType == "awaitingSubmission" &&
deleteAwaitingSubmissions(caseID)
.then((data) => {
console.log("zzzzz");
return data;
})
.then(() => {
console.log("qqqqqq");
getAwaitingSubmissionProxy(cookies.pinsUser).then(
(data) => {
console.log("assss", data);
setAwaitingSubmission(data),
getDetails(data, "awaitingSubmission").then(
(data) => {
console.log(
"submission get details:",
data
);
setAwaitingSubmissionDetails(data);
}
);
}
);
});
};
const getDetails = (resultsObj, detailsType) => {
@@ -94,6 +129,7 @@ const TopThree = (props) => {
return objArr.ticketnumber;
break;
case "awaitingSubmission":
return objArr.ticketnumber;
break;
default:
// code block
@@ -183,14 +219,12 @@ const TopThree = (props) => {
{topThreeType == "awaitingSubmission" ? (
<div className="carModuleAddress">
Make Representation on Case Incomplete, not
submitted
Case Incomplete, not submitted
</div>
) : (
""
)}
</div>
{topThreeType == "watchedCases" && (
<div className="">
<a
@@ -214,6 +248,27 @@ const TopThree = (props) => {
</a>
</div>
)}
{topThreeType == "awaitingSubmission" && (
<div className="">
<a
href="#"
className=" cardModuleRemoveCase govuk-link govuk-link--no-underline govuk-link--inverse "
onClick={() => {
event.preventDefault();
deleteItem(
showTopThreeArr[key].incidentid,
"awaitingSubmission"
);
alert(
"You have deleted case " +
showTopThreeArr[key].ticketnumber
);
}}
>
&mdash;
</a>
</div>
)}
</div>
);
});
@@ -255,6 +310,12 @@ const mapDispatchToProps = (dispatch) => {
setWatchedCasesDetails: (watchedCasesDetails) => {
dispatch(setWatchedCasesDetails(watchedCasesDetails));
},
setAwaitingSubmission: (awaitingSubmission) => {
dispatch(setAwaitingSubmission(awaitingSubmission));
},
setAwaitingSubmissionDetails: (awaitingSubmissionDetails) => {
dispatch(setAwaitingSubmissionDetails(awaitingSubmissionDetails));
},
};
};
+110 -34
View File
@@ -3,6 +3,8 @@ import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { setCurrentReference } from "../../store/currentView/action";
import { connect } from "react-redux";
import jsonpath from "jsonpath";
import transLookup from "../../data/lookuptranslations.json";
const ViewAllResults = (props) => {
const {
@@ -21,8 +23,16 @@ const ViewAllResults = (props) => {
var resultsArr = props[currentView.viewKey][currentView.viewKey].value || [
{},
];
var searchDetailsObj =
props[currentView.viewKey][currentView.viewKey + "Details"] || {};
let resultsRowArr = [];
Object.keys(resultsArr).map((key, index) => {
resultsArr.map((item, key) => {
let detailsObj = jsonpath.query(
searchDetailsObj,
"$..value[?(@.pinswg_name=='" + item.pinswg_title + "')]"
);
detailsObj = detailsObj[0];
resultsRowArr.push(
<div className="govuk-summary-list__row" key={key}>
<dd className="govuk-summary-list__value govuk-!-font-size-16 govuk-!-padding-left-2">
@@ -42,21 +52,21 @@ const ViewAllResults = (props) => {
setCurrentReference({
"currentReference":
currentView.viewKey != "watchedCases"
? resultsArr[index].ticketnumber
: resultsArr[index][
? resultsArr[key].ticketnumber
: resultsArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
],
"currentType": currentView.viewKey,
"incidentid":
currentView.viewKey != "watchedCases"
? resultsArr[index].incidentid
: resultsArr[index][
" _pinswg_watchedcase_value"
? resultsArr[key].incidentid
: resultsArr[key][
"_pinswg_watchedcase_value"
],
"appealType":
resultsArr[index].pinswg_appealcasetype,
resultsArr[key].pinswg_appealcasetype,
});
}}
>
@@ -65,8 +75,8 @@ const ViewAllResults = (props) => {
</span>
{currentView.viewKey != "watchedCases"
? resultsArr[index].ticketnumber
: resultsArr[index][
? resultsArr[key].ticketnumber
: resultsArr[key][
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
]}
</a>
@@ -74,42 +84,108 @@ const ViewAllResults = (props) => {
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
Site Address:{" "}
{t("search:searchresults-site-address-label")}:
</span>
{resultsArr[index].address1}
<br /> {resultsArr[index].town}
<br />
{resultsArr[index].postcode}
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline1
: ""}
{/* {detailsObj.pinswg_siteaddressline1 !=
null && <br />} */}
{_.has(detailsObj, "pinswg_siteaddressline1") &&
detailsObj.pinswg_siteaddressline1 != null && <br />}
{_.has(detailsObj, "pinswg_siteaddressline1")
? detailsObj.pinswg_siteaddressline2
: ""}
{_.has(detailsObj, "pinswg_siteaddressline2") &&
detailsObj.pinswg_siteaddressline2 != null && <br />}
{_.has(detailsObj, "pinswg_siteaddresstown")
? detailsObj.pinswg_siteaddresstown
: ""}
{_.has(detailsObj, "pinswg_siteaddresstown") &&
detailsObj.pinswg_siteaddresstown != null && <br />}
{_.has(detailsObj, "pinswg_siteaddresscounty")
? detailsObj.pinswg_siteaddresscounty
: ""}
{_.has(detailsObj, "pinswg_siteaddresscounty") &&
detailsObj.pinswg_siteaddresscounty != null && <br />}
{_.has(detailsObj, "pinswg_siteaddresspostcode")
? detailsObj.pinswg_siteaddresspostcode
: ""}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">
Appellant/Applicant:
{t("search:searchresults-applicant-label")}:
</span>
Mr smith
{_.has(detailsObj, [
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue",
])
? detailsObj[
"_pinswg_appellant_value@OData.Community.Display.V1.FormattedValue"
]
: resultsArr[key][
"_customerid_value@OData.Community.Display.V1.FormattedValue"
]}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">Authority:</span>
{
resultsArr[index][
"_customerid_value@OData.Community.Display.V1.FormattedValue"
]
}
<span className="results-visually-hidden">
{t("search:searchresults-authority-label")}:
</span>
{_.has(detailsObj, [
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue",
])
? router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
item[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy'
)
: detailsObj[
"_pinswg_associatedlpa_value@OData.Community.Display.V1.FormattedValue"
] || "N/A"
: ""}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">Case Type:</span>
{
resultsArr[index][
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
]
}
<span className="results-visually-hidden">
{t("search:searchresults-case-type-label")}:
</span>
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy'
)
: item[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
] || "N/A"}
</dd>
<dd className="govuk-summary-list__value govuk-!-font-size-16">
<span className="results-visually-hidden">Status:</span>
{
resultsArr[index][
"statuscode@OData.Community.Display.V1.FormattedValue"
]
}
<span className="results-visually-hidden">
{t("search:searchresults-status-label")}:
</span>
{router.locale == "cy"
? jsonpath.query(
transLookup,
'$..[?(@.value=="' +
item[
"statuscode@OData.Community.Display.V1.FormattedValue"
] +
'")].value_cy'
)
: item[
"statuscode@OData.Community.Display.V1.FormattedValue"
] || "N/A"}
</dd>
</div>
);
+14
View File
@@ -6,6 +6,10 @@ import jsonpath from "jsonpath";
import BuildCheckField from "./buildCheckfield";
import { useSelector, shallowEqual, connect } from "react-redux";
import fieldLookup from "../../data/crmfieldlookuptranslations.json";
import {
getFormCollectionByID,
getPickListLabel,
} from "../../components/utils";
import {
setCaseReference,
@@ -105,6 +109,16 @@ let BuildCheckRow = (props) => {
datafieldname[0].value
]
)
: fieldtype[0].value ==
"{3EF39988-22BB-4f0b-BBBE-64B5A3748AEE}"
? getPickListLabel(
props.props.formData.pickListData,
datafieldname[0].value,
props.props.form["appealForm"]
.values[
datafieldname[0].value
]
)
: props.props.form["appealForm"].values[
datafieldname[0].value
]}
+9 -10
View File
@@ -1,20 +1,17 @@
import jsonpath from "jsonpath";
import useTranslation from "next-translate/useTranslation";
import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { useState, useEffect } from "react";
import { useEffect } from "react";
import { connect } from "react-redux";
import { formValueSelector } from "redux-form";
import xpath from "xpath";
import BuildRow from "./buildrow";
import { reduxForm, formValueSelector } from "redux-form";
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
import { updateCase, patchCase } from "../../actions";
import data from "../../data/collections.json";
import { setCurrentSection } from "../../store/appealType/action";
import { updateCase } from "../../actions";
import jsonpath from "jsonpath";
import { getFormCollectionByID } from "../utils";
import data from "../../data/collections.json";
let CompleteAppeal = (props) => {
// un comment to update incident with an appealtype id
useEffect(() => {
let incidentId = props.appealType.caseReference.incidentid;
let updateBody = props.props.form.appealForm.values;
@@ -51,6 +48,8 @@ let CompleteAppeal = (props) => {
primaryAttribute,
props.appealType.caseReference.ticketnumber
);
console.log("patching////////");
patchCase(incidentId);
}, [
props.appealType.caseReference,
props.props.form.appealForm.values,
+8 -16
View File
@@ -1,23 +1,15 @@
import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { useState, useEffect } from "react";
import xpath from "xpath";
import BuildRow from "./buildrow";
import { reduxForm, formValueSelector, Field } from "redux-form";
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
import jsonpath from "jsonpath";
import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { connect } from "react-redux";
import { Field, formValueSelector, reduxForm } from "redux-form";
import transLookup from "../../data/lookuptranslations.json";
import { getFormCollectionByID } from "../utils";
import data from "../../data/collections.json";
import {
setAppealType,
setAppealTypeTitle,
setAppealTypeID,
setAppealLPA,
getAppealTypeObj,
setAppealTypeID,
setAppealTypeTitle,
} from "../../store/appealType/action";
import { getFormCollectionByID } from "../utils";
let CreateCase = (props) => {
// useEffect(() => {
@@ -222,7 +214,7 @@ let CreateCase = (props) => {
appTypeCollection = getFormCollectionByID(appTypeCollection);
router.replace(
(router.locale = "cy" ? "/apelnewydd" : "/newappeal") +
"/newappeal" +
"/" +
appTypeCollection.UrlName +
"?lpa=" +
+13
View File
@@ -25,6 +25,19 @@ export const getFormCollectionByID = (appealTypeID) => {
return collectionName[0];
};
export const getPickListLabel = (data, picklistType, picklistID) => {
const pickListData = jsonpath.query(
data,
"$..[?(@.LogicalName=='" + picklistType + "')]"
);
const pickListLabel = jsonpath.query(
pickListData,
"$..[?(@.Value=='" + picklistID + "')].Label.LocalizedLabels..Label"
);
return pickListLabel[0];
};
/*
* Get the details of a case from the appeal type
* @param object searchResultsObj