added validation methods
This commit is contained in:
@@ -22,7 +22,7 @@ import {
|
||||
setCaseReference,
|
||||
} from "../../store/appealType/action";
|
||||
import { setForm, getFormObj } from "../../store/formData/action";
|
||||
import { getFormData, getAppealsTypes } from "../../actions";
|
||||
import { getFormData, getAppealsTypes, createCase } from "../../actions";
|
||||
|
||||
import xpath from "xpath";
|
||||
import { reduxForm, FormName } from "redux-form";
|
||||
@@ -40,9 +40,10 @@ let Home = (props) => {
|
||||
const { appealtypes } = router.query;
|
||||
|
||||
useEffect(() => {
|
||||
props.setFormTitle(formTitle);
|
||||
props.setCaseReference(router.query.refno);
|
||||
}, []);
|
||||
//setFormTitle(formTitle);
|
||||
setCaseReference(router.query.refno);
|
||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
const formXML = props.formData.formData;
|
||||
const parser = new DOMParser();
|
||||
var doc = parser.parseFromString(formXML, "text/xml");
|
||||
@@ -78,7 +79,7 @@ let Home = (props) => {
|
||||
(key) => optionsTitleObj[key] === appealtypes
|
||||
);
|
||||
|
||||
console.log(formTitle);
|
||||
//console.log(formTitle);
|
||||
|
||||
// crm api query for looking up picklist fields/drop downs
|
||||
// <url path to >/api/data/v8.2/EntityDefinitions(LogicalName='{appeal type form}')/Attributes(LogicalName='{drop down datafield name}')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=GlobalOptionSet($select=Options)
|
||||
@@ -110,31 +111,38 @@ let Home = (props) => {
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} formTitle={formTitle} />
|
||||
<main
|
||||
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
role="main"
|
||||
>
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} formTitle={formTitle} />
|
||||
|
||||
{props.appealType.currentSection == 9999 ? (
|
||||
<CompleteAppeal />
|
||||
) : props.appealType.currentSection == sectionCount + 1 ? (
|
||||
<BuildCheckSection
|
||||
formXML={formXML}
|
||||
sectionCount={sectionCount}
|
||||
onSubmit={onSubmit}
|
||||
formTitle={formTitle}
|
||||
appealType={props.appealType}
|
||||
props={props}
|
||||
/>
|
||||
) : (
|
||||
<BuildSection
|
||||
formXML={formXML}
|
||||
sectionCount={sectionCount}
|
||||
onSubmit={onSubmit}
|
||||
formTitle={formTitle}
|
||||
props={props}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{props.appealType.currentSection == 9999 ? (
|
||||
<CompleteAppeal />
|
||||
) : props.appealType.currentSection ==
|
||||
sectionCount + 1 ? (
|
||||
<BuildCheckSection
|
||||
formXML={formXML}
|
||||
sectionCount={sectionCount}
|
||||
onSubmit={onSubmit}
|
||||
formTitle={formTitle}
|
||||
appealType={props.appealType}
|
||||
props={props}
|
||||
/>
|
||||
) : (
|
||||
<BuildSection
|
||||
formXML={formXML}
|
||||
sectionCount={sectionCount}
|
||||
onSubmit={onSubmit}
|
||||
formTitle={formTitle}
|
||||
props={props}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</main>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
</div>
|
||||
@@ -144,14 +152,17 @@ let Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
console.log("the query", query);
|
||||
//console.log("the query", query);
|
||||
store.dispatch(setAppealTypeID(query.appealtypes));
|
||||
const appealTypeData = await getAppealsTypes();
|
||||
const formdata = (await getFormData(query.appealtypes)) || null;
|
||||
|
||||
const caseReference = createCase("asasa", "asasa");
|
||||
|
||||
let xmlStr = formdata;
|
||||
xmlStr = formdata.value[0].formxml;
|
||||
xmlStr = xmlStr.replace(/\\"/g, "");
|
||||
store.dispatch(setCaseReference(caseReference));
|
||||
store.dispatch(setForm(xmlStr));
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
}
|
||||
|
||||
+17
-13
@@ -49,22 +49,26 @@ const Home = (props) => {
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
<main
|
||||
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
role="main"
|
||||
>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
|
||||
<h1>New Appeal</h1>
|
||||
<CreateCase
|
||||
LPAData={props.LPAData}
|
||||
appealType={props.setAppealType}
|
||||
/>
|
||||
<h1>New Appeal</h1>
|
||||
<CreateCase
|
||||
LPAData={props.LPAData}
|
||||
appealType={props.setAppealType}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -68,45 +68,49 @@ const Home = (props) => {
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
<main
|
||||
className="govuk-main-wrapper govuk-main-wrapper--auto-spacing"
|
||||
id="main-content"
|
||||
role="main"
|
||||
>
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full">
|
||||
<div className="govuk-width-container">
|
||||
<Banner />
|
||||
<Breadcrumbs slug={appealtypes} />
|
||||
<h1>New Appeal</h1>
|
||||
|
||||
<h1>New Appeal</h1>
|
||||
|
||||
<form onSubmit={selectAppealType}>
|
||||
<div className="govuk-form-group">
|
||||
<label
|
||||
className="govuk-label"
|
||||
htmlFor="sort"
|
||||
<form onSubmit={selectAppealType}>
|
||||
<div className="govuk-form-group">
|
||||
<label
|
||||
className="govuk-label"
|
||||
htmlFor="sort"
|
||||
>
|
||||
Select an appeal Type
|
||||
</label>
|
||||
<select
|
||||
className="govuk-select"
|
||||
id="appealTypes"
|
||||
name="appealTypes"
|
||||
onChange={(e) =>
|
||||
props.onChangeSelect(e)
|
||||
}
|
||||
>
|
||||
{appealOptions}
|
||||
</select>
|
||||
</div>
|
||||
<button
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
>
|
||||
Select an appeal Type
|
||||
</label>
|
||||
<select
|
||||
className="govuk-select"
|
||||
id="appealTypes"
|
||||
name="appealTypes"
|
||||
onChange={(e) =>
|
||||
props.onChangeSelect(e)
|
||||
}
|
||||
>
|
||||
{appealOptions}
|
||||
</select>
|
||||
</div>
|
||||
<button
|
||||
className="govuk-button"
|
||||
data-module="govuk-button"
|
||||
>
|
||||
Continue
|
||||
</button>
|
||||
</form>
|
||||
Continue
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user