fix button registration disabled

Conto Comunitario... passo 2
This commit is contained in:
Surya Paolo
2023-01-13 12:29:34 +01:00
parent 3d77cf671d
commit 42d68eb4b8
17 changed files with 287 additions and 162 deletions

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.5.56" APP_VERSION="0.5.58"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.5.56" APP_VERSION="0.5.58"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.5.56" APP_VERSION="0.5.58"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.5.56" APP_VERSION="0.5.58"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="13" APP_ID="13"
DIRECTORY_LOCAL=newfreeplanet DIRECTORY_LOCAL=newfreeplanet

View File

@@ -1,4 +1,4 @@
APP_VERSION="0.5.56" APP_VERSION="0.5.58"
SERVICE_WORKER_FILE="service-worker.js" SERVICE_WORKER_FILE="service-worker.js"
APP_ID="14" APP_ID="14"
DIRECTORY_LOCAL="newfreeplanet" DIRECTORY_LOCAL="newfreeplanet"

View File

@@ -41,9 +41,8 @@
<div class="q-ma-sx"> <div class="q-ma-sx">
<q-btn <q-btn
v-if=" v-if="
userStore.getMyCircuitsInCommonByUser(myuser).length > 0 && userStore.getMyCircuitsInCommonByUser(myuser).length > 0 &&
myuser.username !== myusername() && ((contact.username !== userStore.my.username) || userStore.hoContiComunitariDaAmministrare())
userStore.my.profile.calc.numGoodsAndServices > 0
" "
icon="fas fa-coins" icon="fas fa-coins"
color="green" color="green"

View File

@@ -1,20 +1,48 @@
<template> <template>
<div v-if="small"> <div v-if="small">
<q-chip <q-chip
dense class="cltexth4 chipbooked shadow-5 q-pa-sm2" dense
class="cltexth4 chipbooked shadow-5 q-pa-sm2"
size="md" size="md"
:color="value > 0 ? `green` : value === 0 ? `gray` : `red`" text-color="white" :color="value > 0 ? `green` : value === 0 ? `gray` : `red`"
icon="fas fa-coins"> text-color="white"
{{ tools.roundDec2(value) }} <span class="text-currency">&nbsp;<em class="q-pa-xxs text-white rounded-borders shadow-2" :style="`background-color: ` + (color ? color : '#ff5500')">{{ symbol }}</em></span> icon="fas fa-coins"
>
{{ tools.roundDec2(value) }}
<span class="text-currency"
>&nbsp;<em
class="q-pa-xxs text-white rounded-borders shadow-2"
:style="`background-color: ` + (color ? color : '#ff5500')"
>{{ symbol }}</em
></span
>
</q-chip> </q-chip>
</div> </div>
<div v-else> <div v-else>
<div v-if="value !== null" :class="`text-h5 ` + (small ? `bordo_stondato_small`: `bordo_stondato_stretto`) + ` full-width`" <div
:style="(!$q.screen.lt.sm && !small ? `min-width: 250px; ` : (small ? ` max-width: 120px;` : ``)) + (color_border ? `border-color: ` + color_border + `!important;`: '')"> v-if="value !== null"
<div class="text-center text-h7-dense text-italic text-grey-14"> :class="
<span v-if="small"> `text-h5 ` +
<em class="q-px-xs text-white rounded-borders" :style="`background-color: ` + (color ? color : '#ff5500')">{{ symbol }}</em> (small ? `bordo_stondato_small` : `bordo_stondato_stretto`) +
</span> ` full-width`
"
:style="
(!$q.screen.lt.sm && !small
? `min-width: 250px; `
: small
? ` max-width: 120px;`
: ``) +
(color_border ? `border-color: ` + color_border + `!important;` : '')
"
>
<div :class="`text-center text-h7-dense text-italic ` + ($q.dark.isActive ? `text-grey-6`: `text-grey-14`)">
<span v-if="small">
<em
class="q-px-xs text-white rounded-borders"
:style="`background-color: ` + (color ? color : '#ff5500')"
>{{ symbol }}</em
>
</span>
<span v-else>{{ label }}</span> <span v-else>{{ label }}</span>
</div> </div>
<div> <div>
@@ -24,36 +52,42 @@
:readonly="readonly" :readonly="readonly"
type="number" type="number"
rounded rounded
:class="!small ? `q-px-sm text-h5`: `q-px-xs text-h7`" :class="!small ? `q-px-sm text-h5` : `q-px-xs text-h7`"
:color="value > 0 ? `green` : `red`" :color="value > 0 ? `green` : `red`"
> >
<template v-slot:prepend> <template v-slot:prepend>
<!--<img src="https://cdn.quasar.dev/logo-v2/svg/logo.svg">--> <!--<img src="https://cdn.quasar.dev/logo-v2/svg/logo.svg">-->
<q-btn v-if="tips && !small" <q-btn
icon="fas fa-info" v-if="tips && !small"
color="primary" text-color="white" icon="fas fa-info"
round color="primary"
size="sm" text-color="white"
@click="showingtooltip = !showingtooltip" round
size="sm"
@click="showingtooltip = !showingtooltip"
> >
</q-btn> </q-btn>
<q-icon v-else name="fas fa-coins" :size="small ? `xs`: `sm`"/> <q-icon v-else name="fas fa-coins" :size="small ? `xs` : `sm`" />
</template> </template>
<template v-slot:control> <template v-slot:control>
<div :class="`align_elem_right `+ (small ? `text-h7` : ``)">{{ valueextra }}{{ tools.roundDec2(value) }} <div :class="`align_elem_right ` + (small ? `text-h7` : ``)">
<q-tooltip :offset="[10, 10]" v-model="showingtooltip">{{ tips }}</q-tooltip> {{ valueextra }}{{ tools.roundDec2(value) }}
<q-tooltip :offset="[10, 10]" v-model="showingtooltip">{{
tips
}}</q-tooltip>
</div> </div>
</template> </template>
<template v-slot:append> <template v-slot:append>
<div v-if="!small" :class="small ? `text-h7-dense` : `text-h7`"> <div v-if="!small" :class="small ? `text-h7-dense` : `text-h7`">
<em class="q-px-sm text-white rounded-borders" :style="`background-color: ` + (color ? color : '#ff5500')">{{ symbol }}</em> <em
class="q-px-sm text-white rounded-borders"
:style="`background-color: ` + (color ? color : '#ff5500')"
>{{ symbol }}</em
>
</div> </div>
</template> </template>
</q-field> </q-field>
</div> </div>
</div> </div>
</div> </div>
</template> </template>

