import { Head } from "@inertiajs/vue3";
import { computed, defineComponent, unref, useSSRContext } from "vue";
import { ssrInterpolate, ssrRenderClass, ssrRenderComponent, ssrRenderList } from "vue/server-renderer";
import { FileText, Printer, Sparkles, 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: {}
	},
	setup(__props) {
		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));
			_push(`<div class="min-h-screen bg-slate-900 text-slate-800 font-mono text-[11px] 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"><main class="w-[80mm] 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-full"><div class="absolute -top-3 left-0 right-0 h-3 flex overflow-hidden select-none print:hidden"><!--[-->`);
			ssrRenderList(20, (i) => {
				_push(`<div class="w-4 h-4 bg-white rotate-45 transform origin-top-left -translate-y-2"></div>`);
			});
			_push(`<!--]--></div><div class="space-y-4"><div class="text-center space-y-1"><div class="font-black text-sm tracking-widest uppercase flex items-center justify-center gap-1">`);
			_push(ssrRenderComponent(unref(Sparkles), { class: "h-3.5 w-3.5 text-red-600 print:hidden" }, null, _parent));
			_push(` ${ssrInterpolate(__props.appName)}</div><div class="text-[9px] font-bold text-slate-500 uppercase tracking-wide">${ssrInterpolate(__props.transaction.outlet?.name || "CafePOS Store")}</div></div><div class="border-t border-b border-dashed border-slate-300 py-2.5 space-y-1 text-[10px]"><div class="flex justify-between"><span>No. Transaksi:</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><div class="flex justify-between"><span>Status:</span><span class="${ssrRenderClass([__props.transaction.status === "success" ? "text-slate-900" : "text-rose-500", "font-bold uppercase"])}">${ssrInterpolate(__props.transaction.status === "success" ? "AKTUAL (SUKSES)" : "VOIDED (BATAL)")}</span></div></div><div class="text-center font-bold tracking-tighter text-slate-400 select-none">================================</div><div class="space-y-2.5"><!--[-->`);
			ssrRenderList(__props.transaction.items, (item) => {
				_push(`<div class="space-y-0.5"><div class="font-bold flex justify-between text-[10px]"><span>${ssrInterpolate(item.product?.name || "Unknown Item")}</span><span>${ssrInterpolate(formatCurrency(item.subtotal))}</span></div><div class="flex justify-between text-[9px] text-slate-600 pl-3"><span>${ssrInterpolate(item.qty)}x ${ssrInterpolate(formatCurrency(item.price))} `);
				if (item.variant) _push(`<span class="uppercase ml-1">[${ssrInterpolate(item.variant)}]</span>`);
				else _push(`<!---->`);
				_push(`</span></div></div>`);
			});
			_push(`<!--]--></div><div class="text-center font-bold tracking-tighter text-slate-400 select-none">================================</div><div class="space-y-1.5 text-[10px]"><div class="flex justify-between"><span>Subtotal:</span><span>${ssrInterpolate(formatCurrency(__props.transaction.total_amount - __props.transaction.tax_amount - __props.transaction.service_charge_amount))}</span></div>`);
			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-dashed border-slate-300 my-1"></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><div class="text-center font-bold tracking-tighter text-slate-400 select-none">================================</div><div class="flex justify-between text-[10px]"><span>Metode Pembayaran:</span><span class="font-bold uppercase">${ssrInterpolate(paymentLabel(__props.transaction.payment_method))}</span></div><div class="text-center font-bold tracking-tighter text-slate-400 select-none">================================</div><div class="text-center space-y-1 text-[9px] text-slate-500 py-2"><p class="font-bold text-black uppercase tracking-wide">TERIMA KASIH</p><p>Atas Kunjungan &amp; Pembelian Anda.</p><p>Printed on: ${ssrInterpolate(printDateTime.value)}</p><p class="italic mt-1.5">&quot;Fresh Coffee, Warm Vibes.&quot;</p></div></div><div class="absolute -bottom-3 left-0 right-0 h-3 flex overflow-hidden select-none print:hidden rotate-180"><!--[-->`);
			ssrRenderList(20, (i) => {
				_push(`<div class="w-4 h-4 bg-white rotate-45 transform origin-top-left -translate-y-2"></div>`);
			});
			_push(`<!--]--></div></main></div></div><!--]-->`);
		};
	}
});
//#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 };
