updated cookie login and watched cases
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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=" +
|
||||
|
||||
Reference in New Issue
Block a user