Click per mandare un messaggio al Destinatario dei RIS, se non è entrato ancora in RIS ITALIA.
This commit is contained in:
@@ -2,7 +2,7 @@ import { defineStore } from 'pinia'
|
||||
|
||||
import {
|
||||
IAccount,
|
||||
ICircuit, ICircuitState, IGlobalState, IGroupShort, IMyCircuit, IMyGroup,
|
||||
ICircuit, ICircuitState, IGlobalState, IGroupShort, IMyCircuit, IMyGroup, IUserFields
|
||||
} from '@src/model'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import translate from '@src/globalroutines/util'
|
||||
@@ -52,6 +52,48 @@ export const useCircuitStore = defineStore('CircuitStore', {
|
||||
return 0
|
||||
},
|
||||
|
||||
sonoDentroAlCircuitoNazionale() {
|
||||
const userStore = useUserStore()
|
||||
|
||||
const circNazionali: any = this.listcircuits.filter((circ: any) => circ.showAlways)
|
||||
|
||||
for (const circ of circNazionali) {
|
||||
const trovato = userStore.my.profile.mycircuits.findIndex((mycirc: any) => mycirc.circuitname === circ.name) >= 0
|
||||
if (trovato){
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
},
|
||||
|
||||
EDentroAlCircuitoNazionale(user: IUserFields) {
|
||||
|
||||
const circNazionali: any = this.listcircuits.filter((circ: any) => circ.showAlways)
|
||||
|
||||
for (const circ of circNazionali) {
|
||||
const trovato = user.profile.mycircuits.findIndex((mycirc: any) => mycirc.circuitname === circ.name) >= 0
|
||||
if (trovato){
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
},
|
||||
|
||||
isCircuitNational(circuitname: string): boolean {
|
||||
return this.listcircuits.findIndex((rec: ICircuit) => rec.name === circuitname && rec.showAlways) >= 0
|
||||
},
|
||||
|
||||
IsNationalAndNotEnterInLocal(circuitname: string): boolean {
|
||||
const userStore = useUserStore()
|
||||
|
||||
return this.isCircuitNational(circuitname) && userStore.my.profile.mycircuits.length <= 0
|
||||
|
||||
},
|
||||
|
||||
getCircuitClass(circuit: ICircuit) {
|
||||
if (circuit.status === shared_consts.CIRCUIT_STATUS.FASE3_MONETA_ABILITATA)
|
||||
return 'circuito_abilitato'
|
||||
@@ -61,6 +103,7 @@ export const useCircuitStore = defineStore('CircuitStore', {
|
||||
return 'circuito_in_creazione'
|
||||
},
|
||||
|
||||
|
||||
getColorCircuitClass(circuit: ICircuit) {
|
||||
if (circuit.status === shared_consts.CIRCUIT_STATUS.FASE3_MONETA_ABILITATA)
|
||||
return 'green'
|
||||
|
||||
@@ -6117,6 +6117,22 @@ export const tools = {
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
SendMsgRisItalia($q: any, usernameDest: string) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const username = userStore.my.username
|
||||
|
||||
userStore.setSendCmd($q, t, username, usernameDest, shared_consts.CallFunz.ENTRA_RIS_ITALIA, null)
|
||||
.then((res: any) => {
|
||||
if (res && res.result) {
|
||||
this.updateMyData(res)
|
||||
tools.showPositiveNotif($q, res.popupOnApp)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
setRequestGroup($q: any, username: string, groupnameDest: string, value: boolean) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -100,6 +100,7 @@ export const DefaultUser: IUserFields = {
|
||||
stepTutorial: 0,
|
||||
noNameSurname: false,
|
||||
noCircuit: false,
|
||||
noCircIta: false,
|
||||
noFoto: false,
|
||||
asked_circuits: [],
|
||||
refused_circuits: [],
|
||||
@@ -168,6 +169,7 @@ export const DefaultProfile: IUserProfile = {
|
||||
stepTutorial: 0,
|
||||
noNameSurname: false,
|
||||
noCircuit: false,
|
||||
noCircIta: false,
|
||||
noFoto: false,
|
||||
asked_circuits: [],
|
||||
refused_circuits: [],
|
||||
@@ -500,7 +502,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
|
||||
// se non ho neanche 1 circuito in comune, metto il mio preferito
|
||||
if (arrfinale.length <= 0) {
|
||||
/*if (arrfinale.length <= 0) {
|
||||
const circuit = circuitStore.getCircuitByProvince(this.my.profile.resid_province)
|
||||
if (circuit)
|
||||
arrfinale.push(circuit.name)
|
||||
@@ -510,7 +512,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
} */
|
||||
|
||||
console.log('arrout', arrfinale)
|
||||
|
||||
@@ -953,6 +955,17 @@ export const useUserStore = defineStore('UserStore', {
|
||||
return await this.execDbOpUser({ mydata })
|
||||
}
|
||||
},
|
||||
async savenoCircIta(val: boolean) {
|
||||
const mydata = {
|
||||
_id: this.my._id,
|
||||
dbop: 'noCircIta',
|
||||
value: val,
|
||||
}
|
||||
if (this.my.profile.noCircIta !== val) {
|
||||
this.my.profile.noCircIta = val
|
||||
return await this.execDbOpUser({ mydata })
|
||||
}
|
||||
},
|
||||
async savenoFoto(val: boolean) {
|
||||
const mydata = {
|
||||
_id: this.my._id,
|
||||
@@ -1626,6 +1639,21 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
},
|
||||
|
||||
async setSendCmd($q: any, t: any, usernameOrig: string, usernameDest: string, cmd: number, value: any) {
|
||||
return Api.SendReq('/users/sendcmd', 'POST', { usernameOrig, usernameDest, cmd, value })
|
||||
.then((res) => {
|
||||
this.updateTables = true
|
||||
// const notifStore = useNotifStore()
|
||||
|
||||
// notifStore.updateNotification = true
|
||||
return res.data
|
||||
}).catch((error) => {
|
||||
tools.showNegativeNotif($q, t('db.recfailed'))
|
||||
return {}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
async setCircuitCmd($q: any, t: any, usernameOrig: string, circuitname: string, cmd: number, value: any, extrarec?: any) {
|
||||
return await Api.SendReq('/users/circuits/cmd', 'POST', { usernameOrig, circuitname, cmd, value, extrarec })
|
||||
.then((res) => {
|
||||
@@ -1849,12 +1877,15 @@ export const useUserStore = defineStore('UserStore', {
|
||||
|
||||
let yes = true
|
||||
|
||||
// Check if I have at least 1 Circuit
|
||||
yes = yes && (this.my.profile.mycircuits.length > 0)
|
||||
if (this.my.profile && this.my.profile.mycircuits) {
|
||||
|
||||
if (myuser && myuser.profile && myuser.profile.mycircuits) {
|
||||
// Check if myuser has at least 1 Circuit
|
||||
yes = yes && (myuser.profile.mycircuits.length > 0)
|
||||
// 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
|
||||
@@ -1902,7 +1933,7 @@ export const useUserStore = defineStore('UserStore', {
|
||||
const dateold = tools.addDays(tools.getDateNow(), -(30 * 6))
|
||||
if (this.my)
|
||||
return this.my.date_reg! && new Date(this.my.date_reg).getTime() < dateold.getTime()
|
||||
else
|
||||
else
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user