Files
appco_dist/.output/server/chunks/build/OrdersList-BbFMG2pP.mjs
T
2026-03-07 16:09:22 +03:30

234 lines
9.5 KiB
JavaScript

import { defineComponent, ref, computed, mergeProps, unref, withCtx, createTextVNode, toDisplayString, reactive, createVNode, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderList, ssrRenderComponent, ssrRenderAttr, ssrInterpolate } from 'vue/server-renderer';
import { U as UserProfilePic } from './UserProfilePic-CSSFM-Xe.mjs';
import { B as BasicButton } from './BasicButton-7YIRCRg8.mjs';
import { u as useRouter$1, a as useConfigStore, aM as useRoute$1, q as useElementSize } from './server.mjs';
import { u as usePrice } from './usePrice-CFcNV1RQ.mjs';
import { t as toJalali } from './useDateTime-iTLoRLEX.mjs';
import { u as useMediaStore } from './media-Cj7oyS0P.mjs';
import { _ as __nuxt_component_1 } from './index-l8e9lvT3.mjs';
import { ContentLoader } from 'vue-content-loader';
const _imports_0$1 = "" + __buildAssetsURL("empty_order.g7yXtwjI.svg");
const _imports_0 = "" + __buildAssetsURL("delivery-box-light.Cz31HXNr.svg");
const _imports_1 = "" + __buildAssetsURL("delivery-box.DZAXZSja.svg");
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
__name: "box",
__ssrInlineRender: true,
setup(__props) {
const config = useConfigStore();
return (_ctx, _push, _parent, _attrs) => {
if (unref(config).isNightStore) {
_push(`<img${ssrRenderAttrs(mergeProps({
src: _imports_0,
alt: "comment",
"cursor-pointer": ""
}, _attrs))}>`);
} else {
_push(`<img${ssrRenderAttrs(mergeProps({
src: _imports_1,
alt: "comment",
"cursor-pointer": ""
}, _attrs))}>`);
}
};
}
});
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("assets/img/icons/box.vue");
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
__name: "OrderCard",
__ssrInlineRender: true,
props: {
order: {}
},
setup(__props) {
const props = __props;
const router = useRouter$1();
const config = useConfigStore();
const address = computed(() => {
const convert = JSON.parse(props.order.address)?.payload;
return `${convert?.province ?? ""}-${convert?.city ?? ""}-${convert?.address ?? ""}`;
});
useMediaStore();
return (_ctx, _push, _parent, _attrs) => {
const _component_a_divider = __nuxt_component_1;
_push(`<div${ssrRenderAttrs(_attrs)}><div class="flex justify-between items-center mt-5"><div>`);
if (unref(config).isSeller) {
_push(ssrRenderComponent(UserProfilePic, {
width: "60",
src: _ctx.order.user?.avatar,
"just-show-profile": ""
}, null, _parent));
} else {
_push(ssrRenderComponent(_sfc_main$3, { class: "w-2rem" }, null, _parent));
}
_push(`</div><div class="flex-1 mx-5 gap-4">`);
if (unref(config).isSeller) {
_push(`<div class="text-sm font-semibold">${ssrInterpolate(_ctx.order.user?.name ?? "_")}</div>`);
} else {
_push(`<!---->`);
}
_push(`<div class="text-sm"><span class="text-gray-400 text-xs">${ssrInterpolate(unref(config).useString("orderNumber"))}:</span><span class="text-gray-700 ms-2 font-bold">${ssrInterpolate(_ctx.order.id)}</span></div><div class="flex items-center text-xs gap-2 mt-1"><span class="text-gray-400">${ssrInterpolate(unref(config).useString("totalPrice"))}:</span><span class="text-gray-700 font-bold">${ssrInterpolate(unref(usePrice)(_ctx.order.discount_total_price, true))}</span></div><div class="flex items-baseline text-xs gap-2 mt-1"><span class="text-gray-400">${ssrInterpolate(unref(config).useString("date"))}:</span><span class="text-gray-700 font-bold">${ssrInterpolate(unref(toJalali)(_ctx.order.created_at))}</span></div></div><div class="flex flex-col items-end">`);
_push(ssrRenderComponent(BasicButton, {
class: "!h-7",
onClick: ($event) => unref(router).push({ name: "user-order-id", params: { id: _ctx.order.id } })
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`${ssrInterpolate(unref(config).useString("details"))}`);
} else {
return [
createTextVNode(toDisplayString(unref(config).useString("details")), 1)
];
}
}),
_: 1
}, _parent));
_push(`</div></div>`);
_push(ssrRenderComponent(_component_a_divider, { class: "my-2" }, null, _parent));
_push(`<p class="text-xs font-200">${ssrInterpolate(address.value)}</p></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("components/Cards/OrderCard.vue");
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const OrderCard = Object.assign(_sfc_main$2, { __name: "CardsOrderCard" });
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "OrderCardSkeleton",
__ssrInlineRender: true,
setup(__props) {
const isLoaded = ref(false);
const skeletonRatio = ref(null);
const skeletonSize = reactive(
useElementSize(skeletonRatio, { width: 0, height: 0 }, { box: "border-box" })
);
return (_ctx, _push, _parent, _attrs) => {
if (isLoaded.value) {
_push(`<div${ssrRenderAttrs(mergeProps({
ref_key: "skeletonRatio",
ref: skeletonRatio,
class: "h-fit"
}, _attrs))}>`);
_push(ssrRenderComponent(unref(ContentLoader), {
width: skeletonSize.width,
height: "80"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<circle cx="30" cy="50" r="30"${_scopeId}></circle><rect x="80" y="15" rx="3" ry="3" width="190" height="15"${_scopeId}></rect><rect x="80" y="40" rx="3" ry="3" width="190" height="15"${_scopeId}></rect><rect x="80" y="65" rx="3" ry="3" width="190" height="15"${_scopeId}></rect><rect${ssrRenderAttr("x", skeletonSize.width - 80)} y="35" rx="3" ry="3" width="80" height="30"${_scopeId}></rect>`);
} else {
return [
createVNode("circle", {
cx: "30",
cy: "50",
r: "30"
}),
createVNode("rect", {
x: "80",
y: "15",
rx: "3",
ry: "3",
width: "190",
height: "15"
}),
createVNode("rect", {
x: "80",
y: "40",
rx: "3",
ry: "3",
width: "190",
height: "15"
}),
createVNode("rect", {
x: "80",
y: "65",
rx: "3",
ry: "3",
width: "190",
height: "15"
}),
createVNode("rect", {
x: skeletonSize.width - 80,
y: "35",
rx: "3",
ry: "3",
width: "80",
height: "30"
}, null, 8, ["x"])
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
} else {
_push(`<!---->`);
}
};
}
});
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("components/Cards/OrderCardSkeleton.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const OrderCardSkeleton = Object.assign(_sfc_main$1, { __name: "CardsOrderCardSkeleton" });
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "OrdersList",
__ssrInlineRender: true,
setup(__props) {
const router = useRouter$1();
const config = useConfigStore();
const loading = ref(false);
ref(false);
ref(0);
ref(10);
const orders = ref([]);
computed(() => router.currentRoute.value.params.id);
useRoute$1();
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(mergeProps({
class: ["flex flex-col gap-2 min-h-50vh", orders.value?.length > 0 ? "" : "justify-center"]
}, _attrs))}>`);
if (!loading.value) {
_push(`<!--[-->`);
if (orders.value.length !== 0) {
_push(`<!--[-->`);
ssrRenderList(orders.value, (order) => {
_push(ssrRenderComponent(OrderCard, { order }, null, _parent));
});
_push(`<!--]-->`);
} else {
_push(`<!--[--><img${ssrRenderAttr("src", _imports_0$1)} alt="orders" class="w-20 self-center"><p class="self-center text-gray-6">${ssrInterpolate(unref(config).useString("orderListIsEmpty"))}</p><!--]-->`);
}
_push(`<!--]-->`);
} else {
_push(`<!--[-->`);
ssrRenderList(6, (i) => {
_push(ssrRenderComponent(OrderCardSkeleton, { key: i }, null, _parent));
});
_push(`<!--]-->`);
}
_push(`</div>`);
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/statisticsList/components/OrdersList.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as _ };