import React from 'react';
import {observer, inject} from 'mobx-react';
import bind from 'bind-decorator';
import {
  Card,
  CardActions,
  CardHeader,
  CardMedia,
  CardTitle,
  AutoComplete,
  CardText,
  FlatButton,
  Divider,
  RaisedButton,
  Toolbar,
  DatePicker,
  FontIcon,
  SelectField,
  MenuItem,
  ToolbarGroup,
  FloatingActionButton,
  ToolbarSeparator,
  IconButton,
  ToolbarTitle,
  RadioButton, RadioButtonGroup,
  Tabs, Tab, TextField, Dialog
} from 'material-ui';
import {withRouter} from 'react-router';
import {BrowserRouter as Router, Route} from 'react-router-dom';
import StarBorder from 'material-ui/svg-icons/toggle/star-border';
import ContentAdd from 'material-ui/svg-icons/content/add';

import '../style.scss';
import {appConfig} from "../../../config/app";

@inject('appstate')
@observer
export default class Confirmation extends React.Component {
  constructor(props) {
    super(props);
    this.props = props;
    this.state = {
      openModal :false
    };
    this.defaultState = Object.assign({}, this.state);
    this.http = props.appstate.http;
    this.authStore = props.appstate.auth;
  }

  componentDidMount() {
    console.log('Profile loaded!');

  }

  handleCloseModal = ()=>{
    this.setState({
      openModal : false
    })
  };

  handleOpenModal = ()=>{
    this.setState({
      openModal : true
    })
  }

  render() {

    const data = {
        name : 'Sapta Petala',
        inOut: '16-09-2017 / 17-09-2017',
        roomType:'Superior',
        bedType : 'Single',
        board : 'Room Only',
        roomNight : '1/1',
        price:'200,000',
        pax:'200,000',
        nta:'185,000',
        commission:'15,000'
      };
      const actionsModals = [
        <FlatButton
          label="Cancel"
          primary={true}
          onClick={this.handleCloseModal}
        />,
        <FlatButton
          label="Ok"
          primary={true}
          onClick={this.props.onClickBookNow}
        />,
      ];

    return (
      <Card className="animated fadeIn">
        <Toolbar className="toolbarCard" style={{backgroundColor: '#fff'}}>
          <ToolbarGroup>
                <IconButton
                  iconClassName="material-icons"
                  tooltip="Back"
                  style={{marginLeft:'0px'}}
                  onClick={this.props.onClickBack}
                >
                  arrow_back
                </IconButton>
            <ToolbarTitle style={{fontSize: 14, fontWeight: 500, color: '#32325d'}} text="Confirmation"/>
          </ToolbarGroup>
        </Toolbar>
        <Divider/>
          <div style={{padding: '14px'}}>
            <div className="row hover">
              <div className="col l3">
                <p>Hotel</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>{data.name}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p>In / Out</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>{data.inOut}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p>Room Type</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>{data.roomType}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p>Bed Type</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>{data.bedType}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p>Board</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>{data.board}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p>Room/Night</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>{data.roomNight}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l4">
                <p style={{fontWeight: 'bolder'}}>Price</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p>Hotel Price</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>IDR {data.price}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p>Pax Paid</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>IDR {data.pax}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p>NTA Price</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>IDR {data.nta}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p>Commission</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>IDR {data.commission}</p>
              </div>
            </div>
            <div className="row hover">
              <div className="col l3">
                <p style={{fontWeight: 'bolder'}}>Total</p>
              </div>
              <div className="col l1">
                <p>:</p>
              </div>
              <div className="col l8">
                <p>Rp. 200.000</p>
              </div>
            </div>
            <div className="row">
              <div className="col m10" />
              <div className="col m2">
                <RaisedButton label="Confirm" primary={true} style={{marginTop: '30px'}} icon={ <FontIcon className="material-icons">check</FontIcon>} onClick={this.handleOpenModal} />
                <Dialog
                  title="Are you sure that all data is correct?"
                  actions={actionsModals}
                  modal={true}
                  open={this.state.openModal}
                >
                  Booking request will be send and data can't be change again.
                </Dialog>
              </div>
            </div>
          </div>
      </Card>
    )
  }
}
