Files
appco_dist/.output/server/chunks/build/index-DueIMgOd.mjs
T
2026-02-01 17:38:39 +03:30

1658 lines
83 KiB
JavaScript

import { LoadingOutlined } from '@ant-design/icons-vue';
import { defineComponent, ref, h, watch, resolveDirective, mergeProps, unref, withCtx, createVNode, openBlock, createBlock, Fragment, toDisplayString, createCommentVNode, createTextVNode, withDirectives, renderList, computed, nextTick, reactive, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrRenderClass, ssrInterpolate, ssrRenderAttrs, ssrGetDirectiveProps, ssrRenderList, ssrRenderAttr, ssrRenderStyle } from 'vue/server-renderer';
import { B as BasicIconOld } from './BasicIconOld-93vAWohq.mjs';
import { u as useRouter$1, a as useConfigStore, b as useUserStore, aJ as checkUsername, e as loading, aK as updateUser, aL as getStoreCollections, M as Button } from './server.mjs';
import { e as empty_user } from './empty_user-DSxcM_ac.mjs';
import { i as inputRulesNoMessage } from './inputRules-Cr4Uiro2.mjs';
import { B as BasicInput } from './BasicInput-CldcPa4f.mjs';
import { b as __nuxt_component_0$1 } from './index-xCOPbDMH.mjs';
import { B as BaseDatePicker, a as BaseDatePickerJalali } from './BaseDatePicker-Dkf-M4Yl.mjs';
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
import { F as Form, _ as _sfc_main$5 } from './index-DDKLrugS.mjs';
import { B as BasicSheet } from './index-x7G4qpPf.mjs';
import { B as BasicButton } from './BasicButton-CNera6n7.mjs';
import { I as InstaInput } from './InstaInput-B3jNyRDU.mjs';
import { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue';
import { S as Spin } from './index--iRd5AYr.mjs';
import { debounce } from 'lodash-es';
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
__name: "BasicTextArea",
__ssrInlineRender: true,
props: {
title: {},
value: {},
showCount: { type: Boolean },
maxlength: {},
placeHolder: {},
autoSize: { type: Boolean },
rows: {}
},
emits: ["update:value"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const localValue = computed({
get() {
return props.value;
},
set(value) {
emit("update:value", value);
}
});
return (_ctx, _push, _parent, _attrs) => {
const _component_a_textarea = __nuxt_component_0$1;
_push(ssrRenderComponent(_component_a_textarea, mergeProps({
value: localValue.value,
"onUpdate:value": ($event) => localValue.value = $event,
class: "",
type: props.type,
maxlength: _ctx.maxlength,
"show-count": props.showCount,
rows: _ctx.rows,
placeHolder: props.placeHolder,
"auto-size": props.autoSize
}, _attrs), null, _parent));
};
}
});
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/BasicPacks/BasicTextArea.vue");
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
};
const BasicTextArea = Object.assign(_sfc_main$4, { __name: "BasicPacksBasicTextArea" });
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
__name: "IndexImageUploader",
__ssrInlineRender: true,
props: {
fileList: { default: () => [] },
maxWidth: { default: 1200 },
maxHeight: { default: 1200 },
maxBytes: { default: 200 * 1024 },
minQuality: { default: 0.5 }
},
emits: ["update:fileList", "ok", "delete"],
setup(__props, { emit: __emit }) {
const props = __props;
const emit = __emit;
const config = useConfigStore();
computed(() => config.STORAGE_UPLOAD);
const previewBase = computed(() => (config.STORAGE_URL || "").replace(/\/+$/, ""));
const joinUrl = (base, path) => {
const p = String(path || "").replace(/^\/+/, "");
return base ? `${base}/${p}` : p;
};
const state = reactive({
uid: "",
name: "",
size: 0,
type: "",
status: "",
percent: 0,
url: "",
// preview url کامل
subUrl: "",
// path خامی که بک‌اند برمی‌گردونه
response: null,
xhr: null
});
watch(() => props.fileList, (arr) => {
const v = arr && arr[0] || null;
if (!v) {
reset();
return;
}
const path = v.subUrl || v.path || "";
const full = v.src || v.thumbUrl || (path ? joinUrl(previewBase.value, path) : "");
state.url = full;
state.subUrl = path;
state.status = v.status || "done";
state.name = v.name || "";
}, { immediate: true });
const inp = ref(null);
function pick() {
if (inp.value) {
inp.value.value = "";
inp.value.click();
}
}
function reset() {
if (state.url?.startsWith("blob:")) URL.revokeObjectURL(state.url);
Object.assign(state, { uid: "", name: "", size: 0, type: "", status: "", percent: 0, url: "", subUrl: "", response: null, xhr: null });
}
function removeItem() {
if (state.xhr && state.status === "uploading") {
try {
state.xhr.abort();
} catch {
}
}
const uid = state.uid;
reset();
emit("update:fileList", []);
if (uid) emit("delete", uid);
}
return (_ctx, _push, _parent, _attrs) => {
const _component_a_button = Button;
_push(`<div${ssrRenderAttrs(mergeProps({ class: "su" }, _attrs))} data-v-da675b43><div class="su-card" data-v-da675b43>`);
if (state.url) {
_push(`<img${ssrRenderAttr("src", state.url)} alt="preview" class="su-img" data-v-da675b43>`);
} else {
_push(`<!--[--><svg xmlns="http://www.w3.org/2000/svg" class="su-plus" viewBox="0 0 24 24" fill="none" stroke="currentColor" data-v-da675b43><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 5v14m7-7H5" data-v-da675b43></path></svg><div class="su-text" data-v-da675b43>Upload</div><!--]-->`);
}
if (state.status === "uploading") {
_push(`<div class="su-progress" data-v-da675b43><div class="su-bar" style="${ssrRenderStyle({ width: state.percent + "%" })}" data-v-da675b43></div></div>`);
} else {
_push(`<!---->`);
}
_push(`</div>`);
if (state.url) {
_push(`<div class="su-actions" data-v-da675b43>`);
_push(ssrRenderComponent(_component_a_button, {
class: "su-btn",
onClick: removeItem
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`حذف`);
} else {
return [
createTextVNode("حذف")
];
}
}),
_: 1
}, _parent));
_push(ssrRenderComponent(_component_a_button, {
class: "su-btn",
onClick: pick
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`تغییر`);
} else {
return [
createTextVNode("تغییر")
];
}
}),
_: 1
}, _parent));
_push(`</div>`);
} else {
_push(`<!---->`);
}
_push(`<input type="file" accept="image/*" class="su-input" data-v-da675b43></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 = /* @__PURE__ */ Object.assign(_export_sfc(_sfc_main$3, [["__scopeId", "data-v-da675b43"]]), { __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 imageList = 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);
}
function inputImage() {
imageList.value = [];
const img = props.image;
if (!img) return;
if (typeof img === "string") {
if (img.startsWith("http")) {
imageList.value.push({ src: img, thumbUrl: img, status: "done" });
} else {
imageList.value.push({ subUrl: img, status: "done" });
}
return;
}
const path = img.path || img.subUrl;
const url = img.url || img.src || img.thumbUrl;
if (url) {
imageList.value.push({ src: url, thumbUrl: url, status: "done" });
} else if (path) {
imageList.value.push({ subUrl: path, status: "done" });
}
}
watch(imageList, () => {
if (imageList.value[0]?.subUrl) {
emits("success", imageList.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$5, {
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$5, {
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": imageList.value,
"onUpdate:fileList": ($event) => imageList.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": imageList.value,
"onUpdate:fileList": ($event) => imageList.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(config).appName.en,
class: "w-4rem h-4rem rounded-full object-cover"
}, ssrGetDirectiveProps(_ctx, _directive_lazy, { src: unref(config).useDataStorage(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" && unref(config).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" && unref(config).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));
if (unref(config).isSeller && formFields.value.type !== "customer") {
_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));
} else {
_push3(`<!---->`);
}
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" && unref(config).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"]),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 2,
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"])) : createCommentVNode("", true),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 3,
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,
image: formFields.value.avatar,
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(config).appName.en,
class: "w-4rem h-4rem rounded-full object-cover",
onClick: openImageUploader
}, null, 8, ["alt"]), [
[_directive_lazy, { src: unref(config).useDataStorage(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" && unref(config).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"]),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 2,
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"])) : createCommentVNode("", true),
unref(config).isSeller && formFields.value.type !== "customer" ? (openBlock(), createBlock(InstaInput, {
key: 3,
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,
image: formFields.value.avatar,
onSuccess: loadImage
}, null, 8, ["open", "onUpdate:open", "image"])
]),
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 _ };