import { H as PageSearch, M as _sfc_main$4, ft as _sfc_main$3, k as _sfc_main$1, pt as _sfc_main$2, st as _sfc_main$6, v as _sfc_main$7, vt as _sfc_main$8, x as _sfc_main$5 } from "../ssr.js";
import { t as _sfc_main$9 } from "./AdminLayout-eZgRfDMK.js";
import { n as _sfc_main$10 } from "./Form-DNHSalxg.js";
import _sfc_main$11 from "./Form-3dyZUi_r.js";
import _sfc_main$12 from "./Form-B3ZvlL0V.js";
import _sfc_main$13 from "./View-CHeiwCAv.js";
import { router } from "@inertiajs/vue3";
import { Fragment, createBlock, createCommentVNode, createTextVNode, createVNode, openBlock, ref, renderList, resolveComponent, toDisplayString, unref, useSSRContext, withCtx } from "vue";
import { ssrInterpolate, ssrRenderComponent, ssrRenderList } from "vue/server-renderer";
//#region resources/js/Pages/Sma/People/Supplier/Index.vue
var _sfc_main = /* @__PURE__ */ Object.assign({ layout: _sfc_main$9 }, {
	__name: "Index",
	__ssrInlineRender: true,
	props: [
		"pagination",
		"countries",
		"custom_fields",
		"payment_fields"
	],
	setup(__props) {
		const add = ref(false);
		const user = ref(null);
		const view = ref(false);
		const current = ref(null);
		const payment = ref(false);
		const deleted = ref(false);
		const add_user = ref(false);
		const deleting = ref(false);
		const show_users = 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(route("suppliers.destroy", row.id), {
				preserveScroll: true,
				onSuccess: () => deleted.value = row.id,
				onFinish: () => deleting.value = false
			});
		}
		function hideForm() {
			if (!view.value) current.value = null;
			add.value = false;
		}
		function editUser(row) {
			user.value = row;
			add_user.value = true;
		}
		return (_ctx, _push, _parent, _attrs) => {
			const _component_Head = resolveComponent("Head");
			const _component_Header = resolveComponent("Header");
			const _component_Icon = resolveComponent("Icon");
			const _component_Link = resolveComponent("Link");
			_push(`<!--[-->`);
			_push(ssrRenderComponent(_component_Head, null, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`<title${_scopeId}>${ssrInterpolate(_ctx.$t("Suppliers"))}</title>`);
					else return [createVNode("title", null, toDisplayString(_ctx.$t("Suppliers")), 1)];
				}),
				_: 1
			}, _parent));
			_push(ssrRenderComponent(_component_Header, null, {
				subheading: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`${ssrInterpolate(_ctx.$t("Please review the data below"))}`);
					else return [createTextVNode(toDisplayString(_ctx.$t("Please review the data below")), 1)];
				}),
				menu: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) {
						_push(`<div class="flex items-center justify-center gap-4"${_scopeId}>`);
						if (_ctx.$can("create-suppliers")) _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("Supplier") }))}`);
								else return [createTextVNode(toDisplayString(_ctx.$t("Add {x}", { x: _ctx.$t("Supplier") })), 1)];
							}),
							_: 1
						}, _parent, _scopeId));
						else _push(`<!---->`);
						if (_ctx.$can(["import-suppliers", "export-suppliers"])) _push(ssrRenderComponent(unref(_sfc_main$2), {
							align: "right",
							width: "40",
							"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: "v-arrows",
										size: "size-6"
									}, null, _parent, _scopeId));
									_push(`<span class="sr-only"${_scopeId}>${ssrInterpolate(_ctx.$t("Import/Export"))}</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: "v-arrows",
									size: "size-6"
								}), createVNode("span", { class: "sr-only" }, toDisplayString(_ctx.$t("Import/Export")), 1)])];
							}),
							content: withCtx((_, _push, _parent, _scopeId) => {
								if (_push) {
									_push(`<div${_scopeId}><div class="block px-4 py-2 text-xs text-gray-400"${_scopeId}>${ssrInterpolate(_ctx.$t("Import/Export"))}</div>`);
									if (_ctx.route().has("suppliers.import") && _ctx.$can("import-suppliers")) _push(ssrRenderComponent(unref(_sfc_main$3), { href: _ctx.route("suppliers.import") }, {
										default: withCtx((_, _push, _parent, _scopeId) => {
											if (_push) _push(`${ssrInterpolate(_ctx.$t("Import {x}", { x: _ctx.$t("Suppliers") }))}`);
											else return [createTextVNode(toDisplayString(_ctx.$t("Import {x}", { x: _ctx.$t("Suppliers") })), 1)];
										}),
										_: 1
									}, _parent, _scopeId));
									else _push(`<!---->`);
									if (_ctx.route().has("suppliers.export") && _ctx.$can("export-suppliers")) _push(ssrRenderComponent(unref(_sfc_main$3), {
										as: "a",
										href: _ctx.route("suppliers.export")
									}, {
										default: withCtx((_, _push, _parent, _scopeId) => {
											if (_push) _push(`${ssrInterpolate(_ctx.$t("Export {x}", { x: _ctx.$t("Suppliers") }))}`);
											else return [createTextVNode(toDisplayString(_ctx.$t("Export {x}", { x: _ctx.$t("Suppliers") })), 1)];
										}),
										_: 1
									}, _parent, _scopeId));
									else _push(`<!---->`);
									_push(`</div>`);
								} else return [createVNode("div", null, [
									createVNode("div", { class: "block px-4 py-2 text-xs text-gray-400" }, toDisplayString(_ctx.$t("Import/Export")), 1),
									_ctx.route().has("suppliers.import") && _ctx.$can("import-suppliers") ? (openBlock(), createBlock(unref(_sfc_main$3), {
										key: 0,
										href: _ctx.route("suppliers.import")
									}, {
										default: withCtx(() => [createTextVNode(toDisplayString(_ctx.$t("Import {x}", { x: _ctx.$t("Suppliers") })), 1)]),
										_: 1
									}, 8, ["href"])) : createCommentVNode("", true),
									_ctx.route().has("suppliers.export") && _ctx.$can("export-suppliers") ? (openBlock(), createBlock(unref(_sfc_main$3), {
										key: 1,
										as: "a",
										href: _ctx.route("suppliers.export")
									}, {
										default: withCtx(() => [createTextVNode(toDisplayString(_ctx.$t("Export {x}", { x: _ctx.$t("Suppliers") })), 1)]),
										_: 1
									}, 8, ["href"])) : createCommentVNode("", true)
								])];
							}),
							_: 1
						}, _parent, _scopeId));
						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$4), {
										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$4), {
									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-suppliers") ? (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("Supplier") })), 1)]),
							_: 1
						}, 8, ["onClick"])) : createCommentVNode("", true),
						_ctx.$can(["import-suppliers", "export-suppliers"]) ? (openBlock(), createBlock(unref(_sfc_main$2), {
							key: 1,
							align: "right",
							width: "40",
							"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: "v-arrows",
								size: "size-6"
							}), createVNode("span", { class: "sr-only" }, toDisplayString(_ctx.$t("Import/Export")), 1)])]),
							content: withCtx(() => [createVNode("div", null, [
								createVNode("div", { class: "block px-4 py-2 text-xs text-gray-400" }, toDisplayString(_ctx.$t("Import/Export")), 1),
								_ctx.route().has("suppliers.import") && _ctx.$can("import-suppliers") ? (openBlock(), createBlock(unref(_sfc_main$3), {
									key: 0,
									href: _ctx.route("suppliers.import")
								}, {
									default: withCtx(() => [createTextVNode(toDisplayString(_ctx.$t("Import {x}", { x: _ctx.$t("Suppliers") })), 1)]),
									_: 1
								}, 8, ["href"])) : createCommentVNode("", true),
								_ctx.route().has("suppliers.export") && _ctx.$can("export-suppliers") ? (openBlock(), createBlock(unref(_sfc_main$3), {
									key: 1,
									as: "a",
									href: _ctx.route("suppliers.export")
								}, {
									default: withCtx(() => [createTextVNode(toDisplayString(_ctx.$t("Export {x}", { x: _ctx.$t("Suppliers") })), 1)]),
									_: 1
								}, 8, ["href"])) : createCommentVNode("", true)
							])]),
							_: 1
						})) : 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$4), {
								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("Suppliers"))} `);
					else return [createTextVNode(toDisplayString(_ctx.$t("Suppliers")) + " ", 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$5), { "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><tr><th scope="col" class="text-focus py-3.5 ps-6 pe-3 text-start text-sm font-semibold whitespace-nowrap sm:ps-6 lg:ps-8"><button type="button" class="flex items-center gap-2 whitespace-nowrap">${ssrInterpolate(_ctx.$t("Company"))} `);
			if (unref(filters)?.sort?.startsWith("company:")) _push(ssrRenderComponent(_component_Icon, {
				size: "size-3 text-mute",
				company: unref(filters).sort == "company:desc" ? "c-up" : "c-down"
			}, null, _parent));
			else _push(`<!---->`);
			_push(`</button></th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"><button type="button" class="flex items-center gap-2 whitespace-nowrap">${ssrInterpolate(_ctx.$t("Name"))} `);
			if (unref(filters)?.sort?.startsWith("name:")) _push(ssrRenderComponent(_component_Icon, {
				size: "size-3 text-mute",
				name: unref(filters).sort == "name:desc" ? "c-up" : "c-down"
			}, null, _parent));
			else _push(`<!---->`);
			_push(`</button></th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"><button type="button" class="flex items-center gap-2 whitespace-nowrap">${ssrInterpolate(_ctx.$t("Phone"))} `);
			if (unref(filters)?.sort?.startsWith("phone:")) _push(ssrRenderComponent(_component_Icon, {
				size: "size-3 text-mute",
				name: unref(filters).sort == "phone:desc" ? "c-up" : "c-down"
			}, null, _parent));
			else _push(`<!---->`);
			_push(`</button></th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"><button type="button" class="flex items-center gap-2 whitespace-nowrap">${ssrInterpolate(_ctx.$t("Email"))} `);
			if (unref(filters)?.sort?.startsWith("email:")) _push(ssrRenderComponent(_component_Icon, {
				size: "size-3 text-mute",
				name: unref(filters).sort == "email:desc" ? "c-up" : "c-down"
			}, null, _parent));
			else _push(`<!---->`);
			_push(`</button></th><th scope="col" class="text-focus px-3 py-3.5 text-center text-sm font-semibold whitespace-nowrap">${ssrInterpolate(_ctx.$t("Due"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-center text-sm font-semibold whitespace-nowrap"><button type="button" class="flex items-center gap-2 whitespace-nowrap">${ssrInterpolate(_ctx.$t("Due Limit"))} `);
			if (unref(filters)?.sort?.startsWith("due_limit:")) _push(ssrRenderComponent(_component_Icon, {
				size: "size-3 text-mute",
				name: unref(filters).sort == "due_limit:desc" ? "c-up" : "c-down"
			}, null, _parent));
			else _push(`<!---->`);
			_push(`</button></th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap">${ssrInterpolate(_ctx.$t("Address"))}</th><th scope="col" class="relative w-16 py-3.5 ps-3 pe-4 sm:pe-6 lg:pe-8"><span class="sr-only">${ssrInterpolate(_ctx.$t("Actions"))}</span></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><td class="cursor-pointer py-4 ps-4 pe-3 text-sm whitespace-nowrap sm:ps-6 lg:ps-8">${ssrInterpolate(row.company)}</td><td class="cursor-pointer px-3 py-4 text-sm whitespace-nowrap">${ssrInterpolate(row.name || "")}</td><td class="cursor-pointer px-3 py-4 text-sm whitespace-nowrap">${ssrInterpolate(row.phone || "")}</td><td class="cursor-pointer px-3 py-4 text-sm whitespace-nowrap">${ssrInterpolate(row.email || "")}</td><td class="px-3 py-4 text-end text-sm whitespace-nowrap">`);
					if (_ctx.$page.props.selected_store && _ctx.$can("create-payments")) {
						_push(`<button class="link" type="button">`);
						if (row.balance < 0) _push(`<!--[-->${ssrInterpolate(_ctx.$t("Adv"))}: ${ssrInterpolate(_ctx.$currency(0 - row.balance))}<!--]-->`);
						else _push(`<!--[-->${ssrInterpolate(_ctx.$currency(row.balance))}<!--]-->`);
						_push(`</button>`);
					} else {
						_push(`<!--[-->`);
						if (row.balance < 0) _push(`<!--[-->${ssrInterpolate(_ctx.$t("Adv"))}: ${ssrInterpolate(_ctx.$currency(0 - row.balance))}<!--]-->`);
						else _push(`<!--[-->${ssrInterpolate(_ctx.$currency(row.balance))}<!--]-->`);
						_push(`<!--]-->`);
					}
					_push(`</td><td class="cursor-pointer px-3 py-4 text-end text-sm whitespace-nowrap">${ssrInterpolate(row.due_limit ? _ctx.$number(row.due_limit) : "")}</td><td class="cursor-pointer px-3 py-4 text-sm"><div class="-my-2 line-clamp-2 max-w-xs min-w-64">${ssrInterpolate(_ctx.$address(row))}</div></td><td class="relative w-16 py-4 ps-3 pe-4 text-end text-sm font-medium whitespace-nowrap sm:pe-6 lg:pe-8"><div class="text-mute flex items-center gap-4">`);
					_push(ssrRenderComponent(_component_Link, {
						href: _ctx.route("suppliers.statement", row.id),
						class: "link"
					}, {
						default: withCtx((_, _push, _parent, _scopeId) => {
							if (_push) _push(ssrRenderComponent(_component_Icon, {
								name: "statement",
								class: "size-5"
							}, null, _parent, _scopeId));
							else return [createVNode(_component_Icon, {
								name: "statement",
								class: "size-5"
							})];
						}),
						_: 2
					}, _parent));
					_push(`<button type="button" class="link">`);
					_push(ssrRenderComponent(_component_Icon, {
						name: "users",
						class: "size-5"
					}, null, _parent));
					_push(`</button>`);
					_push(ssrRenderComponent(unref(_sfc_main$6), {
						row,
						editRow,
						deleted: deleted.value,
						deleting: deleting.value,
						deleteRow,
						permission: "suppliers",
						record: _ctx.$t("Supplier")
					}, null, _parent));
					_push(`</div></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$7), {
				class: "mx-4 mt-auto py-2 text-sm sm:mx-6",
				meta: __props.pagination.meta,
				links: __props.pagination.links
			}, null, _parent));
			_push(`</div>`);
			_push(ssrRenderComponent(unref(_sfc_main$8), {
				show: view.value,
				backdrop: false,
				"max-width": "3xl",
				closeable: true,
				onClose: ($event) => view.value = false
			}, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(ssrRenderComponent(_sfc_main$13, {
						current: current.value,
						onClose: ($event) => view.value = false,
						editRow
					}, null, _parent, _scopeId));
					else return [createVNode(_sfc_main$13, {
						current: current.value,
						onClose: ($event) => view.value = false,
						editRow
					}, null, 8, ["current", "onClose"])];
				}),
				_: 1
			}, _parent));
			_push(ssrRenderComponent(unref(_sfc_main$8), {
				show: add.value,
				backdrop: false,
				overflow: true,
				"max-width": "2xl",
				closeable: true,
				onClose: hideForm
			}, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(ssrRenderComponent(_sfc_main$10, {
						current: current.value,
						onClose: hideForm,
						onDone: hideForm,
						countries: __props.countries,
						custom_fields: __props.custom_fields
					}, null, _parent, _scopeId));
					else return [createVNode(_sfc_main$10, {
						current: current.value,
						onClose: hideForm,
						onDone: hideForm,
						countries: __props.countries,
						custom_fields: __props.custom_fields
					}, null, 8, [
						"current",
						"countries",
						"custom_fields"
					])];
				}),
				_: 1
			}, _parent));
			_push(ssrRenderComponent(unref(_sfc_main$8), {
				show: payment.value,
				backdrop: false,
				overflow: true,
				"max-width": "2xl",
				closeable: true,
				onClose: ($event) => payment.value = false
			}, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(ssrRenderComponent(_sfc_main$11, {
						current: null,
						supplier: current.value,
						custom_fields: __props.payment_fields,
						onClose: ($event) => payment.value = false,
						onDone: ($event) => payment.value = false
					}, null, _parent, _scopeId));
					else return [createVNode(_sfc_main$11, {
						current: null,
						supplier: current.value,
						custom_fields: __props.payment_fields,
						onClose: ($event) => payment.value = false,
						onDone: ($event) => payment.value = false
					}, null, 8, [
						"supplier",
						"custom_fields",
						"onClose",
						"onDone"
					])];
				}),
				_: 1
			}, _parent));
			_push(ssrRenderComponent(unref(_sfc_main$8), {
				show: show_users.value,
				backdrop: false,
				overflow: true,
				"max-width": "3xl",
				closeable: true,
				onClose: ($event) => show_users.value = false
			}, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) {
						_push(`<div${_scopeId}><span class="absolute end-12 top-5 inline-flex items-center sm:end-14"${_scopeId}><button type="button" class="link -m-2 flex items-center gap-1 rounded-md border px-1 py-0.5"${_scopeId}>`);
						_push(ssrRenderComponent(_component_Icon, {
							name: "add",
							class: "size-5"
						}, null, _parent, _scopeId));
						_push(` ${ssrInterpolate(_ctx.$t("Add {x}", { x: _ctx.$t("User") }))}</button></span><div class="border-b border-gray-200 px-6 py-4 dark:border-gray-700"${_scopeId}><div class="sm:flex sm:items-baseline sm:justify-between"${_scopeId}><div class="sm:w-0 sm:flex-1"${_scopeId}><h1 class="text-focus text-base font-semibold"${_scopeId}>${ssrInterpolate(_ctx.$t("List {x}", { x: _ctx.$t("Users") }))} ${ssrInterpolate(current.value ? " (" + current.value.name + ")" : "")}</h1><p class="text-mute mt-1 truncate text-sm"${_scopeId}>${ssrInterpolate(_ctx.$t("Please view the supplier users below."))}</p></div></div></div><div class="overflow-x-auto pb-6"${_scopeId}>`);
						if (!current.value.users?.length) _push(`<div class="px-6 pt-6"${_scopeId}><p class="text-mute"${_scopeId}>${ssrInterpolate(_ctx.$t("No users found for this supplier."))}</p></div>`);
						else {
							_push(`<table class="fixed-actions min-w-full divide-y divide-gray-200 dark:divide-gray-700"${_scopeId}><thead${_scopeId}><tr${_scopeId}><th scope="col" class="text-focus py-3.5 ps-4 pe-3 text-start text-sm font-semibold whitespace-nowrap sm:ps-6 lg:ps-8"${_scopeId}>${ssrInterpolate(_ctx.$t("Name"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"${_scopeId}>${ssrInterpolate(_ctx.$t("Phone"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"${_scopeId}>${ssrInterpolate(_ctx.$t("Username"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"${_scopeId}>${ssrInterpolate(_ctx.$t("Email"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold"${_scopeId}>${ssrInterpolate(_ctx.$t("Active"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"${_scopeId}>${ssrInterpolate(_ctx.$t("Impersonate"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"${_scopeId}>${ssrInterpolate(_ctx.$t("Created at"))}</th><th scope="col" class="relative w-16 py-3.5 ps-3 pe-4 sm:pe-6 lg:pe-8"${_scopeId}><span class="sr-only"${_scopeId}>${ssrInterpolate(_ctx.$t("Actions"))}</span></th></tr></thead><tbody class="divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-900"${_scopeId}>`);
							if (current.value.users?.length) {
								_push(`<!--[-->`);
								ssrRenderList(current.value.users, (row) => {
									_push(`<tr${_scopeId}><td class="py-4 ps-4 pe-3 text-sm whitespace-nowrap sm:ps-6 lg:ps-8"${_scopeId}>${ssrInterpolate(row.name)}</td><td class="px-3 py-4 text-sm whitespace-nowrap"${_scopeId}>${ssrInterpolate(row.phone || "")}</td><td class="px-3 py-4 text-sm whitespace-nowrap"${_scopeId}>${ssrInterpolate(row.username || "")}</td><td class="px-3 py-4 text-sm whitespace-nowrap"${_scopeId}>${ssrInterpolate(row.email || "")}</td><td class="px-3 py-4 text-sm whitespace-nowrap"${_scopeId}><div class="flex items-center justify-center"${_scopeId}>${_ctx.$boolean(row.active, true) ?? ""}</div></td><td class="px-3 py-4 text-sm whitespace-nowrap"${_scopeId}><div class="flex items-center justify-center"${_scopeId}>${_ctx.$boolean(row.can_be_impersonated, true) ?? ""}</div></td><td class="px-3 py-4 text-sm whitespace-nowrap"${_scopeId}>${ssrInterpolate(_ctx.$datetime(row.created_at))}</td><td class="relative w-16 py-4 ps-3 pe-4 text-end text-sm font-medium whitespace-nowrap sm:pe-6 lg:pe-8"${_scopeId}><div class="text-mute flex items-center gap-4"${_scopeId}>`);
									_push(ssrRenderComponent(_component_Link, {
										href: _ctx.route("impersonate", row.id),
										class: "link"
									}, {
										default: withCtx((_, _push, _parent, _scopeId) => {
											if (_push) _push(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="size-5"${_scopeId}><path d="m16 11 2 2 4-4"${_scopeId}></path><path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"${_scopeId}></path><circle cx="9" cy="7" r="4"${_scopeId}></circle></svg>`);
											else return [(openBlock(), createBlock("svg", {
												xmlns: "http://www.w3.org/2000/svg",
												viewBox: "0 0 24 24",
												fill: "none",
												stroke: "currentColor",
												"stroke-width": "2",
												"stroke-linecap": "round",
												"stroke-linejoin": "round",
												class: "size-5"
											}, [
												createVNode("path", { d: "m16 11 2 2 4-4" }),
												createVNode("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
												createVNode("circle", {
													cx: "9",
													cy: "7",
													r: "4"
												})
											]))];
										}),
										_: 2
									}, _parent, _scopeId));
									_push(`<button type="button" class="link"${_scopeId}>`);
									_push(ssrRenderComponent(_component_Icon, {
										name: "edit",
										class: "size-5"
									}, null, _parent, _scopeId));
									_push(`</button>`);
									_push(ssrRenderComponent(unref(_sfc_main$6), {
										row,
										permission: "users",
										deleting: deleting.value,
										record: _ctx.$t("User"),
										deleteRow
									}, null, _parent, _scopeId));
									_push(`</div></td></tr>`);
								});
								_push(`<!--]-->`);
							} else _push(`<!---->`);
							_push(`</tbody></table>`);
						}
						_push(`</div></div>`);
					} else return [createVNode("div", null, [
						createVNode("span", { class: "absolute end-12 top-5 inline-flex items-center sm:end-14" }, [createVNode("button", {
							type: "button",
							onClick: ($event) => add_user.value = true,
							class: "link -m-2 flex items-center gap-1 rounded-md border px-1 py-0.5"
						}, [createVNode(_component_Icon, {
							name: "add",
							class: "size-5"
						}), createTextVNode(" " + toDisplayString(_ctx.$t("Add {x}", { x: _ctx.$t("User") })), 1)], 8, ["onClick"])]),
						createVNode("div", { class: "border-b border-gray-200 px-6 py-4 dark:border-gray-700" }, [createVNode("div", { class: "sm:flex sm:items-baseline sm:justify-between" }, [createVNode("div", { class: "sm:w-0 sm:flex-1" }, [createVNode("h1", { class: "text-focus text-base font-semibold" }, toDisplayString(_ctx.$t("List {x}", { x: _ctx.$t("Users") })) + " " + toDisplayString(current.value ? " (" + current.value.name + ")" : ""), 1), createVNode("p", { class: "text-mute mt-1 truncate text-sm" }, toDisplayString(_ctx.$t("Please view the supplier users below.")), 1)])])]),
						createVNode("div", { class: "overflow-x-auto pb-6" }, [!current.value.users?.length ? (openBlock(), createBlock("div", {
							key: 0,
							class: "px-6 pt-6"
						}, [createVNode("p", { class: "text-mute" }, toDisplayString(_ctx.$t("No users found for this supplier.")), 1)])) : (openBlock(), createBlock("table", {
							key: 1,
							class: "fixed-actions min-w-full divide-y divide-gray-200 dark:divide-gray-700"
						}, [createVNode("thead", null, [createVNode("tr", null, [
							createVNode("th", {
								scope: "col",
								class: "text-focus py-3.5 ps-4 pe-3 text-start text-sm font-semibold whitespace-nowrap sm:ps-6 lg:ps-8"
							}, toDisplayString(_ctx.$t("Name")), 1),
							createVNode("th", {
								scope: "col",
								class: "text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"
							}, toDisplayString(_ctx.$t("Phone")), 1),
							createVNode("th", {
								scope: "col",
								class: "text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"
							}, toDisplayString(_ctx.$t("Username")), 1),
							createVNode("th", {
								scope: "col",
								class: "text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"
							}, toDisplayString(_ctx.$t("Email")), 1),
							createVNode("th", {
								scope: "col",
								class: "text-focus px-3 py-3.5 text-start text-sm font-semibold"
							}, toDisplayString(_ctx.$t("Active")), 1),
							createVNode("th", {
								scope: "col",
								class: "text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"
							}, toDisplayString(_ctx.$t("Impersonate")), 1),
							createVNode("th", {
								scope: "col",
								class: "text-focus px-3 py-3.5 text-start text-sm font-semibold whitespace-nowrap"
							}, toDisplayString(_ctx.$t("Created at")), 1),
							createVNode("th", {
								scope: "col",
								class: "relative w-16 py-3.5 ps-3 pe-4 sm:pe-6 lg:pe-8"
							}, [createVNode("span", { class: "sr-only" }, toDisplayString(_ctx.$t("Actions")), 1)])
						])]), createVNode("tbody", { class: "divide-y divide-gray-200 bg-white dark:divide-gray-700 dark:bg-gray-900" }, [current.value.users?.length ? (openBlock(true), createBlock(Fragment, { key: 0 }, renderList(current.value.users, (row) => {
							return openBlock(), createBlock("tr", { key: row.id }, [
								createVNode("td", { class: "py-4 ps-4 pe-3 text-sm whitespace-nowrap sm:ps-6 lg:ps-8" }, toDisplayString(row.name), 1),
								createVNode("td", { class: "px-3 py-4 text-sm whitespace-nowrap" }, toDisplayString(row.phone || ""), 1),
								createVNode("td", { class: "px-3 py-4 text-sm whitespace-nowrap" }, toDisplayString(row.username || ""), 1),
								createVNode("td", { class: "px-3 py-4 text-sm whitespace-nowrap" }, toDisplayString(row.email || ""), 1),
								createVNode("td", { class: "px-3 py-4 text-sm whitespace-nowrap" }, [createVNode("div", {
									class: "flex items-center justify-center",
									innerHTML: _ctx.$boolean(row.active, true)
								}, null, 8, ["innerHTML"])]),
								createVNode("td", { class: "px-3 py-4 text-sm whitespace-nowrap" }, [createVNode("div", {
									class: "flex items-center justify-center",
									innerHTML: _ctx.$boolean(row.can_be_impersonated, true)
								}, null, 8, ["innerHTML"])]),
								createVNode("td", { class: "px-3 py-4 text-sm whitespace-nowrap" }, toDisplayString(_ctx.$datetime(row.created_at)), 1),
								createVNode("td", { class: "relative w-16 py-4 ps-3 pe-4 text-end text-sm font-medium whitespace-nowrap sm:pe-6 lg:pe-8" }, [createVNode("div", { class: "text-mute flex items-center gap-4" }, [
									createVNode(_component_Link, {
										href: _ctx.route("impersonate", row.id),
										class: "link"
									}, {
										default: withCtx(() => [(openBlock(), createBlock("svg", {
											xmlns: "http://www.w3.org/2000/svg",
											viewBox: "0 0 24 24",
											fill: "none",
											stroke: "currentColor",
											"stroke-width": "2",
											"stroke-linecap": "round",
											"stroke-linejoin": "round",
											class: "size-5"
										}, [
											createVNode("path", { d: "m16 11 2 2 4-4" }),
											createVNode("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
											createVNode("circle", {
												cx: "9",
												cy: "7",
												r: "4"
											})
										]))]),
										_: 1
									}, 8, ["href"]),
									createVNode("button", {
										type: "button",
										onClick: ($event) => editUser(row),
										class: "link"
									}, [createVNode(_component_Icon, {
										name: "edit",
										class: "size-5"
									})], 8, ["onClick"]),
									createVNode(unref(_sfc_main$6), {
										row,
										permission: "users",
										deleting: deleting.value,
										record: _ctx.$t("User"),
										deleteRow
									}, null, 8, [
										"row",
										"deleting",
										"record"
									])
								])])
							]);
						}), 128)) : createCommentVNode("", true)])]))])
					])];
				}),
				_: 1
			}, _parent));
			_push(ssrRenderComponent(unref(_sfc_main$8), {
				show: add_user.value,
				backdrop: false,
				overflow: true,
				"max-width": "2xl",
				closeable: true,
				onClose: ($event) => add_user.value = false
			}, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(ssrRenderComponent(_sfc_main$12, {
						current: user.value,
						supplier: current.value,
						onDone: ($event) => add_user.value = false,
						onClose: ($event) => add_user.value = false,
						custom_fields: __props.custom_fields
					}, null, _parent, _scopeId));
					else return [createVNode(_sfc_main$12, {
						current: user.value,
						supplier: current.value,
						onDone: ($event) => add_user.value = false,
						onClose: ($event) => add_user.value = false,
						custom_fields: __props.custom_fields
					}, null, 8, [
						"current",
						"supplier",
						"onDone",
						"onClose",
						"custom_fields"
					])];
				}),
				_: 1
			}, _parent));
			_push(`</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/People/Supplier/Index.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
//#endregion
export { _sfc_main as default };
