- L'utente entra direttamente sul circuito, con fido a zero.

++Abilitazione Fido utente (per admin).
This commit is contained in:
Surya Paolo
2023-06-01 11:40:26 +02:00
parent 616a6c4218
commit e805088da7
32 changed files with 481 additions and 187 deletions

View File

@@ -3818,7 +3818,7 @@ export const tools = {
,
gettextevent(myevent: any) {
// return '"' + myevent.title + '" (' + func_tools.getDateStr(myevent.date) + ') - ' + myevent.time
return '"' + (myevent.title ? myevent.title : (myevent.descr ? myevent.descr: '')) + '" (' + this.getstrDateEmailTime(myevent.dateTimeStart) + ')'
return '"' + (myevent.title ? myevent.title : (myevent.descr ? myevent.descr : '')) + '" (' + this.getstrDateEmailTime(myevent.dateTimeStart) + ')'
},
getlangforQuasar(mylang: string) {
@@ -5756,6 +5756,66 @@ export const tools = {
})
},
addFidoToMyCircuits($q: any, username: string, circuitname: string) {
const userStore = useUserStore()
const notifStore = useNotifStore()
$q.dialog({
message: t('db.domanda_addfidotocircuit', { username, circuitname }),
ok: { label: t('dialog.yes'), push: true },
cancel: { label: t('dialog.cancel') },
title: t('db.domanda')
}).onOk(() => {
userStore.setCircuitCmd($q, t, username, circuitname, shared_consts.CIRCUITCMD.SETFIDO, true)
.then((res: any) => {
if (res && res.result) {
this.updateMyData(res)
notifStore.updateNotification = true
if (res.circuit) {
if (userStore.my.profile.mycircuits)
userStore.my.profile.mycircuits = [...userStore.my.profile.mycircuits, res.circuit]
else
userStore.my.profile.mycircuits = [res]
}
tools.showPositiveNotif($q, t('db.addedfidocircuit', { circuitname }))
}
})
})
},
addFidoGroupToMyCircuits($q: any, groupname: string, circuitname: string) {
const userStore = useUserStore()
const notifStore = useNotifStore()
$q.dialog({
message: t('db.domanda_addgrouptocircuit', { groupname, circuitname }),
ok: { label: t('dialog.yes'), push: true },
cancel: { label: t('dialog.cancel') },
title: t('db.domanda')
}).onOk(() => {
let extrarec = {
groupname,
}
userStore.setCircuitCmd($q, t, userStore.my.username, circuitname, shared_consts.CIRCUITCMD.SETFIDO, true, extrarec)
.then((res: any) => {
if (res && res.result) {
this.updateMyData(res)
notifStore.updateNotification = true
if (res.circuit) {
if (userStore.my.profile.mycircuits)
userStore.my.profile.mycircuits = [...userStore.my.profile.mycircuits, res.circuit]
else
userStore.my.profile.mycircuits = [res]
}
tools.showPositiveNotif($q, t('db.addedfidocircuit', { circuitname }))
}
})
})
},
addToMyGroups($q: any, username: string, groupnameDest: string) {
const userStore = useUserStore()
@@ -6276,44 +6336,32 @@ export const tools = {
const userStore = useUserStore()
let msg = ''
if (value) {
msg = t('circuit.domanda_ask', { circuitname })
} else {
msg = t('circuit.domanda_revoke', { circuitname })
}
$q.dialog({
message: msg,
ok: {
label: t('dialog.yes'),
push: true
},
cancel: {
label: t('dialog.cancel')
},
title: t('db.domanda')
}).onOk(() => {
userStore.setCircuitCmd($q, t, username, circuitname, shared_consts.CIRCUITCMD.REQ, value, { groupname })
.then((res: any) => {
if (res) {
if (value) {
// ADD to req
userStore.my.profile.asked_circuits.push(res.circuit)
tools.showPositiveNotif($q, t('circuit.askedto', { circuitname }))
} else {
// REMOVE to req
userStore.my.profile.asked_circuits = userStore.my.profile.asked_circuits.filter((rec: ICircuit) => rec.name !== circuitname)
tools.showPositiveNotif($q, t('circuit.revoketo', { circuitname }))
}
this.updateMyData(res)
userStore.setCircuitCmd($q, t, username, circuitname, shared_consts.CIRCUITCMD.REQ, value, { groupname })
.then((res: any) => {
if (res) {
if (value) {
// ADD to req
userStore.my.profile.asked_circuits.push(res.circuit)
tools.showPositiveNotif($q, t('circuit.askedto', { circuitname }))
} else {
tools.showNegativeNotif($q, t('db.recfailed'))
// REMOVE to req
userStore.my.profile.asked_circuits = userStore.my.profile.asked_circuits.filter((rec: ICircuit) => rec.name !== circuitname)
tools.showPositiveNotif($q, t('circuit.revoketo', { circuitname }))
}
})
})
this.updateMyData(res)
} else {
tools.showNegativeNotif($q, t('db.recfailed'))
}
})
},
getDestStrByExtraRec(extrarec: any) {
return extrarec.groupdest ? extrarec.groupdest : (extrarec.contoComDest ? extrarec.contoComDest : extrarec.dest)
},
getOrigStrBySendNotif(extrarec: any) {
return extrarec.grouporig ? extrarec.grouporig : (extrarec.contoComOrig ? extrarec.contoComOrig : extrarec.sender)
},
async sendCoinsByCircuit($q: any, circuit: ICircuit, sendcoinrec: ISendCoin) {
@@ -6523,6 +6571,10 @@ export const tools = {
let risultato = false
if (userStore.isAdmin) {
return true
}
if (userStore.my.profile.manage_mycircuits) {
const ris = userStore.my.profile.manage_mycircuits.find((circuit: ICircuit) => {
if (circuit.name === circuitname) {
@@ -6622,6 +6674,9 @@ export const tools = {
isUserAdminGroup(groupname: string, username: string) {
const userStore = useUserStore()
if (userStore.my.username === username && userStore.isAdmin) {
return true
}
let risultato = false
if (userStore.my.profile.manage_mygroups) {
@@ -6664,6 +6719,10 @@ export const tools = {
isUserTheCreatorOfTheCircuit(name: string, username: string) {
const userStore = useUserStore()
if (userStore.my.username === username && userStore.isAdmin) {
return true
}
let risultato = false
if (userStore.my.profile.manage_mycircuits) {
@@ -6684,6 +6743,10 @@ export const tools = {
isUserAdminCircuit(name: string, username: string) {
const userStore = useUserStore()
if (userStore.my.username === username && userStore.isAdmin) {
return true
}
let risultato = false
if (userStore.my.profile.manage_mycircuits) {