Conto Comunitario...

This commit is contained in:
Surya Paolo
2023-01-12 01:03:19 +01:00
parent 2acf161d5d
commit 3d77cf671d
21 changed files with 436 additions and 65 deletions

View File

@@ -11,7 +11,13 @@ import { CRegistration } from '@/components/CRegistration'
export default defineComponent({ export default defineComponent({
name: 'CCheckIfIsLogged', name: 'CCheckIfIsLogged',
components: { CRegistration }, components: { CRegistration },
props: {}, props: {
showalways: {
type: Boolean,
required: true,
default: false,
},
},
setup(props, { emit }) { setup(props, { emit }) {
const userStore = useUserStore() const userStore = useUserStore()

View File

@@ -1,5 +1,5 @@
<template> <template>
<div v-if="!tools.isLogged()"> <div v-if="showalways || (!showalways && !tools.isLogged())">
<div class="q-pa-md q-gutter-sm"> <div class="q-pa-md q-gutter-sm">
<div id="logo" class="text-center"> <div id="logo" class="text-center">
<q-img <q-img

View File

@@ -974,6 +974,16 @@
</div> </div>
</div> </div>
<div v-else-if="myel.type === shared_consts.ELEMTYPE.CHECK_EMAIL"></div> <div v-else-if="myel.type === shared_consts.ELEMTYPE.CHECK_EMAIL"></div>
<div v-else-if="myel.type === shared_consts.ELEMTYPE.CHECKIFISLOGGED">
<q-select
v-model="myel.container"
:options="[{label: 'Mostra Sempre', value: true, label: 'Solo se Offline', value: false}]"
label="Quando mostrarlo"
emit-value
map-options
>
</q-select>
</div>
</div> </div>
</div> </div>
<div> <div>

View File

@@ -478,7 +478,7 @@
</div> </div>
<div v-else-if="myel.type === shared_consts.ELEMTYPE.CHECKIFISLOGGED"> <div v-else-if="myel.type === shared_consts.ELEMTYPE.CHECKIFISLOGGED">
<div v-if="editOn" class="elemEdit">CCheckIfIsLogged</div> <div v-if="editOn" class="elemEdit">CCheckIfIsLogged</div>
<CCheckIfIsLogged></CCheckIfIsLogged> <CCheckIfIsLogged :showalways="myel.container"></CCheckIfIsLogged>
</div> </div>
<div v-else-if="myel.type === shared_consts.ELEMTYPE.INFO_VERSION"> <div v-else-if="myel.type === shared_consts.ELEMTYPE.INFO_VERSION">
<div>Versione: {{ tools.getvers() }}</div> <div>Versione: {{ tools.getvers() }}</div>

View File

@@ -95,22 +95,24 @@ export default defineComponent({
const mybutt = [] const mybutt = []
mybutt.push({ label: t('mypages.find_people'), value: costanti.FIND_PEOPLE }) mybutt.push({ label: t('mypages.find_people'), value: costanti.FIND_PEOPLE })
if (numFriends.value > 0 || props.modelValue === costanti.FRIENDS) if (costanti.ENABLE_FRIENDS) {
mybutt.push({ label: t('mypages.friends') + ' (' + numFriends.value + ')', value: costanti.FRIENDS }) if (numFriends.value > 0 || props.modelValue === costanti.FRIENDS)
mybutt.push({ label: t('mypages.friends') + ' (' + numFriends.value + ')', value: costanti.FRIENDS })
if (numReqFriends.value > 0 || props.modelValue === costanti.REQ_FRIENDS)
mybutt.push({
label: t('mypages.request_friends') + ' (' + numReqFriends.value + ')',
value: costanti.REQ_FRIENDS
})
if (numAskSentFriends.value > 0 || props.modelValue === costanti.ASK_SENT_FRIENDS)
mybutt.push({
label: t('mypages.request_sent') + ' (' + numAskSentFriends.value + ')',
value: costanti.ASK_SENT_FRIENDS
})
}
if (numReqFriends.value > 0 || props.modelValue === costanti.REQ_FRIENDS)
mybutt.push({
label: t('mypages.request_friends') + ' (' + numReqFriends.value + ')',
value: costanti.REQ_FRIENDS
})
if (numHandShake.value > 0 || props.modelValue === costanti.HANDSHAKE) if (numHandShake.value > 0 || props.modelValue === costanti.HANDSHAKE)
mybutt.push({ label: t('mypages.handshake') + ' (' + numHandShake.value + ')', value: costanti.HANDSHAKE }) mybutt.push({ label: t('mypages.handshake') + ' (' + numHandShake.value + ')', value: costanti.HANDSHAKE })
if (numAskSentFriends.value > 0 || props.modelValue === costanti.ASK_SENT_FRIENDS)
mybutt.push({
label: t('mypages.request_sent') + ' (' + numAskSentFriends.value + ')',
value: costanti.ASK_SENT_FRIENDS
})
if (numAskTrust.value > 0 || props.modelValue === costanti.ASK_TRUST) if (numAskTrust.value > 0 || props.modelValue === costanti.ASK_TRUST)
mybutt.push({ label: t('mypages.request_trust') + ' (' + numAskTrust.value + ')', value: costanti.ASK_TRUST }) mybutt.push({ label: t('mypages.request_trust') + ' (' + numAskTrust.value + ')', value: costanti.ASK_TRUST })
if (numTrusted.value > 0 || props.modelValue === costanti.TRUSTED) if (numTrusted.value > 0 || props.modelValue === costanti.TRUSTED)

View File

@@ -42,6 +42,7 @@ export default defineComponent({
required: false, required: false,
default: false, default: false,
}, },
}, },
setup(props, { emit }) { setup(props, { emit }) {

View File

@@ -0,0 +1,4 @@
.myflex{
display: flex;
flex: 1;
}

View File

@@ -0,0 +1,122 @@
import { defineComponent, onMounted, PropType, ref, watch } from 'vue'
import { useUserStore } from '@store/UserStore'
import { IMyGroup, IImgGallery, IUserFields, IUserProfile, IFriends, ICircuit, IAccount } from 'model'
import { costanti } from '@costanti'
import { shared_consts } from '@/common/shared_vuejs'
import { tools } from '@store/Modules/tools'
import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n'
import { useRoute, useRouter } from 'vue-router'
import { toolsext } from '@store/Modules/toolsext'
import { useCircuitStore } from '@store/CircuitStore'
export default defineComponent({
name: 'CMyGroupOnlyView',
emits: ['setCmd'],
components: {},
props: {
mygrp: {
type: Object as PropType<IMyGroup | null>,
required: false,
default: null,
},
mygroupname: {
type: String,
required: false,
default: null,
},
visu: {
type: Number,
required: true,
},
circuitname: {
type: String,
required: false,
default: '',
},
noaut: {
type: Boolean,
required: false,
default: false,
},
labelextra: {
type: String,
required: false,
default: '',
},
},
setup(props, { emit }) {
const userStore = useUserStore()
const $q = useQuasar()
const { t } = useI18n()
const $router = useRouter()
const $route = useRoute()
const groupname = ref('')
const circuitStore = useCircuitStore()
const showsendCoinTo = ref(false)
const grp = ref(<IMyGroup | null>null)
const table = ref(toolsext.TABMYGROUPS)
const circuit = ref(<ICircuit | null | undefined>null)
watch(() => props.mygrp, (newval, oldval) => {
mounted()
})
function mounted() {
if (!props.mygrp) {
if (props.mygroupname) {
groupname.value = props.mygroupname
//++Todo: carica contact
grp.value = null
}
} else {
if (props.mygrp) {
grp.value = props.mygrp
groupname.value = props.mygrp.groupname
}
}
circuit.value = circuitStore.getCircuitByName(props.circuitname)
}
function getImgGroup(group: IMyGroup) {
return userStore.getImgByGroup(group)
}
function naviga(path: string) {
$router.push(path)
}
function setCmd(cmd: number, myusername: string, value: any = '') {
emit('setCmd', cmd, myusername, value)
}
function myusername() {
return userStore.my.username
}
onMounted(mounted)
return {
grp,
costanti,
getImgGroup,
naviga,
setCmd,
shared_consts,
userStore,
tools,
table,
myusername,
circuit,
showsendCoinTo,
}
},
})

View File

@@ -0,0 +1,41 @@
<template>
<div v-if="tools.isUserOk()">
<div v-if="grp">
<q-item class="q-my-sm" clickable>
<q-item-section
avatar
@click="naviga(tools.getPathByGroup(grp, table))"
>
<q-item-label v-if="labelextra"
><strong>{{ labelextra }}</strong></q-item-label
>
<q-avatar size="60px">
<q-img
:src="getImgGroup(grp)"
:alt="grp.groupname"
img-class="imgprofile"
height="60px"
/>
</q-avatar>
</q-item-section>
<q-item-section @click="naviga(tools.getPathByGroup(grp, table))">
<q-item-label
><strong>{{ grp.title }}</strong> ({{ grp.groupname }})
</q-item-label>
<q-item-label v-if="grp.descr" caption lines="3"
><em>{{ grp.descr }}</em></q-item-label
>
</q-item-section>
</q-item>
</div>
</div>
<div v-else></div>
</template>
<script lang="ts" src="./CMyGroupOnlyView.ts">
</script>
<style lang="scss" scoped>
@import './CMyGroupOnlyView.scss';
</style>

View File

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

View File

@@ -594,7 +594,7 @@
<q-menu> <q-menu>
<q-list style="min-width: 200px"> <q-list style="min-width: 200px">
<q-item <q-item
v-if="!userStore.IsMyFriendByUsername(contact.username)" v-if="costanti.ENABLE_FRIENDS && !userStore.IsMyFriendByUsername(contact.username)"
clickable clickable
icon="fas fa-user-plus" icon="fas fa-user-plus"
v-close-popup v-close-popup
@@ -672,6 +672,7 @@
<q-list style="min-width: 200px"> <q-list style="min-width: 200px">
<q-item <q-item
v-if=" v-if="
costanti.ENABLE_FRIENDS &&
!userStore.IsMyFriendByUsername(contact.username) && !userStore.IsMyFriendByUsername(contact.username) &&
!userStore.IsAskedFriendByUsername(contact.username) !userStore.IsAskedFriendByUsername(contact.username)
" "
@@ -696,6 +697,7 @@
</q-item> </q-item>
<q-item <q-item
v-else-if=" v-else-if="
costanti.ENABLE_FRIENDS &&
!userStore.IsMyFriendByUsername(contact.username) && !userStore.IsMyFriendByUsername(contact.username) &&
userStore.IsAskedFriendByUsername(contact.username) userStore.IsAskedFriendByUsername(contact.username)
" "
@@ -719,7 +721,7 @@
}}</q-item-section> }}</q-item-section>
</q-item> </q-item>
<q-item <q-item
v-else-if="userStore.IsMyFriendByUsername(contact.username)" v-else-if="costanti.ENABLE_FRIENDS && userStore.IsMyFriendByUsername(contact.username)"
style="min-width: 200px" style="min-width: 200px"
clickable clickable
v-close-popup v-close-popup

View File

@@ -8,6 +8,7 @@ import { useCircuitStore } from '@store/CircuitStore'
import { useQuasar } from 'quasar' import { useQuasar } from 'quasar'
import { useI18n } from '@/boot/i18n' import { useI18n } from '@/boot/i18n'
import { CMyUserOnlyView } from '@/components/CMyUserOnlyView' import { CMyUserOnlyView } from '@/components/CMyUserOnlyView'
import { CMyGroupOnlyView } from '@/components/CMyGroupOnlyView'
import { costanti } from '@costanti' import { costanti } from '@costanti'
export default defineComponent({ export default defineComponent({
@@ -22,6 +23,11 @@ export default defineComponent({
type: String, type: String,
default: '' default: ''
}, },
qtydefault: {
type: String,
required: false,
default: '1'
},
to_user: { to_user: {
type: Object as PropType<IUserFields>, type: Object as PropType<IUserFields>,
required: false, required: false,
@@ -38,7 +44,7 @@ export default defineComponent({
default: null, default: null,
}, },
}, },
components: { CSaldo, CMyUserOnlyView }, components: { CSaldo, CMyUserOnlyView, CMyGroupOnlyView },
setup(props, { emit }) { setup(props, { emit }) {
const $q = useQuasar() const $q = useQuasar()
@@ -48,18 +54,22 @@ export default defineComponent({
const circuitStore = useCircuitStore() const circuitStore = useCircuitStore()
const from_username = ref(userStore.my.username) const from_username = ref(userStore.my.username)
const from_groupname = ref('')
const circuitsel = ref('') const circuitsel = ref('')
const qty = ref(<string | number>'') const qty = ref(<string | number>'')
const causal = ref('') const causal = ref('')
const bothcircuits = ref(<any>[]) const bothcircuits = ref(<any>[])
const groupSel = ref(<IMyGroup | null | undefined>null)
const circuitloaded = ref(<ICircuit | undefined>undefined) const circuitloaded = ref(<ICircuit | undefined>undefined)
const circuitdest = ref(<ICircuit | undefined>undefined) const circuitdest = ref(<ICircuit | undefined>undefined)
const accountloaded = ref(<IAccount | undefined>undefined) const accountloaded = ref(<IAccount | undefined | null>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 maxsendable = ref(0)
const numstep = ref(0) const numstep = ref(0)
const tipoConto = 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>[])
@@ -67,20 +77,52 @@ export default defineComponent({
const qtyRef = ref(<any>null) const qtyRef = ref(<any>null)
const causalRef = ref(<any>null) const causalRef = ref(<any>null)
const groupsListAdmin = ref(<IMyGroup[]>[])
const arrGroupsList = ref(<any[]>[])
watch(() => circuitsel.value, (newval, oldval) => { watch(() => circuitsel.value, (newval, oldval) => {
tools.setCookie(tools.CIRCUIT_USE, newval) tools.setCookie(tools.CIRCUIT_USE, newval)
aggiorna() aggiorna()
}) })
watch(() => tipoConto.value, (newval, oldval) => {
aggiorna()
})
watch(() => from_groupname.value, (newval, oldval) => {
aggiorna()
})
watch(() => from_username.value, (newval, oldval) => {
aggiorna()
})
watch(() => props.showprop, (newval, oldval) => { watch(() => props.showprop, (newval, oldval) => {
console.log('props.showprop', props.showprop, newval) console.log('props.showprop', props.showprop, newval)
show.value = newval show.value = newval
}) })
function aggiorna() { function aggiorna() {
groupSel.value = null
accountloaded.value = null
circuitloaded.value = circuitStore.listcircuits.find((rec: ICircuit) => rec.name === circuitsel.value) circuitloaded.value = circuitStore.listcircuits.find((rec: ICircuit) => rec.name === circuitsel.value)
if (circuitloaded.value) { if (circuitloaded.value) {
accountloaded.value = userStore.getAccountByCircuitId(circuitloaded.value._id) if (tipoConto.value === costanti.AccountType.USER) {
accountloaded.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
} else if (tipoConto.value === costanti.AccountType.COMMUNITY_ACCOUNT) {
groupSel.value = userStore.my.profile.manage_mygroups.find((group: IMyGroup) => from_groupname.value === group.groupname)
accountloaded.value = groupSel.value ? groupSel.value.account : null
}
groupsListAdmin.value = userStore.GroupsListWhereIAmAdmin()
arrGroupsList.value = []
for (const group of groupsListAdmin.value) {
arrGroupsList.value.push({ label: group.groupname, value: group.groupname });
}
// accountdest.value = userStore.getAccountByCircuitId(circuitloaded.value._id) // accountdest.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
if (accountloaded.value) { if (accountloaded.value) {
remainingCoins.value = circuitStore.getRemainingCoinsToSend(accountloaded.value) remainingCoins.value = circuitStore.getRemainingCoinsToSend(accountloaded.value)
@@ -132,6 +174,8 @@ export default defineComponent({
circuitsel.value = bothcircuits.value[0] circuitsel.value = bothcircuits.value[0]
} }
qty.value = props.qtydefault
aggiorna() aggiorna()
show.value = true show.value = true
@@ -191,6 +235,8 @@ export default defineComponent({
} }
} }
onMounted(mounted) onMounted(mounted)
return { return {
@@ -217,6 +263,9 @@ export default defineComponent({
numstep, numstep,
costanti, costanti,
userStore, userStore,
tipoConto,
arrGroupsList,
from_groupname,
} }
}, },
}) })

View File

@@ -1,6 +1,11 @@
<template> <template>
<div> <div>
<q-dialog v-model="show" :maximized="$q.screen.lt.sm" @hide="hide" @show="qtyRef ? qtyRef.focus() : ''"> <q-dialog
v-model="show"
:maximized="$q.screen.lt.sm"
@hide="hide"
@show="qtyRef ? 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>
@@ -9,9 +14,14 @@
<q-btn flat round color="white" icon="close" v-close-popup></q-btn> <q-btn flat round color="white" icon="close" v-close-popup></q-btn>
</q-toolbar> </q-toolbar>
<q-card-section class="q-pa-xs inset-shadow"> <q-card-section class="q-pa-xs inset-shadow">
<q-select <q-select
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'" rounded outlined v-model="circuitsel" :options="bothcircuits" label="Circuito"> :behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
rounded
outlined
v-model="circuitsel"
:options="bothcircuits"
label="Circuito"
>
</q-select> </q-select>
<CSaldo <CSaldo
@@ -19,14 +29,58 @@
:symbol="circuitloaded.symbol" :symbol="circuitloaded.symbol"
:color="circuitloaded.color" :color="circuitloaded.color"
:saldo="accountloaded ? accountloaded.saldo : 0" :saldo="accountloaded ? accountloaded.saldo : 0"
:qtarem="accountloaded ? circuitStore.getRemainingCoinsToSend(accountloaded) : 0" :qtarem="
> accountloaded
? circuitStore.getRemainingCoinsToSend(accountloaded)
: 0
"
>
</CSaldo> </CSaldo>
<q-input v-model="from_username" label="Mittente" class="full-width" readonly> <div>
<q-btn-toggle
v-model="tipoConto"
class="my-custom-toggle"
no-caps
rounded
unelevated
toggle-color="primary"
color="white"
text-color="primary"
:options="[
{ label: 'Utente', value: costanti.AccountType.USER },
{
label: 'Conto Comunitario',
value: costanti.AccountType.COMMUNITY_ACCOUNT,
},
]"
/>
</div>
<q-input
v-if="tipoConto === costanti.AccountType.USER"
v-model="from_username"
label="Mittente"
class="full-width"
readonly
>
</q-input> </q-input>
<div v-else>
<q-select
v-model="from_groupname"
:options="arrGroupsList"
label="Gruppo"
rounded
emit-value
map-options
>
<!-- Mostra i gruppi su cui sei Admin -->
</q-select>
</div>
<!-- Destination -->
<CMyUserOnlyView <CMyUserOnlyView
v-if="to_user"
:mycontact="to_user" :mycontact="to_user"
:visu="costanti.FIND_PEOPLE" :visu="costanti.FIND_PEOPLE"
@setCmd="tools.setCmd" @setCmd="tools.setCmd"
@@ -34,44 +88,77 @@
> >
</CMyUserOnlyView> </CMyUserOnlyView>
<CMyGroupOnlyView v-if="to_group" :mygrp="to_group" :visu="costanti.USER_GROUPS"
:circuitname="circuitloaded.name"
labelextra="Destinatario">
</CMyGroupOnlyView>
<div v-if="circuitloaded"> <div v-if="circuitloaded">
<q-banner <q-banner
v-if="!circuitloaded.transactionsEnabled" v-if="!circuitloaded.transactionsEnabled"
rounded rounded
class="bg-red text-white" class="bg-red text-white"
style="text-align: center;" style="text-align: center"
> >
<em style="font-weight: bold">{{ $t('circuit.transactionsEnabled_text') }}</em><br> <em style="font-weight: bold">{{
$t('circuit.transactionsEnabled_text')
}}</em
><br />
</q-banner> </q-banner>
<q-input <q-input
ref="qtyRef" ref="qtyRef"
class="q-py-sm text-h5" class="q-py-sm text-h5"
outlined v-model="qty" type="number" outlined
v-model="qty"
type="number"
:rules="[ :rules="[
val => val <= circuitStore.getRemainingCoinsToSend(accountloaded) || t('circuit.qta_remaining_to_send', { maxqta: circuitStore.getRemainingCoinsToSend(accountloaded), symbol: circuitloaded.symbol }), (val) =>
val => val > 0 || t('circuit.qta_not_valid')]" val <= circuitStore.getRemainingCoinsToSend(accountloaded) ||
:label="t('movement.amount_to_send', {qtamax: circuitStore.getRemainingCoinsToSend(accountloaded) ? circuitStore.getRemainingCoinsToSend(accountloaded).toFixed(2) : 0 + ` ` + circuitloaded.symbol})" t('circuit.qta_remaining_to_send', {
maxqta: circuitStore.getRemainingCoinsToSend(accountloaded),
symbol: circuitloaded.symbol,
}),
(val) => val > 0 || t('circuit.qta_not_valid'),
]"
:label="
t('movement.amount_to_send', {
qtamax: circuitStore.getRemainingCoinsToSend(accountloaded)
? circuitStore
.getRemainingCoinsToSend(accountloaded)
.toFixed(2)
: 0 + ` ` + circuitloaded.symbol,
})
"
input-class="text-right" input-class="text-right"
v-on:keyup.enter="$event.target.nextElementSibling.focus()" v-on:keyup.enter="$event.target.nextElementSibling.focus()"
> >
<!--val => val > circuitStore.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" <em
:style="`background-color: ` + (circuitloaded.color ? circuitloaded.color : '#ff5500')">{{ circuitloaded.symbol }}</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>
<q-slider <q-slider
class="q-ma-xs" class="q-ma-xs"
v-if="(qty !== '') && circuitStore.getRemainingCoinsToSend(accountloaded) > 0" v-if="
qty !== '' &&
circuitStore.getRemainingCoinsToSend(accountloaded) > 0
"
v-model="qty" v-model="qty"
color="green" color="green"
markers markers
track-size="10px" track-size="10px"
:step="numstep/2" :step="numstep / 2"
:marker-labels="arrayMarkerLabel" :marker-labels="arrayMarkerLabel"
label-always label-always
:label-value="priceLabel" :label-value="priceLabel"
@@ -79,23 +166,42 @@
switch-marker-labels-side switch-marker-labels-side
:inner-max="remainingCoins" :inner-max="remainingCoins"
:min="0" :min="0"
:max="Number(maxsendable ? maxsendable: 0)" :max="Number(maxsendable ? maxsendable : 0)"
/> />
</div> </div>
<q-input <q-input
ref="causalRef" ref="causalRef"
v-model="causal" label="Note" class="q-my-sm full-width"> v-model="causal"
label="Note"
class="q-my-sm full-width"
>
</q-input> </q-input>
</q-card-section> </q-card-section>
<q-card-actions align="center"> <q-card-actions align="center">
<q-btn <q-btn
v-if="circuitloaded" v-if="circuitloaded"
:disable="qtyRef ? (qtyRef.hasError || !circuitloaded.transactionsEnabled) : false" :disable="
:label="$t('circuit.sendcoinsto', {qty, coin: circuitsel, dest: to_group ? to_group.groupname : to_user.username })" color="positive" qtyRef
@click="sendCoin()"></q-btn> ? qtyRef.hasError || !circuitloaded.transactionsEnabled
<q-btn flat :label="$t('dialog.cancel')" color="primary" v-close-popup></q-btn> : false
"
:label="
$t('circuit.sendcoinsto', {
qty,
coin: circuitsel,
dest: to_group ? to_group.groupname : 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> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>

View File

@@ -41,6 +41,8 @@ export interface IMyGroup {
date_blocked?: Date date_blocked?: Date
createdBy?: string createdBy?: string
mycircuits?: IMyCircuit[] mycircuits?: IMyCircuit[]
account?: IAccount
} }
export interface ICalcStat { export interface ICalcStat {

View File

@@ -1051,7 +1051,7 @@ const msg_it = {
friends: 'Amici', friends: 'Amici',
bacheca: 'Bacheca', bacheca: 'Bacheca',
services: 'Servizi', services: 'Servizi',
handshake: 'Strette', handshake: 'Raporti di fiducia',
hosp: 'Ospitalità', hosp: 'Ospitalità',
events: 'Eventi', events: 'Eventi',
goods: 'Beni', goods: 'Beni',
@@ -1060,7 +1060,7 @@ const msg_it = {
request_friends: 'Richieste Amicizia', request_friends: 'Richieste Amicizia',
request_sent: 'Richieste Inviate', request_sent: 'Richieste Inviate',
request_trust: 'Richieste Fiducia', request_trust: 'Richieste Fiducia',
trusted: 'Fiducia Accettata', trusted: 'Amici inseriti',
rejected: 'Rifiutati', rejected: 'Rifiutati',
provapao: 'Prova pao', provapao: 'Prova pao',
circuits: 'Circuiti', circuits: 'Circuiti',

View File

@@ -17,6 +17,14 @@ export const costanti = {
CERCO: 2, CERCO: 2,
}, },
ENABLE_FRIENDS: false,
ENABLE_CONTI_COMUNITARI: true,
AccountType: {
USER: 0,
COMMUNITY_ACCOUNT: 1,
},
Lang: { Lang: {
IT: 1, IT: 1,
EN: 2, EN: 2,

View File

@@ -6543,6 +6543,31 @@ export const tools = {
}, },
getGroupsWhereIAmTheAdminOfTheCircuit(name: string, username: string) {
const userStore = useUserStore()
let arr: any[] = []
let risultato = false
if (userStore.my.profile.manage_mycircuits) {
const ris = userStore.my.profile.manage_mycircuits.find((circuit: ICircuit) => {
if (circuit.name === name) {
return true
}
})
// console.log('ris', ris)
if (ris && ris.admins) {
const isadmin = ris.admins.find((user: IFriends) => user.username === username)
risultato = !!isadmin
}
}
return arr
},
setCmd($q: any, cmd: number, username: string, value: any, dest: string) { setCmd($q: any, cmd: number, username: string, value: any, dest: string) {
console.log('setcmd', cmd) console.log('setcmd', cmd)
if (cmd === shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP) { if (cmd === shared_consts.GROUPSCMD.REMOVE_FROM_MYGROUP) {

View File

@@ -244,20 +244,8 @@ export const useUserStore = defineStore('UserStore', {
return false return false
}, },
GroupsListWhereIAmAdmin(username: string): string[] { GroupsListWhereIAmAdmin(): IMyGroup[] {
let myarr: any[] = [] return this.my.profile.manage_mygroups
const globalStore = useGlobalStore()
if (this.my.profile && globalStore.mygroups) {
myarr = globalStore.mygroups.filter((mygroup: IMyGroup) => {
if (mygroup.admins && mygroup.admins.findIndex((useradmin: IUserAdmins) => useradmin.username === username) >= 0) {
return true
}
return false
})
}
return myarr
}, },
IsAskedFriendByUsername(username: string): boolean { IsAskedFriendByUsername(username: string): boolean {

View File

@@ -20,7 +20,7 @@ import { toolsext } from '@store/Modules/toolsext'
import { useQuasar } from 'quasar' import { useQuasar } from 'quasar'
import { CNotifAtTop } from '@src/components/CNotifAtTop' import { CNotifAtTop } from '@src/components/CNotifAtTop'
import { costanti } from '@costanti' import { costanti } from '@costanti'
import { ICity, IFriends, ICircuit, ISearchList, IUserFields, IAccount } from 'model' import { ICity, IFriends, ICircuit, ISearchList, IUserFields, IAccount, IMyGroup } from 'model'
import { shared_consts } from '@/common/shared_vuejs' import { shared_consts } from '@/common/shared_vuejs'
import { colmyUserPeople, colmyUserPeopleSaldi, colmyUserCircuit, colmyMovement, colmyMovementTable } from '@store/Modules/fieldsTable' import { colmyUserPeople, colmyUserPeopleSaldi, colmyUserCircuit, colmyMovement, colmyMovementTable } from '@store/Modules/fieldsTable'
import { useNotifStore } from '@store/NotifStore' import { useNotifStore } from '@store/NotifStore'
@@ -44,7 +44,7 @@ export default defineComponent({
const showonlymine = ref(true) const showonlymine = ref(true)
const tabellare = ref(false) const tabellare = ref(false)
const groupsListAdmin = ref(<string[]>[]) const groupsListAdmin = ref(<IMyGroup[]>[])
const groupnameSel = ref('') const groupnameSel = ref('')
const animation = ref('fade') const animation = ref('fade')
@@ -267,7 +267,7 @@ export default defineComponent({
await loadCircuit() await loadCircuit()
if (userStore.my.username) if (userStore.my.username)
groupsListAdmin.value = userStore.GroupsListWhereIAmAdmin(userStore.my.username) groupsListAdmin.value = userStore.GroupsListWhereIAmAdmin()
} }

View File

@@ -68,7 +68,7 @@
<div> <div>
<q-banner <q-banner
v-if=" v-if="
userStore.my.profile.calc.numGoodsAndServices <= 0 && userStore.my.profile && userStore.my.profile.calc.numGoodsAndServices <= 0 &&
userStore.IsMyCircuitByName(circuit.name) userStore.IsMyCircuitByName(circuit.name)
" "
rounded rounded
@@ -228,7 +228,7 @@
icon="fas fa-file-word" icon="fas fa-file-word"
></q-tab> ></q-tab>
<q-tab <q-tab
v-if="false && tools.iAmAdminCircuit(circuit.name)" v-if="costanti.ENABLE_CONTI_COMUNITARI && tools.iAmAdminCircuit(circuit.name)"
:label="t('circuit.gruppicom')" :label="t('circuit.gruppicom')"
name="gruppicom" name="gruppicom"
icon="fas fa-coins" icon="fas fa-coins"

View File

@@ -415,6 +415,7 @@
<div <div
class="row centeritems q-ma-sm q-pa-sm" class="row centeritems q-ma-sm q-pa-sm"
v-if=" v-if="
costanti.ENABLE_FRIENDS &&
userStore.IsReqFriendByUsername( userStore.IsReqFriendByUsername(
userStore.userprofile.username userStore.userprofile.username
) )
@@ -449,6 +450,7 @@
<div v-else> <div v-else>
<q-btn <q-btn
v-if=" v-if="
costanti.ENABLE_FRIENDS &&
!userStore.IsMyFriendByUsername( !userStore.IsMyFriendByUsername(
userStore.userprofile.username userStore.userprofile.username
) && ) &&
@@ -507,6 +509,7 @@
</q-item> </q-item>
<q-item <q-item
v-if=" v-if="
costanti.ENABLE_FRIENDS &&
userStore.IsMyFriendByUsername( userStore.IsMyFriendByUsername(
userStore.userprofile.username userStore.userprofile.username
) )
@@ -582,6 +585,7 @@
<q-btn <q-btn
v-if=" v-if="
costanti.ENABLE_FRIENDS &&
userStore.IsAskedFriendByUsername( userStore.IsAskedFriendByUsername(
userStore.userprofile.username userStore.userprofile.username
) && ) &&