- pagine admin: Accounts, Movements e Circuits.
- add change min e max range circuiti (per tutti i record).
This commit is contained in:
@@ -69,6 +69,8 @@ export default defineComponent({
|
||||
|
||||
const groupSel = ref(<IMyGroup | null | undefined>null)
|
||||
|
||||
const datasaved = ref(<any>null)
|
||||
|
||||
const circuittoload = ref(<ICircuit | undefined>undefined)
|
||||
const circuitloaded = ref(<ICircuit>{})
|
||||
const circuitdest = ref(<ICircuit | undefined>undefined)
|
||||
@@ -101,6 +103,12 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
watch(() => tipoConto.value, (newval, oldval) => {
|
||||
|
||||
if (tipoConto.value === costanti.AccountType.COLLECTIVE_ACCOUNT) {
|
||||
if (arrGroupsList.value.length >= 1)
|
||||
from_groupname.value = arrGroupsList.value[0]
|
||||
}
|
||||
|
||||
aggiorna()
|
||||
})
|
||||
|
||||
@@ -122,96 +130,110 @@ export default defineComponent({
|
||||
groupSel.value = null
|
||||
from_contocom.value = ''
|
||||
accountloaded.value = null
|
||||
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 (!circuittoload.value || (circuittoload.value && circuittoload.value.name !== circuitsel.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 }) => {
|
||||
datasaved.value = data
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if (datasaved.value) {
|
||||
try {
|
||||
arrTypesAccounts.value = [
|
||||
{
|
||||
label: t('circuit.user'),
|
||||
value: costanti.AccountType.USER,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
if (!!data.circuit) {
|
||||
circuitloaded.value = data.circuit
|
||||
if (!!datasaved.value.circuit) {
|
||||
circuitloaded.value = datasaved.value.circuit
|
||||
|
||||
if (tipoConto.value === costanti.AccountType.USER) {
|
||||
accountloaded.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
|
||||
} else if (tipoConto.value === costanti.AccountType.COLLECTIVE_ACCOUNT) {
|
||||
groupSel.value = userStore.my.profile.manage_mygroups.find((group: IMyGroup) => from_groupname.value === group.groupname)
|
||||
if (tipoConto.value === costanti.AccountType.USER) {
|
||||
accountloaded.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
|
||||
} 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
|
||||
}
|
||||
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.GroupsListWhereIAmAdminInTheCircuit(circuitloaded.value.name)
|
||||
console.log('groupsListAdmin.value', groupsListAdmin.value)
|
||||
groupsListAdmin.value = userStore.GroupsListWhereIAmAdminInTheCircuit(circuitloaded.value.name)
|
||||
console.log('groupsListAdmin.value', groupsListAdmin.value)
|
||||
|
||||
arrGroupsList.value = []
|
||||
arrGroupsList.value = []
|
||||
|
||||
if (groupsListAdmin.value) {
|
||||
for (const group of groupsListAdmin.value) {
|
||||
if (groupsListAdmin.value) {
|
||||
for (const group of groupsListAdmin.value) {
|
||||
let aggiungi = true
|
||||
|
||||
if (props.to_group && props.to_group.groupname === group.groupname)
|
||||
aggiungi = false
|
||||
|
||||
if (aggiungi)
|
||||
arrGroupsList.value.push({ label: group.groupname, value: group.groupname });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 (arrGroupsList.value.length > 0) {
|
||||
arrTypesAccounts.value.push(
|
||||
{
|
||||
label: t('circuit.conticollettivi'),
|
||||
value: costanti.AccountType.COLLECTIVE_ACCOUNT,
|
||||
})
|
||||
}
|
||||
|
||||
if (tools.iCanSendCoinsSuperUserCircuit(circuitsel.value) && (!props.to_contocom)) {
|
||||
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) {
|
||||
remainingCoins.value = circuitStore.getRemainingCoinsToSend(accountloaded.value)
|
||||
if (accountloaded.value.saldo > 0) {
|
||||
maxsendable.value = accountloaded.value.saldo + accountloaded.value.fidoConcesso
|
||||
} else {
|
||||
maxsendable.value = accountloaded.value.fidoConcesso
|
||||
}
|
||||
|
||||
// if (tools.iAmAdminCircuit(circuitloaded.value.name))
|
||||
// arrGroupsList.value.push({ label: circuitloaded.value.name, value: circuitloaded.value.path });
|
||||
if (remainingCoins.value < 10) {
|
||||
remainingCoins.value = 10
|
||||
}
|
||||
|
||||
// accountdest.value = userStore.getAccountByCircuitId(circuitloaded.value._id)
|
||||
if (accountloaded.value) {
|
||||
remainingCoins.value = circuitStore.getRemainingCoinsToSend(accountloaded.value)
|
||||
if (accountloaded.value.saldo > 0) {
|
||||
maxsendable.value = accountloaded.value.saldo + accountloaded.value.fidoConcesso
|
||||
numstep.value = Math.round(maxsendable.value / 10)
|
||||
if (numstep.value < 1) {
|
||||
numstep.value = 1
|
||||
}
|
||||
|
||||
const quanti = [...Array(20).keys()].map(i => i + 1)
|
||||
for (const ind of quanti) {
|
||||
let valuenorm = ind * numstep.value
|
||||
let value = ind * numstep.value
|
||||
if (value > remainingCoins.value) {
|
||||
break
|
||||
} else {
|
||||
maxsendable.value = accountloaded.value.fidoConcesso
|
||||
}
|
||||
|
||||
if (remainingCoins.value < 10) {
|
||||
remainingCoins.value = 10
|
||||
}
|
||||
|
||||
numstep.value = Math.round(maxsendable.value / 10)
|
||||
if (numstep.value < 1) {
|
||||
numstep.value = 1
|
||||
}
|
||||
|
||||
const quanti = [...Array(20).keys()].map(i => i + 1)
|
||||
for (const ind of quanti) {
|
||||
let valuenorm = ind * numstep.value
|
||||
let value = ind * numstep.value
|
||||
if (value > remainingCoins.value) {
|
||||
break
|
||||
} else {
|
||||
const label = valuenorm.toString()
|
||||
arrayMarkerLabel.value.push({ value, label })
|
||||
}
|
||||
const label = valuenorm.toString()
|
||||
arrayMarkerLabel.value.push({ value, label })
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
</q-toolbar>
|
||||
<q-card-section class="q-pa-xs inset-shadow">
|
||||
<q-select
|
||||
v-if="!circuitname"
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
rounded
|
||||
outlined
|
||||
@@ -23,6 +24,9 @@
|
||||
label="Circuito"
|
||||
>
|
||||
</q-select>
|
||||
<div v-else>
|
||||
Circuito: {{circuitname}}
|
||||
</div>
|
||||
|
||||
<q-banner
|
||||
rounded
|
||||
@@ -220,24 +224,21 @@
|
||||
</q-card-section>
|
||||
<q-card-actions align="center">
|
||||
<q-btn
|
||||
v-if="circuitloaded"
|
||||
:disable="
|
||||
qtyRef
|
||||
? qtyRef.hasError ||
|
||||
v-if="circuitloaded && (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 &&
|
||||
(tipoConto === costanti.AccountType.COLLECTIVE_ACCOUT &&
|
||||
to_group &&
|
||||
from_groupname &&
|
||||
to_group.groupname === from_groupname) ||
|
||||
(tipoConto === costanti.AccountType.COMMUNITY_ACCOUNT &&
|
||||
!from_contocom)
|
||||
: false
|
||||
"
|
||||
!from_contocom))
|
||||
: true)"
|
||||
:label="
|
||||
$t('circuit.sendcoinsto', {
|
||||
qty,
|
||||
|
||||
Reference in New Issue
Block a user