hooks fixes and ordering of events

This commit is contained in:
2024-11-16 07:45:38 +00:00
parent aaf9b3e574
commit 4bf10d97db
6 changed files with 234 additions and 152 deletions
@@ -5,7 +5,7 @@ import { useRouter } from "next/router";
import { useDropzone } from "react-dropzone";
import { connect } from "react-redux";
import { Field, change, formValueSelector, reduxForm } from "redux-form";
import { useState } from "react";
import { useState, useEffect } from "react";
import {
FileUploadField,
@@ -41,7 +41,6 @@ let RepLPA = (props) => {
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const [savingStatus, setSavingStatus] = useState(false);
const files = acceptedFiles.map((file) => (
<li key={file.path}>
{file.path} - {file.size} bytes
@@ -49,34 +48,6 @@ let RepLPA = (props) => {
));
const required = (value) => (value ? undefined : "Required");
const updateQuestionnaireCount = () => {
{
switch (currentView.caseReference.appealType) {
case 846040000:
case 846040001:
case 846040006:
case 846040025:
case 846040004:
case 846040018:
case 846040003:
case 846040009:
case 846040008:
setQuestionnaireCount(7);
break;
case 846040005:
case 846040006:
case 846040007:
setQuestionnaireCount(9);
break;
default:
setQuestionnaireCount(7);
break;
}
}
};
const whichQuestionnaire = () => {
{
switch (currentView.caseReference.appealType) {
@@ -90,7 +61,6 @@ let RepLPA = (props) => {
case 846040009:
case 846040008:
case 846040017:
updateQuestionnaireCount();
return (
<S78_Questionnaire
props={props}
@@ -110,7 +80,6 @@ let RepLPA = (props) => {
case 846040005:
case 846040006:
case 846040007:
updateQuestionnaireCount();
return (
<Enforcement_Questionnaire
props={props}
@@ -218,7 +187,8 @@ let RepLPA = (props) => {
);
resultsObj = resultsObj[0];
props.formObj["representationForm"].hasOwnProperty("values") &&
props.formObj.hasOwnProperty("representationForm") &&
props.formObj["representationForm"].hasOwnProperty("values") &&
props.formObj["representationForm"].values.hasOwnProperty(
"representationCapacity"
) &&
@@ -409,7 +379,6 @@ let RepLPA = (props) => {
Back
</a>
)}
{savingStatus ? (
<span className=" progress-save-active">
{router.locale == "cy"