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,
  Tabs, Tab,
  RaisedButton,
  Toolbar,
  DatePicker,
  FontIcon,
  Table,
  TableBody,
  TableHeader,
  TableHeaderColumn,
  TableRow,
  TableRowColumn,
  MenuItem,
  ToolbarGroup,
  FloatingActionButton,
  ToolbarSeparator,
  IconButton,
  ToolbarTitle,
  RadioButton,
  TextField,
  Paper,
  RadioButtonGroup
} from 'material-ui';
import StarBorder from 'material-ui/svg-icons/toggle/star-border';
import SwipeableViews from 'react-swipeable-views';
import SearchIcon from 'material-ui/svg-icons/action/search';
import AddIcon from 'material-ui/svg-icons/content/add';
import NavigationArrowBack from 'material-ui/svg-icons/navigation/arrow-back';
import NavigationCancel from 'material-ui/svg-icons/navigation/cancel';
import CommunicationNoSim from 'material-ui/svg-icons/communication/no-sim';

import '../style.scss';
import {appConfig} from "../../../config/app";
import {DIALOG} from "../../../stores/global_ui";
import {LINKS} from "../../../routes";
import {Link} from "react-router-dom";

@inject('appstate')
@observer
export default class WalletComponentDetail extends React.Component {
  constructor(props) {
    super(props);
    this.props = props;
    this.state = {
      value: 1,
      searchText: '',
      slideIndex: 0
    };
    this.defaultState = Object.assign({}, this.state);
    this.http = props.appstate.http;
    this.authStore = props.appstate.auth;
  }

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

  }

  handleUpdateInput = (searchText) => {
    this.setState({
      searchText: searchText,
    });
  };

  handleNewRequest = () => {
    this.setState({
      searchText: '',
    });
  };

  tabsHandleChange = (value) => {
    this.setState({
      slideIndex: value,
    });
  };

  handleChange = (event, index, value) => this.setState({value});

  render() {
    const styles = {

      radioButton: {
        marginBottom: 16,
      },
    };

    const colors = [
      'Jakarta - Soekarno - Hatta (CGK)',
      'Bali',
      'Surabaya',
      'Yogyakarta',
      'Aceh',
      'Kalimantan',
      'Medan',
      'Papua',
    ];

    const items = [
      <MenuItem key={1} value={1} primaryText="All Maskapai"/>,
      <MenuItem key={2} value={2} primaryText="Air Asia"/>,
      <MenuItem key={3} value={3} primaryText="Weeknights"/>,
      <MenuItem key={4} value={4} primaryText="Weekends"/>,
      <MenuItem key={5} value={5} primaryText="Weekly"/>,
    ];

    const count = [
      <MenuItem key={1} value={1} primaryText="1"/>,
      <MenuItem key={2} value={2} primaryText="2"/>,
      <MenuItem key={3} value={3} primaryText="3"/>,
      <MenuItem key={4} value={4} primaryText="4"/>,
      <MenuItem key={5} value={5} primaryText="5"/>,
    ];

    return (
      <div className="customerDetail containerMiddle animated fadeIn">
        <div style={{marginBottom: '10px', marginLeft: '-15px'}}>
          <FlatButton
            className="headerMenu"
            hoverColor="#f1f5f9"
            style={{background: '#ffffff00'}}
            onClick={() => this.props.history.goBack}
            label="Back"
            primary={true}
            icon={<NavigationArrowBack/>}
          />
        </div>

        <Card className="row">

          <div className="flexSpaceBetween" style={{padding: 16}}>
            <div className="">
              <CardTitle style={{padding: 0, fontSize: 22}}
                         titleStyle={{fontSize: 22}}
                         title="Transaction #1827381"
              />
              <div className="listCustDetail">
                <div className="listHeaderCustDetailItem flex">
                  <p className="listHeaderCustomerDetailItemKey">Type</p>
                  <p className="listHeaderCustomerDetailItemValue"><code>Package Down Payment Commision</code></p>
                </div>
                <div className="listHeaderCustDetailItem flex">
                  <p className="listHeaderCustomerDetailItemKey">Date</p>
                  <p className="listHeaderCustomerDetailItemValue">10 October 2017</p>
                </div>
                <div className="listHeaderCustDetailItem flex">
                  <p className="listHeaderCustomerDetailItemKey">From</p>
                  <p className="listHeaderCustomerDetailItemValue">Customer <code>cus_1237812</code></p>
                </div>
                <div className="listHeaderCustDetailItem flex">
                  <p className="listHeaderCustomerDetailItemKey">Order Reference</p>
                    <p className="listHeaderCustomerDetailItemValue">#1827381</p>
                </div>
              </div>
            </div>

            <ToolbarGroup>
              <IconButton tooltip="Cancel">
                <NavigationCancel/>
              </IconButton>
              <IconButton tooltip="Void">
                <CommunicationNoSim/>
              </IconButton>
            </ToolbarGroup>
          </div>
          <Divider/>

          <div style={{marginTop: 0}}>
            <Table selectable={false}>
              <TableHeader displaySelectAll={false}
                           adjustForCheckbox={false}
                           enableSelectAll={false}>
                <TableRow style={{height: 38, background: '#f6f9fc'}}>

                  <TableHeaderColumn className="TableHeaderColumnAkun"
                                     style={{height: 'auto'}}>Description</TableHeaderColumn>
                  <TableHeaderColumn className="TableHeaderColumnAkun"
                                     style={{height: 'auto'}}>Qty</TableHeaderColumn>
                  <TableHeaderColumn className="TableHeaderColumnAkun"
                                     style={{height: 'auto'}}>Price</TableHeaderColumn>
                  <TableHeaderColumn className="TableHeaderColumnAkun"
                                     style={{height: 'auto'}}>Commision</TableHeaderColumn>
                  <TableHeaderColumn className="TableHeaderColumnAkun"
                                     style={{height: 'auto'}}>Amount</TableHeaderColumn>
                </TableRow>
              </TableHeader>
              <TableBody displayRowCheckbox={false}>

                <TableRow>
                  <TableRowColumn>Package #1827381 Payment</TableRowColumn>
                  <TableRowColumn>1</TableRowColumn>
                  <TableRowColumn>1.500.000</TableRowColumn>
                  <TableRowColumn>10%</TableRowColumn>
                  <TableRowColumn>150.000</TableRowColumn>
                </TableRow>
                <TableRow>
                  <TableRowColumn>Package #92839 Payment</TableRowColumn>
                  <TableRowColumn>1</TableRowColumn>
                  <TableRowColumn>1.500.000</TableRowColumn>
                  <TableRowColumn>10%</TableRowColumn>
                  <TableRowColumn>150.000</TableRowColumn>
                </TableRow>
                <TableRow>
                  <TableRowColumn></TableRowColumn>
                  <TableRowColumn></TableRowColumn>
                  <TableRowColumn></TableRowColumn>
                  <TableRowColumn><b>Total</b></TableRowColumn>
                  <TableRowColumn><b>300.000</b></TableRowColumn>
                </TableRow>
              </TableBody>
            </Table>
            <Divider/>

          </div>
        </Card>
        <Card>

          <CardHeader actAsExpander={true}
                      showExpandableButton={false} style={{paddingBottom: 16}}
                      subtitle={<a style={{fontSize: 12, paddingLeft: 10}}>Transaction History</a>}/>
          <Divider/>

          <CardText className="no-padding" expandable={true}>
            <Table selectable={false}>
              <TableHeader displaySelectAll={false}
                           adjustForCheckbox={false}
                           enableSelectAll={false}>
                <TableRow style={{height: 38, background: '#f6f9fc'}}>

                  <TableHeaderColumn className="TableHeaderColumnAkun"
                                     style={{height: 'auto'}}>Date</TableHeaderColumn>
                  <TableHeaderColumn className="TableHeaderColumnAkun"
                                     style={{height: 'auto'}}>Description</TableHeaderColumn>
                  <TableHeaderColumn className="TableHeaderColumnAkun"
                                     style={{height: 'auto'}}>Amount</TableHeaderColumn>
                  <TableHeaderColumn className="TableHeaderColumnAkun"
                                     style={{height: 'auto'}}>Status</TableHeaderColumn>
                </TableRow>
              </TableHeader>
              <TableBody displayRowCheckbox={false}>
                <TableRow>
                  <TableRowColumn>10/02/2017 22:30:10</TableRowColumn>
                  <TableRowColumn>Awaiting Approval</TableRowColumn>
                  <TableRowColumn>Rp. 3.000.000.00</TableRowColumn>
                  <TableRowColumn>Approved</TableRowColumn>
                </TableRow>
                <TableRow>
                  <TableRowColumn>10/02/2017 20:30:10</TableRowColumn>
                  <TableRowColumn>Awaiting Approval</TableRowColumn>
                  <TableRowColumn>Rp. 3.000.000.00</TableRowColumn>
                  <TableRowColumn>Pending</TableRowColumn>
                </TableRow>
              </TableBody>
            </Table>
          </CardText>
        </Card>

      </div>
    )
  }
}
