From 260f89db62a760b7e36f19ff9392aa49acc10b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A4=D1=80=D0=BE=D0=BB=D0=BE=D0=B2?= Date: Mon, 11 Oct 2021 13:42:32 +0500 Subject: [PATCH] Add import/export to WellOperations --- src/pages/Documents/DocumentsTemplate.jsx | 2 +- src/pages/Well.jsx | 4 +- src/pages/WellOperations/ImportExportBar.jsx | 54 +++++++++++++++++++ src/pages/WellOperations/ImportOperations.jsx | 41 ++++++++++++++ src/pages/WellOperations/index.jsx | 11 +++- 5 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 src/pages/WellOperations/ImportExportBar.jsx create mode 100644 src/pages/WellOperations/ImportOperations.jsx diff --git a/src/pages/Documents/DocumentsTemplate.jsx b/src/pages/Documents/DocumentsTemplate.jsx index 4f8c6af..6409392 100644 --- a/src/pages/Documents/DocumentsTemplate.jsx +++ b/src/pages/Documents/DocumentsTemplate.jsx @@ -8,7 +8,7 @@ import { formatBytes, } from "../../components/factory" import { EditableTable, makePaginationObject } from "../../components/Table" -import UploadForm from "../../components/UploadForm" +import {UploadForm} from "../../components/UploadForm" import LoaderPortal from "../../components/LoaderPortal" import {UserView} from '../../components/UserView' import {CompanyView} from '../../components/CompanyView' diff --git a/src/pages/Well.jsx b/src/pages/Well.jsx index 01103e5..9da4b48 100644 --- a/src/pages/Well.jsx +++ b/src/pages/Well.jsx @@ -46,7 +46,7 @@ export default function Well() { Рапорт }> - Операции по скважине + Операции по скважине }> Архив @@ -89,7 +89,7 @@ export default function Well() { - + diff --git a/src/pages/WellOperations/ImportExportBar.jsx b/src/pages/WellOperations/ImportExportBar.jsx new file mode 100644 index 0000000..11addca --- /dev/null +++ b/src/pages/WellOperations/ImportExportBar.jsx @@ -0,0 +1,54 @@ +import { Button, Tooltip, Modal } from "antd"; +import {useState} from 'react' +import { FileOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons' +import { download } from '../../components/factory' +import { ImportOperations } from './ImportOperations' + +const style = {margin:4} + +export const ImportExportBar = ({idWell, onImported}) =>{ + const [isImportModalVisible, setIsImportModalVisible] = useState(false) + + const downloadTemplate = async () => download(`/api/well/${idWell}/wellOperations/tamplate`) + const downloadExport = async () => download(`/api/well/${idWell}/wellOperations/export`) + + const onDone = () => { + setIsImportModalVisible(false) + if(onImported) + onImported() + } + + return <> + +