Visu Sent Monete

This commit is contained in:
Paolo Arena
2022-09-13 12:28:33 +02:00
parent f59691985a
commit 44c75768c6
29 changed files with 301 additions and 69 deletions

View File

@@ -58,7 +58,6 @@ export default defineComponent({
return { return {
showingtooltip, showingtooltip,
t, t,
$q,
} }
}, },
}) })

View File

@@ -27,7 +27,7 @@
<q-icon v-else name="fas fa-coins" size="sm"/> <q-icon v-else name="fas fa-coins" size="sm"/>
</template> </template>
<template v-slot:control> <template v-slot:control>
<div class="align_elem_right">{{ value }} <div class="align_elem_right">{{ value.toFixed(2) }}
<q-tooltip :offset="[10, 10]" v-model="showingtooltip">{{tips}}</q-tooltip> <q-tooltip :offset="[10, 10]" v-model="showingtooltip">{{tips}}</q-tooltip>
</div> </div>
</template> </template>

View File

@@ -114,6 +114,8 @@ export default defineComponent({
const mypagination = computed(() => { const mypagination = computed(() => {
if (props.table === toolsext.TABMYBACHECAS) if (props.table === toolsext.TABMYBACHECAS)
return { sortBy: 'dateTimeStart', descending: false, page: 1, rowsNumber: 20, rowsPerPage: 20 } return { sortBy: 'dateTimeStart', descending: false, page: 1, rowsNumber: 20, rowsPerPage: 20 }
else if (props.table === toolsext.TABMOVEMENTS)
return { sortBy: 'transactionDate', descending: true, page: 1, rowsNumber: 20, rowsPerPage: 20 }
return { sortBy: 'date_created', descending: true, page: 1, rowsNumber: 20, rowsPerPage: 20 } return { sortBy: 'date_created', descending: true, page: 1, rowsNumber: 20, rowsPerPage: 20 }
}) })

View File

View File

@@ -0,0 +1,75 @@
import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
import { useGlobalStore } from '@store/globalStore'
import { useUserStore } from '@store/UserStore'
import { fieldsTable } from '@store/Modules/fieldsTable'
import { tools } from '@store/Modules/tools'
import { costanti } from '@costanti'
import { shared_consts } from '@/common/shared_vuejs'
import { CMyFieldDb } from '@/components/CMyFieldDb'
import { CDateTime } from '@/components/CDateTime'
import { toolsext } from '@src/store/Modules/toolsext'
import { computed } from 'vue'
import { INotif } from 'model'
import { useNotifStore } from '@store/NotifStore'
import { useCircuitStore } from '@store/CircuitStore'
import { useRouter } from 'vue-router'
import MixinUsers from '@/mixins/mixin-users'
export default defineComponent({
name: 'CNotifAtTop',
props: {
},
components: { },
setup(props, { emit }) {
const q = useQuasar()
const { t } = useI18n()
const globalStore = useGlobalStore()
const userStore = useUserStore()
const notifStore = useNotifStore()
const circuitStore = useCircuitStore()
const $router = useRouter()
const { getImgByNotif, getNotifText, getTypeDirNotif, getTypeIdNotif } = MixinUsers()
const lasts_notifs_req = computed(() => notifStore.getnotifs_coinsreq())
const num_notifs = computed(() => lasts_notifs_req.value.length)
function mounted() {
//
}
function clickNotif(notif: INotif) {
if (notif.openUrl) {
let mylink = tools.updateQueryStringParameter(notif.openUrl, 'idnotif', notif._id)
console.log('mylink', mylink, notif._id)
if (mylink) {
$router.replace(mylink)
}
}
}
onMounted(mounted)
return {
q,
t,
getImgByNotif,
getNotifText,
getTypeDirNotif,
getTypeIdNotif,
tools,
costanti,
shared_consts,
fieldsTable,
globalStore,
toolsext,
lasts_notifs_req,
num_notifs,
clickNotif,
}
},
})

View File

@@ -0,0 +1,58 @@
<template>
<q-banner
v-if="num_notifs > 0"
rounded
dense
class="bg-primary text-white"
color="primary q-title"
style="text-align: center;">
<template v-slot:avatar>
<q-icon name="fas fa-exclamation-triangle" color="yellow" size="xs" />
</template>
<q-item clickable v-for="(notif, index) in lasts_notifs_req" :key="index">
<!--<q-item-section avatar>
<q-avatar>
<q-item-label lines="1">{{ getTypeDirNotif(notif) }}</q-item-label>
</q-avatar>
</q-item-section>-->
<q-item-section avatar>
<q-avatar>
<img :src="notif.myimgsender" :alt="notif.sender">
</q-avatar>
</q-item-section>
<q-item-section v-ripple>
<q-item-label lines="5" :class="(!notif.read) ? 'unread' : 'read'" @click="clickNotif(notif)">
<div v-html="getNotifText($t, notif, false)"></div>
</q-item-label>
<q-item-label caption lines="2"
v-if="notif.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS && notif.status === 0 && notif.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ"
v-ripple>
<div class="row no-wrap justify-evenly q-pa-sm">
<q-btn
size="md"
icon="fas fa-coins"
color="positive" :label="$t('circuit.accept_coins_qty', {qty: notif.extrarec.qty, symbol: notif.extrarec.symbol})"
@click="tools.acceptCoins(q, notif.sender, notif)"
/>
<q-btn
size="md"
color="negative" :label="$t('circuit.refuse_coins_qty', {qty: notif.extrarec.qty, symbol: notif.extrarec.symbol})"
@click="tools.refuseCoins(q, notif.sender, notif.extrarec)"
/>
</div>
</q-item-label>
</q-item-section>
</q-item>
</q-banner>
</template>
<script lang="ts" src="./CNotifAtTop.ts">
</script>
<style lang="scss" scoped>
@import './CNotifAtTop.scss';
</style>

View File

@@ -0,0 +1 @@
export {default as CNotifAtTop} from './CNotifAtTop.vue'

View File

@@ -7,6 +7,8 @@ import { useUserStore } from '@store/UserStore'
import { useCircuitStore } from '@store/CircuitStore' import { useCircuitStore } from '@store/CircuitStore'
import { useQuasar } from 'quasar' import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n' import { useI18n } from '@/boot/i18n'
import { CMyUser } from '@/components/CMyUser'
import { costanti } from '@costanti'
export default defineComponent({ export default defineComponent({
name: 'CSendCoins', name: 'CSendCoins',
@@ -21,7 +23,7 @@ export default defineComponent({
required: true, required: true,
}, },
}, },
components: { CCurrencyValue }, components: { CCurrencyValue, CMyUser },
setup(props, { emit }) { setup(props, { emit }) {
const $q = useQuasar() const $q = useQuasar()
@@ -42,11 +44,13 @@ export default defineComponent({
const accountloaded = ref(<IAccount | undefined>undefined) const accountloaded = ref(<IAccount | undefined>undefined)
const accountdest = ref(<IAccount | undefined>undefined) const accountdest = ref(<IAccount | undefined>undefined)
const remainingCoins = ref(0) const remainingCoins = ref(0)
const maxsendable = ref(0)
const numstep = ref(0)
const priceLabel = computed(() => circuitloaded.value ? `${qty.value} ` + circuitloaded.value.symbol : '') const priceLabel = computed(() => circuitloaded.value ? `${qty.value} ` + circuitloaded.value.symbol : '')
const arrayMarkerLabel = ref(<any>[]) const arrayMarkerLabel = ref(<any>[])
const qtyRef = ref(null) const qtyRef = ref(<any>null)
watch(() => circuitsel.value, (newval, oldval) => { watch(() => circuitsel.value, (newval, oldval) => {
aggiorna() aggiorna()
@@ -63,15 +67,30 @@ export default defineComponent({
accountloaded.value = userStore.getAccountByCircuitId(circuitloaded.value._id) accountloaded.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
// accountdest.value = userStore.getAccountByCircuitId(circuitloaded.value._id) // accountdest.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
if (accountloaded.value) { if (accountloaded.value) {
remainingCoins.value = tools.getRemainingCoinsToSend(accountloaded.value) remainingCoins.value = circuitStore.getRemainingCoinsToSend(accountloaded.value)
const quanti = [ ...Array(100).keys() ].map( i => i+1) if (accountloaded.value.saldo > 0) {
maxsendable.value = accountloaded.value.saldo + accountloaded.value.fidoConcesso
} else {
maxsendable.value = accountloaded.value.fidoConcesso
}
if (remainingCoins.value < 10) {
remainingCoins.value = 10
}
numstep.value = Math.round(maxsendable.value / 10)
if (numstep.value < 1) {
numstep.value = 1
}
const quanti = [...Array(20).keys()].map(i => i + 1)
for (const ind of quanti) { for (const ind of quanti) {
let value = ind * 10 let value = ind * numstep.value
if (value > remainingCoins.value) { if (value > remainingCoins.value) {
break break
} else { } else {
const label = value.toString() const label = value.toString()
arrayMarkerLabel.value.push({value, label}) arrayMarkerLabel.value.push({ value, label })
} }
} }
} }
@@ -108,15 +127,15 @@ export default defineComponent({
if (props.to_user.username && qty.value && circuitloaded.value) { if (props.to_user.username && qty.value && circuitloaded.value) {
const myrecsendcoin: ISendCoin = { const myrecsendcoin: ISendCoin = {
qty: qty.value, qty: tools.convstrToNum(qty.value),
dest: props.to_user.username, dest: props.to_user.username,
circuitname: circuitsel.value, circuitname: circuitsel.value,
causal: causal.value, causal: causal.value,
symbol: circuitloaded.value.symbol, symbol: circuitloaded.value.symbol,
} }
console.log('myrecsendcoin', myrecsendcoin) if (myrecsendcoin) {
if (circuitloaded.value) { tools.sendCoinsByCircuit($q, circuitloaded.value, myrecsendcoin)
tools.sendCoinsByCircuit($q, circuitloaded.value, myrecsendcoin).then((ris: any) => { .then((ris: any) => {
if (ris) { if (ris) {
show.value = false show.value = false
} }
@@ -145,6 +164,11 @@ export default defineComponent({
arrayMarkerLabel, arrayMarkerLabel,
remainingCoins, remainingCoins,
qtyRef, qtyRef,
maxsendable,
circuitStore,
numstep,
costanti,
userStore,
} }
}, },
}) })

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<q-dialog v-model="show" :maximized="$q.screen.lt.sm" @hide="hide"> <q-dialog v-model="show" :maximized="$q.screen.lt.sm" @hide="hide" @show="qtyRef.focus()">
<q-card class="dialog_card"> <q-card class="dialog_card">
<q-toolbar class="bg-primary text-white"> <q-toolbar class="bg-primary text-white">
<q-toolbar-title> <q-toolbar-title>
@@ -22,24 +22,31 @@
</CCurrencyValue> </CCurrencyValue>
<q-input v-model="from_username" label="Mittente" class="full-width" disable> <q-input v-model="from_username" label="Mittente" class="full-width" readonly>
</q-input>
<q-input v-model="to_user.username" label="Destinatario" class="full-width" disable>
</q-input> </q-input>
<CMyUser
:mycontact="to_user"
:visu="costanti.FIND_PEOPLE"
@setCmd="tools.setCmd"
labelextra="Destinatario"
>
</CMyUser>
<q-input v-model="causal" label="Note" class="full-width"> <q-input v-model="causal" label="Note" class="full-width">
</q-input> </q-input>
<div>
<q-input <q-input
ref="qtyRef" ref="qtyRef"
class="q-px-sm text-h5" class="q-py-sm text-h5"
outlined v-model="qty" type="number" outlined v-model="qty" type="number"
:rules="[ val => val < tools.getRemainingCoinsToSend(accountloaded) || t('circuit.qta_remaining_to_send', { maxqta: tools.getRemainingCoinsToSend(accountloaded), symbol: circuitloaded.symbol })]" :label="t('movement.amount')" :rules="[ val => val <= circuitStore.getRemainingCoinsToSend(accountloaded) || t('circuit.qta_remaining_to_send', { maxqta: circuitStore.getRemainingCoinsToSend(accountloaded), symbol: circuitloaded.symbol })]"
:label="t('movement.amount_to_send', {qtamax: circuitStore.getRemainingCoinsToSend(accountloaded).toFixed(2) + ` ` + circuitloaded.symbol})"
> >
<!--val => val > tools.getMaxCoinsToSend(accountloaded) || t('circuit.qta_max_to_send', { maxqta: tools.getRemainingCoinsToSend(accountloaded), symbol: circuitloaded.symbol })]" --> <!--val => val > circuitStore.getMaxCoinsToSend(accountloaded) || t('circuit.qta_max_to_send', { maxqta: tools.getRemainingCoinsToSend(accountloaded), symbol: circuitloaded.symbol })]" -->
<template v-slot:append> <template v-slot:append>
<div class="text-h5"> <div class="text-h5">
<em class="q-px-sm text-white rounded-borders" :style="`background-color: ` + (circuitloaded.color ? circuitloaded.color : '#ff5500')">{{ circuitloaded.symbol }}</em> <em class="q-px-sm text-white rounded-borders"
:style="`background-color: ` + (circuitloaded.color ? circuitloaded.color : '#ff5500')">{{ circuitloaded.symbol }}</em>
</div> </div>
</template> </template>
</q-input> </q-input>
@@ -48,7 +55,8 @@
v-model="qty" v-model="qty"
color="green" color="green"
markers markers
:step="5" track-size="10px"
:step="numstep"
:marker-labels="arrayMarkerLabel" :marker-labels="arrayMarkerLabel"
label-always label-always
:label-value="priceLabel" :label-value="priceLabel"
@@ -56,14 +64,15 @@
switch-marker-labels-side switch-marker-labels-side
:inner-max="remainingCoins" :inner-max="remainingCoins"
:min="0" :min="0"
:max="accountloaded.fidoConcesso" :max="Number(maxsendable.toFixed(2))"
/> />
</div>
</q-card-section> </q-card-section>
<q-card-actions align="center"> <q-card-actions align="center">
<q-btn <q-btn
:disable="qtyRef ? qtyRef.hasError : false" :disable="qtyRef ? qtyRef.hasError : false"
:label="$t('circuit.sendcoinsto', {qty, coin: circuitsel, dest: to_user.username })" color="primary" :label="$t('circuit.sendcoinsto', {qty, coin: circuitsel, dest: to_user.username })" color="positive"
@click="sendCoin()"></q-btn> @click="sendCoin()"></q-btn>
<q-btn flat :label="$t('dialog.cancel')" color="primary" v-close-popup></q-btn> <q-btn flat :label="$t('dialog.cancel')" color="primary" v-close-popup></q-btn>
</q-card-actions> </q-card-actions>

View File

@@ -62,3 +62,4 @@ export * from './CNotifSettings'
// export * from './CPreloadImages' // export * from './CPreloadImages'
export * from './CSendCoins' export * from './CSendCoins'
export * from './CCurrencyValue' export * from './CCurrencyValue'
export * from './CNotifAtTop'

View File

@@ -163,7 +163,7 @@
size="sm" size="sm"
icon="fas fa-user-plus" icon="fas fa-user-plus"
color="positive" :label="$t('circuit.accept_coins')" color="positive" :label="$t('circuit.accept_coins')"
@click="tools.acceptCoins($q, notif.sender, notif.extrarec)" @click="tools.acceptCoins($q, notif.sender, notif)"
/> />
<q-btn <q-btn
dense dense

View File

@@ -12,6 +12,7 @@ import { CUserNonVerif } from '@/components/CUserNonVerif'
import { CTitlePage } from '@/components/CTitlePage' import { CTitlePage } from '@/components/CTitlePage'
import { CMapsEsempio } from '@src/components/CMapsEsempio' import { CMapsEsempio } from '@src/components/CMapsEsempio'
import { CVerifyEmail } from '@src/components/CVerifyEmail' import { CVerifyEmail } from '@src/components/CVerifyEmail'
import { CNotifAtTop } from '@src/components/CNotifAtTop'
import { CVerifyTelegram } from '@src/components/CVerifyTelegram' import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
import { LandingFooter } from '@/components/LandingFooter' import { LandingFooter } from '@/components/LandingFooter'
import { useGlobalStore } from '@store/globalStore' import { useGlobalStore } from '@store/globalStore'
@@ -22,7 +23,8 @@ import MixinUsers from '@/mixins/mixin-users'
export default defineComponent({ export default defineComponent({
name: 'Goods', name: 'Goods',
components: { CSkill, CChartMap, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter }, components: { CSkill, CChartMap, CMapsEsempio, CFinder,
CNotifAtTop, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter },
setup() { setup() {
return { return {

View File

@@ -2,6 +2,7 @@
<q-page class=""> <q-page class="">
<div v-if="tools.isLogged()"> <div v-if="tools.isLogged()">
<CNotifAtTop />
<div v-if="tools.isUserOk()"> <div v-if="tools.isUserOk()">
<CTitlePage :ind="0" /> <CTitlePage :ind="0" />

View File

@@ -9,6 +9,8 @@ import { CFinder } from '@/components/CFinder'
import { LandingFooter } from '@/components/LandingFooter' import { LandingFooter } from '@/components/LandingFooter'
import { CDashboard } from '@/components/CDashboard' import { CDashboard } from '@/components/CDashboard'
import { CChartMap } from '@src/components/CChartMap' import { CChartMap } from '@src/components/CChartMap'
import { CNotifAtTop } from '@src/components/CNotifAtTop'
import { CUserNonVerif } from '@/components/CUserNonVerif' import { CUserNonVerif } from '@/components/CUserNonVerif'
import { CTitlePage } from '@/components/CTitlePage' import { CTitlePage } from '@/components/CTitlePage'
import { CMapsEsempio } from '@src/components/CMapsEsempio' import { CMapsEsempio } from '@src/components/CMapsEsempio'
@@ -24,7 +26,7 @@ import { colmyHosp } from '@store/Modules/fieldsTable'
export default defineComponent({ export default defineComponent({
name: 'hosp', name: 'hosp',
components: { CSkill, CChartMap, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter }, components: { CSkill, CChartMap, CMapsEsempio, CNotifAtTop, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter },
setup() { setup() {
return { return {
colmyHosp, colmyHosp,

View File

@@ -3,6 +3,7 @@
<div v-if="tools.isLogged()"> <div v-if="tools.isLogged()">
<CNotifAtTop />
<div v-if="tools.isUserOk()"> <div v-if="tools.isUserOk()">
<CTitlePage :ind="2" /> <CTitlePage :ind="2" />

View File

@@ -16,6 +16,8 @@ import { CMapsEsempio } from '@src/components/CMapsEsempio'
import { useGlobalStore } from '@store/globalStore' import { useGlobalStore } from '@store/globalStore'
import { useUserStore } from '@store/UserStore' import { useUserStore } from '@store/UserStore'
import { static_data } from '@/db/static_data' import { static_data } from '@/db/static_data'
import { useNotifStore } from '@store/NotifStore'
import MixinBase from '@/mixins/mixin-base' import MixinBase from '@/mixins/mixin-base'
import MixinUsers from '@/mixins/mixin-users' import MixinUsers from '@/mixins/mixin-users'
import { shared_consts } from '@/common/shared_vuejs' import { shared_consts } from '@/common/shared_vuejs'
@@ -28,6 +30,8 @@ export default defineComponent({
const globalStore = useGlobalStore() const globalStore = useGlobalStore()
const userStore = useUserStore() const userStore = useUserStore()
const { getValDb } = MixinBase() const { getValDb } = MixinBase()
const notifStore = useNotifStore()
const { setmeta } = MixinMetaTags() const { setmeta } = MixinMetaTags()
@@ -41,6 +45,7 @@ export default defineComponent({
shared_consts, shared_consts,
globalStore, globalStore,
setmeta, setmeta,
notifStore,
} }
}, },
}) })

View File

@@ -10,6 +10,7 @@ import { CDashboard } from '@/components/CDashboard'
import { CTitlePage } from '@/components/CTitlePage' import { CTitlePage } from '@/components/CTitlePage'
import { CChartMap } from '@src/components/CChartMap' import { CChartMap } from '@src/components/CChartMap'
import { CUserNonVerif } from '@/components/CUserNonVerif' import { CUserNonVerif } from '@/components/CUserNonVerif'
import { CNotifAtTop } from '@src/components/CNotifAtTop'
import { CMapsEsempio } from '@src/components/CMapsEsempio' import { CMapsEsempio } from '@src/components/CMapsEsempio'
import { CVerifyEmail } from '@src/components/CVerifyEmail' import { CVerifyEmail } from '@src/components/CVerifyEmail'
import { CVerifyTelegram } from '@src/components/CVerifyTelegram' import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
@@ -23,7 +24,7 @@ import { costanti } from '@costanti'
export default defineComponent({ export default defineComponent({
name: 'Services', name: 'Services',
components: { CSkill, CChartMap, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter }, components: { CSkill, CChartMap, CNotifAtTop, CMapsEsempio, CFinder, CVerifyEmail, CVerifyTelegram, CDashboard, CUserNonVerif, CTitlePage, LandingFooter },
setup() { setup() {
return { return {
tools, tools,

View File

@@ -4,6 +4,7 @@
<div v-if="tools.isLogged()"> <div v-if="tools.isLogged()">
<CNotifAtTop />
<div v-if="tools.isUserOk()"> <div v-if="tools.isUserOk()">
<CFinder <CFinder

View File

@@ -1160,6 +1160,8 @@ const msg_it = {
coins_accepted: 'Monete accettate', coins_accepted: 'Monete accettate',
coins_refused: 'Monete rifiutate', coins_refused: 'Monete rifiutate',
accept_coins: 'Accetta Monete', accept_coins: 'Accetta Monete',
accept_coins_qty: 'Accetta {qty} {symbol} !',
refuse_coins_qty: 'Rifiuta',
refuse_coins: 'Rifiuta Monete', refuse_coins: 'Rifiuta Monete',
movements: 'Movimenti', movements: 'Movimenti',
qta_remaining_to_send: 'Quantità massima inviabile {maxqta} {symbol}', qta_remaining_to_send: 'Quantità massima inviabile {maxqta} {symbol}',
@@ -1180,7 +1182,9 @@ const msg_it = {
transactionDate: 'Data Transazione', transactionDate: 'Data Transazione',
accountFromId: 'Dal Conto', accountFromId: 'Dal Conto',
accountToId: 'Al Conto', accountToId: 'Al Conto',
amount: 'Quantità da inviare', amount_sent: 'Quantità inviate',
amount_to_send: 'Quantità da inviare (massimo: {qtamax})',
amount: 'Quantità',
causal: 'Note', causal: 'Note',
causal_table: 'Tabella Causale', causal_table: 'Tabella Causale',
causal_IdRec: 'Id Record Causale', causal_IdRec: 'Id Record Causale',

View File

@@ -1,6 +1,7 @@
import { defineStore } from 'pinia' import { defineStore } from 'pinia'
import { import {
IAccount,
ICircuit, ICircuitState, IGlobalState, ICircuit, ICircuitState, IGlobalState,
} from '@src/model' } from '@src/model'
import { tools } from '@store/Modules/tools' import { tools } from '@store/Modules/tools'
@@ -29,6 +30,12 @@ export const useCircuitStore = defineStore('CircuitStore', {
}, },
actions: { actions: {
getRemainingCoinsToSend(account: IAccount) {
return tools.roundDec2(account.saldo + account.fidoConcesso)
},
getMaxCoinsToSend(account: IAccount) {
return tools.roundDec2(account.qta_maxConcessa - account.saldo)
},
async loadCircuits() { async loadCircuits() {
return Api.SendReq('/users/circuits', 'POST', null) return Api.SendReq('/users/circuits', 'POST', null)

View File

@@ -12,7 +12,7 @@ import {
ITodo, ITodo,
IUserFields, IUserFields,
Privacy, Privacy,
TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin, IMovement, IMovVisu, TipoVisu, IGroup, IMySkill, IMyBacheca, IImgGallery, IMsgGlobParam, IUserExport, ISpecialField, IAccount, IMyCircuit, ISendCoin, IMovement, IMovVisu, INotif,
} from '@model' } from '@model'
import { addToDate } from '@quasar/quasar-ui-qcalendar' import { addToDate } from '@quasar/quasar-ui-qcalendar'
@@ -3365,7 +3365,7 @@ export const tools = {
return 'primary' return 'primary'
}, },
convstrToNum(myval: any) { convstrToNum(myval: any): number {
if (typeof myval == 'number' && !isNaN(myval)) { if (typeof myval == 'number' && !isNaN(myval)) {
if (Number.isInteger(myval)) { if (Number.isInteger(myval)) {
@@ -3375,6 +3375,7 @@ export const tools = {
return parseFloat(myval) return parseFloat(myval)
} }
} }
return parseFloat(myval)
}, },
getCookie(mytok: any, def?: any, convertint: any = false) { getCookie(mytok: any, def?: any, convertint: any = false) {
@@ -4787,10 +4788,11 @@ export const tools = {
}, },
acceptCoins($q: any, username: string, recsendcoin: ISendCoin) { acceptCoins($q: any, username: string, notif: any) {
const userStore = useUserStore() const userStore = useUserStore()
userStore.setCircuitCmd($q, t, username, recsendcoin.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT, 0, recsendcoin) notif.extrarec.notifId = notif._id
userStore.setCircuitCmd($q, t, username, notif.extrarec.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_ACCEPT, 0, notif.extrarec)
.then((res: any) => { .then((res: any) => {
if (res) { if (res) {
if (res.cansend) { if (res.cansend) {
@@ -5265,7 +5267,7 @@ export const tools = {
}) })
}, },
sendCoinsByCircuit($q: any, circuit: ICircuit, sendcoinrec: ISendCoin): any { async sendCoinsByCircuit($q: any, circuit: ICircuit, sendcoinrec: ISendCoin) {
const userStore = useUserStore() const userStore = useUserStore()
@@ -5274,7 +5276,7 @@ export const tools = {
let msg = '' let msg = ''
msg = t('circuit.question_sendcoinsto', { coin: circuit.symbol, dest: sendcoinrec.dest, qty: sendcoinrec.qty }) msg = t('circuit.question_sendcoinsto', { coin: circuit.symbol, dest: sendcoinrec.dest, qty: sendcoinrec.qty })
$q.dialog({ return $q.dialog({
message: msg, message: msg,
ok: { ok: {
label: t('dialog.yes'), label: t('dialog.yes'),
@@ -5288,7 +5290,11 @@ export const tools = {
return userStore.setCircuitCmd($q, t, username, sendcoinrec.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_REQ, true, sendcoinrec) return userStore.setCircuitCmd($q, t, username, sendcoinrec.circuitname, shared_consts.CIRCUITCMD.SENDCOINS_REQ, true, sendcoinrec)
.then((res: any) => { .then((res: any) => {
if (res.cansend) { console.log('setCircuitCmd ', res)
if (res && res.cansend) {
if (res.useraccounts && res.useraccounts.length > 0) {
userStore.my.profile.useraccounts = res.useraccounts
}
tools.showPositiveNotif($q, t('circuit.coins_sendrequest_sent')) tools.showPositiveNotif($q, t('circuit.coins_sendrequest_sent'))
} else { } else {
tools.showNegativeNotif($q, res.errormsg) tools.showNegativeNotif($q, res.errormsg)
@@ -5296,7 +5302,9 @@ export const tools = {
}) })
}) })
return null return await new Promise((resolve, reject) => {
resolve(false)
})
}, },
cancelReqCircuit($q: any, username: string, circuitname: string) { cancelReqCircuit($q: any, username: string, circuitname: string) {
@@ -6311,11 +6319,11 @@ export const tools = {
return '' return ''
} }
}, },
getRemainingCoinsToSend(account: IAccount) { roundDec2(mynum: number): number {
return account.saldo + account.fidoConcesso; return (Math.round(mynum * 100)/100);
}, },
getMaxCoinsToSend(account: IAccount) { roundDec2Str(mynum: number): string {
return account.qta_maxConcessa - account.saldo; return (Math.round(mynum * 100)/100).toFixed(2);
}, },
// getLocale() { // getLocale() {
// if (navigator.languages && navigator.languages.length > 0) { // if (navigator.languages && navigator.languages.length > 0) {

View File

@@ -60,6 +60,7 @@ export const func_tools = {
export const toolsext = { export const toolsext = {
TABUSER: 'users', TABUSER: 'users',
TABFRIENDS: 'friends', TABFRIENDS: 'friends',
TABMOVEMENTS: 'movements',
TABMYGROUPS: 'mygroups', TABMYGROUPS: 'mygroups',
TABSKILLS: 'skills', TABSKILLS: 'skills',
TABGOODS: 'goods', TABGOODS: 'goods',

View File

@@ -25,6 +25,12 @@ export const useNotifStore = defineStore('NotifStore', {
}, },
getnotifs_coinsreq: (mystate: INotifState) => (): INotif[] => {
const ctrec = (mystate.last_notifs) ? mystate.last_notifs.slice(0, 20).filter((rec) => !rec.read && rec.typedir === shared_consts.TypeNotifs.TYPEDIR_CIRCUITS && rec.typeid === shared_consts.TypeNotifs.ID_CIRCUIT_SENDCOINSREQ) : []
return (ctrec)
},
getnumNotifUnread: (mystate: INotifState) => () => { getnumNotifUnread: (mystate: INotifState) => () => {
const myarr = mystate.last_notifs.filter((notif) => !notif.read) const myarr = mystate.last_notifs.filter((notif) => !notif.read)
return (tools.isArray(myarr) ? myarr.length : 0) return (tools.isArray(myarr) ? myarr.length : 0)
@@ -55,6 +61,19 @@ export const useNotifStore = defineStore('NotifStore', {
this.updateArrNotif() this.updateArrNotif()
}, },
updateRecNotif(recnotif: INotif) {
if (recnotif) {
const myrec = this.last_notifs.find((rec: any) => rec._id === recnotif._id)
if (myrec) {
myrec.status = recnotif.status
myrec.read = recnotif.read
myrec.descr = recnotif.descr
this.updateArrNotif()
}
}
},
async setBadgeIconApp(){ async setBadgeIconApp(){
// Get our dummy count and update it, // Get our dummy count and update it,
// just to give more context for this demo. // just to give more context for this demo.

View File

@@ -27,6 +27,7 @@ import { costanti } from '@costanti'
import { IMyGroup } from '@model/UserStore' import { IMyGroup } from '@model/UserStore'
import globalroutines from '../globalroutines/index' import globalroutines from '../globalroutines/index'
import { useNotifStore } from '@store/NotifStore'
export const DefaultUser: IUserFields = { export const DefaultUser: IUserFields = {
_id: '', _id: '',
@@ -1226,9 +1227,14 @@ export const useUserStore = defineStore('UserStore', {
}, },
async setCircuitCmd($q: any, t: any, usernameOrig: string, circuitname: string, cmd: number, value: any, extrarec?: any) { async setCircuitCmd($q: any, t: any, usernameOrig: string, circuitname: string, cmd: number, value: any, extrarec?: any) {
return Api.SendReq('/users/circuits/cmd', 'POST', { usernameOrig, circuitname, cmd, value, extrarec }) return await Api.SendReq('/users/circuits/cmd', 'POST', { usernameOrig, circuitname, cmd, value, extrarec })
.then((res) => { .then((res) => {
this.updateTables = true this.updateTables = true
if (res.data.recnotif) {
const notifStore = useNotifStore()
notifStore.updateRecNotif(res.data.recnotif)
}
return res.data return res.data
}).catch((error) => { }).catch((error) => {
tools.showNegativeNotif($q, t('db.recfailed')) tools.showNegativeNotif($q, t('db.recfailed'))

View File

@@ -123,6 +123,7 @@
:arrfilters="arrfilterand" :arrfilters="arrfilterand"
:filtercustom="filtercustom_rich" :filtercustom="filtercustom_rich"
:prop_searchList="searchList" :prop_searchList="searchList"
:prop_pagination="{ sortBy: 'transactionDate', descending: true, page: 1, rowsNumber: 20, rowsPerPage: 20 }"
:showType="costanti.SHOW_MOVEMENTS" :showType="costanti.SHOW_MOVEMENTS"
keyMain="" keyMain=""
:showCol="false" :showCol="false"

View File

@@ -1,6 +1,7 @@
import { CMyCircuits } from '@/components/CMyCircuits' import { CMyCircuits } from '@/components/CMyCircuits'
import { CFinder } from '@/components/CFinder' import { CFinder } from '@/components/CFinder'
import { CGridTableRec } from '@/components/CGridTableRec' import { CGridTableRec } from '@/components/CGridTableRec'
import { CNotifAtTop } from '@/components/CNotifAtTop'
import { tools } from '@store/Modules/tools' import { tools } from '@store/Modules/tools'
import { toolsext } from '@store/Modules/toolsext' import { toolsext } from '@store/Modules/toolsext'
import { computed, defineComponent, onMounted, ref, watch } from 'vue' import { computed, defineComponent, onMounted, ref, watch } from 'vue'
@@ -14,7 +15,7 @@ import { shared_consts } from '@/common/shared_vuejs'
export default defineComponent({ export default defineComponent({
name: 'mycircuits', name: 'mycircuits',
components: { CMyCircuits, CGridTableRec, CFinder }, components: { CMyCircuits, CGridTableRec, CFinder, CNotifAtTop },
props: {}, props: {},
setup() { setup() {
const userStore = useUserStore() const userStore = useUserStore()

View File

@@ -1,5 +1,6 @@
<template> <template>
<div v-if="isfinishLoading" class=""> <div v-if="isfinishLoading" class="">
<CNotifAtTop />
<CMyCircuits <CMyCircuits
v-model="filter" v-model="filter"
:finder="true" :finder="true"

View File

@@ -1,6 +1,7 @@
import { CMyGroups } from '@/components/CMyGroups' import { CMyGroups } from '@/components/CMyGroups'
import { CFinder } from '@/components/CFinder' import { CFinder } from '@/components/CFinder'
import { CGridTableRec } from '@/components/CGridTableRec' import { CGridTableRec } from '@/components/CGridTableRec'
import { CNotifAtTop } from '@/components/CNotifAtTop'
import { tools } from '@store/Modules/tools' import { tools } from '@store/Modules/tools'
import { toolsext } from '@store/Modules/toolsext' import { toolsext } from '@store/Modules/toolsext'
import { computed, defineComponent, onMounted, ref, watch } from 'vue' import { computed, defineComponent, onMounted, ref, watch } from 'vue'
@@ -14,7 +15,7 @@ import { shared_consts } from '@/common/shared_vuejs'
export default defineComponent({ export default defineComponent({
name: 'mygroups', name: 'mygroups',
components: { CMyGroups, CGridTableRec, CFinder }, components: { CMyGroups, CGridTableRec, CNotifAtTop, CFinder },
props: {}, props: {},
setup() { setup() {
const userStore = useUserStore() const userStore = useUserStore()

View File

@@ -1,5 +1,6 @@
<template> <template>
<div class=""> <div class="">
<CNotifAtTop />
<!--<q-banner <!--<q-banner
rounded rounded
dense dense