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

1624 lines
82 KiB
JavaScript

import { LoadingOutlined } from '@ant-design/icons-vue';
import { u as useRouter$1, a as useConfigStore, b as useUserStore, a5 as checkUsername, S as Spin, f as loading, D as reactiveProjectName, C as getSupabaseStorageUrl, F as Form, A as APP_Milady_Date, a6 as updateUser, a7 as getStoreCollections, a8 as __nuxt_component_0$1, a9 as Modal, d as api$1, s as supabase } from './server.mjs';
import { defineComponent, ref, h, watch, resolveDirective, mergeProps, unref, withCtx, createVNode, createBlock, openBlock, Fragment, toDisplayString, createCommentVNode, createTextVNode, withDirectives, renderList, nextTick, computed, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrRenderClass, ssrInterpolate, ssrRenderAttrs, ssrGetDirectiveProps, ssrRenderList, ssrRenderStyle, ssrRenderAttr } from 'vue/server-renderer';
import { B as BasicIconOld, u as usePrefix } from './BasicIconOld-93vAWohq.mjs';
import { e as empty_user } from './empty_user-BaUNCdgf.mjs';
import { i as inputRulesNoMessage } from './inputRules-BErREp_b.mjs';
import { B as BasicInput } from './BasicInput-DvVrG0oq.mjs';
import { B as BasicTextArea } from './BasicTextArea-DwMwa6bG.mjs';
import { B as BaseDatePicker, a as BaseDatePickerJalali } from './BaseDatePicker-L5Qgd4FF.mjs';
import { _ as _sfc_main$4 } from './close-1waVvhB6.mjs';
import { B as BasicSheet } from './index-CM92jef_.mjs';
import { B as BasicButton } from './BasicButton-B9iMRxfW.mjs';
import { I as InstaInput } from './InstaInput-BxY1EG9H.mjs';
import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue';
import { debounce } from 'lodash-es';
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
__name: "IndexImageUploader",
__ssrInlineRender: true,
props: {
fileList: {},
bucket: { default: "productimg" }
},
emits: ["update:fileList", "ok", "delete"],
setup(__props, { emit: __emit }) {
const { prefixCls } = usePrefix("index-image-uploader");
const previewVisible = ref(false);
const previewImage = ref("");
const previewTitle = ref("");
const loading2 = ref(false);
const props = __props;
const emits = __emit;
const fileList = computed({
get() {
return props.fileList || [];
},
set(value) {
emits("update:fileList", value);
}
});
const handlePreview = async (file) => {
previewImage.value = file.src;
previewVisible.value = true;
previewTitle.value = file.name || file.url.substring(file.url.lastIndexOf("/") + 1);
};
const handleCancel = () => {
previewVisible.value = false;
previewTitle.value = "";
};
const beforeUpload = (file) => {
const isLt100k = file.size / 1024 / 1024 < 0.2;
if (!isLt100k) {
api$1.error("حداکثر حجم بارگذاری 200 کیلو بایت میباشد");
}
return isLt100k;
};
function handleChange(info) {
if (info.file.status === "uploading") {
loading2.value = true;
return;
}
if (info.file.status === "error") {
loading2.value = false;
fileList.value = [];
api$1.error("خطا در بارگذاری");
}
if (info.file.status === "done") {
loading2.value = false;
api$1.success("تصویر شاخص با موفقیت بارگذاری شد");
emits("ok", info.file.response.id);
}
if (info.file.status === "removed") {
emits("delete", info.file.uid);
}
}
async function customRequest(options) {
const { onSuccess, onError, file } = options;
try {
const uniqueFileName = `${Date.now()}-${file.name}`;
const { data, error } = await supabase.storage.from(props.bucket).upload(uniqueFileName, file);
if (error) {
throw error;
}
onSuccess(data, file);
const publicUrl = supabase.storage.from(props.bucket).getPublicUrl(uniqueFileName);
fileList.value = [
{
uid: uniqueFileName,
name: file.name,
status: "done",
url: publicUrl.data.publicUrl,
subUrl: data.fullPath
}
];
} catch (error) {
console.error("Upload error:", error);
onError(error);
}
}
return (_ctx, _push, _parent, _attrs) => {
const _component_AUpload = __nuxt_component_0$1;
const _component_AModal = Modal;
_push(`<div${ssrRenderAttrs(mergeProps({
class: [unref(prefixCls)]
}, _attrs))}><div class="flex items-center justify-center overflow-hidden border border-solid border-blue-600 bg-gray-50 rounded-md p-2">`);
_push(ssrRenderComponent(_component_AUpload, {
"file-list": fileList.value,
"onUpdate:fileList": ($event) => fileList.value = $event,
name: "file",
"list-type": "picture-card",
showUploadList: true,
multiple: false,
customRequest,
"before-upload": beforeUpload,
onChange: handleChange,
onPreview: handlePreview
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
if (fileList.value.length === 0) {
_push2(`<div${_scopeId}>`);
if (loading2.value) {
_push2(ssrRenderComponent(unref(LoadingOutlined), null, null, _parent2, _scopeId));
} else {
_push2(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:add",
color: "#6B7280",
class: "justify-center"
}, null, _parent2, _scopeId));
}
_push2(`<div class="text-gray-500 text-center text-xs font-normal"${_scopeId}>Add Image</div></div>`);
} else {
_push2(`<!---->`);
}
} else {
return [
fileList.value.length === 0 ? (openBlock(), createBlock("div", { key: 0 }, [
loading2.value ? (openBlock(), createBlock(unref(LoadingOutlined), { key: 0 })) : (openBlock(), createBlock(BasicIconOld, {
key: 1,
icon: "vuesax-linear:add",
color: "#6B7280",
class: "justify-center"
})),
createVNode("div", { class: "text-gray-500 text-center text-xs font-normal" }, "Add Image")
])) : createCommentVNode("", true)
];
}
}),
_: 1
}, _parent));
_push(ssrRenderComponent(_component_AModal, {
open: previewVisible.value,
title: previewTitle.value,
footer: null,
onCancel: handleCancel
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<img alt="example" style="${ssrRenderStyle({ "width": "100%" })}"${ssrRenderAttr("src", previewImage.value)}${_scopeId}>`);
} else {
return [
createVNode("img", {
alt: "example",
style: { "width": "100%" },
src: previewImage.value
}, null, 8, ["src"])
];
}
}),
_: 1
}, _parent));
_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("components/ProductUploader/IndexImageUploader.vue");
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
};
const IndexImageUploader = Object.assign(_sfc_main$3, { __name: "ProductUploaderIndexImageUploader" });
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
__name: "BasicSheetUploadImage",
__ssrInlineRender: true,
props: {
open: { type: Boolean, default: false },
image: {}
},
emits: ["update:open", "success"],
setup(__props, { emit: __emit }) {
const config = useConfigStore();
const sheetRef = ref(null);
const brandImage = ref([]);
const emits = __emit;
const props = __props;
async function openSheet() {
await nextTick();
await sheetRef.value?.setOpen();
}
async function closeSheet() {
await nextTick();
await sheetRef.value?.setClose();
emits("update:open", false);
}
const inputImage = () => {
if (props.image) {
brandImage.value = [];
brandImage.value.push({
src: getSupabaseStorageUrl(props.image),
// name: props.data.image.original_name,
thumbUrl: getSupabaseStorageUrl(props.image)
});
}
};
watch(brandImage, () => {
emits("success", brandImage.value[0]?.subUrl);
});
watch(props, (value) => {
if (value.open) {
openSheet();
} else {
closeSheet();
}
inputImage();
});
return (_ctx, _push, _parent, _attrs) => {
_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(`<div flex justify-center items-center flex-col p-2${_scopeId}><div bg-gray-500 h-2px w-2.5rem${_scopeId}></div><div class="flex justify-center"${_scopeId}><div mt-3 font-semibold${_scopeId}>${ssrInterpolate(unref(config).useString("imageUploader"))}</div><div class="absolute end-0"${_scopeId}>`);
_push2(ssrRenderComponent(_sfc_main$4, {
class: "w-1rem mt-2 me-5",
onClick: closeSheet
}, null, _parent2, _scopeId));
_push2(`</div></div></div>`);
} 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(unref(config).useString("imageUploader")), 1),
createVNode("div", { class: "absolute end-0" }, [
createVNode(_sfc_main$4, {
class: "w-1rem mt-2 me-5",
onClick: closeSheet
})
])
])
])
];
}
}),
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<div class="max-h-85vh overflow-y-auto px-2 mt3 pb-10"${_scopeId}><div class="flex justify-center"${_scopeId}>`);
_push2(ssrRenderComponent(IndexImageUploader, {
"file-list": brandImage.value,
"onUpdate:fileList": ($event) => brandImage.value = $event
}, null, _parent2, _scopeId));
_push2(`</div></div>`);
} else {
return [
createVNode("div", { class: "max-h-85vh overflow-y-auto px-2 mt3 pb-10" }, [
createVNode("div", { class: "flex justify-center" }, [
createVNode(IndexImageUploader, {
"file-list": brandImage.value,
"onUpdate:fileList": ($event) => brandImage.value = $event
}, null, 8, ["file-list", "onUpdate:fileList"])
])
])
];
}
}),
_: 1
}, _parent));
};
}
});
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/ProductUploader/BasicSheetUploadImage.vue");
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const BasicSheetUploadImage = Object.assign(_sfc_main$2, { __name: "ProductUploaderBasicSheetUploadImage" });
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "JobSelector",
__ssrInlineRender: true,
props: {
open: { type: Boolean },
id: {}
},
emits: ["update:open", "setField"],
setup(__props, { emit: __emit }) {
const config = useConfigStore();
useUserStore();
const sheetRef = ref(null);
const storeCollection = ref([]);
ref();
const props = __props;
const emits = __emit;
const selectedJob = ref();
function buildTree(items, parentId = null) {
return items.filter((item) => item.parent_id === parentId).map((item) => ({
...item,
children: buildTree(items, item.id)
}));
}
const getCollections = async () => {
try {
loading.value = true;
const res = await getStoreCollections();
storeCollection.value = buildTree(res);
} catch (e) {
console.log("e ===>", e);
} finally {
loading.value = false;
}
};
async function openSheet() {
if (props.id) {
selectedJob.value = props.id;
}
if (storeCollection.value?.length == 0) getCollections();
await nextTick();
await sheetRef.value?.setOpen();
}
async function closeSheet() {
await nextTick();
await sheetRef.value?.setClose();
}
watch(props, (value) => {
if (value.open) {
openSheet();
} else {
closeSheet();
}
});
const selectCategory = (val) => {
closeSheet();
emits("setField", val);
};
return (_ctx, _push, _parent, _attrs) => {
const _component_a_spin = Spin;
_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(`<div${_scopeId}></div>`);
} else {
return [
createVNode("div")
];
}
}),
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<div class="px-4 pb-4 flex flex-col justify-between h-70vh"${_scopeId}><div class="flex flex-col gap-2 mt-5 mb-5"${_scopeId}><div${_scopeId}><div flex p-2${_scopeId}><div mt-1 font-semibold${_scopeId}>${ssrInterpolate(unref(config).useString("allCollection"))}</div></div>`);
_push2(ssrRenderComponent(_component_a_spin, { spinning: unref(loading) }, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`<div class="max-h-[50vh] overflow-auto"${_scopeId2}><!--[-->`);
ssrRenderList(storeCollection.value, (item) => {
_push3(ssrRenderComponent(unref(Disclosure), {
as: "div",
class: "mt-2"
}, {
default: withCtx(({ open }, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(unref(DisclosureButton), {
class: "flex w-full items-center rounded-lg px-4 justify-start text-sm focus:outline-none focus-visible:ring bg-transparent",
onClick: () => item?.children?.length ? null : selectCategory(item)
}, {
default: withCtx((_3, _push5, _parent5, _scopeId4) => {
if (_push5) {
_push5(`<div class="${ssrRenderClass([[selectedJob.value === item.id ? "border-primary border-solid border-1 " : "", item?.children?.length ? unref(config).isNightStore ? "text-gray-2" : "text-gray-8" : unref(config).isNightStore ? "text-gray-2" : "text-gray-8"], "w-full flex items-center gap2 rounded-md p-2 text-start"])}"${_scopeId4}><span${_scopeId4}>`);
_push5(ssrRenderComponent(BasicIconOld, {
icon: item?.children?.length ? "vuesax-linear:main-component" : "vuesax-linear:component"
}, null, _parent5, _scopeId4));
_push5(`</span><span${_scopeId4}>${ssrInterpolate(item.title)}</span></div>`);
if (item.children?.length) {
_push5(ssrRenderComponent(BasicIconOld, {
class: [open ? "" : "rotate-180", "transform"],
icon: "tabler:chevron-up"
}, null, _parent5, _scopeId4));
} else {
_push5(`<!---->`);
}
} else {
return [
createVNode("div", {
class: ["w-full flex items-center gap2 rounded-md p-2 text-start", [selectedJob.value === item.id ? "border-primary border-solid border-1 " : "", item?.children?.length ? unref(config).isNightStore ? "text-gray-2" : "text-gray-8" : unref(config).isNightStore ? "text-gray-2" : "text-gray-8"]]
}, [
createVNode("span", null, [
createVNode(BasicIconOld, {
icon: item?.children?.length ? "vuesax-linear:main-component" : "vuesax-linear:component"
}, null, 8, ["icon"])
]),
createVNode("span", null, toDisplayString(item.title), 1)
], 2),
item.children?.length ? (openBlock(), createBlock(BasicIconOld, {
key: 0,
class: [open ? "" : "rotate-180", "transform"],
icon: "tabler:chevron-up"
}, null, 8, ["class"])) : createCommentVNode("", true)
];
}
}),
_: 2
}, _parent4, _scopeId3));
_push4(ssrRenderComponent(unref(DisclosurePanel), { class: "px-4 flex flex-col gap-2 text-sm mt2 mb5" }, {
default: withCtx((_3, _push5, _parent5, _scopeId4) => {
if (_push5) {
_push5(`<!--[-->`);
ssrRenderList(item?.children, (child) => {
_push5(`<div class="${ssrRenderClass([[
selectedJob.value === child.id ? "border-primary border-solid border-1 " : "",
unref(config).isNightStore ? "text-gray-2" : "text-gray-8"
], "w-full flex items-center gap2 rounded-md p-2 text-start ms2"])}"${_scopeId4}><span${_scopeId4}>`);
_push5(ssrRenderComponent(BasicIconOld, { icon: "vuesax-linear:component" }, null, _parent5, _scopeId4));
_push5(`</span><span${_scopeId4}>${ssrInterpolate(child.title)}</span></div>`);
});
_push5(`<!--]-->`);
} else {
return [
(openBlock(true), createBlock(Fragment, null, renderList(item?.children, (child) => {
return openBlock(), createBlock("div", {
class: ["w-full flex items-center gap2 rounded-md p-2 text-start ms2", [
selectedJob.value === child.id ? "border-primary border-solid border-1 " : "",
unref(config).isNightStore ? "text-gray-2" : "text-gray-8"
]],
onClick: ($event) => selectCategory(child)
}, [
createVNode("span", null, [
createVNode(BasicIconOld, { icon: "vuesax-linear:component" })
]),
createVNode("span", null, toDisplayString(child.title), 1)
], 10, ["onClick"]);
}), 256))
];
}
}),
_: 2
}, _parent4, _scopeId3));
} else {
return [
createVNode(unref(DisclosureButton), {
class: "flex w-full items-center rounded-lg px-4 justify-start text-sm focus:outline-none focus-visible:ring bg-transparent",
onClick: () => item?.children?.length ? null : selectCategory(item)
}, {
default: withCtx(() => [
createVNode("div", {
class: ["w-full flex items-center gap2 rounded-md p-2 text-start", [selectedJob.value === item.id ? "border-primary border-solid border-1 " : "", item?.children?.length ? unref(config).isNightStore ? "text-gray-2" : "text-gray-8" : unref(config).isNightStore ? "text-gray-2" : "text-gray-8"]]
}, [
createVNode("span", null, [
createVNode(BasicIconOld, {
icon: item?.children?.length ? "vuesax-linear:main-component" : "vuesax-linear:component"
}, null, 8, ["icon"])
]),
createVNode("span", null, toDisplayString(item.title), 1)
], 2),
item.children?.length ? (openBlock(), createBlock(BasicIconOld, {
key: 0,
class: [open ? "" : "rotate-180", "transform"],
icon: "tabler:chevron-up"
}, null, 8, ["class"])) : createCommentVNode("", true)
]),
_: 2
}, 1032, ["onClick"]),
createVNode(unref(DisclosurePanel), { class: "px-4 flex flex-col gap-2 text-sm mt2 mb5" }, {
default: withCtx(() => [
(openBlock(true), createBlock(Fragment, null, renderList(item?.children, (child) => {
return openBlock(), createBlock("div", {
class: ["w-full flex items-center gap2 rounded-md p-2 text-start ms2", [
selectedJob.value === child.id ? "border-primary border-solid border-1 " : "",
unref(config).isNightStore ? "text-gray-2" : "text-gray-8"
]],
onClick: ($event) => selectCategory(child)
}, [
createVNode("span", null, [
createVNode(BasicIconOld, { icon: "vuesax-linear:component" })
]),
createVNode("span", null, toDisplayString(child.title), 1)
], 10, ["onClick"]);
}), 256))
]),
_: 2
}, 1024)
];
}
}),
_: 2
}, _parent3, _scopeId2));
});
_push3(`<!--]--></div>`);
} else {
return [
createVNode("div", { class: "max-h-[50vh] overflow-auto" }, [
(openBlock(true), createBlock(Fragment, null, renderList(storeCollection.value, (item) => {
return openBlock(), createBlock(unref(Disclosure), {
as: "div",
class: "mt-2"
}, {
default: withCtx(({ open }) => [
createVNode(unref(DisclosureButton), {
class: "flex w-full items-center rounded-lg px-4 justify-start text-sm focus:outline-none focus-visible:ring bg-transparent",
onClick: () => item?.children?.length ? null : selectCategory(item)
}, {
default: withCtx(() => [
createVNode("div", {
class: ["w-full flex items-center gap2 rounded-md p-2 text-start", [selectedJob.value === item.id ? "border-primary border-solid border-1 " : "", item?.children?.length ? unref(config).isNightStore ? "text-gray-2" : "text-gray-8" : unref(config).isNightStore ? "text-gray-2" : "text-gray-8"]]
}, [
createVNode("span", null, [
createVNode(BasicIconOld, {
icon: item?.children?.length ? "vuesax-linear:main-component" : "vuesax-linear:component"
}, null, 8, ["icon"])
]),
createVNode("span", null, toDisplayString(item.title), 1)
], 2),
item.children?.length ? (openBlock(), createBlock(BasicIconOld, {
key: 0,
class: [open ? "" : "rotate-180", "transform"],
icon: "tabler:chevron-up"
}, null, 8, ["class"])) : createCommentVNode("", true)
]),
_: 2
}, 1032, ["onClick"]),
createVNode(unref(DisclosurePanel), { class: "px-4 flex flex-col gap-2 text-sm mt2 mb5" }, {
default: withCtx(() => [
(openBlock(true), createBlock(Fragment, null, renderList(item?.children, (child) => {
return openBlock(), createBlock("div", {
class: ["w-full flex items-center gap2 rounded-md p-2 text-start ms2", [
selectedJob.value === child.id ? "border-primary border-solid border-1 " : "",
unref(config).isNightStore ? "text-gray-2" : "text-gray-8"
]],
onClick: ($event) => selectCategory(child)
}, [
createVNode("span", null, [
createVNode(BasicIconOld, { icon: "vuesax-linear:component" })
]),
createVNode("span", null, toDisplayString(child.title), 1)
], 10, ["onClick"]);
}), 256))
]),
_: 2
}, 1024)
]),
_: 2
}, 1024);
}), 256))
])
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`</div></div>`);
_push2(ssrRenderComponent(BasicButton, {
block: "",
class: "!h-unset !rounded-lg mt-5",
onClick: closeSheet
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(`${ssrInterpolate(unref(config).useString("close"))}`);
} else {
return [
createTextVNode(toDisplayString(unref(config).useString("close")), 1)
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(`</div>`);
} else {
return [
createVNode("div", { class: "px-4 pb-4 flex flex-col justify-between h-70vh" }, [
createVNode("div", { class: "flex flex-col gap-2 mt-5 mb-5" }, [
createVNode("div", null, [
createVNode("div", {
flex: "",
"p-2": ""
}, [
createVNode("div", {
"mt-1": "",
"font-semibold": ""
}, toDisplayString(unref(config).useString("allCollection")), 1)
]),
createVNode(_component_a_spin, { spinning: unref(loading) }, {
default: withCtx(() => [
createVNode("div", { class: "max-h-[50vh] overflow-auto" }, [
(openBlock(true), createBlock(Fragment, null, renderList(storeCollection.value, (item) => {
return openBlock(), createBlock(unref(Disclosure), {
as: "div",
class: "mt-2"
}, {
default: withCtx(({ open }) => [
createVNode(unref(DisclosureButton), {
class: "flex w-full items-center rounded-lg px-4 justify-start text-sm focus:outline-none focus-visible:ring bg-transparent",
onClick: () => item?.children?.length ? null : selectCategory(item)
}, {
default: withCtx(() => [
createVNode("div", {
class: ["w-full flex items-center gap2 rounded-md p-2 text-start", [selectedJob.value === item.id ? "border-primary border-solid border-1 " : "", item?.children?.length ? unref(config).isNightStore ? "text-gray-2" : "text-gray-8" : unref(config).isNightStore ? "text-gray-2" : "text-gray-8"]]
}, [
createVNode("span", null, [
createVNode(BasicIconOld, {
icon: item?.children?.length ? "vuesax-linear:main-component" : "vuesax-linear:component"
}, null, 8, ["icon"])
]),
createVNode("span", null, toDisplayString(item.title), 1)
], 2),
item.children?.length ? (openBlock(), createBlock(BasicIconOld, {
key: 0,
class: [open ? "" : "rotate-180", "transform"],
icon: "tabler:chevron-up"
}, null, 8, ["class"])) : createCommentVNode("", true)
]),
_: 2
}, 1032, ["onClick"]),
createVNode(unref(DisclosurePanel), { class: "px-4 flex flex-col gap-2 text-sm mt2 mb5" }, {
default: withCtx(() => [
(openBlock(true), createBlock(Fragment, null, renderList(item?.children, (child) => {
return openBlock(), createBlock("div", {
class: ["w-full flex items-center gap2 rounded-md p-2 text-start ms2", [
selectedJob.value === child.id ? "border-primary border-solid border-1 " : "",
unref(config).isNightStore ? "text-gray-2" : "text-gray-8"
]],
onClick: ($event) => selectCategory(child)
}, [
createVNode("span", null, [
createVNode(BasicIconOld, { icon: "vuesax-linear:component" })
]),
createVNode("span", null, toDisplayString(child.title), 1)
], 10, ["onClick"]);
}), 256))
]),
_: 2
}, 1024)
]),
_: 2
}, 1024);
}), 256))
])
]),
_: 1
}, 8, ["spinning"])
])
]),
createVNode(BasicButton, {
block: "",
class: "!h-unset !rounded-lg mt-5",
onClick: closeSheet
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(config).useString("close")), 1)
]),
_: 1
})
])
];
}
}),
_: 1
}, _parent));
};
}
});
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/userMain/edit/components/JobSelector.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "index",
__ssrInlineRender: true,
setup(__props) {
const router = useRouter$1();
const config = useConfigStore();
const user = useUserStore();
const imageVisible = ref(false);
const img = ref("");
const formRef = ref();
const jobVisible = ref();
const selectedJob = ref();
ref([]);
const formFields = ref({
avatar: "",
birthday: "",
website: "",
name: "",
first_name: "",
last_name: "",
phone: "",
email: "",
bio: "",
skill: ""
});
function setJob(job) {
formFields.value.job = job.id;
selectedJob.value = job;
}
function openImageUploader() {
imageVisible.value = true;
img.value = formFields.value.avatar;
}
function loadImage(img2) {
formFields.value.avatar = img2;
}
function handleSubmit() {
formRef.value.validateFields().then(async () => {
try {
loading.value = true;
formFields.value.name = `${formFields.value.first_name} ${formFields.value.last_name}`;
if (formFields.value.password === "" || formFields.value.password === " ") formFields.value.password = void 0;
await updateUser(formFields.value);
await user.getUserInfo();
await config.getConfig();
router.back();
} catch (e) {
} finally {
loading.value = false;
}
});
}
const validate = ref(true);
const usernameLoading = ref(false);
const indicator = h(LoadingOutlined, {
style: {
fontSize: "16px"
},
spin: true
});
const checkValidateUsername = debounce(async (val) => {
try {
usernameLoading.value = true;
const users = await checkUsername(val);
validate.value = users?.length === 0;
if (!validate.value && users.length === 1) {
validate.value = users[0]?.id === user?.user?.id;
}
} catch (e) {
console.log(e);
} finally {
usernameLoading.value = false;
}
}, 1e3);
watch(user.user, () => {
formFields.value = user.user;
});
return (_ctx, _push, _parent, _attrs) => {
const _component_a_spin = Spin;
const _component_a_form = Form;
const _directive_lazy = resolveDirective("lazy");
let _temp0;
_push(ssrRenderComponent(_component_a_spin, mergeProps({ spinning: unref(loading) }, _attrs), {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`<div class="${ssrRenderClass([" fixed w-full top-0 z-2", !unref(config).isNightStore ? "bg-header-color" : "bg-header-color-dark "])}"${_scopeId}><div class="px-4 flex items-center justify-between"${_scopeId}><div class="flex gap-5 py-4"${_scopeId}>`);
_push2(ssrRenderComponent(BasicIconOld, {
icon: unref(config).isRTL ? "vuesax-linear:arrow-right" : "vuesax-linear:arrow-left",
onClick: ($event) => unref(router).back()
}, null, _parent2, _scopeId));
_push2(`<div class="font-semibold"${_scopeId}>${ssrInterpolate(unref(config).useString("editProfile"))}</div></div><div${_scopeId}></div></div></div><div class="pt-4rem pb-6rem overflow-y-auto"${_scopeId}><div class="w-full flex justify-center"${_scopeId}><img${ssrRenderAttrs(_temp0 = mergeProps({
alt: unref(reactiveProjectName),
class: "w-4rem h-4rem rounded-full object-cover"
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(getSupabaseStorageUrl)(formFields.value.avatar), loading: unref(empty_user), error: unref(empty_user) })))}${_scopeId}>${"textContent" in _temp0 ? ssrInterpolate(_temp0.textContent) : _temp0.innerHTML ?? ""}</div><div class="px-1rem mt-2rem"${_scopeId}>`);
_push2(ssrRenderComponent(_component_a_form, {
ref_key: "formRef",
ref: formRef,
model: formFields.value,
autocomplete: "off",
layout: "vertical"
}, {
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
if (_push3) {
_push3(ssrRenderComponent(InstaInput, {
rules: unref(inputRulesNoMessage)(),
value: formFields.value.first_name,
"onUpdate:value": ($event) => formFields.value.first_name = $event,
label: "firstName",
name: "first_name"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(BasicInput, {
value: formFields.value.first_name,
"onUpdate:value": ($event) => formFields.value.first_name = $event,
placeHolder: unref(config).useString("firstName")
}, null, _parent4, _scopeId3));
} else {
return [
createVNode(BasicInput, {
value: formFields.value.first_name,
"onUpdate:value": ($event) => formFields.value.first_name = $event,
placeHolder: unref(config).useString("firstName")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(InstaInput, {
rules: unref(inputRulesNoMessage)(),
value: formFields.value.last_name,
"onUpdate:value": ($event) => formFields.value.last_name = $event,
label: "lastName",
name: "last_name"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(BasicInput, {
value: formFields.value.last_name,
"onUpdate:value": ($event) => formFields.value.last_name = $event,
placeHolder: unref(config).useString("lastName")
}, null, _parent4, _scopeId3));
} else {
return [
createVNode(BasicInput, {
value: formFields.value.last_name,
"onUpdate:value": ($event) => formFields.value.last_name = $event,
placeHolder: unref(config).useString("lastName")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
];
}
}),
_: 1
}, _parent3, _scopeId2));
if (unref(config).isSeller && formFields.value.type !== "customer") {
_push3(ssrRenderComponent(InstaInput, {
rules: [],
value: formFields.value.website,
"onUpdate:value": ($event) => formFields.value.website = $event,
label: "website",
name: "website"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(BasicInput, {
value: formFields.value.website,
"onUpdate:value": ($event) => formFields.value.website = $event,
placeHolder: unref(config).useString("website")
}, null, _parent4, _scopeId3));
} else {
return [
createVNode(BasicInput, {
value: formFields.value.website,
"onUpdate:value": ($event) => formFields.value.website = $event,
placeHolder: unref(config).useString("website")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
];
}
}),
_: 1
}, _parent3, _scopeId2));
} else {
_push3(`<!---->`);
}
if (unref(config).isSeller && formFields.value.type !== "customer") {
_push3(ssrRenderComponent(InstaInput, {
rules: [],
value: formFields.value.username,
"onUpdate:value": ($event) => formFields.value.username = $event,
label: "username",
name: "username"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(`<div class="flex items-center"${_scopeId3}>`);
_push4(ssrRenderComponent(BasicInput, {
value: formFields.value.username,
"onUpdate:value": ($event) => formFields.value.username = $event,
placeHolder: unref(config).useString("username"),
class: "flex-1",
"validate-status": "success",
onOnchange: unref(checkValidateUsername)
}, null, _parent4, _scopeId3));
if (!usernameLoading.value) {
_push4(`<!--[-->`);
if (validate.value) {
_push4(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:tick-circle",
color: "green",
size: "16"
}, null, _parent4, _scopeId3));
} else {
_push4(ssrRenderComponent(BasicIconOld, {
icon: "vuesax-linear:close-circle",
color: "red",
size: "16"
}, null, _parent4, _scopeId3));
}
_push4(`<!--]-->`);
} else {
_push4(ssrRenderComponent(_component_a_spin, {
spinning: usernameLoading.value,
indicator: unref(indicator)
}, null, _parent4, _scopeId3));
}
_push4(`</div>`);
} else {
return [
createVNode("div", { class: "flex items-center" }, [
createVNode(BasicInput, {
value: formFields.value.username,
"onUpdate:value": ($event) => formFields.value.username = $event,
placeHolder: unref(config).useString("username"),
class: "flex-1",
"validate-status": "success",
onOnchange: unref(checkValidateUsername)
}, null, 8, ["value", "onUpdate:value", "placeHolder", "onOnchange"]),
!usernameLoading.value ? (openBlock(), createBlock(Fragment, { key: 0 }, [
validate.value ? (openBlock(), createBlock(BasicIconOld, {
key: 0,
icon: "vuesax-linear:tick-circle",
color: "green",
size: "16"
})) : (openBlock(), createBlock(BasicIconOld, {
key: 1,
icon: "vuesax-linear:close-circle",
color: "red",
size: "16"
}))
], 64)) : (openBlock(), createBlock(_component_a_spin, {
key: 1,
spinning: usernameLoading.value,
indicator: unref(indicator)
}, null, 8, ["spinning", "indicator"]))
])
];
}
}),
_: 1
}, _parent3, _scopeId2));
} else {
_push3(`<!---->`);
}
_push3(ssrRenderComponent(InstaInput, {
rules: [],
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
label: "birthdate",
name: "birthdate"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
if (unref(config).lang === "en" && ("APP_Milady_Date" in _ctx ? _ctx.APP_Milady_Date : unref(APP_Milady_Date))) {
_push4(ssrRenderComponent(unref(BaseDatePicker), {
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate")
}, null, _parent4, _scopeId3));
} else {
_push4(ssrRenderComponent(unref(BaseDatePickerJalali), {
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate")
}, null, _parent4, _scopeId3));
}
} else {
return [
unref(config).lang === "en" && ("APP_Milady_Date" in _ctx ? _ctx.APP_Milady_Date : unref(APP_Milady_Date)) ? (openBlock(), createBlock(unref(BaseDatePicker), {
key: 0,
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])) : (openBlock(), createBlock(unref(BaseDatePickerJalali), {
key: 1,
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate")
}, null, 8, ["value", "onUpdate:value", "placeHolder"]))
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(InstaInput, {
rules: unref(inputRulesNoMessage)(),
value: formFields.value.phone,
"onUpdate:value": ($event) => formFields.value.phone = $event,
label: "phone",
name: "phone"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(BasicInput, {
value: formFields.value.phone,
"onUpdate:value": ($event) => formFields.value.phone = $event,
placeHolder: unref(config).useString("phone")
}, null, _parent4, _scopeId3));
} else {
return [
createVNode(BasicInput, {
value: formFields.value.phone,
"onUpdate:value": ($event) => formFields.value.phone = $event,
placeHolder: unref(config).useString("phone")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(InstaInput, {
rules: [],
value: formFields.value.password,
"onUpdate:value": ($event) => formFields.value.password = $event,
label: "password",
name: "password"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(BasicInput, {
value: formFields.value.password,
"onUpdate:value": ($event) => formFields.value.password = $event,
"place-holder": unref(config).useString("password"),
"is-password": ""
}, null, _parent4, _scopeId3));
} else {
return [
createVNode(BasicInput, {
value: formFields.value.password,
"onUpdate:value": ($event) => formFields.value.password = $event,
"place-holder": unref(config).useString("password"),
"is-password": ""
}, null, 8, ["value", "onUpdate:value", "place-holder"])
];
}
}),
_: 1
}, _parent3, _scopeId2));
_push3(ssrRenderComponent(InstaInput, {
rules: [],
value: formFields.value.job,
"onUpdate:value": ($event) => formFields.value.job = $event,
label: "skill",
onClick: ($event) => jobVisible.value = true,
name: "password"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
if (!formFields.value.job) {
_push4(`<div class="text-gray-3 mt2 mr2"${_scopeId3}>${ssrInterpolate(unref(config).useString("selectSkill"))}</div>`);
} else {
_push4(`<div class="${ssrRenderClass([unref(config).isNightStore ? "text-gray-3" : "text-gray-8", "mt2 mr2"])}"${_scopeId3}>${ssrInterpolate(selectedJob.value?.title)}</div>`);
}
} else {
return [
!formFields.value.job ? (openBlock(), createBlock("div", {
key: 0,
class: "text-gray-3 mt2 mr2"
}, toDisplayString(unref(config).useString("selectSkill")), 1)) : (openBlock(), createBlock("div", {
key: 1,
class: ["mt2 mr2", unref(config).isNightStore ? "text-gray-3" : "text-gray-8"]
}, toDisplayString(selectedJob.value?.title), 3))
];
}
}),
_: 1
}, _parent3, _scopeId2));
if (unref(config).isSeller && formFields.value.type !== "customer") {
_push3(ssrRenderComponent(InstaInput, {
class: "min-h-120px",
rules: unref(inputRulesNoMessage)(),
value: formFields.value.bio,
"onUpdate:value": ($event) => formFields.value.bio = $event,
label: "bio",
"content-height": "",
name: "bio"
}, {
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
if (_push4) {
_push4(ssrRenderComponent(BasicTextArea, {
value: formFields.value.bio,
"onUpdate:value": ($event) => formFields.value.bio = $event,
placeHolder: unref(config).useString("writeYourBio"),
rows: 3,
class: "bg-transparent border-unset"
}, null, _parent4, _scopeId3));
} else {
return [
createVNode(BasicTextArea, {
value: formFields.value.bio,
"onUpdate:value": ($event) => formFields.value.bio = $event,
placeHolder: unref(config).useString("writeYourBio"),
rows: 3,
class: "bg-transparent border-unset"
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
];
}
}),
_: 1
}, _parent3, _scopeId2));
} else {
_push3(`<!---->`);
}
} else {
return [
createVNode(InstaInput, {
rules: unref(inputRulesNoMessage)(),
value: formFields.value.first_name,
"onUpdate:value": ($event) => formFields.value.first_name = $event,
label: "firstName",
name: "first_name"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.first_name,
"onUpdate:value": ($event) => formFields.value.first_name = $event,
placeHolder: unref(config).useString("firstName")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["rules", "value", "onUpdate:value"]),
createVNode(InstaInput, {
rules: unref(inputRulesNoMessage)(),
value: formFields.value.last_name,
"onUpdate:value": ($event) => formFields.value.last_name = $event,
label: "lastName",
name: "last_name"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.last_name,
"onUpdate:value": ($event) => formFields.value.last_name = $event,
placeHolder: unref(config).useString("lastName")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["rules", "value", "onUpdate:value"]),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 0,
rules: [],
value: formFields.value.website,
"onUpdate:value": ($event) => formFields.value.website = $event,
label: "website",
name: "website"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.website,
"onUpdate:value": ($event) => formFields.value.website = $event,
placeHolder: unref(config).useString("website")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["value", "onUpdate:value"])) : createCommentVNode("", true),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 1,
rules: [],
value: formFields.value.username,
"onUpdate:value": ($event) => formFields.value.username = $event,
label: "username",
name: "username"
}, {
default: withCtx(() => [
createVNode("div", { class: "flex items-center" }, [
createVNode(BasicInput, {
value: formFields.value.username,
"onUpdate:value": ($event) => formFields.value.username = $event,
placeHolder: unref(config).useString("username"),
class: "flex-1",
"validate-status": "success",
onOnchange: unref(checkValidateUsername)
}, null, 8, ["value", "onUpdate:value", "placeHolder", "onOnchange"]),
!usernameLoading.value ? (openBlock(), createBlock(Fragment, { key: 0 }, [
validate.value ? (openBlock(), createBlock(BasicIconOld, {
key: 0,
icon: "vuesax-linear:tick-circle",
color: "green",
size: "16"
})) : (openBlock(), createBlock(BasicIconOld, {
key: 1,
icon: "vuesax-linear:close-circle",
color: "red",
size: "16"
}))
], 64)) : (openBlock(), createBlock(_component_a_spin, {
key: 1,
spinning: usernameLoading.value,
indicator: unref(indicator)
}, null, 8, ["spinning", "indicator"]))
])
]),
_: 1
}, 8, ["value", "onUpdate:value"])) : createCommentVNode("", true),
createVNode(InstaInput, {
rules: [],
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
label: "birthdate",
name: "birthdate"
}, {
default: withCtx(() => [
unref(config).lang === "en" && ("APP_Milady_Date" in _ctx ? _ctx.APP_Milady_Date : unref(APP_Milady_Date)) ? (openBlock(), createBlock(unref(BaseDatePicker), {
key: 0,
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])) : (openBlock(), createBlock(unref(BaseDatePickerJalali), {
key: 1,
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate")
}, null, 8, ["value", "onUpdate:value", "placeHolder"]))
]),
_: 1
}, 8, ["value", "onUpdate:value"]),
createVNode(InstaInput, {
rules: unref(inputRulesNoMessage)(),
value: formFields.value.phone,
"onUpdate:value": ($event) => formFields.value.phone = $event,
label: "phone",
name: "phone"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.phone,
"onUpdate:value": ($event) => formFields.value.phone = $event,
placeHolder: unref(config).useString("phone")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["rules", "value", "onUpdate:value"]),
createVNode(InstaInput, {
rules: [],
value: formFields.value.password,
"onUpdate:value": ($event) => formFields.value.password = $event,
label: "password",
name: "password"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.password,
"onUpdate:value": ($event) => formFields.value.password = $event,
"place-holder": unref(config).useString("password"),
"is-password": ""
}, null, 8, ["value", "onUpdate:value", "place-holder"])
]),
_: 1
}, 8, ["value", "onUpdate:value"]),
createVNode(InstaInput, {
rules: [],
value: formFields.value.job,
"onUpdate:value": ($event) => formFields.value.job = $event,
label: "skill",
onClick: ($event) => jobVisible.value = true,
name: "password"
}, {
default: withCtx(() => [
!formFields.value.job ? (openBlock(), createBlock("div", {
key: 0,
class: "text-gray-3 mt2 mr2"
}, toDisplayString(unref(config).useString("selectSkill")), 1)) : (openBlock(), createBlock("div", {
key: 1,
class: ["mt2 mr2", unref(config).isNightStore ? "text-gray-3" : "text-gray-8"]
}, toDisplayString(selectedJob.value?.title), 3))
]),
_: 1
}, 8, ["value", "onUpdate:value", "onClick"]),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 2,
class: "min-h-120px",
rules: unref(inputRulesNoMessage)(),
value: formFields.value.bio,
"onUpdate:value": ($event) => formFields.value.bio = $event,
label: "bio",
"content-height": "",
name: "bio"
}, {
default: withCtx(() => [
createVNode(BasicTextArea, {
value: formFields.value.bio,
"onUpdate:value": ($event) => formFields.value.bio = $event,
placeHolder: unref(config).useString("writeYourBio"),
rows: 3,
class: "bg-transparent border-unset"
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["rules", "value", "onUpdate:value"])) : createCommentVNode("", true)
];
}
}),
_: 1
}, _parent2, _scopeId));
_push2(ssrRenderComponent(BasicButton, {
block: "",
type: "primary",
class: "mt-5",
onClick: ($event) => handleSubmit(),
loading: unref(loading),
size: "large",
disabled: !validate.value
}, {
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(`</div>`);
_push2(ssrRenderComponent(BasicSheetUploadImage, {
open: imageVisible.value,
"onUpdate:open": ($event) => imageVisible.value = $event,
onSuccess: loadImage
}, null, _parent2, _scopeId));
_push2(`</div>`);
_push2(ssrRenderComponent(_sfc_main$1, {
id: formFields.value.job,
open: jobVisible.value,
"onUpdate:open": ($event) => jobVisible.value = $event,
onSetField: setJob
}, null, _parent2, _scopeId));
} else {
return [
createVNode("div", {
class: [" fixed w-full top-0 z-2", !unref(config).isNightStore ? "bg-header-color" : "bg-header-color-dark "]
}, [
createVNode("div", { class: "px-4 flex items-center justify-between" }, [
createVNode("div", { class: "flex gap-5 py-4" }, [
createVNode(BasicIconOld, {
icon: unref(config).isRTL ? "vuesax-linear:arrow-right" : "vuesax-linear:arrow-left",
onClick: ($event) => unref(router).back()
}, null, 8, ["icon", "onClick"]),
createVNode("div", { class: "font-semibold" }, toDisplayString(unref(config).useString("editProfile")), 1)
]),
createVNode("div")
])
], 2),
createVNode("div", { class: "pt-4rem pb-6rem overflow-y-auto" }, [
createVNode("div", { class: "w-full flex justify-center" }, [
withDirectives(createVNode("img", {
alt: unref(reactiveProjectName),
class: "w-4rem h-4rem rounded-full object-cover",
onClick: openImageUploader
}, null, 8, ["alt"]), [
[_directive_lazy, { src: unref(getSupabaseStorageUrl)(formFields.value.avatar), loading: unref(empty_user), error: unref(empty_user) }]
])
]),
createVNode("div", { class: "px-1rem mt-2rem" }, [
createVNode(_component_a_form, {
ref_key: "formRef",
ref: formRef,
model: formFields.value,
autocomplete: "off",
layout: "vertical"
}, {
default: withCtx(() => [
createVNode(InstaInput, {
rules: unref(inputRulesNoMessage)(),
value: formFields.value.first_name,
"onUpdate:value": ($event) => formFields.value.first_name = $event,
label: "firstName",
name: "first_name"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.first_name,
"onUpdate:value": ($event) => formFields.value.first_name = $event,
placeHolder: unref(config).useString("firstName")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["rules", "value", "onUpdate:value"]),
createVNode(InstaInput, {
rules: unref(inputRulesNoMessage)(),
value: formFields.value.last_name,
"onUpdate:value": ($event) => formFields.value.last_name = $event,
label: "lastName",
name: "last_name"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.last_name,
"onUpdate:value": ($event) => formFields.value.last_name = $event,
placeHolder: unref(config).useString("lastName")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["rules", "value", "onUpdate:value"]),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 0,
rules: [],
value: formFields.value.website,
"onUpdate:value": ($event) => formFields.value.website = $event,
label: "website",
name: "website"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.website,
"onUpdate:value": ($event) => formFields.value.website = $event,
placeHolder: unref(config).useString("website")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["value", "onUpdate:value"])) : createCommentVNode("", true),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 1,
rules: [],
value: formFields.value.username,
"onUpdate:value": ($event) => formFields.value.username = $event,
label: "username",
name: "username"
}, {
default: withCtx(() => [
createVNode("div", { class: "flex items-center" }, [
createVNode(BasicInput, {
value: formFields.value.username,
"onUpdate:value": ($event) => formFields.value.username = $event,
placeHolder: unref(config).useString("username"),
class: "flex-1",
"validate-status": "success",
onOnchange: unref(checkValidateUsername)
}, null, 8, ["value", "onUpdate:value", "placeHolder", "onOnchange"]),
!usernameLoading.value ? (openBlock(), createBlock(Fragment, { key: 0 }, [
validate.value ? (openBlock(), createBlock(BasicIconOld, {
key: 0,
icon: "vuesax-linear:tick-circle",
color: "green",
size: "16"
})) : (openBlock(), createBlock(BasicIconOld, {
key: 1,
icon: "vuesax-linear:close-circle",
color: "red",
size: "16"
}))
], 64)) : (openBlock(), createBlock(_component_a_spin, {
key: 1,
spinning: usernameLoading.value,
indicator: unref(indicator)
}, null, 8, ["spinning", "indicator"]))
])
]),
_: 1
}, 8, ["value", "onUpdate:value"])) : createCommentVNode("", true),
createVNode(InstaInput, {
rules: [],
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
label: "birthdate",
name: "birthdate"
}, {
default: withCtx(() => [
unref(config).lang === "en" && ("APP_Milady_Date" in _ctx ? _ctx.APP_Milady_Date : unref(APP_Milady_Date)) ? (openBlock(), createBlock(unref(BaseDatePicker), {
key: 0,
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])) : (openBlock(), createBlock(unref(BaseDatePickerJalali), {
key: 1,
value: formFields.value.birthday,
"onUpdate:value": ($event) => formFields.value.birthday = $event,
inputReadOnly: "",
placeHolder: unref(config).useString("birthdate")
}, null, 8, ["value", "onUpdate:value", "placeHolder"]))
]),
_: 1
}, 8, ["value", "onUpdate:value"]),
createVNode(InstaInput, {
rules: unref(inputRulesNoMessage)(),
value: formFields.value.phone,
"onUpdate:value": ($event) => formFields.value.phone = $event,
label: "phone",
name: "phone"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.phone,
"onUpdate:value": ($event) => formFields.value.phone = $event,
placeHolder: unref(config).useString("phone")
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["rules", "value", "onUpdate:value"]),
createVNode(InstaInput, {
rules: [],
value: formFields.value.password,
"onUpdate:value": ($event) => formFields.value.password = $event,
label: "password",
name: "password"
}, {
default: withCtx(() => [
createVNode(BasicInput, {
value: formFields.value.password,
"onUpdate:value": ($event) => formFields.value.password = $event,
"place-holder": unref(config).useString("password"),
"is-password": ""
}, null, 8, ["value", "onUpdate:value", "place-holder"])
]),
_: 1
}, 8, ["value", "onUpdate:value"]),
createVNode(InstaInput, {
rules: [],
value: formFields.value.job,
"onUpdate:value": ($event) => formFields.value.job = $event,
label: "skill",
onClick: ($event) => jobVisible.value = true,
name: "password"
}, {
default: withCtx(() => [
!formFields.value.job ? (openBlock(), createBlock("div", {
key: 0,
class: "text-gray-3 mt2 mr2"
}, toDisplayString(unref(config).useString("selectSkill")), 1)) : (openBlock(), createBlock("div", {
key: 1,
class: ["mt2 mr2", unref(config).isNightStore ? "text-gray-3" : "text-gray-8"]
}, toDisplayString(selectedJob.value?.title), 3))
]),
_: 1
}, 8, ["value", "onUpdate:value", "onClick"]),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 2,
class: "min-h-120px",
rules: unref(inputRulesNoMessage)(),
value: formFields.value.bio,
"onUpdate:value": ($event) => formFields.value.bio = $event,
label: "bio",
"content-height": "",
name: "bio"
}, {
default: withCtx(() => [
createVNode(BasicTextArea, {
value: formFields.value.bio,
"onUpdate:value": ($event) => formFields.value.bio = $event,
placeHolder: unref(config).useString("writeYourBio"),
rows: 3,
class: "bg-transparent border-unset"
}, null, 8, ["value", "onUpdate:value", "placeHolder"])
]),
_: 1
}, 8, ["rules", "value", "onUpdate:value"])) : createCommentVNode("", true)
]),
_: 1
}, 8, ["model"]),
createVNode(BasicButton, {
block: "",
type: "primary",
class: "mt-5",
onClick: ($event) => handleSubmit(),
loading: unref(loading),
size: "large",
disabled: !validate.value
}, {
default: withCtx(() => [
createTextVNode(toDisplayString(unref(config).useString("submit")), 1)
]),
_: 1
}, 8, ["onClick", "loading", "disabled"])
]),
createVNode(BasicSheetUploadImage, {
open: imageVisible.value,
"onUpdate:open": ($event) => imageVisible.value = $event,
onSuccess: loadImage
}, null, 8, ["open", "onUpdate:open"])
]),
createVNode(_sfc_main$1, {
id: formFields.value.job,
open: jobVisible.value,
"onUpdate:open": ($event) => jobVisible.value = $event,
onSetField: setJob
}, null, 8, ["id", "open", "onUpdate:open"])
];
}
}),
_: 1
}, _parent));
};
}
});
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/user/userMain/edit/index.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as _ };
//# sourceMappingURL=index-D5nf33pD.mjs.map