+
{{ $t('notifs.nonotif') }}
@@ -52,30 +65,50 @@
-
+
-
+
-
- {{ getUsernameChatByNotif(notif) }}
+
+
+
+
+
+
+
+ {{ getNotifText(notif, false) }}
- {{ getNotifText(notif, false) }}
+ {{ tools.getstrDateTimeShort(notif.datenotif) }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ $t('notifs.delete_notif') }}
+
+
+
+
+
+ {{ $t('notifs.deactivate_notif') }}
+
+
+
+
-
- {{ tools.getstrDateTimeShort(notif.datenotif) }}
-
@@ -86,3 +119,6 @@
+
diff --git a/src/mixins/mixin-base.ts b/src/mixins/mixin-base.ts
index c3c2597c..705d3ab5 100755
--- a/src/mixins/mixin-base.ts
+++ b/src/mixins/mixin-base.ts
@@ -8,7 +8,7 @@ import MixinMetaTags from '@src/mixins/mixin-metatags'
import { useUserStore } from '@store/UserStore'
import { useGlobalStore } from '@store/globalStore'
import { useQuasar } from 'quasar'
-import { IDataPass } from '@model'
+import { IDataPass, ISpecialField } from '@model'
import { tools } from '../store/Modules/tools'
import { costanti } from '@costanti'
import { fieldsTable } from '@store/Modules/fieldsTable'
@@ -28,9 +28,9 @@ export default function () {
return fieldsTable
}
- function getValDb(keystr: string, serv: boolean, def?: any, table?: string, subkey?: any, id?: any, idmain?: any, indrec?: number, subsubkey?: string) {
+ function getValDb(keystr: string, serv: boolean, def?: any, table?: string, subkey?: any, id?: any, idmain?: any, indrec?: number, subsubkey?: string, specialField?: ISpecialField) {
// console.log('getValDb')
- return toolsext.getValDb(keystr, serv, def, table, subkey, id, idmain, indrec, subsubkey)
+ return toolsext.getValDb(keystr, serv, def, table, subkey, id, idmain, indrec, subsubkey, specialField)
}
@@ -40,12 +40,12 @@ export default function () {
return ris
}
- async function setValDb($q: any, key: string, value: any, type: any, serv: boolean, table?: string, subkey?: string, id?: any, indrec?: number, subsubkey?: string) {
+ async function setValDb($q: any, key: string, value: any, type: any, serv: boolean, table?: string, subkey?: string, id?: any, indrec?: number, subsubkey?: string, specialField?: ISpecialField) {
const userStore = useUserStore()
const globalStore = useGlobalStore()
const { t } = useI18n()
- console.log('setValDb', key, value, serv, table, subkey, indrec, subsubkey, indrec, subsubkey)
+ // console.log('setValDb', key, value, serv, table, subkey, indrec, subsubkey, specialField)
let mydatatosave: IDataPass | null = null
if (table === 'users') {
@@ -55,24 +55,51 @@ export default function () {
if (key === 'profile') {
- if (subsubkey && indrec) {
+ if (subsubkey && !!indrec && indrec >= 0) {
// @ts-ignore
userStore.my.profile[subkey][indrec][subsubkey] = value
- }else {
- // @ts-ignore
- userStore.my.profile[subkey] = value
+
+ } else {
+
+ if (!!specialField && subkey) {
+ // @ts-ignore
+ const myrec = userStore.my.profile[subkey].filter(specialField.findsubkey)
+ if (myrec && tools.isArray(myrec) && myrec.length > 0 && !!specialField.paramtosetsubkey) {
+ myrec[0][specialField.paramtosetsubkey] = value
+ // console.log('myrec[specialField.paramtosetsubkey]', myrec[0][specialField.paramtosetsubkey], myrec)
+ // @ts-ignore
+ } else {
+ //let mynewrec = tools.getDefaultRecByTableAndSpecialField(table, specialField)
+ // @ts-ignore
+ let mynewrec = specialField.defaultnewrec
+ // @ts-ignore
+ mynewrec[specialField.paramtosetsubkey] = value
+ // console.log('mynewrec', mynewrec)
+ // @ts-ignore
+ userStore.my.profile[subkey].push(mynewrec)
+ }
+
+ // @ts-ignore
+ // console.log('saved', userStore.my.profile[subkey])
+ } else {
+ // @ts-ignore
+ userStore.my.profile[subkey] = value
+ }
}
+
+ // Save to the DB:
+ // @ts-ignore
+ myfield[`${key}.${subkey}`] = userStore.my.profile[subkey]
+
} else {
+ // Save to the DB:
+ myfield[key] = value
+
// @ts-ignore
userStore.my[key] = value
}
// Save to the DB:
- if (subkey) {
- myfield[`${key}.${subkey}`] = value
- } else {
- myfield[key] = value
- }
// console.log('myfield', myfield)
@@ -102,7 +129,7 @@ export default function () {
globalStore.setValueSettingsByKey({ key, value, serv })
let myrec = globalStore.getrecSettingsByKey(key, serv)
- console.log('settings... myrec ', myrec, 'key=', key, 'serv', serv)
+ // console.log('settings... myrec ', myrec, 'key=', key, 'serv', serv)
if (myrec === undefined) {
myrec = {
idapp: process.env.APP_ID,
@@ -128,7 +155,7 @@ export default function () {
},
)
}
- console.log('myrec', myrec)
+ // console.log('myrec', myrec)
mydatatosave = {
// @ts-ignore
diff --git a/src/mixins/mixin-users.ts b/src/mixins/mixin-users.ts
index 89435c74..ea2b1308 100755
--- a/src/mixins/mixin-users.ts
+++ b/src/mixins/mixin-users.ts
@@ -1,5 +1,6 @@
import { IMessage, INotif } from '@src/model'
import { useUserStore } from '@store/UserStore'
+import { useNotifStore } from '@store/NotifStore'
import { useGlobalStore } from '@store/globalStore'
import { useProducts } from '@store/Products'
import { serv_constants } from '@store/Modules/serv_constants'
@@ -161,19 +162,18 @@ export default function () {
}
function getNumNotif() {
- // ++Todo: conv
- /*
- return NotifStore.getlasts_messages().length
- */
+ const notifStore = useNotifStore()
+ const mynotifs = notifStore.getlasts_notifs
+ if (!!mynotifs)
+ return mynotifs.length
return 0
}
function getNumNotifUnread() {
- // return userStore.getlasts_messages().length
- // ++Todo: conv
- // return NotifStore.getnumMsgUnread()
- return 0
+ const notifStore = useNotifStore()
+
+ return notifStore.getnumNotifUnread
}
function getUsernameChatByNotif(msg: INotif) {
@@ -198,13 +198,11 @@ export default function () {
return ''
}
- function getImgByNotif(msg: INotif) {
+ function getImgByNotif(notif: INotif) {
const userStore = useUserStore()
+ const notifStore = useNotifStore()
- //++Todo: Notif
- return ''
- // @ts-ignore
- // return `${userStore.getImgByUsername(this.getUsernameChatByMsg(msg))}`
+ return `${userStore.getImgByUsername(notif.sender)}`
}
diff --git a/src/model/GlobalStore.ts b/src/model/GlobalStore.ts
index 7e7ff9b5..7b4d1d14 100755
--- a/src/model/GlobalStore.ts
+++ b/src/model/GlobalStore.ts
@@ -540,6 +540,13 @@ export interface IParamsQuery {
extrapar?: string
}
+export interface ISpecialField {
+ findsubkey?: any
+ paramtosetsubkey?: any
+ paramdef?: any
+ defaultnewrec?: object
+}
+
export interface IColGridTable {
name: string
subfield?: string
diff --git a/src/model/MessageStore.ts b/src/model/MessageStore.ts
index 3de9e167..fb37c771 100755
--- a/src/model/MessageStore.ts
+++ b/src/model/MessageStore.ts
@@ -86,6 +86,7 @@ export interface INotif {
descr: string
datenotif?: Date
status?: StatusMessage
+ link?: string
read?: boolean
deleted?: boolean
}
@@ -108,4 +109,5 @@ export interface IMessageState {
export interface INotifState {
last_notifs: INotif[]
+ show_all: boolean
}
diff --git a/src/model/UserStore.ts b/src/model/UserStore.ts
index 41da6124..f34ec3ae 100755
--- a/src/model/UserStore.ts
+++ b/src/model/UserStore.ts
@@ -35,6 +35,13 @@ export interface ICalcStat {
numByTab: {}
}
+export interface IUserNotifType {
+ _id: number
+ dir: number
+ value: number
+}
+
+
export interface IUserProfile {
img?: string
nationality?: string
@@ -78,7 +85,7 @@ export interface IUserProfile {
req_friends: IFriends[]
mygroups: IMyGroup[]
manage_mygroups: IMyGroup[]
- notifs: number
+ notifs: IUserNotifType[]
// in memory
asked_friends: any[]
diff --git a/src/rootgen/admin/userPanel/userPanel.ts b/src/rootgen/admin/userPanel/userPanel.ts
index 8023d102..b9d61d9d 100755
--- a/src/rootgen/admin/userPanel/userPanel.ts
+++ b/src/rootgen/admin/userPanel/userPanel.ts
@@ -9,9 +9,13 @@ import { static_data } from '@/db/static_data'
import { fieldsTable } from '@src/store/Modules/fieldsTable'
import { shared_consts } from '@/common/shared_vuejs'
-import { useUserStore } from '@store/UserStore'
+import { DefaultProfile, useUserStore } from '@store/UserStore'
import { costanti } from '@costanti'
import { useQuasar } from 'quasar'
+import { useNotifStore } from '@store/NotifStore'
+import { INotif } from 'model'
+import { IUserFields } from '@model/UserStore'
+import { useI18n } from '@/boot/i18n'
export default defineComponent({
name: 'userPanel',
@@ -24,15 +28,28 @@ export default defineComponent({
const search = ref('')
const colVisib = ref('')
const mycolumns = ref([])
- const myuser = ref({})
+ const myuser = ref({_id: '', username: '', name: '', surname: '', profile: DefaultProfile})
const risultato = ref('')
+ const mynotif = ref('')
+ const mylink = ref('')
+ const notiftype = ref(1)
+
+ const listnotif = ref([])
+ const { t } = useI18n();
+
const userStore = useUserStore()
+ const notifStore = useNotifStore()
async function mounted() {
//
search.value = tools.getCookie(tools.COOK_SEARCH + 'searchpanel')
await refresh()
+
+ listnotif.value = shared_consts.UsersNotif_Adv_List
+ for (const rec of listnotif.value) {
+ rec.label = t(rec.labeltrans)
+ }
}
function changeCol(newval: any) {
@@ -43,7 +60,7 @@ export default defineComponent({
if (!!search.value)
myuser.value = await userStore.loadUserPanel(search.value)
else
- myuser.value = {}
+ myuser.value = {_id: '', username: '', name: '', surname: '', profile: DefaultProfile}
}
@@ -62,6 +79,21 @@ export default defineComponent({
tools.copyStringToClipboard($q, risultato.value, false)
}
+ async function sendNotifToUser() {
+
+ if (!!myuser.value) {
+ const notif: INotif = {
+ type: notiftype.value,
+ sender: userStore.my.username,
+ dest: myuser.value.username,
+ descr: mynotif.value,
+ link: mylink.value,
+ }
+ await notifStore.SendNotifEvent(notif)
+
+ }
+ }
+
onMounted(mounted)
return {
@@ -69,6 +101,7 @@ export default defineComponent({
fieldsTable,
search,
tools,
+ shared_consts,
doSearch,
changeCol,
myuser,
@@ -76,7 +109,12 @@ export default defineComponent({
mycolumns,
colVisib,
exportListaEmail,
+ sendNotifToUser,
risultato,
+ mynotif,
+ mylink,
+ notiftype,
+ listnotif,
}
}
})
diff --git a/src/rootgen/admin/userPanel/userPanel.vue b/src/rootgen/admin/userPanel/userPanel.vue
index 79e29d5d..55294813 100755
--- a/src/rootgen/admin/userPanel/userPanel.vue
+++ b/src/rootgen/admin/userPanel/userPanel.vue
@@ -2,7 +2,19 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js
index bd714e75..c1d8f547 100755
--- a/src/statics/lang/it.js
+++ b/src/statics/lang/it.js
@@ -746,14 +746,33 @@ const msg_it = {
nomessage: 'Nessun Messaggio',
},
notifs: {
+ all: 'Tutte',
+ notread: 'Non lette',
+ settings: 'Configura Notifiche',
+ setallread: 'Segna tutte come già lette',
telegrammsg: 'Telegram',
notif: 'Notifica',
notifs: 'Notifiche',
- nonotif: 'Nessuna Notifica',
+ nonotif: 'Nessuna Nuova Notifica',
warn_province: 'in Provincia',
warn_city: 'in Città ',
warn_my_groups: 'miei Gruppi',
warn_my_ris_circuit: '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',
+ },
+ typenotifs: {
+ new_rec_bacheca: 'Annunci',
+ new_rec_bacheca_descr: 'Avvisami se vengono aggiunti nuovi Annunci',
+ friends: 'Richieste di Amicizia',
+ friends_descr: 'Avvisami se:',
+ events: 'Eventi',
+ events_descr: 'Avvisami se vengono aggiunti nuovi Eventi',
+ circuits: 'Circuiti',
+ circuits_descr: 'Avvisami:',
+ booking: 'Prenotazioni',
},
event: {
_id: 'id',
diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts
index e5afcbf0..6b9be451 100755
--- a/src/store/Modules/costanti.ts
+++ b/src/store/Modules/costanti.ts
@@ -265,6 +265,7 @@ export const costanti = {
username_chip: 12000,
link: 12500,
listobj: 13000,
+
},
FieldTypeArr: [
@@ -276,6 +277,11 @@ export const costanti = {
{ label: 'Select', value: 32 },
{ label: 'Number', value: 64 },
{ label: 'crypted', value: 9000 },
+ { label: 'object', value: 10000 },
+ { label: 'separator', value: 11000 },
+ { label: 'username_chip', value: 12000 },
+ { label: 'link', value: 12500 },
+ { label: 'listobj', value: 13000 },
],
TipoVisu: {
diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts
index 36cf9ab9..1066bf98 100755
--- a/src/store/Modules/fieldsTable.ts
+++ b/src/store/Modules/fieldsTable.ts
@@ -1598,6 +1598,11 @@ const colTableGeneric = [
AddCol({ name: 'label', label_trans: 'proj.longdescr' }),
]
+const colTableGenTrans = [
+ AddCol({ name: 'value', label_trans: 'others.value' }),
+ AddCol({ name: 'labeltrans', label_trans: 'proj.longdescr' }),
+]
+
export const colTableOperator = [
AddCol({ name: 'username', label_trans: 'reg.username_short' }),
AddCol({ name: 'name', label_trans: 'reg.name' }),
@@ -2710,9 +2715,18 @@ export const fieldsTable = {
{
value: 'usernotifs',
label: 'Notifiche',
- columns: colTableGeneric,
+ columns: colTableGenTrans,
colkey: 'value',
- collabel: 'label',
+ collabel: 'labeltrans',
+ colicon: 'icon',
+ noshow: true,
+ },
+ {
+ value: 'typenotifs',
+ label: 'Tipi di Notifiche',
+ columns: colTableGenTrans,
+ colkey: 'value',
+ collabel: 'labeltrans',
colicon: 'icon',
noshow: true,
},
diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts
index 6623d294..e9ee4dfe 100644
--- a/src/store/Modules/tools.ts
+++ b/src/store/Modules/tools.ts
@@ -12,7 +12,7 @@ import {
ITodo,
IUserFields,
Privacy,
- TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport,
+ TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField,
} from '@model'
import { addToDate } from '@quasar/quasar-ui-qcalendar'
@@ -3527,7 +3527,7 @@ export const tools = {
},
- getValDb(keystr: string, serv: boolean, def?: any, table?: string, subkey?: any, id?: any, idmain?: any): any {
+ getValDb(keystr: string, serv: boolean, def?: any, table?: string, subkey?: any, id?: any, idmain?: any, specialField?: ISpecialField): any {
const globalStore = useGlobalStore()
const todos = useTodoStore()
const userStore = useUserStore()
@@ -5544,7 +5544,17 @@ export const tools = {
return myval
}
- }
+ },
+
+ updateQueryStringParameter(uri: string, key: string, value: string) {
+ const re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i')
+ const separator = uri.indexOf('?') !== -1 ? '&' : '?'
+ if (uri.match(re)) {
+ return uri.replace(re, '$1' + key + '=' + value + '$2')
+ } else {
+ return uri + separator + key + '=' + value
+ }
+ },
// getLocale() {
diff --git a/src/store/Modules/toolsext.ts b/src/store/Modules/toolsext.ts
index bf3a5082..2b2c7179 100755
--- a/src/store/Modules/toolsext.ts
+++ b/src/store/Modules/toolsext.ts
@@ -5,6 +5,7 @@ import { static_data } from '@/db/static_data'
import { useGlobalStore } from '@store/globalStore'
import { useTodoStore } from '@store/Todos'
import { Router } from 'vue-router'
+import { ISpecialField } from 'model'
export const func_tools = {
getLocale(vero ?: boolean): string {
@@ -155,7 +156,7 @@ export const toolsext = {
// this.$q.lang.set(mylang)
},
- getValDb(keystr: string, serv: boolean, def?: any, table?: string, subkey?: string, id?: any, idmain?: any, indrec?: number, subsubkey?: string): any | undefined {
+ getValDb(keystr: string, serv: boolean, def?: any, table?: string, subkey?: string, id?: any, idmain?: any, indrec?: number, subsubkey?: string, specialField?: ISpecialField): any | undefined {
const todos = useTodoStore()
const userStore = useUserStore()
@@ -168,8 +169,23 @@ export const toolsext = {
// @ts-ignore
return userStore.my.profile[subkey][indrec][subsubkey]
} else {
- // @ts-ignore
- return userStore.my.profile[subkey]
+
+ if (specialField && specialField.findsubkey && !!subkey) {
+ // @ts-ignore
+ const myrec = userStore.my.profile[subkey].filter(specialField.findsubkey)
+ // console.log('loaded', myrec)
+ if (myrec && myrec.length > 0 && !!specialField.paramtosetsubkey) {
+ // @ts-ignore
+ return myrec[0][specialField.paramtosetsubkey]
+ } else {
+ return ''
+ }
+
+ } else {
+
+ // @ts-ignore
+ return userStore.my.profile[subkey]
+ }
}
}
} else if (keystr) { // @ts-ignore
diff --git a/src/store/NotifStore.ts b/src/store/NotifStore.ts
index db40dfd2..318ed2fa 100755
--- a/src/store/NotifStore.ts
+++ b/src/store/NotifStore.ts
@@ -12,19 +12,21 @@ import { useUserStore } from '@store/UserStore'
export const useNotifStore = defineStore('NotifStore', {
state: (): INotifState => ({
last_notifs: [],
+ show_all: true
}),
getters: {
getlasts_notifs: (mystate: INotifState) => (): INotif[] => {
- const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 5) : []
+ const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 5).filter((rec) => mystate.show_all ? true : !rec.read) : []
// const ctrec = (mystate.notifs) ? mystate.notifs.slice().reverse().slice(0, 5) : []
return (ctrec)
},
getnumNotifUnread: (mystate: INotifState) => () => {
- return mystate.last_notifs.filter((notif) => !notif.read).length
+ const myarr = mystate.last_notifs.filter((notif) => !notif.read)
+ return (tools.isArray(myarr) ? myarr.length : 0)
},
},
@@ -37,12 +39,50 @@ export const useNotifStore = defineStore('NotifStore', {
}
},
+ setAsRead(idnotif: string) {
+ const rec = this.last_notifs.find((rec: any) => rec._id === idnotif)
+ if (rec) {
+ rec.read = true
+ }
+ },
+
+ setAllRead(username: string) {
+ return Api.SendReq(`/sendnotif/setall/${username}/${process.env.APP_ID}`, 'GET', null)
+ .then((res) => {
+ // console.log('res', res)
+ if (res) {
+ for (const rec of this.last_notifs) {
+ rec.read = true
+ }
+ }
+
+ })
+ .catch((error) => {
+ console.error(error)
+ return false
+ })
+
+ },
+
+ deleteRec(id: string) {
+
+ },
+
+ deactivateRec(id: string) {
+
+ },
+
async updateNotifDataFromServer({ username, lastdataread }: {username: string, lastdataread: Date}) {
// console.log('updateNotifDataFromServer', username, lastdataread)
return Api.SendReq(`/sendnotif/${username}/${lastdataread}/${process.env.APP_ID}`, 'GET', null)
.then((res) => {
// console.log('res', res)
+ if (!!res.data && !!res.data.arrnotif) {
+ this.last_notifs = res.data.arrnotif
+ } else {
+ this.last_notifs = []
+ }
return true
})
.catch((error) => {
@@ -61,6 +101,7 @@ export const useNotifStore = defineStore('NotifStore', {
data.sender = notif.sender
data.dest = notif.dest
data.descr = notif.descr
+ data.link = notif.link
data.datenotif = tools.getDateNow()
data.read = false
diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts
index c879b1ab..ca81bdcc 100755
--- a/src/store/UserStore.ts
+++ b/src/store/UserStore.ts
@@ -3,7 +3,7 @@ import { defineStore } from 'pinia'
import {
IFriends, IMsgGlobParam,
ISigninOptions,
- ISignupOptions, IUserFields, IUserProfile, IUserState,
+ ISignupOptions, IUserFields, IUserNotifType, IUserProfile, IUserState,
} from '@src/model'
import { tools } from '@store/Modules/tools'
import translate from '@src/globalroutines/util'
@@ -54,7 +54,7 @@ export const DefaultUser: IUserFields = {
manage_mygroups: [],
asked_friends: [],
asked_groups: [],
- notifs: 15,
+ notifs: [],
},
cart: {
userId: '',
@@ -100,7 +100,7 @@ export const DefaultProfile: IUserProfile = {
manage_mygroups: [],
asked_friends: [],
asked_groups: [],
- notifs: 15,
+ notifs: [],
}
export const useUserStore = defineStore('UserStore', {
@@ -975,9 +975,10 @@ export const useUserStore = defineStore('UserStore', {
}
},
- async loadUserProfile(username: string) {
+ async loadUserProfile({username, idnotif}: {username: string, idnotif?: string}) {
const data = {
- username
+ username,
+ idnotif
}
return Api.SendReq('/users/profile', 'POST', data)
@@ -993,7 +994,7 @@ export const useUserStore = defineStore('UserStore', {
},
- async setUserNotifs(notifs: number) {
+ async setUserNotifs(notifs: IUserNotifType[]) {
const data = {
notifs
}
diff --git a/src/store/globalStore.ts b/src/store/globalStore.ts
index 89982833..72e8b749 100644
--- a/src/store/globalStore.ts
+++ b/src/store/globalStore.ts
@@ -30,7 +30,7 @@ import urlBase64ToUint8Array from '@src/js/utility'
import translate from '@src/globalroutines/util'
import { useTodoStore } from '@store/Todos'
import { useMessageStore } from './MessageStore'
-import { useNotifStore } from './NotifStore'
+import { useNotifStore } from '@store/NotifStore'
const stateConnDefault = 'online'
@@ -1592,6 +1592,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 myarr = this.getListByTable(table)
if (costanti.TABLES_ARRAY.includes(table)) {
diff --git a/src/views/messages/messages.ts b/src/views/messages/messages.ts
index efe0fe86..b608323a 100755
--- a/src/views/messages/messages.ts
+++ b/src/views/messages/messages.ts
@@ -78,6 +78,8 @@ export default defineComponent({
const myrec = msgchat(username)
// Get msg for this chat
const lastdata: any = (myrec) ? myrec.lastdataread : tools.getLastDateReadReset()
+ if (!lastdata)
+ return null
console.table(myrec)
let mydate = ''
if (!tools.isIsoDate(lastdata))
diff --git a/src/views/user/editprofile/editprofile.ts b/src/views/user/editprofile/editprofile.ts
index b6e5bdeb..bb73fcaa 100755
--- a/src/views/user/editprofile/editprofile.ts
+++ b/src/views/user/editprofile/editprofile.ts
@@ -80,7 +80,7 @@ export default defineComponent({
function loadProfile() {
// Carica il profilo di quest'utente
- userStore.loadUserProfile(userStore.my.username).then((ris) => {
+ userStore.loadUserProfile({username: userStore.my.username}).then((ris) => {
myuser.value = ris
})
}
diff --git a/src/views/user/myprofile/myprofile.ts b/src/views/user/myprofile/myprofile.ts
index f2d6a9c8..3bfb010c 100755
--- a/src/views/user/myprofile/myprofile.ts
+++ b/src/views/user/myprofile/myprofile.ts
@@ -21,6 +21,7 @@ import { IMyGroup, IUserFields } from 'model'
import { shared_consts } from '@/common/shared_vuejs'
import { static_data } from '@/db/static_data'
import { fieldsTable } from '@store/Modules/fieldsTable'
+import { useNotifStore } from '@store/NotifStore'
import MixinUsers from '@/mixins/mixin-users'
@@ -43,6 +44,7 @@ export default defineComponent({
const animation = ref('fade')
const username = computed(() => $route.params.username ? $route.params.username.toString() : userStore.my.username)
+ const idnotif = computed(() => $route.query.idnotif ? $route.query.idnotif.toString() : '')
const filtroutente = ref([])
const showPic = ref(false)
@@ -52,6 +54,8 @@ export default defineComponent({
const actualcard = ref('mygoods')
+ const notifStore = useNotifStore()
+
const mycards = computed(() => {
return costanti.MAINCARDS.filter((rec: any) => rec.table)
})
@@ -70,10 +74,11 @@ export default defineComponent({
async function loadProfile() {
// Carica il profilo di quest'utente
if (username.value) {
- await userStore.loadUserProfile(username.value).then((ris) => {
+ await userStore.loadUserProfile({ username: username.value, idnotif: idnotif.value }).then((ris) => {
myuser.value = ris
if (myuser.value) {
filtroutente.value = [{ userId: myuser.value._id }]
+ notifStore.setAsRead(idnotif.value)
try {
listgroupsfiltered.value = globalStore.mygroups.filter((grp: IMyGroup) => myuser.value!.profile.mygroups.findIndex((rec: IMyGroup) => rec.groupname === grp.groupname) >= 0)
@@ -97,6 +102,7 @@ export default defineComponent({
})
function mounted() {
+ console.log('idnotif', idnotif)
loadProfile()
}
@@ -168,6 +174,7 @@ export default defineComponent({
actualcard,
caricato,
listgroupsfiltered,
+ idnotif,
}
}
})
diff --git a/src/views/user/usernotifs/usernotifs.scss b/src/views/user/usernotifs/usernotifs.scss
new file mode 100755
index 00000000..e69de29b
diff --git a/src/views/user/usernotifs/usernotifs.ts b/src/views/user/usernotifs/usernotifs.ts
new file mode 100755
index 00000000..9a1afe52
--- /dev/null
+++ b/src/views/user/usernotifs/usernotifs.ts
@@ -0,0 +1,30 @@
+import { computed, defineComponent, onMounted, ref, watch } from 'vue'
+import { useUserStore } from '@store/UserStore'
+import { useRoute, useRouter } from 'vue-router'
+import { useI18n } from '@/boot/i18n'
+import { useQuasar } from 'quasar'
+import { CMyCardPopup } from '@/components/CMyCardPopup'
+import { CMyPage } from '@/components/CMyPage'
+import { CNotifSettings } from '@/components/CNotifSettings'
+import { toolsext } from '@store/Modules/toolsext'
+import { tools } from '@store/Modules/tools'
+import { shared_consts } from '@src/common/shared_vuejs'
+
+export default defineComponent({
+ name: 'usernotifs',
+ components: { CMyCardPopup, CNotifSettings, CMyPage },
+ props: {},
+ setup() {
+ const userStore = useUserStore()
+ const $route = useRoute()
+ const $q = useQuasar()
+ const { t } = useI18n()
+
+ return {
+ t,
+ toolsext,
+ tools,
+ shared_consts,
+ }
+ }
+})
diff --git a/src/views/user/usernotifs/usernotifs.vue b/src/views/user/usernotifs/usernotifs.vue
new file mode 100755
index 00000000..f5368cf3
--- /dev/null
+++ b/src/views/user/usernotifs/usernotifs.vue
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+