import {Button, Modal, Checkbox } from "antd";
import {DrillingFluid} from "../components/DrillingFluid";
import {useState, useEffect} from "react";
import {useParams} from "react-router-dom"
import {SludgeDiagram} from "../components/MudDiagram";
import {Nnb} from "../components/Nnb"
import Disposition from "../components/Disposition";
import notify from "../components/notify"


export default function LastData() {

  const [tableVisible, setCementTableVisible] = useState(false)
  const [tableSludgeVisible, setTableSludgeVisible] = useState(false)
  const [tableNNBVisible, setTableNNBVisible] = useState(false)
  const [dispositionVisible, setDispositionVisible] = useState(false)
  const [loader, setLoader] = useState(false)

  return (
    <>
      <div>&nbsp;</div>
      <Button type="primary" onClick={() => setCementTableVisible(true)}>
        Последний замер бурового раствора
      </Button>
      <Modal
        title='Последние показатели бурового раствора'
        centered
        visible={tableVisible}
        onCancel={() => setCementTableVisible(false)}
        width={2000}
        footer={[
          <Button key="back" onClick={() => setCementTableVisible(false)}>
            Закрыть
          </Button>
        ]}
      >
        <DrillingFluid/>
        <div>&nbsp;</div>
        <p style={{textAlign: "right"}}><b>{new Date().toLocaleString()}</b></p>
      </Modal>
      <Button type="primary" onClick={() => setTableSludgeVisible(true)} style={{marginLeft: "5px"}}>
        Шламограмма
      </Button>
      <Modal
        title='Шламограмма'
        centered
        visible={tableSludgeVisible}
        onCancel={() => setTableSludgeVisible(false)}
        width={2000}
        footer={[
          <Button key="back" onClick={() => setTableSludgeVisible(false)}>
            Закрыть
          </Button>
        ]}
      >
        <SludgeDiagram/>
        <div>&nbsp;</div>
        <p style={{textAlign: "right"}}><b>{new Date().toLocaleString()}</b></p>
      </Modal>
      <Button type="primary" onClick={() => setTableNNBVisible(true)} style={{marginLeft: "5px"}}>
        ННБ
      </Button>
      <Modal
        title='ННБ'
        centered
        visible={tableNNBVisible}
        onCancel={() => setTableNNBVisible(false)}
        width={2000}
        footer={[
          <Button key="back" onClick={() => setTableNNBVisible(false)}>
            Закрыть
          </Button>
        ]}
      >
        <Nnb/>
        <div>&nbsp;</div>
        <p style={{textAlign: "right"}}><b>{new Date().toLocaleString()}</b></p>
      </Modal>
      <Button type="primary" onClick={() => setDispositionVisible(true)} style={{marginLeft: "5px"}}>
        Распоряжение
      </Button>
      <Modal
        title='Распоряжение'
        centered
        visible={dispositionVisible}
        onOk={() => setDispositionVisible(false)}
        onCancel={() => setDispositionVisible(false)}
        width={850}
        okText='Ок'
        cancelText='Отмена'
        footer={[
          <Checkbox style={{marginRight: '10px'}}>Принять распоряжение</Checkbox>,
          <Button key="submit" type="secondary"
                  onClick={() => setDispositionVisible(false)}>
            Отмена
          </Button>,
          <Button key="submit" type="primary"
                  onClick={() => setDispositionVisible(false)}>
            Ок
          </Button>
        ]}
      >
        <Disposition/>
      </Modal>
    </>)
}