applied upload funcitonalilty to IP,Agent,LPA
This commit is contained in:
@@ -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
|
||||
}
|
||||
/>
|
||||
</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>
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user