Invio RIS da User a Conto Comunitario

- Visu movimenti OK
This commit is contained in:
Surya Paolo
2023-02-01 23:50:58 +01:00
parent 97ee2a1129
commit cfa2457147
12 changed files with 164 additions and 75 deletions

View File

@@ -2185,6 +2185,7 @@ export default defineComponent({
editOn, editOn,
newRecordBoolOld, newRecordBoolOld,
showSpin, showSpin,
userStore,
} }
} }
}) })

View File

@@ -28,10 +28,7 @@
v-if="butt_modif_new || mytitle" v-if="butt_modif_new || mytitle"
:class="$q.screen.lt.sm ? `` : `q-gutter-md q-ma-xs` + ` row`" :class="$q.screen.lt.sm ? `` : `q-gutter-md q-ma-xs` + ` row`"
> >
<div <div class="q-table__title" style="min-width: 150px">
class="q-table__title"
style="min-width: 150px"
>
{{ mytitle }} {{ mytitle }}
</div> </div>
<q-space></q-space> <q-space></q-space>
@@ -448,16 +445,21 @@
" "
> >
<div class="q-pa-xs row items-start q-gutter-xs"> <div class="q-pa-xs row items-start q-gutter-xs">
<q-card <q-card class="my-card text-black">
class="my-card text-white"
:style="
`background: radial-gradient(circle, #cccccc 0%, ` +
(tools.isEntrataByRecMov(row) ? `#aaffaa` : `#ffaaaa`) +
` 100%)`
"
>
<q-toolbar class="bg-primary text-white" style="min-height: 30px"> <q-toolbar class="bg-primary text-white" style="min-height: 30px">
<q-toolbar-title> <q-toolbar-title>
<span class="q-ma-sm">
<q-icon
v-if="tools.isEntrataByRecMov(row)"
name="fas fa-box-tissue"
color="green"
></q-icon>
<q-icon
v-else
name="fas fa-share-square"
color="red"
></q-icon>
</span>
{{ {{
tools.isEntrataByRecMov(row) tools.isEntrataByRecMov(row)
? t('movement.movin') ? t('movement.movin')
@@ -471,7 +473,7 @@
v-if=" v-if="
showColCheck(col, tools.TIPOVIS_SHOW_RECORD, true, 1, row) 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` : ``"
> >
<div :class="getclrow(row)"> <div :class="getclrow(row)">
<CMyPopupEdit <CMyPopupEdit
@@ -1141,7 +1143,7 @@
> >
<q-card class="dialog_card"> <q-card class="dialog_card">
<q-bar dense class="bg-primary text-white"> <q-bar dense class="bg-primary text-white">
Nuovo {{mytitle}}: Nuovo {{ mytitle }}:
<q-space /> <q-space />
<q-btn flat round color="white" icon="close" v-close-popup></q-btn> <q-btn flat round color="white" icon="close" v-close-popup></q-btn>
</q-bar> </q-bar>
@@ -1215,7 +1217,7 @@
> >
<q-card class="dialog_card"> <q-card class="dialog_card">
<q-bar dense class="bg-primary text-white"> <q-bar dense class="bg-primary text-white">
Nuovo {{mytitle}}: Nuovo {{ mytitle }}:
<q-space /> <q-space />
<q-btn flat round color="white" icon="close" v-close-popup></q-btn> <q-btn flat round color="white" icon="close" v-close-popup></q-btn>
</q-bar> </q-bar>

View File

@@ -81,11 +81,12 @@
</div> </div>
<div v-else-if="col.fieldtype === costanti.FieldType.username_chip"> <div v-else-if="col.fieldtype === costanti.FieldType.username_chip">
<div class=""> <div class="">
<span v-if="col.extrafield"> <span v-if="col.extrafield && (col.tipovisu !== costanti.TipoVisu.LINK || (col.tipovisu === costanti.TipoVisu.LINK && userStore.getImgByProfile(row, true, col)))">
<span class="extrafield">{{ $t(col.extrafield) }}</span> <span class="extrafield">{{ $t(col.extrafield) }}</span>
</span> </span>
</div> </div>
<div class="q-ma-xs chip_shadow"> <div v-if="!col.extrafield || (col.extrafield && (col.tipovisu !== costanti.TipoVisu.LINK || (col.tipovisu === costanti.TipoVisu.LINK && userStore.getImgByProfile(row, true, col))))"
class="q-ma-xs chip_shadow">
<div <div
v-if=" v-if="
(col.tipovisu === costanti.TipoVisu.LINK || (col.tipovisu === costanti.TipoVisu.LINK ||
@@ -108,11 +109,19 @@
<q-item-section avatar> <q-item-section avatar>
<q-avatar round size="48px"> <q-avatar round size="48px">
<img :src="userStore.getImgByProfile(row, true, col)" /> <img :src="userStore.getImgByProfile(row, true, col)" />
<q-badge v-if="tools.isUserOnline(row, col)" align="top" floating color="green">online</q-badge> <q-badge
v-if="tools.isUserOnline(row, col)"
align="top"
floating
color="green"
>online</q-badge
>
</q-avatar> </q-avatar>
</q-item-section> </q-item-section>
<q-item-section class=""> <q-item-section class="">
<q-item-label>{{ tools.getNameToShow(row, col) }}</q-item-label> <q-item-label>{{
tools.getNameToShow(row, col)
}}</q-item-label>
<q-item-label caption>{{ <q-item-label caption>{{
tools.getUserNameOnlyIfToShow(row, col) tools.getUserNameOnlyIfToShow(row, col)
}}</q-item-label> }}</q-item-label>
@@ -120,29 +129,6 @@
<q-item-section side></q-item-section> <q-item-section side></q-item-section>
</q-item> </q-item>
</div> </div>
<!--
<q-btn
v-if="
(col.tipovisu === costanti.TipoVisu.LINK ||
col.tipovisu === costanti.TipoVisu.NONE) &&
myvalue
"
glossy
rounded
size="md"
:class="{ disabled: disable }"
color="white"
text-color="blue"
:icon="`img:` + userStore.getImgUserByUsername(myvalue)"
:to="
col.link
? col.link.replace(col.name, myvalue)
: `/my/username`.replace(col.name, myvalue)
"
:label="tools.getNameToShow(row)"
>
</q-btn>-->
<q-avatar <q-avatar
v-else-if=" v-else-if="
col.tipovisu === costanti.TipoVisu.LINKIMG && myvalue col.tipovisu === costanti.TipoVisu.LINKIMG && myvalue

View File

@@ -254,8 +254,8 @@ export default defineComponent({
myrecsendcoin.groupdest = props.to_group ? props.to_group.groupname : '' myrecsendcoin.groupdest = props.to_group ? props.to_group.groupname : ''
myrecsendcoin.contoComDest = props.to_contocom myrecsendcoin.contoComDest = props.to_contocom
myrecsendcoin.grouporig = tipoConto.value === costanti.AccountType.COMMUNITY_ACCOUNT ? from_groupname.value : '' myrecsendcoin.grouporig = tipoConto.value === costanti.AccountType.COLLECTIVE_ACCOUNT ? from_groupname.value : ''
myrecsendcoin.contoComOrig = tipoConto.value === costanti.AccountType.COLLECTIVE_ACCOUNT ? props.from_contocom : '' myrecsendcoin.contoComOrig = tipoConto.value === costanti.AccountType.COMMUNITY_ACCOUNT ? props.from_contocom : ''
myrecsendcoin.dest = props.to_user ? props.to_user.username : '' myrecsendcoin.dest = props.to_user ? props.to_user.username : ''

View File

@@ -214,8 +214,8 @@
qtyRef qtyRef
? qtyRef.hasError || !circuitloaded.transactionsEnabled || ? qtyRef.hasError || !circuitloaded.transactionsEnabled ||
((tipoConto === costanti.AccountType.USER) && to_user && (from_username === to_user.username)) || ((tipoConto === costanti.AccountType.USER) && to_user && (from_username === to_user.username)) ||
((tipoConto === costanti.AccountType.COMMUNITY_ACCOUNT) && !from_groupname) || ((tipoConto === costanti.AccountType.COLLECTIVE_ACCOUNT) && !from_groupname) ||
((tipoConto === costanti.AccountType.COMMUNITY_ACCOUNT) && to_group && from_groupname && (to_group.groupname === from_groupname)) || ((tipoConto === costanti.AccountType.COLLECTIVE_ACCOUNT) && to_group && from_groupname && (to_group.groupname === from_groupname)) ||
((tipoConto === costanti.AccountType.COMMUNITY_ACCOUNT) && !to_contocom) ((tipoConto === costanti.AccountType.COMMUNITY_ACCOUNT) && !to_contocom)
: false : false
" "

View File

@@ -750,6 +750,7 @@ export interface IColGridTable {
allowNewValue?: boolean allowNewValue?: boolean
showpicprofile_ifnotset?: boolean showpicprofile_ifnotset?: boolean
extrafield?: string extrafield?: string
tipoconto?: number
} }
export interface ITableRec { export interface ITableRec {

View File

@@ -1309,7 +1309,11 @@ const msg_it = {
movin: 'Monete Ricevute', movin: 'Monete Ricevute',
movout: 'Monete Inviate', movout: 'Monete Inviate',
from: 'Inviate da:', from: 'Inviate da:',
fromCColl: 'Inviate dal Conto Collettivo:',
fromCCom: 'Inviate dal Conto Comunitario:',
to: 'A favore di:', to: 'A favore di:',
toCColl: 'Al Conto Collettivo:',
toCCom: 'Al Conto Comunitario:',
pendingtransaction: '* Transazioni Pendenti', pendingtransaction: '* Transazioni Pendenti',
onlymymov: 'Mostra solo i miei movimenti', onlymymov: 'Mostra solo i miei movimenti',
showsaldi: 'Mostra i Saldi dei membri', showsaldi: 'Mostra i Saldi dei membri',

View File

@@ -72,6 +72,11 @@ export const useCircuitStore = defineStore('CircuitStore', {
return this.listcircuits.find((rec: ICircuit) => rec.name === circuitname) return this.listcircuits.find((rec: ICircuit) => rec.name === circuitname)
}, },
getCircuitByPath(circuitpath: string): ICircuit | null {
const ris = this.listcircuits.find((rec: ICircuit) => rec.path === circuitpath)
return ris ? ris : null
},
async loadCircuits() { async loadCircuits() {
return Api.SendReq('/users/circuits', 'POST', null) return Api.SendReq('/users/circuits', 'POST', null)
.then((res) => { .then((res) => {

View File

@@ -22,8 +22,8 @@ export const costanti = {
AccountType: { AccountType: {
USER: 0, USER: 0,
COMMUNITY_ACCOUNT: 1, COLLECTIVE_ACCOUNT: 1,
COLLECTIVE_ACCOUNT: 2, COMMUNITY_ACCOUNT: 2,
}, },
Lang: { Lang: {

View File

@@ -67,6 +67,7 @@ function AddCol(params: IColGridTable) {
allowNewValue: (params.allowNewValue === undefined) ? false : params.allowNewValue, allowNewValue: (params.allowNewValue === undefined) ? false : params.allowNewValue,
showpicprofile_ifnotset: (params.showpicprofile_ifnotset === undefined) ? false : params.showpicprofile_ifnotset, showpicprofile_ifnotset: (params.showpicprofile_ifnotset === undefined) ? false : params.showpicprofile_ifnotset,
extrafield: (params.extrafield === undefined) ? '' : params.extrafield, extrafield: (params.extrafield === undefined) ? '' : params.extrafield,
tipoconto: (params.tipoconto === undefined) ? costanti.AccountType.USER : params.tipoconto,
visible: (params.visible === undefined) ? true : params.visible, visible: (params.visible === undefined) ? true : params.visible,
icon: (params.icon === undefined) ? '' : params.icon, icon: (params.icon === undefined) ? '' : params.icon,
action: (params.action === undefined) ? '' : params.action, action: (params.action === undefined) ? '' : params.action,
@@ -606,6 +607,7 @@ export const colmyMovement = [
link: '/my/userfrom.username', link: '/my/userfrom.username',
noshowlabel: true, noshowlabel: true,
extrafield: 'movement.from', extrafield: 'movement.from',
tipoconto: costanti.AccountType.USER,
}), }),
AddCol({ AddCol({
name: 'userto.username', name: 'userto.username',
@@ -618,6 +620,7 @@ export const colmyMovement = [
link: '/my/userto.username', link: '/my/userto.username',
extrafield: 'movement.to', extrafield: 'movement.to',
noshowlabel: true, noshowlabel: true,
tipoconto: costanti.AccountType.USER,
}), }),
AddCol({ AddCol({
@@ -630,7 +633,21 @@ export const colmyMovement = [
fieldtype: costanti.FieldType.username_chip, fieldtype: costanti.FieldType.username_chip,
link: '/my/groupfrom.groupname', link: '/my/groupfrom.groupname',
noshowlabel: true, 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({ AddCol({
name: 'groupto.groupname', name: 'groupto.groupname',
@@ -641,8 +658,22 @@ export const colmyMovement = [
tipovisu: costanti.TipoVisu.LINK, tipovisu: costanti.TipoVisu.LINK,
fieldtype: costanti.FieldType.username_chip, fieldtype: costanti.FieldType.username_chip,
link: '/my/groupto.groupname', link: '/my/groupto.groupname',
extrafield: 'movement.to', extrafield: 'movement.toCColl',
noshowlabel: true, 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({ AddCol({

View File

@@ -3620,8 +3620,12 @@ export const tools = {
}, },
isUserOnline(user: IUserFields, col: any = null) { isUserOnline(user: IUserFields, col: any = null) {
const dateonline = tools.addDays(tools.getDateNow(), -1) try {
return user.lasttimeonline && new Date(user.lasttimeonline).getTime() > dateonline.getTime() 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) { addMinutes(mydate: Date, minutes: number) {
@@ -7536,7 +7540,7 @@ export const tools = {
|| myemail.search(/live.it/i) !== -1 || myemail.search(/live.it/i) !== -1
|| myemail.search(/microsoft/i) !== -1 || myemail.search(/microsoft/i) !== -1
}, },
// || myemail.search(/yahoo/i) !== -1 // || myemail.search(/yahoo/i) !== -1
getoptionsMainCards(only: boolean) { getoptionsMainCards(only: boolean) {
let myarr = [] let myarr = []

View File

@@ -39,6 +39,7 @@ import { IGroupShort, IMyGroup, IUserAdmins } from '@model/UserStore'
import globalroutines from '../globalroutines/index' import globalroutines from '../globalroutines/index'
import { useNotifStore } from '@store/NotifStore' import { useNotifStore } from '@store/NotifStore'
import { useCircuitStore } from './CircuitStore'
export const DefaultUser: IUserFields = { export const DefaultUser: IUserFields = {
_id: '', _id: '',
@@ -244,6 +245,15 @@ export const useUserStore = defineStore('UserStore', {
return false 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[] { GroupsListWhereIAmAdmin(): IMyGroup[] {
return this.my.profile.manage_mygroups return this.my.profile.manage_mygroups
}, },
@@ -319,25 +329,47 @@ export const useUserStore = defineStore('UserStore', {
if (row.hasOwnProperty(col.name)) { if (row.hasOwnProperty(col.name)) {
value = row[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) { if (row) {
const mycol = col.name + '.img' const mycol = col.name + '.img'
if (row.hasOwnProperty(mycol)) { if (row.hasOwnProperty(mycol)) {
img = row[mycol] img = row[mycol]
} }
} }
return img ? img : 'images/noimg-user.svg' return img ? img : 'images/noimg-user.svg'
}, },
getImgByProfile(userparam: any, reale: any = false, col: any = null): string { getImgByProfile(userparam: any, reale: any = false, col: any = null): string {
try { try {
let myrec = this.getRecByCol(userparam, col) let myrec = this.getRecByCol(userparam, col)
let img = ''
if (!reale)
img = 'images/noimg-user.svg'
if (myrec.profile && myrec.profile.img) { if (col.tipoconto === costanti.AccountType.COLLECTIVE_ACCOUNT) {
return costanti.DIR_UPLOAD + 'profile/' + myrec.username + '/' + myrec.profile.img img = this.getImgByGroupname(myrec.groupname)
} else if (col.tipoconto === costanti.AccountType.COMMUNITY_ACCOUNT) {
img = this.getImgByCircuitpath(myrec.path)
} else { } 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) { } catch (e) {
// //
} }
@@ -423,28 +455,41 @@ export const useUserStore = defineStore('UserStore', {
}, },
getImgByCircuit(circ: ICircuit): string { getImgByCircuit(circ: ICircuit | null): string {
try { 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 return costanti.DIR_UPLOAD + 'circuits/' + circ.path + '/' + circ.photos[0].imagefile
} catch (e) { } catch (e) {
//
} }
return 'images/noimg.png' 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 { try {
// ++Todo: Sistemare! // ++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) { } catch (e) {
//
} }
return 'images/noimg.png' return 'images/noimg.png'
}, },
getImgByGroupname(groupname: string): string {
const mygroup = this.getMyGroupByGroupname(groupname)
return this.getImgByGroup(mygroup)
},
getRefLink(username: string): string { getRefLink(username: string): string {
if (username === '') if (username === '')
username = this.my.username username = this.my.username
@@ -498,12 +543,16 @@ export const useUserStore = defineStore('UserStore', {
let myrec = user let myrec = user
if (col && col.field === 'userto') if (col && col.field === 'userto')
myrec = user.userto myrec = user.userto
if (col && col.field === 'groupto') else if (col && col.field === 'groupto')
myrec = user.groupto myrec = user.groupto
if (col && col.field === 'userfrom') else if (col && col.field === 'userfrom')
myrec = user.userfrom myrec = user.userfrom
if (col && col.field === 'groupfrom') else if (col && col.field === 'groupfrom')
myrec = user.groupfrom myrec = user.groupfrom
else if (col && col.field === 'contocomfrom')
myrec = user.contocomfrom
else if (col && col.field === 'contocomto')
myrec = user.contocomto
return myrec return myrec
}, },
@@ -512,16 +561,22 @@ export const useUserStore = defineStore('UserStore', {
let name = '' let name = ''
let myrec = this.getRecByCol(user, col) let myrec = this.getRecByCol(user, col)
if (!!myrec.name) if (col.tipoconto === costanti.AccountType.USER) {
name = myrec.name + ' ' if (!!myrec.name)
if (!!myrec.surname) name = myrec.name + ' '
name += myrec.surname + ' ' if (!!myrec.surname)
name += myrec.surname + ' '
if (!name) { if (!name) {
name += myrec.username + ' ' name += myrec.username + ' '
} }
if (col && col.field === 'extrarec' && !name) { if (col && col.field === 'extrarec' && !name) {
name = myrec.dest 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 return name