import React, { Component } from 'react';
import { Table, Row, Col, Button, Divider } from 'antd';
// import { $http } from '../../../containers/config/https';
import PatientList from '../Patient/PatientList';
import EventDetail from '../VitalSigns/EventDetail';


export default class EventRegister extends Component {
    constructor(props) {
        super(props);
        this.state = {
            leftspan: 5,
            rightspan: 19,
            admID: '',
            iconType: "double-left",
        }
    }

    updateState = (patientObj) => {
        if (patientObj.iconType) {
            this.setState(patientObj);
        }
        if (patientObj.patient) {
            let admID = patientObj.patient;
            if (admID.length === 0) return
            this.setState({
                admID: admID[0],
            });
        }
    }
    render() {
        return (
            <div style={{ height: "100%", width: '100%' }} className="VitalSignsSingle">
                <Col className={this.state.iconType == "double-left" ? "" : "visibleIcon"} span={this.state.leftspan}
                    style={{ border: this.state.iconType == "double-left" ? "1px solid #cccccc" : "0px", height: "100%", overflowY: 'hidden', background: '#ffffff', boxSizing: 'border-box' }}>
                    <PatientList updateState={this.updateState} iconType={this.state.iconType} type="radio" />
                </Col>
                <Col span={this.state.rightspan} style={{ border: "1px solid #cccccc", height: "100%", overflow: 'hidden' }}>
                    <EventDetail admID={this.state.admID ? this.state.admID : sessionStorage.admID} />
                </Col>
            </div>
        )
    }
}