function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

import React from 'react';
import '../../assets/styles/widgets/meetingCalenderViews/meetingCalenderViews.scss';
import { connect, PromiseState } from "react-refetch";
import moment from 'moment';
import { AccordionContent, Avatar, ListItemSection, Menu, MenuItem, MenuOverlay, Modal, ModalBody, ModalFooter, ModalHeader, Icon, Button, Popover } from '@momentum-ui/react';
import Loading from "../common/component/Loading";

var pmrMoreInfo = function (_React$Component) {
  _inherits(pmrMoreInfo, _React$Component);

  function pmrMoreInfo(props) {
    _classCallCheck(this, pmrMoreInfo);

    var _this = _possibleConstructorReturn(this, _React$Component.call(this, props));

    _this.state = {
      showDialog: false,
      items: []
    };
    return _this;
  }

  pmrMoreInfo.prototype.render = function render() {
    var _this2 = this;

    function handleClick(e) {
      e.preventDefault();
      e.stopPropagation();
      console.log('The link was clicked.');
    }

    var pmrMoreInfoFetch = this.props.pmrMoreInfoFetch;

    var myPmrMoreInfo = PromiseState.all([pmrMoreInfoFetch]);

    if (myPmrMoreInfo.pending) {
      return React.createElement(
        'div',
        { className: 'wg_pmr_more' },
        React.createElement(Loading, null)
      );
    } else if (myPmrMoreInfo.rejected) {
      return React.createElement(
        'div',
        { className: 'wg_pmr_more' },
        myPmrMoreInfo.reason
      );
    } else if (myPmrMoreInfo.fulfilled) {
      // decompose the PromiseState back into individual
      var _myPmrMoreInfo$value = myPmrMoreInfo.value,
          _pmrMoreInfo = _myPmrMoreInfo$value[0];

      var pmrMoreInfos = _pmrMoreInfo.items[0];
      // this.setState(state => ({ items: myMeetingInfo.items}));
      // + {item.meetingNumber}
      console.log(this.state);
      console.log(_pmrMoreInfo.items);

      return React.createElement(
        'span',
        { className: 'wg_pmr_more moreway', role: 'alert', id: 'popover-content-1' },
        React.createElement(
          'span',
          { id: 'pmr_advancedInfo' },
          React.createElement(
            'div',
            { className: 'pop' },
            React.createElement(
              'div',
              { className: 'pmr_adInfo_roomid' },
              React.createElement(
                'span',
                null,
                'Meeting Number:'
              ),
              React.createElement(
                'span',
                {
                  tabIndex: '0',
                  'aria-label': 'Using command C or Ctrl C to copy the information',
                  title: this.props.meetingNumber
                },
                this.props.meetingNumber
              )
            ),
            React.createElement(
              'div',
              { id: 'copiedArea', className: 'pmr_pop' },
              React.createElement(
                'div',
                { className: 'pmr_pop_c' },
                React.createElement(
                  'div',
                  { className: 'pmr_pop_items' },
                  React.createElement(
                    'div',
                    { className: 'pmr_pop_imoret' },
                    React.createElement(
                      'h5',
                      null,
                      'Join by video system'
                    )
                  ),
                  React.createElement(
                    'div',
                    { id: 'VideoPart', className: 'pmr_pop_imorei' },
                    React.createElement(
                      'div',
                      null,
                      React.createElement(
                        'i',
                        {
                          id: 'joinByVideoDial' },
                        'Dial ',
                        pmrMoreInfos.hostEmail,
                        ' and enter your host PIN ',
                        pmrMoreInfos.hostKey,
                        '.'
                      )
                    ),
                    React.createElement(
                      'div',
                      null,
                      React.createElement(
                        'i',
                        null,
                        'You can also dial ',
                        pmrMoreInfos.dialInIpAddress,
                        ' and enter your meeting number.'
                      )
                    )
                  )
                ),
                React.createElement(
                  'div',
                  { className: 'pmr_pop_items' },
                  React.createElement(
                    'div',
                    { className: 'pmr_pop_imoret' },
                    React.createElement(
                      'h5',
                      null,
                      'Join by phone'
                    )
                  ),
                  React.createElement(
                    'div',
                    { id: 'AudioPart', className: 'pmr_pop_imorei' },
                    pmrMoreInfos.telephony.callInNumbers.map(function (item, index) {
                      return React.createElement(
                        'div',
                        { className: 'audioPartRow' },
                        React.createElement(
                          'label',
                          null,
                          item.callInNumber
                        ),
                        React.createElement(
                          'span',
                          null,
                          item.label
                        )
                      );
                    }),
                    React.createElement(
                      'div',
                      { className: 'audioPartRow' },
                      React.createElement(
                        'label',
                        null,
                        'Access code:'
                      ),
                      React.createElement(
                        'span',
                        null,
                        this.props.meetingNumber
                      )
                    ),
                    React.createElement(
                      'div',
                      { id: 'pmr_hostPIN', className: 'audioPartRow' },
                      React.createElement(
                        'label',
                        null,
                        'Host PIN:'
                      ),
                      React.createElement(
                        'span',
                        null,
                        pmrMoreInfos.hostKey
                      )
                    )
                  )
                )
              )
            ),
            React.createElement(
              'div',
              { className: 'pmr_pop_items callinNumber' },
              React.createElement(
                'div',
                { className: 'wbxCallinNumber' },
                React.createElement(
                  'a',
                  { 'aria-label': 'Open Modal', onClick: function onClick() {
                      return _this2.setState({ showDialog: true });
                    }, href: '#' },
                  'Global call-in numbers'
                ),
                React.createElement(
                  Modal,
                  {
                    icon: React.createElement(Icon, { name: 'warning_72', color: '$md-yellow-50' }),
                    applicationId: 'app',
                    onHide: function onHide() {
                      return _this2.setState({ showDialog: false });
                    },
                    show: this.state.showDialog,
                    ref: function ref(modalDialog) {
                      return _this2.modalDialog = modalDialog;
                    },
                    size: 'dialog',
                    htmlId: 'modalDialog'
                  },
                  React.createElement(ModalHeader, {
                    headerLabel: 'Global call-in numbers'
                  }),
                  React.createElement(
                    ModalBody,
                    null,
                    React.createElement(
                      'div',
                      { className: 'md-data-table', style: { width: '100%' } },
                      React.createElement(
                        'div',
                        { className: 'md-data-table__wrapper' },
                        React.createElement(
                          'table',
                          { className: 'testTableClass' },
                          React.createElement(
                            'thead',
                            { className: 'md-data-table__thead' },
                            React.createElement(
                              'tr',
                              null,
                              React.createElement(
                                'th',
                                { style: { width: '8rem' } },
                                'Country'
                              ),
                              React.createElement(
                                'th',
                                { style: { width: '5rem' } },
                                'Toll Type'
                              ),
                              React.createElement(
                                'th',
                                { style: { width: '10rem' } },
                                'Call Number'
                              )
                            )
                          ),
                          React.createElement(
                            'tbody',
                            {
                              className: 'md-data-table__tbody' },
                            pmrMoreInfos.telephony.callInNumbers.map(function (item, index) {
                              return React.createElement(
                                'tr',
                                null,
                                React.createElement(
                                  'td',
                                  null,
                                  ' ',
                                  item.label,
                                  ' '
                                ),
                                React.createElement(
                                  'td',
                                  null,
                                  ' ',
                                  item.tollType,
                                  ' '
                                ),
                                React.createElement(
                                  'td',
                                  null,
                                  ' ',
                                  item.callInNumber,
                                  ' '
                                )
                              );
                            })
                          )
                        )
                      )
                    )
                  ),
                  React.createElement(
                    ModalFooter,
                    null,
                    React.createElement(Button, {
                      children: 'Cancel',
                      onClick: function onClick() {
                        return _this2.modalDialog.closeModal();
                      },
                      ariaLabel: 'Close Modal',
                      color: 'default'
                    }),
                    React.createElement(Button, {
                      children: 'OK',
                      onClick: function onClick() {
                        return _this2.modalDialog.closeModal();
                      },
                      ariaLabel: 'Submit Form',
                      color: 'blue'
                    })
                  )
                )
              )
            )
          )
        )
      );
    }
  };

  return pmrMoreInfo;
}(React.Component);

export default connect(function (props) {
  return {
    // simple GET from a URL injected as `userFetch` prop
    // if `userId` changes, data will be refetched

    // similar to `userFetch`, but using object syntax
    // specifies a refresh interval to poll for new data

    pmrMoreInfoFetch: {
      url: props.endPoint + '/meetings?meetingNumber=201105545',
      headers: {
        Authorization: 'Bearer ' + props.token
      }
    }
  };
})(pmrMoreInfo);