2021-08-31 18:04:04 +05:00
|
|
|
|
import {Button} from 'antd'
|
|
|
|
|
import { useState } from "react"
|
|
|
|
|
import {invokeWebApiWrapperAsync, download} from '../../components/factory'
|
|
|
|
|
import DocumentsTemplate from './DocumentsTemplate'
|
|
|
|
|
import LoaderPortal from '../../components/LoaderPortal'
|
|
|
|
|
|
|
|
|
|
const idFileCategoryDrillingProgramItems = 13;
|
|
|
|
|
|
|
|
|
|
export default function DrillingProgram({idWell}) {
|
|
|
|
|
const [showLoader, setShowLoader] = useState(false)
|
|
|
|
|
|
2021-09-01 10:32:47 +05:00
|
|
|
|
const urlDownloadProgram =`/api/well/${idWell}/drillingProgram`
|
2021-08-31 18:04:04 +05:00
|
|
|
|
|
|
|
|
|
const downloadProgram = () => invokeWebApiWrapperAsync(async()=>{
|
|
|
|
|
await download(urlDownloadProgram)
|
|
|
|
|
},
|
|
|
|
|
setShowLoader,
|
|
|
|
|
"Не удалось загрузить программу бурения")
|
|
|
|
|
|
|
|
|
|
return(<LoaderPortal show={showLoader}>
|
|
|
|
|
<Button onClick={downloadProgram}>Сформировать программу бурения</Button>
|
|
|
|
|
<DocumentsTemplate
|
|
|
|
|
idWell={idWell}
|
2021-09-01 10:32:47 +05:00
|
|
|
|
idCategory={idFileCategoryDrillingProgramItems}
|
|
|
|
|
accept='.xlsx'/>
|
2021-08-31 18:04:04 +05:00
|
|
|
|
</LoaderPortal>)
|
|
|
|
|
}
|