'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _mxa = require('../../components/mxa');

var _imageLink = require('../constant/imageLink');

var _imageLink2 = _interopRequireDefault(_imageLink);

var _home = require('../styles/views/home.less');

var _home2 = _interopRequireDefault(_home);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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; } /**
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                * Created by vison on 16/11/30.
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                */


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

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

    var _this = _possibleConstructorReturn(this, (SysNotification.__proto__ || Object.getPrototypeOf(SysNotification)).call(this, props));

    _this.handleClickNotification = function () {
      console.log('click');
    };

    _this.renderListCell = function () {
      return _this.props.dataSource.map(function (item) {
        return _react2.default.createElement(
          _mxa.Row,
          { key: item.id, type: 'flex', align: 'middle', justify: 'start', onClick: _this.handleClickNotification, className: _home2.default.listItem },
          _react2.default.createElement(_mxa.Col, { className: item.isRead ? _home2.default.badgeNull : _home2.default.badge }),
          _react2.default.createElement(
            _mxa.Col,
            null,
            _react2.default.createElement(
              'p',
              { className: _home2.default.notificationTitle },
              item.NODate
            ),
            _react2.default.createElement(
              'p',
              { className: _home2.default.notificationContent },
              item.NOContent
            )
          )
        );
      });
    };

    _this.renderNotifiList = function () {
      var data = _this.props.dataSource;
      if (data && data.length > 0) {
        return _react2.default.createElement(
          'div',
          null,
          _this.renderListCell()
        );
      }
      return _react2.default.createElement(
        _mxa.Row,
        { type: 'flex', align: 'middle', justify: 'start' },
        _react2.default.createElement('img', { src: _imageLink2.default.home_notification_null, alt: '\u6682\u65E0\u6D88\u606F' })
      );
    };

    _this.state = {};
    return _this;
  }

  _createClass(SysNotification, [{
    key: 'render',
    value: function render() {
      return _react2.default.createElement(
        'div',
        { className: _home2.default.notification },
        _react2.default.createElement(
          _mxa.Row,
          { type: 'flex', align: 'middle', justify: 'start', className: _home2.default.commonTitle },
          _react2.default.createElement(_mxa.Col, { className: _home2.default.highLight }),
          _react2.default.createElement(
            'span',
            null,
            '\u901A\u77E5\u6D88\u606F'
          )
        ),
        this.renderNotifiList()
      );
    }
  }]);

  return SysNotification;
}(_react2.default.Component);

exports.default = SysNotification;
//# sourceMappingURL=SysNotification.js.map