import { Head } from "@inertiajs/vue3";
import { computed, defineComponent, unref, useSSRContext } from "vue";
import { ssrInterpolate, ssrRenderAttr, ssrRenderComponent, ssrRenderList, ssrRenderStyle } from "vue/server-renderer";
import { FileText, Printer, X } from "lucide-vue-next";
//#region resources/js/Pages/CafePOS/Transactions/Print.vue?vue&type=script&setup=true&lang.ts
var Print_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
	__name: "Print",
	__ssrInlineRender: true,
	props: {
		transaction: {},
		appName: {},
		thermalLogo: {}
	},
	setup(__props) {
		const urlParams = new URLSearchParams(window.location.search);
		const cashReceivedQuery = urlParams.get("cash_received");
		const changeQuery = urlParams.get("change");
		const cashReceived = computed(() => cashReceivedQuery ? parseFloat(cashReceivedQuery) : null);
		const changeDue = computed(() => changeQuery ? parseFloat(changeQuery) : null);
		const isRaw = computed(() => urlParams.get("raw") === "true");
		const printDateTime = computed(() => {
			const now = /* @__PURE__ */ new Date();
			return now.toLocaleDateString("id-ID", {
				day: "2-digit",
				month: "short",
				year: "numeric"
			}) + " " + now.toLocaleTimeString("id-ID", {
				hour: "2-digit",
				minute: "2-digit",
				second: "2-digit"
			});
		});
		const formatCurrency = (val) => {
			return "Rp " + new Intl.NumberFormat("id-ID").format(Math.round(val));
		};
		const formatDate = (dateStr) => {
			return new Date(dateStr).toLocaleString("id-ID", {
				year: "numeric",
				month: "short",
				day: "numeric",
				hour: "2-digit",
				minute: "2-digit",
				second: "2-digit"
			});
		};
		const paymentLabel = (method) => {
			return {
				cash: "Tunai (Cash)",
				transfer: "Transfer Bank",
				qris: "QRIS"
			}[method] ?? method;
		};
		return (_ctx, _push, _parent, _attrs) => {
			_push(`<!--[-->`);
			_push(ssrRenderComponent(unref(Head), { title: "Cetak Struk - " + __props.transaction.transaction_number }, null, _parent));
			if (isRaw.value) {
				_push(`<div class="w-[58mm] text-black font-mono leading-tight p-0 m-0 bg-white" style="${ssrRenderStyle({
					"zoom": "0.8",
					"transform-origin": "top left",
					"max-width": "58mm"
				})}"><div class="space-y-1 text-black text-center flex flex-col items-center justify-center w-full">`);
				if (__props.thermalLogo) _push(`<img${ssrRenderAttr("src", __props.thermalLogo)} alt="Logo" class="max-h-14 max-w-full object-contain mb-1 block border-0 bg-transparent mx-auto">`);
				else _push(`<!---->`);
				_push(`<div class="font-extrabold text-[15px] tracking-widest uppercase text-center w-full">${ssrInterpolate(__props.appName)}</div><div class="text-[11px] font-bold uppercase tracking-wide text-center w-full">${ssrInterpolate(__props.transaction.outlet?.name || "CafePOS Store")}</div><div class="text-[10px] font-medium leading-tight text-center w-full pb-2"> Bukti Pembayaran POS </div></div><div class="border-t border-b border-dashed border-black py-2.5 space-y-1 text-[11px] leading-relaxed text-black"><div class="flex justify-between"><span>No.:</span><span class="font-bold">${ssrInterpolate(__props.transaction.transaction_number)}</span></div><div class="flex justify-between"><span>Tanggal:</span><span class="font-bold">${ssrInterpolate(formatDate(__props.transaction.created_at))}</span></div><div class="flex justify-between"><span>Kasir:</span><span class="font-bold">${ssrInterpolate(__props.transaction.user?.name || "-")}</span></div>`);
				if (__props.transaction.table) _push(`<div class="flex justify-between"><span>Meja (Table):</span><span class="font-bold">Meja ${ssrInterpolate(__props.transaction.table.number)}</span></div>`);
				else _push(`<!---->`);
				if (__props.transaction.customer) _push(`<div class="flex justify-between"><span>Pelanggan:</span><span class="font-bold">${ssrInterpolate(__props.transaction.customer.name)}</span></div>`);
				else _push(`<!---->`);
				_push(`<div class="flex justify-between"><span>Tipe:</span><span class="font-bold uppercase">${ssrInterpolate(__props.transaction.order_type ? __props.transaction.order_type.replace("_", " ") : "POS")}</span></div><div class="flex justify-between"><span>Status:</span><span class="font-bold uppercase">${ssrInterpolate(__props.transaction.status === "success" ? "AKTUAL" : "VOIDED")}</span></div>`);
				if (__props.transaction.queue_number) _push(`<div class="flex justify-between"><span>No. Antrean:</span><span class="font-bold text-[12px] border border-black text-black px-1.5 rounded">${ssrInterpolate(__props.transaction.queue_number)}</span></div>`);
				else _push(`<!---->`);
				_push(`</div><div class="space-y-3 py-1 text-black"><!--[-->`);
				ssrRenderList(__props.transaction.items, (item) => {
					_push(`<div class="space-y-1"><div class="font-bold text-[11px] leading-tight text-left">${ssrInterpolate(item.product?.name || "Unknown Item")}</div><div class="flex justify-between text-[10px] pl-3 leading-normal font-bold"><span>${ssrInterpolate(item.qty)} x ${ssrInterpolate(formatCurrency(item.price))} `);
					if (item.variant) _push(`<span class="font-bold uppercase ml-1.5">[${ssrInterpolate(item.variant)}]</span>`);
					else _push(`<!---->`);
					_push(`</span><span class="flex-shrink-0 ml-2 font-bold">${ssrInterpolate(formatCurrency(item.subtotal))}</span></div>`);
					if (item.modifiers && item.modifiers.length > 0) {
						_push(`<div class="pl-5 text-[9.5px] leading-normal italic font-medium"><!--[-->`);
						ssrRenderList(item.modifiers, (m) => {
							_push(`<div class="flex justify-between"><span>+ ${ssrInterpolate(m.name)}</span>`);
							if (m.price > 0) _push(`<span class="flex-shrink-0 ml-2">${ssrInterpolate(formatCurrency(m.price))}</span>`);
							else _push(`<!---->`);
							_push(`</div>`);
						});
						_push(`<!--]--></div>`);
					} else _push(`<!---->`);
					_push(`</div>`);
				});
				_push(`<!--]--></div><div class="space-y-1.5 text-[11px] border-t border-dashed border-black pt-3 text-black"><div class="flex justify-between"><span>Subtotal:</span><span>${ssrInterpolate(formatCurrency(__props.transaction.total_amount - __props.transaction.tax_amount - __props.transaction.service_charge_amount + __props.transaction.discount_amount))}</span></div>`);
				if (__props.transaction.discount_amount > 0) _push(`<div class="flex justify-between"><span>Diskon (Promo):</span><span>-${ssrInterpolate(formatCurrency(__props.transaction.discount_amount))}</span></div>`);
				else _push(`<!---->`);
				if (__props.transaction.service_charge_amount > 0) _push(`<div class="flex justify-between"><span>Service Charge:</span><span>${ssrInterpolate(formatCurrency(__props.transaction.service_charge_amount))}</span></div>`);
				else _push(`<!---->`);
				if (__props.transaction.tax_amount > 0) _push(`<div class="flex justify-between"><span>Pajak (Tax):</span><span>${ssrInterpolate(formatCurrency(__props.transaction.tax_amount))}</span></div>`);
				else _push(`<!---->`);
				_push(`<div class="border-t border-double border-black my-2"></div><div class="flex justify-between text-[11px] font-black uppercase"><span>TOTAL KESELURUHAN:</span><span>${ssrInterpolate(formatCurrency(__props.transaction.total_amount))}</span></div><div class="border-t border-dashed border-black my-2"></div><div class="flex justify-between"><span>Metode Pembayaran:</span><span class="font-bold uppercase">${ssrInterpolate(paymentLabel(__props.transaction.payment_method))}</span></div>`);
				if (__props.transaction.payment_method === "cash") {
					_push(`<!--[-->`);
					if (cashReceived.value !== null) _push(`<div class="flex justify-between"><span>Tunai Diterima:</span><span>${ssrInterpolate(formatCurrency(cashReceived.value))}</span></div>`);
					else _push(`<!---->`);
					if (changeDue.value !== null) _push(`<div class="flex justify-between font-bold"><span>Kembalian:</span><span>${ssrInterpolate(formatCurrency(changeDue.value))}</span></div>`);
					else _push(`<!---->`);
					_push(`<!--]-->`);
				} else _push(`<!---->`);
				_push(`</div><div class="text-center space-y-1.5 text-[10px] pt-4 border-t border-dashed border-black mt-4 text-black font-mono"><p class="font-extrabold text-[11px] uppercase tracking-wider">TERIMA KASIH</p><p>Atas Kunjungan &amp; Pembelian Anda</p><p class="italic text-[9.5px]">&quot;Fresh Coffee, Warm Vibes.&quot;</p><div class="border-t border-dotted border-black my-2 w-1/2 mx-auto"></div><p class="text-[9px]">Sistem POS: ${ssrInterpolate(__props.appName)}</p><p class="text-[8.5px]">Waktu Cetak: ${ssrInterpolate(printDateTime.value)}</p></div></div>`);
			} else {
				_push(`<div class="min-h-screen bg-slate-900 text-slate-800 font-sans flex flex-col items-center print:bg-white print:text-black"><div class="w-full bg-slate-950 border-b border-slate-800 px-6 py-4 flex items-center justify-between shadow-md print:hidden select-none sticky top-0 z-50"><div class="flex items-center gap-2.5"><div class="p-2 bg-red-600/10 rounded-xl">`);
				_push(ssrRenderComponent(unref(FileText), { class: "h-5 w-5 text-red-500" }, null, _parent));
				_push(`</div><div><h1 class="text-sm font-bold text-slate-100 flex items-center gap-1.5"> Cetak Struk POS <span class="text-[9px] px-1.5 py-0.5 rounded bg-red-600 text-white font-bold uppercase tracking-wider">Receipt 80mm</span></h1><p class="text-[10px] text-slate-400 mt-0.5">Struk Transaksi: ${ssrInterpolate(__props.transaction.transaction_number)}</p></div></div><div class="flex items-center gap-3"><button class="px-4 py-2 bg-red-600 hover:bg-red-500 text-white rounded-xl text-xs font-bold transition-all cursor-pointer flex items-center gap-2 shadow-lg shadow-red-950/20 active:scale-95 animate-pulse">`);
				_push(ssrRenderComponent(unref(Printer), { class: "h-4 w-4" }, null, _parent));
				_push(`<span>Cetak Struk</span></button><button class="px-4 py-2 bg-slate-850 hover:bg-slate-800 border border-slate-700 text-slate-300 rounded-xl text-xs font-bold transition-all cursor-pointer flex items-center gap-2 active:scale-95">`);
				_push(ssrRenderComponent(unref(X), { class: "h-4 w-4" }, null, _parent));
				_push(`<span>Tutup</span></button></div></div><div class="my-8 print:my-0 flex justify-center w-full print:justify-start"><main class="w-[58mm] min-h-[100mm] bg-white text-black p-4 shadow-2xl relative border-t-8 border-red-600 print:shadow-none print:border-t-0 print:p-0 print:w-[58mm] print:m-0"><div class="space-y-4 font-mono text-black"><div class="space-y-1 text-black text-center flex flex-col items-center justify-center w-full">`);
				if (__props.thermalLogo) _push(`<img${ssrRenderAttr("src", __props.thermalLogo)} alt="Logo" class="max-h-14 max-w-full object-contain mb-1 block border-0 bg-transparent mx-auto">`);
				else _push(`<!---->`);
				_push(`<div class="font-extrabold text-[15px] tracking-widest uppercase text-center w-full">${ssrInterpolate(__props.appName)}</div><div class="text-[11px] font-bold uppercase tracking-wide text-center w-full">${ssrInterpolate(__props.transaction.outlet?.name || "CafePOS Store")}</div><div class="text-[10px] font-medium leading-tight text-center w-full pb-2"> Bukti Pembayaran POS </div></div><div class="border-t border-b border-dashed border-black py-2.5 space-y-1 text-[11px] leading-relaxed text-black"><div class="flex justify-between"><span>No.:</span><span class="font-bold">${ssrInterpolate(__props.transaction.transaction_number)}</span></div><div class="flex justify-between"><span>Tanggal:</span><span class="font-bold">${ssrInterpolate(formatDate(__props.transaction.created_at))}</span></div><div class="flex justify-between"><span>Kasir:</span><span class="font-bold">${ssrInterpolate(__props.transaction.user?.name || "-")}</span></div>`);
				if (__props.transaction.table) _push(`<div class="flex justify-between"><span>Meja (Table):</span><span class="font-bold">Meja ${ssrInterpolate(__props.transaction.table.number)}</span></div>`);
				else _push(`<!---->`);
				if (__props.transaction.customer) _push(`<div class="flex justify-between"><span>Pelanggan:</span><span class="font-bold">${ssrInterpolate(__props.transaction.customer.name)}</span></div>`);
				else _push(`<!---->`);
				_push(`<div class="flex justify-between"><span>Tipe:</span><span class="font-bold uppercase">${ssrInterpolate(__props.transaction.order_type ? __props.transaction.order_type.replace("_", " ") : "POS")}</span></div><div class="flex justify-between"><span>Status:</span><span class="font-bold uppercase">${ssrInterpolate(__props.transaction.status === "success" ? "AKTUAL" : "VOIDED")}</span></div>`);
				if (__props.transaction.queue_number) _push(`<div class="flex justify-between"><span>No. Antrean:</span><span class="font-bold text-[12px] border border-black text-black px-1.5 rounded">${ssrInterpolate(__props.transaction.queue_number)}</span></div>`);
				else _push(`<!---->`);
				_push(`</div><div class="space-y-3 py-1 text-black"><!--[-->`);
				ssrRenderList(__props.transaction.items, (item) => {
					_push(`<div class="space-y-1"><div class="font-bold text-[11px] leading-tight text-left">${ssrInterpolate(item.product?.name || "Unknown Item")}</div><div class="flex justify-between text-[10px] pl-3 leading-normal font-bold"><span>${ssrInterpolate(item.qty)} x ${ssrInterpolate(formatCurrency(item.price))} `);
					if (item.variant) _push(`<span class="font-bold uppercase ml-1.5">[${ssrInterpolate(item.variant)}]</span>`);
					else _push(`<!---->`);
					_push(`</span><span class="flex-shrink-0 ml-2 font-bold">${ssrInterpolate(formatCurrency(item.subtotal))}</span></div>`);
					if (item.modifiers && item.modifiers.length > 0) {
						_push(`<div class="pl-5 text-[9.5px] leading-normal italic font-medium"><!--[-->`);
						ssrRenderList(item.modifiers, (m) => {
							_push(`<div class="flex justify-between"><span>+ ${ssrInterpolate(m.name)}</span>`);
							if (m.price > 0) _push(`<span class="flex-shrink-0 ml-2">${ssrInterpolate(formatCurrency(m.price))}</span>`);
							else _push(`<!---->`);
							_push(`</div>`);
						});
						_push(`<!--]--></div>`);
					} else _push(`<!---->`);
					_push(`</div>`);
				});
				_push(`<!--]--></div><div class="space-y-1.5 text-[11px] border-t border-dashed border-black pt-3 text-black"><div class="flex justify-between"><span>Subtotal:</span><span>${ssrInterpolate(formatCurrency(__props.transaction.total_amount - __props.transaction.tax_amount - __props.transaction.service_charge_amount + __props.transaction.discount_amount))}</span></div>`);
				if (__props.transaction.discount_amount > 0) _push(`<div class="flex justify-between"><span>Diskon (Promo):</span><span>-${ssrInterpolate(formatCurrency(__props.transaction.discount_amount))}</span></div>`);
				else _push(`<!---->`);
				if (__props.transaction.service_charge_amount > 0) _push(`<div class="flex justify-between"><span>Service Charge:</span><span>${ssrInterpolate(formatCurrency(__props.transaction.service_charge_amount))}</span></div>`);
				else _push(`<!---->`);
				if (__props.transaction.tax_amount > 0) _push(`<div class="flex justify-between"><span>Pajak (Tax):</span><span>${ssrInterpolate(formatCurrency(__props.transaction.tax_amount))}</span></div>`);
				else _push(`<!---->`);
				_push(`<div class="border-t border-double border-black my-2"></div><div class="flex justify-between text-[11px] font-black uppercase"><span>TOTAL KESELURUHAN:</span><span>${ssrInterpolate(formatCurrency(__props.transaction.total_amount))}</span></div><div class="border-t border-dashed border-black my-2"></div><div class="flex justify-between"><span>Metode Pembayaran:</span><span class="font-bold uppercase">${ssrInterpolate(paymentLabel(__props.transaction.payment_method))}</span></div>`);
				if (__props.transaction.payment_method === "cash") {
					_push(`<!--[-->`);
					if (cashReceived.value !== null) _push(`<div class="flex justify-between"><span>Tunai Diterima:</span><span>${ssrInterpolate(formatCurrency(cashReceived.value))}</span></div>`);
					else _push(`<!---->`);
					if (changeDue.value !== null) _push(`<div class="flex justify-between font-bold"><span>Kembalian:</span><span>${ssrInterpolate(formatCurrency(changeDue.value))}</span></div>`);
					else _push(`<!---->`);
					_push(`<!--]-->`);
				} else _push(`<!---->`);
				_push(`</div><div class="text-center space-y-1.5 text-[10px] pt-4 border-t border-dashed border-black mt-4 text-black"><p class="font-extrabold text-[11px] uppercase tracking-wider">TERIMA KASIH</p><p>Atas Kunjungan &amp; Pembelian Anda</p><p class="italic text-[9.5px]">&quot;Fresh Coffee, Warm Vibes.&quot;</p><div class="border-t border-dotted border-black my-2 w-1/2 mx-auto"></div><p class="text-[9px]">Sistem POS: ${ssrInterpolate(__props.appName)}</p><p class="text-[8.5px]">Waktu Cetak: ${ssrInterpolate(printDateTime.value)}</p></div></div></main></div></div>`);
			}
			_push(`<!--]-->`);
		};
	}
});
//#endregion
//#region resources/js/Pages/CafePOS/Transactions/Print.vue
var _sfc_setup = Print_vue_vue_type_script_setup_true_lang_default.setup;
Print_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/Transactions/Print.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
var Print_default = Print_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { Print_default as default };
