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 { createTextVNode, createVNode, mergeProps, onMounted, ref, resolveDynamicComponent, toDisplayString, unref, useSSRContext, withCtx } from "vue";
import { ssrInterpolate, ssrRenderAttrs, ssrRenderComponent, ssrRenderVNode } from "vue/server-renderer";
//#region resources/js/Pages/Sma/Order/Income/QuickView.vue
var _sfc_main = {
	__name: "QuickView",
	__ssrInlineRender: true,
	props: [
		"current",
		"custom_fields",
		"editRow",
		"force"
	],
	setup(__props) {
		const page = usePage();
		const props = __props;
		const loading = ref(true);
		const income = 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 () => {
			await http_default.get(route("incomes.show", {
				income: props.current.id,
				json: true
			})).then((res) => {
				income.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 (income.value) ssrRenderVNode(_push, createVNode(resolveDynamicComponent(templateComponent[unref(page).props.settings?.sale_template || "One"]), mergeProps({
				type: "income",
				record: income.value,
				editRow: __props.editRow,
				custom_fields: __props.custom_fields
			}, _attrs), {
				amount: withCtx(({ record }, _push, _parent, _scopeId) => {
					if (_push) _push(`<div class="mx-4 mt-4 rounded-md border border-gray-200 bg-gray-50 px-5 py-4 dark:border-gray-700 dark:bg-gray-950"${_scopeId}><div class="flex items-center justify-between text-lg font-bold"${_scopeId}>${ssrInterpolate(_ctx.$t("Amount"))}: <span${_scopeId}>${ssrInterpolate(_ctx.$currency(record.amount))}</span></div><div class="mt-2"${_scopeId}>${ssrInterpolate(_ctx.$t("By"))}: ${ssrInterpolate(record.user?.name)}</div></div>`);
					else return [createVNode("div", { class: "mx-4 mt-4 rounded-md border border-gray-200 bg-gray-50 px-5 py-4 dark:border-gray-700 dark:bg-gray-950" }, [createVNode("div", { class: "flex items-center justify-between text-lg font-bold" }, [createTextVNode(toDisplayString(_ctx.$t("Amount")) + ": ", 1), createVNode("span", null, toDisplayString(_ctx.$currency(record.amount)), 1)]), createVNode("div", { class: "mt-2" }, toDisplayString(_ctx.$t("By")) + ": " + toDisplayString(record.user?.name), 1)])];
				}),
				_: 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/Income/QuickView.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
//#endregion
export { _sfc_main as default };
