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

@@ -275,6 +275,7 @@ export const costanti = {
link: 12500,
listobj: 13000,
label: 14000,
currency: 15000,
},

View File

@@ -65,6 +65,7 @@ function AddCol(params: IColGridTable) {
subfield_extra1: (params.subfield_extra1 === undefined) ? '' : params.subfield_extra1,
allowNewValue: (params.allowNewValue === undefined) ? false : params.allowNewValue,
showpicprofile_ifnotset: (params.showpicprofile_ifnotset === undefined) ? false : params.showpicprofile_ifnotset,
extrafield: (params.extrafield === undefined) ? '' : params.extrafield,
visible: (params.visible === undefined) ? true : params.visible,
icon: (params.icon === undefined) ? '' : params.icon,
action: (params.action === undefined) ? '' : params.action,
@@ -531,6 +532,7 @@ export const colmyMovement = [
fieldtype: costanti.FieldType.username_chip,
link: '/my/userfrom.username',
noshowlabel: true,
extrafield: 'movement.from',
}),
AddCol({
name: 'userto.username',
@@ -541,11 +543,12 @@ export const colmyMovement = [
tipovisu: costanti.TipoVisu.LINK,
fieldtype: costanti.FieldType.username_chip,
link: '/my/userto.username',
extrafield: 'movement.to',
noshowlabel: true,
}),
AddCol({ name: 'amount', label_trans: 'movement.amount',
fieldtype: costanti.FieldType.string, required: true, tipovisu: costanti.TipoVisu.TESTO_BORDATO }),
fieldtype: costanti.FieldType.currency, required: true, tipovisu: costanti.TipoVisu.TESTO_BORDATO }),
AddCol({ name: 'causal', label_trans: 'movement.causal', tipovisu: costanti.TipoVisu.TESTO_BORDATO }),
]
@@ -2415,11 +2418,13 @@ export const colTableSubCashCategory = [
export const colTableCircuitComplete = [
AddCol({ name: 'Num', label_trans: 'circuit.num', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId', fieldtype: costanti.FieldType.select, jointable: 'mygroups' }), // da togliere poi
// AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId', fieldtype: costanti.FieldType.select, jointable: 'mygroups' }), // da togliere poi
AddCol({ name: 'name', label_trans: 'circuit.name',
maxlength: 40,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage }),
AddCol({ name: 'path', label_trans: 'circuit.path' }),
AddCol({ name: 'path', label_trans: 'circuit.path',
allowchar: costanti.ALLOWCHAR_CODE,
}),
AddCol({ name: 'subname', label_trans: 'circuit.subname' }),
AddCol({ name: 'longdescr', label_trans: 'circuit.descr', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'regulation', label_trans: 'circuit.regulation', fieldtype: costanti.FieldType.html }),
@@ -2428,14 +2433,15 @@ export const colTableCircuitComplete = [
AddCol({ name: 'createdBy', label_trans: 'circuit.founder', fieldtype: costanti.FieldType.select, jointable: 'users', }),
AddCol({ name: 'totCircolante', label_trans: 'circuit.totCircolante', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'totTransato', label_trans: 'circuit.totTransato', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'nome_valuta', label_trans: 'circuit.nome_valuta' }),
// AddCol({ name: 'nome_valuta', label_trans: 'circuit.nome_valuta' }),
AddCol({ name: 'symbol', label_trans: 'circuit.symbol' }),
AddCol({ name: 'color', label_trans: 'circuit.color' }),
AddCol({ name: 'abbrev', label_trans: 'circuit.abbrev' }),
AddCol({ name: 'compara_valuta', label_trans: 'circuit.compara_valuta', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'compara_euro', label_trans: 'circuit.compara_euro', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'valuta_per_euro', label_trans: 'circuit.valuta_per_euro', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'fido_scoperto_default', label_trans: 'circuit.fido_scoperto_default', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'qta_max_default', label_trans: 'circuit.qta_max_default', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'fido_scoperto_default', label_trans: 'circuit.fido_scoperto_default', fieldtype: costanti.FieldType.currency }),
AddCol({ name: 'qta_max_default', label_trans: 'circuit.qta_max_default', fieldtype: costanti.FieldType.currency }),
AddCol({ name: 'data_costituz', label_trans: 'circuit.data_costituz', fieldtype: costanti.FieldType.date }),
AddCol({ name: 'deperimento', label_trans: 'circuit.deperimento', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'freq_deper', label_trans: 'circuit.freq_deper' }),
@@ -2480,12 +2486,16 @@ export const colTableCircuitComplete = [
]
export const colTableCircuit = [
AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId', fieldtype: costanti.FieldType.select, jointable: 'mygroups' }), // da togliere poi
// AddCol({ name: 'groupnameId', label_trans: 'circuit.groupnameId', fieldtype: costanti.FieldType.select, jointable: 'mygroups' }), // da togliere poi
AddCol({ name: 'name', label_trans: 'circuit.name',
required: true,
maxlength: 40,
maxlength: 30,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InView }),
AddCol({ name: 'path', label_trans: 'circuit.path', required: true }),
AddCol({ name: 'path', label_trans: 'circuit.path', required: true,
maxlength: 30,
showWhen: costanti.showWhen.NewRec + costanti.showWhen.InPage + costanti.showWhen.InView,
allowchar: costanti.ALLOWCHAR_CODE,
}),
AddCol({ name: 'subname', label_trans: 'circuit.subname' }),
AddCol({ name: 'longdescr', label_trans: 'circuit.descr', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'systemUserId', label_trans: 'circuit.systemUserId', fieldtype: costanti.FieldType.select, jointable: 'users', }),
@@ -2504,12 +2514,15 @@ export const colTableCircuit = [
sortable: true,
showWhen: 0
}),
AddCol({ name: 'nome_valuta', label_trans: 'circuit.nome_valuta', required: true }),
// AddCol({ name: 'nome_valuta', label_trans: 'circuit.nome_valuta', required: true }),
AddCol({ name: 'symbol', label_trans: 'circuit.symbol' }),
AddCol({ name: 'color', label_trans: 'circuit.color' }),
AddCol({ name: 'fido_scoperto_default', label_trans: 'circuit.fido_scoperto_default',
fieldtype: costanti.FieldType.number, required: true, visulabel: true }),
fieldtype: costanti.FieldType.currency, required: true, visulabel: true }),
AddCol({ name: 'qta_max_default', label_trans: 'circuit.qta_max_default',
fieldtype: costanti.FieldType.number, required: true, visulabel: true }),
fieldtype: costanti.FieldType.currency, required: true, visulabel: true }),
AddCol({ name: 'regulation', label_trans: 'circuit.regulation', fieldtype: costanti.FieldType.html }),
AddCol({ name: 'deperimento', label_trans: 'circuit.deperimento', fieldtype: costanti.FieldType.boolean }),
AddCol({ name: 'data_costituz', label_trans: 'circuit.data_costituz', fieldtype: costanti.FieldType.date }),
AddCol({
name: 'photos',
@@ -2531,7 +2544,7 @@ export const colmyUserCircuit = [
AddCol({ name: 'fidoConcesso', label_trans: 'account.fidoConcesso', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'qta_maxConcessa', label_trans: 'account.qta_maxConcessa', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'importo_iniziale', label_trans: 'account.importo_iniziale', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'saldo', label_trans: 'account.saldo', fieldtype: costanti.FieldType.number }),
AddCol({ name: 'saldo', label_trans: 'account.saldo', fieldtype: costanti.FieldType.currency }),
AddCol({ name: 'deleted', label_trans: 'reg.deleted', fieldtype: costanti.FieldType.boolean }),
AddCol(DeleteRec),
AddCol(DuplicateRec),

View File

@@ -6,6 +6,7 @@ export const serv_constants = {
RIS_CODE_EMAIL_ALREADY_VERIFIED: -5,
RIS_CODE_EMAIL_VERIFIED: 1,
RIS_CODE_REC_ALREADY_EXIST_SYMBOL: -102,
RIS_CODE_REC_ALREADY_EXIST_CODE: -101,
RIS_CODE_REC_ALREADY_EXIST_NAME: -100,
RIS_CODE_USER_APORTADOR_NOT_VALID: -75,

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]

View File

@@ -1676,7 +1676,7 @@ export const useGlobalStore = defineStore('GlobalStore', {
myserv = window.location.host
if (process.env.DEBUGGING) {
myserv = 'http://localhost:3000'; // 'http://192.168.1.54:3000'
myserv = 'http://192.168.1.103:3000'; // 'http://192.168.1.54:3000'
}
if (!myserv) {