Send Coins

This commit is contained in:
Paolo Arena
2022-09-12 18:36:54 +02:00
parent d28050e71f
commit f59691985a
28 changed files with 507 additions and 95 deletions

View File

@@ -3154,6 +3154,8 @@ export const tools = {
this.showNegativeNotif(mythisq, t('reg.err.rec_already_exist_name') + ' ' + msg)
} else if (riscode === serv_constants.RIS_CODE_REC_ALREADY_EXIST_CODE) {
this.showNegativeNotif(mythisq, t('reg.err.rec_already_exist_code') + ' ' + msg)
} else if (riscode === serv_constants.RIS_CODE_REC_ALREADY_EXIST_SYMBOL) {
this.showNegativeNotif(mythisq, t('reg.err.rec_already_exist_symbol') + ' ' + msg)
}
},
@@ -4791,7 +4793,11 @@ export const tools = {
userStore.setCircuitCmd($q, t, username, recsendcoin.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT, 0, recsendcoin)
.then((res: any) => {
if (res) {
tools.showPositiveNotif($q, t('circuit.coins_accepted'))
if (res.cansend) {
tools.showPositiveNotif($q, t('circuit.coins_accepted'))
} else {
tools.showNegativeNotif($q, res.errormsg)
}
}
})
},
@@ -5282,13 +5288,15 @@ export const tools = {
return userStore.setCircuitCmd($q, t, username, sendcoinrec.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_REQ, true, sendcoinrec)
.then((res: any) => {
if (res) {
if (res.cansend) {
tools.showPositiveNotif($q, t('circuit.coins_sendrequest_sent'))
} else {
tools.showNegativeNotif($q, t('circuit.coins_sendrequest_failed'))
tools.showNegativeNotif($q, res.errormsg)
}
})
})
return null
},
cancelReqCircuit($q: any, username: string, circuitname: string) {
@@ -6264,12 +6272,14 @@ export const tools = {
},
isTypeByRecMov(rec: IMovVisu) {
const userStore = useUserStore()
let type = costanti.TypeMov.Nessuno
if (userStore.my.username === rec.userfrom.username) {
type = rec.amount > 0 ? costanti.TypeMov.Uscita : (rec.amount < 0 ? costanti.TypeMov.Entrata : costanti.TypeMov.Nessuno)
} else if (userStore.my.username === rec.userto.username) {
type = rec.amount > 0 ? costanti.TypeMov.Entrata : (rec.amount < 0 ? costanti.TypeMov.Uscita : costanti.TypeMov.Nessuno)
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)
} else if (userStore.my.username === rec.userto.username) {
type = rec.amount > 0 ? costanti.TypeMov.Entrata : (rec.amount < 0 ? costanti.TypeMov.Uscita : costanti.TypeMov.Nessuno)
}
}
return type
@@ -6278,6 +6288,35 @@ export const tools = {
return this.isTypeByRecMov(rec) === costanti.TypeMov.Entrata
},
getSymbolByCircuit(circuit: any) {
try {
if (circuit.symbol) {
return circuit.symbol
} else {
if (circuit.circuitfrom.symbol) {
return circuit.circuitfrom.symbol
} else {
return ''
}
}
}catch (e) {
return ''
}
},
getColorByCircuit(circuit: any) {
if (circuit.color) {
return circuit.color
} else {
return ''
}
},
getRemainingCoinsToSend(account: IAccount) {
return account.saldo + account.fidoConcesso;
},
getMaxCoinsToSend(account: IAccount) {
return account.qta_maxConcessa - account.saldo;
},
// getLocale() {
// if (navigator.languages && navigator.languages.length > 0) {
// return navigator.languages[0]