"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

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

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

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

var _progress = _interopRequireDefault(require("../progress"));

var _schedule = _interopRequireDefault(require("../schedule"));

var _tools = require("../../../../../utils/tools");

require("./index.css");

var _utils = require("./utils");

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

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

var preCls = "tita-summary-work-progress";

var MileStone = function MileStone(_ref) {
  var _data$LastRichContent;

  var data = _ref.data,
      workId = _ref.workId;
  var scheduleRef = (0, _react.useRef)({
    focus: function focus() {}
  });

  var handleShowWork = function handleShowWork() {
    window.open("#/work?&work_id=".concat(workId, "&detail_type=milepost"));
  };

  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__table-mile-title"),
    onClick: function onClick() {
      return handleShowWork(data);
    }
  }, /*#__PURE__*/_react["default"].createElement("i", {
    className: "".concat(preCls, "__table-row-title-icon tu-icon-licheng-s")
  }), /*#__PURE__*/_react["default"].createElement("span", {
    className: "".concat(preCls, "__table-mile-title-text")
  }, _openData["default"].parseString((0, _tools.htmlDecodeByRegExp)(data.MilestoneName))), data.IsDeadLine === true && /*#__PURE__*/_react["default"].createElement("span", {
    className: "".concat(preCls, "__table-row-title-remain")
  }, data.RemainingContent))), /*#__PURE__*/_react["default"].createElement("td", null, !!data.MilestoneId && /*#__PURE__*/_react["default"].createElement(_progress["default"], {
    id: "".concat(data.MilestoneId),
    type: "task",
    status: (0, _utils.getStatus)(data.RiskLevel || 1),
    value: Number(data.Progress),
    editable: false
  })), /*#__PURE__*/_react["default"].createElement("td", null, !!data.MilestoneId && /*#__PURE__*/_react["default"].createElement(_schedule["default"], {
    ref: scheduleRef,
    curContent: (data === null || data === void 0 ? void 0 : (_data$LastRichContent = data.LastRichContent) === null || _data$LastRichContent === void 0 ? void 0 : _data$LastRichContent.trim()) || (data === null || data === void 0 ? void 0 : data.LastContent) || "",
    value: data === null || data === void 0 ? void 0 : data.LastContents,
    id: data.MilestoneId
  }))));
};

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