Invio RIS da User a Conto Comunitario
- Visu movimenti OK
This commit is contained in:
@@ -39,6 +39,7 @@ import { IGroupShort, IMyGroup, IUserAdmins } from '@model/UserStore'
|
||||
|
||||
import globalroutines from '../globalroutines/index'
|
||||
import { useNotifStore } from '@store/NotifStore'
|
||||
import { useCircuitStore } from './CircuitStore'
|
||||
|
||||
export const DefaultUser: IUserFields = {
|
||||
_id: '',
|
||||
@@ -244,6 +245,15 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return false
|
||||
},
|
||||
|
||||
getMyGroupByGroupname(groupname: string): IMyGroup | null {
|
||||
if (this.my.profile.mygroups) {
|
||||
const ris = this.my.profile.mygroups.find((rec) => rec.groupname === groupname)
|
||||
return ris ? ris : null
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
},
|
||||
|
||||
GroupsListWhereIAmAdmin(): IMyGroup[] {
|
||||
return this.my.profile.manage_mygroups
|
||||
},
|
||||
@@ -319,25 +329,47 @@ export const useUserStore = defineStore('UserStore', {
|
||||
if (row.hasOwnProperty(col.name)) {
|
||||
value = row[col.name]
|
||||
}
|
||||
let img = this.getImgByUsername(value)
|
||||
let tipoconto = costanti.AccountType.USER
|
||||
if (row.hasOwnProperty(col.tipoconto) && col.tipoconto) {
|
||||
tipoconto = col.tipoconto
|
||||
}
|
||||
let img = ''
|
||||
if (tipoconto === costanti.AccountType.USER) {
|
||||
img = this.getImgByUsername(value)
|
||||
} else if (tipoconto === costanti.AccountType.COLLECTIVE_ACCOUNT) {
|
||||
img = this.getImgByGroupname(value)
|
||||
} else if (tipoconto === costanti.AccountType.COMMUNITY_ACCOUNT) {
|
||||
img = this.getImgByCircuitpath(value)
|
||||
}
|
||||
|
||||
if (row) {
|
||||
const mycol = col.name + '.img'
|
||||
if (row.hasOwnProperty(mycol)) {
|
||||
img = row[mycol]
|
||||
}
|
||||
}
|
||||
|
||||
return img ? img : 'images/noimg-user.svg'
|
||||
},
|
||||
|
||||
getImgByProfile(userparam: any, reale: any = false, col: any = null): string {
|
||||
try {
|
||||
let myrec = this.getRecByCol(userparam, col)
|
||||
let img = ''
|
||||
if (!reale)
|
||||
img = 'images/noimg-user.svg'
|
||||
|
||||
if (myrec.profile && myrec.profile.img) {
|
||||
return costanti.DIR_UPLOAD + 'profile/' + myrec.username + '/' + myrec.profile.img
|
||||
if (col.tipoconto === costanti.AccountType.COLLECTIVE_ACCOUNT) {
|
||||
img = this.getImgByGroupname(myrec.groupname)
|
||||
} else if (col.tipoconto === costanti.AccountType.COMMUNITY_ACCOUNT) {
|
||||
img = this.getImgByCircuitpath(myrec.path)
|
||||
} else {
|
||||
return 'images/noimg-user.svg'
|
||||
if (myrec.profile && myrec.profile.img) {
|
||||
img = costanti.DIR_UPLOAD + 'profile/' + myrec.username + '/' + myrec.profile.img
|
||||
}
|
||||
}
|
||||
|
||||
return img
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
@@ -423,28 +455,41 @@ export const useUserStore = defineStore('UserStore', {
|
||||
},
|
||||
|
||||
|
||||
getImgByCircuit(circ: ICircuit): string {
|
||||
getImgByCircuit(circ: ICircuit | null): string {
|
||||
|
||||
try {
|
||||
if (circ.photos && circ.photos.length > 0)
|
||||
if (circ && circ.photos && circ.photos.length > 0)
|
||||
return costanti.DIR_UPLOAD + 'circuits/' + circ.path + '/' + circ.photos[0].imagefile
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
return 'images/noimg.png'
|
||||
},
|
||||
|
||||
getImgByGroup(group: IMyGroup): string {
|
||||
getImgByCircuitpath(circuitpath: string): string {
|
||||
const circuitStore = useCircuitStore()
|
||||
|
||||
const mycirc = circuitStore.getCircuitByPath(circuitpath)
|
||||
return this.getImgByCircuit(mycirc)
|
||||
},
|
||||
|
||||
|
||||
getImgByGroup(group: IMyGroup | null): string {
|
||||
|
||||
try {
|
||||
// ++Todo: Sistemare!
|
||||
return costanti.DIR_UPLOAD + 'mygroups/' + group.groupname + '/' + group.photos[0].imagefile
|
||||
if (group) {
|
||||
return costanti.DIR_UPLOAD + 'mygroups/' + group.groupname + '/' + group.photos[0].imagefile
|
||||
}
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
return 'images/noimg.png'
|
||||
},
|
||||
|
||||
getImgByGroupname(groupname: string): string {
|
||||
const mygroup = this.getMyGroupByGroupname(groupname)
|
||||
return this.getImgByGroup(mygroup)
|
||||
},
|
||||
|
||||
getRefLink(username: string): string {
|
||||
if (username === '')
|
||||
username = this.my.username
|
||||
@@ -498,12 +543,16 @@ export const useUserStore = defineStore('UserStore', {
|
||||
let myrec = user
|
||||
if (col && col.field === 'userto')
|
||||
myrec = user.userto
|
||||
if (col && col.field === 'groupto')
|
||||
else if (col && col.field === 'groupto')
|
||||
myrec = user.groupto
|
||||
if (col && col.field === 'userfrom')
|
||||
else if (col && col.field === 'userfrom')
|
||||
myrec = user.userfrom
|
||||
if (col && col.field === 'groupfrom')
|
||||
else if (col && col.field === 'groupfrom')
|
||||
myrec = user.groupfrom
|
||||
else if (col && col.field === 'contocomfrom')
|
||||
myrec = user.contocomfrom
|
||||
else if (col && col.field === 'contocomto')
|
||||
myrec = user.contocomto
|
||||
|
||||
return myrec
|
||||
},
|
||||
@@ -512,16 +561,22 @@ export const useUserStore = defineStore('UserStore', {
|
||||
let name = ''
|
||||
let myrec = this.getRecByCol(user, col)
|
||||
|
||||
if (!!myrec.name)
|
||||
name = myrec.name + ' '
|
||||
if (!!myrec.surname)
|
||||
name += myrec.surname + ' '
|
||||
if (col.tipoconto === costanti.AccountType.USER) {
|
||||
if (!!myrec.name)
|
||||
name = myrec.name + ' '
|
||||
if (!!myrec.surname)
|
||||
name += myrec.surname + ' '
|
||||
|
||||
if (!name) {
|
||||
name += myrec.username + ' '
|
||||
}
|
||||
if (col && col.field === 'extrarec' && !name) {
|
||||
name = myrec.dest
|
||||
if (!name) {
|
||||
name += myrec.username + ' '
|
||||
}
|
||||
if (col && col.field === 'extrarec' && !name) {
|
||||
name = myrec.dest
|
||||
}
|
||||
} else if (col.tipoconto === costanti.AccountType.COLLECTIVE_ACCOUNT) {
|
||||
return myrec.descr
|
||||
} else if (col.tipoconto === costanti.AccountType.COMMUNITY_ACCOUNT) {
|
||||
return myrec.name
|
||||
}
|
||||
|
||||
return name
|
||||
|
||||
Reference in New Issue
Block a user