import Link from "next/link"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import { useState, useEffect } from "react"; import xpath from "xpath"; import BuildRow from "./buildrow"; import { reduxForm, formValueSelector } from "redux-form"; import { useDispatch, useSelector, shallowEqual, connect } from "react-redux"; let BuildSection = (props) => { // useEffect(() => { // window.scrollTo(0, 0); // }); let { t } = useTranslation(); const router = useRouter(); const { locale } = router; const { formXML, sectionCount, onSubmit, handleSubmit, formTitle } = props; const [currentSection, setCurrentSection] = useState(1); 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 rowXML = xpath.select( "/form/tabs/tab[" + currentSection + "]/columns//sections/section/rows/row", doc ); var titleList = xpath.select( "//form/tabs/tab[*]/labels/label/@description", doc ); const handleParam = (setValue) => (e) => setValue(e.target.value); const basicSearch = (event) => { event.preventDefault(); console.log(query); // /searchresults }; const onHandleSubmit = (values) => { setCurrentSection(currentSection + 1); }; return (

{titles[0].value}

{}
{props.sectionCount != currentSection ? ( ) : ( "" )} {currentSection > 1 ? ( setCurrentSection(currentSection - 1) } > Back ) : ( "" )}
); }; const mapStateToProps = (state) => { return { form: state.form, }; }; BuildSection = reduxForm({ // a unique name for the form form: "sssappealForm", destroyOnUnmount: false, })(BuildSection); const selector = formValueSelector("appealForm"); // <-- same as form name export default connect(mapStateToProps)(BuildSection);