Circuits OK
Accounts Ok Movements OK
This commit is contained in:
@@ -67,6 +67,7 @@ export const tools = {
|
||||
FRIENDS_SEARCH: 'FR_SE',
|
||||
GROUP_SEARCH: 'GR_SE',
|
||||
CIRCUIT_SEARCH: 'CI_SE',
|
||||
CIRCUIT_USE: 'CIR_U',
|
||||
|
||||
getprefCountries: ['it', 'es', 'us'],
|
||||
|
||||
@@ -4328,6 +4329,7 @@ export const tools = {
|
||||
'blue': '#0000ff',
|
||||
'blue-3': '#90caf9',
|
||||
'blue-4': '#64b5f6',
|
||||
'amber-10': '#ff6f00',
|
||||
'blue-6': '#2196f3',
|
||||
'blueviolet': '#8a2be2',
|
||||
'brown': '#a52a2a',
|
||||
@@ -4796,6 +4798,10 @@ export const tools = {
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
if (res.cansend) {
|
||||
if (res.user) {
|
||||
userStore.my = res.user
|
||||
}
|
||||
console.log('useraccounts', userStore.my.profile.useraccounts)
|
||||
tools.showPositiveNotif($q, t('circuit.coins_accepted'))
|
||||
} else {
|
||||
tools.showNegativeNotif($q, res.errormsg)
|
||||
@@ -4804,10 +4810,11 @@ export const tools = {
|
||||
})
|
||||
},
|
||||
|
||||
refuseCoins($q: any, username: string, recsendcoin: ISendCoin) {
|
||||
refuseCoins($q: any, username: string, notif: any) {
|
||||
|
||||
const userStore = useUserStore()
|
||||
userStore.setCircuitCmd($q, t, username, recsendcoin.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_REFUSE, recsendcoin)
|
||||
notif.extrarec.notifId = notif._id
|
||||
userStore.setCircuitCmd($q, t, username, notif.extrarec.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_REFUSE, 0, notif.extrarec)
|
||||
.then((res: any) => {
|
||||
if (res) {
|
||||
tools.showPositiveNotif($q, t('circuit.coins_refused'))
|
||||
@@ -5295,6 +5302,9 @@ export const tools = {
|
||||
if (res.useraccounts && res.useraccounts.length > 0) {
|
||||
userStore.my.profile.useraccounts = res.useraccounts
|
||||
}
|
||||
if (res.user) {
|
||||
userStore.my = res.user
|
||||
}
|
||||
tools.showPositiveNotif($q, t('circuit.coins_sendrequest_sent'))
|
||||
} else {
|
||||
tools.showNegativeNotif($q, res.errormsg)
|
||||
@@ -5344,7 +5354,7 @@ export const tools = {
|
||||
if (username === userStore.my.username) {
|
||||
userStore.my.profile.asked_circuits = userStore.my.profile.asked_circuits.filter((rec: ICircuit) => rec.name !== circuitname)
|
||||
}
|
||||
tools.showPositiveNotif($q, t('db.refusedcircuit', { username }))
|
||||
tools.showPositiveNotif($q, t('circuit.refusedcircuit', { username }))
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -5653,8 +5663,18 @@ export const tools = {
|
||||
tools.addToMyCircuits($q, username, dest)
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.REQ) {
|
||||
tools.setRequestCircuit($q, username, dest, value)
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.CANCEL_REQ) {
|
||||
tools.cancelReqCircuit($q, username, dest)
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.REFUSE_REQ) {
|
||||
tools.refuseReqCircuit($q, username, dest)
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.DELETE) {
|
||||
tools.DeleteCircuit($q, username, dest)
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.ADDADMIN) {
|
||||
tools.addtoAdminOfCircuit($q, username, dest)
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.REMOVEADMIN) {
|
||||
tools.removeAdminOfCircuit($q, username, dest)
|
||||
} else if (cmd === shared_consts.CIRCUITCMD.REMOVE_FROM_MYLIST) {
|
||||
tools.removeFromMyCircuits($q, username, dest)
|
||||
}
|
||||
},
|
||||
isCallable(anything: any) {
|
||||
@@ -6257,8 +6277,13 @@ export const tools = {
|
||||
|
||||
// Function to return commonElements
|
||||
getCommon(arr1: any, arr2: any, field: string): any[] {
|
||||
arr1.sort((a: any, b: any) => b[field] - a[field]) // Sort both the arrays
|
||||
arr2.sort((a: any, b: any) => b[field] - a[field])
|
||||
// @ts-ignore
|
||||
arr1.sort((a: any, b: any) => (a[field] > b[field]) - (a[field] < b[field])) // Sort both the arrays
|
||||
// @ts-ignore
|
||||
arr2.sort((a: any, b: any) => (a[field] > b[field]) - (a[field] < b[field]))
|
||||
|
||||
// console.log('arr1', arr1)
|
||||
// console.log('arr2', arr2)
|
||||
let common = [] // Array to contain common elements
|
||||
let i = 0, j = 0 // i points to arr1 and j to arr2
|
||||
// Break if one of them runs out
|
||||
@@ -6284,9 +6309,9 @@ export const tools = {
|
||||
if (rec && rec.userfrom) {
|
||||
const userStore = useUserStore()
|
||||
if (userStore.my.username === rec.userfrom.username) {
|
||||
type = rec.amount > 0 ? costanti.TypeMov.Uscita : (rec.amount < 0 ? costanti.TypeMov.Entrata : costanti.TypeMov.Nessuno)
|
||||
type = costanti.TypeMov.Uscita
|
||||
} else if (userStore.my.username === rec.userto.username) {
|
||||
type = rec.amount > 0 ? costanti.TypeMov.Entrata : (rec.amount < 0 ? costanti.TypeMov.Uscita : costanti.TypeMov.Nessuno)
|
||||
type = costanti.TypeMov.Entrata
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user