fix Registrazione data

fix linkref
fix controllo login
fix pagination CGridTableRec
added CstatusReg e Cstatus
This commit is contained in:
Paolo Arena
2020-01-20 01:50:45 +01:00
parent 5153c143dd
commit 7104f7d1e0
33 changed files with 1558 additions and 0 deletions

View File

@@ -0,0 +1,146 @@
import { Component, Prop, Watch } from 'vue-property-decorator'
import { INotData } from '../../model/index'
import { tools } from '../../store/Modules/tools'
import { NotevoleStore } from '@store'
import MixinBase from '@src/mixins/mixin-base'
import { validationMixin } from 'vuelidate'
import { validations } from '../CSignUpNotevole/CSignUp-validate'
import { CTitleBanner } from '@components'
import { CCardState } from '../CCardState'
import { UserStore } from '../../store/Modules'
@Component({
name: 'CStatusReg',
components: { CTitleBanner, CCardState }
})
export default class CStatusReg extends MixinBase {
public NUMSEC_TO_POLLING: number = 60
public MAXNUM_POLLING: number = 10
public myloadingload: boolean = false
public eseguipolling: boolean = false
public polling = null
public numpolled: number = 0
public datastat: INotData = {
num_tot_lista: 0,
num_reg_lista: 0,
num_reg: 0,
lastsreg: [],
checkuser: { verified_email: false }
}
public async checkifpolling() {
if (UserStore.state.my.profile) {
if (!UserStore.state.my.verified_email || UserStore.state.my.profile.teleg_id <= 0)
this.NUMSEC_TO_POLLING = 10
}
if (this.eseguipolling) {
clearInterval(this.polling)
this.polling = null
if (this.numpolled > 100) {
this.NUMSEC_TO_POLLING = 60 * 5
}
if (this.numpolled < this.MAXNUM_POLLING) {
if (!this.polling) {
this.polling = setInterval(() => {
this.load()
this.numpolled++
}, this.NUMSEC_TO_POLLING * 1000)
}
}
}
}
public beforeDestroy() {
clearInterval(this.polling)
}
public created() {
if (tools.isManager()) {
this.MAXNUM_POLLING = 1000
}
this.load()
}
get lastsreg() {
return this.datastat.lastsreg
}
public async load() {
// console.log('load')
this.myloadingload = true
const datastat = await NotevoleStore.actions.notevoleload()
if (datastat) {
this.datastat = datastat
}
// console.log('this.datastat.lastsreg')
// console.table(this.datastat.lastsreg)
// console.log('newsstate')
// console.table('GlobalStore.state.serv_settings', GlobalStore.state.serv_settings)
this.eseguipolling = true
// console.log('this.eseguipolling', this.eseguipolling)
this.myloadingload = false
if (UserStore.state.my) {
if (this.datastat.checkuser) {
if (this.datastat.checkuser.verified_email && !UserStore.state.my.verified_email) {
UserStore.state.my.verified_email = true
this.riaggiorna()
}
if (UserStore.state.my.profile) {
if ((UserStore.state.my.profile.teleg_id <= 0 && this.datastat.checkuser.profile.teleg_id > 0) ||
(UserStore.state.my.profile.teleg_id !== this.datastat.checkuser.profile.teleg_id > 0)) {
UserStore.state.my.profile.teleg_id = this.datastat.checkuser.profile.teleg_id
this.riaggiorna()
}
if ((UserStore.state.my.profile.teleg_checkcode <= 0 && this.datastat.checkuser.profile.teleg_checkcode > 0) ||
(UserStore.state.my.profile.teleg_checkcode !== this.datastat.checkuser.profile.teleg_checkcode)) {
UserStore.state.my.profile.teleg_checkcode = this.datastat.checkuser.profile.teleg_checkcode
this.riaggiorna()
}
}
}
}
this.checkifpolling()
}
public riaggiorna() {
// clearInterval(this.polling)
// this.polling = null
this.checkifpolling()
}
get perc_reg() {
if (this.datastat.num_tot_lista > 0)
return (this.datastat.num_reg_lista / this.datastat.num_tot_lista * 100)
else
return 0
}
public geticon(reg) {
if (reg.profile.nationality === 'IT')
return 'fa-flag-it'
else if (reg.profile.nationality === 'ES')
return 'fa-flag-es'
else if (reg.profile.nationality === 'US')
return 'fa-flag-us'
else if ((reg.profile.nationality === 'GB') || (reg.profile.nationality === 'UK'))
return 'fa-flag-gb'
else if (reg.profile.nationality === 'DE')
return 'fa-flag-de'
return ''
}
get visustat() {
return this.datastat.num_reg > 0 || this.datastat.num_reg_lista > 0
}
}

View File

@@ -0,0 +1,53 @@
<template>
<div>
<div v-if="visustat">
<CTitleBanner class="q-pa-xs" :title="$t('pages.status')" bgcolor="bg-primary" clcolor="text-white"
mystyle="" myclass="myshad" canopen="true">
<div class="flex flex-center">
<CCardState :mytext="$t('pages.statusreg.reg')" :myval="datastat.num_reg" :myperc="100"></CCardState>
<CCardState :mytext="$t('pages.statusreg.giainlista')" :isperc="true" :myval="datastat.num_reg_lista"
:myperc="perc_reg" :textadd="` / ` + datastat.num_tot_lista"></CCardState>
<div class="column animazione">
<div class="text-center">Nuove Registrazioni:</div>
<transition-group name="fade" mode="out-in"
appear
enter-active-class="animazione fadeIn"
leave-active-class="animazione fadeOut">
<q-item v-for="(user, index) in lastsreg" :key="user.username" class="q-mb-xs animated" v-ripple>
<q-item-section avatar>
<q-avatar v-if="geticon(user)" :class="geticon(user)">
</q-avatar>
<q-avatar v-else color="primary" text-color="white" class="text-center">
{{ tools.capitalize(user.profile.nationality) }}
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label>{{ user.name }} {{ tools.firstchars_onedot(user.surname, 1) }}</q-item-label>
<q-item-label caption lines="1">{{ user.username }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-item-label>{{ tools.getstrDateTimeShort(user.date_temp_reg) }}</q-item-label>
<q-chip outline color="green" text-color="white" icon-right="fas fa-user-plus" size="xs"></q-chip>
</q-item-section>
</q-item>
</transition-group>
</div>
</div>
</CTitleBanner>
</div>
</div>
</template>
<script lang="ts" src="./CStatusReg.ts">
</script>
<style lang="scss" scoped>
@import './CStatusReg.scss';
</style>

View File

@@ -0,0 +1 @@
export {default as CStatusReg} from './CStatusReg.vue'