const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../pisellSelectCustomerModal/RightPanel/Add/PhoneField/index.js");
const require_utils = require("./utils.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");
require("./index.less");
//#region src/components/booking/forms/sendModal/index.tsx
const SendModal = ({ open, refreshKey, onCancel, onOk, defaultValues = {}, onValuesChange }) => {
	const [form] = antd.Form.useForm();
	const sendSms = antd.Form.useWatch("sendSms", form);
	const sendEmail = antd.Form.useWatch("sendEmail", form);
	const handleOk = () => {
		form.validateFields().then((values) => {
			onOk(values);
		});
	};
	return /* @__PURE__ */ react.default.createElement(_pisell_materials.PisellModal, {
		open,
		title: _pisell_utils.locales.getText("pisell2.text.send-form-reminder"),
		onCancel,
		onOk: handleOk,
		okText: _pisell_utils.locales.getText("pisell2.text.send-form-ok")
	}, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode-send-form-wrap" }, /* @__PURE__ */ react.default.createElement(antd.Form, {
		form,
		key: refreshKey,
		onValuesChange,
		layout: "vertical",
		initialValues: defaultValues
	}, /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "sendSms",
		valuePropName: "checked",
		style: { marginBottom: 12 }
	}, /* @__PURE__ */ react.default.createElement(antd.Checkbox, null, _pisell_utils.locales.getText("pisell2.text.send-sms-reminder"))), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "phone",
		style: { marginLeft: 16 },
		rules: [{
			required: sendSms,
			message: _pisell_utils.locales.getText("pisell2.text.phone-required-error-message")
		}, { validator: (_, value) => {
			if (!value || !value.phone) return Promise.reject(_pisell_utils.locales.getText("pisell2.text.phone-required-error-message"));
			try {
				if (!require_utils.parseMaxStatus(value)) return Promise.reject(_pisell_utils.locales.getText("pisell2.text.phone-format-error-message"));
				return Promise.resolve();
			} catch (error) {
				return Promise.reject(_pisell_utils.locales.getText("pisell2.text.phone-format-error-message"));
			}
		} }]
	}, /* @__PURE__ */ react.default.createElement(require_index.default, null)), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "sendEmail",
		valuePropName: "checked",
		style: { marginBottom: 12 }
	}, /* @__PURE__ */ react.default.createElement(antd.Checkbox, null, _pisell_utils.locales.getText("pisell2.text.send-email-reminder"))), /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "email",
		style: { marginLeft: 16 },
		rules: [{
			required: sendEmail,
			message: _pisell_utils.locales.getText("pisell2.text.email-required-error-message")
		}, {
			pattern: /^([a-zA-Z0-9_\-\.+])+@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,63})+$/,
			message: _pisell_utils.locales.getText("pisell2.text.send-email-email-error-message")
		}]
	}, /* @__PURE__ */ react.default.createElement(antd.Input, { size: "large" })))));
};
//#endregion
exports.default = SendModal;
