const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
const require_index = require("./bookingDashboard/index.js");
const require_index$1 = require("./bookingList/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
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/ticketBooking/components/bookingDataPanel/index.tsx
const BookingDataPanel = (0, react.forwardRef)((props, ref) => {
	const { currentDate, onBookingClick, bookingId } = props;
	const Toast = (0, _pisell_materials.useToast)();
	const bookingListRef = (0, react.useRef)(null);
	const bookingDashboardRef = (0, react.useRef)(null);
	const bookingTimeStartBetween = (0, react.useMemo)(() => {
		return [`${currentDate} 00:00:00`, `${currentDate} 23:59:59`];
	}, [currentDate]);
	const items = (0, react.useMemo)(() => {
		return [{
			label: _pisell_utils.locales.getText("pisell2.ticket-booking.dashboard"),
			key: "data-board",
			children: /* @__PURE__ */ react.default.createElement(require_index.default, {
				bookingTimeStartBetween,
				ref: bookingDashboardRef
			})
		}, {
			label: _pisell_utils.locales.getText("pisell2.ticket-booking.booking-list"),
			key: "booking-list",
			children: /* @__PURE__ */ react.default.createElement(require_index$1.default, {
				bookingTimeStartBetween,
				onBookingClick,
				bookingId,
				ref: bookingListRef
			})
		}];
	}, [currentDate, bookingId]);
	(0, react.useImperativeHandle)(ref, () => ({ refresh: () => {
		var _bookingListRef$curre, _bookingDashboardRef$;
		(_bookingListRef$curre = bookingListRef.current) === null || _bookingListRef$curre === void 0 || _bookingListRef$curre.refresh();
		(_bookingDashboardRef$ = bookingDashboardRef.current) === null || _bookingDashboardRef$ === void 0 || _bookingDashboardRef$.refresh();
	} }));
	return /* @__PURE__ */ react.default.createElement("div", { className: "pisell-ticket-booking-data-panel" }, /* @__PURE__ */ react.default.createElement("div", {
		className: "pisell-ticket-booking-data-panel-mask",
		style: { display: bookingId ? "block" : "none" },
		onClick: () => {
			onBookingClick({});
		}
	}), /* @__PURE__ */ react.default.createElement(_pisell_materials.Tabs, {
		type: "line",
		items,
		tabBarExtraContent: /* @__PURE__ */ react.default.createElement("div", {
			className: "pisell-ticket-booking-data-panel-tab-extra",
			onClick: () => {
				var _bookingListRef$curre2, _bookingDashboardRef$2, _Toast$success;
				(_bookingListRef$curre2 = bookingListRef.current) === null || _bookingListRef$curre2 === void 0 || _bookingListRef$curre2.refresh();
				(_bookingDashboardRef$2 = bookingDashboardRef.current) === null || _bookingDashboardRef$2 === void 0 || _bookingDashboardRef$2.refresh();
				Toast === null || Toast === void 0 || (_Toast$success = Toast.success) === null || _Toast$success === void 0 || _Toast$success.call(Toast, _pisell_utils.locales.getText("pisell2.ticket-booking.refresh-success"));
			}
		}, /* @__PURE__ */ react.default.createElement(_ant_design_icons.SyncOutlined, null)),
		tabBarStyle: {
			margin: "0 0 0 16px",
			height: "40px"
		}
	}));
});
//#endregion
exports.default = BookingDataPanel;
