2020-02-12 20:41:57 +01:00
|
|
|
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'
|
2020-05-14 17:23:03 +02:00
|
|
|
import { IDashboard, IDownline, IUserProfile } from '../../model'
|
2020-02-12 20:41:57 +01:00
|
|
|
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
|
2020-05-10 21:06:42 +02:00
|
|
|
@Prop({ required: false, default: -1 }) public ind_order_ingr: number
|
|
|
|
|
@Prop({ required: false, default: -1 }) public id_listaingr: number
|
2020-02-12 20:41:57 +01:00
|
|
|
@Prop({ required: true }) public mydashboard
|
2020-05-14 17:23:03 +02:00
|
|
|
@Prop({ required: true }) public mydownline
|
2020-02-12 20:41:57 +01:00
|
|
|
@Prop({ required: false, default: false }) public notitle
|
2020-05-10 21:06:42 +02:00
|
|
|
@Prop({ required: false, default: false }) public showregalainv
|
2020-02-12 20:41:57 +01:00
|
|
|
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,
|
2020-05-14 17:23:03 +02:00
|
|
|
numpeople_aportador: 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public downline: IDownline = {
|
2020-02-12 20:41:57 +01:00
|
|
|
downline: [],
|
|
|
|
|
downnotreg: [],
|
|
|
|
|
downbyuser: []
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Watch('mydashboard')
|
|
|
|
|
public changedash() {
|
|
|
|
|
console.log('changedash')
|
|
|
|
|
this.dashboard = this.mydashboard
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
@Watch('mydownline')
|
|
|
|
|
public changedl() {
|
|
|
|
|
console.log('changedl')
|
|
|
|
|
this.downline = this.mydownline
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-12 20:41:57 +01:00
|
|
|
@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)
|
2020-03-10 21:42:30 +01:00
|
|
|
return tools.isBitActive(user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_READ_GUIDELINES.value)
|
2020-02-12 20:41:57 +01:00
|
|
|
return false
|
|
|
|
|
},
|
|
|
|
|
info: '',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: 'fas fa-tv',
|
|
|
|
|
textlang: 'steps.video_intro',
|
|
|
|
|
textadd(user) {
|
|
|
|
|
return ''
|
|
|
|
|
},
|
|
|
|
|
isok(user) {
|
|
|
|
|
if (user)
|
|
|
|
|
if (user.profile)
|
2020-03-10 21:42:30 +01:00
|
|
|
return tools.isBitActive(user.profile.saw_and_accepted, shared_consts.Accepted.CHECK_SEE_VIDEO_PRINCIPI.value)
|
2020-02-12 20:41:57 +01:00
|
|
|
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)
|
2020-02-19 16:10:05 +01:00
|
|
|
return user.profile.my_dream.length > 10
|
2020-02-12 20:41:57 +01:00
|
|
|
else
|
|
|
|
|
return false
|
|
|
|
|
},
|
|
|
|
|
info: '',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: 'far fa-credit-card',
|
|
|
|
|
textlang: 'steps.paymenttype',
|
|
|
|
|
textadd(user) {
|
|
|
|
|
return ''
|
|
|
|
|
},
|
|
|
|
|
isok(user) {
|
|
|
|
|
if (user) {
|
|
|
|
|
if (!!user.profile.paymenttypes) {
|
2020-09-04 00:08:36 +02:00
|
|
|
return UserStore.state.my.profile.paymenttypes.length > 1
|
2020-02-12 20:41:57 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
},
|
|
|
|
|
info: '',
|
|
|
|
|
},
|
2020-03-10 21:42:30 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
|
|
public arrrequisiti_liberi = [
|
2020-02-12 20:41:57 +01:00
|
|
|
{
|
|
|
|
|
icon: 'fas fa-users',
|
|
|
|
|
textlang: 'steps.sharemovement',
|
|
|
|
|
textadd(user) {
|
|
|
|
|
return ''
|
|
|
|
|
},
|
|
|
|
|
isok(user) {
|
|
|
|
|
if (user) {
|
|
|
|
|
return user.numinvitati >= 2
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
info: '',
|
|
|
|
|
},
|
|
|
|
|
{
|
2020-02-19 16:10:05 +01:00
|
|
|
icon: 'fas fa-check',
|
2020-02-12 20:41:57 +01:00
|
|
|
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
|
2020-05-14 17:23:03 +02:00
|
|
|
this.downline = this.mydownline
|
2020-02-12 20:41:57 +01:00
|
|
|
this.seluser = this.myseluser
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public async update_username() {
|
|
|
|
|
|
|
|
|
|
await UserStore.actions.getDashboard({ username: this.dashboard.myself.username }).then((ris) => {
|
|
|
|
|
this.dashboard = ris
|
2020-05-14 17:23:03 +02:00
|
|
|
|
|
|
|
|
UserStore.actions.getDownline({ username: this.dashboard.myself.username }).then((ris2) => {
|
|
|
|
|
this.downline = ris2
|
|
|
|
|
this.$emit('aggiorna')
|
|
|
|
|
})
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
})
|
2020-05-14 17:23:03 +02:00
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
}
|
|
|
|
|
|
2020-02-12 20:41:57 +01:00
|
|
|
public isextralist(user) {
|
|
|
|
|
return !!user.cell_complete
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ismyinvited_notreg(user) {
|
2020-05-10 21:06:42 +02:00
|
|
|
// return this.dashboard.downnotreg.find((rec) => rec.ind_order === user.ind_order)
|
2020-02-12 20:41:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ismydownline(user) {
|
2020-05-14 17:23:03 +02:00
|
|
|
return this.downline.downline.find((rec) => rec.username === user.username)
|
2020-02-12 20:41:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 = ''
|
2020-02-19 16:10:05 +01:00
|
|
|
aportador_solidario = aportador_solidario.trim()
|
2020-02-12 20:41:57 +01:00
|
|
|
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,
|
2020-05-10 21:06:42 +02:00
|
|
|
param2: { aportador_solidario },
|
|
|
|
|
param3: notiftxt
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async RegalaInvitante(user, invitante_username, ind_order_ingr, id_listaingr, notifBottxt) {
|
|
|
|
|
let notiftxt = ''
|
|
|
|
|
invitante_username = invitante_username.trim()
|
|
|
|
|
if (this.notifBot)
|
|
|
|
|
notiftxt = notifBottxt
|
|
|
|
|
|
|
|
|
|
await tools.askConfirm(this.$q, translate('reg.regala_invitante'), translate('reg.regala_invitante') + ' ' + user.name + ' ' + user.surname + ' a ' + invitante_username + ' ?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.REGALA_INVITANTE, 0, {
|
|
|
|
|
param1: id_listaingr,
|
2020-05-13 01:33:07 +02:00
|
|
|
param2: { invitante_username, ind_order_ingr, name: user.name, surname: user.surname },
|
2020-02-12 20:41:57 +01:00
|
|
|
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
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
if (!this.showregalainv) {
|
|
|
|
|
error = error || (this.aportador_solidario === this.seluser.aportador_solidario)
|
|
|
|
|
}
|
2020-02-12 20:41:57 +01:00
|
|
|
|
|
|
|
|
return !error
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get getnotifBotTxt() {
|
|
|
|
|
return this.$t('dashboard.ricevuto_dono', {
|
|
|
|
|
invitato: this.seluser.name + ' ' + this.seluser.surname,
|
|
|
|
|
mittente: this.dashboard.myself.username
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
get getnotifBotTxtInvitante() {
|
2020-05-13 01:33:07 +02:00
|
|
|
return this.$t('dashboard.ricevuto_dono_invitante', {
|
2020-05-10 21:06:42 +02:00
|
|
|
mittente: this.dashboard.myself.username
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-19 16:10:05 +01:00
|
|
|
get myclassreq() {
|
|
|
|
|
let mycl = 'text-center'
|
|
|
|
|
mycl += (this.ismydownline) ? ' ' + 'background-color: green;' : ''
|
|
|
|
|
|
|
|
|
|
return mycl
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
public geticonerror(mybool) {
|
|
|
|
|
if (mybool)
|
|
|
|
|
return 'fas fa-exclamation-triangle'
|
|
|
|
|
else
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public isregalainvitante() {
|
|
|
|
|
return this.ind_order_ingr >= 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public gettitleregala() {
|
|
|
|
|
if (this.isregalainvitante())
|
|
|
|
|
return this.$t('reg.regala_invitante')
|
|
|
|
|
else
|
|
|
|
|
return this.$t('reg.regala_invitato')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-02-12 20:41:57 +01:00
|
|
|
}
|