const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
const require_useEngineContext = require("../../../hooks/useEngineContext.js");
const require_index = require("./components/membersField/index.js");
const require_serve = require("./serve.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _pisell_utils = require("@pisell/utils");
let _pisell_materials = require("@pisell/materials");
let ahooks = require("ahooks");
//#region src/plus/saasAttendance/settings/BasicInfoTab.tsx
const BasicInfoTab = (props) => {
	var _engineContext$appHel;
	const engineContext = require_useEngineContext.default();
	const { translation } = (engineContext === null || engineContext === void 0 || (_engineContext$appHel = engineContext.appHelper) === null || _engineContext$appHel === void 0 ? void 0 : _engineContext$appHel.utils) || {};
	const { data } = (0, ahooks.useRequest)(require_serve.getTimezoneList, { defaultParams: [{ pageSize: 499 }] });
	const timeZoneOptions = (0, react.useMemo)(() => {
		var _data$data;
		return (data === null || data === void 0 || (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.map((item) => ({
			label: translation(item.name),
			value: item.code
		}))) || [];
	}, [data]);
	return /* @__PURE__ */ react.default.createElement("div", {
		className: "saas-attendance-group-settings__panel",
		id: props.id
	}, /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		label: _pisell_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(_pisell_utils.locales.getText("pisell2.attendance.group-settings.basic-info.name-required"));
			return Promise.resolve();
		} }],
		extra: _pisell_utils.locales.getText("pisell2.attendance.group-settings.basic-info.name-max-length")(50)
	}, /* @__PURE__ */ react.default.createElement(_pisell_materials.BaseTranslation, {
		maxLength: 50,
		placeholder: _pisell_utils.locales.getText("pisell2.attendance.group-settings.basic-info.name-tip")
	})), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		label: _pisell_utils.locales.getText("pisell2.attendance.group-settings.basic-info.label.time-zone"),
		name: "timezone",
		rules: [{ required: true }],
		required: true,
		extra: /* @__PURE__ */ react.default.createElement("div", { style: { color: "#ea580c" } }, /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
			type: "pisell2-alert-triangle",
			size: 14,
			style: { marginRight: 4 }
		}), _pisell_utils.locales.getText("pisell2.attendance.group-settings.basic-info.time-zone-tip"))
	}, /* @__PURE__ */ react.default.createElement(antd.Select, {
		disabled: true,
		options: timeZoneOptions
	})), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		label: _pisell_utils.locales.getText("pisell2.attendance.group-settings.basic-info.label.members"),
		name: "member_ids",
		rules: [{ required: true }]
	}, /* @__PURE__ */ react.default.createElement(require_index.default, null)));
};
//#endregion
exports.default = BasicInfoTab;
