import { H as PageSearch, v as _sfc_main$2, x as _sfc_main$1 } from "../ssr.js";
import { t as _sfc_main$3 } from "./AdminLayout-eZgRfDMK.js";
import { Fragment, createBlock, createTextVNode, createVNode, openBlock, resolveComponent, toDisplayString, unref, useSSRContext, withCtx } from "vue";
import { ssrInterpolate, ssrRenderClass, ssrRenderComponent, ssrRenderList } from "vue/server-renderer";
//#region resources/js/Pages/Sma/People/Customer/Statement.vue
var _sfc_main = /* @__PURE__ */ Object.assign({ layout: _sfc_main$3 }, {
	__name: "Statement",
	__ssrInlineRender: true,
	props: ["pagination", "customer"],
	setup(__props) {
		const { filters, searching, sortBy } = PageSearch();
		return (_ctx, _push, _parent, _attrs) => {
			const _component_Head = resolveComponent("Head");
			const _component_Header = resolveComponent("Header");
			const _component_Link = resolveComponent("Link");
			const _component_Icon = resolveComponent("Icon");
			_push(`<!--[-->`);
			_push(ssrRenderComponent(_component_Head, null, {
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) _push(`<title${_scopeId}>${ssrInterpolate(_ctx.$t("Customer Statement"))}</title>`);
					else return [createVNode("title", null, toDisplayString(_ctx.$t("Customer Statement")), 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}>`);
						_push(ssrRenderComponent(_component_Link, {
							class: "btn-primary",
							href: _ctx.route("customers.index")
						}, {
							default: withCtx((_, _push, _parent, _scopeId) => {
								if (_push) _push(`${ssrInterpolate(_ctx.$t("List {x}", { x: _ctx.$t("Customers") }))}`);
								else return [createTextVNode(toDisplayString(_ctx.$t("List {x}", { x: _ctx.$t("Customers") })), 1)];
							}),
							_: 1
						}, _parent, _scopeId));
						_push(`</div>`);
					} else return [createVNode("div", { class: "flex items-center justify-center gap-4" }, [createVNode(_component_Link, {
						class: "btn-primary",
						href: _ctx.route("customers.index")
					}, {
						default: withCtx(() => [createTextVNode(toDisplayString(_ctx.$t("List {x}", { x: _ctx.$t("Customers") })), 1)]),
						_: 1
					}, 8, ["href"])])];
				}),
				default: withCtx((_, _push, _parent, _scopeId) => {
					if (_push) {
						_push(`${ssrInterpolate(_ctx.$t("Customer Statement"))} (${ssrInterpolate(__props.customer.company || __props.customer.name)}) `);
						if (__props.customer.balance < 0) _push(`<!--[-->(${ssrInterpolate(_ctx.$t("Adv"))}: ${ssrInterpolate(_ctx.$currency(0 - __props.customer.balance))})<!--]-->`);
						else _push(`<!--[-->(${ssrInterpolate(_ctx.$t("Due"))}: ${ssrInterpolate(_ctx.$currency(__props.customer.balance))})<!--]-->`);
					} else return [createTextVNode(toDisplayString(_ctx.$t("Customer Statement")) + " (" + toDisplayString(__props.customer.company || __props.customer.name) + ") ", 1), __props.customer.balance < 0 ? (openBlock(), createBlock(Fragment, { key: 0 }, [createTextVNode("(" + toDisplayString(_ctx.$t("Adv")) + ": " + toDisplayString(_ctx.$currency(0 - __props.customer.balance)) + ")", 1)], 64)) : (openBlock(), createBlock(Fragment, { key: 1 }, [createTextVNode("(" + toDisplayString(_ctx.$t("Due")) + ": " + toDisplayString(_ctx.$currency(__props.customer.balance)) + ")", 1)], 64))];
				}),
				_: 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$1), { "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="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"><button type="button" class="flex items-center gap-2 whitespace-nowrap">${ssrInterpolate(_ctx.$t("Created at"))} `);
			if (unref(filters)?.sort?.startsWith("created_at:")) _push(ssrRenderComponent(_component_Icon, {
				size: "size-3 text-mute",
				name: unref(filters).sort == "created_at: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"><button type="button" class="flex items-center gap-2 whitespace-nowrap">${ssrInterpolate(_ctx.$t("Description"))} `);
			if (unref(filters)?.sort?.startsWith("description:")) _push(ssrRenderComponent(_component_Icon, {
				size: "size-3 text-mute",
				name: unref(filters).sort == "description:desc" ? "c-up" : "c-down"
			}, null, _parent));
			else _push(`<!---->`);
			_push(`</button></th><th scope="col" class="text-focus px-3 py-3.5 text-end text-sm font-semibold whitespace-nowrap">${ssrInterpolate(_ctx.$t("Debit"))}</th><th scope="col" class="text-focus px-3 py-3.5 text-end text-sm font-semibold whitespace-nowrap">${ssrInterpolate(_ctx.$t("Credit"))}</th><th scope="col" class="text-focus py-3.5 ps-3 pe-6 text-end text-sm font-semibold whitespace-nowrap">${ssrInterpolate(_ctx.$t("Balance"))}</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 class="${ssrRenderClass(row.deleted_at ? "bg-red-100 dark:bg-red-950" : "")}"><td class="py-4 ps-6 pe-3 text-sm whitespace-nowrap">${ssrInterpolate(_ctx.$datetime(row.created_at))}</td><td class="px-3 py-4 text-sm whitespace-nowrap"><div class="-my-2 line-clamp-2 min-w-64">${(row.description || "") ?? ""}</div></td><td class="px-3 py-4 text-end text-sm whitespace-nowrap text-red-600 dark:text-red-400">${ssrInterpolate(row.value < 0 ? _ctx.$currency(Math.abs(row.value)) : "-")}</td><td class="px-3 py-4 text-end text-sm whitespace-nowrap text-green-600 dark:text-green-400">${ssrInterpolate(row.value > 0 ? _ctx.$currency(row.value) : "-")}</td><td class="${ssrRenderClass([row.balance < 0 ? "text-red-600 dark:text-red-400" : "text-green-600 dark:text-green-400", "py-4 ps-3 pe-6 text-end text-sm font-semibold whitespace-nowrap"])}">${ssrInterpolate(_ctx.$currency(row.balance))}</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$2), {
				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><!--]-->`);
		};
	}
});
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/Customer/Statement.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
//#endregion
export { _sfc_main as default };
