diff --git a/components/case/representation/representationAgent.js b/components/case/representation/representationAgent.js
index a7abdbf3..f2c7caab 100644
--- a/components/case/representation/representationAgent.js
+++ b/components/case/representation/representationAgent.js
@@ -13,6 +13,11 @@ import {
} from "./representationElements";
import { useDropzone } from "react-dropzone";
+import {
+ setRepresentationCapacity,
+ setRepresentationSubmit,
+ setFilesForRepresentations,
+} from "../../../store/currentView/action";
const RepAgent = (props) => {
let { t } = useTranslation();
@@ -29,6 +34,7 @@ const RepAgent = (props) => {
updateRepresentation,
setSavingStatus,
savingStatus,
+ setFilesForRepresentations,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
@@ -183,59 +189,38 @@ const RepAgent = (props) => {
props.props.caseReference
}
hint={"sdsd"}
- fileList={[]}
- setFilesForRepresentation={[]}
+ fileList={
+ props.currentView.caseReference.hasOwnProperty(
+ "repDetails"
+ )
+ ? props.currentView.caseReference.repDetails.hasOwnProperty(
+ "filesList"
+ ) &&
+ props.currentView
+ .caseReference
+ .repDetails.filesList
+ .length > 0
+ ? props.currentView
+ .caseReference
+ .repDetails
+ .filesList
+ : []
+ : []
+ }
+ setFilesForRepresentations={
+ setFilesForRepresentations
+ }
containerID={
props.props.props.accountDetails
.containerID
}
filenamePrefix={props.formObj}
+ props={props.props.props}
+ setCurrentReference={
+ props.setCurrentReference
+ }
/>
- {props.currentView.caseReference.hasOwnProperty(
- "repDetails"
- ) ? (
- props.currentView.caseReference.repDetails.hasOwnProperty(
- "filesList"
- ) &&
- props.currentView.caseReference
- .repDetails.filesList.length > 0 ? (
-
- {filterFilesList.map(
- (blob, i) => (
-
-

-
-
- {blob.name} (
- {bytesToSize(
- blob.size
- )}
- )
-
-
- )
- )}
-
- ) : (
- ""
- )
- ) : (
- ""
- )}
{" "}
@@ -318,6 +303,10 @@ const RepAgent = (props) => {
const mapDispatchToProps = (dispatch) => ({
updateField: (form, field, newValue) =>
dispatch(change(form, field, newValue)),
+
+ setFilesForRepresentations: (fileList) => {
+ dispatch(setFilesForRepresentations(fileList));
+ },
});
export default connect(
diff --git a/components/case/representation/representationInterestedPartyPerson.js b/components/case/representation/representationInterestedPartyPerson.js
index 685ef531..2ceee4f9 100644
--- a/components/case/representation/representationInterestedPartyPerson.js
+++ b/components/case/representation/representationInterestedPartyPerson.js
@@ -13,6 +13,11 @@ import {
} from "./representationElements";
import { useDropzone } from "react-dropzone";
+import {
+ setRepresentationCapacity,
+ setRepresentationSubmit,
+ setFilesForRepresentations,
+} from "../../../store/currentView/action";
const RepInterestedPartyPerson = (props) => {
let { t } = useTranslation();
@@ -28,6 +33,7 @@ const RepInterestedPartyPerson = (props) => {
updateRepresentation,
setSavingStatus,
savingStatus,
+ setFilesForRepresentations,
} = props;
const required = (value) => (value ? undefined : "Required");
@@ -179,59 +185,38 @@ const RepInterestedPartyPerson = (props) => {
props.props.caseReference
}
hint={"sdsd"}
- fileList={[]}
- setFilesForRepresentation={[]}
+ fileList={
+ props.currentView.caseReference.hasOwnProperty(
+ "repDetails"
+ )
+ ? props.currentView.caseReference.repDetails.hasOwnProperty(
+ "filesList"
+ ) &&
+ props.currentView
+ .caseReference
+ .repDetails.filesList
+ .length > 0
+ ? props.currentView
+ .caseReference
+ .repDetails
+ .filesList
+ : []
+ : []
+ }
+ setFilesForRepresentations={
+ setFilesForRepresentations
+ }
containerID={
props.props.props.accountDetails
.containerID
}
filenamePrefix={props.formObj}
+ props={props.props.props}
+ setCurrentReference={
+ props.setCurrentReference
+ }
/>
- {props.currentView.caseReference.hasOwnProperty(
- "repDetails"
- ) ? (
- props.currentView.caseReference.repDetails.hasOwnProperty(
- "filesList"
- ) &&
- props.currentView.caseReference
- .repDetails.filesList.length > 0 ? (
-
- {filterFilesList.map(
- (blob, i) => (
-
-

-
-
- {blob.name} (
- {bytesToSize(
- blob.size
- )}
- )
-
-
- )
- )}
-
- ) : (
- ""
- )
- ) : (
- ""
- )}
{" "}
@@ -320,6 +305,9 @@ const RepInterestedPartyPerson = (props) => {
const mapDispatchToProps = (dispatch) => ({
updateField: (form, field, newValue) =>
dispatch(change(form, field, newValue)),
+ setFilesForRepresentations: (fileList) => {
+ dispatch(setFilesForRepresentations(fileList));
+ },
});
export default connect(
diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js
index a36b3447..7f463704 100644
--- a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js
+++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_enforcement.js
@@ -14,6 +14,11 @@ import {
RenderRichMultiline,
RenderTextfield,
} from "../representationElements";
+import {
+ setRepresentationCapacity,
+ setRepresentationSubmit,
+ setFilesForRepresentations,
+} from "../../../../store/currentView/action";
let Enforcement_Questionnaire = (props) => {
let { t } = useTranslation();
@@ -29,6 +34,7 @@ let Enforcement_Questionnaire = (props) => {
procedureTypeValue,
onBehalfOfLPA,
showQuestionnaireSection,
+ setFilesForRepresentations,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
@@ -1173,13 +1179,29 @@ let Enforcement_Questionnaire = (props) => {
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={
- props.props.props.props.form[
- "representationForm"
- ].values.filesList || []
+ props.currentView.caseReference.hasOwnProperty(
+ "repDetails"
+ )
+ ? props.currentView.caseReference.repDetails.hasOwnProperty(
+ "filesList"
+ ) &&
+ props.currentView.caseReference.repDetails
+ .filesList.length > 0
+ ? props.currentView.caseReference
+ .repDetails.filesList
+ : []
+ : []
}
- setFilesForRepresentation={[]}
- containerID={props.containerID}
- filenamePrefix={props.props}
+ setFilesForRepresentations={
+ setFilesForRepresentations
+ }
+ containerID={
+ props.props.props.props.accountDetails
+ .containerID
+ }
+ filenamePrefix={props.props.formObj}
+ props={props.props.props}
+ setCurrentReference={props.setCurrentReference}
/>
@@ -1252,6 +1274,17 @@ Enforcement_Questionnaire = connect((state) => {
};
})(Enforcement_Questionnaire);
+const mapDispatchToProps = (dispatch) => {
+ return {
+ updateField: (form, field, newValue) =>
+ dispatch(change(form, field, newValue)),
+
+ setFilesForRepresentations: (fileList) => {
+ dispatch(setFilesForRepresentations(fileList));
+ },
+ };
+};
+
const mapStateToProps = (state, props) => {
return {
search: state.search,
@@ -1264,7 +1297,10 @@ const mapStateToProps = (state, props) => {
};
};
-export default connect(mapStateToProps)(
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(
reduxForm({
form: "representationForm",
enableReinitialize: false,
diff --git a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js
index 8e780d93..11380192 100644
--- a/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js
+++ b/components/case/representation/representationQuestionnaires/representationLPAQuestionnaire_s78.js
@@ -14,6 +14,11 @@ import {
RenderRichMultiline,
RenderTextfield,
} from "../representationElements";
+import {
+ setRepresentationCapacity,
+ setRepresentationSubmit,
+ setFilesForRepresentations,
+} from "../../../../store/currentView/action";
import { connect } from "react-redux";
@@ -33,6 +38,7 @@ let S78_Questionnaire = (props) => {
procedureTypeValue,
onBehalfOfLPA,
showQuestionnaireSection,
+ setFilesForRepresentations,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const files = acceptedFiles.map((file) => (
@@ -986,13 +992,29 @@ let S78_Questionnaire = (props) => {
ticketnumber={props.props.caseReference}
hint={"sdsd"}
fileList={
- props.props.props.props.form[
- "representationForm"
- ].values.filesList || []
+ props.currentView.caseReference.hasOwnProperty(
+ "repDetails"
+ )
+ ? props.currentView.caseReference.repDetails.hasOwnProperty(
+ "filesList"
+ ) &&
+ props.currentView.caseReference.repDetails
+ .filesList.length > 0
+ ? props.currentView.caseReference
+ .repDetails.filesList
+ : []
+ : []
}
- setFilesForRepresentation={[]}
- containerID={props.containerID}
- filenamePrefix={props.props}
+ setFilesForRepresentations={
+ setFilesForRepresentations
+ }
+ containerID={
+ props.props.props.props.accountDetails
+ .containerID
+ }
+ filenamePrefix={props.props.formObj}
+ props={props.props.props}
+ setCurrentReference={props.setCurrentReference}
/>
@@ -1064,6 +1086,17 @@ S78_Questionnaire = connect((state) => {
};
})(S78_Questionnaire);
+const mapDispatchToProps = (dispatch) => {
+ return {
+ updateField: (form, field, newValue) =>
+ dispatch(change(form, field, newValue)),
+
+ setFilesForRepresentations: (fileList) => {
+ dispatch(setFilesForRepresentations(fileList));
+ },
+ };
+};
+
const mapStateToProps = (state, props) => {
return {
search: state.search,
@@ -1076,7 +1109,10 @@ const mapStateToProps = (state, props) => {
};
};
-export default connect(mapStateToProps)(
+export default connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(
reduxForm({
form: "representationForm",
enableReinitialize: false,