{{ $t('balance') }}
@@ -95,9 +95,16 @@
@@ -57,31 +57,30 @@ async function onLogin() {
/>
-
-
-
-
- {{ $t(`langs.${lang}`) }}
-
-
-
-
+
+
+
+
+
+
+ {{ $t(`langs.${lang}`) }}
+
+
+
+
+
({ left: 0, top: 0 }),
@@ -34,18 +35,18 @@ export default route(function (/* { store, ssrContext } */) {
history: createHistory(
process.env.MODE === 'ssr' ? void 0 : process.env.VUE_ROUTER_BASE
)
- })
+ });
Router.afterEach((to, from) => {
- if (from.name === to.name) return
- const app = appStore()
+ if (from.name === to.name) return;
+ const app = useAppStore();
app.$patch({
- title: window.i18n.t(to.name || 'home'),
+ title: i18n.global.t(to.name || 'home'),
subtitle: null,
useRightDrawer: false,
rightDrawerOpen: true
- })
- })
+ });
+ });
- return Router
-})
+ return Router;
+});
diff --git a/src/router/routes.js b/src/router/routes.js
index 4be3a3ea..71112809 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -4,7 +4,7 @@ const routes = [
component: () => import('layouts/LoginLayout.vue'),
children: [
{
- name: 'Login',
+ name: 'login',
path: '/login/:email?',
component: () => import('pages/Login/LoginView.vue')
},
@@ -35,19 +35,9 @@ const routes = [
component: () => import('src/pages/Cms/HomeView.vue')
},
{
- name: 'orders',
+ name: 'confirmedOrders',
path: '/ecomerce/orders',
- component: () => import('pages/Ecomerce/Orders.vue')
- },
- {
- name: 'ticket',
- path: '/ecomerce/ticket/:id',
- component: () => import('pages/Ecomerce/Ticket.vue')
- },
- {
- name: 'invoices',
- path: '/ecomerce/invoices',
- component: () => import('pages/Ecomerce/Invoices.vue')
+ component: () => import('src/pages/Ecomerce/Orders.vue')
},
{
name: 'catalog',
@@ -55,24 +45,59 @@ const routes = [
component: () => import('pages/Ecomerce/Catalog.vue')
},
{
- name: 'packages',
+ name: 'agencyPackages',
path: '/agencies/packages',
component: () => import('src/pages/Agencies/PackagesView.vue')
},
{
- name: 'Account',
+ name: 'accountConfig',
path: '/account/conf',
component: () => import('pages/Account/AccountConfig.vue')
},
{
- name: 'AddressesList',
+ name: 'addressesList',
path: '/account/address-list',
component: () => import('pages/Account/AddressList.vue')
},
{
- name: 'AddressDetails',
+ name: 'addressDetails',
path: '/account/address/:id?',
component: () => import('pages/Account/AddressDetails.vue')
+ },
+ {
+ name: 'controlPanel',
+ path: 'admin/links',
+ component: () => import('pages/Admin/LinksView.vue')
+ },
+ {
+ name: 'adminUsers',
+ path: 'admin/users',
+ component: () => import('pages/Admin/UsersView.vue')
+ },
+ {
+ name: 'adminConnections',
+ path: 'admin/connections',
+ component: () => import('pages/Admin/ConnectionsView.vue')
+ },
+ {
+ name: 'adminVisits',
+ path: 'admin/visits'
+ // component: () => import('pages/Admin/VisitsView.vue')
+ },
+ {
+ name: 'adminNews',
+ path: 'admin/news'
+ // component: () => import('pages/Admin/NewsView.vue')
+ },
+ {
+ name: 'adminPhotos',
+ path: 'admin/photos'
+ // component: () => import('pages/Admin/PhotosView.vue')
+ },
+ {
+ name: 'adminItems',
+ path: 'admin/items'
+ // component: () => import('pages/Admin/ItemsView.vue')
}
]
},
diff --git a/src/stores/app.js b/src/stores/app.js
index 95aa70a7..53be4e73 100644
--- a/src/stores/app.js
+++ b/src/stores/app.js
@@ -1,19 +1,46 @@
-import { defineStore } from 'pinia'
-import { jApi } from 'boot/axios'
+import { defineStore } from 'pinia';
+import { jApi } from 'boot/axios';
-export const appStore = defineStore('hedera', {
+export const useAppStore = defineStore('hedera', {
state: () => ({
title: null,
subtitle: null,
imageUrl: '',
useRightDrawer: false,
- rightDrawerOpen: false
+ rightDrawerOpen: false,
+ isHeaderMounted: false,
+ menuEssentialLinks: []
}),
actions: {
- async loadConfig () {
- const imageUrl = await jApi.getValue('SELECT url FROM imageConfig')
- this.$patch({ imageUrl })
+ async getMenuLinks() {
+ const sections = await jApi.query('SELECT * FROM myMenu');
+ const sectionMap = new Map();
+ for (const section of sections) {
+ sectionMap.set(section.id, section);
+ }
+
+ const sectionTree = [];
+ for (const section of sections) {
+ const parent = section.parentFk;
+ if (parent) {
+ const parentSection = sectionMap.get(parent);
+ if (!parentSection) continue;
+ let childs = parentSection.childs;
+ if (!childs) {
+ childs = parentSection.childs = [];
+ }
+ childs.push(section);
+ } else {
+ sectionTree.push(section);
+ }
+ }
+
+ this.menuEssentialLinks = sectionTree;
+ },
+ async loadConfig() {
+ const imageUrl = await jApi.getValue('SELECT url FROM imageConfig');
+ this.$patch({ imageUrl });
}
}
-})
+});
diff --git a/src/stores/index.js b/src/stores/index.js
index 94cce71e..d718b663 100644
--- a/src/stores/index.js
+++ b/src/stores/index.js
@@ -1,5 +1,5 @@
-import { store } from 'quasar/wrappers'
-import { createPinia } from 'pinia'
+import { store } from 'quasar/wrappers';
+import { createPinia } from 'pinia';
/*
* If not building with SSR mode, you can
@@ -11,10 +11,10 @@ import { createPinia } from 'pinia'
*/
export default store((/* { ssrContext } */) => {
- const pinia = createPinia()
+ const pinia = createPinia();
// You can add Pinia plugins here
// pinia.use(SomePiniaPlugin)
- return pinia
-})
+ return pinia;
+});
diff --git a/src/stores/user.js b/src/stores/user.js
index e90123bf..c7df4d12 100644
--- a/src/stores/user.js
+++ b/src/stores/user.js
@@ -1,7 +1,7 @@
import { defineStore } from 'pinia';
import { api, jApi } from 'boot/axios';
-export const userStore = defineStore('user', {
+export const useUserStore = defineStore('user', {
state: () => {
const token =
sessionStorage.getItem('vnToken') ||
@@ -9,10 +9,9 @@ export const userStore = defineStore('user', {
return {
token,
- id: null,
- name: null,
- nickname: null,
- isGuest: false
+ isGuest: false,
+ user: null,
+ supplantedUser: null
};
},
@@ -21,6 +20,11 @@ export const userStore = defineStore('user', {
},
actions: {
+ async getToken() {
+ this.token =
+ sessionStorage.getItem('vnToken') ||
+ localStorage.getItem('vnToken');
+ },
async login(user, password, remember) {
const params = { user, password };
const res = await api.post('Accounts/login', params);
@@ -36,7 +40,6 @@ export const userStore = defineStore('user', {
name: user
});
},
-
async logout() {
if (this.token != null) {
try {
@@ -48,16 +51,38 @@ export const userStore = defineStore('user', {
this.$reset();
},
- async loadData() {
- const userData = await jApi.getObject(
- 'SELECT id, nickname, name FROM account.myUser'
- );
+ async fetchUser(userType = 'user') {
+ try {
+ const userData = await jApi.getObject(
+ 'SELECT id, nickname, name FROM account.myUser'
+ );
+ this.$patch({ [userType]: userData });
+ } catch (error) {
+ console.error('Error fetching user: ', error);
+ }
+ },
- this.$patch({
- id: userData.id,
- nickname: userData.nickname,
- name: userData.name
+ async supplantUser(supplantUser) {
+ const json = await jApi.send('client/supplant', {
+ supplantUser
});
+ this.token = json;
+ sessionStorage.setItem('supplantUser', supplantUser);
+ await this.fetchUser('supplantedUser');
+ },
+
+ async supplantInit() {
+ const user = sessionStorage.getItem('supplantUser');
+ if (user == null) return;
+ await this.supplantUser(user);
+ },
+
+ async logoutSupplantedUser() {
+ sessionStorage.removeItem('supplantUser');
+ this.supplantedUser = null;
+ await api.post('Accounts/logout');
+ this.getToken();
+ await this.fetchUser();
}
}
});