Visu Sent Monete
This commit is contained in:
@@ -58,7 +58,6 @@ export default defineComponent({
|
||||
return {
|
||||
showingtooltip,
|
||||
t,
|
||||
$q,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<q-icon v-else name="fas fa-coins" size="sm"/>
|
||||
</template>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -114,6 +114,8 @@ export default defineComponent({
|
||||
const mypagination = computed(() => {
|
||||
if (props.table === toolsext.TABMYBACHECAS)
|
||||
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 }
|
||||
})
|
||||
|
||||
0
src/components/CNotifAtTop/CNotifAtTop.scss
Executable file
0
src/components/CNotifAtTop/CNotifAtTop.scss
Executable file
75
src/components/CNotifAtTop/CNotifAtTop.ts
Executable file
75
src/components/CNotifAtTop/CNotifAtTop.ts
Executable 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,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
58
src/components/CNotifAtTop/CNotifAtTop.vue
Executable file
58
src/components/CNotifAtTop/CNotifAtTop.vue
Executable 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>
|
||||
1
src/components/CNotifAtTop/index.ts
Executable file
1
src/components/CNotifAtTop/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as CNotifAtTop} from './CNotifAtTop.vue'
|
||||
@@ -7,6 +7,8 @@ import { useUserStore } from '@store/UserStore'
|
||||
import { useCircuitStore } from '@store/CircuitStore'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { CMyUser } from '@/components/CMyUser'
|
||||
import { costanti } from '@costanti'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CSendCoins',
|
||||
@@ -21,7 +23,7 @@ export default defineComponent({
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
components: { CCurrencyValue },
|
||||
components: { CCurrencyValue, CMyUser },
|
||||
|
||||
setup(props, { emit }) {
|
||||
const $q = useQuasar()
|
||||
@@ -42,11 +44,13 @@ export default defineComponent({
|
||||
const accountloaded = ref(<IAccount | undefined>undefined)
|
||||
const accountdest = ref(<IAccount | undefined>undefined)
|
||||
const remainingCoins = ref(0)
|
||||
const maxsendable = ref(0)
|
||||
const numstep = ref(0)
|
||||
|
||||
const priceLabel = computed(() => circuitloaded.value ? `${qty.value} ` + circuitloaded.value.symbol : '')
|
||||
const arrayMarkerLabel = ref(<any>[])
|
||||
|
||||
const qtyRef = ref(null)
|
||||
const qtyRef = ref(<any>null)
|
||||
|
||||
watch(() => circuitsel.value, (newval, oldval) => {
|
||||
aggiorna()
|
||||
@@ -63,15 +67,30 @@ export default defineComponent({
|
||||
accountloaded.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
|
||||
// accountdest.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
|
||||
if (accountloaded.value) {
|
||||
remainingCoins.value = tools.getRemainingCoinsToSend(accountloaded.value)
|
||||
const quanti = [ ...Array(100).keys() ].map( i => i+1)
|
||||
remainingCoins.value = circuitStore.getRemainingCoinsToSend(accountloaded.value)
|
||||
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) {
|
||||
let value = ind * 10
|
||||
let value = ind * numstep.value
|
||||
if (value > remainingCoins.value) {
|
||||
break
|
||||
} else {
|
||||
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) {
|
||||
const myrecsendcoin: ISendCoin = {
|
||||
qty: qty.value,
|
||||
qty: tools.convstrToNum(qty.value),
|
||||
dest: props.to_user.username,
|
||||
circuitname: circuitsel.value,
|
||||
causal: causal.value,
|
||||
symbol: circuitloaded.value.symbol,
|
||||
}
|
||||
console.log('myrecsendcoin', myrecsendcoin)
|
||||
if (circuitloaded.value) {
|
||||
tools.sendCoinsByCircuit($q, circuitloaded.value, myrecsendcoin).then((ris: any) => {
|
||||
if (myrecsendcoin) {
|
||||
tools.sendCoinsByCircuit($q, circuitloaded.value, myrecsendcoin)
|
||||
.then((ris: any) => {
|
||||
if (ris) {
|
||||
show.value = false
|
||||
}
|
||||
@@ -145,6 +164,11 @@ export default defineComponent({
|
||||
arrayMarkerLabel,
|
||||
remainingCoins,
|
||||
qtyRef,
|
||||
maxsendable,
|
||||
circuitStore,
|
||||
numstep,
|
||||
costanti,
|
||||
userStore,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<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-toolbar class="bg-primary text-white">
|
||||
<q-toolbar-title>
|
||||
@@ -22,24 +22,31 @@
|
||||
|
||||
</CCurrencyValue>
|
||||
|
||||
<q-input v-model="from_username" label="Mittente" class="full-width" disable>
|
||||
</q-input>
|
||||
<q-input v-model="to_user.username" label="Destinatario" class="full-width" disable>
|
||||
<q-input v-model="from_username" label="Mittente" class="full-width" readonly>
|
||||
</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>
|
||||
|
||||
|
||||
<div>
|
||||
<q-input
|
||||
ref="qtyRef"
|
||||
class="q-px-sm text-h5"
|
||||
class="q-py-sm text-h5"
|
||||
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>
|
||||
<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>
|
||||
</template>
|
||||
</q-input>
|
||||
@@ -48,7 +55,8 @@
|
||||
v-model="qty"
|
||||
color="green"
|
||||
markers
|
||||
:step="5"
|
||||
track-size="10px"
|
||||
:step="numstep"
|
||||
:marker-labels="arrayMarkerLabel"
|
||||
label-always
|
||||
:label-value="priceLabel"
|
||||
@@ -56,14 +64,15 @@
|
||||
switch-marker-labels-side
|
||||
:inner-max="remainingCoins"
|
||||
:min="0"
|
||||
:max="accountloaded.fidoConcesso"
|
||||
:max="Number(maxsendable.toFixed(2))"
|
||||
/>
|
||||
</div>
|
||||
|
||||
</q-card-section>
|
||||
<q-card-actions align="center">
|
||||
<q-btn
|
||||
: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>
|
||||
<q-btn flat :label="$t('dialog.cancel')" color="primary" v-close-popup></q-btn>
|
||||
</q-card-actions>
|
||||
|
||||
@@ -62,3 +62,4 @@ export * from './CNotifSettings'
|
||||
// export * from './CPreloadImages'
|
||||
export * from './CSendCoins'
|
||||
export * from './CCurrencyValue'
|
||||
export * from './CNotifAtTop'
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
size="sm"
|
||||
icon="fas fa-user-plus"
|
||||
color="positive" :label="$t('circuit.accept_coins')"
|
||||
@click="tools.acceptCoins($q, notif.sender, notif.extrarec)"
|
||||
@click="tools.acceptCoins($q, notif.sender, notif)"
|
||||
/>
|
||||
<q-btn
|
||||
dense
|
||||
|
||||
@@ -12,6 +12,7 @@ import { CUserNonVerif } from '@/components/CUserNonVerif'
|
||||
import { CTitlePage } from '@/components/CTitlePage'
|
||||
import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
||||
import { CNotifAtTop } from '@src/components/CNotifAtTop'
|
||||
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
||||
import { LandingFooter } from '@/components/LandingFooter'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
@@ -22,7 +23,8 @@ import MixinUsers from '@/mixins/mixin-users'
|
||||
|
||||
export default defineComponent({
|
||||
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() {
|
||||
|
||||
return {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<q-page class="">
|
||||
|
||||
<div v-if="tools.isLogged()">
|
||||
<CNotifAtTop />
|
||||
|
||||
<div v-if="tools.isUserOk()">
|
||||
<CTitlePage :ind="0" />
|
||||
|
||||
@@ -9,6 +9,8 @@ import { CFinder } from '@/components/CFinder'
|
||||
import { LandingFooter } from '@/components/LandingFooter'
|
||||
import { CDashboard } from '@/components/CDashboard'
|
||||
import { CChartMap } from '@src/components/CChartMap'
|
||||
import { CNotifAtTop } from '@src/components/CNotifAtTop'
|
||||
|
||||
import { CUserNonVerif } from '@/components/CUserNonVerif'
|
||||
import { CTitlePage } from '@/components/CTitlePage'
|
||||
import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||
@@ -24,7 +26,7 @@ import { colmyHosp } from '@store/Modules/fieldsTable'
|
||||
|
||||
export default defineComponent({
|
||||
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() {
|
||||
return {
|
||||
colmyHosp,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
<div v-if="tools.isLogged()">
|
||||
|
||||
<CNotifAtTop />
|
||||
<div v-if="tools.isUserOk()">
|
||||
<CTitlePage :ind="2" />
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { static_data } from '@/db/static_data'
|
||||
import { useNotifStore } from '@store/NotifStore'
|
||||
|
||||
import MixinBase from '@/mixins/mixin-base'
|
||||
import MixinUsers from '@/mixins/mixin-users'
|
||||
import { shared_consts } from '@/common/shared_vuejs'
|
||||
@@ -28,6 +30,8 @@ export default defineComponent({
|
||||
const globalStore = useGlobalStore()
|
||||
const userStore = useUserStore()
|
||||
const { getValDb } = MixinBase()
|
||||
const notifStore = useNotifStore()
|
||||
|
||||
|
||||
const { setmeta } = MixinMetaTags()
|
||||
|
||||
@@ -41,6 +45,7 @@ export default defineComponent({
|
||||
shared_consts,
|
||||
globalStore,
|
||||
setmeta,
|
||||
notifStore,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -10,6 +10,7 @@ import { CDashboard } from '@/components/CDashboard'
|
||||
import { CTitlePage } from '@/components/CTitlePage'
|
||||
import { CChartMap } from '@src/components/CChartMap'
|
||||
import { CUserNonVerif } from '@/components/CUserNonVerif'
|
||||
import { CNotifAtTop } from '@src/components/CNotifAtTop'
|
||||
import { CMapsEsempio } from '@src/components/CMapsEsempio'
|
||||
import { CVerifyEmail } from '@src/components/CVerifyEmail'
|
||||
import { CVerifyTelegram } from '@src/components/CVerifyTelegram'
|
||||
@@ -23,7 +24,7 @@ import { costanti } from '@costanti'
|
||||
|
||||
export default defineComponent({
|
||||
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() {
|
||||
return {
|
||||
tools,
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<div v-if="tools.isLogged()">
|
||||
|
||||
<CNotifAtTop />
|
||||
<div v-if="tools.isUserOk()">
|
||||
|
||||
<CFinder
|
||||
|
||||
@@ -1160,6 +1160,8 @@ const msg_it = {
|
||||
coins_accepted: 'Monete accettate',
|
||||
coins_refused: 'Monete rifiutate',
|
||||
accept_coins: 'Accetta Monete',
|
||||
accept_coins_qty: 'Accetta {qty} {symbol} !',
|
||||
refuse_coins_qty: 'Rifiuta',
|
||||
refuse_coins: 'Rifiuta Monete',
|
||||
movements: 'Movimenti',
|
||||
qta_remaining_to_send: 'Quantità massima inviabile {maxqta} {symbol}',
|
||||
@@ -1180,7 +1182,9 @@ const msg_it = {
|
||||
transactionDate: 'Data Transazione',
|
||||
accountFromId: 'Dal 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_table: 'Tabella Causale',
|
||||
causal_IdRec: 'Id Record Causale',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
import {
|
||||
IAccount,
|
||||
ICircuit, ICircuitState, IGlobalState,
|
||||
} from '@src/model'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
@@ -29,6 +30,12 @@ export const useCircuitStore = defineStore('CircuitStore', {
|
||||
},
|
||||
|
||||
actions: {
|
||||
getRemainingCoinsToSend(account: IAccount) {
|
||||
return tools.roundDec2(account.saldo + account.fidoConcesso)
|
||||
},
|
||||
getMaxCoinsToSend(account: IAccount) {
|
||||
return tools.roundDec2(account.qta_maxConcessa - account.saldo)
|
||||
},
|
||||
|
||||
async loadCircuits() {
|
||||
return Api.SendReq('/users/circuits', 'POST', null)
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
ITodo,
|
||||
IUserFields,
|
||||
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'
|
||||
|
||||
import { addToDate } from '@quasar/quasar-ui-qcalendar'
|
||||
@@ -3365,7 +3365,7 @@ export const tools = {
|
||||
return 'primary'
|
||||
},
|
||||
|
||||
convstrToNum(myval: any) {
|
||||
convstrToNum(myval: any): number {
|
||||
|
||||
if (typeof myval == 'number' && !isNaN(myval)) {
|
||||
if (Number.isInteger(myval)) {
|
||||
@@ -3375,6 +3375,7 @@ export const tools = {
|
||||
return parseFloat(myval)
|
||||
}
|
||||
}
|
||||
return parseFloat(myval)
|
||||
},
|
||||
|
||||
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()
|
||||
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) => {
|
||||
if (res) {
|
||||
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()
|
||||
|
||||
@@ -5274,7 +5276,7 @@ export const tools = {
|
||||
let msg = ''
|
||||
msg = t('circuit.question_sendcoinsto', { coin: circuit.symbol, dest: sendcoinrec.dest, qty: sendcoinrec.qty })
|
||||
|
||||
$q.dialog({
|
||||
return $q.dialog({
|
||||
message: msg,
|
||||
ok: {
|
||||
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)
|
||||
.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'))
|
||||
} else {
|
||||
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) {
|
||||
@@ -6311,11 +6319,11 @@ export const tools = {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
getRemainingCoinsToSend(account: IAccount) {
|
||||
return account.saldo + account.fidoConcesso;
|
||||
roundDec2(mynum: number): number {
|
||||
return (Math.round(mynum * 100)/100);
|
||||
},
|
||||
getMaxCoinsToSend(account: IAccount) {
|
||||
return account.qta_maxConcessa - account.saldo;
|
||||
roundDec2Str(mynum: number): string {
|
||||
return (Math.round(mynum * 100)/100).toFixed(2);
|
||||
},
|
||||
// getLocale() {
|
||||
// if (navigator.languages && navigator.languages.length > 0) {
|
||||
|
||||
@@ -60,6 +60,7 @@ export const func_tools = {
|
||||
export const toolsext = {
|
||||
TABUSER: 'users',
|
||||
TABFRIENDS: 'friends',
|
||||
TABMOVEMENTS: 'movements',
|
||||
TABMYGROUPS: 'mygroups',
|
||||
TABSKILLS: 'skills',
|
||||
TABGOODS: 'goods',
|
||||
|
||||
@@ -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) => () => {
|
||||
const myarr = mystate.last_notifs.filter((notif) => !notif.read)
|
||||
return (tools.isArray(myarr) ? myarr.length : 0)
|
||||
@@ -55,6 +61,19 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
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(){
|
||||
// Get our dummy count and update it,
|
||||
// just to give more context for this demo.
|
||||
|
||||
@@ -27,6 +27,7 @@ import { costanti } from '@costanti'
|
||||
import { IMyGroup } from '@model/UserStore'
|
||||
|
||||
import globalroutines from '../globalroutines/index'
|
||||
import { useNotifStore } from '@store/NotifStore'
|
||||
|
||||
export const DefaultUser: IUserFields = {
|
||||
_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) {
|
||||
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) => {
|
||||
this.updateTables = true
|
||||
if (res.data.recnotif) {
|
||||
const notifStore = useNotifStore()
|
||||
|
||||
notifStore.updateRecNotif(res.data.recnotif)
|
||||
}
|
||||
return res.data
|
||||
}).catch((error) => {
|
||||
tools.showNegativeNotif($q, t('db.recfailed'))
|
||||
|
||||
@@ -123,6 +123,7 @@
|
||||
:arrfilters="arrfilterand"
|
||||
:filtercustom="filtercustom_rich"
|
||||
:prop_searchList="searchList"
|
||||
:prop_pagination="{ sortBy: 'transactionDate', descending: true, page: 1, rowsNumber: 20, rowsPerPage: 20 }"
|
||||
:showType="costanti.SHOW_MOVEMENTS"
|
||||
keyMain=""
|
||||
:showCol="false"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { CMyCircuits } from '@/components/CMyCircuits'
|
||||
import { CFinder } from '@/components/CFinder'
|
||||
import { CGridTableRec } from '@/components/CGridTableRec'
|
||||
import { CNotifAtTop } from '@/components/CNotifAtTop'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { computed, defineComponent, onMounted, ref, watch } from 'vue'
|
||||
@@ -14,7 +15,7 @@ import { shared_consts } from '@/common/shared_vuejs'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'mycircuits',
|
||||
components: { CMyCircuits, CGridTableRec, CFinder },
|
||||
components: { CMyCircuits, CGridTableRec, CFinder, CNotifAtTop },
|
||||
props: {},
|
||||
setup() {
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div v-if="isfinishLoading" class="">
|
||||
<CNotifAtTop />
|
||||
<CMyCircuits
|
||||
v-model="filter"
|
||||
:finder="true"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { CMyGroups } from '@/components/CMyGroups'
|
||||
import { CFinder } from '@/components/CFinder'
|
||||
import { CGridTableRec } from '@/components/CGridTableRec'
|
||||
import { CNotifAtTop } from '@/components/CNotifAtTop'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
import { toolsext } from '@store/Modules/toolsext'
|
||||
import { computed, defineComponent, onMounted, ref, watch } from 'vue'
|
||||
@@ -14,7 +15,7 @@ import { shared_consts } from '@/common/shared_vuejs'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'mygroups',
|
||||
components: { CMyGroups, CGridTableRec, CFinder },
|
||||
components: { CMyGroups, CGridTableRec, CNotifAtTop, CFinder },
|
||||
props: {},
|
||||
setup() {
|
||||
const userStore = useUserStore()
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="">
|
||||
<CNotifAtTop />
|
||||
<!--<q-banner
|
||||
rounded
|
||||
dense
|
||||
|
||||
Reference in New Issue
Block a user