const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_index = require("../../../../plus/noteModal/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _pisell_utils = require("@pisell/utils");
let _pisell_icon_es_Edit05 = require("@pisell/icon/es/Edit05");
_pisell_icon_es_Edit05 = require_runtime.__toESM(_pisell_icon_es_Edit05);
require("./index.less");
//#region src/components/booking/notes/addNote/index.tsx
const AddNote = ({ value, onChange, title, placeholder }) => {
	const [modalOpen, setModalOpen] = (0, react.useState)(false);
	const handleOpenModal = () => {
		setModalOpen(true);
	};
	const handleConfirm = (newValue) => {
		onChange === null || onChange === void 0 || onChange(newValue);
		setModalOpen(false);
	};
	const handleDelete = () => {
		onChange === null || onChange === void 0 || onChange("");
		setModalOpen(false);
	};
	const handleCancel = () => {
		setModalOpen(false);
	};
	return /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode__booking-notes" }, /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode__booking-notes-label" }, title), /* @__PURE__ */ react.default.createElement("div", {
		className: "pisell-lowcode__booking-notes-input-area",
		style: { marginTop: title ? 8 : 0 },
		onClick: handleOpenModal
	}, value ? /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode__booking-notes-content" }, value) : /* @__PURE__ */ react.default.createElement("div", { className: "pisell-lowcode__booking-notes-placeholder" }, placeholder || _pisell_utils.locales.getText("pisell2.text.add-order-notes")), /* @__PURE__ */ react.default.createElement(antd.Button, {
		type: "text",
		icon: /* @__PURE__ */ react.default.createElement(_pisell_icon_es_Edit05.default, null),
		size: "small",
		className: "pisell-lowcode__booking-notes-edit-btn",
		onClick: (e) => {
			e.stopPropagation();
			handleOpenModal();
		}
	}))), /* @__PURE__ */ react.default.createElement(require_index.default, {
		open: modalOpen,
		title: title || _pisell_utils.locales.getText("pisell2.text.add-order-notes"),
		value,
		onConfirm: handleConfirm,
		onDelete: handleDelete,
		onCancel: handleCancel
	}));
};
//#endregion
exports.default = AddNote;
