- L'utente entra direttamente sul circuito, con fido a zero.

++Abilitazione Fido utente (per admin).
This commit is contained in:
Surya Paolo
2023-06-01 11:40:26 +02:00
parent 616a6c4218
commit e805088da7
32 changed files with 481 additions and 187 deletions

View File

@@ -487,10 +487,31 @@ export const useUserStore = defineStore('UserStore', {
},
getMyCircuitsInCommonByUser(user: IUserFields): any[] {
let arrout = []
let vuoto = false
const circuitStore = useCircuitStore()
if (!this.my.profile.mycircuits || (!user || !user.profile || !user.profile.mycircuits))
return []
return tools.getCommon([...this.my.profile.mycircuits], [...user.profile.mycircuits], 'circuitname')
vuoto = true // ok
else
arrout = tools.getCommon([...this.my.profile.mycircuits], [...user.profile.mycircuits], 'circuitname')
// se non ho neanche 1 circuito in comune, metto il mio preferito
if (arrout.length <= 0) {
const circuit = circuitStore.getCircuitByProvince(this.my.profile.resid_province)
if (circuit)
arrout.push(circuit.name)
else {
if (this.my.profile.mycircuits.length > 0) {
arrout.push(this.my.profile.mycircuits[0].circuitname)
}
}
}
console.log('arrout', arrout)
return arrout
},
getMyCircuits(): any[] {
@@ -659,7 +680,7 @@ export const useUserStore = defineStore('UserStore', {
if (!!myrec.surname)
name += myrec.surname + ' '
if (!name) {
if (!name && myrec.username) {
name += myrec.username + ' '
}
if (col && col.field === 'extrarec' && !name) {
@@ -670,12 +691,18 @@ export const useUserStore = defineStore('UserStore', {
return myrec.descr
else if (myrec.hasOwnProperty('groupname'))
return myrec.groupname
else if (myrec.hasOwnProperty('grouporig'))
return myrec.grouporig
} else if (tipoconto === costanti.AccountType.COMMUNITY_ACCOUNT) {
if (myrec.hasOwnProperty('name'))
return myrec.name
else if (myrec.hasOwnProperty('contocom'))
return myrec.contocom
else if (myrec.hasOwnProperty('contoComDest'))
return myrec.contoComDest
}
if (!name && myrec.extrarec && myrec.extrarec.hasOwnProperty('contoComDest'))
return myrec.extrarec.contoComDest
return name
},
@@ -1772,6 +1799,25 @@ export const useUserStore = defineStore('UserStore', {
},
showButtonSendCoin(myuser: IUserFields) {
const oldway = false
if (oldway)
return this.getMyCircuitsInCommonByUser(myuser).length > 0
let yes = true
// Check if I have at least 1 Circuit
yes = yes && (this.my.profile.mycircuits.length > 0)
if (myuser && myuser.profile && myuser.profile.mycircuits) {
// Check if myuser has at least 1 Circuit
yes = yes && (myuser.profile.mycircuits.length > 0)
}
return yes
},
async setSeen($q: any, t: any, id: any, table: string, myrec: any) {
let value = false