import { t as __exportAll } from "./rolldown-runtime-rSIU-vHC.js";
import { x as _sfc_main$1, z as http_default } from "../ssr.js";
import { onMounted, ref, resolveComponent, unref, useSSRContext } from "vue";
import { ssrInterpolate, ssrRenderAttr, ssrRenderAttrs, ssrRenderComponent, ssrRenderList } from "vue/server-renderer";
//#region resources/js/Pages/Sma/Pos/Components/ShowOrders.vue
var ShowOrders_exports = /* @__PURE__ */ __exportAll({ default: () => _sfc_main });
var _sfc_main = {
	__name: "ShowOrders",
	__ssrInlineRender: true,
	props: ["show"],
	emits: [
		"close",
		"loadOrder",
		"delete-order"
	],
	setup(__props, { emit: __emit }) {
		const orders = ref(null);
		const loading = ref(false);
		onMounted(() => {
			showOpenOrders();
		});
		async function showOpenOrders() {
			loading.value = true;
			http_default.get(route("pos.orders")).then((res) => orders.value = res.data).catch().finally(() => loading.value = false);
		}
		return (_ctx, _push, _parent, _attrs) => {
			const _component_Icon = resolveComponent("Icon");
			_push(`<div${ssrRenderAttrs(_attrs)}><div class="relative border-b border-gray-200 p-4 sm:px-6 dark:border-gray-700"><div class="absolute end-0 top-0 pe-4 pt-4"><button type="button" class="rounded-md hover:text-gray-500 focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 focus:outline-hidden"><span class="sr-only">${ssrInterpolate(_ctx.$t("Close"))}</span><svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"></path></svg></button></div><div><h3 class="text-base leading-6 font-semibold text-gray-900 dark:text-gray-100">${ssrInterpolate(_ctx.$t("Open Orders (on hold)"))}</h3><p class="mt-1 text-sm">${ssrInterpolate(_ctx.$t("Please click the order below to load or trash icon to delete."))}</p></div></div><div class="rounded-b-lg bg-gray-100 p-6 dark:bg-gray-800">`);
			if (loading.value) {
				_push(`<div class="h-40">`);
				_push(ssrRenderComponent(unref(_sfc_main$1), { loadingClass: "w-10 h-20" }, null, _parent));
				_push(`</div>`);
			} else _push(`<!---->`);
			if (orders.value && orders.value.data && orders.value.data.length) {
				_push(`<ul role="list" class="grid grid-cols-1 gap-6 sm:grid-cols-2"><!--[-->`);
				ssrRenderList(orders.value.data, (openOrder, oi) => {
					_push(`<li class="group relative col-span-1 rounded-lg bg-white shadow-xs hover:bg-gray-50 dark:bg-gray-900"><button type="button" class="flex w-full items-start justify-between space-x-4 p-4 text-start"><div class="flex-1 truncate">`);
					if (_ctx.$page.props.settings?.restaurant == 1 && openOrder.table) _push(`<p class="truncate text-sm font-bold text-primary-700 dark:text-primary-400">${ssrInterpolate(openOrder.table?.name)} (${ssrInterpolate(openOrder.hall?.name)}) </p>`);
					else _push(`<!---->`);
					_push(`<p class="mt-1 truncate text-sm font-medium">${ssrInterpolate(_ctx.$t("Ref"))}: <span class="font-bold">${ssrInterpolate(openOrder.reference)}</span></p><h3 class="mt-0.5 truncate text-sm font-bold text-gray-900 dark:text-gray-100">#${ssrInterpolate(openOrder.number)}</h3><p class="mt-0.5 truncate text-sm font-medium">${ssrInterpolate(openOrder.customer?.company || openOrder.customer?.name)}</p><p class="truncate text-sm">${ssrInterpolate(_ctx.$t("Items"))}: ${ssrInterpolate(openOrder.data.total_items)} (${ssrInterpolate(_ctx.$number_qty(openOrder.data.total_quantity))}) </p><p class="truncate text-sm">${ssrInterpolate(_ctx.$t("Total"))}: ${ssrInterpolate(_ctx.$currency(openOrder.data.total))}</p></div>`);
					if (!_ctx.$can("delete-sales")) _push(`<img alt=""${ssrRenderAttr("src", openOrder.user.profile_photo_url)} class="-mt-px h-10 w-10 rounded-full bg-gray-300 group-hover:hidden">`);
					else _push(`<!---->`);
					_push(`</button>`);
					if (_ctx.$can("delete-orders")) {
						_push(`<div class="absolute end-4 top-4 h-10 w-10 shrink-0 rounded-full"><img alt=""${ssrRenderAttr("src", openOrder.user.profile_photo_url)} class="-mt-px h-10 w-10 rounded-full bg-gray-300 group-hover:hidden"><button type="button" class="-mt-px hidden h-10 w-10 items-center justify-center rounded-full bg-red-200 group-hover:flex">`);
						_push(ssrRenderComponent(_component_Icon, {
							name: "trash",
							class: "-mt-px h-6 w-6 text-red-600"
						}, null, _parent));
						_push(`</button></div>`);
					} else _push(`<!---->`);
					_push(`</li>`);
				});
				_push(`<!--]--></ul>`);
			} else _push(`<div class="text-center"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="mx-auto h-12 w-12 text-gray-400"><path stroke-linecap="round" stroke-linejoin="round" d="M6.429 9.75 2.25 12l4.179 2.25m0-4.5 5.571 3 5.571-3m-11.142 0L2.25 7.5 12 2.25l9.75 5.25-4.179 2.25m0 0L21.75 12l-4.179 2.25m0 0 4.179 2.25L12 21.75 2.25 16.5l4.179-2.25m11.142 0-5.571 3-5.571-3"></path></svg><h3 class="mt-2 text-sm font-semibold text-gray-900 dark:text-gray-100">${ssrInterpolate(_ctx.$t("No Suspended Orders"))}</h3><p class="mt-1 text-sm">${ssrInterpolate(_ctx.$t("There is no suspended order to display."))}</p></div>`);
			_push(`</div></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/Pos/Components/ShowOrders.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
//#endregion
export { _sfc_main as n, ShowOrders_exports as t };
