- profilo corretto

This commit is contained in:
Surya Paolo
2024-02-18 20:13:41 +01:00
parent 6945c6eba0
commit 473ea72e80
17 changed files with 58 additions and 17 deletions

View File

@@ -30,6 +30,7 @@ import { static_data } from '@/db/static_data'
import { fieldsTable } from '@store/Modules/fieldsTable'
import { useNotifStore } from '@store/NotifStore'
import MixinUsers from '@/mixins/mixin-users'
import { useCircuitStore } from '@src/store/CircuitStore'
export default defineComponent({
@@ -44,6 +45,7 @@ export default defineComponent({
setup(props) {
const userStore = useUserStore()
const globalStore = useGlobalStore()
const circuitStore = useCircuitStore()
const $route = useRoute()
const $q = useQuasar()
const { t } = useI18n()
@@ -59,12 +61,14 @@ export default defineComponent({
const idnotif = computed(() => $route.query.idnotif ? $route.query.idnotif.toString() : '')
const filtroutente = ref(<any[]>[])
const filtro_eventi = ref(<any[]>[])
const showPic = ref(false)
const caricato = ref(false)
const myuser = ref(<IUserFields | null>null)
const actualcard = ref('mygoods')
const allcirc = ref(<any>[])
const notifStore = useNotifStore()
@@ -88,12 +92,21 @@ export default defineComponent({
async function loadProfile() {
console.log('loadProfile...', username.value)
try {
let today = new Date();
today.setHours(0, 0, 0, 0);
// Carica il profilo di quest'utente
if (username.value) {
await userStore.loadUserProfile({ username: username.value, idnotif: idnotif.value }).then((ris) => {
console.log('loadUserProfile = ', ris)
myuser.value = ris
if (myuser.value) {
// filtro_eventi.value = [{ userId: myuser.value._id }, { dateTimeStart: { $gte: today } }]
let mydate = tools.addDays(tools.getDateNow(), -1)
let mydateend = tools.addDays(mydate, 30)
mydate = tools.getstrYYMMDDDate(mydate)
filtro_eventi.value = [{ userId: myuser.value._id }, { dateTimeStart: { $gte: mydate, $lte: mydateend } }]
filtroutente.value = [{ userId: myuser.value._id }]
notifStore.setAsRead(idnotif.value)
@@ -104,9 +117,20 @@ export default defineComponent({
}
try {
listcircuitsfiltered.value = myuser.value.profile.mycircuits
allcirc.value = myuser.value.profile.mycircuits
} catch (e) {
listcircuitsfiltered.value = []
allcirc.value = []
}
const circnaz = circuitStore.getCircuitoNazionale(allcirc.value)
if (allcirc.value.length > 0) {
listcircuitsfiltered.value = allcirc.value.slice(0, 5)
if (circnaz)
listcircuitsfiltered.value.unshift(circnaz)
// includi anche il circuito nazionale
} else {
listcircuitsfiltered.value = allcirc.value
}
}
@@ -214,6 +238,7 @@ export default defineComponent({
getLinkUserTelegram,
getLinkWebSite,
filtroutente,
filtro_eventi,
filtrofavorite,
filtrobookmark,
showPic,