"use strict";

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

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

var _searchDropdown = _interopRequireDefault(require("../../../../../components/search-dropdown"));

var _periodSelector = _interopRequireDefault(require("../../../../../components/period-selector"));

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

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

var preCls = "homepage-datalist";

function HomeNavSelector(props) {
  var type = props.type,
      source = props.source,
      setType = props.setType,
      cycleTime = props.cycleTime,
      setCycleTime = props.setCycleTime,
      typeMap = props.typeMap;

  var onPeriodChange = function onPeriodChange(cycle) {
    var annualNum = cycle.annualNum,
        cycleType = cycle.cycleType,
        yqmNum = cycle.yqmNum;
    setCycleTime({
      name: _periodSelector["default"].formatPeriod(cycle),
      cycleType: cycleType,
      yearNum: annualNum,
      yqmNum: yqmNum
    });
  };

  return /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__main__navSelecter")
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__main__navSelecter--type")
  }, source === "align" && /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"], {
    value: type,
    onChange: setType
  }, /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "all"
  }, (0, _getLocale.getLocale)("Mod_all")), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "hadNotAlign"
  }, (0, _getLocale.getLocale)("OKR_Db_Unaligned")), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "hadAlign"
  }, (0, _getLocale.getLocale)("OKR_Db_Aligned"))), source === "update" && /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"], {
    value: type,
    onChange: setType
  }, /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "all"
  }, (0, _getLocale.getLocale)("Mod_all")), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "hadNotUpdate"
  }, (0, _getLocale.getLocale)("HP_Notupdated")), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "hadUpdate"
  }, (0, _getLocale.getLocale)("HP_Updated"))), source === "target" && /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"], {
    value: type,
    onChange: setType
  }, /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "all"
  }, (0, _getLocale.getLocale)("Mod_all")), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "normalOkr"
  }, (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Notrack")), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "riskOkr"
  }, (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Atrisk")), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "dalyOkr"
  }, (0, _getLocale.getLocale)("OKR_MyO_Pop_Upd_Postoned")), /*#__PURE__*/_react["default"].createElement(_searchDropdown["default"].Option, {
    value: "endOkr"
  }, (0, _getLocale.getLocale)("OKR_MyO_Butt_Hasended"))), /*#__PURE__*/_react["default"].createElement("span", {
    className: "tu-icon-arrow-down1"
  })), /*#__PURE__*/_react["default"].createElement(_periodSelector["default"], {
    selected: cycleTime ? {
      annualNum: cycleTime.yearNum,
      cycleType: cycleTime.cycleType,
      yqmNum: cycleTime.yqmNum
    } : {
      annualNum: "2021",
      cycleType: "-1",
      yqmNum: "0"
    },
    onChange: function onChange(cycle) {
      return onPeriodChange(cycle);
    },
    yearsRange: [2018, 2030]
  }, /*#__PURE__*/_react["default"].createElement("div", {
    className: "".concat(preCls, "__main__navSelecter--cycle")
  }, cycleTime.name, " ", /*#__PURE__*/_react["default"].createElement("span", {
    className: "tu-icon-arrow-down1"
  }))));
}

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