From e2006e683b5cabe2375ad2d8765be34efb22f0eb Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Sat, 23 Jul 2022 17:44:44 +0200 Subject: [PATCH] Notifications Settings Notifications User Panel --- src/common/shared_vuejs.ts | 81 ++++++++++++++++--- .../CNotifSettings/CNotifSettings.ts | 9 ++- .../CNotifSettings/CNotifSettings.vue | 59 +++++++++++++- src/layouts/menuone/menuOne.ts | 2 +- .../toolbar/notifPopover/notifPopover.scss | 7 +- .../toolbar/notifPopover/notifPopover.ts | 11 ++- .../toolbar/notifPopover/notifPopover.vue | 22 +++-- src/mixins/mixin-users.ts | 19 ++--- src/model/MessageStore.ts | 10 ++- src/model/UserStore.ts | 5 ++ src/rootgen/admin/userPanel/userPanel.ts | 35 ++++++-- src/rootgen/admin/userPanel/userPanel.vue | 10 ++- src/statics/lang/it.js | 24 +++++- src/store/Modules/tools.ts | 29 ++++++- src/store/Modules/toolsext.ts | 1 + src/store/NotifStore.ts | 50 +++++++++--- src/store/UserStore.ts | 10 +++ src/store/globalStore.ts | 13 ++- 18 files changed, 328 insertions(+), 69 deletions(-) diff --git a/src/common/shared_vuejs.ts b/src/common/shared_vuejs.ts index a4ab944a..de90a040 100755 --- a/src/common/shared_vuejs.ts +++ b/src/common/shared_vuejs.ts @@ -850,60 +850,121 @@ export const shared_consts = { }, UsersNotif: { - NEW_ADV_PROVINCE: 1, - NEW_ADV_CITY: 2, - NEW_ADV_MY_GROUPS: 4, - NEW_ADV_MY_RIS_CIRCUIT: 8, + NEW_ADV_CITY: 1, + NEW_ADV_PROVINCE: 2, + NEW_ADV_REGION: 4, + NEW_ADV_MY_GROUPS: 8, + NEW_ADV_MY_RIS_CIRCUIT: 16, + NEW_ADV_SECTOR: 32, }, - typeNotifs: [ + TypeNotifs: { + TYPEDIR_BACHECA: 1, + ID_BACHECA_NEW_GOOD: 1, + ID_BACHECA_NEW_SERVICE: 2, + + TYPEDIR_EVENTS: 2, + ID_EVENTS_NEW_REC: 1, + ID_EVENTS_REMOVE_REC: 2, + + TYPEDIR_FRIENDS: 3, + ID_FRIENDS_NEW_REC: 1, + + TYPEDIR_CIRCUITS: 4, + + TYPEDIR_BOOKING: 5, + + TYPEDIR_MSGS: 6, + ID_MSGS_NEW_REC: 1, + + }, + + + TypeNotifs_Arr: [ { value: 1, // labeltrans: 'typenotifs.new_rec_bacheca', descr: 'typenotifs.new_rec_bacheca_descr', + icon:'fas fa-house-user', + list: [ + { + value: 1, // ID_BACHECA_NEW_GOOD + labeltrans: 'notifsid.bacheca_new_good', + }, + { + value: 2, // ID_BACHECA_NEW_SERVICE + labeltrans: 'notifsid.bacheca_new_service', + } + ], }, { value: 2, // labeltrans: 'typenotifs.events', descr: 'typenotifs.events_descr', + icon:'fas fa-bullhorn', + list: [ + { + value: 1, // ID_EVENTS_NEW_REC + labeltrans: 'notifsid.events_new', + } + ], }, { value: 3, // labeltrans: 'typenotifs.friends', descr: 'typenotifs.friends_descr', + icon:'fas fa-user-plus', + list: [ + { + value: 1, // ID_FRIENDS_NEW_REC + labeltrans: 'notifsid.friends_new', + } + ], }, { value: 4, // labeltrans: 'typenotifs.circuits', descr: 'typenotifs.circuits_descr', + icon:'fas fa-coins', }, { value: 5, // labeltrans: 'typenotifs.booking', descr: '', + icon:'fas fa-book-open', }, ], UsersNotif_Adv_List: [ + /*{ + value: 1, // NEW_ADV_CITY + labeltrans: 'notifs.warn_city', + directory: 1, + },*/ { - value: 1, // NEW_ADV_PROVINCE + value: 2, // NEW_ADV_PROVINCE labeltrans: 'notifs.warn_province', directory: 1, }, { - value: 2, // NEW_ADV_CITY - labeltrans: 'notifs.warn_city', + value: 32, // NEW_ADV_SECTOR + labeltrans: 'notifs.warn_sector', directory: 1, }, { - value: 4, // NEW_ADV_MY_GROUPS + value: 4, // NEW_ADV_PROVINCE + labeltrans: 'notifs.warn_region', + directory: 1, + }, + { + value: 8, // NEW_ADV_MY_GROUPS labeltrans: 'notifs.warn_my_groups', directory: 1, }, { - value: 8, // NEW_ADV_MY_RIS_CIRCUIT + value: 16, // NEW_ADV_MY_RIS_CIRCUIT labeltrans: 'notifs.warn_my_ris_circuit', directory: 1, }, diff --git a/src/components/CNotifSettings/CNotifSettings.ts b/src/components/CNotifSettings/CNotifSettings.ts index 91acb14f..56767ff0 100755 --- a/src/components/CNotifSettings/CNotifSettings.ts +++ b/src/components/CNotifSettings/CNotifSettings.ts @@ -2,13 +2,15 @@ import { defineComponent, onMounted, PropType, ref, watch } from 'vue' import { useQuasar } from 'quasar' import { useI18n } from '@/boot/i18n' import { useGlobalStore } from '@store/globalStore' +import { useUserStore } from '@store/UserStore' import { fieldsTable } from '@store/Modules/fieldsTable' import { tools } from '@store/Modules/tools' import { costanti } from '@costanti' import { shared_consts } from '@/common/shared_vuejs' import { CMyFieldDb } from '@/components/CMyFieldDb' import { CDateTime } from '@/components/CDateTime' - +import { toolsext } from '@src/store/Modules/toolsext' +import { computed } from 'vue' export default defineComponent({ name: 'CNotifSettings', @@ -19,6 +21,9 @@ export default defineComponent({ const $q = useQuasar() const { t } = useI18n() const globalStore = useGlobalStore() + const userStore = useUserStore() + + const profile = computed(() => userStore.my.profile) function mounted() { @@ -34,6 +39,8 @@ export default defineComponent({ shared_consts, fieldsTable, globalStore, + toolsext, + profile, } }, }) diff --git a/src/components/CNotifSettings/CNotifSettings.vue b/src/components/CNotifSettings/CNotifSettings.vue index 6459bdec..160a556d 100755 --- a/src/components/CNotifSettings/CNotifSettings.vue +++ b/src/components/CNotifSettings/CNotifSettings.vue @@ -3,10 +3,10 @@
- @@ -30,6 +30,61 @@ :type="costanti.FieldType.binary"> +
+
+ + + + +
+
+ + +
+
+ + +
+ + + + +
+
diff --git a/src/layouts/menuone/menuOne.ts b/src/layouts/menuone/menuOne.ts index 7f780534..d8f6ee87 100755 --- a/src/layouts/menuone/menuOne.ts +++ b/src/layouts/menuone/menuOne.ts @@ -42,7 +42,7 @@ export default defineComponent({ }) } - watch(() => userStore.isLogged,(to, from) => { + watch(() => userStore.isLogged || finishLoading.value,(to, from) => { myroutes.value = [] myroutes.value = static_data.routes }) diff --git a/src/layouts/toolbar/notifPopover/notifPopover.scss b/src/layouts/toolbar/notifPopover/notifPopover.scss index e6ca7ca0..454bd94b 100755 --- a/src/layouts/toolbar/notifPopover/notifPopover.scss +++ b/src/layouts/toolbar/notifPopover/notifPopover.scss @@ -17,7 +17,12 @@ } .unread { - font-weight: bold; + +} + +.unread-date { + color: royalblue; + font-weight: 600; } .read { diff --git a/src/layouts/toolbar/notifPopover/notifPopover.ts b/src/layouts/toolbar/notifPopover/notifPopover.ts index 8f1f5e31..b81a77e0 100755 --- a/src/layouts/toolbar/notifPopover/notifPopover.ts +++ b/src/layouts/toolbar/notifPopover/notifPopover.ts @@ -5,6 +5,8 @@ import { IMessage, IMsgUsers, INotif, } from '@model' +import { date } from 'quasar' + import { tools } from '@src/store/Modules/tools' import { useRouter } from 'vue-router' @@ -53,7 +55,7 @@ export default defineComponent({ datenotif: new Date() }) - const { getNumNotifUnread, getNumNotif, getUsernameChatByNotif, getImgByNotif, getNotifText, getTypeNotif } = MixinUsers() + const { getNumNotifUnread, getNumNotif, getUsernameChatByNotif, getImgByNotif, getNotifText, getTypeDirNotif, getTypeIdNotif } = MixinUsers() // function lasts_notifs (state: IUserState) => IMessage[] { // @@ -79,8 +81,8 @@ export default defineComponent({ }) function clickNotif(notif: INotif) { - if (notif.link) { - let mylink = tools.updateQueryStringParameter(notif.link, 'idnotif', notif._id) + if (notif.openUrl) { + let mylink = tools.updateQueryStringParameter(notif.openUrl, 'idnotif', notif._id) console.log('mylink', mylink, notif._id) if (mylink) { $router.replace(mylink) @@ -155,7 +157,8 @@ export default defineComponent({ getUsernameChatByNotif, getImgByNotif, getNotifText, - getTypeNotif, + getTypeDirNotif, + getTypeIdNotif, tools, usernotifs, shared_consts, diff --git a/src/layouts/toolbar/notifPopover/notifPopover.vue b/src/layouts/toolbar/notifPopover/notifPopover.vue index 089a8b3f..89fbfe6f 100755 --- a/src/layouts/toolbar/notifPopover/notifPopover.vue +++ b/src/layouts/toolbar/notifPopover/notifPopover.vue @@ -28,6 +28,12 @@ {{ $t('notifs.setallread') }} + + + + + {{ $t('notifs.deleteall') }} +
@@ -65,11 +71,11 @@
- + @@ -79,19 +85,19 @@ - + {{ getNotifText(notif, false) }} - - {{ tools.getstrDateTimeShort(notif.datenotif) }} + + {{ tools.timeAgo(notif.datenotif) }} - + - + @@ -99,7 +105,7 @@ - + {{ $t('notifs.deactivate_notif') }} diff --git a/src/mixins/mixin-users.ts b/src/mixins/mixin-users.ts index ea2b1308..af90d3bf 100755 --- a/src/mixins/mixin-users.ts +++ b/src/mixins/mixin-users.ts @@ -187,15 +187,12 @@ export default function () { return '' } - function getTypeNotif(msg: INotif) { - if (msg) { - if (msg.type) { - return msg.type - } - } else { - return '' - } - return '' + function getTypeDirNotif(msg: INotif) { + return (msg && msg.typedir) ? msg.typedir : 0 + } + + function getTypeIdNotif(msg: INotif) { + return (msg && msg.typeid) ? msg.typeid : 0 } function getImgByNotif(notif: INotif) { @@ -206,7 +203,6 @@ export default function () { } - return { getUsernameChatByMsg, getMyUsername, @@ -232,7 +228,8 @@ export default function () { getNumNotifUnread, getNumNotif, getUsernameChatByNotif, - getTypeNotif, + getTypeDirNotif, + getTypeIdNotif, getImgByNotif, getNotifText, } diff --git a/src/model/MessageStore.ts b/src/model/MessageStore.ts index fb37c771..47e3a867 100755 --- a/src/model/MessageStore.ts +++ b/src/model/MessageStore.ts @@ -53,7 +53,8 @@ export const MsgDefault: IMessage = { export const NotifDefault: INotif = { _id: '', idapp: '', - type: 0, + typedir: 0, + typeid: 0, sender: '', dest: '', descr: '', @@ -80,14 +81,17 @@ export interface IMessage { export interface INotif { _id?: any idapp?: string - type: number + typedir: number + typeid: number sender: string, dest: string, descr: string datenotif?: Date status?: StatusMessage - link?: string + openUrl?: string read?: boolean + tablerec?: string + idrec?: string deleted?: boolean } diff --git a/src/model/UserStore.ts b/src/model/UserStore.ts index f34ec3ae..6f9d78f8 100755 --- a/src/model/UserStore.ts +++ b/src/model/UserStore.ts @@ -86,6 +86,11 @@ export interface IUserProfile { mygroups: IMyGroup[] manage_mygroups: IMyGroup[] notifs: IUserNotifType[] + notif_idCities: number[] + notif_provinces: string[] + notif_regions: string[] + notif_sectors: number[] + notif_sector_goods: number[] // in memory asked_friends: any[] diff --git a/src/rootgen/admin/userPanel/userPanel.ts b/src/rootgen/admin/userPanel/userPanel.ts index b9d61d9d..f1e5a243 100755 --- a/src/rootgen/admin/userPanel/userPanel.ts +++ b/src/rootgen/admin/userPanel/userPanel.ts @@ -1,5 +1,6 @@ import { defineComponent, onMounted, ref } from 'vue' +import { computed } from 'vue' import { CMyPage } from '@/components/CMyPage' import { CCopyBtn } from '@/components/CCopyBtn' import { CKeyAndValue } from '@/components/CKeyAndValue' @@ -31,12 +32,26 @@ export default defineComponent({ const myuser = ref({_id: '', username: '', name: '', surname: '', profile: DefaultProfile}) const risultato = ref('') const mynotif = ref('') - const mylink = ref('') - const notiftype = ref(1) + const notifdirtype = ref(1) + const notifidtype = ref(1) const listnotif = ref([]) + const listnotiftype = ref([]) const { t } = useI18n(); + const listnotifid = computed(() => { + if (notifdirtype.value) { + const mylist: any = shared_consts.TypeNotifs_Arr.find((rec: any) => rec.value === notifdirtype.value) + if (mylist) { + for (const rec of mylist.list) { + rec.label = t(rec.labeltrans) + } + } + + return mylist.list + } + return [] + }) const userStore = useUserStore() const notifStore = useNotifStore() @@ -50,6 +65,12 @@ export default defineComponent({ for (const rec of listnotif.value) { rec.label = t(rec.labeltrans) } + + listnotiftype.value = shared_consts.TypeNotifs_Arr + for (const rec of listnotiftype.value) { + rec.label = t(rec.labeltrans) + } + } function changeCol(newval: any) { @@ -83,11 +104,11 @@ export default defineComponent({ if (!!myuser.value) { const notif: INotif = { - type: notiftype.value, + typedir: notifdirtype.value, + typeid: notifidtype.value, sender: userStore.my.username, dest: myuser.value.username, descr: mynotif.value, - link: mylink.value, } await notifStore.SendNotifEvent(notif) @@ -112,9 +133,11 @@ export default defineComponent({ sendNotifToUser, risultato, mynotif, - mylink, - notiftype, + notifdirtype, + notifidtype, listnotif, + listnotiftype, + listnotifid, } } }) diff --git a/src/rootgen/admin/userPanel/userPanel.vue b/src/rootgen/admin/userPanel/userPanel.vue index 55294813..452639c2 100755 --- a/src/rootgen/admin/userPanel/userPanel.vue +++ b/src/rootgen/admin/userPanel/userPanel.vue @@ -2,16 +2,18 @@ -
- +
+ + + + + -
diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index c1d8f547..e5941a24 100755 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -640,6 +640,8 @@ const msg_it = { title_subscribed: 'Sottoscrizione a {sitename}!', subscribed: 'Ora potrai ricevere i messaggi e le notifiche.', newVersionAvailable: 'Aggiorna', + provinces: 'Province', + cities: 'Comuni', }, connection: { conn: 'Connessione', @@ -750,18 +752,23 @@ const msg_it = { notread: 'Non lette', settings: 'Configura Notifiche', setallread: 'Segna tutte come già lette', + deleteall: 'Cancella tutte le notifiche', telegrammsg: 'Telegram', notif: 'Notifica', notifs: 'Notifiche', nonotif: 'Nessuna Nuova Notifica', - warn_province: 'in Provincia', - warn_city: 'in Città', - warn_my_groups: 'miei Gruppi', - warn_my_ris_circuit: 'miei Circuiti', + warn_province: 'nelle Province', + warn_sector: 'in un Settore', + warn_region: 'nelle Regioni', + warn_city: 'in una Città selezionata', + warn_my_groups: 'nei miei Gruppi', + warn_my_ris_circuit: 'nei miei Circuiti', new_event: 'Nuovo Evento', new_friends: 'Nuove Richieste di Amicizia', delete_notif: 'Elimina questa notifica', deactivate_notif: 'Smetti di ricevere notifiche come questa', + select_provinces: 'Scegli le Provincie da cui ricevere le notifiche', + select_regions: 'Scegli le Regioni da cui ricevere le notifiche', }, typenotifs: { new_rec_bacheca: 'Annunci', @@ -774,6 +781,12 @@ const msg_it = { circuits_descr: 'Avvisami:', booking: 'Prenotazioni', }, + notifsid: { + bacheca_new_good: 'Nuovo Bene', + bacheca_new_service: 'Nuovo Servizio', + events_new: 'Nuovo Evento', + friends_new: 'Nuova Richiesta di Amicizia', + }, event: { _id: 'id', typol: 'Typology', @@ -919,6 +932,8 @@ const msg_it = { }, sectors: { name: 'Settore', + sector_general: 'Settori', + sector_goods: 'Settori dei Beni', }, catgrps: { name: 'Categoria', @@ -1003,6 +1018,7 @@ const msg_it = { city: { prov: 'Provincia', reg: 'Regione', + regs: 'Regioni', link_grp: 'Link Territoriale', }, annunci: { diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index e9ee4dfe..6f8be7f2 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -1749,6 +1749,7 @@ export const tools = { if (elem.meta && elem.meta.requiresAuth) { visu = visu && this.isLoggedToSystem() } + // console.log('MENU visu', elem.path, visu) return visu }, @@ -4003,7 +4004,7 @@ export const tools = { let ris = true const online = this.getValDb('SITO_ONLINE', false, true) ris = userStore.isAdmin && !pertutti ? true : online - // console.log('isadmin', userStore.isAdmin) + console.log('sito_online', ris) return ris }, @@ -5537,7 +5538,7 @@ export const tools = { }, getvalueAll(myval: string | Date) { - const mydate = new Date(myval); + const mydate = new Date(myval) if (mydate instanceof Date && !isNaN(mydate.valueOf())) { return this.getstrDateTime(mydate) } else { @@ -5556,6 +5557,30 @@ export const tools = { } }, + timeAgo(input: any) { + const date = (input instanceof Date) ? input : new Date(input) + const formatter = new Intl.RelativeTimeFormat(toolsext.getLocale() || 'it') + const ranges: any = { + years: 3600 * 24 * 365, + months: 3600 * 24 * 30, + weeks: 3600 * 24 * 7, + days: 3600 * 24, + hours: 3600, + minutes: 60, + seconds: 1 + } + const secondsElapsed = (date.getTime() - Date.now()) / 1000 + let key: any + for (key in ranges) { + if (ranges[key] < Math.abs(secondsElapsed)) { + // @ts-ignore + const delta = secondsElapsed / ranges[key] + // @ts-ignore + return formatter.format(Math.round(delta), key) + } + } + }, + // getLocale() { // if (navigator.languages && navigator.languages.length > 0) { diff --git a/src/store/Modules/toolsext.ts b/src/store/Modules/toolsext.ts index 2b2c7179..9baee52c 100755 --- a/src/store/Modules/toolsext.ts +++ b/src/store/Modules/toolsext.ts @@ -63,6 +63,7 @@ export const toolsext = { TABMYGROUPS: 'mygroups', TABSKILLS: 'skills', TABSECTORS: 'sectors', + TABSECTORGOODS: 'sectorgoods', TABREGIONS: 'regions', TABCITIES: 'cities', TABPROVINCE: 'provinces', diff --git a/src/store/NotifStore.ts b/src/store/NotifStore.ts index 318ed2fa..1ba876bf 100755 --- a/src/store/NotifStore.ts +++ b/src/store/NotifStore.ts @@ -18,7 +18,7 @@ export const useNotifStore = defineStore('NotifStore', { getters: { getlasts_notifs: (mystate: INotifState) => (): INotif[] => { - const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 5).filter((rec) => mystate.show_all ? true : !rec.read) : [] + const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 10).filter((rec) => mystate.show_all ? true : !rec.read) : [] // const ctrec = (mystate.notifs) ? mystate.notifs.slice().reverse().slice(0, 5) : [] return (ctrec) @@ -33,7 +33,7 @@ export const useNotifStore = defineStore('NotifStore', { actions: { setNotif(notif: INotif) { - // console.log('arrnotif', arrnotif) + console.log('setNotif', notif) if (notif) { this.last_notifs = [notif, ...this.last_notifs] } @@ -61,15 +61,42 @@ export const useNotifStore = defineStore('NotifStore', { console.error(error) return false }) + }, + + deleteRec(username: string, id: string) { + return Api.SendReq(`/sendnotif/del/${username}/${id}/${process.env.APP_ID}`, 'GET', null) + .then((res) => { + // console.log('res', res) + if (res) { + this.last_notifs = this.last_notifs.filter((rec) => rec._id !== id) + } + + }) + .catch((error) => { + console.error(error) + return false + }) }, - deleteRec(id: string) { + deleteAll(username: string, id: string) { + return Api.SendReq(`/sendnotif/delall/${username}/${process.env.APP_ID}`, 'GET', null) + .then((res) => { + // console.log('res', res) + if (res) { + this.last_notifs = [] + } + + }) + .catch((error) => { + console.error(error) + return false + }) }, deactivateRec(id: string) { - + return '' }, async updateNotifDataFromServer({ username, lastdataread }: {username: string, lastdataread: Date}) { @@ -94,14 +121,17 @@ export const useNotifStore = defineStore('NotifStore', { async SendNotifEvent(notif: INotif) { console.log('SendNotifEvent', notif) + const userStore = useUserStore() + + const data: INotif = { ...NotifDefault, ...notif } data.idapp = process.env.APP_ID - data.type = notif.type + data.typedir = notif.typedir + data.typeid = notif.typeid data.sender = notif.sender data.dest = notif.dest data.descr = notif.descr - data.link = notif.link data.datenotif = tools.getDateNow() data.read = false @@ -110,10 +140,12 @@ export const useNotifStore = defineStore('NotifStore', { return Api.SendReq('/sendnotif', 'POST', data) .then((res) => { - // console.log('res', res) + console.log('res', res) if (res.status === 200) { - if (res.data.code === serv_constants.RIS_CODE_OK) { - this.setNotif(res.data) + if (res.data.code === serv_constants.RIS_CODE_OK && res.data.record) { + if (res.data.record.dest === userStore.my.username) { + this.setNotif(res.data.record) + } return true } } diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts index ca81bdcc..e2fecc46 100755 --- a/src/store/UserStore.ts +++ b/src/store/UserStore.ts @@ -55,6 +55,11 @@ export const DefaultUser: IUserFields = { asked_friends: [], asked_groups: [], notifs: [], + notif_idCities: [], + notif_provinces: [], + notif_regions: [], + notif_sectors: [], + notif_sector_goods: [], }, cart: { userId: '', @@ -101,6 +106,11 @@ export const DefaultProfile: IUserProfile = { asked_friends: [], asked_groups: [], notifs: [], + notif_idCities: [], + notif_provinces: [], + notif_regions: [], + notif_sectors: [], + notif_sector_goods: [], } export const useUserStore = defineStore('UserStore', { diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts index 72e8b749..53cdb5f9 100644 --- a/src/store/globalStore.ts +++ b/src/store/globalStore.ts @@ -338,13 +338,14 @@ export const useGlobalStore = defineStore('GlobalStore', { }, addDynamicPages($router: Router | null) { + // console.log('this.mypage', this.mypage) // console.log('addDynamicPages') const arrpagesroute: IListRoutes[] = [] for (const page of this.mypage) { if (page.active) { - // console.log('page', page.lang) if (this.isMyLang(page)) { + // console.log('page.active', page.title) // console.log('page', page.title, 'OK') arrpagesroute.push({ active: true, @@ -416,17 +417,21 @@ export const useGlobalStore = defineStore('GlobalStore', { if ($router) { if (tools.sito_online(false)) { + // console.log('SITO ONLINE', arrpagesroute) arrpagesroute.forEach(function (route: any) { $router.addRoute(route) }) $router.addRoute(last) } else { + // console.log('SITO OFFLINE') $router.addRoute(sito_offline) $router.addRoute(last) $router.replace('/sito_offline') } + // console.log('getRoutes', $router.getRoutes()) + const mypathsel = $router.currentRoute.value.fullPath if (mypathsel !== '/') { // console.log('mypathsel', mypathsel) @@ -898,6 +903,7 @@ export const useGlobalStore = defineStore('GlobalStore', { if (res) { const index = this.mypage.findIndex((rec) => rec.path === path) if (index >= 0) { + console.log('load page', path, '...') this.mypage[index] = res.data.mypage } return res.data.mypage @@ -1360,8 +1366,9 @@ export const useGlobalStore = defineStore('GlobalStore', { if (showall) { this.newstosent = (res.data.newstosent) ? [...res.data.newstosent] : [] this.mailinglist = (res.data.mailinglist) ? [...res.data.mailinglist] : [] - this.mypage = (res.data.mypage) ? [...res.data.mypage] : [] } + this.mypage = (res.data.mypage) ? [...res.data.mypage] : [] + console.log('this.mypage', this.mypage) let isLogged = false @@ -1592,7 +1599,7 @@ export const useGlobalStore = defineStore('GlobalStore', { else if (table === toolsext.TABLOCACCOM) myarr = shared_consts.LocationAccom else if (table === toolsext.TABPREF) myarr = shared_consts.Preferences else if (table === 'usernotifs') myarr = shared_consts.UsersNotif_Adv_List - else if (table === 'typenotifs') myarr = shared_consts.typeNotifs + else if (table === 'typenotifs') myarr = shared_consts.TypeNotifs_Arr else myarr = this.getListByTable(table) if (costanti.TABLES_ARRAY.includes(table)) {