Reformat all project files to use the prettier config file.
This commit is contained in:
@@ -1,71 +1,69 @@
|
||||
import {UploadOutlined} from "@ant-design/icons";
|
||||
import {Upload} from "antd";
|
||||
import React, {useState} from "react";
|
||||
import { UploadOutlined } from "@ant-design/icons";
|
||||
import { Upload } from "antd";
|
||||
import React, { useState } from "react";
|
||||
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop, selectCurrentUser,} from "../../redux/user/user.selectors";
|
||||
import {handleUpload} from "./documents-local-upload.utility";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop, selectCurrentUser } from "../../redux/user/user.selectors";
|
||||
import { handleUpload } from "./documents-local-upload.utility";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
bodyshop: selectBodyshop,
|
||||
currentUser: selectCurrentUser,
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
|
||||
export function DocumentsLocalUploadComponent({
|
||||
children,
|
||||
currentUser,
|
||||
bodyshop,
|
||||
job,
|
||||
vendorid,
|
||||
invoice_number,
|
||||
callbackAfterUpload,
|
||||
allowAllTypes,
|
||||
}) {
|
||||
const [fileList, setFileList] = useState([]);
|
||||
children,
|
||||
currentUser,
|
||||
bodyshop,
|
||||
job,
|
||||
vendorid,
|
||||
invoice_number,
|
||||
callbackAfterUpload,
|
||||
allowAllTypes
|
||||
}) {
|
||||
const [fileList, setFileList] = useState([]);
|
||||
|
||||
const handleDone = (uid) => {
|
||||
setTimeout(() => {
|
||||
setFileList((fileList) => fileList.filter((x) => x.uid !== uid));
|
||||
}, 2000);
|
||||
};
|
||||
const handleDone = (uid) => {
|
||||
setTimeout(() => {
|
||||
setFileList((fileList) => fileList.filter((x) => x.uid !== uid));
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
return (
|
||||
<Upload.Dragger
|
||||
multiple={true}
|
||||
fileList={fileList}
|
||||
onChange={(f) => {
|
||||
if (f.event && f.event.percent === 100) handleDone(f.file.uid);
|
||||
return (
|
||||
<Upload.Dragger
|
||||
multiple={true}
|
||||
fileList={fileList}
|
||||
onChange={(f) => {
|
||||
if (f.event && f.event.percent === 100) handleDone(f.file.uid);
|
||||
|
||||
setFileList(f.fileList);
|
||||
}}
|
||||
customRequest={(ev) =>
|
||||
handleUpload({
|
||||
ev,
|
||||
context: {
|
||||
jobid: job.id,
|
||||
vendorid,
|
||||
invoice_number,
|
||||
callback: callbackAfterUpload,
|
||||
},
|
||||
})
|
||||
}
|
||||
{...(!allowAllTypes && {
|
||||
accept: "audio/*, video/*, image/*, .pdf, .doc, .docx, .xls, .xlsx",
|
||||
})}
|
||||
>
|
||||
{children || (
|
||||
<>
|
||||
<p className="ant-upload-drag-icon">
|
||||
<UploadOutlined/>
|
||||
</p>
|
||||
<p className="ant-upload-text">
|
||||
Click or drag files to this area to upload.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</Upload.Dragger>
|
||||
);
|
||||
setFileList(f.fileList);
|
||||
}}
|
||||
customRequest={(ev) =>
|
||||
handleUpload({
|
||||
ev,
|
||||
context: {
|
||||
jobid: job.id,
|
||||
vendorid,
|
||||
invoice_number,
|
||||
callback: callbackAfterUpload
|
||||
}
|
||||
})
|
||||
}
|
||||
{...(!allowAllTypes && {
|
||||
accept: "audio/*, video/*, image/*, .pdf, .doc, .docx, .xls, .xlsx"
|
||||
})}
|
||||
>
|
||||
{children || (
|
||||
<>
|
||||
<p className="ant-upload-drag-icon">
|
||||
<UploadOutlined />
|
||||
</p>
|
||||
<p className="ant-upload-text">Click or drag files to this area to upload.</p>
|
||||
</>
|
||||
)}
|
||||
</Upload.Dragger>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(DocumentsLocalUploadComponent);
|
||||
|
||||
Reference in New Issue
Block a user