"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _react = _interopRequireDefault(require("react"));

var _okrProgressDetail = _interopRequireDefault(require("../../../okr-progress-detail"));

var _title = _interopRequireDefault(require("../title"));

var _scheduleO = _interopRequireDefault(require("../../img/schedule-o.svg"));

var _drawerManager = _interopRequireDefault(require("../../../drawer-manager"));

var _openData = require("../../../../utils/open-data");

require("./index.css");

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

// @ts-ignore
var renderTitle = function renderTitle(title, workId) {
  return /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement("img", {
    className: "sub-o-progress__o-icon",
    src: _scheduleO["default"]
  }), /*#__PURE__*/_react["default"].createElement("span", {
    className: "sub-o-progress__title-text",
    onClick: function onClick() {
      _drawerManager["default"].open("okrDetail", {
        okrId: workId
      });
    }
  }, (0, _openData.parseString)(title)));
};

var SubOProgress = function SubOProgress(_ref) {
  var data = _ref.data;
  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "sub-o-progress__container"
  }, /*#__PURE__*/_react["default"].createElement(_title["default"], {
    title: "\u5B50\u76EE\u6807\u7684\u8FDB\u5C55"
  }), /*#__PURE__*/_react["default"].createElement("div", {
    className: "sub-o-progress__content-wrapper"
  }, data && data.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement(_okrProgressDetail["default"], {
      key: index,
      riskLevel: item.riskLevel,
      title: renderTitle(item.title, item.id),
      percent: item.percent,
      oldPercent: item.oldPercent,
      content: item.content,
      time: item.time,
      canEdit: false,
      id: item.id,
      rightTip: item.rightTip
    });
  })));
};

var _default = SubOProgress;
exports["default"] = _default;