"use strict";

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

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

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

var _tableRowOProject = _interopRequireDefault(require("../table-row-o-project"));

var _constant = require("./constant");

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

var _getLocale = require("../../../../../utils/getLocale");

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

require("./index.css");

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

var prefix = "titaui-dynamic-task-progress";

var RenderRow = function RenderRow(_ref) {
  var item = _ref.item;

  var handleShowTaskDetail = function handleShowTaskDetail(item) {
    // @ts-ignore
    if (item.Id == -1) return;
    window.Talent.app.vent.trigger("global-pull-screen", item.TaskId, "task");
  };

  var render = function render() {
    if (item.IsImport) {
      var _item$LastRichContent;

      return /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement("div", {
        className: "".concat(prefix, "__table-row-title"),
        onClick: function onClick() {
          return handleShowTaskDetail(item);
        }
      }, /*#__PURE__*/_react["default"].createElement("i", {
        className: "".concat(prefix, "__table-row-title-icon ").concat(_constant.EStatusStatus2ClassType[item.IconStatus])
      }), /*#__PURE__*/_react["default"].createElement("span", {
        className: "".concat(prefix, "__table-row-title-text")
      }, (0, _openData.parseString)(item.Name)), item.RemainDay > 0 && /*#__PURE__*/_react["default"].createElement("span", {
        className: "".concat(prefix, "__table-row-title-remain")
      }, (0, _getLocale.getLocale)("Rep_NewS_PrgreDelay").replace("XX", item.RemainDay)), item.WorkTimes > 0 && /*#__PURE__*/_react["default"].createElement("span", {
        className: "".concat(prefix, "__table-row-title-worktime")
      }, item.WorkTimes, "h"))), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement(_progress["default"], {
        id: "".concat(item.Id),
        type: "task",
        status: item.Status === 1 || item.Status === 2 && item.RiskLevel === 4 ? "normal" : "risk",
        value: item.Progress,
        editable: false
      })), /*#__PURE__*/_react["default"].createElement("td", null, /*#__PURE__*/_react["default"].createElement(_schedule["default"], {
        oldValue: (item === null || item === void 0 ? void 0 : (_item$LastRichContent = item.LastRichContent) === null || _item$LastRichContent === void 0 ? void 0 : _item$LastRichContent.trim()) || (item === null || item === void 0 ? void 0 : item.LastContent) || "" // oldValue={item?.LastRichContent?.trim() ||  ""}
        ,
        value: item.LastContents,
        editable: false,
        id: item.Id
      })));
    } else {
      return /*#__PURE__*/_react["default"].createElement("tr", null, /*#__PURE__*/_react["default"].createElement("td", {
        colSpan: 3
      }, /*#__PURE__*/_react["default"].createElement(_tableRowOProject["default"], {
        data: item // 6: okr 4: 项目
        ,
        extraClass: "".concat(prefix, "__table-obj")
      })));
    }
  };

  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, render());
};

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