- Downline User

- Not registered if already exists.
- Forgot Password
This commit is contained in:
Paolo Arena
2020-01-30 01:20:23 +01:00
parent 3653b8309c
commit 1956e53d07
24 changed files with 325 additions and 408 deletions

View File

@@ -1,139 +0,0 @@
<template>
<div class="mypanel">
<div v-if="!emailinviata">
<q-banner
rounded
class="bg-primary text-white"
style="text-align: center;">
<span class="mybanner">{{ $t('reset.title_update_pwd')}}</span>
</q-banner>
<br>
<q-field
:error="$v.form.password.$error"
:error-label="`${errorMsg('password', $v.form.password)}`"
>
<q-input
v-model="form.password"
:before="[{icon: 'vpn_key', handler () {}}]"
@blur="$v.form.password.$touch"
:error="$v.form.password.$error"
:float-label="$t('reg.password')"
/>
</q-field>
<q-field
:error="$v.form.repeatPassword.$error"
:error-label="`${errorMsg('repeatpassword', $v.form.repeatPassword)}`"
>
<q-input
v-model="form.repeatPassword"
:before="[{icon: 'vpn_key', handler () {}}]"
@blur="$v.form.repeatPassword.$touch"
:error="$v.form.repeatPassword.$error"
:float-label="$t('reg.repeatPassword')"
/>
</q-field>
<div align="center">
<q-btn rounded size="lg" color="primary" @click="submit" :disable="$v.$error">
{{$t('reset.update_password')}}
</q-btn>
</div>
</div>
<div v-else>
<q-banner
rounded
class="bg-primary text-white"
style="text-align: center;">
<span class="mybanner">{{ $t('reset.email_sent')}}</span>
</q-banner>
<br>
<div>
{{ $t('reset.check_email')}}
</div>
</div>
</div>
</template>
<script lang="ts">
import { mapActions } from 'vuex'
import * as types from '../../store/mutation-types'
//import {tools} from '../../store/Modules/user'
import { serv_constants } from '../../store/Modules/serv_constants'
import Vue from 'vue'
import { required } from "vuelidate/lib/validators"
import { UserStore } from "../../store/Modules";
import { IUserFields, IUserState } from "../../model"
import { tools } from "../../store/Modules/tools";
import { toolsext } from '@src/store/Modules/toolsext'
export default class UpdatePassword extends Vue {
emailsent = false
form = {
password: '',
repeatPassword: '',
tokenforgot: '',
}
created() {
// this.load()
}
get emailinviata() {
return this.emailsent
}
// validations: {
// form: {
// password: {
// required,
// },
// repeatPassword: {
// required,
// sameAsPassword: sameAs('password')
// },
// }
// },
submit() {
this.$v.form.$touch()
if (this.$v.form.$error) {
tools.showNotif(this.$q, this.$t('reg.err.errore_generico'))
return
}
this.$q.loading.show({ message: this.$t('reset.incorso') })
this.form.tokenforgot = ''
console.log(this.form)
UserStore.actions.resetpwd(this.form)
.then((ris) => {
this.emailsent = ris.updatepwd
this.$q.loading.hide()
}).catch(error => {
console.log("ERROR = " + error)
this.$q.loading.hide()
})
}
})
</script>
<style scoped>
.mypanel {
padding: 10px;
margin: 10px;
}
</style>

View File

@@ -1,81 +1,12 @@
import { Component, Mixins, Prop, Watch } from 'vue-property-decorator'
import MixinBase from '../../../mixins/mixin-base'
import { CMyFieldDb, CTitleBanner, CProfile } from '@components'
import { UserStore } from '../../../store/Modules'
import { tools } from '../../../store/Modules/tools'
import { DefaultUser } from '@src/store/Modules/UserStore'
import { CMyDashboard } from '../../../components/CMyDashboard'
@Component({
components: { CProfile, CTitleBanner, CMyFieldDb }
components: { CMyDashboard }
})
export default class Dashboard extends MixinBase {
public $v
public $q
public dashboard = {aportador: DefaultUser, downline: []}
public mythis() {
return this
}
public created() {
UserStore.actions.getDashboard({}).then((ris) => {
console.log('getDashboard', ris)
if (ris.aportador === undefined) {
this.dashboard.aportador = DefaultUser
} else {
this.dashboard.aportador = ris.aportador
}
if (ris.downline === undefined) {
this.dashboard.downline = []
} else {
this.dashboard.downline = [...ris.downline]
}
// console.log('this.dashboard', this.dashboard)
})
}
public getletter(user) {
return user.name[0].toUpperCase()
}
public getnumber(user, index) {
return index
}
public getstatecolor(user) {
return (this.dashboard.aportador.verified_email) ? 'green' : 'gray'
}
public getmoneycolor(user) {
return (this.dashboard.aportador.made_gift) ? 'green' : 'gray'
}
public get2peoplecolor(user, index) {
if (!!user.downline)
return (user.downline.length >= 2) ? 'green' : 'gray'
else
return 'grey'
}
public getnumpeople(user) {
if (!!user.downline)
return (user.downline.length)
else
return 0
}
get getRefLink() {
return UserStore.getters.getRefLink()
}
public copylink() {
tools.copyStringToClipboard(this, this.getRefLink)
}
get madegift() {
return UserStore.state.my.made_gift
}
}

