added crm driven form via oauth

This commit is contained in:
robert.bond@test.gov.wales
2021-09-07 12:46:59 +01:00
parent 9e13a9e7c8
commit 8e8797418a
12 changed files with 245 additions and 149 deletions
+18 -8
View File
@@ -22,7 +22,13 @@ import {
setCaseReference,
} from "../../store/appealType/action";
import { setForm, getFormObj } from "../../store/formData/action";
import { getFormData, getAppealsTypes, createCase } from "../../actions";
import {
getFormData,
getAppealsTypes,
getMandatoryFields,
createCase,
getPickLists,
} from "../../actions";
import xpath from "xpath";
import { reduxForm, FormName } from "redux-form";
@@ -56,12 +62,9 @@ let Home = (props) => {
var tabs = xpath.select("//form/tabs/tab[*]", doc);
let optionsStr = props.appealType.appealTypeOptions.GlobalOptionSet.Options;
let optionsStr = props.appealType.appealTypeOptions.value;
let selectedObj = jsonpath.query(
optionsStr,
"$..LocalizedLabels[?(@.Label)].Label"
);
let selectedObj = jsonpath.query(optionsStr, "$..value");
//let optionsTitleObj = [];
@@ -154,8 +157,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
//console.log("the query", query);
const [appealTypeData, formdata] = await Promise.all([
const [
appealTypeData,
mandatoryFieldsData,
pickListData,
formdata,
] = await Promise.all([
await getAppealsTypes(),
await getMandatoryFields(query.appealtypes),
await getPickLists(query.appealtypes),
await getFormData(query.appealtypes),
]);
@@ -166,7 +176,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
xmlStr = xmlStr.replace(/\\"/g, "");
store.dispatch(setAppealTypeID(query.appealtypes));
store.dispatch(setCaseReference(caseReference));
store.dispatch(setForm(xmlStr));
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
store.dispatch(setAppealType(appealTypeData));
}
);
+7 -2
View File
@@ -19,7 +19,7 @@ import {
setSearchResults,
getSearchResultsObj,
} from "../store/searchOutput/action";
import { getBasicSearch } from "../actions";
import { getBasicSearch, getBasicSearchDetails } from "../actions";
const Home = (props) => {
const { footerLinks, pages } = props;
@@ -57,8 +57,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
console.log("query-", query);
const searchResultsObj = (await getBasicSearch(query.q)) || null;
const [searchResultsObj, searchDetailsObj] = await Promise.all(
await getBasicSearch(query.q),
await getBasicSearchDetails(query.d)
);
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setSearch(query.q));
}
);