- Aggiunto Step: i 7 Requisiti degli invitati.
- Aggiornata la Lavagna (anche sul BOT). - Zoom solo 3 visibili.
This commit is contained in:
12
src/components/CMyRequirement/CMyRequirement-validate.ts
Normal file
12
src/components/CMyRequirement/CMyRequirement-validate.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { ISignupOptions } from 'model'
|
||||
import { email, minLength, required, sameAs } from 'vuelidate/lib/validators'
|
||||
// import { ValidationRuleset } from 'vuelidate'
|
||||
import { complexity, registeredemail, registereduser, aportadorexist } from '../../validation'
|
||||
|
||||
export const validations = {
|
||||
|
||||
aportador_solidario: {
|
||||
aportadorexist,
|
||||
required
|
||||
}
|
||||
}
|
||||
0
src/components/CMyRequirement/CMyRequirement.scss
Normal file
0
src/components/CMyRequirement/CMyRequirement.scss
Normal file
293
src/components/CMyRequirement/CMyRequirement.ts
Normal file
293
src/components/CMyRequirement/CMyRequirement.ts
Normal file
@@ -0,0 +1,293 @@
|
||||
import { Component, Prop, Watch } from 'vue-property-decorator'
|
||||
|
||||
import { UserStore } from '../../store/Modules'
|
||||
import { DefaultUser } from '@src/store/Modules/UserStore'
|
||||
|
||||
import MixinUsers from '../../mixins/mixin-users'
|
||||
import { CProfile } from '../CProfile'
|
||||
import { CTitleBanner } from '../CTitleBanner'
|
||||
import { CMyFieldDb } from '../CMyFieldDb'
|
||||
import { CCopyBtn } from '../CCopyBtn'
|
||||
import { CUserBadge } from '../CUserBadge'
|
||||
import { CLegenda } from '../CLegenda'
|
||||
import { IDashboard, IUserProfile } from '../../model'
|
||||
import { IUserFields } from '../../model/UserStore'
|
||||
import { CRequisito } from '../CRequisito'
|
||||
import translate from '../../globalroutines/util'
|
||||
import { tools } from '../../store/Modules/tools'
|
||||
import { lists } from '../../store/Modules/lists'
|
||||
import { validations } from './CMyRequirement-validate'
|
||||
import { validationMixin } from 'vuelidate'
|
||||
import { shared_consts } from '../../common/shared_vuejs'
|
||||
|
||||
@Component({
|
||||
mixins: [validationMixin],
|
||||
validations,
|
||||
components: { CProfile, CTitleBanner, CMyFieldDb, CCopyBtn, CUserBadge, CLegenda, CRequisito }
|
||||
})
|
||||
|
||||
export default class CMyRequirement extends MixinUsers {
|
||||
@Prop({ required: true }) public myseluser
|
||||
@Prop({ required: true }) public mydashboard
|
||||
@Prop({ required: false, default: false }) public notitle
|
||||
public $t
|
||||
public $v
|
||||
public $q
|
||||
public notifBot: boolean = true
|
||||
public aportador_solidario: string = ''
|
||||
public seluser: IUserFields = DefaultUser
|
||||
public dashboard: IDashboard = {
|
||||
myself: DefaultUser,
|
||||
aportador: DefaultUser,
|
||||
numpeople_aportador: 0,
|
||||
downline: [],
|
||||
downnotreg: [],
|
||||
downbyuser: []
|
||||
}
|
||||
|
||||
@Watch('mydashboard')
|
||||
public changedash() {
|
||||
console.log('changedash')
|
||||
this.dashboard = this.mydashboard
|
||||
}
|
||||
|
||||
@Watch('myusersel')
|
||||
public changemyusersel() {
|
||||
console.log('myseluser')
|
||||
this.seluser = this.myseluser
|
||||
}
|
||||
|
||||
public arrrequisiti = [
|
||||
{
|
||||
icon: 'email',
|
||||
textlang: 'reg.verified_email',
|
||||
textadd(user) {
|
||||
return ''
|
||||
},
|
||||
isok(user) {
|
||||
if (user)
|
||||
return user.verified_email
|
||||
else
|
||||
return false
|
||||
},
|
||||
info: '',
|
||||
},
|
||||
{
|
||||
icon: 'fab fa-telegram',
|
||||
textlang: 'reg.telegram',
|
||||
textadd(user) {
|
||||
return ''
|
||||
},
|
||||
isok(user) {
|
||||
if (user)
|
||||
if (user.profile)
|
||||
return user.profile.teleg_id > 0
|
||||
|
||||
return false
|
||||
},
|
||||
info: '',
|
||||
},
|
||||
{
|
||||
icon: 'fas fa-file-signature',
|
||||
textlang: 'steps.linee_guida',
|
||||
textadd(user) {
|
||||
return ''
|
||||
},
|
||||
isok(user) {
|
||||
if (user)
|
||||
if (user.profile)
|
||||
return tools.isBitActive(user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_READ_GUIDELINES)
|
||||
return false
|
||||
},
|
||||
info: '',
|
||||
},
|
||||
{
|
||||
icon: 'fas fa-tv',
|
||||
textlang: 'steps.video_intro',
|
||||
textadd(user) {
|
||||
return ''
|
||||
},
|
||||
isok(user) {
|
||||
if (user)
|
||||
if (user.profile)
|
||||
return tools.isBitActive(user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI)
|
||||
return false
|
||||
},
|
||||
info: '',
|
||||
},
|
||||
{
|
||||
icon: 'fas fa-video',
|
||||
textlang: 'steps.zoom',
|
||||
textadd(user) {
|
||||
return ''
|
||||
},
|
||||
isok(user) {
|
||||
if (user) {
|
||||
return user.profile.saw_zoom_presentation
|
||||
}
|
||||
|
||||
},
|
||||
info: '',
|
||||
},
|
||||
{
|
||||
icon: 'fas fa-heart',
|
||||
textlang: 'steps.dream',
|
||||
textadd(user) {
|
||||
return ''
|
||||
},
|
||||
isok(user) {
|
||||
if (user)
|
||||
if (user.profile.my_dream)
|
||||
return user.profile.my_dream.length > 20
|
||||
else
|
||||
return false
|
||||
},
|
||||
info: '',
|
||||
},
|
||||
{
|
||||
icon: 'far fa-credit-card',
|
||||
textlang: 'steps.paymenttype',
|
||||
textadd(user) {
|
||||
return ''
|
||||
},
|
||||
isok(user) {
|
||||
let ispaypal = false
|
||||
if (user) {
|
||||
if (!!user.profile.paymenttypes) {
|
||||
if (user.profile.paymenttypes.includes('paypal')) {
|
||||
if (user.profile.email_paypal) {
|
||||
ispaypal = true
|
||||
}
|
||||
}
|
||||
if (!!user.profile)
|
||||
if (!!user.profile.paymenttypes) {
|
||||
const ris = (user.profile.paymenttypes.length >= 1) && ispaypal
|
||||
return ris
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return false
|
||||
},
|
||||
info: '',
|
||||
},
|
||||
{
|
||||
icon: 'fas fa-users',
|
||||
textlang: 'steps.sharemovement',
|
||||
textadd(user) {
|
||||
return ''
|
||||
},
|
||||
isok(user) {
|
||||
if (user) {
|
||||
return user.numinvitati >= 2
|
||||
}
|
||||
},
|
||||
info: '',
|
||||
},
|
||||
{
|
||||
icon: 'fas fa-users',
|
||||
textlang: 'dashboard.inv_attivi',
|
||||
textadd(user) {
|
||||
return ' (' + user.numinvitatiattivi + ')'
|
||||
},
|
||||
isok(user) {
|
||||
if (user) {
|
||||
return user.numinvitatiattivi >= 2
|
||||
}
|
||||
},
|
||||
info: '',
|
||||
},
|
||||
]
|
||||
|
||||
get mythis() {
|
||||
return this
|
||||
}
|
||||
|
||||
public created() {
|
||||
this.dashboard = this.mydashboard
|
||||
this.seluser = this.myseluser
|
||||
|
||||
}
|
||||
|
||||
public isextralist(user) {
|
||||
return !!user.cell_complete
|
||||
}
|
||||
|
||||
public ismyinvited_notreg(user) {
|
||||
return this.dashboard.downnotreg.find((rec) => rec.ind_order === user.ind_order)
|
||||
}
|
||||
|
||||
public ismydownline(user) {
|
||||
return this.dashboard.downline.find((rec) => rec.username === user.username)
|
||||
}
|
||||
|
||||
public async deleteUserFromExtraList(user) {
|
||||
|
||||
await tools.askConfirm(this.$q, translate('reg.cancella_invitato'), translate('reg.cancella_invitato') + ' ' + user.name + ' ' + user.surname + '?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.DELETE_EXTRALIST, 0, {
|
||||
param1: user,
|
||||
param2: true
|
||||
})
|
||||
}
|
||||
|
||||
public async deleteUserFromUsersList(user) {
|
||||
|
||||
await tools.askConfirm(this.$q, translate('reg.cancella_invitato'), translate('reg.cancella_invitato') + ' ' + user.name + ' ' + user.surname + '?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.DELETE_USERLIST, 0, {
|
||||
param1: user,
|
||||
param2: true
|
||||
})
|
||||
}
|
||||
|
||||
public async RegalaInvitato(user, aportador_solidario, notifBottxt) {
|
||||
let notiftxt = ''
|
||||
if (this.notifBot)
|
||||
notiftxt = notifBottxt
|
||||
|
||||
await tools.askConfirm(this.$q, translate('reg.regala_invitato'), translate('reg.regala_invitato') + ' ' + user.name + ' ' + user.surname + ' a ' + aportador_solidario + ' ?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.REGALA_INVITATO, 0, {
|
||||
param1: user,
|
||||
param2: aportador_solidario,
|
||||
param3: notiftxt
|
||||
})
|
||||
}
|
||||
|
||||
public errorMsg(cosa: string, item: any) {
|
||||
try {
|
||||
if (!item.$error) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (item.required !== undefined) {
|
||||
if (!item.required) {
|
||||
return this.$t('reg.err.required')
|
||||
}
|
||||
|
||||
} else if (cosa === 'aportador_solidario') {
|
||||
// console.log(item);
|
||||
if (!item.aportadorexist) {
|
||||
// console.log('!item.aportadorexist !')
|
||||
return this.$t('reg.err.aportador_regalare_not_exist')
|
||||
}
|
||||
}
|
||||
|
||||
return ''
|
||||
} catch (error) {
|
||||
// console.log("ERR : " + error);
|
||||
}
|
||||
}
|
||||
|
||||
get allowSubmit() {
|
||||
let error = this.$v.$error || this.$v.$invalid
|
||||
|
||||
error = error || (this.aportador_solidario === this.seluser.aportador_solidario)
|
||||
|
||||
return !error
|
||||
|
||||
}
|
||||
|
||||
get getnotifBotTxt() {
|
||||
return this.$t('dashboard.ricevuto_dono', {
|
||||
invitato: this.seluser.name + ' ' + this.seluser.surname,
|
||||
mittente: this.dashboard.myself.username
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
98
src/components/CMyRequirement/CMyRequirement.vue
Normal file
98
src/components/CMyRequirement/CMyRequirement.vue
Normal file
@@ -0,0 +1,98 @@
|
||||
<template>
|
||||
<div>
|
||||
<CTitleBanner class="shadow-2 rounded-borders" :title="$t('reg.requirement') + ` - ` + seluser.name + ` ` + seluser.surname + ``"
|
||||
bgcolor="bg-primary"
|
||||
clcolor="text-white"
|
||||
mystyle=" " myclass="myshad" :canopen="true">
|
||||
|
||||
|
||||
<div v-if="!ismyinvited_notreg(seluser)" class="text-center">
|
||||
|
||||
<div v-if="!isextralist(seluser)">
|
||||
<div v-for="(req, index) of arrrequisiti">
|
||||
<CRequisito :icon="req.icon" :text="(index + 1) + `. ` + $t(req.textlang) + req.textadd(seluser)" :isok="req.isok(seluser)"
|
||||
:info="req.info"></CRequisito>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div v-if="ismydownline(seluser)">
|
||||
<CTitleBanner class="shadow-2 rounded-borders" :title="$t('reg.regala_invitato')"
|
||||
bgcolor="bg-positive"
|
||||
clcolor="text-white"
|
||||
:visible="false"
|
||||
mystyle=" " myclass="myshad" :canopen="true">
|
||||
|
||||
<div class="column q-gutter-sm justify-center text-center">
|
||||
<q-input
|
||||
bg-color="lightblue"
|
||||
v-model="aportador_solidario"
|
||||
rounded outlined
|
||||
@blur="$v.aportador_solidario.$touch"
|
||||
:error="$v.aportador_solidario.$error"
|
||||
:error-message="errorMsg('aportador_solidario', $v.aportador_solidario)"
|
||||
maxlength="20"
|
||||
debounce="1000"
|
||||
|
||||
:label="$t('reg.username_regala_invitato')">
|
||||
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="person"/>
|
||||
</template>
|
||||
|
||||
</q-input>
|
||||
|
||||
<q-toggle v-model="notifBot" :label="$t('dashboard.sendnotification')"/>
|
||||
|
||||
<q-btn class="q-ma-sm" rounded color="positive" text-color="white" icon="fas fa-gift"
|
||||
:label="$t('reg.regala_invitato')"
|
||||
:disabled='!allowSubmit'
|
||||
@click="RegalaInvitato(seluser, aportador_solidario, getnotifBotTxt)"></q-btn>
|
||||
</div>
|
||||
</CTitleBanner>
|
||||
|
||||
<CTitleBanner v-if="ismydownline(seluser) && (seluser.numinvitati <= 0)"
|
||||
class="shadow-2 rounded-borders text-center"
|
||||
:title="$t('reg.cancella_invitato')"
|
||||
bgcolor="bg-negative"
|
||||
clcolor="text-white"
|
||||
:visible="false"
|
||||
mystyle=" " myclass="myshad" :canopen="true">
|
||||
|
||||
<q-btn rounded text-color="red" icon="delete"
|
||||
:label="$t('reg.cancella_invitato')"
|
||||
@click="deleteUserFromUsersList(seluser)"></q-btn>
|
||||
</CTitleBanner>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="column justify-center q-gutter-sm q-pa-sm">
|
||||
|
||||
<CRequisito icon="fas fa-user" :text="$t('dashboard.notreg')" :isok="false"
|
||||
info=""></CRequisito>
|
||||
|
||||
<CTitleBanner class="shadow-2 rounded-borders text-center"
|
||||
:title="$t('reg.cancella_invitato')"
|
||||
bgcolor="bg-negative"
|
||||
clcolor="text-white"
|
||||
:visible="false"
|
||||
mystyle=" " myclass="myshad" :canopen="true">
|
||||
<q-btn rounded text-color="red" icon="delete" :label="$t('reg.cancella_invitato')"
|
||||
@click="deleteUserFromExtraList(seluser)"></q-btn>
|
||||
</CTitleBanner>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</CTitleBanner>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMyRequirement.ts">
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './CMyRequirement.scss';
|
||||
</style>
|
||||
1
src/components/CMyRequirement/index.ts
Normal file
1
src/components/CMyRequirement/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export {default as CMyRequirement} from './CMyRequirement.vue'
|
||||
Reference in New Issue
Block a user