View File

@@ -1,104 +1,8 @@
<template>
<div class="q-ma-xs q-gutter-xs q-pa-xs">
<div>
<CMyDashboard username="">
<CTitleBanner class="q-pa-xs" :title="$t('pages.dashboard')" bgcolor="bg-info" clcolor="text-white"
mystyle=" " myclass="myshad">
<q-field outlined bottom-slots :label="$t('reg.reflink')" stack-label class="text-center">
<template v-slot:prepend>
<q-btn round dense flat icon="far fa-copy" @click="copylink"/>
</template>
<template v-slot:control>
<div class="self-center full-width no-outline text-center wrapword" tabindex="0">{{getRefLink}}</div>
</template>
</q-field>
<!--<q-toolbar class="bg-primary text-white shadow-2">-->
<!--<q-toolbar-title class="text-center">{{ $t('reg.aportador_solidario')}}</q-toolbar-title>-->
<!--</q-toolbar>-->
<!--
<q-list bordered v-if="!!dashboard.aportador.name">
<q-item class="q-my-sm" clickable v-ripple>
<q-item-section avatar>
<q-avatar color="primary" text-color="white">
{{ getletter(dashboard.aportador) }}
</q-avatar>
</q-item-section>
<q-item-section>
<q-item-label>{{ dashboard.aportador.username }} ({{ dashboard.aportador.name }} {{ dashboard.aportador.surname }})</q-item-label>
<q-item-label caption lines="1">{{ dashboard.aportador.email }}</q-item-label>
</q-item-section>
<q-item-section side>
<q-icon name="fas fa-user-check" color="green"></q-icon>
</q-item-section>
</q-item>
</q-list>
<div v-else class="q-pa-md text-center">
Nessun Dato
</div>
-->
<q-toolbar class="bg-positive text-white shadow-2">
<q-toolbar-title class="text-center">{{ $t('dashboard.downline')}}</q-toolbar-title>
</q-toolbar>
<q-list bordered v-if="!!dashboard.downline && dashboard.downline.length > 0">
<q-item class="q-my-sm" clickable v-ripple v-for="(user, index) in dashboard.downline" :key="index">
<q-item-section avatar>
<div class="row">
<q-avatar text-color="primary">
{{ getnumber(user, index + 1) }}°
</q-avatar>
<q-avatar color="primary" text-color="white">
{{ getletter(user) }}
</q-avatar>
</div>
</q-item-section>
<q-item-section>
<q-item-label>{{ user.username }} ({{ user.name }} {{ user.surname }})</q-item-label>
<q-item-label caption lines="1">{{ user.email }}</q-item-label>
</q-item-section>
<q-item-section side>
<div class="row q-gutter-md justify-center items-center">
<q-icon size="sm" name="fas fa-user-check" :color="getstatecolor(user)"></q-icon>
<q-icon size="sm" name="fas fa-gift" :color="getmoneycolor(user)"></q-icon>
<q-avatar text-color="primary">
{{ getnumpeople(user) }}
</q-avatar>
<q-icon size="sm" name="fas fa-user-friends" :color="get2peoplecolor(user)"></q-icon>
</div>
</q-item-section>
</q-item>
</q-list>
<div v-else class="q-pa-md text-center">
Nessun Dato
</div>
</CTitleBanner>
<!--
<CTitleBanner class="q-pa-xs" :title="$t('text.dashboard.madegift')" bgcolor="bg-info" clcolor="text-white"
mystyle=" " myclass="myshad">
<div class="q-pa-sm text-center">
<div v-if="madegift" class="q-gutter-md">
<q-icon name="fas fa-gift" size="lg" color="green"></q-icon>
<q-icon name="fas fa-thumbs-up" size="lg" color="green"></q-icon>
</div>
<div v-else class="q-gutter-md">
<q-icon name="fas fa-gift" size="lg" color="grey"></q-icon>
<q-icon name="fas fa-exclamation-triangle" size="lg" color="orange"></q-icon>
</div>
</div>
</CTitleBanner>
-->
</CMyDashboard>
</div>
</template>