const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_locales = require("../../../../utils/locales.js");
const require_useToast = require("../../../../hooks/useToast.js");
const require_index = require("../SendPaymentLinkModal/index.js");
const require_locales$1 = require("./locales.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 _ant_design_icons = require("@ant-design/icons");
require("./index.less");
//#region src/components/checkout/components/AdditionalModule/index.tsx
function AdditionalModule({ orderInfo, customAmount, handleButtonClick, hasOrderNote = false, disabled = false, showCashPayment = false, isFullWidth = false, showMore = true }) {
	_pisell_utils.locales.init(require_locales$1.default, require_locales.getLocale());
	const sendLinkModal = require_index.default({
		balanceAmount: (orderInfo === null || orderInfo === void 0 ? void 0 : orderInfo.totalAmount) ? `$${orderInfo.totalAmount}` : "$15.1",
		customerEmail: "customer@email.com"
	});
	const moreMenuItems = [{
		key: "send-link",
		label: _pisell_utils.locales.getText("pisell2.text.send-link"),
		icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.LinkOutlined, null)
	}, {
		key: "print-receipt",
		label: _pisell_utils.locales.getText("pisell2.text.print-receipt"),
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, { type: "pisell2-printer" })
	}];
	const Toast = require_useToast.default();
	return /* @__PURE__ */ react.default.createElement("div", { className: "additional-module" }, showCashPayment && /* @__PURE__ */ react.default.createElement("div", { className: "additional-module-title" }, _pisell_utils.locales.getText("pisell2.text.others")), /* @__PURE__ */ react.default.createElement("div", { className: "additional-module-buttons-container" }, showCashPayment && !isFullWidth ? /* @__PURE__ */ react.default.createElement(react.default.Fragment, null, /* @__PURE__ */ react.default.createElement("div", { className: "additional-module-button-row" }, /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: `additional-module-button-base purple-theme ${hasOrderNote ? "note-button" : ""}`,
		onClick: () => {
			handleButtonClick("order-note");
		},
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
			type: "pisell2-clipboard-minus",
			className: "additional-module-button-icon"
		}),
		size: "large"
	}, _pisell_utils.locales.getText("pisell2.text.order-note"), hasOrderNote && /* @__PURE__ */ react.default.createElement("span", { className: "note-indicator" }, /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, { type: "pisell2-info-circle2" }))), /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: "additional-module-button-base purple-theme",
		onClick: () => {
			handleButtonClick("split-payment");
		},
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
			type: "pisell2-coins-01",
			className: "additional-module-button-icon"
		}),
		size: "large"
	}, _pisell_utils.locales.getText("split.payment"))), /* @__PURE__ */ react.default.createElement("div", { className: "additional-module-button-row" }, /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: "additional-module-button-base purple-theme",
		onClick: () => {
			handleButtonClick("manual-discount");
		},
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
			type: "pisell2-sale-01",
			className: "additional-module-button-icon"
		}),
		size: "large"
	}, _pisell_utils.locales.getText("pisell2.text.additional-module.order-discount")), /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: `additional-module-button-base ${disabled ? "disabled-theme" : "orange-theme"}`,
		onClick: () => {
			handleButtonClick("save-pay-later");
		},
		disabled,
		size: "large",
		icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.ClockCircleOutlined, { className: "additional-module-button-icon" })
	}, _pisell_utils.locales.getText("pisell2.text.save-pay-later")), showMore && /* @__PURE__ */ react.default.createElement(antd.Dropdown, {
		menu: {
			items: moreMenuItems,
			onClick: ({ key }) => {
				console.log("Menu item clicked:", key);
				if (key === "send-link") if (!disabled) handleButtonClick("send-link");
				else Toast.fail(_pisell_utils.locales.getText("pisell2.text.order-no-payment-cannot-send-link"));
				else if (key === "print-receipt") handleButtonClick("print-receipt");
				else if (key === "split-payment") handleButtonClick("split-payment");
				else if (key === "print-receipt") handleButtonClick("print-receipt");
			}
		},
		trigger: ["click"],
		placement: "bottomLeft",
		overlayStyle: { zIndex: 9999 },
		mouseEnterDelay: .1,
		mouseLeaveDelay: .1,
		onOpenChange: (open) => {
			console.log("Dropdown state changed:", open);
		}
	}, /* @__PURE__ */ react.default.createElement(antd.Button, {
		size: "large",
		className: "additional-module-button-base more-button",
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
			type: "pisell2-dots-vertical",
			size: 20
		})
	}))), !showMore && /* @__PURE__ */ react.default.createElement("div", { className: "additional-module-button-row" }, /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: "additional-module-button-base purple-theme",
		onClick: () => {
			handleButtonClick("send-link");
		},
		disabled,
		size: "large",
		icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.LinkOutlined, null)
	}, _pisell_utils.locales.getText("pisell2.text.send-link")), /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: "additional-module-button-base purple-theme",
		onClick: () => {
			handleButtonClick("print-receipt");
		},
		disabled,
		size: "large",
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, { type: "pisell2-printer" })
	}, _pisell_utils.locales.getText("pisell2.text.print-receipt")))) : /* @__PURE__ */ react.default.createElement("div", { className: "additional-module-button-row" }, /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: `additional-module-button-base purple-theme ${hasOrderNote ? "note-button" : ""}`,
		onClick: () => {
			handleButtonClick("order-note");
		},
		size: "large",
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
			type: "pisell2-clipboard-minus",
			className: "additional-module-button-icon"
		})
	}, _pisell_utils.locales.getText("pisell2.text.order-note"), hasOrderNote && /* @__PURE__ */ react.default.createElement("span", { className: "note-indicator" }, /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, { type: "pisell2-info-circle2" }))), /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: "additional-module-button-base purple-theme",
		onClick: () => {
			handleButtonClick("split-payment");
		},
		size: "large",
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
			type: "pisell2-coins-01",
			className: "additional-module-button-icon"
		})
	}, _pisell_utils.locales.getText("split.payment")), /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: "additional-module-button-base purple-theme",
		onClick: () => {
			handleButtonClick("manual-discount");
		},
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
			type: "pisell2-sale-01",
			className: "additional-module-button-icon"
		}),
		size: "large"
	}, _pisell_utils.locales.getText("pisell2.text.additional-module.order-discount")), /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: `additional-module-button-base ${disabled ? "disabled-theme" : "orange-theme"}`,
		onClick: () => {
			handleButtonClick("save-pay-later");
		},
		disabled,
		size: "large",
		icon: /* @__PURE__ */ react.default.createElement(_ant_design_icons.ClockCircleOutlined, { className: "additional-module-button-icon" })
	}, _pisell_utils.locales.getText("pisell2.text.save-pay-later")), /* @__PURE__ */ react.default.createElement(antd.Dropdown, {
		menu: {
			items: moreMenuItems,
			onClick: ({ key }) => {
				console.log("Menu item clicked:", key);
				if (key === "send-link") if (!disabled) handleButtonClick("send-link");
				else Toast.fail(_pisell_utils.locales.getText("pisell2.text.order-no-payment-cannot-send-link"));
				else if (key === "split-payment") handleButtonClick("split-payment");
				else if (key === "print-receipt") handleButtonClick("print-receipt");
			}
		},
		trigger: ["click"],
		placement: "bottomLeft",
		overlayStyle: { zIndex: 9999 },
		mouseEnterDelay: .1,
		mouseLeaveDelay: .1,
		onOpenChange: (open) => {
			console.log("Dropdown state changed:", open);
		}
	}, /* @__PURE__ */ react.default.createElement(antd.Button, {
		className: "additional-module-button-base more-button",
		size: "large",
		icon: /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, {
			type: "pisell2-dots-vertical",
			size: 20
		})
	})))), sendLinkModal.content);
}
//#endregion
exports.default = AdditionalModule;
