From 44c75768c63a28d956ae33cb78391aecad351dea Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Tue, 13 Sep 2022 12:28:33 +0200 Subject: [PATCH] Visu Sent Monete --- .../CCurrencyValue/CCurrencyValue.ts | 1 - .../CCurrencyValue/CCurrencyValue.vue | 2 +- src/components/CFinder/CFinder.ts | 2 + src/components/CNotifAtTop/CNotifAtTop.scss | 0 src/components/CNotifAtTop/CNotifAtTop.ts | 75 +++++++++++++++++++ src/components/CNotifAtTop/CNotifAtTop.vue | 58 ++++++++++++++ src/components/CNotifAtTop/index.ts | 1 + src/components/CSendCoins/CSendCoins.ts | 52 +++++++++---- src/components/CSendCoins/CSendCoins.vue | 75 +++++++++++-------- src/components/index.ts | 1 + .../toolbar/notifPopover/notifPopover.vue | 2 +- src/root/goods/goods.ts | 4 +- src/root/goods/goods.vue | 1 + src/root/hosp/hosp.ts | 4 +- src/root/hosp/hosp.vue | 1 + src/root/mainview/mainview.ts | 5 ++ src/root/services/services.ts | 3 +- src/root/services/services.vue | 1 + src/statics/lang/it.js | 6 +- src/store/CircuitStore.ts | 7 ++ src/store/Modules/tools.ts | 32 +++++--- src/store/Modules/toolsext.ts | 1 + src/store/NotifStore.ts | 19 +++++ src/store/UserStore.ts | 8 +- src/views/user/mycircuit/mycircuit.vue | 1 + src/views/user/mycircuits/mycircuits.ts | 3 +- src/views/user/mycircuits/mycircuits.vue | 1 + src/views/user/mygroups/mygroups.ts | 3 +- src/views/user/mygroups/mygroups.vue | 1 + 29 files changed, 301 insertions(+), 69 deletions(-) create mode 100755 src/components/CNotifAtTop/CNotifAtTop.scss create mode 100755 src/components/CNotifAtTop/CNotifAtTop.ts create mode 100755 src/components/CNotifAtTop/CNotifAtTop.vue create mode 100755 src/components/CNotifAtTop/index.ts diff --git a/src/components/CCurrencyValue/CCurrencyValue.ts b/src/components/CCurrencyValue/CCurrencyValue.ts index eed77c48..06480322 100755 --- a/src/components/CCurrencyValue/CCurrencyValue.ts +++ b/src/components/CCurrencyValue/CCurrencyValue.ts @@ -58,7 +58,6 @@ export default defineComponent({ return { showingtooltip, t, - $q, } }, }) diff --git a/src/components/CCurrencyValue/CCurrencyValue.vue b/src/components/CCurrencyValue/CCurrencyValue.vue index 124bd272..0ef0aa05 100755 --- a/src/components/CCurrencyValue/CCurrencyValue.vue +++ b/src/components/CCurrencyValue/CCurrencyValue.vue @@ -27,7 +27,7 @@ diff --git a/src/components/CFinder/CFinder.ts b/src/components/CFinder/CFinder.ts index 56e0de0b..0c88c6ca 100755 --- a/src/components/CFinder/CFinder.ts +++ b/src/components/CFinder/CFinder.ts @@ -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 } }) diff --git a/src/components/CNotifAtTop/CNotifAtTop.scss b/src/components/CNotifAtTop/CNotifAtTop.scss new file mode 100755 index 00000000..e69de29b diff --git a/src/components/CNotifAtTop/CNotifAtTop.ts b/src/components/CNotifAtTop/CNotifAtTop.ts new file mode 100755 index 00000000..24d27489 --- /dev/null +++ b/src/components/CNotifAtTop/CNotifAtTop.ts @@ -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, + } + }, +}) + diff --git a/src/components/CNotifAtTop/CNotifAtTop.vue b/src/components/CNotifAtTop/CNotifAtTop.vue new file mode 100755 index 00000000..da5c1e6d --- /dev/null +++ b/src/components/CNotifAtTop/CNotifAtTop.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/components/CNotifAtTop/index.ts b/src/components/CNotifAtTop/index.ts new file mode 100755 index 00000000..03058b62 --- /dev/null +++ b/src/components/CNotifAtTop/index.ts @@ -0,0 +1 @@ +export {default as CNotifAtTop} from './CNotifAtTop.vue' diff --git a/src/components/CSendCoins/CSendCoins.ts b/src/components/CSendCoins/CSendCoins.ts index 2e39690b..81094828 100755 --- a/src/components/CSendCoins/CSendCoins.ts +++ b/src/components/CSendCoins/CSendCoins.ts @@ -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(undefined) const accountdest = ref(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([]) - const qtyRef = ref(null) + const qtyRef = ref(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,19 +127,19 @@ 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 (ris) { - show.value = false - } - }) + 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, } }, }) diff --git a/src/components/CSendCoins/CSendCoins.vue b/src/components/CSendCoins/CSendCoins.vue index 10c1f6c0..0bd64bf0 100755 --- a/src/components/CSendCoins/CSendCoins.vue +++ b/src/components/CSendCoins/CSendCoins.vue @@ -1,6 +1,6 @@