updated cookie login and watched cases

This commit is contained in:
2021-11-03 08:24:54 +00:00
parent 30a7e426af
commit fa4c765799
20 changed files with 208 additions and 130 deletions
+8 -22
View File
@@ -9,6 +9,7 @@ import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
import { setCurrentSection } from "../../store/appealType/action";
import { updateCase } from "../../actions";
import jsonpath from "jsonpath";
import { getFormCollectionByID } from "../utils";
import data from "../../data/collections.json";
@@ -18,12 +19,11 @@ let CompleteAppeal = (props) => {
let incidentId = props.appealType.caseReference.incidentid;
let updateBody = props.props.form.appealForm.values;
let appTypeCollection = getFormCollectionByID(
props.appealType.appealTypeID
);
let updateBindAppealTypeToIncident =
"pinswg_" +
props.appealType.caseReference[
"pinswg_appealcasetype@OData.Community.Display.V1.FormattedValue"
].replace(/(\band|[\s\-\+\(\)\,\&])/g, "") +
"Ids";
appTypeCollection.LogicalName + "Ids";
Object.assign(updateBody, {
"pinswg_Appellant@odata.bind":
@@ -40,23 +40,9 @@ let CompleteAppeal = (props) => {
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()
);
let updateFormCollection = appTypeCollection.LogicalCollectionName;
let primaryAttribute = appTypeCollection.PrimaryIdAttribute;
updateCase(
incidentId,
@@ -75,7 +61,7 @@ let CompleteAppeal = (props) => {
const getFormCollection = (formtype) => {
const collectionName = jsonpath.query(
data,
"$..[?(@.LogicalName=='" + formtype + "')].LogicalCollectionName"
"$..[?(@.LogicalName=='" + formtype + "')]"
);
//console.log(collectionName[0]);
return collectionName[0];
+5 -28
View File
@@ -8,6 +8,7 @@ import { reduxForm, formValueSelector, Field } from "redux-form";
import { useDispatch, useSelector, shallowEqual, connect } from "react-redux";
import jsonpath from "jsonpath";
import transLookup from "../../data/lookuptranslations.json";
import { getFormCollectionByID } from "../utils";
import data from "../../data/collections.json";
import {
@@ -181,14 +182,7 @@ let CreateCase = (props) => {
)
? ""
: optionsObj[key]
.attributevalue +
"," +
optionsObj[key].value
.replace(
/(\band|[\s\-\+\(\)\,\&])/g,
""
)
.toLowerCase()
.attributevalue
}
>
{_.isEmpty(optionsObj[key])
@@ -220,34 +214,17 @@ let CreateCase = (props) => {
const required = (value) => (value ? undefined : "Required");
const getFormCollection = (formtype) => {
formtype =
"pinswg_" +
(formtype.length > 39 ? formtype.slice(0, 39) : formtype);
const collectionName = jsonpath.query(
data,
"$..[?(@.LogicalName=='" + formtype + "')].UrlName"
);
//console.log(collectionName[0]);
return collectionName[0];
};
const onHandleSubmit = (values) => {
event.preventDefault();
var appTypeCollection = values.appealTypes.split(",")[1];
var appTypeCollection = values.appealTypes;
appTypeCollection = getFormCollection(
appTypeCollection.length > 39
? appTypeCollection.slice(0, 39)
: appTypeCollection
);
appTypeCollection = getFormCollectionByID(appTypeCollection);
router.replace(
(router.locale = "cy" ? "/apelnewydd" : "/newappeal") +
"/" +
appTypeCollection +
appTypeCollection.UrlName +
"?lpa=" +
values.lpaTypes +
"&apt=" +