Merge from git

This commit is contained in:
2021-11-01 11:21:39 +00:00
parent adcff32d73
commit d94b3b3e5a
210 changed files with 69742 additions and 3359 deletions
+85 -4
View File
@@ -7,11 +7,87 @@ import BuildRow from "./buildrow";
import { reduxForm, formValueSelector } from "redux-form";
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
import { setCurrentSection } from "../../store/appealType/action";
import { updateCase } from "../../actions";
import jsonpath from "jsonpath";
import data from "../../data/collections.json";
let CompleteAppeal = (props) => {
// useEffect(() => {
// window.scrollTo(0, 0);
// });
// un comment to update incident with an appealtype id
useEffect(() => {
let incidentId = props.appealType.caseReference.incidentid;
let updateBody = props.props.form.appealForm.values;
let updateBindAppealTypeToIncident =
"pinswg_" +
props.appealType.caseReference[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
].replace(/(\band|[\s\-\+\(\)\,\&])/g, "") +
"Ids";
Object.assign(updateBody, {
"pinswg_Appellant@odata.bind":
"/contacts(" + props.props.accountDetails.loggedinUserId + ")",
"pinswg_AssociatedLPA@odata.bind":
"/accounts(" + props.appealType.appealLPA + ")",
"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);
let updateFormCollection = getFormCollection(
"pinswg_" +
props.appealType.caseReference[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
]
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
);
let primaryAttribute = getPrimaryAttr(
"pinswg_" +
props.appealType.caseReference[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
]
.replace(/(\band|[\s\-\+\(\)\,\&])/g, "")
.toLowerCase()
);
updateCase(
incidentId,
updateBody,
updateFormCollection,
primaryAttribute,
props.appealType.caseReference.ticketnumber
);
}, [
props.appealType.caseReference,
props.props.form.appealForm.values,
props.appealType.appealLPA,
props.props.accountDetails.loggedinUserId,
]);
const getFormCollection = (formtype) => {
const collectionName = jsonpath.query(
data,
"$..[?(@.LogicalName=='" + formtype + "')].LogicalCollectionName"
);
//console.log(collectionName[0]);
return collectionName[0];
};
const getPrimaryAttr = (formtype) => {
const attrName = jsonpath.query(
data,
"$..[?(@.LogicalName=='" + formtype + "')].PrimaryIdAttribute"
);
return attrName[0];
};
let { t } = useTranslation();
@@ -52,6 +128,9 @@ let CompleteAppeal = (props) => {
setCurrentSection(currentSection + 1);
};
// console.log(JSON.stringify(props.props.form.appealForm.values, null, 2));
//alert(JSON.stringify(props.props.form.appealForm.values, null, 2));
return (
<div className="govuk-grid-row">
<div className="govuk-grid-column-two-thirds">
@@ -60,7 +139,9 @@ let CompleteAppeal = (props) => {
<div className="govuk-panel__body">
Your reference number
<br />
<strong>{props.appealType.caseReference}</strong>
<strong>
{props.appealType.caseReference.ticketnumber}
</strong>
</div>
</div>