- Migliorata la Notifica degli Eventi su Telegram

- Gli annunci (beni/servizi/ospitalità) ora possono essere visti anche tramite un link, anche per chi non è dentro alla App.
- Aggiunto bottone "Aggiorna" per aggiornare il Saldo attuale.
- I "Conti Collettivi" ora vengono chiamati Gruppi (o Conto di Gruppo).
This commit is contained in:
Surya Paolo
2023-10-01 01:24:55 +02:00
parent bfceb64811
commit 31598e3fbd
43 changed files with 784 additions and 515 deletions

View File

@@ -69,11 +69,11 @@ export const useCircuitStore = defineStore('CircuitStore', {
return 'red'
},
getCircuitByName(circuitname: string): ICircuit | undefined | null {
getCircuitByName(circuitname: string): ICircuit | undefined | null {
return this.listcircuits.find((rec: ICircuit) => rec.name === circuitname)
},
getCircuitByProvince(prov: string): ICircuit | undefined | null {
getCircuitByProvince(prov: string): ICircuit | undefined | null {
return this.listcircuits.find((rec: ICircuit) => rec.strProv === prov)
},
@@ -81,20 +81,20 @@ export const useCircuitStore = defineStore('CircuitStore', {
return this.listcircuits.find((rec: ICircuit) => rec._id === circuitId)
},
getNameByCircuitId(circuitId: string): string {
getNameByCircuitId(circuitId: string): string {
const circuit = this.getCircuitByCircuitId(circuitId);
return circuit && circuit.name ? circuit.name : ''
},
getCircuitsLabelValue(): any {
getCircuitsLabelValue(): any {
let arr = []
for (const circ of this.listcircuits) {
arr.push({label: circ.name, value: circ._id})
arr.push({ label: circ.name, value: circ._id })
}
return arr
},
getCircuitByPath(circuitpath: string): ICircuit | null {
getCircuitByPath(circuitpath: string): ICircuit | null {
const ris = this.listcircuits.find((rec: ICircuit) => rec.path === circuitpath)
return ris ? ris : null
},
@@ -109,7 +109,18 @@ export const useCircuitStore = defineStore('CircuitStore', {
},
getCircuitsListByGroup(mygrp: IMyGroup): ICircuit[] {
async aggiornaSaldo(circuitId: string) {
return Api.SendReq('/users/updatesaldo', 'POST', { circuitId })
.then((res) => {
if (res.data.ris)
tools.updateMyData(res.data.ris)
}).catch((error) => {
return {}
})
},
getCircuitsListByGroup(mygrp: IMyGroup): ICircuit[] {
return this.listcircuits.filter((rec: ICircuit) => mygrp.mycircuits!.findIndex((circ: IMyCircuit) => circ.circuitname === rec.name) >= 0)
},
@@ -122,21 +133,21 @@ export const useCircuitStore = defineStore('CircuitStore', {
},
getAccountByCircuitId(circuitId: string): any {
if (this.listaccounts) {
/*if (this.listaccounts) {
return this.listaccounts.find((rec: IAccount) => rec.circuitId === circuitId)
}
return null
return null*/
},
getAccountsListNameValue(): any[] {
let arr = []
if (this.listaccounts) {
for (const acc of this.listaccounts) {
let chi = acc.username ? acc.username : (acc.groupname ? 'Collettivo: ' + acc.groupname : 'Comunitario: ' + acc.contocom)
let chi = acc.username ? acc.username : (acc.groupname ? 'Gruppo: ' + acc.groupname : 'Comunitario: ' + acc.contocom)
if (acc.circuitId) {
chi = '[' + this.getNameByCircuitId(acc.circuitId) + '] ' + chi
}
arr.push({label: chi, value: acc._id})
arr.push({ label: chi, value: acc._id })
}
}
return arr

View File

@@ -689,7 +689,7 @@ export const colmyMovementTable = [
AddCol({ name: 'transactionDate', label_trans: 'movement.transactionDate', fieldtype: costanti.FieldType.date }),
AddCol({
name: 'userfrom.username',
label_trans: 'reg.username',
label_trans: 'circuit.sender',
field: 'userfrom',
subfield: 'username',
tipovisu: costanti.TipoVisu.LINK,
@@ -724,7 +724,7 @@ export const colmyMovementTable = [
}),
AddCol({
name: 'userto.username',
label_trans: 'reg.username',
label_trans: 'circuit.dest',
field: 'userto',
subfield: 'username',
foredit: false,

View File

@@ -4767,6 +4767,7 @@ export const tools = {
getnumrequisiti(user: IUserFields) {
let req = 0
req += user.verified_email ? 1 : 0
req += user.profile.teleg_id! > 0 ? 1 : 0
req += this.isBitActive(user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_READ_GUIDELINES.value) ? 1 : 0
@@ -5111,7 +5112,7 @@ export const tools = {
TelegVerificato(): boolean {
const userStore = useUserStore()
return userStore.my.profile ? userStore.my.profile.teleg_id! > 0 : false
return userStore.my.profile ? userStore.my.profile.teleg_id! > 0 || userStore.my.profile.teleg_id_old! > 0 : false
},
isDebugOn(): boolean {

View File

@@ -190,7 +190,7 @@ export const useNotifStore = defineStore('NotifStore', {
},
async updateNotifDataFromServer({ username, lastdataread }: { username: string, lastdataread: Date }) {
// console.log('updateNotifDataFromServer', username, lastdataread)
console.log('updateNotifDataFromServer', username, lastdataread)
return Api.SendReq(`/sendnotif/${username}/${lastdataread}/${process.env.APP_ID}`, 'GET', null)
.then((res) => {
@@ -210,6 +210,7 @@ export const useNotifStore = defineStore('NotifStore', {
})
},
async SendNotifEvent(notif: INotif) {
console.log('SendNotifEvent', notif)

View File

@@ -608,15 +608,19 @@ export const useUserStore = defineStore('UserStore', {
return tools.getUrlSite() + '/registrati/' + username
},
isTelegIdOk(): boolean {
return (this.my.profile.teleg_id! > 0 || this.my.profile.teleg_id_old! > 0)
},
isUserOk(): boolean {
const globalStore = useGlobalStore()
if (globalStore.site.confpages.enableRegMultiChoice) {
return ((this.my.profile.teleg_id! > 0 && this.isUsernameTelegOk()) || this.my.verified_email!) && this.my.verified_by_aportador!
return ((this.isTelegIdOk() && this.isUsernameTelegOk()) || this.my.verified_email!) && this.my.verified_by_aportador!
} else {
return this.my.profile.teleg_id! > 0 && this.my.verified_by_aportador! && this.isUsernameTelegOk()
return this.isTelegIdOk() && this.my.verified_by_aportador! && this.isUsernameTelegOk()
}
// return this.my.verified_email! && this.my.profile.teleg_id! > 0 && this.my.verified_by_aportador!
// return this.my.verified_email! && this.isTelegIdOk() && this.my.verified_by_aportador!
},
isUserWaitingVerifAportador(): boolean {
@@ -625,17 +629,17 @@ export const useUserStore = defineStore('UserStore', {
isOldRegNotFinished(): boolean {
return tools.isLogged() && ((!this.my.profile.teleg_id || this.my.profile.teleg_id <= 0) || !this.isUsernameTelegOk())
// return this.my.verified_email! && this.my.profile.teleg_id! > 0 && this.my.verified_by_aportador!
// return this.my.verified_email! && this.isTelegIdOk() && this.my.verified_by_aportador!
},
isTelegOk(): boolean {
return this.my.profile.teleg_id! > 0
// return this.my.verified_email! && this.my.profile.teleg_id! > 0 && this.my.verified_by_aportador!
return this.isTelegIdOk()
// return this.my.verified_email! && this.isTelegIdOk() && this.my.verified_by_aportador!
},
isUsernameTelegOk(): boolean {
return !!this.my.profile.username_telegram
// return this.my.verified_email! && this.my.profile.teleg_id! > 0 && this.my.verified_by_aportador!
// return this.my.verified_email! && this.isTelegIdOk() && this.my.verified_by_aportador!
},
getNameSurnameByUserId(userId: string): string {
@@ -1702,6 +1706,12 @@ export const useUserStore = defineStore('UserStore', {
.then((res) => {
if (res && res.data.state === 1) {
if (myrec) {
if (!myrec.myreact) {
myrec.myreact = {
numfav: 0,
}
}
if (!recreaction)
this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, fav: true })
else
@@ -1739,6 +1749,11 @@ export const useUserStore = defineStore('UserStore', {
return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_ATTEND, id, tab, value })
.then((res) => {
if (res && res.data.state === 1) {
if (!myrec.myreact) {
myrec.myreact = {
numattend: 0,
}
}
if (!myrec.myreact.attend)
myrec.myreact.attend = false
// create a record
@@ -1800,6 +1815,11 @@ export const useUserStore = defineStore('UserStore', {
return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_BOOKMARK, id, tab, value })
.then((res) => {
if (res && res.data.state === 1) {
if (!myrec.myreact) {
myrec.myreact = {
numseen: 0,
}
}
if (!myrec.mybook)
myrec.mybook = []
if (!recreaction)
@@ -1813,8 +1833,8 @@ export const useUserStore = defineStore('UserStore', {
//++ this.my.profile.reaction = tools.removeIObjectOnce(this.my.profile.reaction, { id, tab, })
if ((myrec && myrec.mybook) && recreaction)
recreaction.book = false
myrec.myreact.numbook--
//myrec.mybook = myrec.mybook.filter((rec: IFavBook) => rec.username !== this.my.username)
myrec.myreact.numbook--
//myrec.mybook = myrec.mybook.filter((rec: IFavBook) => rec.username !== this.my.username)
tools.showNegativeNotif($q, t('cmd.bookmark_unset'))
}
}).catch((error) => {
@@ -1856,6 +1876,11 @@ export const useUserStore = defineStore('UserStore', {
.then((res) => {
if (res && res.data.state === 1) {
if (value) {
if (!myrec.myreact) {
myrec.myreact = {
numseen: 0,
}
}
myrec.myreact.numseen++
if (!recreaction)
this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, seen: true })