import { Head } from "@inertiajs/vue3";
import { computed, defineComponent, unref, useSSRContext } from "vue";
import { ssrInterpolate, ssrRenderComponent, ssrRenderList } from "vue/server-renderer";
import { FileText, Printer, X } from "lucide-vue-next";
//#region resources/js/Pages/DashboardPrint.vue?vue&type=script&setup=true&lang.ts
var DashboardPrint_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
	__name: "DashboardPrint",
	__ssrInlineRender: true,
	props: {
		kpi: {},
		salesTrend: {},
		topProducts: {},
		paymentSplit: {},
		revenueByOutlet: {},
		lowStockAlerts: {},
		outlets: {},
		filters: {},
		appName: {}
	},
	setup(__props) {
		const props = __props;
		const activeOutletName = computed(() => {
			if (!props.filters.outlet_id) return "Semua Outlet";
			const found = props.outlets.find((o) => o.id === Number(props.filters.outlet_id));
			return found ? found.name : "Semua Outlet";
		});
		const formatMonth = (monthStr) => {
			if (!monthStr) return "-";
			try {
				const [year, month] = monthStr.split("-");
				return new Date(Number(year), Number(month) - 1, 1).toLocaleDateString("id-ID", {
					month: "long",
					year: "numeric"
				});
			} catch {
				return monthStr;
			}
		};
		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 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 Ringkasan - " + __props.appName }, null, _parent));
			_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-650/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"> Pratinjau Ringkasan POS <span class="text-[9px] px-1.5 py-0.5 rounded bg-red-600 text-white font-bold uppercase tracking-wider">Thermal 80mm</span></h1><p class="text-[10px] text-slate-400 mt-0.5">Format struk kasir, tekan cetak untuk mencetak ke printer.</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-[80mm] min-h-[120mm] bg-white text-black p-5 shadow-2xl relative border-t-8 border-red-600 print:shadow-none print:border-t-0 print:p-0 print:w-[80mm] print:m-0"><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 font-mono text-black"><div class="text-center space-y-1"><div class="font-extrabold text-[15px] tracking-widest uppercase text-black">${ssrInterpolate(__props.appName)}</div><div class="text-[11px] font-bold text-black uppercase tracking-wide">Laporan Ringkasan Bisnis</div></div><div class="border-t border-b border-dashed border-black py-2.5 space-y-1 text-[11px] text-black"><div class="flex justify-between"><span>Waktu Cetak:</span><span class="font-bold text-right">${ssrInterpolate(printDateTime.value)}</span></div><div class="flex justify-between"><span>Bulan Lap:</span><span class="font-bold uppercase text-right">${ssrInterpolate(formatMonth(__props.filters.month))}</span></div><div class="flex justify-between"><span>Outlet:</span><span class="font-bold text-right">${ssrInterpolate(activeOutletName.value)}</span></div><div class="flex justify-between"><span>Status Data:</span><span class="font-bold text-right">AKTUAL</span></div></div><div class="space-y-2 text-black"><div class="text-[12px] font-extrabold uppercase text-center tracking-wider border border-black p-1 bg-slate-150 print:bg-white"> RINGKASAN UTAMA </div><div class="space-y-1.5 text-[11px]"><div class="flex justify-between"><span>Pendapatan Hari Ini:</span><span class="font-bold">${ssrInterpolate(formatCurrency(__props.kpi.revenue_today))}</span></div><div class="flex justify-between"><span>Transaksi Hari Ini:</span><span class="font-bold">${ssrInterpolate(__props.kpi.tx_today)} Txn</span></div><div class="flex justify-between"><span>Rata-rata Tiket Hari Ini:</span><span class="font-bold">${ssrInterpolate(formatCurrency(__props.kpi.avg_ticket_today))}</span></div><div class="border-t border-dashed border-black my-2"></div><div class="flex justify-between font-bold"><span>Omzet Bulan Ini:</span><span class="font-extrabold">${ssrInterpolate(formatCurrency(__props.kpi.revenue_month))}</span></div><div class="flex justify-between"><span>Transaksi Bulan Ini:</span><span class="font-bold">${ssrInterpolate(__props.kpi.tx_month)} Txn</span></div></div></div><div class="border-t border-dashed border-black my-2"></div><div class="space-y-2 text-black"><div class="text-[12px] font-extrabold uppercase text-center tracking-wider border border-black p-1 bg-slate-150 print:bg-white"> MENU TERLARIS (TOP 5) </div>`);
			if (__props.topProducts.length === 0) _push(`<div class="text-center text-[11px] italic py-2"> Tidak ada data penjualan </div>`);
			else {
				_push(`<div class="space-y-2.5 text-[11px]"><!--[-->`);
				ssrRenderList(__props.topProducts, (item, idx) => {
					_push(`<div class="space-y-0.5"><div class="font-bold flex justify-between"><span>#${ssrInterpolate(idx + 1)} ${ssrInterpolate(item.name)}</span><span class="font-bold">${ssrInterpolate(formatCurrency(item.sales))}</span></div><div class="flex justify-between text-[10px] pl-3"><span>Kategori: ${ssrInterpolate(item.category)}</span><span class="font-bold">${ssrInterpolate(item.qty)} Porsi</span></div></div>`);
				});
				_push(`<!--]--></div>`);
			}
			_push(`</div><div class="border-t border-dashed border-black my-2"></div><div class="space-y-2 text-black"><div class="text-[12px] font-extrabold uppercase text-center tracking-wider border border-black p-1 bg-slate-150 print:bg-white"> METODE PEMBAYARAN </div>`);
			if (__props.paymentSplit.length === 0) _push(`<div class="text-center text-[11px] italic py-2"> Tidak ada transaksi </div>`);
			else {
				_push(`<div class="space-y-1.5 text-[11px]"><!--[-->`);
				ssrRenderList(__props.paymentSplit, (p) => {
					_push(`<div class="flex justify-between"><span>${ssrInterpolate(paymentLabel(p.method))} (${ssrInterpolate(p.count)} Txn)</span><span class="font-bold">${ssrInterpolate(formatCurrency(p.total))}</span></div>`);
				});
				_push(`<!--]--></div>`);
			}
			_push(`</div>`);
			if (!__props.filters.outlet_id) {
				_push(`<!--[--><div class="border-t border-dashed border-black my-2"></div><div class="space-y-2 text-black"><div class="text-[12px] font-extrabold uppercase text-center tracking-wider border border-black p-1 bg-slate-150 print:bg-white"> KONTRIBUSI OUTLET </div>`);
				if (__props.revenueByOutlet.length === 0) _push(`<div class="text-center text-[11px] italic py-2"> Tidak ada data outlet </div>`);
				else {
					_push(`<div class="space-y-1.5 text-[11px]"><!--[-->`);
					ssrRenderList(__props.revenueByOutlet, (r) => {
						_push(`<div class="flex justify-between"><span>${ssrInterpolate(r.outlet)} (${ssrInterpolate(r.count)} Txn)</span><span class="font-bold">${ssrInterpolate(formatCurrency(r.total))}</span></div>`);
					});
					_push(`<!--]--></div>`);
				}
				_push(`</div><!--]-->`);
			} else _push(`<!---->`);
			_push(`<div class="border-t border-dashed border-black my-2"></div><div class="space-y-2 text-black"><div class="text-[12px] font-extrabold uppercase text-center tracking-wider border border-black p-1 bg-slate-150 print:bg-white"> PERINGATAN STOK RENDAH </div>`);
			if (__props.lowStockAlerts.length === 0) _push(`<div class="text-center text-[11px] font-bold py-2 uppercase tracking-wide"> [ SEMUA STOK AMAN ] </div>`);
			else {
				_push(`<div class="space-y-2.5 text-[11px]"><!--[-->`);
				ssrRenderList(__props.lowStockAlerts.slice(0, 10), (item, idx) => {
					_push(`<div class="space-y-0.5"><div class="font-bold flex justify-between"><span class="truncate pr-2">• ${ssrInterpolate(item.name)}</span><span class="flex-shrink-0 font-bold">${ssrInterpolate(item.stock_qty)} / ${ssrInterpolate(item.threshold_qty)} ${ssrInterpolate(item.unit)}</span></div><div class="text-[10px] pl-3 opacity-90"> Outlet: ${ssrInterpolate(item.outlet_name)}</div></div>`);
				});
				_push(`<!--]-->`);
				if (__props.lowStockAlerts.length > 10) _push(`<div class="text-[10px] text-center italic mt-1 font-semibold"> dan ${ssrInterpolate(__props.lowStockAlerts.length - 10)} item lainnya... </div>`);
				else _push(`<!---->`);
				_push(`</div>`);
			}
			_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">SISTEM POS ENTERPRISE</p><p>Dicetak otomatis via Dashboard Admin.</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-[8.5px]">Waktu Cetak: ${ssrInterpolate(printDateTime.value)}</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/DashboardPrint.vue
var _sfc_setup = DashboardPrint_vue_vue_type_script_setup_true_lang_default.setup;
DashboardPrint_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/DashboardPrint.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
var DashboardPrint_default = DashboardPrint_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { DashboardPrint_default as default };
