import React, {Component} from 'react'; import {connect} from 'react-redux'; import Dropzone from 'react-dropzone'; import {Row, Col} from 'reactstrap'; import {uploadCustomerQuestionnaire, badFile} from '../../../../actions/orders/customerQuestionnairesActions'; import {API_SERVER} from '../../../../config'; import FileDownloader from '../../../../helpers/FileDownloader'; import {orderTexts} from '../../../../constants/ordersConstants'; const fileHandler = new FileDownloader(); class ValidateQuestionnaireItem extends Component { downloadDocument(document){ const fileUrl = `${API_SERVER}/utils/api/downloadFile?idDocument=${document.idDocument}&fileName=${document.documentName}.${document.extension}` const fileName = document.documentName + '.' + document.extension; fileHandler.download(fileUrl, fileName); } uploadFile(action,acceptedFiles, rejectedFiles) { if(acceptedFiles && acceptedFiles.length){ const file = acceptedFiles[0]; this.props.dispatch(uploadCustomerQuestionnaire(action.order_id, action.action_id, file)); } // if(rejectedFiles && rejectedFiles.length) { // this.props.dispatch(badFile()); // } } render() { const {action, orderPackage} = this.props; const customerDocuments = [ action.document ]; return (