diff --git a/components/newappeal/buildcheckrow.js b/components/newappeal/buildcheckrow.js
index f69218d9..4e32b4a1 100644
--- a/components/newappeal/buildcheckrow.js
+++ b/components/newappeal/buildcheckrow.js
@@ -2,6 +2,7 @@ import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import xpath from "xpath";
+import jsonpath from "jsonpath";
import BuildCheckField from "./buildCheckfield";
import { useSelector, shallowEqual, connect } from "react-redux";
import {
@@ -22,6 +23,7 @@ let BuildCheckRow = (props) => {
sectionCount,
onSubmit,
updateCurrentSection,
+ mandatoryFieldsData,
} = props;
const parser = new DOMParser();
@@ -62,41 +64,52 @@ let BuildCheckRow = (props) => {
var rows = xpath.select("//label/@description", doc);
var fieldtype = xpath.select("//@classid", doc);
var datafieldname = xpath.select("//@datafieldname", doc);
-
- return (
-
+ const isRequiredField = jsonpath.query(
+ mandatoryFieldsData,
+ "$..value[?(@.LogicalName=='" +
+ datafieldname[0].value +
+ "')]"
);
+
+ if (isRequiredField[0].RequiredLevel.Value != "None") {
+ return (
+
+ );
+ } else {
+ return null;
+ }
}
})}
>
diff --git a/components/newappeal/buildchecksection.js b/components/newappeal/buildchecksection.js
index 310fa566..aa252a3d 100644
--- a/components/newappeal/buildchecksection.js
+++ b/components/newappeal/buildchecksection.js
@@ -28,6 +28,7 @@ let BuildCheckSection = (props) => {
handleSubmit,
formTitle,
setCurrentSection,
+ mandatoryFieldsData,
} = props;
const parser = new DOMParser();
@@ -56,32 +57,30 @@ let BuildCheckSection = (props) => {
return (
-
+
Are these answers correct?
- {Object.keys(titles).map((key) => (
- <>
-
+
+ {Object.keys(titles).map((key) => (
+ <>
+ {/*
{titles[key].value}
-
+
*/}
-
-
- >
- ))}
-
+ >
+ ))}
+
@@ -94,7 +93,6 @@ let BuildCheckSection = (props) => {
-
);
};
diff --git a/components/newappeal/buildfield.js b/components/newappeal/buildfield.js
index 5d1af269..fc24b7a7 100644
--- a/components/newappeal/buildfield.js
+++ b/components/newappeal/buildfield.js
@@ -2,6 +2,7 @@ import Link from "next/link";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import xpath from "xpath";
+
import {
Textfield,
DateField,
@@ -20,7 +21,7 @@ export default function BuildField(props) {
const router = useRouter();
const { locale } = router;
- const { fieldType, label, datafieldname } = props;
+ const { fieldType, label, datafieldname, mandatoryFieldData } = props;
const parser = new DOMParser();
diff --git a/components/newappeal/buildrow.js b/components/newappeal/buildrow.js
index 458a6e75..7efdb493 100644
--- a/components/newappeal/buildrow.js
+++ b/components/newappeal/buildrow.js
@@ -4,6 +4,7 @@ import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import xpath from "xpath";
import BuildField from "./buildfield";
+import jsonpath from "jsonpath";
export default function BuildRow(props) {
let { t } = useTranslation();
@@ -11,7 +12,13 @@ export default function BuildRow(props) {
const router = useRouter();
const { locale } = router;
- const { rowXML, whichSection, sectionCount, onSubmit } = props;
+ const {
+ rowXML,
+ whichSection,
+ sectionCount,
+ onSubmit,
+ mandatoryFieldsData,
+ } = props;
const parser = new DOMParser();
@@ -28,18 +35,31 @@ export default function BuildRow(props) {
var rows = xpath.select("//label/@description", doc);
var fieldtype = xpath.select("//@classid", doc);
var datafieldname = xpath.select("//@datafieldname", doc);
- return (
-
+
+ const isRequiredField = jsonpath.query(
+ mandatoryFieldsData,
+ "$..value[?(@.LogicalName=='" +
+ datafieldname[0].value +
+ "')]"
);
+
+ if (isRequiredField[0].RequiredLevel.Value != "None") {
+ return (
+
+ );
+ } else {
+ return null;
+ }
}
})}
diff --git a/components/newappeal/buildsection.js b/components/newappeal/buildsection.js
index e9bcbda0..673d6529 100644
--- a/components/newappeal/buildsection.js
+++ b/components/newappeal/buildsection.js
@@ -32,19 +32,21 @@ let BuildSection = (props) => {
setCurrentSection,
refno,
gotoSection,
+ mandatoryFieldsData,
} = props;
const currentSection = props.appealType.currentSection;
const parser = new DOMParser();
var doc = parser.parseFromString(props.formXML, "text/xml");
- var titles = xpath.select(
- "//form/tabs/tab[" + currentSection + " ]/labels/label/@description",
- doc
- );
+ // var titles = xpath.select(
+ // "//form/tabs/tab[" + currentSection + " ]/labels/label/@description",
+ // doc
+ // );
var rowXML = xpath.select(
- "/form/tabs/tab[" +
- currentSection +
- "]/columns//sections/section/rows/row",
+ // "/form/tabs/tab[" +
+ // currentSection +
+ // "]/columns//sections/section/rows/row",
+ "/form/tabs/tab/columns//sections/section/rows/row",
doc
);
@@ -129,7 +131,8 @@ let BuildSection = (props) => {
- {titles[0].value}{" "}
+ {/* {titles[0].value}{" "} */}
+ Enter your appeal information
-
*/}
);
};
diff --git a/components/newappeal/complete.js b/components/newappeal/complete.js
index 1d6791ad..af20fe41 100644
--- a/components/newappeal/complete.js
+++ b/components/newappeal/complete.js
@@ -52,6 +52,8 @@ let CompleteAppeal = (props) => {
setCurrentSection(currentSection + 1);
};
+ alert(JSON.stringify(props.props.form.appealForm.values, null, 2));
+
return (
diff --git a/pages/newappeal/[appealtypes].js b/pages/newappeal/[appealtypes].js
index 878a412b..c70d8d54 100644
--- a/pages/newappeal/[appealtypes].js
+++ b/pages/newappeal/[appealtypes].js
@@ -58,7 +58,7 @@ let Home = (props) => {
doc
);
var sectionCount = xpath.select("/form/tabs/tab[*]", doc);
- sectionCount = sectionCount.length;
+ sectionCount = 1; //sectionCount.length;
var tabs = xpath.select("//form/tabs/tab[*]", doc);
@@ -124,7 +124,7 @@ let Home = (props) => {
role="main"
>
{props.appealType.currentSection == 9999 ? (
-
+
) : props.appealType.currentSection ==
sectionCount + 1 ? (
{
formTitle={formTitle}
appealType={props.appealType}
props={props}
+ mandatoryFieldsData={
+ props.formData.mandatoryFieldsData
+ }
/>
) : (
{
sectionCount={sectionCount}
onSubmit={onSubmit}
formTitle={formTitle}
+ mandatoryFieldsData={
+ props.formData.mandatoryFieldsData
+ }
props={props}
/>
)}