diff --git a/package-lock.json b/package-lock.json index 575eb1c..28627b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,6 +42,8 @@ "jalaali-js": "^1.2.7", "jalali-moment": "^3.3.11", "jquery": "^3.7.1", + "leaflet": "^1.9.4", + "lodash": "^4.17.21", "moment": "^2.30.1", "multi-range-slider-vue": "^1.1.4", "not": "^0.1.0", @@ -9016,6 +9018,12 @@ "launch-editor": "^2.9.1" } }, + "node_modules/leaflet": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz", + "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==", + "license": "BSD-2-Clause" + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", diff --git a/package.json b/package.json index 28d7cc9..839bc44 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,8 @@ "jalaali-js": "^1.2.7", "jalali-moment": "^3.3.11", "jquery": "^3.7.1", + "leaflet": "^1.9.4", + "lodash": "^4.17.21", "moment": "^2.30.1", "multi-range-slider-vue": "^1.1.4", "not": "^0.1.0", diff --git a/public/index.html b/public/index.html index 8949394..9469d3f 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ - + <%= htmlWebpackPlugin.options.title %> @@ -19,6 +19,16 @@ >
- + + diff --git a/src/assets/images/location.svg b/src/assets/images/location.svg new file mode 100644 index 0000000..e7d644e --- /dev/null +++ b/src/assets/images/location.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/components/customSidebar.vue b/src/components/customSidebar.vue index 3d9420f..3f4e425 100644 --- a/src/components/customSidebar.vue +++ b/src/components/customSidebar.vue @@ -1,5 +1,6 @@ + + + diff --git a/src/components/modals/identity/addIdentity.vue b/src/components/modals/identity/addIdentity.vue index dcb00f4..24bb509 100644 --- a/src/components/modals/identity/addIdentity.vue +++ b/src/components/modals/identity/addIdentity.vue @@ -130,8 +130,7 @@ export default { errors.value = {}; if (!title.value) errors.value.title = "وارد کردن عنوان مشخصه ضروری می باشد"; - if (!selectedCat.value) - errors.value.selectedCat = "انتخاب دسته ضروری می باشد"; + return Object.keys(errors.value).length === 0; }; @@ -140,44 +139,51 @@ export default { }; const addIdentity = () => { - if (!validateForm()) { - toast.error("لطفا فیلد های لازم را وارد نمایید", { - position: "top-right", - autoClose: 1000, - }); - return; - } - loading.value = true; - - const formData = new FormData(); - formData.append("category_id", selectedCat.value); - formData.append("title", title.value); - - ApiServiece.post(`admin/attributes`, formData) - .then((resp) => { - console.log(resp); - toast.success("!مشخصه با موفقیت اضافه شد", { - position: "top-right", - autoClose: 1000, - }); - }) - .then(() => { - setTimeout(() => { - document.getElementById("close").click(); - emit("attribute-updated"); - }, 500); - }) - .catch((error) => { - console.error(error); - toast.error("!اضافه کردن مشخصه با مشکل مواجه شد", { - position: "top-right", - autoClose: 1000, - }); - }) - .finally(() => { - loading.value = false; - }); - }; + if (!validateForm()) { + toast.error("لطفا فیلد های لازم را وارد نمایید", { + position: "top-right", + autoClose: 1000, + }); + return; + } + loading.value = true; + + const formData = new FormData(); + if (selectedCat.value) { + formData.append("category_id", selectedCat.value); + } + formData.append("title", title.value); + + ApiServiece.post(`admin/attributes`, formData) + .then((resp) => { + console.log(resp); + toast.success("!مشخصه با موفقیت اضافه شد", { + position: "top-right", + autoClose: 1000, + }); + + // **Reset form fields** + title.value = ""; + selectedCat.value = null; + }) + .then(() => { + setTimeout(() => { + document.getElementById("close").click(); + emit("identity-updated"); + }, 500); + }) + .catch((error) => { + console.error(error); + toast.error("!اضافه کردن مشخصه با مشکل مواجه شد", { + position: "top-right", + autoClose: 1000, + }); + }) + .finally(() => { + loading.value = false; + }); +}; + return { errors, diff --git a/src/components/modals/identity/editIdentity.vue b/src/components/modals/identity/editIdentity.vue index a79b394..a0037fa 100644 --- a/src/components/modals/identity/editIdentity.vue +++ b/src/components/modals/identity/editIdentity.vue @@ -77,7 +77,7 @@ type="button" class="btn btn-secondary" data-bs-dismiss="modal" - id="close" + id="closeIdentityModal" > بستن @@ -156,7 +156,6 @@ export default { errors.value = {}; if (!localTitle.value) errors.value.localTitle = "وارد کردن عنوان مشخصه ضروری می باشد"; - if (!localCat.value) errors.value.localCat = "انتخاب دسته ضروری می باشد"; return Object.keys(errors.value).length === 0; }; @@ -173,9 +172,10 @@ export default { return; } loading.value = true; - const formData = new FormData(); - formData.append("category_id", localCatId.value); + if (localCatId.value) { + formData.append("category_id", localCatId.value); + } formData.append("title", localTitle.value); ApiServiece.put(`admin/attributes/${localId.value}`, formData) @@ -188,7 +188,7 @@ export default { }) .then(() => { setTimeout(() => { - document.getElementById("close").click(); + document.getElementById("closeIdentityModal").click(); emit("attribute-updated"); }, 500); }) diff --git a/src/router/index.js b/src/router/index.js index cf4368d..cc182de 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -4,7 +4,7 @@ import appConfig from "../../app.config"; import store from "../state/store"; const router = createRouter({ - history: createWebHistory("/vue/"), + history: createWebHistory("/"), routes, }); diff --git a/src/router/routes.js b/src/router/routes.js index 48ae01c..1d21991 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -233,6 +233,15 @@ export default [ }, component: () => import("../views/live-preview/pages/profile/profile.vue"), }, + { + path: "/address", + name: "address", + meta: { + title: "پروفایل", + requiresAuth: true, + }, + component: () => import("../views/live-preview/pages/profile/address.vue"), + }, { path: "/banners", name: "banners", @@ -282,6 +291,15 @@ export default [ }, component: () => import("../views/live-preview/pages/calls/calls.vue"), }, + { + path: "/settings", + name: "settings", + meta: { + title: "تنظیمات", + requiresAuth: true, + }, + component: () => import("../views/live-preview/pages/settings/setting.vue"), + }, { path: "/", name: "live-preview", @@ -333,12 +351,7 @@ export default [ meta: { title: "sampl Page" }, component: () => import("../views/live-preview/other/sample-page.vue"), }, - { - path: "/setting", - name: "setting", - meta: { title: "Setting" }, - component: () => import("../views/live-preview/ui-kit/setting.vue"), - }, + { path: "/application/plans", name: "Apps Plans", diff --git a/src/views/live-preview/pages/auth2/forgot-password.vue b/src/views/live-preview/pages/auth2/forgot-password.vue index 385b7a5..9776678 100644 --- a/src/views/live-preview/pages/auth2/forgot-password.vue +++ b/src/views/live-preview/pages/auth2/forgot-password.vue @@ -1,7 +1,7 @@ + + diff --git a/src/views/live-preview/pages/auth2/otpLogin.vue b/src/views/live-preview/pages/auth2/otpLogin.vue index bb4c77b..4570d21 100644 --- a/src/views/live-preview/pages/auth2/otpLogin.vue +++ b/src/views/live-preview/pages/auth2/otpLogin.vue @@ -1,6 +1,6 @@ +