ver: 0.5.62
Conti Collettivi visibili solo se sei admin...
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
APP_VERSION="0.5.61"
|
||||
APP_VERSION="0.5.62"
|
||||
SERVICE_WORKER_FILE="service-worker.js"
|
||||
APP_ID="13"
|
||||
DIRECTORY_LOCAL="newfreeplanet"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
APP_VERSION="0.5.61"
|
||||
APP_VERSION="0.5.62"
|
||||
SERVICE_WORKER_FILE="service-worker.js"
|
||||
APP_ID="13"
|
||||
DIRECTORY_LOCAL=newfreeplanet
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
APP_VERSION="0.5.61"
|
||||
APP_VERSION="0.5.62"
|
||||
SERVICE_WORKER_FILE="service-worker.js"
|
||||
APP_ID="13"
|
||||
DIRECTORY_LOCAL="newfreeplanet"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
APP_VERSION="0.5.61"
|
||||
APP_VERSION="0.5.62"
|
||||
SERVICE_WORKER_FILE="service-worker.js"
|
||||
APP_ID="13"
|
||||
DIRECTORY_LOCAL=newfreeplanet
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
APP_VERSION="0.5.61"
|
||||
APP_VERSION="0.5.62"
|
||||
SERVICE_WORKER_FILE="service-worker.js"
|
||||
APP_ID="14"
|
||||
DIRECTORY_LOCAL="newfreeplanet"
|
||||
|
||||
@@ -38,11 +38,6 @@ export default defineComponent({
|
||||
required: false,
|
||||
default: null,
|
||||
},
|
||||
from_contocom: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: '',
|
||||
},
|
||||
to_contocom: {
|
||||
type: String,
|
||||
required: false,
|
||||
@@ -65,20 +60,29 @@ export default defineComponent({
|
||||
|
||||
const from_username = ref(userStore.my.username)
|
||||
const from_groupname = ref('')
|
||||
const from_contocom = ref('')
|
||||
const circuitsel = ref('')
|
||||
const qty = ref(<string | number>'')
|
||||
const causal = ref('')
|
||||
const loading = ref(false)
|
||||
const bothcircuits = ref(<any>[])
|
||||
|
||||
const groupSel = ref(<IMyGroup | null | undefined>null)
|
||||
|
||||
const circuitloaded = ref(<ICircuit | undefined>undefined)
|
||||
const circuittoload = ref(<ICircuit | undefined>undefined)
|
||||
const circuitloaded = ref(<ICircuit>{})
|
||||
const circuitdest = ref(<ICircuit | undefined>undefined)
|
||||
const accountloaded = ref(<IAccount | undefined | null>undefined)
|
||||
const accountdest = ref(<IAccount | undefined>undefined)
|
||||
const remainingCoins = ref(0)
|
||||
const maxsendable = ref(0)
|
||||
const numstep = ref(0)
|
||||
const arrTypesAccounts = ref(<any>[
|
||||
{
|
||||
label: t('circuit.user'),
|
||||
value: costanti.AccountType.USER,
|
||||
},
|
||||
])
|
||||
const tipoConto = ref(costanti.AccountType.USER)
|
||||
|
||||
const priceLabel = computed(() => circuitloaded.value ? `${qty.value} ` + circuitloaded.value.symbol : '')
|
||||
@@ -113,31 +117,65 @@ export default defineComponent({
|
||||
show.value = newval
|
||||
})
|
||||
|
||||
function aggiorna() {
|
||||
async function aggiorna() {
|
||||
loading.value = true
|
||||
groupSel.value = null
|
||||
from_contocom.value = ''
|
||||
accountloaded.value = null
|
||||
circuitloaded.value = circuitStore.listcircuits.find((rec: ICircuit) => rec.name === circuitsel.value)
|
||||
if (circuitloaded.value) {
|
||||
circuittoload.value = circuitStore.listcircuits.find((rec: ICircuit) => rec.name === circuitsel.value)
|
||||
if (circuittoload.value) {
|
||||
await userStore.loadCircuit(circuittoload.value.path, '').then(({ data, status }: { data: any, status: number }) => {
|
||||
try {
|
||||
arrTypesAccounts.value = [
|
||||
{
|
||||
label: t('circuit.user'),
|
||||
value: costanti.AccountType.USER,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
if (!!data.circuit) {
|
||||
circuitloaded.value = data.circuit
|
||||
|
||||
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
|
||||
} else if (tipoConto.value === costanti.AccountType.COLLECTIVE_ACCOUNT) {
|
||||
groupSel.value = userStore.my.profile.manage_mygroups.find((group: IMyGroup) => from_groupname.value === group.groupname)
|
||||
|
||||
accountloaded.value = groupSel.value ? groupSel.value.account : null
|
||||
} else if (tipoConto.value === costanti.AccountType.COMMUNITY_ACCOUNT) {
|
||||
from_contocom.value = circuitloaded.value.path
|
||||
accountloaded.value = circuitloaded.value ? circuitloaded.value.account : null
|
||||
}
|
||||
|
||||
groupsListAdmin.value = userStore.GroupsListWhereIAmAdmin()
|
||||
groupsListAdmin.value = userStore.GroupsListWhereIAmAdmin(circuitloaded.value.name)
|
||||
console.log('groupsListAdmin.value', groupsListAdmin.value)
|
||||
|
||||
arrGroupsList.value = []
|
||||
|
||||
if (groupsListAdmin.value) {
|
||||
for (const group of groupsListAdmin.value) {
|
||||
arrGroupsList.value.push({ label: group.groupname, value: group.groupname });
|
||||
}
|
||||
}
|
||||
|
||||
if (tools.iAmAdminCircuit(circuitloaded.value.name))
|
||||
arrGroupsList.value.push({ label: circuitloaded.value.name, value: circuitloaded.value.path });
|
||||
if (arrGroupsList.value.length > 0) {
|
||||
arrTypesAccounts.value.push(
|
||||
{
|
||||
label: t('circuit.conticollettivi'),
|
||||
value: costanti.AccountType.COLLECTIVE_ACCOUNT,
|
||||
})
|
||||
}
|
||||
|
||||
if (tools.iCanSendCoinsSuperUserCircuit(circuitsel.value)) {
|
||||
arrTypesAccounts.value.push({
|
||||
label: t('circuit.contocom'),
|
||||
value: costanti.AccountType.COMMUNITY_ACCOUNT,
|
||||
})
|
||||
}
|
||||
|
||||
// if (tools.iAmAdminCircuit(circuitloaded.value.name))
|
||||
// arrGroupsList.value.push({ label: circuitloaded.value.name, value: circuitloaded.value.path });
|
||||
|
||||
// accountdest.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
|
||||
if (accountloaded.value) {
|
||||
@@ -169,12 +207,22 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
|
||||
arrTypesAccounts.value = [
|
||||
{
|
||||
label: t('circuit.user'),
|
||||
value: costanti.AccountType.USER,
|
||||
},
|
||||
]
|
||||
|
||||
// ....
|
||||
if (props.to_user) {
|
||||
@@ -255,7 +303,7 @@ export default defineComponent({
|
||||
myrecsendcoin.groupdest = props.to_group ? props.to_group.groupname : ''
|
||||
myrecsendcoin.contoComDest = props.to_contocom
|
||||
myrecsendcoin.grouporig = tipoConto.value === costanti.AccountType.COLLECTIVE_ACCOUNT ? from_groupname.value : ''
|
||||
myrecsendcoin.contoComOrig = tipoConto.value === costanti.AccountType.COMMUNITY_ACCOUNT ? props.from_contocom : ''
|
||||
myrecsendcoin.contoComOrig = tipoConto.value === costanti.AccountType.COMMUNITY_ACCOUNT ? from_contocom.value : ''
|
||||
|
||||
myrecsendcoin.dest = props.to_user ? props.to_user.username : ''
|
||||
|
||||
@@ -302,6 +350,9 @@ export default defineComponent({
|
||||
tipoConto,
|
||||
arrGroupsList,
|
||||
from_groupname,
|
||||
from_contocom,
|
||||
arrTypesAccounts,
|
||||
loading,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
style="text-align: center"
|
||||
>
|
||||
<div class="mybanner_left bg-blue text-white q-mb-sm">
|
||||
{{$t('circuit.sender')}}:
|
||||
{{ $t('circuit.sender') }}:
|
||||
</div>
|
||||
<div>
|
||||
<q-btn-toggle
|
||||
@@ -45,13 +45,7 @@
|
||||
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,
|
||||
},
|
||||
]"
|
||||
:options="arrTypesAccounts"
|
||||
/>
|
||||
</div>
|
||||
<q-input
|
||||
@@ -61,7 +55,9 @@
|
||||
readonly
|
||||
>
|
||||
</q-input>
|
||||
<div v-else>
|
||||
<div
|
||||
v-else-if="tipoConto === costanti.AccountType.COLLECTIVE_ACCOUNT"
|
||||
>
|
||||
<q-select
|
||||
v-model="from_groupname"
|
||||
:options="arrGroupsList"
|
||||
@@ -73,6 +69,17 @@
|
||||
<!-- Mostra i gruppi su cui sei Admin -->
|
||||
</q-select>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="tipoConto === costanti.AccountType.COMMUNITY_ACCOUNT"
|
||||
>
|
||||
<q-input
|
||||
v-model="from_contocom"
|
||||
:label="$t('circuit.contocom')"
|
||||
readonly
|
||||
class="q-my-sm"
|
||||
>
|
||||
</q-input>
|
||||
</div>
|
||||
|
||||
<CSaldo
|
||||
v-if="circuitloaded"
|
||||
@@ -95,7 +102,7 @@
|
||||
color="primary q-title"
|
||||
>
|
||||
<div class="mybanner_left bg-green text-white q-mb-sm">
|
||||
{{$t('circuit.dest')}}
|
||||
{{ $t('circuit.dest') }}
|
||||
</div>
|
||||
|
||||
<!-- Destination -->
|
||||
@@ -115,13 +122,17 @@
|
||||
</CMyGroupOnlyView>
|
||||
<CMyGroupOnlyView
|
||||
v-if="circuitloaded && to_contocom"
|
||||
:mygrp="{groupname: to_contocom}"
|
||||
:mygrp="{ groupname: to_contocom }"
|
||||
:visu="costanti.USER_GROUPS"
|
||||
:circuitname="circuitloaded.name"
|
||||
>
|
||||
</CMyGroupOnlyView>
|
||||
</q-banner>
|
||||
|
||||
<q-inner-loading id="spinner" :showing="loading">
|
||||
<q-spinner-tail size="6em" color="primary" />
|
||||
</q-inner-loading>
|
||||
|
||||
<div v-if="circuitloaded">
|
||||
<q-banner
|
||||
v-if="!circuitloaded.transactionsEnabled"
|
||||
@@ -212,18 +223,30 @@
|
||||
v-if="circuitloaded"
|
||||
:disable="
|
||||
qtyRef
|
||||
? qtyRef.hasError || !circuitloaded.transactionsEnabled ||
|
||||
((tipoConto === costanti.AccountType.USER) && to_user && (from_username === to_user.username)) ||
|
||||
((tipoConto === costanti.AccountType.COLLECTIVE_ACCOUNT) && !from_groupname) ||
|
||||
((tipoConto === costanti.AccountType.COLLECTIVE_ACCOUNT) && to_group && from_groupname && (to_group.groupname === from_groupname)) ||
|
||||
((tipoConto === costanti.AccountType.COMMUNITY_ACCOUNT) && !to_contocom)
|
||||
? qtyRef.hasError ||
|
||||
!circuitloaded.transactionsEnabled ||
|
||||
(tipoConto === costanti.AccountType.USER &&
|
||||
to_user &&
|
||||
from_username === to_user.username) ||
|
||||
(tipoConto === costanti.AccountType.COLLECTIVE_ACCOUNT &&
|
||||
!from_groupname) ||
|
||||
(tipoConto === costanti.AccountType.COLLECTIVE_ACCOUNT &&
|
||||
to_group &&
|
||||
from_groupname &&
|
||||
to_group.groupname === from_groupname) ||
|
||||
(tipoConto === costanti.AccountType.COMMUNITY_ACCOUNT &&
|
||||
!from_contocom)
|
||||
: false
|
||||
"
|
||||
:label="
|
||||
$t('circuit.sendcoinsto', {
|
||||
qty,
|
||||
coin: circuitsel,
|
||||
dest: to_group ? to_group.groupname : (to_user ? to_user.username : to_contocom),
|
||||
dest: to_group
|
||||
? to_group.groupname
|
||||
: to_user
|
||||
? to_user.username
|
||||
: to_contocom,
|
||||
})
|
||||
"
|
||||
color="positive"
|
||||
|
||||
@@ -1266,7 +1266,7 @@ const msg_it = {
|
||||
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',
|
||||
choosecontocom: 'Scegli il tuo Conto Collettivo',
|
||||
contocom: 'Conto Comunitario',
|
||||
user: 'Utente',
|
||||
sender: 'Mittente',
|
||||
|
||||
@@ -6417,6 +6417,29 @@ export const tools = {
|
||||
|
||||
},
|
||||
|
||||
iCanSendCoinsSuperUserCircuit(circuitname: string) {
|
||||
const userStore = useUserStore()
|
||||
|
||||
let risultato = false
|
||||
|
||||
if (userStore.my.profile.manage_mycircuits) {
|
||||
const ris = userStore.my.profile.manage_mycircuits.find((circuit: ICircuit) => {
|
||||
if (circuit.name === circuitname) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
// console.log('ris', ris)
|
||||
if (ris && ris.admins) {
|
||||
const isadmin = ris.admins.find((user: IFriends) => user.username === userStore.my.username)
|
||||
risultato = !!isadmin
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return risultato
|
||||
|
||||
},
|
||||
|
||||
iAmPartOfThisGroup(grp: IMyGroup) {
|
||||
const userStore = useUserStore()
|
||||
return userStore.my.profile.mygroups.findIndex((rec: IMyGroup) => rec.groupname === grp.groupname) >= 0
|
||||
|
||||
@@ -85,6 +85,7 @@ export const useNotifStore = defineStore('NotifStore', {
|
||||
}
|
||||
},
|
||||
updateArrRecNotifFromServer(arrrecnotif: INotif[]) {
|
||||
console.log('arrrecnotif', arrrecnotif)
|
||||
if (arrrecnotif && arrrecnotif.length > 0) {
|
||||
this.last_notifs = arrrecnotif
|
||||
|
||||
|
||||
@@ -254,8 +254,15 @@ export const useUserStore = defineStore('UserStore', {
|
||||
}
|
||||
},
|
||||
|
||||
GroupsListWhereIAmAdmin(): IMyGroup[] {
|
||||
return this.my.profile.manage_mygroups
|
||||
GroupsListWhereIAmAdmin(circuitname: string): any {
|
||||
console.log('GL', circuitname)
|
||||
try {
|
||||
const arr: any = this.my.profile.manage_mygroups.filter((group: IMyGroup) => (group.mycircuits!.findIndex((circ: IMyCircuit) => circ.circuitname === circuitname) >= 0))
|
||||
console.log('arr', arr)
|
||||
return arr
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
},
|
||||
|
||||
hoContiCollettiviDaAmministrare(): boolean {
|
||||
@@ -1288,13 +1295,21 @@ export const useUserStore = defineStore('UserStore', {
|
||||
},
|
||||
|
||||
async loadCircuit(path: string, idnotif: string) {
|
||||
const notifStore = useNotifStore()
|
||||
const data = {
|
||||
path,
|
||||
idnotif,
|
||||
lastdr: notifStore.getLastDataRead(this.my.username),
|
||||
}
|
||||
|
||||
return Api.SendReq('/circuit/load', 'POST', data)
|
||||
.then((res) => {
|
||||
if (res && res.data.arrrecnotif) {
|
||||
notifStore.updateArrRecNotifFromServer(res.data.arrrecnotif)
|
||||
}
|
||||
if (res.data.useraccounts && res.data.useraccounts.length > 0) {
|
||||
this.my.profile.useraccounts = res.data.useraccounts
|
||||
}
|
||||
return { data: res.data, status: res.status }
|
||||
}).catch((error) => {
|
||||
return { data: null, status: error.status }
|
||||
|
||||
@@ -101,8 +101,6 @@ export default defineComponent({
|
||||
|
||||
async function loadCircuit() {
|
||||
|
||||
tabcircuit.value = tools.getCookie(tools.COOK_TAB_CIRCUIT + path.value, 'info')
|
||||
|
||||
loading.value = true
|
||||
// Carica il profilo di quest'utente
|
||||
if (path.value) {
|
||||
@@ -285,10 +283,12 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
async function mounted() {
|
||||
tabcircuit.value = tools.getCookie(tools.COOK_TAB_CIRCUIT + path.value, 'info')
|
||||
|
||||
await loadCircuit()
|
||||
|
||||
if (userStore.my.username)
|
||||
groupsListAdmin.value = userStore.GroupsListWhereIAmAdmin()
|
||||
if (userStore.my.username && circuit.value)
|
||||
groupsListAdmin.value = userStore.GroupsListWhereIAmAdmin(circuit.value.name)
|
||||
|
||||
}
|
||||
|
||||
@@ -457,6 +457,7 @@ export default defineComponent({
|
||||
groupnameSel,
|
||||
showsendCoinTo,
|
||||
showrules,
|
||||
loadCircuit,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -207,6 +207,7 @@
|
||||
:label="t('shared.info1')"
|
||||
name="info"
|
||||
icon="fas fa-info"
|
||||
@click="loadCircuit()"
|
||||
></q-tab>
|
||||
<q-tab
|
||||
v-if="
|
||||
|
||||
Reference in New Issue
Block a user