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
+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=" +