Files
appco_dist/.output/server/chunks/build/index-DqEAn4Lx.mjs
T
2025-08-24 13:00:31 +03:30

1776 lines
67 KiB
JavaScript

import { defineComponent, ref, unref, withCtx, createVNode, createBlock, createCommentVNode, openBlock, computed, reactive, watch, withAsyncContext, resolveDirective, toDisplayString, mergeProps, customRef, toValue, nextTick, createTextVNode, Fragment, renderList, renderSlot, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrRenderAttrs, ssrRenderAttr, ssrInterpolate, ssrRenderList, ssrGetDirectiveProps, ssrRenderSlot, ssrRenderClass } from 'vue/server-renderer';
import { _ as _imports_0 } from './search_gray-B8huMSPA.mjs';
import { u as useRouter$1, a as useConfigStore, N as Input, D as reactiveProjectName, ah as Tabs, ai as __nuxt_component_2$2, f as loading, aj as watchDebounced, C as getSupabaseStorageUrl, b as useUserStore, a1 as useRoute, a0 as useRouter, ak as tryOnScopeDispose$1, al as Menu, am as __nuxt_component_1$5, an as getCustomerList, B as useElementSize$1, ao as Collapse, ap as Slider$1, s as supabase, aq as Tag, P as myAxios, O as Button, ar as CheckboxGroup, as as Checkbox, at as __nuxt_component_6 } from './server.mjs';
import { B as BasicIconOld, u as usePrefix } from './BasicIconOld-93vAWohq.mjs';
import { l as loadGray, S as SquarePostSkeleton } from './gray-BT6NR-_-.mjs';
import { g as getStoreSearchPosts } from './media-c-l6vPxp.mjs';
import { cloneDeep } from 'lodash-es';
import { defineStore } from 'pinia';
import { u as usePrice } from './usePrice-B-5-jXKQ.mjs';
import { B as BasicButton } from './BasicButton-B9iMRxfW.mjs';
import { s as stdin_default } from './index-BVAEX5Zf.mjs';
import { u as useAsyncData } from './asyncData-BzPAimvL.mjs';
import { p as previewImg$1 } from './logo_preview-CJTcB_Eg.mjs';
import { ContentLoader } from 'vue-content-loader';
import { C as CustomerCard, a as CustomerCardSkeleton } from './CustomerCardSkeleton-kdwNkDdL.mjs';
import '../_/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:url';
import 'consola';
import 'ipx';
import 'node:path';
import 'node:crypto';
import '@supabase/supabase-js';
import '@babel/runtime/helpers/esm/extends';
import '@babel/runtime/helpers/esm/objectSpread2';
import '@ant-design/colors';
import '@ctrl/tinycolor';
import 'stylis';
import 'vue-types';
import 'axios';
import '@ant-design/icons-vue';
import 'resize-observer-polyfill';
import 'dom-align';
import 'lodash-es/uniq.js';
import 'lodash-es/pick.js';
import 'lodash-es/isPlainObject.js';
import 'lodash-es/debounce.js';
import 'lodash-es/cloneDeep.js';
import 'async-validator';
import 'lodash-es/find.js';
import 'lodash-es/isEqual.js';
import 'compute-scroll-into-view';
import 'lodash-es/intersection.js';
import 'lodash-es/omit.js';
import 'lodash-es/isNumber.js';
import 'throttle-debounce';
import 'lodash-es/fromPairs.js';
import 'lodash-es/partition.js';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';
import './_plugin-vue_export-helper-1tPrXgE0.mjs';
import './index-Cr7WIrmx.mjs';
import './UserProfilePic-CmaGJi8K.mjs';
import './empty_user-BaUNCdgf.mjs';
const _queue = /* @__PURE__ */ new WeakMap();
function useRouteQuery(name, defaultValue, options = {}) {
const {
mode = "replace",
route = useRoute(),
router = useRouter(),
transform
} = options;
let transformGet = (value) => value;
let transformSet = (value) => value;
if (typeof transform === "function") {
transformGet = transform;
} else if (transform) {
if (transform.get)
transformGet = transform.get;
if (transform.set)
transformSet = transform.set;
}
if (!_queue.has(router))
_queue.set(router, /* @__PURE__ */ new Map());
const _queriesQueue = _queue.get(router);
let query = route.query[name];
tryOnScopeDispose$1(() => {
query = void 0;
});
let _trigger;
const proxy = customRef((track, trigger) => {
_trigger = trigger;
return {
get() {
track();
return transformGet(query !== void 0 ? query : toValue(defaultValue));
},
set(v) {
v = transformSet(v);
if (query === v)
return;
query = v === toValue(defaultValue) ? void 0 : v;
_queriesQueue.set(name, v === toValue(defaultValue) ? void 0 : v);
trigger();
nextTick(() => {
if (_queriesQueue.size === 0)
return;
const newQueries = Object.fromEntries(_queriesQueue.entries());
_queriesQueue.clear();
const { params, query: query2, hash } = route;
router[toValue(mode)]({
params,
query: { ...query2, ...newQueries },
hash
});
});
}
};
});
watch(
() => route.query[name],
(v) => {
if (query === transformGet(v))
return;
query = v;
_trigger();
},
{ flush: "sync" }
);
return proxy;
}
async function getCollection() {
return await myAxios.get("/site/collection/menu");
}
const useCategoryStore = defineStore("category", () => {
const _category = ref([]);
const category = computed(() => {
return _category.value.sort((a, b) => {
return a.position - b.position;
});
});
async function getCategory() {
_category.value = await getCollection();
}
const getCategorySubs = (ids) => {
return category.value.filter((x) => ids.includes(x.parent_id));
};
const categoryWithoutSub = computed(() => {
return category.value.filter((x) => !x.parent_id);
});
return {
_category,
category,
getCategory,
getCategorySubs,
categoryWithoutSub
};
});
const _sfc_main$f = /* @__PURE__ */ defineComponent({
__name: "BasicActionSheet",
__ssrInlineRender: true,
props: {
cancelText: { default: "بازگشت" },
showButton: { type: Boolean, default: false },
showCancel: { type: Boolean, default: true },
showOk: { type: Boolean, default: true },
okText: { default: "ثبت" }
},
setup(__props) {
const props = __props;
return (_ctx, _push, _parent, _attrs) => {
const _component_VanActionSheet = stdin_default;
const _component_AButton = Button;
_push(ssrRenderComponent(_component_VanActionSheet, mergeProps({
teleport: "body",
dir: "ltr",
"close-on-click-overlay": true
}, _attrs), {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<div class="justify-center cursor-pointer flex mt-1"${_scopeId}><span class="rounded-sm w-12 border-t-2 border-t-solid border-t-gray-500 mt-2"${_scopeId}></span></div><div class="mx-4 mb-5 mt-3 max-h-90% overflow-y-auto"${_scopeId}>`);
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
if (props.showButton && (props.showCancel || props.showOk)) {
_push2(`<div class="${ssrRenderClass([[!props.showOk || !props.showCancel ? "grid-cols-1" : "grid-cols-12"], "grid gap-3 mb-5 mt-2"])}"${_scopeId}>`);
if (props.showCancel) {
_push2(ssrRenderComponent(_component_AButton, {
onClick: ($event) => _ctx.$emit("cancel"),
type: "primary",
class: [{ "col-span-4": props.showOk }],
size: "large",
ghost: "",
block: ""
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`${ssrInterpolate(props.cancelText)}`);
} else {
return [
createTextVNode(toDisplayString(props.cancelText), 1)
];
}
}),
_: 1
}, _parent2, _scopeId));
} else {
_push2(`<!---->`);
}
if (props.showOk) {
_push2(ssrRenderComponent(_component_AButton, {
onClick: ($event) => _ctx.$emit("ok"),
type: "primary",
class: [{ "col-span-8": props.showCancel }],
size: "large",
block: ""
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`${ssrInterpolate(props.okText)}`);
} else {
return [
createTextVNode(toDisplayString(props.okText), 1)
];
}
}),
_: 1
}, _parent2, _scopeId));
} else {
_push2(`<!---->`);
}
_push2(`</div>`);
} else {
_push2(`<!---->`);
}
_push2(`</div>`);
} else {
return [
createVNode("div", {
class: "justify-center cursor-pointer flex mt-1",
onClick: ($event) => _ctx.$emit("update:show", false)
}, [
createVNode("span", { class: "rounded-sm w-12 border-t-2 border-t-solid border-t-gray-500 mt-2" })
], 8, ["onClick"]),
createVNode("div", { class: "mx-4 mb-5 mt-3 max-h-90% overflow-y-auto" }, [
renderSlot(_ctx.$slots, "default"),
props.showButton && (props.showCancel || props.showOk) ? (openBlock(), createBlock("div", {
key: 0,
class: ["grid gap-3 mb-5 mt-2", [!props.showOk || !props.showCancel ? "grid-cols-1" : "grid-cols-12"]]
}, [
props.showCancel ? (openBlock(), createBlock(_component_AButton, {
key: 0,
onClick: ($event) => _ctx.$emit("cancel"),
type: "primary",
class: [{ "col-span-4": props.showOk }],
size: "large",
ghost: "",
block: ""
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(props.cancelText), 1)
]),
_: 1
}, 8, ["onClick", "class"])) : createCommentVNode("", true),
props.showOk ? (openBlock(), createBlock(_component_AButton, {
key: 1,
onClick: ($event) => _ctx.$emit("ok"),
type: "primary",
class: [{ "col-span-8": props.showCancel }],
size: "large",
block: ""
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(props.okText), 1)
]),
_: 1
}, 8, ["onClick", "class"])) : createCommentVNode("", true)
], 2)) : createCommentVNode("", true)
])
];
}
}),
_: 3
}, _parent));
};
}
});
const _sfc_setup$f = _sfc_main$f.setup;
_sfc_main$f.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/BasicPacks/BasicActionSheet.vue");
return _sfc_setup$f ? _sfc_setup$f(props, ctx) : void 0;
};
const BasicActionSheet = Object.assign(_sfc_main$f, { __name: "BasicPacksBasicActionSheet" });
const _sfc_main$e = /* @__PURE__ */ defineComponent({
__name: "SortProductSheet",
__ssrInlineRender: true,
props: {
open: { type: Boolean, default: false },
value: {}
},
emits: ["update:open", "update:value", "success"],
setup(__props, { emit: __emit }) {
const config = useConfigStore();
const props = __props;
const emits = __emit;
const orderSelected = computed({
get() {
return props.value;
},
set(value) {
emits("update:value", value);
}
});
const visible = computed({
get() {
return props.open;
},
set(value) {
emits("update:open", value);
}
});
async function handleChangeOrder(orderItem) {
orderSelected.value = orderItem;
closeSheet();
emits("success");
}
function closeSheet() {
visible.value = false;
}
const sortProducts = ref([
{ title: config.useString("newest"), order: "-created_at" },
{ title: config.useString("popular"), order: "-count_fav" },
{ title: config.useString("bestSeller"), order: "-count_order" },
{ title: config.useString("mostVisited"), order: "-count_view" },
{ title: config.useString("cheapest"), order: "+price" },
{ title: config.useString("mostExpensive"), order: "-price" }
]);
return (_ctx, _push, _parent, _attrs) => {
const _component_a_menu = Menu;
const _component_a_menu_item = __nuxt_component_1$5;
_push(ssrRenderComponent(BasicActionSheet, mergeProps({
"close-on-click-overlay": "",
show: visible.value,
"onUpdate:show": ($event) => visible.value = $event,
onClose: closeSheet
}, _attrs), {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<div class="overflow-y-auto px-2 mt3"${_scopeId}><div class="pb-5"${_scopeId}>`);
_push2(ssrRenderComponent(_component_a_menu, {
selectedKeys: [orderSelected.value?.order],
class: "!border-none select-none"
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`<!--[-->`);
ssrRenderList(sortProducts.value, (item, index) => {
_push3(ssrRenderComponent(_component_a_menu_item, {
key: item.order,
onClick: ($event) => handleChangeOrder(item)
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`${ssrInterpolate(item.title)}`);
} else {
return [
createTextVNode(toDisplayString(item.title), 1)
];
}
}),
_: 2
}, _parent3, _scopeId2));
});
_push3(`<!--]-->`);
} else {
return [
(openBlock(true), createBlock(Fragment, null, renderList(sortProducts.value, (item, index) => {
return openBlock(), createBlock(_component_a_menu_item, {
key: item.order,
onClick: ($event) => handleChangeOrder(item)
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(item.title), 1)
]),
_: 2
}, 1032, ["onClick"]);
}), 128))
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`</div></div>`);
_push2(ssrRenderComponent(BasicButton, {
block: "",
danger: "",
onClick: closeSheet
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`${ssrInterpolate(unref(config).useString("cancel"))}`);
} else {
return [
createTextVNode(toDisplayString(unref(config).useString("cancel")), 1)
];
}
}),
_: 1
}, _parent2, _scopeId));
} else {
return [
createVNode("div", { class: "overflow-y-auto px-2 mt3" }, [
createVNode("div", { class: "pb-5" }, [
createVNode(_component_a_menu, {
selectedKeys: [orderSelected.value?.order],
class: "!border-none select-none"
}, {
default: withCtx(() => [
(openBlock(true), createBlock(Fragment, null, renderList(sortProducts.value, (item, index) => {
return openBlock(), createBlock(_component_a_menu_item, {
key: item.order,
onClick: ($event) => handleChangeOrder(item)
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(item.title), 1)
]),
_: 2
}, 1032, ["onClick"]);
}), 128))
]),
_: 1
}, 8, ["selectedKeys"])
])
]),
createVNode(BasicButton, {
block: "",
danger: "",
onClick: closeSheet
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(config).useString("cancel")), 1)
]),
_: 1
})
];
}
}),
_: 1
}, _parent));
};
}
});
const _sfc_setup$e = _sfc_main$e.setup;
_sfc_main$e.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/SortProductSheet.vue");
return _sfc_setup$e ? _sfc_setup$e(props, ctx) : void 0;
};
const _sfc_main$d = /* @__PURE__ */ defineComponent({
__name: "CollapsePanel",
__ssrInlineRender: true,
setup(__props) {
return (_ctx, _push, _parent, _attrs) => {
_push(ssrRenderComponent(unref(__nuxt_component_6), _attrs, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push2, _parent2, _scopeId);
} else {
return [
renderSlot(_ctx.$slots, "default")
];
}
}),
_: 3
}, _parent));
};
}
});
const _sfc_setup$d = _sfc_main$d.setup;
_sfc_main$d.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/CollapsePanel.vue");
return _sfc_setup$d ? _sfc_setup$d(props, ctx) : void 0;
};
const _sfc_main$c = /* @__PURE__ */ defineComponent({
__name: "CollapsePanelFilter",
__ssrInlineRender: true,
props: {
options: { default: () => [] },
value: { default: () => [] }
},
emits: ["update:value"],
setup(__props, { emit: __emit }) {
const props = __props;
const config = useConfigStore();
const text = ref("");
const { prefixCls } = usePrefix("collapse-filter");
const emit = __emit;
const selectValue = computed({
set: (val) => {
emit("update:value", val);
},
get: () => {
return props.value;
}
});
const list = computed(() => {
if (text.value) return props.options.filter((item) => item.label?.includes(text.value));
return props.options;
});
return (_ctx, _push, _parent, _attrs) => {
const _component_a_input = Input;
_push(ssrRenderComponent(_sfc_main$d, mergeProps({
class: [unref(prefixCls)]
}, _attrs), {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(_component_a_input, {
value: text.value,
"onUpdate:value": ($event) => text.value = $event,
bordered: false,
size: "large",
placeholder: unref(config).useString("search"),
class: "input-search myCustomCollapseSearch"
}, {
prefix: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`<img${ssrRenderAttr("src", _imports_0)}${ssrRenderAttr("alt", unref(reactiveProjectName))} class="w-4"${_scopeId2}>`);
} else {
return [
createVNode("img", {
src: _imports_0,
alt: unref(reactiveProjectName),
class: "w-4"
}, null, 8, ["alt"])
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`<div class="max-h-60 mt-4 overflow-y-auto w-full px-2"${_scopeId}>`);
_push2(ssrRenderComponent(unref(CheckboxGroup), {
value: selectValue.value,
"onUpdate:value": ($event) => selectValue.value = $event
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`<div class="flex flex-col gap-4 font-medium !text-gray-600"${_scopeId2}><!--[-->`);
ssrRenderList(list.value, (item, index) => {
_push3(ssrRenderComponent(unref(Checkbox), {
key: index,
value: item.value
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`<div class="truncate w-10rem"${_scopeId3}>${ssrInterpolate(item.label)}</div>`);
} else {
return [
createVNode("div", { class: "truncate w-10rem" }, toDisplayString(item.label), 1)
];
}
}),
_: 2
}, _parent3, _scopeId2));
});
_push3(`<!--]--></div>`);
} else {
return [
createVNode("div", { class: "flex flex-col gap-4 font-medium !text-gray-600" }, [
(openBlock(true), createBlock(Fragment, null, renderList(list.value, (item, index) => {
return openBlock(), createBlock(unref(Checkbox), {
key: index,
value: item.value
}, {
default: withCtx(() => [
createVNode("div", { class: "truncate w-10rem" }, toDisplayString(item.label), 1)
]),
_: 2
}, 1032, ["value"]);
}), 128))
])
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`</div>`);
} else {
return [
createVNode(_component_a_input, {
value: text.value,
"onUpdate:value": ($event) => text.value = $event,
bordered: false,
size: "large",
placeholder: unref(config).useString("search"),
class: "input-search myCustomCollapseSearch"
}, {
prefix: withCtx(() => [
createVNode("img", {
src: _imports_0,
alt: unref(reactiveProjectName),
class: "w-4"
}, null, 8, ["alt"])
]),
_: 1
}, 8, ["value", "onUpdate:value", "placeholder"]),
createVNode("div", { class: "max-h-60 mt-4 overflow-y-auto w-full px-2" }, [
createVNode(unref(CheckboxGroup), {
value: selectValue.value,
"onUpdate:value": ($event) => selectValue.value = $event
}, {
default: withCtx(() => [
createVNode("div", { class: "flex flex-col gap-4 font-medium !text-gray-600" }, [
(openBlock(true), createBlock(Fragment, null, renderList(list.value, (item, index) => {
return openBlock(), createBlock(unref(Checkbox), {
key: index,
value: item.value
}, {
default: withCtx(() => [
createVNode("div", { class: "truncate w-10rem" }, toDisplayString(item.label), 1)
]),
_: 2
}, 1032, ["value"]);
}), 128))
])
]),
_: 1
}, 8, ["value", "onUpdate:value"])
])
];
}
}),
_: 1
}, _parent));
};
}
});
const _sfc_setup$c = _sfc_main$c.setup;
_sfc_main$c.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/CollapsePanelFilter.vue");
return _sfc_setup$c ? _sfc_setup$c(props, ctx) : void 0;
};
const getBrandsList = async (search) => {
let queryBuilder = supabase.from("brands").select("*");
if (search?.length)
queryBuilder.like("title", `%${search}%`);
return (await queryBuilder.select("*").order("created_at", { ascending: false })).data;
};
const getCategoriesList = async (search) => {
let queryBuilder = supabase.from("collections").select("*");
if (search?.length)
queryBuilder.like("title", `%${search}%`);
return (await queryBuilder.select("*").order("created_at", { ascending: false })).data;
};
const _sfc_main$b = /* @__PURE__ */ defineComponent({
__name: "Filters",
__ssrInlineRender: true,
props: {
price: { default: () => [] },
selectedBrand: { default: () => [] },
selectedCollection: { default: () => [] }
},
emits: ["update:price", "update:selectedBrand", "update:selectedCollection", "change"],
setup(__props, { emit: __emit }) {
useCategoryStore();
const activeKey = ref([0]);
const maxPrice = ref(0);
const _price = ref([0, 0]);
const config = useConfigStore();
const brands = ref([]);
const categories = ref([]);
const props = __props;
const { prefixCls } = usePrefix("shop-filter");
const emit = __emit;
watch(
() => props.price,
() => {
if (props.price.length > 0) _price.value = props.price;
else _price.value = [1e4, maxPrice.value];
}
);
const brandOptions = computed(() => {
return brands.value.map((item) => {
return { label: item.title, value: item.id };
});
});
const collectionOptions = computed(() => {
return categories.value.map((item) => {
return { label: item.title, value: item.id };
});
});
const _selectedCollection = computed({
set: (val) => {
emit("update:selectedCollection", val);
emit("change");
},
get: () => {
return props.selectedCollection;
}
});
function applyFilter(val) {
emit("update:price", val);
emit("change");
}
const _selectedBrand = computed({
set: (val) => {
emit("update:selectedBrand", val);
emit("change");
},
get: () => {
return props.selectedBrand;
}
});
const router = useRouter();
const search = ref("");
watch(
() => router.currentRoute,
() => {
if (router.currentRoute.value.query.search) {
search.value = router.currentRoute.value.query.search;
}
},
{ immediate: true }
);
function handleSearch() {
router.push({ name: "shop", query: { search: search.value } });
}
watchDebounced(
search,
() => {
handleSearch();
},
{ debounce: 300 }
);
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(mergeProps({
class: [[unref(prefixCls)], "overflow-y-auto pb-5 max-h-60vh"]
}, _attrs))}>`);
_push(ssrRenderComponent(unref(Collapse), {
activeKey: activeKey.value,
"onUpdate:activeKey": ($event) => activeKey.value = $event,
accordion: "",
bordered: false,
"expand-icon-position": "end",
class: "filter-collapse select-none"
}, {
expandIcon: withCtx(({ isActive }, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<div${_scopeId}>`);
_push2(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:arrow-left-1",
class: ["!text-gray-400 transition-all", [{ "rotate--90": isActive }]],
size: "18"
}, null, _parent2, _scopeId));
_push2(`</div>`);
} else {
return [
createVNode("div", null, [
createVNode(BasicIconOld, {
icon: "vuesax-linear:arrow-left-1",
class: ["!text-gray-400 transition-all", [{ "rotate--90": isActive }]],
size: "18"
}, null, 8, ["class"])
])
];
}
}),
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<div class="p-4"${_scopeId}>${ssrInterpolate(unref(config).useString("price"))} <div class="bottom-divider"${_scopeId}>`);
_push2(ssrRenderComponent(unref(Slider$1), {
value: _price.value,
"onUpdate:value": ($event) => _price.value = $event,
max: maxPrice.value,
min: 1e4,
step: 1e4,
range: "",
reverse: "",
onAfterChange: applyFilter
}, null, _parent2, _scopeId));
_push2(`<div class="flex items-center justify-between"${_scopeId}>`);
_push2(ssrRenderComponent(unref(Input), {
value: unref(usePrice)(_price.value[0], true, ""),
class: "w-20",
readonly: ""
}, null, _parent2, _scopeId));
_push2(`<span class="text-gray-600 text-lg"${_scopeId}>${ssrInterpolate(unref(config).priceUnit)}</span>`);
_push2(ssrRenderComponent(unref(Input), {
value: unref(usePrice)(_price.value[1], true, ""),
class: "w-20",
readonly: ""
}, null, _parent2, _scopeId));
_push2(`</div></div></div>`);
_push2(ssrRenderComponent(_sfc_main$c, {
value: _selectedCollection.value,
"onUpdate:value": ($event) => _selectedCollection.value = $event,
header: unref(config).useString("category"),
options: collectionOptions.value,
class: "bottom-divider"
}, null, _parent2, _scopeId));
_push2(ssrRenderComponent(_sfc_main$c, {
value: _selectedBrand.value,
"onUpdate:value": ($event) => _selectedBrand.value = $event,
header: unref(config).useString("brand"),
options: brandOptions.value
}, null, _parent2, _scopeId));
} else {
return [
createVNode("div", { class: "p-4" }, [
createTextVNode(toDisplayString(unref(config).useString("price")) + " ", 1),
createVNode("div", { class: "bottom-divider" }, [
createVNode(unref(Slider$1), {
value: _price.value,
"onUpdate:value": ($event) => _price.value = $event,
max: maxPrice.value,
min: 1e4,
step: 1e4,
range: "",
reverse: "",
onAfterChange: applyFilter
}, null, 8, ["value", "onUpdate:value", "max"]),
createVNode("div", { class: "flex items-center justify-between" }, [
createVNode(unref(Input), {
value: unref(usePrice)(_price.value[0], true, ""),
class: "w-20",
readonly: ""
}, null, 8, ["value"]),
createVNode("span", { class: "text-gray-600 text-lg" }, toDisplayString(unref(config).priceUnit), 1),
createVNode(unref(Input), {
value: unref(usePrice)(_price.value[1], true, ""),
class: "w-20",
readonly: ""
}, null, 8, ["value"])
])
])
]),
createVNode(_sfc_main$c, {
value: _selectedCollection.value,
"onUpdate:value": ($event) => _selectedCollection.value = $event,
header: unref(config).useString("category"),
options: collectionOptions.value,
class: "bottom-divider"
}, null, 8, ["value", "onUpdate:value", "header", "options"]),
createVNode(_sfc_main$c, {
value: _selectedBrand.value,
"onUpdate:value": ($event) => _selectedBrand.value = $event,
header: unref(config).useString("brand"),
options: brandOptions.value
}, null, 8, ["value", "onUpdate:value", "header", "options"])
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
};
}
});
const _sfc_setup$b = _sfc_main$b.setup;
_sfc_main$b.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/Filters.vue");
return _sfc_setup$b ? _sfc_setup$b(props, ctx) : void 0;
};
const _sfc_main$a = /* @__PURE__ */ defineComponent({
__name: "FilterProductSheet",
__ssrInlineRender: true,
props: {
open: { type: Boolean, default: false },
value: {}
},
emits: ["update:open", "update:value", "success"],
setup(__props, { emit: __emit }) {
const config = useConfigStore();
const props = __props;
const emits = __emit;
const filterItems = computed({
get() {
return props.value;
},
set(value) {
emits("update:value", value);
}
});
const visible = computed({
get() {
return props.open;
},
set(value) {
emits("update:open", value);
}
});
const deleteFilters = async () => {
filterItems.value.brand = [];
filterItems.value.collection = [];
filterItems.value.price = [];
await emits("success");
};
function closeSheet() {
visible.value = false;
}
ref([
{ title: config.useString("newest"), order: "-created_at" },
{ title: config.useString("popular"), order: "-count_fav" },
{ title: config.useString("bestSeller"), order: "-count_order" },
{ title: config.useString("mostVisited"), order: "-count_view" },
{ title: config.useString("cheapest"), order: "+price" },
{ title: config.useString("mostExpensive"), order: "-price" }
]);
return (_ctx, _push, _parent, _attrs) => {
_push(ssrRenderComponent(BasicActionSheet, mergeProps({
"close-on-click-overlay": "",
show: visible.value,
"onUpdate:show": ($event) => visible.value = $event,
onClose: closeSheet
}, _attrs), {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<div class="overflow-y-auto"${_scopeId}>`);
_push2(ssrRenderComponent(_sfc_main$b, {
price: filterItems.value.price,
"onUpdate:price": ($event) => filterItems.value.price = $event,
"selected-brand": filterItems.value.brand,
"onUpdate:selectedBrand": ($event) => filterItems.value.brand = $event,
"selected-collection": filterItems.value.collection,
"onUpdate:selectedCollection": ($event) => filterItems.value.collection = $event
}, null, _parent2, _scopeId));
_push2(`</div><div class="flex gap-3 bg-white pb-5"${_scopeId}>`);
_push2(ssrRenderComponent(BasicButton, {
class: "w-2/3 bg-primary",
size: "large",
type: "primary",
onClick: ($event) => emits("success")
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`${ssrInterpolate(unref(config).useString("filter"))}`);
} else {
return [
createTextVNode(toDisplayString(unref(config).useString("filter")), 1)
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(ssrRenderComponent(BasicButton, {
class: "w-1/3",
size: "large",
onClick: deleteFilters
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`${ssrInterpolate(unref(config).useString("reset"))}`);
} else {
return [
createTextVNode(toDisplayString(unref(config).useString("reset")), 1)
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`</div>`);
_push2(ssrRenderComponent(BasicButton, {
block: "",
danger: "",
onClick: closeSheet
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`${ssrInterpolate(unref(config).useString("cancel"))}`);
} else {
return [
createTextVNode(toDisplayString(unref(config).useString("cancel")), 1)
];
}
}),
_: 1
}, _parent2, _scopeId));
} else {
return [
createVNode("div", { class: "overflow-y-auto" }, [
createVNode(_sfc_main$b, {
price: filterItems.value.price,
"onUpdate:price": ($event) => filterItems.value.price = $event,
"selected-brand": filterItems.value.brand,
"onUpdate:selectedBrand": ($event) => filterItems.value.brand = $event,
"selected-collection": filterItems.value.collection,
"onUpdate:selectedCollection": ($event) => filterItems.value.collection = $event
}, null, 8, ["price", "onUpdate:price", "selected-brand", "onUpdate:selectedBrand", "selected-collection", "onUpdate:selectedCollection"])
]),
createVNode("div", { class: "flex gap-3 bg-white pb-5" }, [
createVNode(BasicButton, {
class: "w-2/3 bg-primary",
size: "large",
type: "primary",
onClick: ($event) => emits("success")
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(config).useString("filter")), 1)
]),
_: 1
}, 8, ["onClick"]),
createVNode(BasicButton, {
class: "w-1/3",
size: "large",
onClick: deleteFilters
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(config).useString("reset")), 1)
]),
_: 1
})
]),
createVNode(BasicButton, {
block: "",
danger: "",
onClick: closeSheet
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(config).useString("cancel")), 1)
]),
_: 1
})
];
}
}),
_: 1
}, _parent));
};
}
});
const _sfc_setup$a = _sfc_main$a.setup;
_sfc_main$a.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/FilterProductSheet.vue");
return _sfc_setup$a ? _sfc_setup$a(props, ctx) : void 0;
};
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
__name: "ProductSearchList",
__ssrInlineRender: true,
props: {
search: {}
},
async setup(__props) {
let __temp, __restore;
const router = useRouter$1();
const config = useConfigStore();
const props = __props;
const posts = ref([]);
const total = ref(0);
const search = useRouteQuery("search", "");
const videoThumbnails = ref({});
const seller = computed(() => config.sellerConfig?.store);
const orderSelected = ref();
const pagination = ref({ limit: 30, page: 0 });
const paginationClone = cloneDeep(pagination.value);
const showOrderAction = ref(false);
const products = ref([]);
const showFilterAction = ref(false);
const categoryStore = useCategoryStore();
const filterItems = reactive({
brand: [],
collection: [],
price: []
});
watch(showOrderAction, () => {
console.log(showOrderAction.value);
});
const { data } = ([__temp, __restore] = withAsyncContext(() => useAsyncData("productSearch", getProductList)), __temp = await __temp, __restore(), __temp);
async function applyFilter() {
showOrderAction.value = false;
pagination.value = cloneDeep(paginationClone);
products.value = [];
showFilterAction.value = false;
await getProductList();
}
async function getProductList() {
try {
loading.value = true;
const filters = [];
if (filterItems.brand.length > 0 || router.currentRoute.value?.query?.brand?.length) {
filters.push({
field: "brand_id",
op: "in",
value: filterItems.brand?.length ? filterItems.brand : [router.currentRoute.value?.query?.brand]
});
}
if (filterItems.collection.length > 0 || router.currentRoute.value?.query?.category?.length) {
filters.push({
field: "collection_id",
op: "in",
value: filterItems.collection?.length ? filterItems.collection : [router.currentRoute.value?.query?.category]
});
const cat = categoryStore.category.find((item) => item.id == filterItems.collection[0]);
if (cat) {
}
}
if (filterItems.price.length > 0) {
filters.push({
field: "price",
op: "eq",
value: filterItems.price
});
}
if (props.search?.length)
filters.push({
field: "title_fa",
op: "like",
value: props.search
});
Object.assign(pagination.value, {
filters,
text_search: search.value,
order: orderSelected.value?.order
});
const res = await getStoreSearchPosts(seller.value?.user_id, pagination.value);
posts.value = res?.rows ?? [];
total.value = res?.query?.total ?? 0;
} catch (e) {
console.log(e);
} finally {
loading.value = false;
}
}
watchDebounced(() => props.search, () => {
applyFilter();
}, { debounce: 300 });
return (_ctx, _push, _parent, _attrs) => {
const _directive_lazy = resolveDirective("lazy");
let _temp0;
_push(`<div${ssrRenderAttrs(_attrs)}><div class="flex justify-between items-center px4 pt-4"><div class="flex gap-2 lg:hidden">`);
_push(ssrRenderComponent(BasicButton, {
class: "flex gap-1 items-center text-xs",
type: "text",
size: "small",
onClick: ($event) => showFilterAction.value = true
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<span${_scopeId}>${ssrInterpolate(unref(config).useString("filterProducts"))}</span>`);
_push2(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:filter",
size: "16"
}, null, _parent2, _scopeId));
} else {
return [
createVNode("span", null, toDisplayString(unref(config).useString("filterProducts")), 1),
createVNode(BasicIconOld, {
icon: "vuesax-linear:filter",
size: "16"
})
];
}
}),
_: 1
}, _parent));
_push(ssrRenderComponent(BasicButton, {
class: "flex gap-1 items-center text-xs",
type: "text",
size: "small",
onClick: ($event) => showOrderAction.value = true
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<span${_scopeId}>${ssrInterpolate(orderSelected.value?.title)}</span>`);
_push2(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:sort",
size: "16"
}, null, _parent2, _scopeId));
} else {
return [
createVNode("span", null, toDisplayString(orderSelected.value?.title), 1),
createVNode(BasicIconOld, {
icon: "vuesax-linear:sort",
size: "16"
})
];
}
}),
_: 1
}, _parent));
_push(`</div><div class="flex gap-2 items-center"><span class="font-bold">${ssrInterpolate(unref(usePrice)(total.value ?? 0, true, ""))}</span><span class="text-xs text-gray-400">${ssrInterpolate(unref(config).useString("countProducts"))}</span></div></div>`);
if (!unref(loading)) {
_push(`<div class="w-full grid grid-cols-3 mt-2 gap-2px"><!--[-->`);
ssrRenderList(posts.value, (post, i) => {
_push(`<div class="w-full aspect-square relative">`);
if (post.files?.length) {
_push(`<!--[-->`);
if (post.files[0].type === "image") {
_push(`<img${ssrRenderAttrs(_temp0 = mergeProps({
class: "w-full h-full object-cover",
alt: unref(reactiveProjectName)
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(getSupabaseStorageUrl)(post.files[0].url), loading: unref(loadGray), error: unref(loadGray) })))}>${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}`);
} else if (post.files[0].type === "video") {
_push(`<div class="relative w-full h-full"><video${ssrRenderAttr("src", post.files[0].url)} class="hidden"></video><img${ssrRenderAttr("src", videoThumbnails.value[post.files[0].url])} class="w-full h-full object-cover" alt="Video Thumbnail"><div class="absolute inset-0 flex items-center justify-center bg-black bg-opacity-30"><svg class="w-12 h-12 text-white" fill="currentColor" viewBox="0 0 24 24"><path d="M8 5v14l11-7z"></path></svg></div></div>`);
} else {
_push(`<!---->`);
}
_push(`<!--]-->`);
} else {
_push(`<!---->`);
}
_push(`</div>`);
});
_push(`<!--]--></div>`);
} else {
_push(ssrRenderComponent(SquarePostSkeleton, null, null, _parent));
}
_push(ssrRenderComponent(_sfc_main$e, {
open: showOrderAction.value,
"onUpdate:open": ($event) => showOrderAction.value = $event,
value: orderSelected.value,
"onUpdate:value": ($event) => orderSelected.value = $event,
onSuccess: applyFilter
}, null, _parent));
_push(ssrRenderComponent(_sfc_main$a, {
open: showFilterAction.value,
"onUpdate:open": ($event) => showFilterAction.value = $event,
value: filterItems,
"onUpdate:value": ($event) => filterItems = $event,
onSuccess: applyFilter
}, null, _parent));
_push(`</div>`);
};
}
});
const _sfc_setup$9 = _sfc_main$9.setup;
_sfc_main$9.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/ProductSearchList.vue");
return _sfc_setup$9 ? _sfc_setup$9(props, ctx) : void 0;
};
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
__name: "BrandCard",
__ssrInlineRender: true,
props: {
item: {},
hasFunction: { type: Boolean, default: true }
},
emits: ["edit", "delete"],
setup(__props, { emit: __emit }) {
const config = useConfigStore();
const emit = __emit;
return (_ctx, _push, _parent, _attrs) => {
const _directive_lazy = resolveDirective("lazy");
let _temp0;
_push(`<div${ssrRenderAttrs(mergeProps({
class: ["flex w-full mt-2 p-2 items-center justify-between rounded-lg", unref(config).isNightStore ? "bg-zinc-800" : "bg-gray-50"]
}, _attrs))}><div class="flex items-center"><img${ssrRenderAttrs(_temp0 = mergeProps({
alt: unref(reactiveProjectName),
class: "w-2.5rem h-2.5rem rounded-lg object-contain"
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(getSupabaseStorageUrl)(_ctx.item.image), loading: unref(previewImg$1), error: unref(previewImg$1) })))}>${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}<div class="ms-5 text-sm">${ssrInterpolate(_ctx.item.title)}</div></div>`);
if (_ctx.hasFunction) {
_push(`<div class="flex items-center gap-2">`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:edit",
color: "blue",
onClick: ($event) => emit("edit", _ctx.item)
}, null, _parent));
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:trash",
color: "red",
onClick: ($event) => emit("delete", _ctx.item.id)
}, null, _parent));
_push(`</div>`);
} else {
_push(`<!---->`);
}
_push(`</div>`);
};
}
});
const _sfc_setup$8 = _sfc_main$8.setup;
_sfc_main$8.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/user/userMain/brands/components/BrandCard.vue");
return _sfc_setup$8 ? _sfc_setup$8(props, ctx) : void 0;
};
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
__name: "BrandCardSkeleton",
__ssrInlineRender: true,
setup(__props) {
const skeletonRatio = ref(null);
const skeletonSize = reactive(
useElementSize$1(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" })
);
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(mergeProps({
ref_key: "skeletonRatio",
ref: skeletonRatio,
class: "h-fit"
}, _attrs))}>`);
_push(ssrRenderComponent(unref(ContentLoader), {
width: skeletonSize.width,
height: "60"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<rect height="50" rx="3" ry="3"${ssrRenderAttr("width", skeletonSize.width)} x="0" y="8"${_scopeId}></rect>`);
} else {
return [
createVNode("rect", {
height: "50",
rx: "3",
ry: "3",
width: skeletonSize.width,
x: "0",
y: "8"
}, null, 8, ["width"])
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
};
}
});
const _sfc_setup$7 = _sfc_main$7.setup;
_sfc_main$7.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/user/userMain/brands/components/BrandCardSkeleton.vue");
return _sfc_setup$7 ? _sfc_setup$7(props, ctx) : void 0;
};
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
__name: "BrandSearchList",
__ssrInlineRender: true,
props: {
search: {}
},
emits: ["selected"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const records = ref([]);
async function reload() {
loading.value = true;
records.value = await getBrandsList(props.search);
loading.value = false;
}
watchDebounced(() => props.search, () => {
reload();
}, { debounce: 300 });
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(_attrs)}><div class="px-4"><!--[-->`);
ssrRenderList(records.value, (item, key) => {
_push(ssrRenderComponent(_sfc_main$8, {
key,
item,
"has-function": false,
onClick: ($event) => emits("selected", item.id)
}, null, _parent));
});
_push(`<!--]-->`);
if (unref(loading)) {
_push(`<div><!--[-->`);
ssrRenderList(10, (i) => {
_push(ssrRenderComponent(_sfc_main$7, null, null, _parent));
});
_push(`<!--]--></div>`);
} else {
_push(`<!---->`);
}
_push(`</div></div>`);
};
}
});
const _sfc_setup$6 = _sfc_main$6.setup;
_sfc_main$6.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/BrandSearchList.vue");
return _sfc_setup$6 ? _sfc_setup$6(props, ctx) : void 0;
};
const previewImg = "" + __buildAssetsURL("logo_preview.B3D6jfxw.png");
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
__name: "CategoryCard",
__ssrInlineRender: true,
props: {
item: {},
hasFunction: { type: Boolean, default: true }
},
emits: ["edit", "delete"],
setup(__props, { emit: __emit }) {
const config = useConfigStore();
const emit = __emit;
return (_ctx, _push, _parent, _attrs) => {
const _component_a_tag = Tag;
const _directive_lazy = resolveDirective("lazy");
let _temp0;
_push(`<div${ssrRenderAttrs(mergeProps({
class: ["flex w-full mt-2 p-2 items-center justify-between", unref(config).isNightStore ? "bg-zinc-800" : "bg-gray-50"]
}, _attrs))}><div class="flex items-center"><img${ssrRenderAttrs(_temp0 = mergeProps({
alt: unref(reactiveProjectName),
class: "w-2.5rem h-2.5rem rounded-lg object-contain"
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(getSupabaseStorageUrl)(_ctx.item.image), loading: unref(previewImg), error: unref(previewImg) })))}>${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}<div><div class="ms-5 text-sm">${ssrInterpolate(_ctx.item.title)}</div>`);
if (_ctx.item.children?.length !== 0) {
_push(`<!--[-->`);
ssrRenderList(_ctx.item.children, (val) => {
_push(ssrRenderComponent(_component_a_tag, { color: "blue" }, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<span${_scopeId}>${ssrInterpolate(val.title)}</span>`);
} else {
return [
createVNode("span", null, toDisplayString(val.title), 1)
];
}
}),
_: 2
}, _parent));
});
_push(`<!--]-->`);
} else {
_push(`<!---->`);
}
_push(`</div></div>`);
if (_ctx.hasFunction) {
_push(`<div class="flex items-center gap-2">`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:edit",
color: "blue",
onClick: ($event) => emit("edit", _ctx.item)
}, null, _parent));
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:trash",
color: "red",
onClick: ($event) => emit("delete", _ctx.item.id)
}, null, _parent));
_push(`</div>`);
} else {
_push(`<!---->`);
}
_push(`</div>`);
};
}
});
const _sfc_setup$5 = _sfc_main$5.setup;
_sfc_main$5.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Cards/CategoryCard.vue");
return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
};
const CategoryCard = Object.assign(_sfc_main$5, { __name: "CardsCategoryCard" });
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
__name: "CategoryCardSkeleton",
__ssrInlineRender: true,
setup(__props) {
const skeletonRatio = ref(null);
const skeletonSize = reactive(
useElementSize$1(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" })
);
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(mergeProps({
ref_key: "skeletonRatio",
ref: skeletonRatio,
class: "h-fit"
}, _attrs))}>`);
_push(ssrRenderComponent(unref(ContentLoader), {
width: skeletonSize.width,
height: "60"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<rect height="50" rx="3" ry="3"${ssrRenderAttr("width", skeletonSize.width)} x="0" y="8"${_scopeId}></rect>`);
} else {
return [
createVNode("rect", {
height: "50",
rx: "3",
ry: "3",
width: skeletonSize.width,
x: "0",
y: "8"
}, null, 8, ["width"])
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
};
}
});
const _sfc_setup$4 = _sfc_main$4.setup;
_sfc_main$4.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Cards/CategoryCardSkeleton.vue");
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
};
const CategoryCardSkeleton = Object.assign(_sfc_main$4, { __name: "CardsCategoryCardSkeleton" });
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
__name: "CategorySearchList",
__ssrInlineRender: true,
props: {
search: {}
},
emits: ["selected"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const records = ref([]);
async function reload() {
loading.value = true;
records.value = await getCategoriesList(props.search);
loading.value = false;
}
watchDebounced(() => props.search, () => {
reload();
}, { debounce: 300 });
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(_attrs)}><div class="px-4"><!--[-->`);
ssrRenderList(records.value, (item, key) => {
_push(ssrRenderComponent(CategoryCard, {
key,
item,
hasFunction: false,
onClick: ($event) => emits("selected", item.id)
}, null, _parent));
});
_push(`<!--]-->`);
if (unref(loading)) {
_push(`<div><!--[-->`);
ssrRenderList(10, (i) => {
_push(ssrRenderComponent(CategoryCardSkeleton, null, null, _parent));
});
_push(`<!--]--></div>`);
} else {
_push(`<!---->`);
}
_push(`</div></div>`);
};
}
});
const _sfc_setup$3 = _sfc_main$3.setup;
_sfc_main$3.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/CategorySearchList.vue");
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
__name: "CustomerSearchList",
__ssrInlineRender: true,
props: {
search: {}
},
setup(__props) {
const router = useRouter$1();
const props = __props;
const userStore = useUserStore();
const loading2 = ref(false);
const endPage = ref(false);
const currentPage = ref(0);
const limit = ref(10);
const users = ref([]);
const request = async () => {
try {
if (!endPage.value) {
loading2.value = true;
const userId = router.currentRoute.value.query?.user_id ?? userStore.user.id;
const res = await getCustomerList(userId, ++currentPage.value, limit.value, props.search);
if (res?.length <= limit.value) endPage.value = true;
users.value.push(...res);
}
} catch (e) {
console.log("e ===>", e);
} finally {
loading2.value = false;
}
};
const reset = () => {
endPage.value = false;
users.value = [];
currentPage.value = 0;
};
watchDebounced(() => props.search, () => {
reset();
request();
}, { debounce: 300 });
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(mergeProps({ class: "flex flex-col gap-2 mx-4" }, _attrs))}>`);
if (!loading2.value) {
_push(`<!--[-->`);
ssrRenderList(users.value, (user) => {
_push(ssrRenderComponent(CustomerCard, { user }, null, _parent));
});
_push(`<!--]-->`);
} else {
_push(`<!--[-->`);
ssrRenderList(8, (i) => {
_push(ssrRenderComponent(CustomerCardSkeleton, null, null, _parent));
});
_push(`<!--]-->`);
}
_push(`</div>`);
};
}
});
const _sfc_setup$2 = _sfc_main$2.setup;
_sfc_main$2.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/components/CustomerSearchList.vue");
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
setup(__props) {
const router = useRouter$1();
const config = useConfigStore();
const activeKey = ref("products");
const searchValue = ref("");
function SelectCategory(id) {
router.replace({
name: "mainSearch",
query: { category: id }
// Directly use the value instead of an array
});
setTimeout(() => {
activeKey.value = "products";
}, 50);
}
function selectBrand(id) {
router.replace({
name: "mainSearch",
query: { brand: id }
// Directly use the value instead of an array
});
setTimeout(() => {
activeKey.value = "products";
}, 50);
}
return (_ctx, _push, _parent, _attrs) => {
const _component_a_input = Input;
const _component_ATabs = Tabs;
const _component_ATabPane = __nuxt_component_2$2;
_push(`<div${ssrRenderAttrs(_attrs)}><div class="flex items-center p3 gap-3">`);
_push(ssrRenderComponent(BasicIconOld, {
icon: !unref(config).isRTL ? "vuesax-linear:arrow-left" : "vuesax-linear:arrow-right",
onClick: ($event) => unref(router).back()
}, null, _parent));
_push(ssrRenderComponent(_component_a_input, {
value: searchValue.value,
"onUpdate:value": ($event) => searchValue.value = $event,
placeholder: unref(config).useString("search"),
class: "w-full border-none"
}, {
prefix: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<img${ssrRenderAttr("src", _imports_0)}${ssrRenderAttr("alt", unref(reactiveProjectName))} class="w-4"${_scopeId}>`);
} else {
return [
createVNode("img", {
src: _imports_0,
alt: unref(reactiveProjectName),
class: "w-4"
}, null, 8, ["alt"])
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
_push(ssrRenderComponent(_component_ATabs, {
activeKey: activeKey.value,
"onUpdate:activeKey": ($event) => activeKey.value = $event,
centered: "",
class: "instaTab"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(ssrRenderComponent(_component_ATabPane, {
class: "!w-full",
key: "products",
tab: unref(config).useString("products")
}, null, _parent2, _scopeId));
if (unref(config).isSeller) {
_push2(ssrRenderComponent(_component_ATabPane, {
class: "!w-full",
key: "customers",
tab: unref(config).useString("customers")
}, null, _parent2, _scopeId));
} else {
_push2(`<!---->`);
}
_push2(ssrRenderComponent(_component_ATabPane, {
class: "!w-full",
key: "categories",
tab: unref(config).useString("categories")
}, null, _parent2, _scopeId));
_push2(ssrRenderComponent(_component_ATabPane, {
class: "!w-full",
key: "brands",
tab: unref(config).useString("brands")
}, null, _parent2, _scopeId));
} else {
return [
createVNode(_component_ATabPane, {
class: "!w-full",
key: "products",
tab: unref(config).useString("products")
}, null, 8, ["tab"]),
unref(config).isSeller ? (openBlock(), createBlock(_component_ATabPane, {
class: "!w-full",
key: "customers",
tab: unref(config).useString("customers")
}, null, 8, ["tab"])) : createCommentVNode("", true),
createVNode(_component_ATabPane, {
class: "!w-full",
key: "categories",
tab: unref(config).useString("categories")
}, null, 8, ["tab"]),
createVNode(_component_ATabPane, {
class: "!w-full",
key: "brands",
tab: unref(config).useString("brands")
}, null, 8, ["tab"])
];
}
}),
_: 1
}, _parent));
_push(`<div class="h-85vh overflow-y-auto pb-5vh">`);
if (activeKey.value === "products") {
_push(ssrRenderComponent(_sfc_main$9, { search: searchValue.value }, null, _parent));
} else {
_push(`<!---->`);
}
if (activeKey.value === "customers") {
_push(ssrRenderComponent(_sfc_main$2, { search: searchValue.value }, null, _parent));
} else {
_push(`<!---->`);
}
if (activeKey.value === "categories") {
_push(ssrRenderComponent(_sfc_main$3, {
search: searchValue.value,
onSelected: SelectCategory
}, null, _parent));
} else {
_push(`<!---->`);
}
if (activeKey.value === "brands") {
_push(ssrRenderComponent(_sfc_main$6, {
search: searchValue.value,
onSelected: selectBrand
}, null, _parent));
} else {
_push(`<!---->`);
}
_push(`</div></div>`);
};
}
});
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/search/mainSearch/index.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
setup(__props) {
return (_ctx, _push, _parent, _attrs) => {
_push(ssrRenderComponent(_sfc_main$1, _attrs, null, _parent));
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/search/main/index.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };
//# sourceMappingURL=index-DqEAn4Lx.mjs.map