@opengis/admin
Version:
This project Softpro Admin
79 lines (78 loc) • 2.84 kB
JavaScript
import { _ as n, f as m } from "./import-file-BgK4s__E.js";
import { u as p } from "./user-B_2kh6ic.js";
import { resolveComponent as f, createElementBlock as d, openBlock as u, createElementVNode as o, createBlock as h, createCommentVNode as b } from "vue";
const x = {
data() {
return {
formScheme: null,
formValues: {}
};
},
mounted() {
this.getFormScheme();
},
computed: {
userData() {
return p.value;
}
},
methods: {
async updateUser() {
var r;
try {
await m.put(`/user/${(r = this.userData.user) == null ? void 0 : r.uid}`, this.formValues), await this.$notify({
title: "Успішно!",
message: "Дані успішно оновлені",
type: "success"
});
} catch {
this.$notify({
title: "Помилка!",
message: "Сталася помилка",
type: "error"
});
}
},
async getFormScheme() {
var r, t, a, l;
try {
const { data: e } = await m.get(
"/api/template/form/admin.profile.form"
);
console.log(this.userData);
for (const s in e == null ? void 0 : e.schema)
(t = (r = this.userData) == null ? void 0 : r.user) != null && t[s] && (this.formValues[s] = (l = (a = this.userData) == null ? void 0 : a.user) == null ? void 0 : l[s]);
this.formScheme = e.schema;
} catch (e) {
console.error(e);
}
}
}
}, g = { class: "flex justify-center pt-[20px] pb-[20px] pl-[20px] h-[calc(100vh-58px)]" }, k = { class: "bg-white rounded-xl p-[20px]" }, y = { class: "flex-1 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500" }, w = { class: "flex" };
function _(r, t, a, l, e, s) {
const i = f("VsForm");
return u(), d("div", g, [
o("div", k, [
t[2] || (t[2] = o("h2", { class: "mb-[20px] text-center" }, "Профіль", -1)),
o("div", y, [
e.formScheme ? (u(), h(i, {
key: 0,
scheme: e.formScheme,
modelValue: e.formValues,
"onUpdate:modelValue": t[0] || (t[0] = (c) => e.formValues = c),
class: "pb-0"
}, null, 8, ["scheme", "modelValue"])) : b("", !0),
o("div", w, [
o("button", {
onClick: t[1] || (t[1] = (...c) => s.updateUser && s.updateUser(...c)),
class: "ml-auto text-[18px] bg-blue-500 text-white px-[8px] py-[4px] rounded hover:bg-blue-700 duration-300"
}, " Зберегти ")
])
])
])
]);
}
const D = /* @__PURE__ */ n(x, [["render", _]]);
export {
D as default
};