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"
APP_ID="13"
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"
APP_ID="13"
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"
APP_ID="13"
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"
APP_ID="13"
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"
APP_ID="14"
DIRECTORY_LOCAL="newfreeplanet"

View File

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

View File

@@ -1,19 +1,47 @@
<template>
<div v-if="small">
<q-chip
dense class="cltexth4 chipbooked shadow-5 q-pa-sm2"
dense
class="cltexth4 chipbooked shadow-5 q-pa-sm2"
size="md"
:color="value > 0 ? `green` : value === 0 ? `gray` : `red`" text-color="white"
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>
:color="value > 0 ? `green` : value === 0 ? `gray` : `red`"
text-color="white"
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>
</div>
<div v-else>
<div v-if="value !== null" :class="`text-h5 ` + (small ? `bordo_stondato_small`: `bordo_stondato_stretto`) + ` 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 text-grey-14">
<div
v-if="value !== null"
:class="
`text-h5 ` +
(small ? `bordo_stondato_small` : `bordo_stondato_stretto`) +
` 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>
<em
class="q-px-xs text-white rounded-borders"
:style="`background-color: ` + (color ? color : '#ff5500')"
>{{ symbol }}</em
>
</span>
<span v-else>{{ label }}</span>
</div>
@@ -29,31 +57,37 @@
>
<template v-slot:prepend>
<!--<img src="https://cdn.quasar.dev/logo-v2/svg/logo.svg">-->
<q-btn v-if="tips && !small"
<q-btn
v-if="tips && !small"
icon="fas fa-info"
color="primary" text-color="white"
color="primary"
text-color="white"
round
size="sm"
@click="showingtooltip = !showingtooltip"
>
</q-btn>
<q-icon v-else name="fas fa-coins" :size="small ? `xs` : `sm`" />
</template>
<template v-slot:control>
<div :class="`align_elem_right `+ (small ? `text-h7` : ``)">{{ valueextra }}{{ tools.roundDec2(value) }}
<q-tooltip :offset="[10, 10]" v-model="showingtooltip">{{ tips }}</q-tooltip>
<div :class="`align_elem_right ` + (small ? `text-h7` : ``)">
{{ valueextra }}{{ tools.roundDec2(value) }}
<q-tooltip :offset="[10, 10]" v-model="showingtooltip">{{
tips
}}</q-tooltip>
</div>
</template>
<template v-slot:append>
<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>
</template>
</q-field>
</div>
</div>
</div>
</template>

View File

@@ -977,7 +977,7 @@
<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}]"
:options="[{label: 'Mostra Sempre', value: true }, { label: 'Solo se Offline', value: false}]"
label="Quando mostrarlo"
emit-value
map-options

View File

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

View File

@@ -69,7 +69,7 @@ export default defineComponent({
const remainingCoins = ref(0)
const maxsendable = 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 arrayMarkerLabel = ref(<any>[])
@@ -222,7 +222,8 @@ export default defineComponent({
myrecsendcoin.groupdest = props.to_group ? props.to_group.groupname : ''
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) {
tools.sendCoinsByCircuit($q, circuitloaded.value, myrecsendcoin)

View File

@@ -24,6 +24,56 @@
>
</q-select>
<q-banner
rounded
dense
class="shadow-5 q-my-sm"
color="primary q-title"
style="text-align: center"
>
<div class="mybanner_left bg-blue text-white q-mb-sm">
{{$t('circuit.sender')}}:
</div>
<div>
<q-btn-toggle
v-if="arrGroupsList.length > 0"
v-model="tipoConto"
class="my-custom-toggle"
no-caps
rounded
unelevated
toggle-color="primary"
color="white"
text-color="primary"
:options="[
{ label: $t('circuit.user'), value: costanti.AccountType.USER },
{
label: $t('circuit.contocom'),
value: costanti.AccountType.COMMUNITY_ACCOUNT,
},
]"
/>
</div>
<q-input
v-if="tipoConto === costanti.AccountType.USER"
v-model="from_username"
class="full-width"
readonly
>
</q-input>
<div v-else>
<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>
<CSaldo
v-if="circuitloaded"
:symbol="circuitloaded.symbol"
@@ -36,46 +86,16 @@
"
>
</CSaldo>
</q-banner>
<div>
<q-btn-toggle
v-model="tipoConto"
class="my-custom-toggle"
no-caps
<q-banner
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
dense
class="shadow-5 q-my-sm"
color="primary q-title"
>
</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 class="mybanner_left bg-green text-white q-mb-sm">
{{$t('circuit.dest')}}
</div>
<!-- Destination -->
@@ -84,14 +104,16 @@
:mycontact="to_user"
:visu="costanti.FIND_PEOPLE"
@setCmd="tools.setCmd"
labelextra="Destinatario"
>
</CMyUserOnlyView>
<CMyGroupOnlyView v-if="to_group" :mygrp="to_group" :visu="costanti.USER_GROUPS"
<CMyGroupOnlyView
v-if="to_group"
:mygrp="to_group"
:visu="costanti.USER_GROUPS"
:circuitname="circuitloaded.name"
labelextra="Destinatario">
>
</CMyGroupOnlyView>
</q-banner>
<div v-if="circuitloaded">
<q-banner
@@ -148,7 +170,7 @@
</template>
</q-input>
<q-slider
<!--<q-slider
class="q-ma-xs"
v-if="
qty !== '' &&
@@ -168,12 +190,12 @@
:min="0"
:max="Number(maxsendable ? maxsendable : 0)"
/>
</div>
--></div>
<q-input
ref="causalRef"
v-model="causal"
label="Note"
:label="$t('circuit.note')"
class="q-my-sm full-width"
>
</q-input>

View File

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

View File

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

View File

@@ -1257,11 +1257,17 @@ const msg_it = {
refuse_coins_qty: 'Rifiuta',
refuse_coins: 'Rifiuta Monete',
movements: 'Movimenti',
gruppicom: 'Gruppi Com.',
gruppicom: 'Conti Comunitari',
qta_remaining_to_send: 'Quantità massima inviabile {maxqta} {symbol}',
qta_not_valid: 'Quantità non valida',
qta_max_to_send: 'Quantità massima inviabile {maxqta} {symbol}',
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: {
@@ -1285,7 +1291,7 @@ const msg_it = {
accountFromId: 'Dal Conto',
accountToId: 'Al Conto',
amount_sent: 'Quantità inviate',
amount_to_send: 'Quantità da inviare (massimo: {qtamax})',
amount_to_send: 'Quantità da inviare',
amount: 'Quantità',
causal: 'Note',
causal_table: 'Tabella Causale',

View File

@@ -248,6 +248,11 @@ export const useUserStore = defineStore('UserStore', {
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 {
if (this.my.profile.asked_friends)
return this.my.profile.asked_friends.findIndex((rec) => rec.username === username) >= 0

View File

@@ -237,16 +237,32 @@ export default defineComponent({
idapp: 1,
'circuit.name': 1, 'circuit._id': 1
}
},
{
$lookup: {
from: 'accounts',
localField: 'circuit._id',
foreignField: 'circuitId',
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',
},

View File

@@ -68,7 +68,8 @@
<div>
<q-banner
v-if="
userStore.my.profile && userStore.my.profile.calc.numGoodsAndServices <= 0 &&
userStore.my.profile &&
userStore.my.profile.calc.numGoodsAndServices <= 0 &&
userStore.IsMyCircuitByName(circuit.name)
"
rounded
@@ -200,7 +201,7 @@
v-if="circuit.name"
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
:label="t('shared.info1')"
name="info"
@@ -213,6 +214,15 @@
"
:label="t('shared.subscribes')"
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"
></q-tab>
<q-tab
@@ -227,23 +237,26 @@
name="page"
icon="fas fa-file-word"
></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-tab-panels v-model="tabcircuit" animated>
<q-tab-panel name="gruppicom">
<div
<div class="row justify-center">
<q-btn rounded icon="fas fa-user-plus" class="text-center">
<q-menu>
<q-item>
Chiedi di Entrare nei Circuiti:
</q-item>
<q-list
v-for="(group, ind) of groupsListAdmin"
:key="ind"
class="q-pa-sm"
>
<q-item>
<q-item-section>
<q-btn
v-if="group.groupname &&
v-if="
group.groupname &&
!circuitStore.IsAskedCircuitByNameAndGroup(
circuit.name,
group.groupname
@@ -255,21 +268,24 @@
"
icon="fas fa-user-plus"
color="primary"
:label="$t('circuit.ask') + ' con ' + group.groupname"
:label="group.groupname"
@click="
requestToEnterCircuit = true;
groupnameSel = group;
"
/>
<q-btn
v-else-if="group.groupname && circuitStore.IsAskedCircuitByNameAndGroup(
v-else-if="
group.groupname &&
circuitStore.IsAskedCircuitByNameAndGroup(
circuit.name,
group.groupname
) &&
!userStore.IsMyCircuitByNameAndGroup(
circuit.name,
group.groupname
)"
)
"
icon="fas fa-user-minus"
flat
:label="$t('shared.cancel_ask_short')"
@@ -278,10 +294,32 @@
$q,
userStore.my.username,
circuit.name,
group.groupname,
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>
<CTitleSec title="Lista Gruppi Comunitari" />