import { t as DemoModeBanner_default } from "./DemoModeBanner-BXA28cY_.js";
import { Head, Link, router, usePage } from "@inertiajs/vue3";
import { computed, createTextVNode, createVNode, defineComponent, onMounted, ref, resolveDynamicComponent, unref, useSSRContext, watch, withCtx } from "vue";
import { ssrIncludeBooleanAttr, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderClass, ssrRenderComponent, ssrRenderList, ssrRenderStyle, ssrRenderVNode } from "vue/server-renderer";
import { AlertTriangle, CheckCircle2, Coffee, FileText, Flame, Grid, Maximize, Minimize, Minus, Moon, Plus, Printer, Search, ShoppingCart, Snowflake, Split, Sun, Trash2, X } from "lucide-vue-next";
//#region resources/js/Pages/CafePOS/POS.vue?vue&type=script&setup=true&lang.ts
var POS_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
	__name: "POS",
	__ssrInlineRender: true,
	props: {
		products: {},
		outlets: {},
		selectedOutletId: {},
		ingredientStock: {},
		productStock: {},
		taxPercentage: {},
		servicePercentage: {},
		tables: {},
		customers: {},
		modifiers: {},
		promos: {}
	},
	setup(__props) {
		const props = __props;
		const outletId = ref(props.selectedOutletId || (props.outlets[0] ? props.outlets[0].id : null));
		watch(outletId, (newVal) => {
			if (newVal) router.get(route("pos.index"), { outlet_id: newVal }, {
				preserveState: true,
				replace: true
			});
		});
		const search = ref("");
		const activeCategory = ref("All");
		const categories = [
			"All",
			"Coffee",
			"Non-Coffee",
			"Food",
			"Bakery",
			"Retail",
			"Other"
		];
		const cart = ref([]);
		const orderType = ref("take_away");
		const selectedTableId = ref(null);
		const selectedCustomerId = ref(1);
		const selectedPromoId = ref(null);
		const pointsToRedeem = ref(0);
		const filteredProducts = computed(() => {
			return props.products.filter((p) => {
				const matchesSearch = p.name.toLowerCase().includes(search.value.toLowerCase());
				const matchesCategory = activeCategory.value === "All" || p.category === activeCategory.value;
				return matchesSearch && matchesCategory;
			});
		});
		const getAvailableQty = (product, variant) => {
			if (!outletId.value) return 0;
			if (product.has_recipe) {
				let minAvailable = 999999;
				const applicableRecipes = product.recipes.filter((r) => r.variant === null || r.variant === variant);
				if (applicableRecipes.length === 0) return 0;
				for (const recipe of applicableRecipes) {
					const baseStock = props.ingredientStock[recipe.ingredient_id] || 0;
					let consumedInCart = 0;
					for (const item of cart.value) {
						const matchingRecipe = item.product.recipes.filter((r) => r.variant === null || r.variant === item.variant).find((r) => r.ingredient_id === recipe.ingredient_id);
						if (matchingRecipe) consumedInCart += item.qty * matchingRecipe.usage_qty;
						for (const modId of item.selectedModifiers) {
							const mod = props.modifiers.find((m) => m.id === modId);
							if (mod && mod.ingredient_id === recipe.ingredient_id && mod.usage_qty) consumedInCart += item.qty * mod.usage_qty;
						}
					}
					const remainder = baseStock - consumedInCart;
					const availableForThisIngredient = Math.floor(remainder / recipe.usage_qty);
					if (availableForThisIngredient < minAvailable) minAvailable = availableForThisIngredient;
				}
				return Math.max(0, minAvailable);
			} else {
				const baseStock = props.productStock[product.id] || 0;
				let consumedInCart = 0;
				for (const item of cart.value) if (item.product.id === product.id) consumedInCart += item.qty;
				return Math.max(0, baseStock - consumedInCart);
			}
		};
		const subtotal = computed(() => {
			return cart.value.reduce((sum, item) => {
				const modifiersPrice = item.selectedModifiers.reduce((modSum, modId) => {
					const mod = props.modifiers.find((m) => m.id === modId);
					return modSum + (mod ? mod.price : 0);
				}, 0);
				return sum + (item.product.price + modifiersPrice) * item.qty;
			}, 0);
		});
		const discountAmount = computed(() => {
			let disc = 0;
			if (selectedPromoId.value) {
				const promo = props.promos.find((p) => p.id === selectedPromoId.value);
				if (promo && subtotal.value >= promo.min_purchase) {
					if (promo.type === "percent") disc = subtotal.value * promo.value / 100;
					else if (promo.type === "nominal") disc = promo.value;
				}
			}
			disc += pointsToRedeem.value * 1e3;
			return disc;
		});
		const serviceCharge = computed(() => {
			return subtotal.value * props.servicePercentage / 100;
		});
		const tax = computed(() => {
			return (subtotal.value + serviceCharge.value) * props.taxPercentage / 100;
		});
		const grandTotal = computed(() => {
			return Math.max(0, subtotal.value + serviceCharge.value + tax.value - discountAmount.value);
		});
		const paymentMethod = ref("cash");
		const cashReceived = ref(0);
		const changeDue = computed(() => {
			return Math.max(0, cashReceived.value - grandTotal.value);
		});
		const isReceiptModalOpen = ref(false);
		const receiptData = ref(null);
		const isSplitModalOpen = ref(false);
		const splitItems = ref([]);
		const isCheckingOut = ref(false);
		const getProductInitials = (name) => {
			return name.slice(0, 2).toUpperCase();
		};
		const isDark = ref(false);
		const isFullscreen = ref(false);
		onMounted(() => {
			isDark.value = document.documentElement.classList.contains("dark");
			document.addEventListener("fullscreenchange", () => {
				isFullscreen.value = !!document.fullscreenElement;
			});
		});
		const selectedCustomerPoints = computed(() => {
			const cust = props.customers.find((c) => c.id === selectedCustomerId.value);
			return cust ? cust.loyalty_points : 0;
		});
		const activeAlert = ref(null);
		let alertTimeoutId = null;
		const triggerAlert = (type, message) => {
			if (alertTimeoutId) clearTimeout(alertTimeoutId);
			activeAlert.value = {
				type,
				message
			};
			alertTimeoutId = setTimeout(() => {
				activeAlert.value = null;
			}, 4e3);
		};
		const page = usePage();
		watch(() => page.props.flash, (flash) => {
			if (flash?.success) triggerAlert("success", String(flash.success));
			else if (flash?.error) triggerAlert("error", String(flash.error));
		}, {
			deep: true,
			immediate: true
		});
		return (_ctx, _push, _parent, _attrs) => {
			_push(`<!--[-->`);
			_push(ssrRenderComponent(unref(Head), { title: "POS Cashier Terminal" }, null, _parent));
			_push(`<div class="min-h-screen lg:h-screen bg-slate-50 dark:bg-slate-900 text-slate-900 dark:text-slate-100 flex flex-col overflow-y-auto lg:overflow-hidden select-none">`);
			if (activeAlert.value) {
				_push(`<div class="${ssrRenderClass([activeAlert.value.type === "success" ? "border-emerald-500/30" : "border-rose-500/30", "fixed top-6 right-6 z-[100] w-full max-w-sm overflow-hidden rounded-xl border bg-white/95 dark:bg-slate-955/95 backdrop-blur-md shadow-lg transition-all duration-300 pointer-events-auto select-none font-sans"])}"><div class="p-4 flex items-start gap-3 relative"><div class="${ssrRenderClass([activeAlert.value.type === "success" ? "bg-emerald-500" : "bg-rose-500", "absolute left-0 top-0 bottom-0 w-1"])}"></div><div class="flex-shrink-0 mt-0.5">`);
				ssrRenderVNode(_push, createVNode(resolveDynamicComponent(activeAlert.value.type === "success" ? unref(CheckCircle2) : unref(AlertTriangle)), { class: ["h-5 w-5", activeAlert.value.type === "success" ? "text-emerald-500" : "text-rose-500"] }, null), _parent);
				_push(`</div><div class="flex-1 min-w-0 pr-2"><p class="${ssrRenderClass([activeAlert.value.type === "success" ? "text-emerald-600 dark:text-emerald-400" : "text-rose-600 dark:text-rose-400", "text-[10px] font-extrabold uppercase tracking-widest leading-none mb-1.5"])}">${ssrInterpolate(activeAlert.value.type === "success" ? "Berhasil" : "Peringatan")}</p><p class="text-xs text-slate-700 dark:text-slate-300 font-bold leading-normal">${ssrInterpolate(activeAlert.value.message)}</p></div><button class="flex-shrink-0 p-1 hover:bg-slate-100 dark:hover:bg-slate-900 rounded-lg text-slate-400 dark:text-slate-500 hover:text-slate-700 dark:hover:text-slate-300 transition-colors cursor-pointer">`);
				_push(ssrRenderComponent(unref(X), { class: "h-4 w-4" }, null, _parent));
				_push(`</button></div></div>`);
			} else _push(`<!---->`);
			_push(ssrRenderComponent(DemoModeBanner_default, null, null, _parent));
			if (!isFullscreen.value) {
				_push(`<header class="h-16 border-b border-slate-205 dark:border-slate-800 bg-white dark:bg-slate-950 px-6 flex items-center justify-between flex-shrink-0 shadow-sm z-10 select-none"><div class="flex items-center gap-3">`);
				if (_ctx.$page.props.settings.site_logo) _push(`<div class="h-9 w-9 rounded-lg overflow-hidden border border-slate-100 dark:border-slate-800 flex items-center justify-center bg-slate-50"><img${ssrRenderAttr("src", _ctx.$page.props.settings.site_logo)} alt="Logo" class="max-h-7 object-contain"></div>`);
				else _push(`<div class="h-9 w-9 rounded-lg bg-[#8c5a3c] flex items-center justify-center flex-shrink-0 text-white font-bold text-lg"><span>${ssrInterpolate(_ctx.$page.props.settings.site_name?.charAt(0) ?? "C")}</span></div>`);
				_push(`<div class="flex flex-col"><span class="font-extrabold text-sm tracking-wider uppercase leading-none">${ssrInterpolate(_ctx.$page.props.settings.site_name)}</span><span class="text-[9px] text-slate-400 dark:text-slate-500 mt-1 leading-none">Terminal Kasir</span></div></div><div class="flex items-center gap-2"><span class="text-[10px] text-slate-450 dark:text-slate-500 font-bold uppercase tracking-wider">Outlet:</span>`);
				if (!_ctx.$page.props.auth.user.outlet_id) {
					_push(`<select class="px-2.5 py-1.5 border border-slate-200 dark:border-slate-800 rounded-lg bg-transparent text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-[#8c5a3c]/20 text-slate-900 dark:text-slate-100 cursor-pointer"><!--[-->`);
					ssrRenderList(__props.outlets, (ot) => {
						_push(`<option${ssrRenderAttr("value", ot.id)}${ssrIncludeBooleanAttr(Array.isArray(outletId.value) ? ssrLooseContain(outletId.value, ot.id) : ssrLooseEqual(outletId.value, ot.id)) ? " selected" : ""}>${ssrInterpolate(ot.name)}</option>`);
					});
					_push(`<!--]--></select>`);
				} else _push(`<span class="text-xs font-bold px-3 py-1.5 bg-slate-100 dark:bg-slate-800 rounded-lg border border-slate-200 dark:border-slate-800 text-slate-700 dark:text-slate-300">${ssrInterpolate(__props.outlets.find((o) => o.id === outletId.value)?.name)}</span>`);
				_push(`</div><div class="flex items-center gap-4"><div class="flex items-center gap-2.5"><div class="h-8 w-8 rounded-full bg-[#8c5a3c]/10 text-[#8c5a3c] flex items-center justify-center font-bold text-xs">${ssrInterpolate(getProductInitials(_ctx.$page.props.auth.user.name))}</div><div class="flex flex-col hidden sm:flex text-left leading-none"><span class="text-xs font-semibold leading-none">${ssrInterpolate(_ctx.$page.props.auth.user.name)}</span><span class="text-[9px] text-slate-400 dark:text-slate-550 mt-1 leading-none">${ssrInterpolate(_ctx.$page.props.auth.user.roles[0] || "Staff")}</span></div></div><div class="h-5 w-[1px] bg-slate-200 dark:bg-slate-800 hidden sm:block"></div><div class="flex items-center gap-2">`);
				if (_ctx.$page.props.auth.user.roles.includes("Super Admin") || _ctx.$page.props.auth.user.roles.includes("Owner") || _ctx.$page.props.auth.user.roles.includes("Admin")) _push(ssrRenderComponent(unref(Link), {
					href: _ctx.route("dashboard"),
					class: "px-3 py-1.5 border border-slate-200 dark:border-slate-800 rounded-lg text-xs font-semibold hover:bg-slate-50 dark:hover:bg-slate-900 transition-colors cursor-pointer text-slate-700 dark:text-slate-300"
				}, {
					default: withCtx((_, _push, _parent, _scopeId) => {
						if (_push) _push(` Dashboard Admin `);
						else return [createTextVNode(" Dashboard Admin ")];
					}),
					_: 1
				}, _parent));
				else _push(`<!---->`);
				_push(`<button class="h-8 w-8 rounded-lg hover:bg-slate-100 dark:hover:bg-slate-900 flex items-center justify-center text-slate-555 dark:text-slate-400 cursor-pointer transition-colors" aria-label="Toggle Theme">`);
				if (isDark.value) _push(ssrRenderComponent(unref(Sun), { class: "h-4.5 w-4.5 text-amber-500" }, null, _parent));
				else _push(ssrRenderComponent(unref(Moon), { class: "h-4.5 w-4.5 text-slate-600 dark:text-slate-400" }, null, _parent));
				_push(`</button><button class="h-8 w-8 rounded-lg hover:bg-slate-100 dark:hover:bg-slate-900 flex items-center justify-center text-slate-555 dark:text-slate-400 cursor-pointer transition-colors" title="Toggle Layar Penuh">`);
				if (isFullscreen.value) _push(ssrRenderComponent(unref(Minimize), { class: "h-4.5 w-4.5" }, null, _parent));
				else _push(ssrRenderComponent(unref(Maximize), { class: "h-4.5 w-4.5" }, null, _parent));
				_push(`</button>`);
				_push(ssrRenderComponent(unref(Link), {
					href: _ctx.route("logout"),
					method: "post",
					as: "button",
					class: "px-3 py-1.5 bg-rose-600 hover:bg-rose-500 text-white rounded-lg text-xs font-semibold transition-colors cursor-pointer"
				}, {
					default: withCtx((_, _push, _parent, _scopeId) => {
						if (_push) _push(` Keluar `);
						else return [createTextVNode(" Keluar ")];
					}),
					_: 1
				}, _parent));
				_push(`</div></div></header>`);
			} else _push(`<!---->`);
			_push(`<main class="flex-1 p-6 overflow-visible lg:overflow-hidden min-h-0 flex flex-col bg-slate-50 dark:bg-slate-900"><div class="grid grid-cols-1 lg:grid-cols-12 gap-6 lg:h-full lg:overflow-hidden min-h-0"><div class="lg:col-span-7 xl:col-span-8 flex flex-col lg:h-full space-y-4 min-w-0 min-h-0"><div class="flex flex-wrap items-center justify-between gap-4 bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-xl p-4 shadow-sm flex-shrink-0"><div class="relative flex-1 max-w-sm">`);
			_push(ssrRenderComponent(unref(Search), { class: "absolute left-3 top-2.5 h-4 w-4 text-slate-400" }, null, _parent));
			_push(`<input${ssrRenderAttr("value", search.value)} type="text" placeholder="Cari menu kopi atau makanan..." class="w-full pl-9 pr-4 py-2 border border-slate-200 dark:border-slate-800 rounded-lg bg-transparent text-sm focus:outline-none focus:ring-2 focus:ring-[#8c5a3c]/20 focus:border-[#8c5a3c] transition-all text-slate-900 dark:text-slate-100"></div><div class="flex items-center gap-1.5"><!--[-->`);
			ssrRenderList([
				"dine_in",
				"take_away",
				"delivery"
			], (type) => {
				_push(`<button class="${ssrRenderClass(["px-3 py-1.5 border rounded-lg text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer", orderType.value === type ? "bg-[#8c5a3c] border-[#8c5a3c] text-white" : "bg-transparent border-slate-200 dark:border-slate-800 text-slate-500 dark:text-slate-400"])}">${ssrInterpolate(type === "dine_in" ? "Dine In" : type === "delivery" ? "Delivery" : "Take Away")}</button>`);
			});
			_push(`<!--]--></div></div><div class="flex gap-2 overflow-x-auto pb-1 flex-shrink-0 scrollbar-thin scrollbar-thumb-slate-200 dark:scrollbar-thumb-slate-800"><!--[-->`);
			ssrRenderList(categories, (cat) => {
				_push(`<button class="${ssrRenderClass(["px-4 py-2 rounded-full text-xs font-semibold whitespace-nowrap transition-all cursor-pointer border", activeCategory.value === cat ? "bg-[#8c5a3c] border-[#8c5a3c] text-white shadow-sm" : "bg-white dark:bg-slate-900 border-slate-200 dark:border-slate-700 text-slate-600 dark:text-slate-400 hover:bg-slate-50 dark:hover:bg-slate-800 hover:border-slate-300 dark:hover:border-slate-600"])}">${ssrInterpolate(cat)}</button>`);
			});
			_push(`<!--]--></div><div class="flex-1 overflow-y-auto pr-1 min-h-0">`);
			if (filteredProducts.value.length === 0) {
				_push(`<div class="flex flex-col items-center justify-center p-12 text-slate-400 bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-2xl h-full shadow-sm">`);
				_push(ssrRenderComponent(unref(Coffee), { class: "h-12 w-12 text-slate-300 mb-2" }, null, _parent));
				_push(`<p class="text-sm">Tidak ada produk ditemukan.</p></div>`);
			} else {
				_push(`<div class="grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-4 gap-4"><!--[-->`);
				ssrRenderList(filteredProducts.value, (p) => {
					_push(`<div class="${ssrRenderClass(["bg-white dark:bg-slate-950 border rounded-xl overflow-hidden shadow-sm flex flex-col transition-all duration-200 group relative select-none", getAvailableQty(p, p.category === "Coffee" || p.category === "Non-Coffee" ? "ice" : null) > 0 ? "hover:-translate-y-0.5 hover:shadow-md border-slate-200 dark:border-slate-800 cursor-pointer" : "opacity-60 border-slate-200 dark:border-slate-900 cursor-not-allowed"])}"><div class="aspect-square w-full relative overflow-hidden bg-slate-50/50 dark:bg-slate-900/30 flex-shrink-0">`);
					if (p.image_path) _push(`<img${ssrRenderAttr("src", p.image_path)} alt="Product Photo" class="h-full w-full object-cover group-hover:scale-105 transition-transform duration-300">`);
					else _push(`<div class="h-full w-full bg-gradient-to-br from-[#8c5a3c]/20 to-orange-550/20 text-[#8c5a3c] flex items-center justify-center font-bold text-xl">${ssrInterpolate(getProductInitials(p.name))}</div>`);
					_push(`<div class="absolute bottom-2 right-2">`);
					if (getAvailableQty(p, p.category === "Coffee" || p.category === "Non-Coffee" ? "ice" : null) > 0) _push(`<span class="inline-flex px-1.5 py-0.5 rounded text-[9px] font-bold uppercase bg-emerald-500 text-white shadow-sm"> In Stock (${ssrInterpolate(getAvailableQty(p, p.category === "Coffee" || p.category === "Non-Coffee" ? "ice" : null))}) </span>`);
					else _push(`<span class="inline-flex px-1.5 py-0.5 rounded text-[9px] font-bold uppercase bg-rose-600 text-white shadow-sm"> Habis </span>`);
					_push(`</div></div><div class="p-3 flex-1 flex flex-col justify-between"><div><h4 class="text-sm font-semibold text-slate-900 dark:text-slate-100 truncate group-hover:text-[#8c5a3c] transition-colors">${ssrInterpolate(p.name)}</h4><p class="text-[10px] text-slate-400 mt-0.5 truncate">${ssrInterpolate(p.description || "Tidak ada deskripsi")}</p></div><p class="text-sm font-bold text-slate-900 dark:text-slate-100 mt-2"> Rp ${ssrInterpolate(Number(p.price).toLocaleString("id-ID"))}</p></div></div>`);
				});
				_push(`<!--]--></div>`);
			}
			_push(`</div></div><div class="lg:col-span-5 xl:col-span-4 bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-xl shadow-sm flex flex-col h-[550px] lg:h-full overflow-hidden min-h-0 flex-shrink-0"><div class="p-4 border-b border-slate-200 dark:border-slate-800 flex items-center justify-between flex-shrink-0 bg-slate-50/50 dark:bg-slate-900/10"><div class="flex items-center gap-2">`);
			_push(ssrRenderComponent(unref(ShoppingCart), { class: "h-4.5 w-4.5 text-slate-500" }, null, _parent));
			_push(`<h3 class="text-sm font-bold text-slate-900 dark:text-slate-100">Keranjang Belanja</h3></div><div class="flex items-center gap-1.5"><button class="p-1 text-slate-555 hover:text-[#8c5a3c] hover:bg-slate-100 dark:hover:bg-slate-900 rounded-lg cursor-pointer" title="Split Bill">`);
			_push(ssrRenderComponent(unref(Split), { class: "h-4 w-4" }, null, _parent));
			_push(`</button><span class="text-xs px-2 py-0.5 bg-[#8c5a3c]/10 text-[#8c5a3c] rounded-full font-bold">${ssrInterpolate(cart.value.length)} Item(s) </span></div></div>`);
			if (orderType.value === "dine_in") {
				_push(`<div class="p-3 border-b border-slate-200 dark:border-slate-800 bg-[#8c5a3c]/5 flex items-center justify-between gap-4"><div class="flex items-center gap-1.5 text-xs text-[#8c5a3c] font-bold">`);
				_push(ssrRenderComponent(unref(Grid), { class: "h-4 w-4" }, null, _parent));
				_push(`<span>Pilih Meja:</span></div><select class="h-8 px-2.5 border border-[#8c5a3c]/20 rounded-lg bg-white dark:bg-slate-950 text-xs font-semibold focus:outline-none focus:ring-1 focus:ring-[#8c5a3c] text-slate-900 dark:text-slate-100 cursor-pointer"><option${ssrRenderAttr("value", null)}${ssrIncludeBooleanAttr(Array.isArray(selectedTableId.value) ? ssrLooseContain(selectedTableId.value, null) : ssrLooseEqual(selectedTableId.value, null)) ? " selected" : ""}>Pilih...</option><!--[-->`);
				ssrRenderList(__props.tables, (t) => {
					_push(`<option${ssrRenderAttr("value", t.id)}${ssrIncludeBooleanAttr(Array.isArray(selectedTableId.value) ? ssrLooseContain(selectedTableId.value, t.id) : ssrLooseEqual(selectedTableId.value, t.id)) ? " selected" : ""}>${ssrInterpolate(t.number)} (${ssrInterpolate(t.capacity)}p)</option>`);
				});
				_push(`<!--]--></select></div>`);
			} else _push(`<!---->`);
			_push(`<div class="flex-1 overflow-y-auto p-4 space-y-4 min-h-0">`);
			if (cart.value.length === 0) {
				_push(`<div class="flex flex-col items-center justify-center p-8 text-slate-400 h-full">`);
				_push(ssrRenderComponent(unref(ShoppingCart), { class: "h-10 w-10 text-slate-200 mb-2" }, null, _parent));
				_push(`<p class="text-xs text-center">Keranjang kosong.<br>Klik menu di kiri untuk menambahkan.</p></div>`);
			} else {
				_push(`<!--[-->`);
				ssrRenderList(cart.value, (item, idx) => {
					_push(`<div class="p-3 bg-slate-50/50 dark:bg-slate-900/20 rounded-xl border border-slate-100 dark:border-slate-900 flex flex-col space-y-2.5 animate-in slide-in-from-bottom-2 duration-150"><div class="flex items-start justify-between gap-2"><div><h4 class="text-sm font-semibold text-slate-900 dark:text-slate-100 leading-tight">${ssrInterpolate(item.product.name)}</h4><span class="text-xs text-slate-450 font-medium">Rp ${ssrInterpolate(Number(item.product.price).toLocaleString("id-ID"))}</span></div><button class="p-1 text-slate-400 hover:text-rose-500 rounded-lg transition-colors cursor-pointer">`);
					_push(ssrRenderComponent(unref(Trash2), { class: "h-4 w-4" }, null, _parent));
					_push(`</button></div>`);
					if (props.modifiers.length > 0) {
						_push(`<div class="flex flex-wrap items-center gap-1.5 pt-1.5 border-t border-slate-100 dark:border-slate-900"><span class="text-[9px] font-bold text-slate-400 uppercase tracking-wide">Add-ons:</span><!--[-->`);
						ssrRenderList(props.modifiers, (mod) => {
							_push(`<button class="${ssrRenderClass(["px-2 py-0.5 border rounded-lg text-[9px] font-semibold transition-all cursor-pointer", item.selectedModifiers.includes(mod.id) ? "bg-[#8c5a3c]/10 border-[#8c5a3c] text-[#8c5a3c] font-bold" : "bg-white dark:bg-slate-950 border-slate-200 dark:border-slate-800 text-slate-500"])}"> +${ssrInterpolate(mod.name)} (+Rp${ssrInterpolate(Number(mod.price).toLocaleString("id-ID"))}) </button>`);
						});
						_push(`<!--]--></div>`);
					} else _push(`<!---->`);
					_push(`<div class="flex flex-wrap items-center justify-between gap-2 pt-2 border-t border-slate-100 dark:border-slate-900">`);
					if (item.variant !== null) {
						_push(`<div class="flex rounded-lg bg-slate-100 dark:bg-slate-800 p-0.5"><button type="button" class="${ssrRenderClass(["px-2 py-1 rounded-md text-[10px] font-bold uppercase flex items-center gap-1 transition-all cursor-pointer", item.variant === "ice" ? "bg-white dark:bg-slate-955 text-blue-600 dark:text-blue-400 shadow-sm" : "text-slate-400"])}">`);
						_push(ssrRenderComponent(unref(Snowflake), { class: "h-3 w-3" }, null, _parent));
						_push(` Es </button><button type="button" class="${ssrRenderClass(["px-2 py-1 rounded-md text-[10px] font-bold uppercase flex items-center gap-1 transition-all cursor-pointer", item.variant === "hot" ? "bg-white dark:bg-slate-955 text-red-650 dark:text-red-400 shadow-sm" : "text-slate-400"])}">`);
						_push(ssrRenderComponent(unref(Flame), { class: "h-3 w-3" }, null, _parent));
						_push(` Panas </button></div>`);
					} else _push(`<div class="text-[10px] text-slate-400 italic">No variants</div>`);
					_push(`<div class="flex items-center gap-2"><button class="h-6 w-6 rounded bg-slate-100 dark:bg-slate-800 flex items-center justify-center text-slate-600 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-700 cursor-pointer">`);
					_push(ssrRenderComponent(unref(Minus), { class: "h-3.5 w-3.5" }, null, _parent));
					_push(`</button><span class="text-sm font-bold w-6 text-center text-slate-900 dark:text-slate-100">${ssrInterpolate(item.qty)}</span><button${ssrIncludeBooleanAttr(getAvailableQty(item.product, item.variant) <= 0) ? " disabled" : ""} class="h-6 w-6 rounded bg-slate-100 dark:bg-slate-800 flex items-center justify-center text-slate-600 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-700 disabled:opacity-40 cursor-pointer">`);
					_push(ssrRenderComponent(unref(Plus), { class: "h-3.5 w-3.5" }, null, _parent));
					_push(`</button></div></div><input${ssrRenderAttr("value", item.notes)} type="text" placeholder="Catatan (misal: kurang manis, take away)..." class="w-full px-2.5 py-1 text-[11px] border border-slate-200 dark:border-slate-800 rounded bg-white dark:bg-slate-900 text-slate-700 dark:text-slate-300 placeholder-slate-400 dark:placeholder-slate-600 focus:outline-none focus:border-[#8c5a3c]"></div>`);
				});
				_push(`<!--]-->`);
			}
			_push(`</div><div class="border-t border-slate-200 dark:border-slate-800 p-4 space-y-4 bg-slate-50/50 dark:bg-slate-900/10 flex-shrink-0"><div class="space-y-1.5"><span class="text-[9px] font-bold uppercase text-slate-400 tracking-wider">Customer / Member</span><div class="grid grid-cols-2 gap-2"><select class="h-8 px-2 border border-slate-200 dark:border-slate-800 rounded-lg bg-white dark:bg-slate-950 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100 cursor-pointer"><!--[-->`);
			ssrRenderList(__props.customers, (c) => {
				_push(`<option${ssrRenderAttr("value", c.id)}${ssrIncludeBooleanAttr(Array.isArray(selectedCustomerId.value) ? ssrLooseContain(selectedCustomerId.value, c.id) : ssrLooseEqual(selectedCustomerId.value, c.id)) ? " selected" : ""}>${ssrInterpolate(c.name)} ${ssrInterpolate(c.is_member ? "(Member)" : "")}</option>`);
			});
			_push(`<!--]--></select>`);
			if (__props.customers.find((c) => c.id === selectedCustomerId.value)?.is_member) _push(`<div class="flex items-center gap-1.5"><span class="text-[9px] font-bold text-[#8c5a3c]">PTS: ${ssrInterpolate(selectedCustomerPoints.value)}</span><input type="number"${ssrRenderAttr("value", pointsToRedeem.value)} min="0"${ssrRenderAttr("max", selectedCustomerPoints.value)} placeholder="Redeem pts" class="w-full h-8 px-2 border border-slate-200 dark:border-slate-800 rounded-lg bg-white dark:bg-slate-950 text-xs text-right font-bold focus:outline-none"></div>`);
			else _push(`<!---->`);
			_push(`</div></div>`);
			if (__props.promos.length > 0) {
				_push(`<div class="space-y-1.5"><span class="text-[9px] font-bold uppercase text-slate-400 tracking-wider">Terapkan Kupon Promo</span><select class="w-full h-8 px-2 border border-slate-200 dark:border-slate-800 rounded-lg bg-white dark:bg-slate-950 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100 cursor-pointer"><option${ssrRenderAttr("value", null)}${ssrIncludeBooleanAttr(Array.isArray(selectedPromoId.value) ? ssrLooseContain(selectedPromoId.value, null) : ssrLooseEqual(selectedPromoId.value, null)) ? " selected" : ""}>Pilih promo...</option><!--[-->`);
				ssrRenderList(__props.promos, (p) => {
					_push(`<option${ssrRenderAttr("value", p.id)}${ssrIncludeBooleanAttr(subtotal.value < p.min_purchase) ? " disabled" : ""}${ssrIncludeBooleanAttr(Array.isArray(selectedPromoId.value) ? ssrLooseContain(selectedPromoId.value, p.id) : ssrLooseEqual(selectedPromoId.value, p.id)) ? " selected" : ""}>${ssrInterpolate(p.name)} (Min. Rp${ssrInterpolate(Number(p.min_purchase).toLocaleString("id-ID"))}) </option>`);
				});
				_push(`<!--]--></select></div>`);
			} else _push(`<!---->`);
			_push(`<div class="space-y-1.5 text-xs text-slate-600 dark:text-slate-400"><div class="flex justify-between"><span>Subtotal</span><span class="font-semibold text-slate-900 dark:text-slate-100">Rp ${ssrInterpolate(subtotal.value.toLocaleString("id-ID"))}</span></div>`);
			if (__props.servicePercentage > 0) _push(`<div class="flex justify-between"><span>Biaya Layanan (${ssrInterpolate(__props.servicePercentage)}%)</span><span class="font-semibold text-slate-900 dark:text-slate-100">Rp ${ssrInterpolate(serviceCharge.value.toLocaleString("id-ID"))}</span></div>`);
			else _push(`<!---->`);
			if (__props.taxPercentage > 0) _push(`<div class="flex justify-between"><span>Pajak Restoran (${ssrInterpolate(__props.taxPercentage)}%)</span><span class="font-semibold text-slate-900 dark:text-slate-100">Rp ${ssrInterpolate(tax.value.toLocaleString("id-ID"))}</span></div>`);
			else _push(`<!---->`);
			if (discountAmount.value > 0) _push(`<div class="flex justify-between text-rose-500 font-bold"><span>Potongan Diskon</span><span>-Rp ${ssrInterpolate(discountAmount.value.toLocaleString("id-ID"))}</span></div>`);
			else _push(`<!---->`);
			_push(`<div class="flex justify-between text-sm font-bold text-slate-900 dark:text-slate-100 pt-1.5 border-t border-slate-200 dark:border-slate-800"><span>Total Tagihan</span><span class="text-[#8c5a3c]">Rp ${ssrInterpolate(grandTotal.value.toLocaleString("id-ID"))}</span></div></div><div class="space-y-2"><span class="text-[10px] font-bold uppercase text-slate-400 tracking-wider">Metode Pembayaran</span><div class="grid grid-cols-3 gap-2"><!--[-->`);
			ssrRenderList([
				"cash",
				"transfer",
				"qris"
			], (method) => {
				_push(`<button class="${ssrRenderClass(["py-2 text-xs font-semibold rounded-lg border text-center transition-all cursor-pointer uppercase", paymentMethod.value === method ? "bg-[#8c5a3c]/10 border-[#8c5a3c] text-[#8c5a3c]" : "border-slate-200 dark:border-slate-850 text-slate-500 dark:text-slate-400 bg-white dark:bg-slate-950"])}">${ssrInterpolate(method)}</button>`);
			});
			_push(`<!--]--></div></div>`);
			if (paymentMethod.value === "cash") {
				_push(`<div class="space-y-2 pt-2 border-t border-dashed border-slate-200 dark:border-slate-800"><div class="flex items-center justify-between gap-4"><span class="text-[10px] font-bold uppercase text-slate-400 dark:text-slate-500">Uang Diterima</span><input${ssrRenderAttr("value", cashReceived.value)} type="number" class="w-32 px-2 py-1 text-right border border-slate-200 dark:border-slate-700 rounded bg-white dark:bg-slate-900 text-slate-900 dark:text-slate-100 text-sm focus:outline-none focus:border-[#8c5a3c] font-bold"></div><div class="flex flex-wrap gap-1.5 pt-1"><button type="button" class="px-2 py-1 rounded bg-slate-100 dark:bg-slate-800 text-slate-700 dark:text-slate-300 text-[10px] font-semibold hover:bg-slate-200 dark:hover:bg-slate-700 cursor-pointer transition-colors"> Pas </button><!--[-->`);
				ssrRenderList([
					2e4,
					5e4,
					1e5
				], (amt) => {
					_push(`<button type="button" class="px-2 py-1 rounded bg-slate-100 dark:bg-slate-800 text-slate-700 dark:text-slate-300 text-[10px] font-semibold hover:bg-slate-200 dark:hover:bg-slate-700 cursor-pointer transition-colors" style="${ssrRenderStyle(amt >= grandTotal.value ? null : { display: "none" })}"> Rp ${ssrInterpolate(amt.toLocaleString("id-ID"))}</button>`);
				});
				_push(`<!--]--></div>`);
				if (cashReceived.value >= grandTotal.value) _push(`<div class="flex justify-between items-center text-xs font-semibold text-emerald-600 dark:text-emerald-400 pt-1.5"><span>Kembalian</span><span class="font-bold text-sm">Rp ${ssrInterpolate(changeDue.value.toLocaleString("id-ID"))}</span></div>`);
				else _push(`<!---->`);
				_push(`</div>`);
			} else _push(`<!---->`);
			_push(`<button${ssrIncludeBooleanAttr(cart.value.length === 0 || isCheckingOut.value || paymentMethod.value === "cash" && cashReceived.value < grandTotal.value) ? " disabled" : ""} class="w-full py-3 bg-[#8c5a3c] hover:bg-[#734a31] text-white rounded-lg text-sm font-semibold shadow-sm focus:outline-none focus:ring-2 focus:ring-[#8c5a3c]/20 disabled:opacity-40 transition-all cursor-pointer flex items-center justify-center gap-2"><span>${ssrInterpolate(isCheckingOut.value ? "Memproses Transaksi..." : "Selesaikan Pembayaran")}</span></button></div></div></div></main>`);
			if (isReceiptModalOpen.value) {
				_push(`<div class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/65 backdrop-blur-sm"><div id="receipt-print-modal" class="w-full max-w-sm bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-2xl shadow-2xl p-6 animate-in zoom-in-95 duration-200 space-y-6 text-slate-900 dark:text-slate-100"><div class="text-center space-y-1"><h2 class="text-xl font-bold tracking-wider uppercase text-slate-900 dark:text-slate-100">${ssrInterpolate(_ctx.$page.props.settings.site_name)}</h2><p class="text-xs font-medium text-slate-500 dark:text-slate-400">${ssrInterpolate(receiptData.value?.outlet_name)}</p><p class="text-[10px] text-slate-400 dark:text-slate-500">${ssrInterpolate(receiptData.value?.date)}</p></div><div class="border-t border-b border-dashed border-slate-200 dark:border-slate-700 py-3 text-xs space-y-1.5 font-mono text-slate-800 dark:text-slate-200"><div class="flex justify-between"><span>No Transaksi:</span><span>${ssrInterpolate(receiptData.value?.transaction_number)}</span></div><div class="flex justify-between"><span>Kasir:</span><span>${ssrInterpolate(receiptData.value?.cashier_name)}</span></div><div class="flex justify-between uppercase"><span>Metode Bayar:</span><span>${ssrInterpolate(receiptData.value?.payment_method)}</span></div></div><div class="space-y-2.5 font-mono text-xs"><!--[-->`);
				ssrRenderList(receiptData.value?.items, (item, idx) => {
					_push(`<div class="flex justify-between items-start"><div class="max-w-[200px]"><p class="font-semibold">${ssrInterpolate(item.product.name)}</p>`);
					if (item.variant) _push(`<span class="text-[10px] text-slate-400 uppercase">[${ssrInterpolate(item.variant)}]</span>`);
					else _push(`<!---->`);
					if (item.selectedModifiers && item.selectedModifiers.length > 0) {
						_push(`<div class="pl-2 space-y-0.5"><!--[-->`);
						ssrRenderList(item.selectedModifiers, (mId) => {
							_push(`<span class="text-[9px] text-slate-500 block"> + ${ssrInterpolate(__props.modifiers.find((m) => m.id === mId)?.name)}</span>`);
						});
						_push(`<!--]--></div>`);
					} else _push(`<!---->`);
					if (item.notes) _push(`<span class="text-[10px] text-slate-400 block italic">* ${ssrInterpolate(item.notes)}</span>`);
					else _push(`<!---->`);
					_push(`</div><span class="flex-shrink-0">${ssrInterpolate(item.qty)} x Rp${ssrInterpolate(Number(item.product.price).toLocaleString("id-ID"))}</span></div>`);
				});
				_push(`<!--]--></div><div class="border-t border-dashed border-slate-200 dark:border-slate-700 pt-3 space-y-1.5 font-mono text-xs text-slate-800 dark:text-slate-200"><div class="flex justify-between"><span>Subtotal</span><span>Rp ${ssrInterpolate(Number(receiptData.value?.subtotal).toLocaleString("id-ID"))}</span></div>`);
				if (receiptData.value?.service > 0) _push(`<div class="flex justify-between"><span>Biaya Layanan</span><span>Rp ${ssrInterpolate(Number(receiptData.value?.service).toLocaleString("id-ID"))}</span></div>`);
				else _push(`<!---->`);
				if (receiptData.value?.tax > 0) _push(`<div class="flex justify-between"><span>Pajak Restoran</span><span>Rp ${ssrInterpolate(Number(receiptData.value?.tax).toLocaleString("id-ID"))}</span></div>`);
				else _push(`<!---->`);
				_push(`<div class="flex justify-between text-sm font-bold pt-1.5 border-t border-slate-200 dark:border-slate-800"><span>Total Tagihan</span><span>Rp ${ssrInterpolate(Number(receiptData.value?.total).toLocaleString("id-ID"))}</span></div><div class="flex justify-between pt-1 text-slate-600 dark:text-slate-350"><span>Bayar</span><span>Rp ${ssrInterpolate(Number(receiptData.value?.cash_received).toLocaleString("id-ID"))}</span></div>`);
				if (receiptData.value?.payment_method === "cash") _push(`<div class="flex justify-between text-emerald-600 dark:text-emerald-400 font-bold"><span>Kembalian</span><span>Rp ${ssrInterpolate(Number(receiptData.value?.change).toLocaleString("id-ID"))}</span></div>`);
				else _push(`<!---->`);
				_push(`</div><div class="flex flex-col gap-2 pt-4 border-t border-slate-200 dark:border-slate-800 print:hidden"><div class="flex gap-2">`);
				if (receiptData.value) {
					_push(`<a${ssrRenderAttr("href", _ctx.route("transactions.print", receiptData.value.id))} target="_blank" class="flex-1 py-2 border border-slate-200 dark:border-slate-800 hover:bg-slate-50 dark:hover:bg-slate-900 rounded-lg text-xs font-semibold text-slate-700 dark:text-slate-300 transition-all flex items-center justify-center gap-1.5 cursor-pointer text-center">`);
					_push(ssrRenderComponent(unref(Printer), { class: "h-3.5 w-3.5" }, null, _parent));
					_push(` Struk Kasir </a>`);
				} else _push(`<!---->`);
				if (receiptData.value) {
					_push(`<a${ssrRenderAttr("href", _ctx.route("transactions.kitchen-print", receiptData.value.id))} target="_blank" class="flex-1 py-2 border border-slate-200 dark:border-slate-800 hover:bg-slate-50 dark:hover:bg-slate-900 rounded-lg text-xs font-semibold text-[#8c5a3c] transition-all flex items-center justify-center gap-1.5 cursor-pointer text-center">`);
					_push(ssrRenderComponent(unref(FileText), { class: "h-3.5 w-3.5" }, null, _parent));
					_push(` Tiket Dapur </a>`);
				} else _push(`<!---->`);
				_push(`</div><button class="w-full py-2 bg-[#8c5a3c] hover:bg-[#734a31] text-white rounded-lg text-xs font-semibold shadow-sm focus:outline-none transition-all cursor-pointer text-center"> Selesai </button></div></div></div>`);
			} else _push(`<!---->`);
			if (isSplitModalOpen.value) {
				_push(`<div class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/65 backdrop-blur-sm animate-in fade-in duration-150"><div class="bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-2xl shadow-2xl w-full max-w-lg overflow-hidden flex flex-col transform transition-all max-h-[90vh]"><div class="px-6 py-4 border-b border-slate-200 dark:border-slate-800 flex items-center justify-between"><h3 class="text-sm font-extrabold text-slate-900 dark:text-slate-100 flex items-center gap-2">`);
				_push(ssrRenderComponent(unref(Split), { class: "h-4 w-4 text-[#8c5a3c]" }, null, _parent));
				_push(`<span>Split Bill (Pisah Pembayaran)</span></h3><button class="p-1.5 hover:bg-slate-100 dark:hover:bg-slate-900 rounded-lg text-slate-400 cursor-pointer">`);
				_push(ssrRenderComponent(unref(X), { class: "h-4 w-4" }, null, _parent));
				_push(`</button></div><div class="flex-1 overflow-y-auto p-6 space-y-4"><p class="text-xs text-slate-400">Tentukan jumlah qty item yang ingin dibayar pada tagihan pertama (Split Bill). Sisa item akan tetap berada di keranjang untuk pembayaran berikutnya.</p><div class="border border-slate-200 dark:border-slate-800 rounded-xl overflow-hidden"><table class="w-full text-left border-collapse bg-white dark:bg-slate-950"><thead><tr class="bg-slate-50 dark:bg-slate-900 text-[10px] font-bold text-slate-400 dark:text-slate-500 border-b border-slate-200 dark:border-slate-800"><th class="p-3">Nama Menu</th><th class="p-3 text-center">Keranjang Qty</th><th class="p-3 text-center" style="${ssrRenderStyle({ "width": "130px" })}">Split Qty</th></tr></thead><tbody class="divide-y divide-slate-100 dark:divide-slate-800"><!--[-->`);
				ssrRenderList(splitItems.value, (split, index) => {
					_push(`<tr class="text-xs font-semibold hover:bg-slate-50 dark:hover:bg-slate-900/50 transition-colors"><td class="p-3"><span class="text-slate-800 dark:text-slate-200 block">${ssrInterpolate(cart.value[split.itemIndex].product.name)}</span>`);
					if (cart.value[split.itemIndex].variant) _push(`<span class="text-[9px] text-[#8c5a3c] font-black uppercase">${ssrInterpolate(cart.value[split.itemIndex].variant)}</span>`);
					else _push(`<!---->`);
					_push(`</td><td class="p-3 text-center font-bold text-slate-700 dark:text-slate-300">${ssrInterpolate(cart.value[split.itemIndex].qty)}</td><td class="p-3"><div class="flex items-center justify-center gap-2"><button type="button" class="h-6 w-6 rounded bg-slate-100 dark:bg-slate-800 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-700 flex items-center justify-center cursor-pointer transition-colors"> - </button><span class="w-6 text-center font-extrabold text-slate-900 dark:text-slate-100">${ssrInterpolate(split.qty)}</span><button type="button" class="h-6 w-6 rounded bg-slate-100 dark:bg-slate-800 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-700 flex items-center justify-center cursor-pointer transition-colors"> + </button></div></td></tr>`);
				});
				_push(`<!--]--></tbody></table></div></div><div class="px-6 py-4 border-t border-slate-200 dark:border-slate-800 flex items-center justify-end gap-3 bg-slate-50/50 dark:bg-slate-900/10"><button type="button" class="px-4 py-2 border border-slate-200 dark:border-slate-800 text-slate-700 dark:text-slate-350 text-xs font-bold rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 cursor-pointer"> Batal </button><button type="button"${ssrIncludeBooleanAttr(isCheckingOut.value || !splitItems.value.some((s) => s.qty > 0)) ? " disabled" : ""} class="px-4 py-2 bg-[#8c5a3c] hover:bg-[#734a31] text-white text-xs font-bold rounded-xl cursor-pointer disabled:opacity-50"> Bayar Bagian Ini </button></div></div></div>`);
			} else _push(`<!---->`);
			_push(`</div><!--]-->`);
		};
	}
});
//#endregion
//#region resources/js/Pages/CafePOS/POS.vue
var _sfc_setup = POS_vue_vue_type_script_setup_true_lang_default.setup;
POS_vue_vue_type_script_setup_true_lang_default.setup = (props, ctx) => {
	const ssrContext = useSSRContext();
	(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/Pages/CafePOS/POS.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
var POS_default = POS_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { POS_default as default };
