- pagine admin: Accounts, Movements e Circuits.

- add change min e max range circuiti (per tutti i record).
This commit is contained in:
Surya Paolo
2023-02-06 22:58:18 +01:00
parent 0234e2323a
commit 5c2b28939b
24 changed files with 560 additions and 180 deletions

View File

@@ -81,12 +81,45 @@
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.username_chip">
<div class="">
<span v-if="col.extrafield && (col.tipovisu !== costanti.TipoVisu.LINK || (col.tipovisu === costanti.TipoVisu.LINK && userStore.getImgByProfile(row, true, col)))">
<span
v-if="
col.extrafield &&
(col.tipovisu !== costanti.TipoVisu.LINK ||
(col.tipovisu === costanti.TipoVisu.LINK &&
userStore.getImgByProfile(row, true, col)))
"
>
<span class="extrafield">{{ $t(col.extrafield) }}</span>
</span>
</div>
<div v-if="!col.extrafield || (col.extrafield && (col.tipovisu !== costanti.TipoVisu.LINK || (col.tipovisu === costanti.TipoVisu.LINK && userStore.getImgByProfile(row, true, col))))"
class="q-ma-xs chip_shadow">
<div v-if="canModify">
<q-input
:type="
col.fieldtype === costanti.FieldType.crypted
? 'password'
: 'text'
"
:maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined"
v-model="myvalue"
@update:model-value="changevalRec"
:label="col.visulabel ? $t(col.label_trans) : ''"
:autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop
autofocus
>
</q-input>
</div>
<div
v-else-if="
!col.extrafield ||
(col.extrafield &&
(col.tipovisu !== costanti.TipoVisu.LINK ||
(col.tipovisu === costanti.TipoVisu.LINK &&
userStore.getImgByProfile(row, true, col))))
"
class="q-ma-xs chip_shadow"
>
<div
v-if="
(col.tipovisu === costanti.TipoVisu.LINK ||
@@ -975,6 +1008,7 @@
</div>
</div>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.password">
<div v-if="isInModif">
<q-input
@@ -1323,6 +1357,23 @@
>
</CMyToggleList>
</div>
<div v-else-if="col.fieldtype === costanti.FieldType.username_chip">
<q-input
:type="
col.fieldtype === costanti.FieldType.crypted
? 'password'
: 'text'
"
:maxlength="col.maxlength ? col.maxlength : undefined"
:minlength="col.minlength ? col.minlength : undefined"
v-model="scope.value"
:label="col.visulabel ? $t(col.label_trans) : ''"
:autogrow="col.fieldtype !== costanti.FieldType.crypted"
@keyup.enter.stop
autofocus
>
</q-input>
</div>
<div
v-else-if="
col.fieldtype === costanti.FieldType.star5 ||

View File

@@ -86,8 +86,8 @@ export default defineComponent({
//$router.push(link)
}
function getNameToShow(user: IUserFields) {
return userStore.getNameToShow(user)
function getNameToShow(user: IUserFields, col = null) {
return userStore.getNameToShow(user, col)
}

View File

@@ -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
}
}
}

View File

@@ -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,