import { t as B } from "./index.esm-0G7eAEV5.js";
import { H as PageSearch, M as _sfc_main$3, k as _sfc_main$1, pt as _sfc_main$2, st as _sfc_main$5, v as _sfc_main$6, vt as _sfc_main$7, x as _sfc_main$4 } from "../ssr.js";
import { t as _sfc_main$8 } from "./AdminLayout-eZgRfDMK.js";
import _sfc_main$9 from "./Form-CxQDays7.js";
import { router } from "@inertiajs/vue3";
import { Fragment, createBlock, createCommentVNode, createTextVNode, createVNode, openBlock, ref, resolveComponent, toDisplayString, unref, useSSRContext, withCtx } from "vue";
import { ssrInterpolate, ssrRenderClass, ssrRenderComponent, ssrRenderList } from "vue/server-renderer";
//#region resources/js/Pages/Sma/Pos/Table/Index.vue
var _sfc_main = /* @__PURE__ */ Object.assign({ layout: _sfc_main$8 }, {
	__name: "Index",
	__ssrInlineRender: true,
	props: ["pagination", "halls"],
	setup(__props) {
		const add = ref(false);
		const current = ref(null);
		const deleted = ref(false);
		const deleting = ref(false);
		const { filters, searching, searchNow, sortBy } = PageSearch();
		function editRow(row) {
			current.value = row;
			add.value = true;
		}
		function deleteRow(row) {
			deleting.value = true;
			router.delete(B("pos.halls.destroy", row.id), {
				preserveScroll: true,
				onSuccess: () => deleted.value = row.id,
				onFinish: () => deleting.value = false
			});
		}
		function hideForm() {
			current.value = null;
			add.value = false;
		}
		return (_ctx, _push, _parent, _attrs) => {
			const _component_Head = resolveComponent("Head");
			const _component_Header = resolveComponent("Header");
			const _component_Icon = resolveComponent("Icon");
			const _component_SortIcons = resolveComponent("SortIcons");
			const _component_Badge = resolveComponent("Badge");
			_push(`<!--[-->`);
			_push(ssrRenderComponent(_component_Head, null, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`<title${_scopeId}>${ssrInterpolate(_ctx.$t("Restaurant Halls"))}</title>`);
					else return [createVNode("title", null, toDisplayString(_ctx.$t("Restaurant Halls")), 1)];
				}),
				_: 1
			}, _parent));
			_push(ssrRenderComponent(_component_Header, null, {
				subheading: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`${ssrInterpolate(_ctx.$t("Manage dining tables and seating arrangements"))}`);
					else return [createTextVNode(toDisplayString(_ctx.$t("Manage dining tables and seating arrangements")), 1)];
				}),
				menu: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) {
						_push(`<div class="flex items-center justify-center gap-4"${_scopeId}>`);
						if (_ctx.$can("create-tables")) {
							_push(`<!--[-->`);
							if (_ctx.$page.props.selected_store) _push(ssrRenderComponent(unref(_sfc_main$1), {
								type: "button",
								onClick: ($event) => add.value = true
							}, {
								default: withCtx((_, _push, _parent, _scopeId) => {
									if (_push) _push(`${ssrInterpolate(_ctx.$t("Add {x}", { x: _ctx.$t("Table") }))}`);
									else return [createTextVNode(toDisplayString(_ctx.$t("Add {x}", { x: _ctx.$t("Table") })), 1)];
								}),
								_: 1
							}, _parent, _scopeId));
							else _push(ssrRenderComponent(unref(_sfc_main$1), {
								type: "button",
								onClick: () => _ctx.$page.props.select_store = true
							}, {
								default: withCtx((_, _push, _parent, _scopeId) => {
									if (_push) _push(`${ssrInterpolate(_ctx.$t("Add {x}", { x: _ctx.$t("Table") }))}`);
									else return [createTextVNode(toDisplayString(_ctx.$t("Add {x}", { x: _ctx.$t("Table") })), 1)];
								}),
								_: 1
							}, _parent, _scopeId));
							_push(`<!--]-->`);
						} else _push(`<!---->`);
						_push(ssrRenderComponent(unref(_sfc_main$2), {
							align: "right",
							width: "56",
							"auto-close": false
						}, {
							trigger: withCtx((_, _push, _parent, _scopeId) => {
								if (_push) {
									_push(`<button class="-m-2 flex items-center rounded-md p-2.5 transition duration-150 ease-in-out"${_scopeId}>`);
									_push(ssrRenderComponent(_component_Icon, {
										name: "funnel-o",
										size: "size-5"
									}, null, _parent, _scopeId));
									_push(`<span class="sr-only"${_scopeId}>${ssrInterpolate(_ctx.$t("Show Filters"))}</span></button>`);
								} else return [createVNode("button", { class: "-m-2 flex items-center rounded-md p-2.5 transition duration-150 ease-in-out" }, [createVNode(_component_Icon, {
									name: "funnel-o",
									size: "size-5"
								}), createVNode("span", { class: "sr-only" }, toDisplayString(_ctx.$t("Show Filters")), 1)])];
							}),
							content: withCtx((_, _push, _parent, _scopeId) => {
								if (_push) {
									_push(`<div class="px-4 py-2"${_scopeId}><div${_scopeId}>`);
									_push(ssrRenderComponent(unref(_sfc_main$3), {
										json: true,
										"value-key": "id",
										"label-key": "name",
										onChange: unref(searchNow),
										label: _ctx.$t("Hall"),
										suggestions: __props.halls,
										modelValue: unref(filters).hall_id,
										"onUpdate:modelValue": ($event) => unref(filters).hall_id = $event,
										placeholder: _ctx.$t("All Halls")
									}, null, _parent, _scopeId));
									_push(`</div><div class="mt-4"${_scopeId}>`);
									_push(ssrRenderComponent(unref(_sfc_main$3), {
										json: true,
										onChange: unref(searchNow),
										label: _ctx.$t("Status"),
										modelValue: unref(filters).active,
										"onUpdate:modelValue": ($event) => unref(filters).active = $event,
										placeholder: _ctx.$t("All"),
										suggestions: [{
											value: "1",
											label: _ctx.$t("Active")
										}, {
											value: "0",
											label: _ctx.$t("Inactive")
										}]
									}, null, _parent, _scopeId));
									_push(`</div><div class="mt-4"${_scopeId}>`);
									_push(ssrRenderComponent(unref(_sfc_main$3), {
										json: true,
										onChange: unref(searchNow),
										label: _ctx.$t("Trashed"),
										modelValue: unref(filters).trashed,
										"onUpdate:modelValue": ($event) => unref(filters).trashed = $event,
										placeholder: _ctx.$t("With Trashed"),
										suggestions: [
											{
												value: "not",
												label: _ctx.$t("Not Trashed")
											},
											{
												value: "with",
												label: _ctx.$t("With Trashed")
											},
											{
												value: "only",
												label: _ctx.$t("Only Trashed")
											}
										]
									}, null, _parent, _scopeId));
									_push(`</div></div>`);
								} else return [createVNode("div", { class: "px-4 py-2" }, [
									createVNode("div", null, [createVNode(unref(_sfc_main$3), {
										json: true,
										"value-key": "id",
										"label-key": "name",
										onChange: unref(searchNow),
										label: _ctx.$t("Hall"),
										suggestions: __props.halls,
										modelValue: unref(filters).hall_id,
										"onUpdate:modelValue": ($event) => unref(filters).hall_id = $event,
										placeholder: _ctx.$t("All Halls")
									}, null, 8, [
										"onChange",
										"label",
										"suggestions",
										"modelValue",
										"onUpdate:modelValue",
										"placeholder"
									])]),
									createVNode("div", { class: "mt-4" }, [createVNode(unref(_sfc_main$3), {
										json: true,
										onChange: unref(searchNow),
										label: _ctx.$t("Status"),
										modelValue: unref(filters).active,
										"onUpdate:modelValue": ($event) => unref(filters).active = $event,
										placeholder: _ctx.$t("All"),
										suggestions: [{
											value: "1",
											label: _ctx.$t("Active")
										}, {
											value: "0",
											label: _ctx.$t("Inactive")
										}]
									}, null, 8, [
										"onChange",
										"label",
										"modelValue",
										"onUpdate:modelValue",
										"placeholder",
										"suggestions"
									])]),
									createVNode("div", { class: "mt-4" }, [createVNode(unref(_sfc_main$3), {
										json: true,
										onChange: unref(searchNow),
										label: _ctx.$t("Trashed"),
										modelValue: unref(filters).trashed,
										"onUpdate:modelValue": ($event) => unref(filters).trashed = $event,
										placeholder: _ctx.$t("With Trashed"),
										suggestions: [
											{
												value: "not",
												label: _ctx.$t("Not Trashed")
											},
											{
												value: "with",
												label: _ctx.$t("With Trashed")
											},
											{
												value: "only",
												label: _ctx.$t("Only Trashed")
											}
										]
									}, null, 8, [
										"onChange",
										"label",
										"modelValue",
										"onUpdate:modelValue",
										"placeholder",
										"suggestions"
									])])
								])];
							}),
							_: 1
						}, _parent, _scopeId));
						_push(`</div>`);
					} else return [createVNode("div", { class: "flex items-center justify-center gap-4" }, [_ctx.$can("create-tables") ? (openBlock(), createBlock(Fragment, { key: 0 }, [_ctx.$page.props.selected_store ? (openBlock(), createBlock(unref(_sfc_main$1), {
						key: 0,
						type: "button",
						onClick: ($event) => add.value = true
					}, {
						default: withCtx(() => [createTextVNode(toDisplayString(_ctx.$t("Add {x}", { x: _ctx.$t("Table") })), 1)]),
						_: 1
					}, 8, ["onClick"])) : (openBlock(), createBlock(unref(_sfc_main$1), {
						key: 1,
						type: "button",
						onClick: () => _ctx.$page.props.select_store = true
					}, {
						default: withCtx(() => [createTextVNode(toDisplayString(_ctx.$t("Add {x}", { x: _ctx.$t("Table") })), 1)]),
						_: 1
					}, 8, ["onClick"]))], 64)) : createCommentVNode("", true), createVNode(unref(_sfc_main$2), {
						align: "right",
						width: "56",
						"auto-close": false
					}, {
						trigger: withCtx(() => [createVNode("button", { class: "-m-2 flex items-center rounded-md p-2.5 transition duration-150 ease-in-out" }, [createVNode(_component_Icon, {
							name: "funnel-o",
							size: "size-5"
						}), createVNode("span", { class: "sr-only" }, toDisplayString(_ctx.$t("Show Filters")), 1)])]),
						content: withCtx(() => [createVNode("div", { class: "px-4 py-2" }, [
							createVNode("div", null, [createVNode(unref(_sfc_main$3), {
								json: true,
								"value-key": "id",
								"label-key": "name",
								onChange: unref(searchNow),
								label: _ctx.$t("Hall"),
								suggestions: __props.halls,
								modelValue: unref(filters).hall_id,
								"onUpdate:modelValue": ($event) => unref(filters).hall_id = $event,
								placeholder: _ctx.$t("All Halls")
							}, null, 8, [
								"onChange",
								"label",
								"suggestions",
								"modelValue",
								"onUpdate:modelValue",
								"placeholder"
							])]),
							createVNode("div", { class: "mt-4" }, [createVNode(unref(_sfc_main$3), {
								json: true,
								onChange: unref(searchNow),
								label: _ctx.$t("Status"),
								modelValue: unref(filters).active,
								"onUpdate:modelValue": ($event) => unref(filters).active = $event,
								placeholder: _ctx.$t("All"),
								suggestions: [{
									value: "1",
									label: _ctx.$t("Active")
								}, {
									value: "0",
									label: _ctx.$t("Inactive")
								}]
							}, null, 8, [
								"onChange",
								"label",
								"modelValue",
								"onUpdate:modelValue",
								"placeholder",
								"suggestions"
							])]),
							createVNode("div", { class: "mt-4" }, [createVNode(unref(_sfc_main$3), {
								json: true,
								onChange: unref(searchNow),
								label: _ctx.$t("Trashed"),
								modelValue: unref(filters).trashed,
								"onUpdate:modelValue": ($event) => unref(filters).trashed = $event,
								placeholder: _ctx.$t("With Trashed"),
								suggestions: [
									{
										value: "not",
										label: _ctx.$t("Not Trashed")
									},
									{
										value: "with",
										label: _ctx.$t("With Trashed")
									},
									{
										value: "only",
										label: _ctx.$t("Only Trashed")
									}
								]
							}, null, 8, [
								"onChange",
								"label",
								"modelValue",
								"onUpdate:modelValue",
								"placeholder",
								"suggestions"
							])])
						])]),
						_: 1
					})])];
				}),
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`${ssrInterpolate(_ctx.$t("Restaurant Tables"))} `);
					else return [createTextVNode(toDisplayString(_ctx.$t("Restaurant Tables")) + " ", 1)];
				}),
				_: 1
			}, _parent));
			_push(`<div class="relative flex grow flex-col items-stretch justify-stretch self-stretch bg-white px-4 sm:px-6 lg:px-8 dark:bg-gray-800">`);
			if (unref(searching)) _push(ssrRenderComponent(unref(_sfc_main$4), { "circle-size": "w-10 h-10" }, null, _parent));
			else _push(`<!---->`);
			_push(`<div class="flow-root grow"><div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8"><div class="my-2 inline-block min-w-full border-b border-gray-200 align-middle dark:border-gray-700"><table class="fixed-actions min-w-full divide-y divide-gray-200 dark:divide-gray-700"><thead class="whitespace-nowrap"><tr><th scope="col" class="text-focus py-3.5 ps-4 pe-3 text-start text-sm font-semibold sm:ps-6 lg:ps-8"><div class="inline-flex"><span>${ssrInterpolate(_ctx.$t("Table Name"))}</span>`);
			_push(ssrRenderComponent(_component_SortIcons, {
				sort: "name",
				filters: unref(filters)
			}, null, _parent));
			_push(`</div></th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold">${ssrInterpolate(_ctx.$t("Hall Name"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-center text-sm font-semibold">${ssrInterpolate(_ctx.$t("Seats"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-center text-sm font-semibold">${ssrInterpolate(_ctx.$t("Order"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold">${ssrInterpolate(_ctx.$t("Description"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-center text-sm font-semibold"><div class="inline-flex"><span>${ssrInterpolate(_ctx.$t("Status"))}</span>`);
			_push(ssrRenderComponent(_component_SortIcons, {
				sort: "active",
				filters: unref(filters)
			}, null, _parent));
			_push(`</div></th><th scope="col" class="relative w-16 py-3.5 ps-3 pe-4 sm:pe-6 lg:pe-8"></th></tr></thead><tbody class="divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-900">`);
			if (__props.pagination && __props.pagination.data && __props.pagination.data.length) {
				_push(`<!--[-->`);
				ssrRenderList(__props.pagination.data, (row) => {
					_push(`<tr tabindex="0" class="${ssrRenderClass({ "bg-gray-100 opacity-25 dark:bg-gray-900": deleted.value === row.id })}"><td class="text-focus py-4 ps-4 pe-3 text-sm font-medium whitespace-nowrap sm:ps-6 lg:ps-8"><div class="flex items-center text-sm"><div><p class="font-semibold">${ssrInterpolate(row.name)}</p>`);
					if (row.deleted_at) _push(`<p class="text-xs text-red-600 dark:text-red-400">${ssrInterpolate(_ctx.$t("Deleted"))}</p>`);
					else _push(`<!---->`);
					_push(`</div></div></td><td class="cursor-pointer px-3 py-4 text-sm font-semibold whitespace-nowrap">${ssrInterpolate(row.hall?.name || "")}</td><td class="cursor-pointer px-3 py-4 text-center text-sm font-semibold whitespace-nowrap">${ssrInterpolate(row.seats)}</td><td class="cursor-pointer px-3 py-4 text-center text-sm font-semibold whitespace-nowrap">${ssrInterpolate(row.order)}</td><td class="cursor-pointer px-3 py-4 text-sm font-semibold whitespace-nowrap">${ssrInterpolate(row.description)}</td><td class="cursor-pointer px-3 py-4 text-center text-sm font-semibold whitespace-nowrap">`);
					if (row.active) _push(ssrRenderComponent(_component_Badge, { variant: "success" }, {
						default: withCtx((_, _push, _parent, _scopeId) => {
							if (_push) _push(`${ssrInterpolate(_ctx.$t("Active"))}`);
							else return [createTextVNode(toDisplayString(_ctx.$t("Active")), 1)];
						}),
						_: 2
					}, _parent));
					else _push(ssrRenderComponent(_component_Badge, { variant: "danger" }, {
						default: withCtx((_, _push, _parent, _scopeId) => {
							if (_push) _push(`${ssrInterpolate(_ctx.$t("Inactive"))}`);
							else return [createTextVNode(toDisplayString(_ctx.$t("Inactive")), 1)];
						}),
						_: 2
					}, _parent));
					_push(`</td><td class="${ssrRenderClass([{ deleted: row.deleted_at }, "relative w-16 py-4 ps-3 pe-4 text-end text-sm font-medium whitespace-nowrap sm:pe-6 lg:pe-8"])}">`);
					_push(ssrRenderComponent(unref(_sfc_main$5), {
						row,
						editRow,
						deleted: deleted.value,
						permission: "tables",
						deleting: deleting.value,
						deleteRow,
						record: _ctx.$t("Table")
					}, null, _parent));
					_push(`</td></tr>`);
				});
				_push(`<!--]-->`);
			} else _push(`<tr><td colspan="100%"><div class="text-mute py-3.5 ps-4 pe-3 text-sm font-light whitespace-nowrap sm:ps-2 lg:ps-4">${ssrInterpolate(_ctx.$t("There is no data to display!"))}</div></td></tr>`);
			_push(`</tbody></table></div></div></div><div class="-mx-4 sm:-mx-6 lg:-mx-8">`);
			_push(ssrRenderComponent(unref(_sfc_main$6), {
				class: "mx-4 mt-auto py-2 text-sm sm:mx-6",
				meta: __props.pagination.meta,
				links: __props.pagination.links
			}, null, _parent));
			_push(`</div></div>`);
			_push(ssrRenderComponent(unref(_sfc_main$7), {
				show: add.value,
				onClose: hideForm,
				maxWidth: "xl"
			}, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(ssrRenderComponent(_sfc_main$9, {
						current: current.value,
						halls: __props.halls,
						onClose: hideForm,
						onDone: unref(searchNow)
					}, null, _parent, _scopeId));
					else return [createVNode(_sfc_main$9, {
						current: current.value,
						halls: __props.halls,
						onClose: hideForm,
						onDone: unref(searchNow)
					}, null, 8, [
						"current",
						"halls",
						"onDone"
					])];
				}),
				_: 1
			}, _parent));
			_push(`<!--]-->`);
		};
	}
});
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/Table/Index.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
//#endregion
export { _sfc_main as default };
