content: import React from 'react';
  import Paper from 'material-ui/lib/paper';
  import DatePicker from 'material-ui/lib/date-picker/date-picker';
  import TimePicker from 'material-ui/lib/time-picker/time-picker';
  import RaisedButton from 'material-ui/lib/raised-button';
  import InputDate from './input_date';
  import InputTime from './input_time';
  import { partial, formatDate, formatTime } from '../lib/utils';
  import { getCRDate, getCRStartTime, getCREndTime } from '../lib/store';
  import { emit } from '../lib/dispatcher';
  
  const createBooking = partial(emit, 'CREATE_BOOKING');
  
  const ConferenceRoom = React.createClass({
  
    componentDidMount() {
  
      if (getCRDate() === null) {
        emit('SET_CR_DATE', new Date());
        emit('SET_VALID', 'date', true);
      }
  
      if (getCRStartTime() === null) {
        emit('SET_CR_START_TIME', new Date());
        emit('SET_VALID', 'start', true);
      }
  
      if (getCREndTime() === null) {
        emit('SET_CR_START_TIME', new Date());
        emit('SET_VALID', 'end', true);
      }
    },
    render() {
  
      const date = getCRDate();
      const start = getCRStartTime();
      const end = getCREndTime();
      const uid = this.props.user.get('id');
  
      return (
  
        <Paper rounded={false} style={{ padding: 10, height: 'calc(100vh - 64px)' }}>
  
          <h1>Бронювання конференц-залу</h1>
  
          <InputDate hintText='Оберіть день' defaultValue={new Date()} value={date}
            formatDate={formatDate} minDate={new Date()} onChange={partial(emit, 'SET_CR_DATE')} />
  
          <InputTime hintText='Оберіть час початку' defaultValue={new Date()} value={start} name='start'
            formatTime={formatTime} minTime={new Date()} onChange={partial(emit, 'SET_CR_START_TIME')} />
  
          <InputTime hintText='Оберіть час закінчення' defaultValue={new Date()} value={end} name='end'
            formatTime={formatTime} minTime={start || new Date()} onChange={partial(emit, 'SET_CR_END_TIME')} />
  
          <RaisedButton
            label='Забронювати'
            onTouchTap={partial(createBooking, Number(date), Number(start), Number(end), uid)} />
  
        </Paper>
      );
    }
  });
  
  export default ConferenceRoom;
  