View File

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

View File

@@ -59,8 +59,7 @@
<q-btn <q-btn
v-if=" v-if="
userStore.getMyCircuitsInCommonByUser(contact).length > 0 && userStore.getMyCircuitsInCommonByUser(contact).length > 0 &&
contact.username !== userStore.my.username && ((contact.username !== userStore.my.username) || userStore.hoContiComunitariDaAmministrare())
userStore.my.profile.calc.numGoodsAndServices > 0
" "
icon="fas fa-coins" icon="fas fa-coins"
color="green" color="green"

View File

@@ -69,7 +69,7 @@ export default defineComponent({
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 tipoConto = ref(costanti.AccountType.USER)
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>[])
@@ -222,7 +222,8 @@ export default defineComponent({
myrecsendcoin.groupdest = props.to_group ? props.to_group.groupname : '' myrecsendcoin.groupdest = props.to_group ? props.to_group.groupname : ''
myrecsendcoin.dest = props.to_user ? props.to_user.username : '' myrecsendcoin.dest = props.to_user ? props.to_user.username : ''
myrecsendcoin.grouporig = props.from_group ? props.from_group.groupname : ''
myrecsendcoin.grouporig = tipoConto.value === costanti.AccountType.COMMUNITY_ACCOUNT ? from_groupname.value : ''
if (myrecsendcoin) { if (myrecsendcoin) {
tools.sendCoinsByCircuit($q, circuitloaded.value, myrecsendcoin) tools.sendCoinsByCircuit($q, circuitloaded.value, myrecsendcoin)

View File

@@ -24,74 +24,96 @@
> >
</q-select> </q-select>
<CSaldo <q-banner
v-if="circuitloaded" rounded
:symbol="circuitloaded.symbol" dense
:color="circuitloaded.color" class="shadow-5 q-my-sm"
:saldo="accountloaded ? accountloaded.saldo : 0" color="primary q-title"
:qtarem=" style="text-align: center"
accountloaded
? circuitStore.getRemainingCoinsToSend(accountloaded)
: 0
"
> >
</CSaldo> <div class="mybanner_left bg-blue text-white q-mb-sm">
{{$t('circuit.sender')}}:
<div> </div>
<q-btn-toggle <div>
v-model="tipoConto" <q-btn-toggle
class="my-custom-toggle" v-if="arrGroupsList.length > 0"
no-caps v-model="tipoConto"
rounded class="my-custom-toggle"
unelevated no-caps
toggle-color="primary" rounded
color="white" unelevated
text-color="primary" toggle-color="primary"
:options="[ color="white"
{ label: 'Utente', value: costanti.AccountType.USER }, text-color="primary"
{ :options="[
label: 'Conto Comunitario', { label: $t('circuit.user'), value: costanti.AccountType.USER },
value: costanti.AccountType.COMMUNITY_ACCOUNT, {
}, label: $t('circuit.contocom'),
]" value: costanti.AccountType.COMMUNITY_ACCOUNT,
/> },
</div> ]"
/>
<q-input </div>
v-if="tipoConto === costanti.AccountType.USER" <q-input
v-model="from_username" v-if="tipoConto === costanti.AccountType.USER"
label="Mittente" v-model="from_username"
class="full-width" class="full-width"
readonly readonly
>
</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-input>
</q-select> <div v-else>
</div> <q-select
v-model="from_groupname"
:options="arrGroupsList"
:label="$t('circuit.choosecontocom')"
rounded
emit-value
map-options
>
<!-- Mostra i gruppi su cui sei Admin -->
</q-select>
</div>
<!-- Destination --> <CSaldo
<CMyUserOnlyView v-if="circuitloaded"
v-if="to_user" :symbol="circuitloaded.symbol"
:mycontact="to_user" :color="circuitloaded.color"
:visu="costanti.FIND_PEOPLE" :saldo="accountloaded ? accountloaded.saldo : 0"
@setCmd="tools.setCmd" :qtarem="
labelextra="Destinatario" accountloaded
? circuitStore.getRemainingCoinsToSend(accountloaded)
: 0
"
>
</CSaldo>
</q-banner>
<q-banner
rounded
dense
class="shadow-5 q-my-sm"
color="primary q-title"
> >
</CMyUserOnlyView> <div class="mybanner_left bg-green text-white q-mb-sm">
{{$t('circuit.dest')}}
</div>
<CMyGroupOnlyView v-if="to_group" :mygrp="to_group" :visu="costanti.USER_GROUPS" <!-- Destination -->
:circuitname="circuitloaded.name" <CMyUserOnlyView
labelextra="Destinatario"> v-if="to_user"
</CMyGroupOnlyView> :mycontact="to_user"
:visu="costanti.FIND_PEOPLE"
@setCmd="tools.setCmd"
>
</CMyUserOnlyView>
<CMyGroupOnlyView
v-if="to_group"
:mygrp="to_group"
:visu="costanti.USER_GROUPS"
:circuitname="circuitloaded.name"
>
</CMyGroupOnlyView>
</q-banner>
<div v-if="circuitloaded"> <div v-if="circuitloaded">
<q-banner <q-banner
@@ -148,7 +170,7 @@
</template> </template>
</q-input> </q-input>
<q-slider <!--<q-slider
class="q-ma-xs" class="q-ma-xs"
v-if=" v-if="
qty !== '' && qty !== '' &&
@@ -168,12 +190,12 @@
: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" v-model="causal"
label="Note" :label="$t('circuit.note')"
class="q-my-sm full-width" class="q-my-sm full-width"
> >
</q-input> </q-input>

View File

@@ -296,7 +296,6 @@
size="lg" size="lg"
color="positive" color="positive"
@click="submitOk" @click="submitOk"
:disabled="!allowSubmit()"
:label="$t('reg.submit')" :label="$t('reg.submit')"
> >
</q-btn> </q-btn>

View File

@@ -179,6 +179,12 @@ $heightBtn: 100%;
text-align: center; text-align: center;
} }
.mybanner_left {
font-weight: bold;
font-size: 1.1rem;
text-align: left;
}
.lowperc { .lowperc {
color: red; color: red;
} }

View File

@@ -1257,11 +1257,17 @@ const msg_it = {
refuse_coins_qty: 'Rifiuta', refuse_coins_qty: 'Rifiuta',
refuse_coins: 'Rifiuta Monete', refuse_coins: 'Rifiuta Monete',
movements: 'Movimenti', movements: 'Movimenti',
gruppicom: 'Gruppi Com.', gruppicom: 'Conti Comunitari',
qta_remaining_to_send: 'Quantità massima inviabile {maxqta} {symbol}', qta_remaining_to_send: 'Quantità massima inviabile {maxqta} {symbol}',
qta_not_valid: 'Quantità non valida', qta_not_valid: 'Quantità non valida',
qta_max_to_send: 'Quantità massima inviabile {maxqta} {symbol}', qta_max_to_send: 'Quantità massima inviabile {maxqta} {symbol}',
transaction_suspended: 'Transazioni sospese', transaction_suspended: 'Transazioni sospese',
choosecontocom: 'Scegli il tuo Conto Comunitario',
contocom: 'Conto Comunitario',
user: 'Utente',
sender: 'Mittente',
dest: 'Destinatario',
note: 'Note per il Destinatario',
}, },
account: { account: {
@@ -1285,7 +1291,7 @@ const msg_it = {
accountFromId: 'Dal Conto', accountFromId: 'Dal Conto',
accountToId: 'Al Conto', accountToId: 'Al Conto',
amount_sent: 'Quantità inviate', amount_sent: 'Quantità inviate',
amount_to_send: 'Quantità da inviare (massimo: {qtamax})', amount_to_send: 'Quantità da inviare',
amount: 'Quantità', amount: 'Quantità',
causal: 'Note', causal: 'Note',
causal_table: 'Tabella Causale', causal_table: 'Tabella Causale',

View File

@@ -248,6 +248,11 @@ export const useUserStore = defineStore('UserStore', {
return this.my.profile.manage_mygroups return this.my.profile.manage_mygroups
}, },
hoContiComunitariDaAmministrare(): boolean {
const arr = this.my.profile.manage_mygroups.find((group: IMyGroup) => group.account)
return arr ? true : false
},
IsAskedFriendByUsername(username: string): boolean { IsAskedFriendByUsername(username: string): boolean {
if (this.my.profile.asked_friends) if (this.my.profile.asked_friends)
return this.my.profile.asked_friends.findIndex((rec) => rec.username === username) >= 0 return this.my.profile.asked_friends.findIndex((rec) => rec.username === username) >= 0

View File

@@ -237,15 +237,31 @@ export default defineComponent({
idapp: 1, idapp: 1,
'circuit.name': 1, 'circuit._id': 1 'circuit.name': 1, 'circuit._id': 1
} }
}, },
{ {
$lookup: { $lookup: {
from: 'accounts', from: 'accounts',
localField: 'circuit._id',
foreignField: 'circuitId',
as: 'account', as: 'account',
let: { groupname: '$groupname', idapp: '$idapp', circuitId: '$circuit._id' },
pipeline: [
{
$match:
{
$expr:
{
$and:
[
{ $eq: ['$groupname', '$$groupname'] },
{ $eq: ['$idapp', '$$idapp'] },
{ $eq: ['$circuitId', '$$circuitId'] },
],
},
},
},
],
}, },
}, },
{ {
$unwind: '$account', $unwind: '$account',

View File

@@ -68,7 +68,8 @@
<div> <div>
<q-banner <q-banner
v-if=" v-if="
userStore.my.profile && 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
@@ -200,7 +201,7 @@
v-if="circuit.name" v-if="circuit.name"
class="no-wrap justify-evenly items-center content-start" class="no-wrap justify-evenly items-center content-start"
> >
<q-tabs v-model="tabcircuit" class="text-blue"> <q-tabs v-model="tabcircuit" class="text-blue" no-caps>
<q-tab <q-tab
:label="t('shared.info1')" :label="t('shared.info1')"
name="info" name="info"
@@ -213,6 +214,15 @@
" "
:label="t('shared.subscribes')" :label="t('shared.subscribes')"
name="members" name="members"
icon="fas fa-user-friends"
></q-tab>
<q-tab
v-if="
costanti.ENABLE_CONTI_COMUNITARI &&
tools.iAmAdminCircuit(circuit.name)
"
:label="t('circuit.gruppicom')"
name="gruppicom"
icon="fas fa-users" icon="fas fa-users"
></q-tab> ></q-tab>
<q-tab <q-tab
@@ -227,61 +237,89 @@
name="page" name="page"
icon="fas fa-file-word" icon="fas fa-file-word"
></q-tab> ></q-tab>
<q-tab
v-if="costanti.ENABLE_CONTI_COMUNITARI && tools.iAmAdminCircuit(circuit.name)"
:label="t('circuit.gruppicom')"
name="gruppicom"
icon="fas fa-coins"
></q-tab>
</q-tabs> </q-tabs>
<q-tab-panels v-model="tabcircuit" animated> <q-tab-panels v-model="tabcircuit" animated>
<q-tab-panel name="gruppicom"> <q-tab-panel name="gruppicom">
<div <div class="row justify-center">
v-for="(group, ind) of groupsListAdmin" <q-btn rounded icon="fas fa-user-plus" class="text-center">
:key="ind" <q-menu>
class="q-pa-sm" <q-item>
> Chiedi di Entrare nei Circuiti:
<q-btn </q-item>
v-if="group.groupname && <q-list
!circuitStore.IsAskedCircuitByNameAndGroup( v-for="(group, ind) of groupsListAdmin"
circuit.name, :key="ind"
group.groupname class="q-pa-sm"
) && >
!userStore.IsMyCircuitByNameAndGroup( <q-item>
circuit.name, <q-item-section>
group.groupname <q-btn
) v-if="
" group.groupname &&
icon="fas fa-user-plus" !circuitStore.IsAskedCircuitByNameAndGroup(
color="primary" circuit.name,
:label="$t('circuit.ask') + ' con ' + group.groupname" group.groupname
@click=" ) &&
requestToEnterCircuit = true; !userStore.IsMyCircuitByNameAndGroup(
groupnameSel = group; circuit.name,
" group.groupname
/> )
<q-btn "
v-else-if="group.groupname && circuitStore.IsAskedCircuitByNameAndGroup( icon="fas fa-user-plus"
circuit.name, color="primary"
group.groupname :label="group.groupname"
) && @click="
!userStore.IsMyCircuitByNameAndGroup( requestToEnterCircuit = true;
circuit.name, groupnameSel = group;
group.groupname "
)" />
icon="fas fa-user-minus" <q-btn
flat v-else-if="
:label="$t('shared.cancel_ask_short')" group.groupname &&
@click=" circuitStore.IsAskedCircuitByNameAndGroup(
tools.cancelReqCircuit( circuit.name,
$q, group.groupname
userStore.my.username, ) &&
circuit.name, !userStore.IsMyCircuitByNameAndGroup(
group.groupname, circuit.name,
) group.groupname
" )
/> "
icon="fas fa-user-minus"
flat
:label="$t('shared.cancel_ask_short')"
@click="
tools.cancelReqCircuit(
$q,
userStore.my.username,
circuit.name,
group.groupname
)
"
/>
</q-item-section>
</q-item>
</q-list>
<q-list>
<q-item
clickable
v-close-popup
@click="
tools.setCmd(
$q,
shared_consts.GROUPSCMD.REQGROUP,
myusername(),
true,
grp.groupname
)
"
>
</q-item>
</q-list>
</q-menu>
</q-btn>
</div> </div>
<CTitleSec title="Lista Gruppi Comunitari" /> <CTitleSec title="Lista Gruppi Comunitari" />