import { defineComponent, ref, computed, unref, resolveDirective, mergeProps, withCtx, createTextVNode, toDisplayString, createVNode, withDirectives, reactive, watch, nextTick, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrRenderAttrs, ssrRenderClass, ssrInterpolate, ssrGetDirectiveProps, ssrRenderList } from 'vue/server-renderer';
import { u as useRouter$1, a as useConfigStore, b as useUserStore, C as getSupabaseStorageUrl, ac as __nuxt_component_4, ad as __nuxt_component_1$1, f as loading, ae as useProduct, G as Badge, F as Form, j as __nuxt_component_1$3, P as myAxios, Q as supabaseService, d as api$1 } from './server.mjs';
import { B as BasicIconOld } from './BasicIconOld-93vAWohq.mjs';
import { u as usePrice } from './usePrice-B-5-jXKQ.mjs';
import { e as empty_user } from './empty_user-BaUNCdgf.mjs';
import { B as BasicButton } from './BasicButton-B9iMRxfW.mjs';
import { p as previewImg } from './logo_preview-CJTcB_Eg.mjs';
import { t as toJalali } from './useDateTime-D8RCoGwW.mjs';
import { B as BasicSheet } from './index-CM92jef_.mjs';
import { _ as _sfc_main$5 } from './close-1waVvhB6.mjs';
import { B as BasicInput } from './BasicInput-DvVrG0oq.mjs';
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.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 'pinia';
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 'lodash-es';
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 'moment';
import 'moment-timezone';
import 'moment-jalaali';
import 'date-fns';
import 'date-fns/locale';
import '@vueuse/gesture';
import '@headlessui/vue';
import 'framesync';
import 'popmotion';
import 'style-value-types';
import './close_light-DbrEdRZI.mjs';
const getOneOrder = async (id) => {
return await myAxios.get(`/order/${id}`);
};
const updateStatus = async (id, obj) => supabaseService.fetch("orders_status", "update", {
data: obj,
field: "id",
value: id
});
const createStatus = async (obj) => {
return await myAxios.post(`/order/change-status/${obj.order_id}`, { title: obj.title });
};
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
__name: "OrderProductCard",
__ssrInlineRender: true,
props: {
item: {},
isLast: { type: Boolean }
},
setup(__props) {
const props = __props;
const config = useConfigStore();
const {
originalImage,
qty,
price,
title,
hasDiscount,
originalPrice
} = useProduct(props.item.product, props.item.variant);
return (_ctx, _push, _parent, _attrs) => {
const _component_a_badge = Badge;
const _component_a_divider = __nuxt_component_4;
const _directive_lazy = resolveDirective("lazy");
let _temp0;
_push(`
`);
_push(ssrRenderComponent(_component_a_badge, {
count: _ctx.item.qty
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`
![]()
${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}
`);
} else {
return [
createVNode("div", { class: "h-6rem w-6rem" }, [
withDirectives(createVNode("img", {
alt: "instagram",
class: "bg-zinc-1 w-6rem aspect-square rounded-2xl object-contain ms-2"
}, null, 512), [
[_directive_lazy, { src: unref(originalImage), loading: unref(previewImg), error: unref(previewImg) }]
])
])
];
}
}),
_: 1
}, _parent));
_push(`
${ssrInterpolate(unref(title))}
`);
ssrRenderList(_ctx.item?.variant?.attribute_values, (val, index) => {
_push(`
${ssrInterpolate(val.value)}
`);
if (_ctx.item?.variant?.attribute_values.length - 1 !== index) {
_push(`
,
`);
} else {
_push(``);
}
_push(`
`);
});
_push(`
${ssrInterpolate(_ctx.item.qty)}
${ssrInterpolate(unref(config).useString("item2"))}
`);
if (unref(hasDiscount)) {
_push(`${ssrInterpolate(unref(usePrice)(unref(originalPrice), true, ""))}`);
} else {
_push(``);
}
_push(`${ssrInterpolate(unref(usePrice)(unref(price), true, ""))}${ssrInterpolate(unref(config).priceUnit)}
`);
_push(ssrRenderComponent(_component_a_divider, { class: "my-2" }, null, _parent));
_push(`
${ssrInterpolate(unref(usePrice)(_ctx.item.qty * unref(price), true, ""))}
${ssrInterpolate(unref(config).priceUnit)}
`);
if (unref(hasDiscount)) {
_push(`
${ssrInterpolate(unref(usePrice)(_ctx.item.qty * unref(originalPrice)))}
`);
} else {
_push(``);
}
_push(`
`);
if (!_ctx.isLast) {
_push(`
`);
} else {
_push(``);
}
_push(`
`);
};
}
});
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/OrderProductCard.vue");
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
};
const ProductCard = Object.assign(_sfc_main$4, { __name: "CardsOrderProductCard" });
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
__name: "StatusAddEdit",
__ssrInlineRender: true,
props: {
open: { type: Boolean, default: false },
isEdit: { type: Boolean, default: false },
data: {},
orderId: {}
},
emits: ["update:open", "update:isEdit", "success"],
setup(__props, { emit: __emit }) {
const formFields = reactive({});
const formRef = ref();
const config = useConfigStore();
const sheetRef = ref(null);
const props = __props;
const emits = __emit;
const addForm = () => {
Object.assign(formFields, {
title: ""
});
};
const editForm = () => {
console.log(props.data);
Object.assign(formFields, props.data);
};
const handleSubmit = async () => {
formRef.value.validateFields().then(async () => {
try {
loading.value = true;
formFields.order_id = props.orderId;
if (props.isEdit && props.data) {
const data = props.data;
await updateStatus(data.id, formFields);
emits("update:isEdit", false);
api$1.success(config.useString("editedSuccessfully"));
} else {
await createStatus(formFields);
api$1.success(config.useString("addedSuccessfully"));
}
emits("update:visible", false);
emits("success");
await closeSheet();
} catch (e) {
loading.value = false;
console.log("error", e);
}
});
};
watch(props, (value) => {
if (value.open) {
openSheet();
} else {
closeSheet();
}
if (props.isEdit) {
editForm();
} else {
addForm();
}
});
async function openSheet() {
await nextTick();
await sheetRef.value?.setOpen();
}
async function closeSheet() {
await nextTick();
await sheetRef.value?.setClose();
emits("update:open", false);
}
return (_ctx, _push, _parent, _attrs) => {
const _component_a_form = Form;
const _component_a_form_item = __nuxt_component_1$3;
_push(ssrRenderComponent(BasicSheet, mergeProps({
title: "",
ref_key: "sheetRef",
ref: sheetRef,
headerCls: "",
closeOnClickOutside: "",
onOnClickOutside: ($event) => emits("update:open", false),
onOnClose: ($event) => emits("update:open", false)
}, _attrs), {
header: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`${ssrInterpolate(_ctx.isEdit ? unref(config).useString("editStatus") : unref(config).useString("addStatus"))}
`);
_push2(ssrRenderComponent(_sfc_main$5, {
class: "w-1rem mt-2 me-5",
onClick: closeSheet
}, null, _parent2, _scopeId));
_push2(`
`);
} else {
return [
createVNode("div", {
flex: "",
"justify-center": "",
"items-center": "",
"flex-col": "",
"p-2": ""
}, [
createVNode("div", {
"bg-gray-500": "",
"h-2px": "",
"w-2.5rem": ""
}),
createVNode("div", { class: "flex justify-center" }, [
createVNode("div", {
"mt-3": "",
"font-semibold": ""
}, toDisplayString(_ctx.isEdit ? unref(config).useString("editStatus") : unref(config).useString("addStatus")), 1),
createVNode("div", { class: "absolute end-0" }, [
createVNode(_sfc_main$5, {
class: "w-1rem mt-2 me-5",
onClick: closeSheet
})
])
])
])
];
}
}),
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(``);
_push2(ssrRenderComponent(_component_a_form, {
model: formFields,
ref_key: "formRef",
ref: formRef
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(ssrRenderComponent(_component_a_form_item, {
label: unref(config).useString("title"),
name: "title"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(BasicInput, {
value: formFields.title,
"onUpdate:value": ($event) => formFields.title = $event,
"place-holder": unref(config).useString("title")
}, null, _parent4, _scopeId3));
} else {
return [
createVNode(BasicInput, {
value: formFields.title,
"onUpdate:value": ($event) => formFields.title = $event,
"place-holder": unref(config).useString("title")
}, null, 8, ["value", "onUpdate:value", "place-holder"])
];
}
}),
_: 1
}, _parent3, _scopeId2));
} else {
return [
createVNode(_component_a_form_item, {
label: unref(config).useString("title"),
name: "title"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.title,
"onUpdate:value": ($event) => formFields.title = $event,
"place-holder": unref(config).useString("title")
}, null, 8, ["value", "onUpdate:value", "place-holder"])
]),
_: 1
}, 8, ["label"])
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(ssrRenderComponent(BasicButton, {
type: "primary",
block: "",
onClick: handleSubmit
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`${ssrInterpolate(unref(config).useString("submit"))}`);
} else {
return [
createTextVNode(toDisplayString(unref(config).useString("submit")), 1)
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`
`);
} else {
return [
createVNode("div", { class: "max-h-85vh overflow-y-auto px-2 mt3 pb-10" }, [
createVNode(_component_a_form, {
model: formFields,
ref_key: "formRef",
ref: formRef
}, {
default: withCtx(() => [
createVNode(_component_a_form_item, {
label: unref(config).useString("title"),
name: "title"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.title,
"onUpdate:value": ($event) => formFields.title = $event,
"place-holder": unref(config).useString("title")
}, null, 8, ["value", "onUpdate:value", "place-holder"])
]),
_: 1
}, 8, ["label"])
]),
_: 1
}, 8, ["model"]),
createVNode(BasicButton, {
type: "primary",
block: "",
onClick: handleSubmit
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(config).useString("submit")), 1)
]),
_: 1
})
])
];
}
}),
_: 1
}, _parent));
};
}
});
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("components/StatusAddEdit.vue");
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
};
const StatusAddEdit = /* @__PURE__ */ Object.assign(_export_sfc(_sfc_main$3, [["__scopeId", "data-v-29f95169"]]), { __name: "StatusAddEdit" });
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
__name: "OrderDetail",
__ssrInlineRender: true,
setup(__props) {
const router = useRouter$1();
const order = ref(null);
const showMore = ref(false);
const visible = ref(false);
const isEdit = ref(false);
const userStore = useUserStore();
const data = ref({});
const orderStatus = ref([]);
const id = computed(() => {
return parseInt(router.currentRoute.value.params.id);
});
const config = useConfigStore();
const address = computed(() => {
if (order.value) {
const convert = order.value?.address?.payload;
return `${convert?.province ?? ""}-${convert?.city ?? ""}-${convert?.address ?? ""}`;
} else {
return "";
}
});
const getOrder = async () => {
try {
loading.value = true;
order.value = await getOneOrder(id.value);
orderStatus.value = order.value?.orders_status?.map((x) => {
return {
title: x.title,
description: toJalali(x.created_at ?? "_")
};
});
} catch (e) {
console.log(e);
} finally {
loading.value = false;
}
};
computed(() => {
return usePrice(order.value?.total_price + (order.value?.profit ?? 0), true, "");
});
computed(() => {
return usePrice(order.value?.profit ?? 0, true, "");
});
computed(() => {
return usePrice(order.value?.total_price, true, "");
});
return (_ctx, _push, _parent, _attrs) => {
const _component_a_divider = __nuxt_component_4;
const _component_a_steps = __nuxt_component_1$1;
const _directive_lazy = resolveDirective("lazy");
let _temp0, _temp1;
_push(`![]()
${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}
${ssrInterpolate(order.value?.store?.name ?? "")}
${ssrInterpolate(unref(config).useString("seller"))}
![]()
${"textContent" in _temp1 ? ssrInterpolate(_temp1.textContent) : _temp1.innerHTML ?? ""}
${ssrInterpolate(order.value?.user?.name ?? "")}
${ssrInterpolate(order.value?.user?.phone)}
${ssrInterpolate(unref(config).useString("customer"))}
`);
_push(ssrRenderComponent(_component_a_divider, null, null, _parent));
_push(`
${ssrInterpolate(unref(config).useString("orderSummery"))}
`);
if (!showMore.value) {
_push(`
`);
ssrRenderList(order.value?.order_items?.slice(0, 3), (item, index) => {
_push(ssrRenderComponent(ProductCard, {
key: item.product.id,
item,
isLast: (order.value?.order_items?.length ?? 0) < 3 ? (order.value?.order_items?.length ?? 0) - 1 === index : index === 2
}, null, _parent));
});
_push(`
`);
} else {
_push(`
`);
ssrRenderList(order.value?.order_items, (item, index) => {
_push(ssrRenderComponent(ProductCard, {
key: item.product.id,
item,
isLast: (order.value?.order_items?.length ?? 0) - 1 === index
}, null, _parent));
});
_push(`
`);
}
if ((order.value?.order_items?.length ?? 0) > 3) {
_push(`
`);
if (showMore.value) {
_push(ssrRenderComponent(BasicButton, {
onClick: ($event) => showMore.value = !showMore.value,
size: "small"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`${ssrInterpolate(unref(config).useString("less"))}`);
} else {
return [
createTextVNode(toDisplayString(unref(config).useString("less")), 1)
];
}
}),
_: 1
}, _parent));
} else {
_push(ssrRenderComponent(BasicButton, {
onClick: ($event) => showMore.value = !showMore.value,
size: "small"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`${ssrInterpolate(unref(config).useString("more"))}`);
} else {
return [
createTextVNode(toDisplayString(unref(config).useString("more")), 1)
];
}
}),
_: 1
}, _parent));
}
_push(`
`);
} else {
_push(``);
}
_push(`
`);
_push(ssrRenderComponent(_component_a_divider, null, null, _parent));
_push(`
${ssrInterpolate(unref(config).useString("paymentDetail"))}
${ssrInterpolate(unref(config).useString("totalPrice"))}:
${ssrInterpolate(unref(usePrice)(order.value?.total_price ?? 0, true, ""))}
${ssrInterpolate(unref(config).priceUnit)}
${ssrInterpolate(unref(config).useString("totalItems"))}:
${ssrInterpolate(order.value?.total_qty ?? 0)}
${ssrInterpolate(unref(config).useString("countProducts"))}
`);
if (order.value?.sum_gold !== 0) {
_push(`
${ssrInterpolate(unref(config).useString("totalGoldWeight"))}:
${ssrInterpolate(order.value?.sum_gold)}
${ssrInterpolate(unref(config).useString("gram"))}
`);
} else {
_push(``);
}
if (order.value?.sum_silver !== 0) {
_push(`
${ssrInterpolate(unref(config).useString("totalSilverWeight"))}:
${ssrInterpolate(order.value?.sum_silver)}
${ssrInterpolate(unref(config).useString("gram"))}
`);
} else {
_push(``);
}
_push(`
${ssrInterpolate(unref(config).useString("profit"))}:
${ssrInterpolate(unref(usePrice)(order.value?.total_discounts ?? 0, true, ""))}
${ssrInterpolate(unref(config).priceUnit)}
${ssrInterpolate(unref(config).useString("amountPaid"))}
${ssrInterpolate(unref(usePrice)(order.value?.discount_total_price ?? 0, true, ""))}${ssrInterpolate(unref(config).priceUnit)}
`);
_push(ssrRenderComponent(_component_a_divider, null, null, _parent));
_push(`
${ssrInterpolate(unref(config).useString("address"))}
${ssrInterpolate(address.value)}
`);
_push(ssrRenderComponent(_component_a_divider, null, null, _parent));
_push(`
${ssrInterpolate(unref(config).useString("status"))}
`);
_push(ssrRenderComponent(_component_a_steps, {
direction: "vertical",
size: "small",
current: orderStatus.value.length - 1,
items: orderStatus.value
}, null, _parent));
if (unref(config).isSeller && order.value?.store_id === unref(userStore).user?.id) {
_push(`
`);
_push(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:add",
"color-white": "",
size: "17"
}, null, _parent));
_push(`
${ssrInterpolate(unref(config).useString("addStatus"))}
`);
} else {
_push(``);
}
_push(`
`);
_push(ssrRenderComponent(StatusAddEdit, {
open: visible.value,
"onUpdate:open": ($event) => visible.value = $event,
"is-edit": isEdit.value,
"onUpdate:isEdit": ($event) => isEdit.value = $event,
data: data.value,
onSuccess: getOrder,
"order-id": id.value
}, null, _parent));
_push(`
`);
};
}
});
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/OrderDetail.vue");
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const OrderDetail = Object.assign(_sfc_main$2, { __name: "OrderDetail" });
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
setup(__props) {
const router = useRouter$1();
ref(null);
computed(() => {
return parseInt(router.currentRoute.value.params.id);
});
const config = useConfigStore();
return (_ctx, _push, _parent, _attrs) => {
_push(``);
_push(ssrRenderComponent(BasicIconOld, {
icon: !unref(config).isRTL ? "vuesax-linear:arrow-left" : "vuesax-linear:arrow-right",
onClick: ($event) => unref(router).back()
}, null, _parent));
_push(`
${ssrInterpolate(unref(config).useString("orderDetail"))}
`);
_push(ssrRenderComponent(OrderDetail, null, null, _parent));
_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("views/base/pages/user/order/index.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "[id]",
__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/user/order/[id].vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };
//# sourceMappingURL=_id_-CjGI2ICL.mjs.map