"use strict";

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

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

var _switch = _interopRequireDefault(require("../../../components/switch"));

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

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

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

var _precls = require("../precls");

require("./index.css");

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

function DepartTitle(props) {
  var _props$onlyThisDept = props.onlyThisDept,
      onlyThisDept = _props$onlyThisDept === void 0 ? false : _props$onlyThisDept,
      onChange = props.onChange,
      departmentName = props.departmentName,
      departmentId = props.departmentId;

  var handleOnChange = function handleOnChange(val) {
    onChange && onChange(val);
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(_precls.precls, "__header-depart-title")
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(_precls.precls, "__header-depart-title-icon")
  }, departmentId == 0 && /*#__PURE__*/_react["default"].createElement("span", {
    className: "tu-icon-OKR-gongsi-m"
  }), departmentId != 0 && /*#__PURE__*/_react["default"].createElement("span", {
    className: "".concat(_precls.precls, "__header-depart-title--overflow")
  }, /*#__PURE__*/_react["default"].createElement(_openData.OpenDepartmentName, {
    name: departmentName,
    id: departmentId
  }))), /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(_precls.precls, "__header-depart-title-name")
  }, /*#__PURE__*/_react["default"].createElement(_tooltip["default"].Text, {
    maxWidth: 160,
    text: /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, departmentId == 0 && (0, _getLocale.getLocale)("OKR_CompanyAll_Allobje"), departmentId != 0 && /*#__PURE__*/_react["default"].createElement(_openData.OpenDepartmentName, {
      name: departmentName,
      id: departmentId
    }))
  })), departmentId != 0 && /*#__PURE__*/_react["default"].createElement(_switch["default"], {
    label: /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
      overlay: (0, _getLocale.getLocale)("OKR_ComAll_Wswitchon"),
      placement: "top"
    }, /*#__PURE__*/_react["default"].createElement("span", {
      className: "".concat(_precls.precls, "__header-depart-title__onlythisdept")
    }, "\u53EA\u770B\u672C\u90E8\u95E8"))),
    checked: onlyThisDept,
    onChange: handleOnChange
  }));
}

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