"use strict";

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

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

var _classnames = _interopRequireDefault(require("classnames"));

var _tooltip = _interopRequireDefault(require("../../../../tooltip"));

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 }; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

var prefix = 'titaui-dynamic-summary-table-row-o-project';

var TableRowOProject = function TableRowOProject(_ref) {
  var _classNames2;

  var data = _ref.data,
      _ref$extraClass = _ref.extraClass,
      extraClass = _ref$extraClass === void 0 ? '' : _ref$extraClass;

  var handleTitleClick = function handleTitleClick() {
    if (data.ParentObjType === 62) {
      _drawerManager["default"].open('okrDetail', {
        okrId: data.Id
      });
    } else if (data.ParentObjType === 4) {
      window.open(window.location.href.replace(window.location.hash, "#work?iTalentNavCode=tita-work&work_id=".concat(data.Id)));
    }
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: (0, _classnames["default"])("".concat(prefix, " ").concat(extraClass), _defineProperty({}, "".concat(prefix, "--disable"), data.Id === -1)),
    onClick: handleTitleClick
  }, /*#__PURE__*/_react["default"].createElement("i", {
    className: (0, _classnames["default"])("".concat(prefix, "__icon"), (_classNames2 = {}, _defineProperty(_classNames2, "tu-icon-H5-O-s", data.ParentObjType === 62 || data.ObjectType === 62 && data.Id !== 0), _defineProperty(_classNames2, "tu-icon-project-s", data.ParentObjType === 4 || data.ObjectType === 4), _defineProperty(_classNames2, "tu-icon-fenlei", data.ObjectType === 62 && data.Id === 0), _classNames2))
  }), /*#__PURE__*/_react["default"].createElement("span", {
    className: "".concat(prefix, "__text")
  }, /*#__PURE__*/_react["default"].createElement(_tooltip["default"].Text, {
    isPercent: true,
    text: (0, _openData.parseString)(data.Name)
  })));
};

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