import { t as AdminLayout_default } from "./AdminLayout-DcKfAlG1.js";
import { Head, router, useForm } from "@inertiajs/vue3";
import { Fragment, computed, createBlock, createCommentVNode, createVNode, defineComponent, openBlock, ref, renderList, toDisplayString, unref, useSSRContext, vModelSelect, vModelText, withCtx, withDirectives, withModifiers } from "vue";
import { ssrIncludeBooleanAttr, ssrInterpolate, ssrLooseContain, ssrLooseEqual, ssrRenderAttr, ssrRenderClass, ssrRenderComponent, ssrRenderList } from "vue/server-renderer";
import { CheckCircle, Edit2, Eye, FileText, Plus, Send, Trash2, X } from "lucide-vue-next";
//#region resources/js/Pages/CafePOS/PurchaseOrders/Index.vue?vue&type=script&setup=true&lang.ts
var Index_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
	__name: "Index",
	__ssrInlineRender: true,
	props: {
		purchaseOrders: {},
		outlets: {},
		suppliers: {},
		ingredients: {},
		isCashier: { type: Boolean },
		filters: {}
	},
	setup(__props) {
		const props = __props;
		const outletFilter = ref(props.filters.outlet_id || "");
		const statusFilter = ref(props.filters.status || "");
		const applyFilters = () => {
			router.get(route("purchase-orders.index"), {
				outlet_id: outletFilter.value,
				status: statusFilter.value
			}, {
				preserveState: true,
				replace: true
			});
		};
		const isFormModalOpen = ref(false);
		const isDetailModalOpen = ref(false);
		const editingPO = ref(null);
		const selectedPO = ref(null);
		const form = useForm({
			outlet_id: props.outlets[0] ? props.outlets[0].id : "",
			supplier_id: props.suppliers[0] ? props.suppliers[0].id : "",
			notes: "",
			items: [{
				ingredient_id: "",
				qty: 1,
				price: 0
			}]
		});
		const openCreateModal = () => {
			editingPO.value = null;
			form.reset();
			form.clearErrors();
			form.outlet_id = props.outlets[0] ? props.outlets[0].id : "";
			form.supplier_id = props.suppliers[0] ? props.suppliers[0].id : "";
			form.notes = "";
			form.items = [{
				ingredient_id: "",
				qty: 1,
				price: 0
			}];
			isFormModalOpen.value = true;
		};
		const openEditModal = (po) => {
			editingPO.value = po;
			form.clearErrors();
			form.outlet_id = po.outlet_id;
			form.supplier_id = po.supplier_id;
			form.notes = po.notes || "";
			form.items = po.items ? po.items.map((item) => ({
				ingredient_id: item.ingredient_id,
				qty: Number(item.qty),
				price: Number(item.price)
			})) : [{
				ingredient_id: "",
				qty: 1,
				price: 0
			}];
			isFormModalOpen.value = true;
		};
		const openDetailModal = (po) => {
			selectedPO.value = po;
			isDetailModalOpen.value = true;
		};
		const addFormItem = () => {
			form.items.push({
				ingredient_id: "",
				qty: 1,
				price: 0
			});
		};
		const removeFormItem = (idx) => {
			if (form.items.length > 1) form.items.splice(idx, 1);
		};
		const handleIngredientChange = (idx) => {
			const selectedId = Number(form.items[idx].ingredient_id);
			const ing = props.ingredients.find((i) => i.id === selectedId);
			if (ing) form.items[idx].price = Number(ing.purchase_price);
		};
		const formSubtotal = computed(() => {
			return form.items.reduce((sum, item) => sum + item.qty * item.price, 0);
		});
		const submitForm = () => {
			if (editingPO.value) form.put(route("purchase-orders.update", editingPO.value.id), { onSuccess: () => {
				isFormModalOpen.value = false;
				form.reset();
			} });
			else form.post(route("purchase-orders.store"), { onSuccess: () => {
				isFormModalOpen.value = false;
				form.reset();
			} });
		};
		const sendPO = (po) => {
			if (confirm(`Apakah Anda yakin ingin mengirim PO "${po.po_number}" ke Pemasok?`)) router.post(route("purchase-orders.send", po.id));
		};
		const receivePO = (po) => {
			if (confirm(`Apakah Anda yakin telah menerima kiriman barang dari PO "${po.po_number}"? Ini akan secara otomatis menambah stok bahan baku di outlet.`)) router.post(route("purchase-orders.receive", po.id));
		};
		const deletePO = (po) => {
			if (confirm(`Hapus Purchase Order "${po.po_number}" secara permanen?`)) router.delete(route("purchase-orders.destroy", po.id));
		};
		const getStatusClass = (status) => {
			switch (status) {
				case "draft": return "bg-slate-500/10 text-slate-600 dark:text-slate-400 border-slate-500/20";
				case "sent": return "bg-indigo-500/10 text-indigo-600 dark:text-indigo-400 border-indigo-500/20";
				case "received": return "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20";
				case "cancelled": return "bg-rose-500/10 text-rose-600 dark:text-rose-400 border-rose-500/20";
				default: return "bg-slate-500/10 text-slate-600 border-slate-500/20";
			}
		};
		const formatDate = (dateStr) => {
			return new Date(dateStr).toLocaleDateString("id-ID", {
				year: "numeric",
				month: "short",
				day: "numeric",
				hour: "2-digit",
				minute: "2-digit"
			});
		};
		return (_ctx, _push, _parent, _attrs) => {
			_push(`<!--[-->`);
			_push(ssrRenderComponent(unref(Head), { title: "Purchase Orders & GRN" }, null, _parent));
			_push(ssrRenderComponent(AdminLayout_default, null, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) {
						_push(`<div class="space-y-6"${_scopeId}><div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4"${_scopeId}><div${_scopeId}><h1 class="text-2xl font-bold tracking-tight text-slate-900 dark:text-slate-50"${_scopeId}>Purchase Orders (PO) &amp; Penerimaan Barang</h1><p class="text-sm text-slate-500 dark:text-slate-400 mt-1"${_scopeId}> Pesan bahan baku ke Pemasok, kelola draf pembelian, dan lakukan konfirmasi penerimaan barang (GRN) untuk update stok otomatis. </p></div><button class="px-4 py-2.5 bg-[#8c5a3c] hover:bg-[#734a31] text-white rounded-xl text-xs font-bold transition-all shadow-md flex items-center gap-2 cursor-pointer self-start"${_scopeId}>`);
						_push(ssrRenderComponent(unref(Plus), { class: "h-4.5 w-4.5" }, null, _parent, _scopeId));
						_push(`<span${_scopeId}>Buat PO Baru</span></button></div><div class="bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-xl p-5 shadow-sm flex flex-col md:flex-row gap-4 items-end"${_scopeId}>`);
						if (!__props.isCashier) {
							_push(`<div class="w-full md:w-64"${_scopeId}><label class="block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase mb-1.5"${_scopeId}>Filter Outlet</label><select class="w-full h-10 px-3 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 focus:border-[#8c5a3c] text-slate-900 dark:text-slate-100"${_scopeId}><option value=""${ssrIncludeBooleanAttr(Array.isArray(outletFilter.value) ? ssrLooseContain(outletFilter.value, "") : ssrLooseEqual(outletFilter.value, "")) ? " selected" : ""}${_scopeId}>Semua Outlet</option><!--[-->`);
							ssrRenderList(__props.outlets, (ot) => {
								_push(`<option${ssrRenderAttr("value", String(ot.id))}${ssrIncludeBooleanAttr(Array.isArray(outletFilter.value) ? ssrLooseContain(outletFilter.value, String(ot.id)) : ssrLooseEqual(outletFilter.value, String(ot.id))) ? " selected" : ""}${_scopeId}>${ssrInterpolate(ot.name)}</option>`);
							});
							_push(`<!--]--></select></div>`);
						} else _push(`<!---->`);
						_push(`<div class="w-full md:w-48"${_scopeId}><label class="block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase mb-1.5"${_scopeId}>Filter Status</label><select class="w-full h-10 px-3 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 focus:border-[#8c5a3c] text-slate-900 dark:text-slate-100"${_scopeId}><option value=""${ssrIncludeBooleanAttr(Array.isArray(statusFilter.value) ? ssrLooseContain(statusFilter.value, "") : ssrLooseEqual(statusFilter.value, "")) ? " selected" : ""}${_scopeId}>Semua Status</option><option value="draft"${ssrIncludeBooleanAttr(Array.isArray(statusFilter.value) ? ssrLooseContain(statusFilter.value, "draft") : ssrLooseEqual(statusFilter.value, "draft")) ? " selected" : ""}${_scopeId}>Draft</option><option value="sent"${ssrIncludeBooleanAttr(Array.isArray(statusFilter.value) ? ssrLooseContain(statusFilter.value, "sent") : ssrLooseEqual(statusFilter.value, "sent")) ? " selected" : ""}${_scopeId}>Sent (Dikirim)</option><option value="received"${ssrIncludeBooleanAttr(Array.isArray(statusFilter.value) ? ssrLooseContain(statusFilter.value, "received") : ssrLooseEqual(statusFilter.value, "received")) ? " selected" : ""}${_scopeId}>Received (Diterima / GRN)</option><option value="cancelled"${ssrIncludeBooleanAttr(Array.isArray(statusFilter.value) ? ssrLooseContain(statusFilter.value, "cancelled") : ssrLooseEqual(statusFilter.value, "cancelled")) ? " selected" : ""}${_scopeId}>Cancelled (Batal)</option></select></div></div><div class="bg-white dark:bg-slate-955 border border-slate-200 dark:border-slate-805 rounded-xl shadow-sm overflow-hidden"${_scopeId}><div class="overflow-x-auto"${_scopeId}><table class="w-full text-left text-xs border-collapse"${_scopeId}><thead${_scopeId}><tr class="border-b border-slate-200 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-900/30 text-slate-500 dark:text-slate-400 font-semibold uppercase tracking-wider"${_scopeId}><th class="p-4"${_scopeId}>No. PO</th><th class="p-4"${_scopeId}>Outlet</th><th class="p-4"${_scopeId}>Pemasok</th><th class="p-4"${_scopeId}>Tanggal Buat</th><th class="p-4 text-right"${_scopeId}>Total Biaya</th><th class="p-4 text-center"${_scopeId}>Status</th><th class="p-4 text-right"${_scopeId}>Aksi</th></tr></thead><tbody class="divide-y divide-slate-200 dark:divide-slate-800 text-slate-700 dark:text-slate-300"${_scopeId}>`);
						if (__props.purchaseOrders.length === 0) _push(`<tr${_scopeId}><td colspan="7" class="p-8 text-center text-slate-400 italic"${_scopeId}> Tidak ada data Purchase Order. </td></tr>`);
						else _push(`<!---->`);
						_push(`<!--[-->`);
						ssrRenderList(__props.purchaseOrders, (po) => {
							_push(`<tr class="hover:bg-slate-50/50 dark:hover:bg-slate-900/10 transition-colors"${_scopeId}><td class="p-4 font-mono font-bold text-[#8c5a3c]"${_scopeId}>${ssrInterpolate(po.po_number)}</td><td class="p-4 font-semibold"${_scopeId}>${ssrInterpolate(po.outlet?.name)}</td><td class="p-4 font-semibold"${_scopeId}>${ssrInterpolate(po.supplier?.name)}</td><td class="p-4 text-slate-500"${_scopeId}>${ssrInterpolate(formatDate(po.created_at))}</td><td class="p-4 text-right font-bold text-slate-900 dark:text-slate-100"${_scopeId}>Rp ${ssrInterpolate(Number(po.total_amount).toLocaleString("id-ID"))}</td><td class="p-4 text-center"${_scopeId}><span class="${ssrRenderClass(["px-2 py-0.5 border rounded-full text-[10px] font-bold uppercase tracking-wider", getStatusClass(po.status)])}"${_scopeId}>${ssrInterpolate(po.status)}</span></td><td class="p-4 text-right"${_scopeId}><div class="flex items-center justify-end gap-1.5"${_scopeId}><button title="Detail Item" class="p-1.5 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-500 hover:text-slate-800 dark:hover:text-slate-200 rounded-lg cursor-pointer"${_scopeId}>`);
							_push(ssrRenderComponent(unref(Eye), { class: "h-4 w-4" }, null, _parent, _scopeId));
							_push(`</button>`);
							if (po.status === "draft") {
								_push(`<!--[--><button title="Kirim ke Supplier" class="p-1.5 hover:bg-indigo-50 dark:hover:bg-indigo-950/20 text-indigo-650 hover:text-indigo-700 rounded-lg cursor-pointer"${_scopeId}>`);
								_push(ssrRenderComponent(unref(Send), { class: "h-4 w-4" }, null, _parent, _scopeId));
								_push(`</button><button title="Ubah PO" class="p-1.5 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-500 hover:text-slate-850 dark:hover:text-slate-200 rounded-lg cursor-pointer"${_scopeId}>`);
								_push(ssrRenderComponent(unref(Edit2), { class: "h-4 w-4" }, null, _parent, _scopeId));
								_push(`</button><!--]-->`);
							} else _push(`<!---->`);
							if (po.status === "sent") {
								_push(`<button title="Konfirmasi Barang Diterima (GRN)" class="p-1.5 hover:bg-emerald-50 dark:hover:bg-emerald-955/20 text-emerald-600 hover:text-emerald-700 rounded-lg cursor-pointer"${_scopeId}>`);
								_push(ssrRenderComponent(unref(CheckCircle), { class: "h-4 w-4" }, null, _parent, _scopeId));
								_push(`</button>`);
							} else _push(`<!---->`);
							if (po.status === "draft" || po.status === "cancelled") {
								_push(`<button title="Hapus" class="p-1.5 hover:bg-rose-50 dark:hover:bg-rose-955/20 text-rose-600 hover:text-rose-700 rounded-lg cursor-pointer"${_scopeId}>`);
								_push(ssrRenderComponent(unref(Trash2), { class: "h-4 w-4" }, null, _parent, _scopeId));
								_push(`</button>`);
							} else _push(`<!---->`);
							_push(`</div></td></tr>`);
						});
						_push(`<!--]--></tbody></table></div></div>`);
						if (isFormModalOpen.value) {
							_push(`<div class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/60 backdrop-blur-sm"${_scopeId}><div class="bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-2xl shadow-2xl w-full max-w-2xl overflow-hidden transform transition-all"${_scopeId}><div class="px-6 py-4 border-b border-slate-200 dark:border-slate-800 flex items-center justify-between"${_scopeId}><h3 class="text-sm font-extrabold text-slate-900 dark:text-slate-100"${_scopeId}>${ssrInterpolate(editingPO.value ? "Edit Purchase Order" : "Buat Purchase Order Baru")}</h3><button class="p-1.5 hover:bg-slate-100 dark:hover:bg-slate-900 rounded-lg text-slate-400 cursor-pointer"${_scopeId}>`);
							_push(ssrRenderComponent(unref(X), { class: "h-4 w-4" }, null, _parent, _scopeId));
							_push(`</button></div><form class="p-6 space-y-6"${_scopeId}><div class="grid grid-cols-2 gap-4"${_scopeId}><div${_scopeId}><label class="block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase tracking-wider mb-1.5"${_scopeId}>Outlet Tujuan</label><select required${ssrIncludeBooleanAttr(__props.isCashier || !!editingPO.value) ? " disabled" : ""} class="w-full h-10 px-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-[#8c5a3c]/20 focus:border-[#8c5a3c] text-slate-900 dark:text-slate-100 cursor-pointer"${_scopeId}><!--[-->`);
							ssrRenderList(__props.outlets, (ot) => {
								_push(`<option${ssrRenderAttr("value", ot.id)}${ssrIncludeBooleanAttr(Array.isArray(unref(form).outlet_id) ? ssrLooseContain(unref(form).outlet_id, ot.id) : ssrLooseEqual(unref(form).outlet_id, ot.id)) ? " selected" : ""}${_scopeId}>${ssrInterpolate(ot.name)}</option>`);
							});
							_push(`<!--]--></select></div><div${_scopeId}><label class="block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase tracking-wider mb-1.5"${_scopeId}>Pilih Pemasok (Supplier)</label><select required${ssrIncludeBooleanAttr(!!editingPO.value) ? " disabled" : ""} class="w-full h-10 px-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-[#8c5a3c]/20 focus:border-[#8c5a3c] text-slate-900 dark:text-slate-100 cursor-pointer"${_scopeId}><!--[-->`);
							ssrRenderList(__props.suppliers, (s) => {
								_push(`<option${ssrRenderAttr("value", s.id)}${ssrIncludeBooleanAttr(Array.isArray(unref(form).supplier_id) ? ssrLooseContain(unref(form).supplier_id, s.id) : ssrLooseEqual(unref(form).supplier_id, s.id)) ? " selected" : ""}${_scopeId}>${ssrInterpolate(s.name)}</option>`);
							});
							_push(`<!--]--></select></div></div><div class="space-y-3"${_scopeId}><div class="flex items-center justify-between"${_scopeId}><label class="block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase tracking-wider"${_scopeId}>Item Bahan Baku</label><button type="button" class="px-2.5 py-1.5 bg-[#8c5a3c]/10 text-[#8c5a3c] hover:bg-[#8c5a3c]/20 text-[10px] font-bold rounded-lg transition-colors cursor-pointer flex items-center gap-1"${_scopeId}>`);
							_push(ssrRenderComponent(unref(Plus), { class: "h-3 w-3" }, null, _parent, _scopeId));
							_push(`<span${_scopeId}>Tambah Item</span></button></div><div class="space-y-3 max-h-56 overflow-y-auto pr-1"${_scopeId}><!--[-->`);
							ssrRenderList(unref(form).items, (item, idx) => {
								_push(`<div class="flex gap-3 items-end"${_scopeId}><div class="flex-1"${_scopeId}><select required class="w-full h-10 px-2.5 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100 cursor-pointer"${_scopeId}><option value=""${ssrIncludeBooleanAttr(Array.isArray(item.ingredient_id) ? ssrLooseContain(item.ingredient_id, "") : ssrLooseEqual(item.ingredient_id, "")) ? " selected" : ""}${_scopeId}>Pilih bahan baku...</option><!--[-->`);
								ssrRenderList(__props.ingredients, (ing) => {
									_push(`<option${ssrRenderAttr("value", ing.id)}${ssrIncludeBooleanAttr(Array.isArray(item.ingredient_id) ? ssrLooseContain(item.ingredient_id, ing.id) : ssrLooseEqual(item.ingredient_id, ing.id)) ? " selected" : ""}${_scopeId}>${ssrInterpolate(ing.name)} (${ssrInterpolate(ing.unit)})</option>`);
								});
								_push(`<!--]--></select></div><div class="w-24"${_scopeId}><input type="number"${ssrRenderAttr("value", item.qty)} required min="0.0001" step="any" placeholder="Qty" class="w-full h-10 px-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100"${_scopeId}></div><div class="w-32"${_scopeId}><input type="number"${ssrRenderAttr("value", item.price)} required min="0" placeholder="Harga Satuan" class="w-full h-10 px-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100"${_scopeId}></div><button type="button"${ssrIncludeBooleanAttr(unref(form).items.length <= 1) ? " disabled" : ""} class="h-10 w-10 border border-slate-200 dark:border-slate-700 rounded-xl flex items-center justify-center text-slate-450 hover:text-rose-600 disabled:opacity-30 cursor-pointer"${_scopeId}>`);
								_push(ssrRenderComponent(unref(Trash2), { class: "h-4 w-4" }, null, _parent, _scopeId));
								_push(`</button></div>`);
							});
							_push(`<!--]--></div></div><div${_scopeId}><label class="block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase tracking-wider mb-1.5"${_scopeId}>Catatan Tambahan / Keterangan</label><textarea placeholder="Contoh: Pengiriman paling lambat hari Selasa pagi..." rows="2" class="w-full p-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100"${_scopeId}>${ssrInterpolate(unref(form).notes)}</textarea></div><div class="flex items-center justify-between pt-4 border-t border-slate-100 dark:border-slate-800"${_scopeId}><div${_scopeId}><span class="text-[10px] text-slate-400 font-bold uppercase tracking-wider"${_scopeId}>Total Estimasi Biaya</span><h4 class="text-base font-black text-slate-900 dark:text-slate-100 mt-0.5"${_scopeId}>Rp ${ssrInterpolate(formSubtotal.value.toLocaleString("id-ID"))}</h4></div><div class="flex gap-3"${_scopeId}><button type="button" class="px-4 py-2 border border-slate-200 dark:border-slate-800 text-slate-750 dark:text-slate-300 text-xs font-bold rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 cursor-pointer"${_scopeId}> Batal </button><button type="submit"${ssrIncludeBooleanAttr(unref(form).processing) ? " disabled" : ""} class="px-5 py-2 bg-[#8c5a3c] hover:bg-[#734a31] text-white text-xs font-bold rounded-xl cursor-pointer"${_scopeId}>${ssrInterpolate(unref(form).processing ? "Menyimpan..." : editingPO.value ? "Simpan Perubahan" : "Buat PO (Draft)")}</button></div></div></form></div></div>`);
						} else _push(`<!---->`);
						if (isDetailModalOpen.value && selectedPO.value) {
							_push(`<div class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/60 backdrop-blur-sm animate-fade-in"${_scopeId}><div class="bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-2xl shadow-2xl w-full max-w-xl overflow-hidden p-6 space-y-6 animate-in zoom-in-95 duration-200"${_scopeId}><div class="flex items-center justify-between border-b border-slate-100 dark:border-slate-800 pb-3"${_scopeId}><div class="flex items-center gap-2"${_scopeId}>`);
							_push(ssrRenderComponent(unref(FileText), { class: "h-5 w-5 text-[#8c5a3c]" }, null, _parent, _scopeId));
							_push(`<div${_scopeId}><h3 class="text-sm font-extrabold text-slate-900 dark:text-slate-100"${_scopeId}>Rincian Purchase Order</h3><p class="text-[10px] text-slate-400 font-mono"${_scopeId}>${ssrInterpolate(selectedPO.value.po_number)}</p></div></div><button class="p-1.5 hover:bg-slate-100 dark:hover:bg-slate-900 rounded-lg text-slate-400 cursor-pointer"${_scopeId}>`);
							_push(ssrRenderComponent(unref(X), { class: "h-4 w-4" }, null, _parent, _scopeId));
							_push(`</button></div><div class="grid grid-cols-2 gap-4 text-xs"${_scopeId}><div class="space-y-1"${_scopeId}><span class="text-[9px] font-bold text-slate-400 uppercase tracking-wider"${_scopeId}>Outlet Penerima</span><p class="font-bold text-slate-850 dark:text-slate-200"${_scopeId}>${ssrInterpolate(selectedPO.value.outlet?.name)}</p></div><div class="space-y-1"${_scopeId}><span class="text-[9px] font-bold text-slate-400 uppercase tracking-wider"${_scopeId}>Pemasok</span><p class="font-bold text-slate-850 dark:text-slate-200"${_scopeId}>${ssrInterpolate(selectedPO.value.supplier?.name)}</p></div><div class="space-y-1"${_scopeId}><span class="text-[9px] font-bold text-slate-400 uppercase tracking-wider"${_scopeId}>Tanggal Dibuat</span><p class="text-slate-650 dark:text-slate-350"${_scopeId}>${ssrInterpolate(formatDate(selectedPO.value.created_at))}</p></div><div class="space-y-1"${_scopeId}><span class="text-[9px] font-bold text-slate-400 uppercase tracking-wider"${_scopeId}>Status PO</span><div${_scopeId}><span class="${ssrRenderClass(["px-2 py-0.5 border rounded-full text-[9px] font-bold uppercase tracking-wider", getStatusClass(selectedPO.value.status)])}"${_scopeId}>${ssrInterpolate(selectedPO.value.status)}</span></div></div></div><div class="space-y-2"${_scopeId}><label class="block text-[10px] font-extrabold text-slate-450 dark:text-slate-500 uppercase tracking-wider"${_scopeId}>Daftar Bahan Baku Pesanan</label><div class="border border-slate-150 dark:border-slate-800 rounded-xl overflow-hidden max-h-48 overflow-y-auto"${_scopeId}><table class="w-full text-left text-xs border-collapse"${_scopeId}><thead${_scopeId}><tr class="bg-slate-50 dark:bg-slate-900 border-b border-slate-150 dark:border-slate-800 text-slate-500 font-bold"${_scopeId}><th class="p-2.5"${_scopeId}>Nama Bahan</th><th class="p-2.5 text-center"${_scopeId}>Jumlah</th><th class="p-2.5 text-right"${_scopeId}>Harga Satuan</th><th class="p-2.5 text-right pr-3"${_scopeId}>Subtotal</th></tr></thead><tbody class="divide-y divide-slate-100 dark:divide-slate-800 text-slate-700 dark:text-slate-300"${_scopeId}><!--[-->`);
							ssrRenderList(selectedPO.value.items, (item) => {
								_push(`<tr${_scopeId}><td class="p-2.5 font-bold"${_scopeId}>${ssrInterpolate(item.ingredient?.name)}</td><td class="p-2.5 text-center"${_scopeId}>${ssrInterpolate(Number(item.qty).toLocaleString("id-ID"))} ${ssrInterpolate(item.ingredient?.unit)}</td><td class="p-2.5 text-right"${_scopeId}>Rp ${ssrInterpolate(Number(item.price).toLocaleString("id-ID"))}</td><td class="p-2.5 text-right pr-3 font-bold"${_scopeId}>Rp ${ssrInterpolate(Number(item.subtotal).toLocaleString("id-ID"))}</td></tr>`);
							});
							_push(`<!--]--></tbody></table></div></div>`);
							if (selectedPO.value.notes) _push(`<div class="p-3 bg-slate-50 dark:bg-slate-950 rounded-xl border border-slate-100 dark:border-slate-800 text-xs"${_scopeId}><span class="block text-[9px] font-bold text-slate-400 uppercase tracking-wider mb-1"${_scopeId}>Catatan Tambahan</span><p class="text-slate-650 dark:text-slate-350 italic"${_scopeId}>&quot;${ssrInterpolate(selectedPO.value.notes)}&quot;</p></div>`);
							else _push(`<!---->`);
							_push(`<div class="flex items-center justify-between border-t border-slate-100 dark:border-slate-800 pt-4"${_scopeId}><div${_scopeId}><span class="text-[9px] text-slate-400 font-bold uppercase tracking-wider"${_scopeId}>Total Pembelian</span><h4 class="text-base font-black text-slate-900 dark:text-slate-100 mt-0.5"${_scopeId}>Rp ${ssrInterpolate(Number(selectedPO.value.total_amount).toLocaleString("id-ID"))}</h4></div><button class="px-5 py-2 border border-slate-200 dark:border-slate-800 text-slate-500 rounded-xl text-xs font-bold hover:bg-slate-50 dark:hover:bg-slate-800 cursor-pointer"${_scopeId}> Tutup Detail </button></div></div></div>`);
						} else _push(`<!---->`);
						_push(`</div>`);
					} else return [createVNode("div", { class: "space-y-6" }, [
						createVNode("div", { class: "flex flex-col sm:flex-row sm:items-center justify-between gap-4" }, [createVNode("div", null, [createVNode("h1", { class: "text-2xl font-bold tracking-tight text-slate-900 dark:text-slate-50" }, "Purchase Orders (PO) & Penerimaan Barang"), createVNode("p", { class: "text-sm text-slate-500 dark:text-slate-400 mt-1" }, " Pesan bahan baku ke Pemasok, kelola draf pembelian, dan lakukan konfirmasi penerimaan barang (GRN) untuk update stok otomatis. ")]), createVNode("button", {
							onClick: openCreateModal,
							class: "px-4 py-2.5 bg-[#8c5a3c] hover:bg-[#734a31] text-white rounded-xl text-xs font-bold transition-all shadow-md flex items-center gap-2 cursor-pointer self-start"
						}, [createVNode(unref(Plus), { class: "h-4.5 w-4.5" }), createVNode("span", null, "Buat PO Baru")])]),
						createVNode("div", { class: "bg-white dark:bg-slate-950 border border-slate-200 dark:border-slate-800 rounded-xl p-5 shadow-sm flex flex-col md:flex-row gap-4 items-end" }, [!__props.isCashier ? (openBlock(), createBlock("div", {
							key: 0,
							class: "w-full md:w-64"
						}, [createVNode("label", { class: "block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase mb-1.5" }, "Filter Outlet"), withDirectives(createVNode("select", {
							"onUpdate:modelValue": ($event) => outletFilter.value = $event,
							onChange: applyFilters,
							class: "w-full h-10 px-3 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 focus:border-[#8c5a3c] text-slate-900 dark:text-slate-100"
						}, [createVNode("option", { value: "" }, "Semua Outlet"), (openBlock(true), createBlock(Fragment, null, renderList(__props.outlets, (ot) => {
							return openBlock(), createBlock("option", {
								key: ot.id,
								value: String(ot.id)
							}, toDisplayString(ot.name), 9, ["value"]);
						}), 128))], 40, ["onUpdate:modelValue"]), [[vModelSelect, outletFilter.value]])])) : createCommentVNode("", true), createVNode("div", { class: "w-full md:w-48" }, [createVNode("label", { class: "block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase mb-1.5" }, "Filter Status"), withDirectives(createVNode("select", {
							"onUpdate:modelValue": ($event) => statusFilter.value = $event,
							onChange: applyFilters,
							class: "w-full h-10 px-3 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 focus:border-[#8c5a3c] text-slate-900 dark:text-slate-100"
						}, [
							createVNode("option", { value: "" }, "Semua Status"),
							createVNode("option", { value: "draft" }, "Draft"),
							createVNode("option", { value: "sent" }, "Sent (Dikirim)"),
							createVNode("option", { value: "received" }, "Received (Diterima / GRN)"),
							createVNode("option", { value: "cancelled" }, "Cancelled (Batal)")
						], 40, ["onUpdate:modelValue"]), [[vModelSelect, statusFilter.value]])])]),
						createVNode("div", { class: "bg-white dark:bg-slate-955 border border-slate-200 dark:border-slate-805 rounded-xl shadow-sm overflow-hidden" }, [createVNode("div", { class: "overflow-x-auto" }, [createVNode("table", { class: "w-full text-left text-xs border-collapse" }, [createVNode("thead", null, [createVNode("tr", { class: "border-b border-slate-200 dark:border-slate-800 bg-slate-50/50 dark:bg-slate-900/30 text-slate-500 dark:text-slate-400 font-semibold uppercase tracking-wider" }, [
							createVNode("th", { class: "p-4" }, "No. PO"),
							createVNode("th", { class: "p-4" }, "Outlet"),
							createVNode("th", { class: "p-4" }, "Pemasok"),
							createVNode("th", { class: "p-4" }, "Tanggal Buat"),
							createVNode("th", { class: "p-4 text-right" }, "Total Biaya"),
							createVNode("th", { class: "p-4 text-center" }, "Status"),
							createVNode("th", { class: "p-4 text-right" }, "Aksi")
						])]), createVNode("tbody", { class: "divide-y divide-slate-200 dark:divide-slate-800 text-slate-700 dark:text-slate-300" }, [__props.purchaseOrders.length === 0 ? (openBlock(), createBlock("tr", { key: 0 }, [createVNode("td", {
							colspan: "7",
							class: "p-8 text-center text-slate-400 italic"
						}, " Tidak ada data Purchase Order. ")])) : createCommentVNode("", true), (openBlock(true), createBlock(Fragment, null, renderList(__props.purchaseOrders, (po) => {
							return openBlock(), createBlock("tr", {
								key: po.id,
								class: "hover:bg-slate-50/50 dark:hover:bg-slate-900/10 transition-colors"
							}, [
								createVNode("td", { class: "p-4 font-mono font-bold text-[#8c5a3c]" }, toDisplayString(po.po_number), 1),
								createVNode("td", { class: "p-4 font-semibold" }, toDisplayString(po.outlet?.name), 1),
								createVNode("td", { class: "p-4 font-semibold" }, toDisplayString(po.supplier?.name), 1),
								createVNode("td", { class: "p-4 text-slate-500" }, toDisplayString(formatDate(po.created_at)), 1),
								createVNode("td", { class: "p-4 text-right font-bold text-slate-900 dark:text-slate-100" }, "Rp " + toDisplayString(Number(po.total_amount).toLocaleString("id-ID")), 1),
								createVNode("td", { class: "p-4 text-center" }, [createVNode("span", { class: ["px-2 py-0.5 border rounded-full text-[10px] font-bold uppercase tracking-wider", getStatusClass(po.status)] }, toDisplayString(po.status), 3)]),
								createVNode("td", { class: "p-4 text-right" }, [createVNode("div", { class: "flex items-center justify-end gap-1.5" }, [
									createVNode("button", {
										onClick: ($event) => openDetailModal(po),
										title: "Detail Item",
										class: "p-1.5 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-500 hover:text-slate-800 dark:hover:text-slate-200 rounded-lg cursor-pointer"
									}, [createVNode(unref(Eye), { class: "h-4 w-4" })], 8, ["onClick"]),
									po.status === "draft" ? (openBlock(), createBlock(Fragment, { key: 0 }, [createVNode("button", {
										onClick: ($event) => sendPO(po),
										title: "Kirim ke Supplier",
										class: "p-1.5 hover:bg-indigo-50 dark:hover:bg-indigo-950/20 text-indigo-650 hover:text-indigo-700 rounded-lg cursor-pointer"
									}, [createVNode(unref(Send), { class: "h-4 w-4" })], 8, ["onClick"]), createVNode("button", {
										onClick: ($event) => openEditModal(po),
										title: "Ubah PO",
										class: "p-1.5 hover:bg-slate-100 dark:hover:bg-slate-800 text-slate-500 hover:text-slate-850 dark:hover:text-slate-200 rounded-lg cursor-pointer"
									}, [createVNode(unref(Edit2), { class: "h-4 w-4" })], 8, ["onClick"])], 64)) : createCommentVNode("", true),
									po.status === "sent" ? (openBlock(), createBlock("button", {
										key: 1,
										onClick: ($event) => receivePO(po),
										title: "Konfirmasi Barang Diterima (GRN)",
										class: "p-1.5 hover:bg-emerald-50 dark:hover:bg-emerald-955/20 text-emerald-600 hover:text-emerald-700 rounded-lg cursor-pointer"
									}, [createVNode(unref(CheckCircle), { class: "h-4 w-4" })], 8, ["onClick"])) : createCommentVNode("", true),
									po.status === "draft" || po.status === "cancelled" ? (openBlock(), createBlock("button", {
										key: 2,
										onClick: ($event) => deletePO(po),
										title: "Hapus",
										class: "p-1.5 hover:bg-rose-50 dark:hover:bg-rose-955/20 text-rose-600 hover:text-rose-700 rounded-lg cursor-pointer"
									}, [createVNode(unref(Trash2), { class: "h-4 w-4" })], 8, ["onClick"])) : createCommentVNode("", true)
								])])
							]);
						}), 128))])])])]),
						isFormModalOpen.value ? (openBlock(), createBlock("div", {
							key: 0,
							class: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/60 backdrop-blur-sm"
						}, [createVNode("div", { class: "bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-2xl shadow-2xl w-full max-w-2xl overflow-hidden transform transition-all" }, [createVNode("div", { class: "px-6 py-4 border-b border-slate-200 dark:border-slate-800 flex items-center justify-between" }, [createVNode("h3", { class: "text-sm font-extrabold text-slate-900 dark:text-slate-100" }, toDisplayString(editingPO.value ? "Edit Purchase Order" : "Buat Purchase Order Baru"), 1), createVNode("button", {
							onClick: ($event) => isFormModalOpen.value = false,
							class: "p-1.5 hover:bg-slate-100 dark:hover:bg-slate-900 rounded-lg text-slate-400 cursor-pointer"
						}, [createVNode(unref(X), { class: "h-4 w-4" })], 8, ["onClick"])]), createVNode("form", {
							onSubmit: withModifiers(submitForm, ["prevent"]),
							class: "p-6 space-y-6"
						}, [
							createVNode("div", { class: "grid grid-cols-2 gap-4" }, [createVNode("div", null, [createVNode("label", { class: "block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase tracking-wider mb-1.5" }, "Outlet Tujuan"), withDirectives(createVNode("select", {
								"onUpdate:modelValue": ($event) => unref(form).outlet_id = $event,
								required: "",
								disabled: __props.isCashier || !!editingPO.value,
								class: "w-full h-10 px-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-[#8c5a3c]/20 focus:border-[#8c5a3c] text-slate-900 dark:text-slate-100 cursor-pointer"
							}, [(openBlock(true), createBlock(Fragment, null, renderList(__props.outlets, (ot) => {
								return openBlock(), createBlock("option", {
									key: ot.id,
									value: ot.id
								}, toDisplayString(ot.name), 9, ["value"]);
							}), 128))], 8, ["onUpdate:modelValue", "disabled"]), [[vModelSelect, unref(form).outlet_id]])]), createVNode("div", null, [createVNode("label", { class: "block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase tracking-wider mb-1.5" }, "Pilih Pemasok (Supplier)"), withDirectives(createVNode("select", {
								"onUpdate:modelValue": ($event) => unref(form).supplier_id = $event,
								required: "",
								disabled: !!editingPO.value,
								class: "w-full h-10 px-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-[#8c5a3c]/20 focus:border-[#8c5a3c] text-slate-900 dark:text-slate-100 cursor-pointer"
							}, [(openBlock(true), createBlock(Fragment, null, renderList(__props.suppliers, (s) => {
								return openBlock(), createBlock("option", {
									key: s.id,
									value: s.id
								}, toDisplayString(s.name), 9, ["value"]);
							}), 128))], 8, ["onUpdate:modelValue", "disabled"]), [[vModelSelect, unref(form).supplier_id]])])]),
							createVNode("div", { class: "space-y-3" }, [createVNode("div", { class: "flex items-center justify-between" }, [createVNode("label", { class: "block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase tracking-wider" }, "Item Bahan Baku"), createVNode("button", {
								type: "button",
								onClick: addFormItem,
								class: "px-2.5 py-1.5 bg-[#8c5a3c]/10 text-[#8c5a3c] hover:bg-[#8c5a3c]/20 text-[10px] font-bold rounded-lg transition-colors cursor-pointer flex items-center gap-1"
							}, [createVNode(unref(Plus), { class: "h-3 w-3" }), createVNode("span", null, "Tambah Item")])]), createVNode("div", { class: "space-y-3 max-h-56 overflow-y-auto pr-1" }, [(openBlock(true), createBlock(Fragment, null, renderList(unref(form).items, (item, idx) => {
								return openBlock(), createBlock("div", {
									key: idx,
									class: "flex gap-3 items-end"
								}, [
									createVNode("div", { class: "flex-1" }, [withDirectives(createVNode("select", {
										"onUpdate:modelValue": ($event) => item.ingredient_id = $event,
										required: "",
										onChange: ($event) => handleIngredientChange(idx),
										class: "w-full h-10 px-2.5 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100 cursor-pointer"
									}, [createVNode("option", { value: "" }, "Pilih bahan baku..."), (openBlock(true), createBlock(Fragment, null, renderList(__props.ingredients, (ing) => {
										return openBlock(), createBlock("option", {
											key: ing.id,
											value: ing.id
										}, toDisplayString(ing.name) + " (" + toDisplayString(ing.unit) + ")", 9, ["value"]);
									}), 128))], 40, ["onUpdate:modelValue", "onChange"]), [[vModelSelect, item.ingredient_id]])]),
									createVNode("div", { class: "w-24" }, [withDirectives(createVNode("input", {
										type: "number",
										"onUpdate:modelValue": ($event) => item.qty = $event,
										required: "",
										min: "0.0001",
										step: "any",
										placeholder: "Qty",
										class: "w-full h-10 px-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100"
									}, null, 8, ["onUpdate:modelValue"]), [[vModelText, item.qty]])]),
									createVNode("div", { class: "w-32" }, [withDirectives(createVNode("input", {
										type: "number",
										"onUpdate:modelValue": ($event) => item.price = $event,
										required: "",
										min: "0",
										placeholder: "Harga Satuan",
										class: "w-full h-10 px-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100"
									}, null, 8, ["onUpdate:modelValue"]), [[vModelText, item.price]])]),
									createVNode("button", {
										type: "button",
										onClick: ($event) => removeFormItem(idx),
										disabled: unref(form).items.length <= 1,
										class: "h-10 w-10 border border-slate-200 dark:border-slate-700 rounded-xl flex items-center justify-center text-slate-450 hover:text-rose-600 disabled:opacity-30 cursor-pointer"
									}, [createVNode(unref(Trash2), { class: "h-4 w-4" })], 8, ["onClick", "disabled"])
								]);
							}), 128))])]),
							createVNode("div", null, [createVNode("label", { class: "block text-[10px] font-bold text-slate-450 dark:text-slate-500 uppercase tracking-wider mb-1.5" }, "Catatan Tambahan / Keterangan"), withDirectives(createVNode("textarea", {
								"onUpdate:modelValue": ($event) => unref(form).notes = $event,
								placeholder: "Contoh: Pengiriman paling lambat hari Selasa pagi...",
								rows: "2",
								class: "w-full p-3 border border-slate-200 dark:border-slate-700 rounded-xl bg-slate-50 dark:bg-slate-800 text-xs font-semibold focus:outline-none text-slate-900 dark:text-slate-100"
							}, null, 8, ["onUpdate:modelValue"]), [[vModelText, unref(form).notes]])]),
							createVNode("div", { class: "flex items-center justify-between pt-4 border-t border-slate-100 dark:border-slate-800" }, [createVNode("div", null, [createVNode("span", { class: "text-[10px] text-slate-400 font-bold uppercase tracking-wider" }, "Total Estimasi Biaya"), createVNode("h4", { class: "text-base font-black text-slate-900 dark:text-slate-100 mt-0.5" }, "Rp " + toDisplayString(formSubtotal.value.toLocaleString("id-ID")), 1)]), createVNode("div", { class: "flex gap-3" }, [createVNode("button", {
								type: "button",
								onClick: ($event) => isFormModalOpen.value = false,
								class: "px-4 py-2 border border-slate-200 dark:border-slate-800 text-slate-750 dark:text-slate-300 text-xs font-bold rounded-xl hover:bg-slate-50 dark:hover:bg-slate-800 cursor-pointer"
							}, " Batal ", 8, ["onClick"]), createVNode("button", {
								type: "submit",
								disabled: unref(form).processing,
								class: "px-5 py-2 bg-[#8c5a3c] hover:bg-[#734a31] text-white text-xs font-bold rounded-xl cursor-pointer"
							}, toDisplayString(unref(form).processing ? "Menyimpan..." : editingPO.value ? "Simpan Perubahan" : "Buat PO (Draft)"), 9, ["disabled"])])])
						], 32)])])) : createCommentVNode("", true),
						isDetailModalOpen.value && selectedPO.value ? (openBlock(), createBlock("div", {
							key: 1,
							class: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-slate-950/60 backdrop-blur-sm animate-fade-in"
						}, [createVNode("div", { class: "bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 rounded-2xl shadow-2xl w-full max-w-xl overflow-hidden p-6 space-y-6 animate-in zoom-in-95 duration-200" }, [
							createVNode("div", { class: "flex items-center justify-between border-b border-slate-100 dark:border-slate-800 pb-3" }, [createVNode("div", { class: "flex items-center gap-2" }, [createVNode(unref(FileText), { class: "h-5 w-5 text-[#8c5a3c]" }), createVNode("div", null, [createVNode("h3", { class: "text-sm font-extrabold text-slate-900 dark:text-slate-100" }, "Rincian Purchase Order"), createVNode("p", { class: "text-[10px] text-slate-400 font-mono" }, toDisplayString(selectedPO.value.po_number), 1)])]), createVNode("button", {
								onClick: ($event) => isDetailModalOpen.value = false,
								class: "p-1.5 hover:bg-slate-100 dark:hover:bg-slate-900 rounded-lg text-slate-400 cursor-pointer"
							}, [createVNode(unref(X), { class: "h-4 w-4" })], 8, ["onClick"])]),
							createVNode("div", { class: "grid grid-cols-2 gap-4 text-xs" }, [
								createVNode("div", { class: "space-y-1" }, [createVNode("span", { class: "text-[9px] font-bold text-slate-400 uppercase tracking-wider" }, "Outlet Penerima"), createVNode("p", { class: "font-bold text-slate-850 dark:text-slate-200" }, toDisplayString(selectedPO.value.outlet?.name), 1)]),
								createVNode("div", { class: "space-y-1" }, [createVNode("span", { class: "text-[9px] font-bold text-slate-400 uppercase tracking-wider" }, "Pemasok"), createVNode("p", { class: "font-bold text-slate-850 dark:text-slate-200" }, toDisplayString(selectedPO.value.supplier?.name), 1)]),
								createVNode("div", { class: "space-y-1" }, [createVNode("span", { class: "text-[9px] font-bold text-slate-400 uppercase tracking-wider" }, "Tanggal Dibuat"), createVNode("p", { class: "text-slate-650 dark:text-slate-350" }, toDisplayString(formatDate(selectedPO.value.created_at)), 1)]),
								createVNode("div", { class: "space-y-1" }, [createVNode("span", { class: "text-[9px] font-bold text-slate-400 uppercase tracking-wider" }, "Status PO"), createVNode("div", null, [createVNode("span", { class: ["px-2 py-0.5 border rounded-full text-[9px] font-bold uppercase tracking-wider", getStatusClass(selectedPO.value.status)] }, toDisplayString(selectedPO.value.status), 3)])])
							]),
							createVNode("div", { class: "space-y-2" }, [createVNode("label", { class: "block text-[10px] font-extrabold text-slate-450 dark:text-slate-500 uppercase tracking-wider" }, "Daftar Bahan Baku Pesanan"), createVNode("div", { class: "border border-slate-150 dark:border-slate-800 rounded-xl overflow-hidden max-h-48 overflow-y-auto" }, [createVNode("table", { class: "w-full text-left text-xs border-collapse" }, [createVNode("thead", null, [createVNode("tr", { class: "bg-slate-50 dark:bg-slate-900 border-b border-slate-150 dark:border-slate-800 text-slate-500 font-bold" }, [
								createVNode("th", { class: "p-2.5" }, "Nama Bahan"),
								createVNode("th", { class: "p-2.5 text-center" }, "Jumlah"),
								createVNode("th", { class: "p-2.5 text-right" }, "Harga Satuan"),
								createVNode("th", { class: "p-2.5 text-right pr-3" }, "Subtotal")
							])]), createVNode("tbody", { class: "divide-y divide-slate-100 dark:divide-slate-800 text-slate-700 dark:text-slate-300" }, [(openBlock(true), createBlock(Fragment, null, renderList(selectedPO.value.items, (item) => {
								return openBlock(), createBlock("tr", { key: item.id }, [
									createVNode("td", { class: "p-2.5 font-bold" }, toDisplayString(item.ingredient?.name), 1),
									createVNode("td", { class: "p-2.5 text-center" }, toDisplayString(Number(item.qty).toLocaleString("id-ID")) + " " + toDisplayString(item.ingredient?.unit), 1),
									createVNode("td", { class: "p-2.5 text-right" }, "Rp " + toDisplayString(Number(item.price).toLocaleString("id-ID")), 1),
									createVNode("td", { class: "p-2.5 text-right pr-3 font-bold" }, "Rp " + toDisplayString(Number(item.subtotal).toLocaleString("id-ID")), 1)
								]);
							}), 128))])])])]),
							selectedPO.value.notes ? (openBlock(), createBlock("div", {
								key: 0,
								class: "p-3 bg-slate-50 dark:bg-slate-950 rounded-xl border border-slate-100 dark:border-slate-800 text-xs"
							}, [createVNode("span", { class: "block text-[9px] font-bold text-slate-400 uppercase tracking-wider mb-1" }, "Catatan Tambahan"), createVNode("p", { class: "text-slate-650 dark:text-slate-350 italic" }, "\"" + toDisplayString(selectedPO.value.notes) + "\"", 1)])) : createCommentVNode("", true),
							createVNode("div", { class: "flex items-center justify-between border-t border-slate-100 dark:border-slate-800 pt-4" }, [createVNode("div", null, [createVNode("span", { class: "text-[9px] text-slate-400 font-bold uppercase tracking-wider" }, "Total Pembelian"), createVNode("h4", { class: "text-base font-black text-slate-900 dark:text-slate-100 mt-0.5" }, "Rp " + toDisplayString(Number(selectedPO.value.total_amount).toLocaleString("id-ID")), 1)]), createVNode("button", {
								onClick: ($event) => isDetailModalOpen.value = false,
								class: "px-5 py-2 border border-slate-200 dark:border-slate-800 text-slate-500 rounded-xl text-xs font-bold hover:bg-slate-50 dark:hover:bg-slate-800 cursor-pointer"
							}, " Tutup Detail ", 8, ["onClick"])])
						])])) : createCommentVNode("", true)
					])];
				}),
				_: 1
			}, _parent));
			_push(`<!--]-->`);
		};
	}
});
//#endregion
//#region resources/js/Pages/CafePOS/PurchaseOrders/Index.vue
var _sfc_setup = Index_vue_vue_type_script_setup_true_lang_default.setup;
Index_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/PurchaseOrders/Index.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
var Index_default = Index_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { Index_default as default };
