upodated rep file upload

This commit is contained in:
2024-12-18 12:39:17 +00:00
parent 54728d9565
commit 97cfeb562a
13 changed files with 433 additions and 108 deletions
@@ -12,10 +12,11 @@ import {
} from "./representationElements";
import { useDropzone } from "react-dropzone";
// import {
// setRepresentationCapacity,
// setRepresentationSubmit,
// } from "../../../store/currentView/action";
import {
setRepresentationCapacity,
setRepresentationSubmit,
setFilesForRepresentations,
} from "../../../store/currentView/action";
const RepAppellant = (props) => {
let { t } = useTranslation();
@@ -32,6 +33,7 @@ const RepAppellant = (props) => {
updateRepresentation,
setSavingStatus,
savingStatus,
setFilesForRepresentations,
} = props;
const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
@@ -170,51 +172,36 @@ const RepAppellant = (props) => {
)}
ticketnumber={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
}
/>
</div>
{props.currentView.caseReference.hasOwnProperty(
"repDetails"
) ? (
props.currentView.caseReference.repDetails.hasOwnProperty(
"filesList"
) &&
props.currentView.caseReference.repDetails
.filesList.length > 0 ? (
<div className="govuk-form-group govuk-!-margin-bottom-9">
{filterFilesList.map((blob, i) => (
<div
key={blob.name + "_" + i}
className="govuk-!-margin-bottom-5 fileThumb "
>
<img
src={getThumbnailIconByExtension(
blob.name
)}
alt={blob.name}
width="50"
/>
<span className="govuk-body govuk-!-font-size-14 govuk-!-padding-left-5">
{blob.name} (
{bytesToSize(blob.size)}
)
</span>
</div>
))}
</div>
) : (
""
)
) : (
""
)}
</fieldset>
</div>{" "}
</div>
@@ -296,10 +283,16 @@ const RepAppellant = (props) => {
//const mapStateToProps = (state, props) => {};
const mapDispatchToProps = (dispatch) => ({
updateField: (form, field, newValue) =>
dispatch(change(form, field, newValue)),
});
const mapDispatchToProps = (dispatch) => {
return {
updateField: (form, field, newValue) =>
dispatch(change(form, field, newValue)),
setFilesForRepresentations: (fileList) => {
dispatch(setFilesForRepresentations(fileList));
},
};
};
export default connect(
null,