Circuits OK

Accounts Ok
Movements OK
This commit is contained in:
Paolo Arena
2022-09-14 11:31:48 +02:00
parent 44c75768c6
commit 25a60472ab
34 changed files with 299 additions and 119 deletions

View File

@@ -57,6 +57,22 @@
background: linear-gradient(45deg, #ffdf40, #ff8359) !important;
}
.progress-bar-5 {
height: 8px;
border-radius: 3px;
background: #ffdf40;
background: -webkit-linear-gradient(45deg, #ffdf40, #ff8359) !important;
background: linear-gradient(45deg, #ffdf40, #ff8359) !important;
}
.progress-bar-6 {
height: 8px;
border-radius: 3px;
background: #ffdf40;
background: -webkit-linear-gradient(45deg, #ffdf40, #ff8359) !important;
background: linear-gradient(45deg, #ffdf40, #ff8359) !important;
}
.border-top {
border-top: 1px solid #efefef;
}

View File

@@ -1040,7 +1040,7 @@ export default defineComponent({
}
function selItem(item: any, col: IColGridTable, inmodif?: boolean) {
console.log('selItem', item, col)
// console.log('selItem', item, col)
if (inmodif) {
}

View File

@@ -1,6 +1,8 @@
import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { computed, defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { useUserStore } from '@store/UserStore'
import { ICircuit, IImgGallery, IUserFields, IUserProfile, IFriends } from 'model'
import { useCircuitStore } from '@store/CircuitStore'
import { ICircuit, IImgGallery, IUserFields, IUserProfile, IFriends, IAccount } from 'model'
import { costanti } from '@costanti'
import { shared_consts } from '@/common/shared_vuejs'
import { tools } from '@store/Modules/tools'
@@ -8,12 +10,13 @@ import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
import { useRoute, useRouter } from 'vue-router'
import { CUserNonVerif } from '@/components/CUserNonVerif'
import { CSaldo } from '@/components/CSaldo'
import { toolsext } from '@store/Modules/toolsext'
export default defineComponent({
name: 'CMyCircuit',
emits: ['setCmd'],
components: {CUserNonVerif},
components: {CUserNonVerif, CSaldo},
props: {
mycircuit: {
type: Object as PropType<ICircuit | null>,
@@ -34,12 +37,17 @@ export default defineComponent({
setup(props, { emit }) {
const userStore = useUserStore()
const circuitStore = useCircuitStore()
const $q = useQuasar()
const { t } = useI18n()
const $router = useRouter()
const $route = useRoute()
const circuit = ref(<ICircuit | null>null)
const account = computed(() => circuit.value ? userStore.getAccountByCircuitId(circuit.value._id) : null )
const qtarem = computed(() => account.value ? circuitStore.getRemainingCoinsToSend(account.value) : 0)
const saldo = computed(() => account.value ? account.value.saldo : 0)
const table = ref(toolsext.TABCIRCUITS)
@@ -88,6 +96,11 @@ export default defineComponent({
tools,
table,
myusername,
circuitStore,
t,
account,
qtarem,
saldo,
}
},
})

View File

@@ -1,7 +1,7 @@
<template>
<div v-if="tools.isUserOk()">
<div v-if="circuit">
<q-item class="q-my-sm" clickable>
<q-item class="q-my-sm bordo_stondato_circuiti" clickable>
<q-item-section avatar @click="naviga(tools.getPathByTableAndRec(table, circuit))">
<q-avatar size="60px">
<q-img :src="getImgCircuit(circuit)" :alt="circuit.name" img-class="imgprofile" height="60px"/>
@@ -9,40 +9,35 @@
</q-item-section>
<q-item-section @click="naviga(tools.getPathByTableAndRec(table, circuit))">
<q-item-label><strong>{{ circuit.name }}</strong> ({{ circuit.subname }})
<q-item-label><strong>{{ circuit.name }}</strong> <span v-if="circuit.subname"> ({{ circuit.subname }})</span>
</q-item-label>
<q-item-label v-if="circuit.longdescr" caption lines="3"><em>{{ circuit.longdescr }}</em></q-item-label>
</q-item-section>
<q-item-section side v-if="visu === costanti.MY_CIRCUITS">
<q-item-label>
<q-btn rounded icon="fas fa-ellipsis-h">
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable icon="fas fa-user-minus" v-close-popup
@click="tools.setCmd($q, shared_consts.CIRCUITCMD.REMOVE_FROM_MYLIST, myusername(), '', circuit.NAME)">
<q-item-section>{{ $t('circuit.remove_from_mylist') }}</q-item-section>
</q-item>
</q-list>
<q-list v-if="tools.iAmAdminCircuit(circuit.name)" style="min-width: 200px">
<q-item clickable v-close-popup @click="tools.setCmd($q, shared_consts.CIRCUITCMD.DELETE, myusername(), '', circuit.name)">
<q-item-section>{{ $t('circuit.delete') }}</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-item-label lines="1">
<CSaldo
:symbol="circuit.symbol"
:color="circuit.color"
:saldo="saldo"
:qtarem="qtarem"
>
</CSaldo>
</q-item-label>
</q-item-section>
<q-item-section side v-if="visu === costanti.USER_CIRCUITS">
<q-item-label>
<q-btn rounded :icon="userStore.IsMyCircuitByName(circuit.name) ? `fas fa-ellipsis-h` : `fas fa-user`">
<q-menu>
<q-list v-if="(!userStore.IsMyCircuitByName(circuit.name) && !userStore.IsAskedCircuitByName(circuit.name) && !userStore.IsRefusedCircuitByName(circuit.name))" style="min-width: 200px">
<q-list
v-if="(!userStore.IsMyCircuitByName(circuit.name) && !userStore.IsAskedCircuitByName(circuit.name) && !userStore.IsRefusedCircuitByName(circuit.name))"
style="min-width: 200px">
<q-item clickable v-close-popup @click="tools.setCmd($q, shared_consts.CIRCUITCMD.REQ, myusername(), true, circuitname)">
<q-item-section>{{ $t('circuit.ask') }}</q-item-section>
</q-item>
</q-list>
<q-list v-else-if="(!userStore.IsMyCircuitByName(circuit.name) && userStore.IsAskedCircuitByName(circuit.name) && !userStore.IsRefusedCircuitByName(circuit.name))" style="min-width: 200px">
<q-list
v-else-if="(!userStore.IsMyCircuitByName(circuit.name) && userStore.IsAskedCircuitByName(circuit.name) && !userStore.IsRefusedCircuitByName(circuit.name))"
style="min-width: 200px">
<q-item clickable v-close-popup @click="tools.setCmd($q, shared_consts.CIRCUITCMD.REQ, myusername(), false, circuit.name)">
<q-item-section>{{ $t('shared.refuse_ask') }}</q-item-section>
</q-item>
@@ -108,5 +103,5 @@
</script>
<style lang="scss" scoped>
@import './CMyCircuit.scss';
@import './CMyCircuit.scss';
</style>

View File

@@ -57,7 +57,7 @@ export default defineComponent({
if (props.modelValue === costanti.CIRCUITS) {
arr = circuitStore.listcircuits
} else if (props.modelValue === costanti.MY_CIRCUITS ) {
arr = userStore.my.profile.mycircuits
arr = circuitStore.listcircuits.filter((circ: any) => userStore.my.profile.mycircuits.findIndex((rec: any) => circ.name === rec.circuitname) >= 0)
} else if (props.modelValue === costanti.MANAGE_CIRCUITS) {
// arr = userStore.my.profile.manage_mycircuits
} else if (props.modelValue === costanti.ASK_SENT_CIRCUIT) {
@@ -72,8 +72,8 @@ export default defineComponent({
const myoptions = computed(() => {
const mybutt = []
mybutt.push({ label: t('mypages.find_circuit'), value: costanti.FIND_CIRCUIT })
mybutt.push({ label: t('mypages.follow_circuits') + ' (' + numMyCircuits.value + ')', value: costanti.MY_CIRCUITS })
mybutt.push({ label: t('mypages.find_circuit'), value: costanti.FIND_CIRCUIT })
// mybutt.push({ label: t('mypages.manage_my_circuits') + ' (' + numManageCircuits.value + ')', value: costanti.MANAGE_CIRCUITS })

View File

@@ -69,6 +69,7 @@ export default defineComponent({
lasts_notifs_req,
num_notifs,
clickNotif,
userStore,
}
},
})

View File

@@ -7,7 +7,7 @@
color="primary q-title"
style="text-align: center;">
<template v-slot:avatar>
<q-icon name="fas fa-exclamation-triangle" color="yellow" size="xs" />
<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">
@@ -28,7 +28,7 @@
<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"
<q-item-label caption lines="18"
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">
@@ -41,7 +41,7 @@
<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)"
@click="tools.refuseCoins(q, notif.sender, notif)"
/>
</div>
</q-item-label>

View File

51
src/components/CSaldo/CSaldo.ts Executable file
View File

@@ -0,0 +1,51 @@
import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { tools } from '@src/store/Modules/tools'
import { CCurrencyValue } from '../CCurrencyValue'
import { date, useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
export default defineComponent({
name: 'CSaldo',
props: {
symbol: {
type: String,
required: true,
},
saldo: {
type: Number,
required: true,
default: 0,
},
qtarem: {
type: Number,
required: false,
default: 0,
},
color: {
type: String,
required: false,
default: '',
},
},
components: { CCurrencyValue },
setup(props, { emit }) {
const $q = useQuasar()
const { t } = useI18n()
const showingtooltip = ref(false)
function created() {
// created
}
onMounted(created)
return {
showingtooltip,
t,
}
},
})

View File

@@ -0,0 +1,18 @@
<template>
<CCurrencyValue
:symbol="symbol"
:tips="t('account.saldo_tips')"
:color="color"
:value="saldo"
:label="t('account.saldo') + ` (max ` + qtarem + `)`">
</CCurrencyValue>
</template>
<script lang="ts" src="./CSaldo.ts">
</script>
<style lang="scss" scoped>
@import './CSaldo.scss';
</style>

1
src/components/CSaldo/index.ts Executable file
View File

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

View File

@@ -2,7 +2,7 @@ import { computed, defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { IAccount, ICircuit, IOperators, ISendCoin, ISpecialField, IUserFields } from '../../model'
import { tools } from '@store/Modules/tools'
import { CCurrencyValue } from '@/components/CCurrencyValue'
import { CSaldo } from '@/components/CSaldo'
import { useUserStore } from '@store/UserStore'
import { useCircuitStore } from '@store/CircuitStore'
import { useQuasar } from 'quasar'
@@ -23,7 +23,7 @@ export default defineComponent({
required: true,
},
},
components: { CCurrencyValue, CMyUser },
components: { CSaldo, CMyUser },
setup(props, { emit }) {
const $q = useQuasar()
@@ -53,6 +53,7 @@ export default defineComponent({
const qtyRef = ref(<any>null)
watch(() => circuitsel.value, (newval, oldval) => {
tools.setCookie(tools.CIRCUIT_USE, newval)
aggiorna()
})
@@ -96,10 +97,6 @@ export default defineComponent({
}
}
console.log('circuitStore.listcircuits', circuitStore.listcircuits, 'aggiorna', circuitloaded.value)
console.log('userStore.my.profile.mycircuits', userStore.my.profile.mycircuits)
}
function mounted() {
@@ -109,9 +106,7 @@ export default defineComponent({
bothcircuits.value = userStore.IsMyCircuitByUser(props.to_user)
if (bothcircuits.value.length === 1) {
circuitsel.value = bothcircuits.value[0]
}
circuitsel.value = tools.getCookie(tools.CIRCUIT_USE, bothcircuits.value[0])
aggiorna()

View File

@@ -13,14 +13,14 @@
<q-select rounded outlined v-model="circuitsel" :options="bothcircuits" label="Circuito">
</q-select>
<CCurrencyValue
<CSaldo
:symbol="circuitloaded.symbol"
:tips="t('account.saldo_tips')"
:color="circuitloaded.color"
:value="accountloaded ? accountloaded.saldo : 0"
:label="t('account.saldo')">
:saldo="accountloaded ? accountloaded.saldo : 0"
:qtarem="accountloaded ? circuitStore.getRemainingCoinsToSend(accountloaded) : 0"
>
</CCurrencyValue>
</CSaldo>
<q-input v-model="from_username" label="Mittente" class="full-width" readonly>
</q-input>
@@ -31,14 +31,14 @@
labelextra="Destinatario"
>
</CMyUser>
<q-input v-model="causal" label="Note" class="full-width">
</q-input>
<div>
<q-input
mask="#.##"
reverse-fill-mask
ref="qtyRef"
class="q-py-sm text-h5"
outlined v-model="qty" type="number"
outlined v-model="qty" type="text"
: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})"
>
@@ -52,6 +52,8 @@
</q-input>
<q-slider
class="q-ma-xs"
v-if="(qty !== '') && circuitStore.getRemainingCoinsToSend(accountloaded) > 0"
v-model="qty"
color="green"
markers
@@ -68,6 +70,9 @@
/>
</div>
<q-input v-model="causal" label="Note" class="q-my-sm full-width">
</q-input>
</q-card-section>
<q-card-actions align="center">
<q-btn