diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index bdd77d8f..031b73af 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -2185,6 +2185,7 @@ export default defineComponent({ editOn, newRecordBoolOld, showSpin, + userStore, } } }) diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 79ff3b20..667d6bb5 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -28,10 +28,7 @@ v-if="butt_modif_new || mytitle" :class="$q.screen.lt.sm ? `` : `q-gutter-md q-ma-xs` + ` row`" > -
+
{{ mytitle }}
@@ -448,16 +445,21 @@ " >
- + + + + + {{ tools.isEntrataByRecMov(row) ? t('movement.movin') @@ -471,7 +473,7 @@ v-if=" showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true, 1, row) " - class="tdclass" + :class="!col.extrafield || (col.extrafield && (col.tipovisu !== costanti.TipoVisu.LINK || (col.tipovisu === costanti.TipoVisu.LINK && userStore.getImgByProfile(row, true, col)))) ? `tdclass` : ``" >
- Nuovo {{mytitle}}: + Nuovo {{ mytitle }}: @@ -1215,7 +1217,7 @@ > - Nuovo {{mytitle}}: + Nuovo {{ mytitle }}: diff --git a/src/components/CMyPopupEdit/CMyPopupEdit.vue b/src/components/CMyPopupEdit/CMyPopupEdit.vue index de6366f7..8ff3d421 100755 --- a/src/components/CMyPopupEdit/CMyPopupEdit.vue +++ b/src/components/CMyPopupEdit/CMyPopupEdit.vue @@ -81,11 +81,12 @@
- + {{ $t(col.extrafield) }}
-
+
- online + online - {{ tools.getNameToShow(row, col) }} + {{ + tools.getNameToShow(row, col) + }} {{ tools.getUserNameOnlyIfToShow(row, col) }} @@ -120,29 +129,6 @@
- - rec.name === circuitname) }, + getCircuitByPath(circuitpath: string): ICircuit | null { + const ris = this.listcircuits.find((rec: ICircuit) => rec.path === circuitpath) + return ris ? ris : null + }, + async loadCircuits() { return Api.SendReq('/users/circuits', 'POST', null) .then((res) => { diff --git a/src/store/Modules/costanti.ts b/src/store/Modules/costanti.ts index 0ce5ccf8..c3a6fa05 100755 --- a/src/store/Modules/costanti.ts +++ b/src/store/Modules/costanti.ts @@ -22,8 +22,8 @@ export const costanti = { AccountType: { USER: 0, - COMMUNITY_ACCOUNT: 1, - COLLECTIVE_ACCOUNT: 2, + COLLECTIVE_ACCOUNT: 1, + COMMUNITY_ACCOUNT: 2, }, Lang: { diff --git a/src/store/Modules/fieldsTable.ts b/src/store/Modules/fieldsTable.ts index 14cef9d3..9cabd129 100755 --- a/src/store/Modules/fieldsTable.ts +++ b/src/store/Modules/fieldsTable.ts @@ -67,6 +67,7 @@ function AddCol(params: IColGridTable) { allowNewValue: (params.allowNewValue === undefined) ? false : params.allowNewValue, showpicprofile_ifnotset: (params.showpicprofile_ifnotset === undefined) ? false : params.showpicprofile_ifnotset, extrafield: (params.extrafield === undefined) ? '' : params.extrafield, + tipoconto: (params.tipoconto === undefined) ? costanti.AccountType.USER : params.tipoconto, visible: (params.visible === undefined) ? true : params.visible, icon: (params.icon === undefined) ? '' : params.icon, action: (params.action === undefined) ? '' : params.action, @@ -606,6 +607,7 @@ export const colmyMovement = [ link: '/my/userfrom.username', noshowlabel: true, extrafield: 'movement.from', + tipoconto: costanti.AccountType.USER, }), AddCol({ name: 'userto.username', @@ -618,6 +620,7 @@ export const colmyMovement = [ link: '/my/userto.username', extrafield: 'movement.to', noshowlabel: true, + tipoconto: costanti.AccountType.USER, }), AddCol({ @@ -630,7 +633,21 @@ export const colmyMovement = [ fieldtype: costanti.FieldType.username_chip, link: '/my/groupfrom.groupname', noshowlabel: true, - extrafield: 'movement.from', + extrafield: 'movement.fromCColl', + tipoconto: costanti.AccountType.COLLECTIVE_ACCOUNT, + }), + AddCol({ + name: 'contocomfrom.path', + label_trans: 'groups.groupname', + field: 'contocomfrom', + subfield: 'path', + foredit: false, + tipovisu: costanti.TipoVisu.LINK, + fieldtype: costanti.FieldType.username_chip, + link: '/circuits/contocomfrom.path', + noshowlabel: true, + extrafield: 'movement.fromCCom', + tipoconto: costanti.AccountType.COMMUNITY_ACCOUNT, }), AddCol({ name: 'groupto.groupname', @@ -641,8 +658,22 @@ export const colmyMovement = [ tipovisu: costanti.TipoVisu.LINK, fieldtype: costanti.FieldType.username_chip, link: '/my/groupto.groupname', - extrafield: 'movement.to', + extrafield: 'movement.toCColl', noshowlabel: true, + tipoconto: costanti.AccountType.COLLECTIVE_ACCOUNT, + }), + AddCol({ + name: 'contocomfto.path', + label_trans: 'groups.groupname', + field: 'contocomto', + subfield: 'path', + foredit: false, + tipovisu: costanti.TipoVisu.LINK, + fieldtype: costanti.FieldType.username_chip, + link: '/circuits/contocomto.path', + noshowlabel: true, + extrafield: 'movement.toCCom', + tipoconto: costanti.AccountType.COMMUNITY_ACCOUNT, }), AddCol({ diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index c0588d62..d5647f4e 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -3620,8 +3620,12 @@ export const tools = { }, isUserOnline(user: IUserFields, col: any = null) { - const dateonline = tools.addDays(tools.getDateNow(), -1) - return user.lasttimeonline && new Date(user.lasttimeonline).getTime() > dateonline.getTime() + try { + const dateonline = tools.addDays(tools.getDateNow(), -1) + return user.lasttimeonline && new Date(user.lasttimeonline).getTime() > dateonline.getTime() + } catch (e) { + return false + } }, addMinutes(mydate: Date, minutes: number) { @@ -7536,7 +7540,7 @@ export const tools = { || myemail.search(/live.it/i) !== -1 || myemail.search(/microsoft/i) !== -1 }, - // || myemail.search(/yahoo/i) !== -1 + // || myemail.search(/yahoo/i) !== -1 getoptionsMainCards(only: boolean) { let myarr = [] diff --git a/src/store/UserStore.ts b/src/store/UserStore.ts index a606ef13..46b3b618 100755 --- a/src/store/UserStore.ts +++ b/src/store/UserStore.ts @@ -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