import { a as _sfc_main$7, i as _sfc_main$1, n as _sfc_main$3, o as _sfc_main$4, r as _sfc_main$6, s as _sfc_main$5, t as _sfc_main$2, x as _sfc_main$8, z as http_default } from "../ssr.js";
import { usePage } from "@inertiajs/vue3";
import { createBlock, createCommentVNode, createVNode, mergeProps, onMounted, openBlock, ref, resolveDynamicComponent, toDisplayString, unref, useSSRContext, withCtx } from "vue";
import { ssrInterpolate, ssrRenderAttr, ssrRenderAttrs, ssrRenderComponent, ssrRenderVNode } from "vue/server-renderer";
//#region resources/js/Pages/Sma/Order/Purchase/QuickView.vue
var _sfc_main = {
	__name: "QuickView",
	__ssrInlineRender: true,
	props: [
		"current",
		"custom_fields",
		"editRow",
		"xfetch",
		"force"
	],
	setup(__props) {
		const page = usePage();
		const props = __props;
		const loading = ref(true);
		const purchase = ref(null);
		const templateComponent = {
			One: _sfc_main$1,
			Two: _sfc_main$2,
			Three: _sfc_main$3,
			Four: _sfc_main$4,
			Five: _sfc_main$5,
			Six: _sfc_main$6,
			Minimal: _sfc_main$7
		};
		onMounted(async () => {
			if (props.xfetch) {
				purchase.value = props.current;
				loading.value = false;
			} else await http_default.get(props.force ? route("purchases.report.show", { id: props.current.id }) : route("purchases.show", {
				purchase: props.current.id,
				json: true
			})).then((res) => {
				purchase.value = res.data;
				loading.value = false;
			}).catch(() => loading.value = false);
		});
		return (_ctx, _push, _parent, _attrs) => {
			if (loading.value) {
				_push(`<div${ssrRenderAttrs(mergeProps({ class: "relative h-64" }, _attrs))}>`);
				_push(ssrRenderComponent(unref(_sfc_main$8), null, null, _parent));
				_push(`</div>`);
			} else if (purchase.value) ssrRenderVNode(_push, createVNode(resolveDynamicComponent(templateComponent[unref(page).props.settings?.sale_template || "One"]), mergeProps({
				type: "purchase",
				xfetch: __props.xfetch,
				record: purchase.value,
				editRow: __props.editRow,
				custom_fields: __props.custom_fields,
				qrUrl: _ctx.route("purchase.url", {
					id: purchase.value.id,
					hash: purchase.value.hash || "hash"
				})
			}, _attrs), {
				alerts: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) if (purchase.value.return_orders_count > 0) _push(`<div class="col-span-full -mb-3 px-6 pt-6"${_scopeId}><a${ssrRenderAttr("href", _ctx.route("return_orders.index", { purchase_id: purchase.value.id }))} class="block rounded-md border border-yellow-700 bg-yellow-50 px-4 py-2.5 dark:bg-yellow-800 print:border print:border-yellow-700"${_scopeId}><div class="flex"${_scopeId}><div class="shrink-0"${_scopeId}><svg class="h-5 w-5 text-yellow-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true"${_scopeId}><path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"${_scopeId}></path></svg></div><div class="ms-3"${_scopeId}><h3 class="text-sm font-medium text-yellow-800 dark:text-yellow-200"${_scopeId}>${ssrInterpolate(_ctx.$t("This purchase has attached to return orders."))}</h3></div></div></a></div>`);
					else _push(`<!---->`);
					else return [purchase.value.return_orders_count > 0 ? (openBlock(), createBlock("div", {
						key: 0,
						class: "col-span-full -mb-3 px-6 pt-6"
					}, [createVNode("a", {
						href: _ctx.route("return_orders.index", { purchase_id: purchase.value.id }),
						class: "block rounded-md border border-yellow-700 bg-yellow-50 px-4 py-2.5 dark:bg-yellow-800 print:border print:border-yellow-700"
					}, [createVNode("div", { class: "flex" }, [createVNode("div", { class: "shrink-0" }, [(openBlock(), createBlock("svg", {
						class: "h-5 w-5 text-yellow-400",
						viewBox: "0 0 20 20",
						fill: "currentColor",
						"aria-hidden": "true"
					}, [createVNode("path", {
						"fill-rule": "evenodd",
						d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",
						"clip-rule": "evenodd"
					})]))]), createVNode("div", { class: "ms-3" }, [createVNode("h3", { class: "text-sm font-medium text-yellow-800 dark:text-yellow-200" }, toDisplayString(_ctx.$t("This purchase has attached to return orders.")), 1)])])], 8, ["href"])])) : createCommentVNode("", true)];
				}),
				_: 1
			}), _parent);
			else _push(`<div${ssrRenderAttrs(mergeProps({ class: "flex min-h-64 items-center justify-center p-6 text-lg font-thin" }, _attrs))}>${ssrInterpolate(_ctx.$t("No data found, the record might not belong to the selected store."))}</div>`);
		};
	}
};
var _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
	const ssrContext = useSSRContext();
	(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/Pages/Sma/Order/Purchase/QuickView.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
//#endregion
export { _sfc_main as default };
