Notifications

Settings Notifications
User Panel
This commit is contained in:
Paolo Arena
2022-07-23 17:44:44 +02:00
parent 6ae82f14cc
commit e2006e683b
18 changed files with 328 additions and 69 deletions

View File

@@ -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) {