var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/plus/saasAttendance/settings/BasicInfoTab.tsx
var BasicInfoTab_exports = {};
__export(BasicInfoTab_exports, {
  default: () => BasicInfoTab_default
});
module.exports = __toCommonJS(BasicInfoTab_exports);
var import_react = __toESM(require("react"));
var import_antd = require("antd");
var import_ahooks = require("ahooks");
var import_materials = require("@pisell/materials");
var import_utils = require("@pisell/utils");
var import_useEngineContext = __toESM(require("../../../hooks/useEngineContext"));
var import_components = require("./components");
var import_serve = require("./serve");
var BasicInfoTab = (props) => {
  var _a;
  const engineContext = (0, import_useEngineContext.default)();
  const { translation } = ((_a = engineContext == null ? void 0 : engineContext.appHelper) == null ? void 0 : _a.utils) || {};
  const { data } = (0, import_ahooks.useRequest)(import_serve.getTimezoneList, {
    defaultParams: [
      {
        pageSize: 499
      }
    ]
  });
  const timeZoneOptions = (0, import_react.useMemo)(() => {
    var _a2;
    return ((_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.map((item) => ({
      label: translation(item.name),
      value: item.code
    }))) || [];
  }, [data]);
  return /* @__PURE__ */ import_react.default.createElement("div", { className: "saas-attendance-group-settings__panel", id: props.id }, /* @__PURE__ */ import_react.default.createElement(
    import_antd.Form.Item,
    {
      label: import_utils.locales.getText(
        "pisell2.attendance.group-settings.basic-info.label.name"
      ),
      name: "name",
      rules: [
        {
          required: true
        },
        {
          validator(_, value) {
            let hasVal = false;
            if (value && typeof value === "object") {
              Object.entries(value).forEach(([key, val]) => {
                if (val) {
                  hasVal = true;
                }
              });
            }
            if (!hasVal) {
              return Promise.reject(
                import_utils.locales.getText(
                  "pisell2.attendance.group-settings.basic-info.name-required"
                )
              );
            }
            return Promise.resolve();
          }
        }
      ],
      extra: import_utils.locales.getText(
        "pisell2.attendance.group-settings.basic-info.name-max-length"
      )(50)
    },
    /* @__PURE__ */ import_react.default.createElement(
      import_materials.BaseTranslation,
      {
        maxLength: 50,
        placeholder: import_utils.locales.getText(
          "pisell2.attendance.group-settings.basic-info.name-tip"
        )
      }
    )
  ), /* @__PURE__ */ import_react.default.createElement(
    import_antd.Form.Item,
    {
      label: import_utils.locales.getText(
        "pisell2.attendance.group-settings.basic-info.label.time-zone"
      ),
      name: "timezone",
      rules: [{ required: true }],
      required: true,
      extra: /* @__PURE__ */ import_react.default.createElement(
        "div",
        {
          style: {
            color: "#ea580c"
          }
        },
        /* @__PURE__ */ import_react.default.createElement(
          import_materials.Icon,
          {
            type: "pisell2-alert-triangle",
            size: 14,
            style: { marginRight: 4 }
          }
        ),
        import_utils.locales.getText(
          "pisell2.attendance.group-settings.basic-info.time-zone-tip"
        )
      )
    },
    /* @__PURE__ */ import_react.default.createElement(import_antd.Select, { disabled: true, options: timeZoneOptions })
  ), /* @__PURE__ */ import_react.default.createElement(
    import_antd.Form.Item,
    {
      label: import_utils.locales.getText(
        "pisell2.attendance.group-settings.basic-info.label.members"
      ),
      name: "member_ids",
      rules: [
        {
          required: true
        }
      ]
    },
    /* @__PURE__ */ import_react.default.createElement(import_components.MembersField, null)
  ));
};
var BasicInfoTab_default = BasicInfoTab;
