import useEngineContext from "../../hooks/useEngineContext.js";
import locales_default from "./locales.js";
import React from "react";
import { Form } from "antd";
import { locales } from "@pisell/utils";
import { FormItemInput } from "@pisell/materials";
import "./index.less";
//#region src/plus/contactInfoModal/ContactInfoContent.tsx
const ContactInfoContent = (props) => {
	var _context$appHelper$ut, _config$first_name, _config$first_name2, _config$last_name, _config$last_name2, _config$phone, _config$phone2, _config$email, _config$email2;
	const context = useEngineContext();
	locales.init(locales_default, ((_context$appHelper$ut = context.appHelper.utils) === null || _context$appHelper$ut === void 0 || (_context$appHelper$ut = _context$appHelper$ut.storage) === null || _context$appHelper$ut === void 0 ? void 0 : _context$appHelper$ut.get("umi_locale")) || "en");
	const { config, form } = props;
	console.log("config", config);
	return /* @__PURE__ */ React.createElement("div", { className: "pisell-contact-info-modal-content" }, /* @__PURE__ */ React.createElement(Form, {
		size: "large",
		layout: "vertical",
		form
	}, /* @__PURE__ */ React.createElement("div", { className: "pisell-contact-info-modal-content-name-wrap" }, (config === null || config === void 0 || (_config$first_name = config.first_name) === null || _config$first_name === void 0 ? void 0 : _config$first_name.visible) !== false ? /* @__PURE__ */ React.createElement(FormItemInput, {
		renderMode: "edit",
		label: locales.getText("pisell2.text.contact-info.modal.first-name"),
		placeholder: locales.getText("pisell2.text.contact-info.modal.first-name-placeholder"),
		name: "first_name",
		requiredobj: {
			required: (config === null || config === void 0 || (_config$first_name2 = config.first_name) === null || _config$first_name2 === void 0 ? void 0 : _config$first_name2.required) !== true ? false : true,
			message: locales.getText("pisell2.text.contact-info.modal.first-name-required")
		}
	}) : null, (config === null || config === void 0 || (_config$last_name = config.last_name) === null || _config$last_name === void 0 ? void 0 : _config$last_name.visible) !== false ? /* @__PURE__ */ React.createElement(FormItemInput, {
		renderMode: "edit",
		label: locales.getText("pisell2.text.contact-info.modal.last-name"),
		placeholder: locales.getText("pisell2.text.contact-info.modal.last-name-placeholder"),
		name: "last_name",
		requiredobj: {
			required: (config === null || config === void 0 || (_config$last_name2 = config.last_name) === null || _config$last_name2 === void 0 ? void 0 : _config$last_name2.required) !== true ? false : true,
			message: locales.getText("pisell2.text.contact-info.modal.last-name-required")
		}
	}) : null), (config === null || config === void 0 || (_config$phone = config.phone) === null || _config$phone === void 0 ? void 0 : _config$phone.visible) !== false ? /* @__PURE__ */ React.createElement(FormItemInput.Mobile, {
		renderMode: "edit",
		name: "phone",
		label: locales.getText("pisell2.text.contact-info.modal.mobile"),
		placeholder: locales.getText("pisell2.text.contact-info.modal.mobile-placeholder"),
		typeobj: {
			type: "phone",
			enabled: true,
			message: locales.getText("pisell2.text.contact-info.modal.mobile-error")
		},
		requiredobj: {
			required: (config === null || config === void 0 || (_config$phone2 = config.phone) === null || _config$phone2 === void 0 ? void 0 : _config$phone2.required) !== true ? false : true,
			message: locales.getText("pisell2.text.contact-info.modal.mobile-required")
		},
		returnFormat: "object"
	}) : null, (config === null || config === void 0 || (_config$email = config.email) === null || _config$email === void 0 ? void 0 : _config$email.visible) !== false ? /* @__PURE__ */ React.createElement(FormItemInput.Email, {
		renderMode: "edit",
		name: "email",
		label: locales.getText("pisell2.text.contact-info.modal.email"),
		placeholder: locales.getText("pisell2.text.contact-info.modal.email-placeholder"),
		typeobj: {
			type: "email",
			enabled: true
		},
		requiredobj: {
			required: (config === null || config === void 0 || (_config$email2 = config.email) === null || _config$email2 === void 0 ? void 0 : _config$email2.required) !== true ? false : true,
			message: locales.getText("pisell2.text.contact-info.modal.email-required")
		},
		onChange: () => {
			form.validateFields(["email"]);
		}
	}) : null));
};
//#endregion
export { ContactInfoContent as default };
