passing a ref api through form and update progress
This commit is contained in:
@@ -2,15 +2,27 @@ import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import xpath from "xpath";
|
||||
import BuildField from "./buildfield";
|
||||
import BuildCheckField from "./buildCheckfield";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import {
|
||||
setCaseReference,
|
||||
setCurrentSection,
|
||||
setFormComplete,
|
||||
} from "../../store/appealType/action";
|
||||
|
||||
export default function BuildCheckRow(props) {
|
||||
let BuildCheckRow = (props) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const { formXML, whichSection, sectionCount, onSubmit } = props;
|
||||
const {
|
||||
formXML,
|
||||
whichSection,
|
||||
sectionCount,
|
||||
onSubmit,
|
||||
updateCurrentSection,
|
||||
} = props;
|
||||
|
||||
const parser = new DOMParser();
|
||||
var doc = parser.parseFromString(props.formXML, "text/xml");
|
||||
@@ -41,14 +53,36 @@ export default function BuildCheckRow(props) {
|
||||
{rows[0].value}
|
||||
</dt>
|
||||
<dd className="govuk-summary-list__value">
|
||||
{
|
||||
props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
]
|
||||
}
|
||||
{fieldtype[0].value ==
|
||||
"{5B773807-9FB2-42db-97C3-7A91EFF8ADFF}"
|
||||
? props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
] != null
|
||||
? props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
].getDate() +
|
||||
"/" +
|
||||
(props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
].getMonth() +
|
||||
1) +
|
||||
"/" +
|
||||
props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
].getFullYear()
|
||||
: ""
|
||||
: props.props.form["appealForm"].values[
|
||||
datafieldname[0].value
|
||||
]}
|
||||
</dd>
|
||||
<dd className="govuk-summary-list__actions">
|
||||
<a className="govuk-link" href="#">
|
||||
<a
|
||||
className="govuk-link"
|
||||
href="#"
|
||||
onClick={() => {
|
||||
updateCurrentSection(whichSection);
|
||||
}}
|
||||
>
|
||||
Change
|
||||
<span className="govuk-visually-hidden">
|
||||
{" "}
|
||||
@@ -61,4 +95,19 @@ export default function BuildCheckRow(props) {
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
updateCurrentSection: (whichSection) => {
|
||||
dispatch(setCurrentSection(whichSection));
|
||||
dispatch(setFormComplete("true"));
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => ({
|
||||
count: state.count,
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(BuildCheckRow);
|
||||
|
||||
Reference in New Issue
Block a user