2020-01-30 01:20:56 +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'
|
2020-02-02 04:07:24 +01:00
|
|
|
import { CLegenda } from '../CLegenda'
|
2020-05-14 17:23:03 +02:00
|
|
|
import { IDashboard, IDownline, IUserProfile } from '../../model'
|
2020-02-02 04:07:24 +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'
|
2020-02-07 22:08:01 +01:00
|
|
|
import { shared_consts } from '../../common/shared_vuejs'
|
2020-02-12 20:41:57 +01:00
|
|
|
import { CMyRequirement } from '../CMyRequirement'
|
2020-03-10 21:42:30 +01:00
|
|
|
import { CRequisiti } from '../CRequisiti'
|
|
|
|
|
import { CCardState } from '../CCardState'
|
|
|
|
|
import { CMyNave } from '../CMyNave'
|
2020-05-10 21:06:42 +02:00
|
|
|
import { validations } from './CMyDashboard-validate'
|
|
|
|
|
import { validationMixin } from 'vuelidate'
|
2020-01-30 01:20:56 +01:00
|
|
|
|
|
|
|
|
@Component({
|
2020-05-10 21:06:42 +02:00
|
|
|
mixins: [validationMixin],
|
|
|
|
|
validations,
|
|
|
|
|
components: {
|
|
|
|
|
CProfile,
|
|
|
|
|
CTitleBanner,
|
|
|
|
|
CMyFieldDb,
|
|
|
|
|
CCopyBtn,
|
|
|
|
|
CUserBadge,
|
|
|
|
|
CLegenda,
|
|
|
|
|
CRequisito,
|
|
|
|
|
CMyRequirement,
|
|
|
|
|
CRequisiti,
|
|
|
|
|
CCardState,
|
|
|
|
|
CMyNave
|
|
|
|
|
},
|
2020-01-30 01:20:56 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export default class CMyDashboard extends MixinUsers {
|
|
|
|
|
public $v
|
|
|
|
|
public $q
|
2020-02-02 04:07:24 +01:00
|
|
|
public myusername: string = ''
|
2020-05-10 21:06:42 +02:00
|
|
|
public tab: string = 'requisiti'
|
|
|
|
|
public tabcosa: string = ''
|
2020-02-02 04:07:24 +01:00
|
|
|
public showuserinfo: boolean = false
|
2020-05-10 21:06:42 +02:00
|
|
|
public shownuovoviaggio: boolean = false
|
2020-02-02 04:07:24 +01:00
|
|
|
public notifBot: boolean = true
|
2020-05-10 21:06:42 +02:00
|
|
|
public loading: boolean = false
|
2020-05-14 17:23:03 +02:00
|
|
|
public loading_invitati: boolean = false
|
2020-02-02 04:07:24 +01:00
|
|
|
public seluser: IUserFields = null
|
|
|
|
|
public aportador_solidario: string = ''
|
2020-05-10 21:06:42 +02:00
|
|
|
public invitante_username: string = ''
|
|
|
|
|
public showregalainv: boolean = false
|
|
|
|
|
public id_listaingr: number = -1
|
|
|
|
|
public ind_order_ingr: number = -1
|
2020-05-11 22:43:54 +02:00
|
|
|
public myrigaattuale: number = 0
|
|
|
|
|
public mycolattuale: number = 0
|
2020-02-02 04:07:24 +01:00
|
|
|
public dashboard: IDashboard = {
|
|
|
|
|
myself: DefaultUser,
|
|
|
|
|
aportador: DefaultUser,
|
|
|
|
|
numpeople_aportador: 0,
|
2020-05-10 21:06:42 +02:00
|
|
|
arrimbarchi: [],
|
|
|
|
|
arrposizioni: [],
|
|
|
|
|
navi_partenza: [],
|
|
|
|
|
lastnave: {},
|
|
|
|
|
arrusers: [],
|
2020-02-02 04:07:24 +01:00
|
|
|
}
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
public downline: IDownline = {
|
|
|
|
|
downline: [],
|
|
|
|
|
downnotreg: [],
|
|
|
|
|
downbyuser: []
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-02 04:07:24 +01:00
|
|
|
@Prop({ required: true }) public username
|
|
|
|
|
|
|
|
|
|
@Watch('UserStore.state.my.dashboard')
|
|
|
|
|
public changedash() {
|
2020-05-11 22:43:54 +02:00
|
|
|
// console.log('changedash')
|
2020-02-02 04:07:24 +01:00
|
|
|
this.dashboard = UserStore.state.my.dashboard
|
2020-05-10 21:06:42 +02:00
|
|
|
if (!!this.dashboard)
|
2020-05-11 22:43:54 +02:00
|
|
|
this.invitante_username = this.dashboard.myself.username
|
2020-05-10 21:06:42 +02:00
|
|
|
|
2020-02-02 04:07:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get mythis() {
|
2020-01-30 01:20:56 +01:00
|
|
|
return this
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public created() {
|
2020-05-10 21:06:42 +02:00
|
|
|
if (!!tools.getCookie(tools.TABBED_DASHBOARD)) {
|
|
|
|
|
this.tab = tools.getCookie(tools.TABBED_DASHBOARD)
|
|
|
|
|
}
|
2020-01-30 01:20:56 +01:00
|
|
|
this.update_username()
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public changetab(val) {
|
|
|
|
|
tools.setCookie(tools.TABBED_DASHBOARD, val)
|
2020-05-14 17:23:03 +02:00
|
|
|
if (this.tab === 'invitati') {
|
|
|
|
|
if (this.downline.downline.length <= 0) {
|
|
|
|
|
this.loading_invitati = true
|
|
|
|
|
UserStore.actions.getDownline({ username: this.myusername }).then((ris) => {
|
|
|
|
|
this.downline = ris
|
|
|
|
|
this.loading_invitati = false
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-11 22:43:54 +02:00
|
|
|
// console.log('setcook', val)
|
2020-05-10 21:06:42 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-30 01:20:56 +01:00
|
|
|
@Watch('this.username')
|
|
|
|
|
public changeusername() {
|
|
|
|
|
this.update_username()
|
|
|
|
|
|
|
|
|
|
}
|
2020-02-02 04:07:24 +01:00
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public aggiorna() {
|
|
|
|
|
this.dashboard = null
|
|
|
|
|
this.update_username()
|
|
|
|
|
this.showuserinfo = false
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-02 04:07:24 +01:00
|
|
|
public async update_username() {
|
2020-05-11 22:43:54 +02:00
|
|
|
// console.log('update_username')
|
2020-05-10 21:06:42 +02:00
|
|
|
this.loading = true
|
2020-01-30 01:20:56 +01:00
|
|
|
if (this.username === '')
|
2020-02-02 04:07:24 +01:00
|
|
|
this.myusername = this.getMyUsername()
|
|
|
|
|
else
|
|
|
|
|
this.myusername = this.username
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
this.loading = true
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
UserStore.actions.getDashboard({ username: this.myusername })
|
|
|
|
|
.then((ris) => {
|
|
|
|
|
this.dashboard = ris
|
|
|
|
|
|
|
|
|
|
if (!!this.dashboard)
|
|
|
|
|
this.invitante_username = this.dashboard.myself.username
|
|
|
|
|
|
|
|
|
|
this.myrigaattuale = this.dashboard.lastnave.riga
|
|
|
|
|
this.mycolattuale = this.dashboard.lastnave.col
|
|
|
|
|
|
|
|
|
|
this.loading = false
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
this.loading = false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
if (this.tab === 'invitati') {
|
|
|
|
|
this.loading_invitati = true
|
|
|
|
|
UserStore.actions.getDownline({ username: this.myusername })
|
|
|
|
|
.then((ris2) => {
|
|
|
|
|
this.downline = ris2
|
|
|
|
|
this.loading_invitati = false
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {
|
|
|
|
|
this.loading_invitati = false
|
|
|
|
|
})
|
2020-05-10 21:06:42 +02:00
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
}
|
2020-05-10 21:06:42 +02:00
|
|
|
|
|
|
|
|
this.showuserinfo = false
|
2020-02-02 04:07:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get getRefLink() {
|
|
|
|
|
return UserStore.getters.getRefLink(this.myusername)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get invitatinotreg() {
|
2020-05-14 17:23:03 +02:00
|
|
|
if (this.downline)
|
|
|
|
|
if (this.downline.downnotreg)
|
|
|
|
|
return this.downline.downnotreg.length > 0
|
2020-02-02 04:07:24 +01:00
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
public selectclick(user, showregalainv, ind_order_ingr, id_listaingr, disabled) {
|
|
|
|
|
if (!disabled) {
|
|
|
|
|
this.showuserinfo = true
|
|
|
|
|
this.seluser = user
|
|
|
|
|
this.showregalainv = showregalainv
|
|
|
|
|
this.ind_order_ingr = ind_order_ingr
|
|
|
|
|
this.id_listaingr = id_listaingr
|
|
|
|
|
}
|
2020-02-02 04:07:24 +01:00
|
|
|
}
|
|
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
get Completato7Req() {
|
|
|
|
|
// return tools.Is7ReqOk(this.dashboard.myself)
|
2020-05-14 17:23:03 +02:00
|
|
|
if (!!this.dashboard.myself)
|
|
|
|
|
return this.dashboard.myself.qualified
|
|
|
|
|
|
|
|
|
|
return false
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
2020-05-10 21:06:42 +02:00
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
get Completato9Req() {
|
|
|
|
|
// return tools.Is9ReqOk(this.dashboard.myself)
|
2020-05-14 17:23:03 +02:00
|
|
|
if (!!this.dashboard.myself)
|
2020-05-10 21:06:42 +02:00
|
|
|
return this.dashboard.myself.qualified && (this.dashboard.myself.numinvitatiattivi >= 2)
|
|
|
|
|
return false
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
get HasNave() {
|
|
|
|
|
if (!!this.dashboard.arrposizioni)
|
|
|
|
|
return this.dashboard.arrposizioni.length > 0
|
|
|
|
|
else
|
|
|
|
|
return false
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public getnavePartenzaByRigaCol(riga, col) {
|
|
|
|
|
for (const mynave of this.dashboard.navi_partenza) {
|
|
|
|
|
if (!!mynave) {
|
|
|
|
|
if ((mynave.riga === riga) && (mynave.col === col)) {
|
|
|
|
|
return mynave
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public datanave(mianave) {
|
2020-05-14 17:23:03 +02:00
|
|
|
// const mynavepart = this.getnavePartenzaByRigaCol(tools.getRiganave(mianave.riga), tools.getColnave(mianave.col))
|
|
|
|
|
if (!!mianave.nave_partenza) {
|
|
|
|
|
if (!!mianave.nave_partenza.date_start)
|
|
|
|
|
return tools.getstrDate(mianave.nave_partenza.date_start)
|
|
|
|
|
}
|
|
|
|
|
return ' --/-- '
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public datagiftchat(mianave) {
|
2020-05-10 21:06:42 +02:00
|
|
|
// const mynavepart = this.getnavePartenzaByRigaCol(tools.getRiganave(mianave.riga), tools.getColnave(mianave.col))
|
|
|
|
|
if (!!mianave.nave_partenza) {
|
2020-05-11 22:43:54 +02:00
|
|
|
if (!!mianave.nave_partenza.date_gift_chat_open)
|
2020-05-14 17:23:03 +02:00
|
|
|
return tools.getstrDate(mianave.nave_partenza.date_gift_chat_open)
|
2020-05-10 21:06:42 +02:00
|
|
|
}
|
|
|
|
|
return ' --/-- '
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public geticon(mianave) {
|
|
|
|
|
if (!mianave)
|
|
|
|
|
return ''
|
|
|
|
|
|
|
|
|
|
if (mianave.made_gift) {
|
|
|
|
|
return 'fas fa-gift'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public colordono(mianave) {
|
|
|
|
|
if (mianave.made_gift) {
|
|
|
|
|
return 'green'
|
|
|
|
|
} else {
|
|
|
|
|
return 'grey'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getposizioneattuale(mianave, totali) {
|
|
|
|
|
const mynavedest = tools.getfirstnaveSognatore(mianave.riga, mianave.col)
|
|
|
|
|
const ris = tools.getnumnavi_finoa(mianave, mynavedest, this.dashboard.lastnave)
|
|
|
|
|
if (totali)
|
|
|
|
|
return mianave.riga + '.' + mianave.col + ' ' + ris.contaattuale + '/' + ris.totale
|
|
|
|
|
else
|
|
|
|
|
return ris.perc
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async NuovoImbarco(username, invitante_username) {
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
await tools.askConfirm(this.$q, translate('steps.nuovo_imbarco'), translate('dialog.continue') + ' ?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.AGGIUNGI_NUOVO_IMBARCO, 0, {
|
2020-05-10 21:06:42 +02:00
|
|
|
param1: { username, invitante_username }
|
|
|
|
|
})
|
|
|
|
|
this.shownuovoviaggio = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public addNuovoImbarco() {
|
|
|
|
|
this.NuovoImbarco(this.dashboard.myself.username, this.invitante_username)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async cancellaImbarco(imbarco) {
|
2020-05-14 17:23:03 +02:00
|
|
|
await tools.askConfirm(this.$q, translate('dashboard.attenzione'), translate('steps.vuoi_cancellare_imbarco'), translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.CANCELLA_IMBARCO, 0, {
|
2020-05-10 21:06:42 +02:00
|
|
|
param1: { ind_order: imbarco.ind_order, username: imbarco.username },
|
|
|
|
|
param2: { num_tess: imbarco.num_tess }
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getnuminvitatistr(index, myuser) {
|
|
|
|
|
let inv = myuser.numinvitati
|
|
|
|
|
let invattivi = myuser.numinvitatiattivi
|
|
|
|
|
|
|
|
|
|
const step = (index - 1) * 2
|
|
|
|
|
|
|
|
|
|
inv -= step
|
|
|
|
|
invattivi -= step
|
|
|
|
|
if (inv < 0)
|
|
|
|
|
inv = 0
|
|
|
|
|
if (invattivi < 0)
|
|
|
|
|
invattivi = 0
|
|
|
|
|
if (inv > 2)
|
|
|
|
|
inv = 2
|
|
|
|
|
if (invattivi > 2)
|
|
|
|
|
invattivi = 2
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
return invattivi + '/' + inv
|
2020-05-10 21:06:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getinvit(index, myuser, posiz) {
|
|
|
|
|
let inv = myuser.numinvitati
|
|
|
|
|
let invattivi = myuser.numinvitatiattivi
|
|
|
|
|
|
|
|
|
|
const step = (posiz.numNaviEntrato + index) * 2
|
|
|
|
|
|
|
|
|
|
inv -= step
|
|
|
|
|
// console.log('inv', inv, 'step = ', step)
|
|
|
|
|
invattivi -= step
|
|
|
|
|
if (inv < 0)
|
|
|
|
|
inv = 0
|
|
|
|
|
if (invattivi < 0)
|
|
|
|
|
invattivi = 0
|
|
|
|
|
if (inv > 2)
|
|
|
|
|
inv = 2
|
|
|
|
|
if (invattivi > 2)
|
|
|
|
|
invattivi = 2
|
|
|
|
|
|
|
|
|
|
return { invattivi, inv }
|
|
|
|
|
}
|
2020-05-14 17:23:03 +02:00
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public getnuminv(index, myuser, posiz) {
|
|
|
|
|
const ris = this.getinvit(index, myuser, posiz)
|
|
|
|
|
|
|
|
|
|
return ris.inv
|
|
|
|
|
}
|
2020-05-14 17:23:03 +02:00
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public getnuminvattivi(index, myuser, posiz) {
|
|
|
|
|
const ris = this.getinvit(index, myuser, posiz)
|
|
|
|
|
|
|
|
|
|
return ris.invattivi
|
|
|
|
|
}
|
2020-05-14 17:23:03 +02:00
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public getnuminvperc(index, myuser, posiz) {
|
|
|
|
|
const ris = this.getinvit(index, myuser, posiz)
|
|
|
|
|
|
|
|
|
|
return ris.invattivi / 2 * 100
|
|
|
|
|
}
|
2020-05-14 17:23:03 +02:00
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public getcolorinvitati(index, myuser, posiz) {
|
|
|
|
|
|
|
|
|
|
const ris = this.getinvit(index, myuser, posiz)
|
|
|
|
|
if (ris.invattivi === 1)
|
|
|
|
|
return 'blue'
|
|
|
|
|
if (ris.invattivi === 2)
|
|
|
|
|
return 'green'
|
|
|
|
|
if (ris.inv === 1)
|
|
|
|
|
return 'orange'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getnumtessstr(num_tess, index) {
|
|
|
|
|
|
|
|
|
|
let str = index + 1 + '°'
|
|
|
|
|
|
|
|
|
|
if (num_tess % 2 === 0) {
|
|
|
|
|
str += ' (Gratis)'
|
|
|
|
|
}
|
|
|
|
|
return str
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 === 'invitante_username') {
|
|
|
|
|
// console.log(item);
|
|
|
|
|
if (!item.aportadorexist) {
|
|
|
|
|
// console.log('!item.aportadorexist !')
|
|
|
|
|
return this.$t('reg.err.invitante_username_not_exist')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ''
|
|
|
|
|
} catch (error) {
|
|
|
|
|
// console.log("ERR : " + error);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get allowSubmit() {
|
|
|
|
|
let error = this.$v.$error || this.$v.$invalid
|
|
|
|
|
|
2020-05-11 22:43:54 +02:00
|
|
|
// error = error || (this.invitante_username === this.dashboard.myself.username)
|
2020-05-10 21:06:42 +02:00
|
|
|
|
|
|
|
|
return !error
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public imbarchipresenti() {
|
2020-05-14 17:23:03 +02:00
|
|
|
let presente = false
|
2020-05-10 21:06:42 +02:00
|
|
|
for (const rec of this.dashboard.arrimbarchi) {
|
|
|
|
|
if (!rec.added)
|
|
|
|
|
presente = true
|
|
|
|
|
}
|
|
|
|
|
return presente
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-13 01:33:07 +02:00
|
|
|
public isprovvisoria(mianave) {
|
|
|
|
|
if (!!mianave && mianave.nave_partenza)
|
|
|
|
|
return mianave.nave_partenza.provvisoria
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getcolorbynave(mianave) {
|
2020-05-10 21:06:42 +02:00
|
|
|
if (!!mianave.nave_partenza)
|
|
|
|
|
return mianave.nave_partenza.provvisoria ? 'gray' : 'green'
|
|
|
|
|
else
|
|
|
|
|
return 'green'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public change_mynote(mianave) {
|
|
|
|
|
|
|
|
|
|
const mydata = {
|
|
|
|
|
note: mianave.note
|
|
|
|
|
}
|
|
|
|
|
tools.saveFieldToServer(this, 'navi', mianave._id, mydata)
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 22:43:54 +02:00
|
|
|
public getNaveSognatoreStr(mianave) {
|
2020-05-10 21:06:42 +02:00
|
|
|
const mynavedest = tools.getfirstnaveSognatore(mianave.riga, mianave.col)
|
2020-05-11 22:43:54 +02:00
|
|
|
const ris = mynavedest.riga + '.' + mynavedest.col
|
|
|
|
|
// console.log('ris', ris)
|
|
|
|
|
return ris
|
2020-05-10 21:06:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getNaveMediatoreStr(mianave) {
|
|
|
|
|
return mianave.riga + '.' + mianave.col
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-13 01:33:07 +02:00
|
|
|
get getstrinvitati() {
|
2020-05-14 17:23:03 +02:00
|
|
|
if (!!this.dashboard && !!this.dashboard.myself)
|
|
|
|
|
if (!!this.dashboard.myself.numinvitati)
|
|
|
|
|
return this.dashboard.myself.numinvitati + ` ` + this.$t('dashboard.downline')
|
|
|
|
|
|
|
|
|
|
if (this.loading_invitati)
|
2020-05-13 01:33:07 +02:00
|
|
|
return ` (...) ` + this.$t('dashboard.downline')
|
2020-05-14 17:23:03 +02:00
|
|
|
else
|
|
|
|
|
return this.$t('dashboard.downline')
|
2020-05-13 01:33:07 +02:00
|
|
|
}
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
public getmyrigaattuale(mianave) {
|
|
|
|
|
const rigamin = tools.getRiganave(mianave.riga)
|
|
|
|
|
const colmin = tools.getColnave(mianave.col)
|
|
|
|
|
|
2020-05-13 01:33:07 +02:00
|
|
|
let riga = this.myrigaattuale
|
2020-05-14 17:23:03 +02:00
|
|
|
let col = this.mycolattuale
|
|
|
|
|
|
|
|
|
|
let colvera = colmin
|
|
|
|
|
if (rigamin > 3) {
|
|
|
|
|
for (let index = rigamin; index < riga - 1; index++){
|
|
|
|
|
colvera = colvera * 2
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
colvera = 7
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (col <= colvera) {
|
|
|
|
|
riga = riga - 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// console.log('[' + rigamin + '.' + colmin + ']', 'riga', riga, 'col', col, 'colvera', colvera)
|
2020-05-13 01:33:07 +02:00
|
|
|
|
|
|
|
|
if (riga < rigamin)
|
|
|
|
|
riga = rigamin
|
|
|
|
|
if (riga > rigamin + 6)
|
|
|
|
|
riga = rigamin + 6
|
2020-03-10 21:42:30 +01:00
|
|
|
|
2020-05-13 01:33:07 +02:00
|
|
|
return riga
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getval7(mianave) {
|
2020-05-14 17:23:03 +02:00
|
|
|
let val = this.getmyrigaattuale(mianave)
|
2020-05-13 01:33:07 +02:00
|
|
|
return val - tools.getRiganave(mianave.riga) + 1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getcolorbyval(mianave) {
|
|
|
|
|
let val = this.getval7(mianave)
|
|
|
|
|
|
|
|
|
|
if (val === 7)
|
|
|
|
|
return 'purple'
|
|
|
|
|
else if (val === 6)
|
|
|
|
|
return 'indigo'
|
|
|
|
|
else if (val === 5)
|
|
|
|
|
return 'blue'
|
|
|
|
|
else if (val === 4)
|
|
|
|
|
return 'green'
|
|
|
|
|
else if (val === 3)
|
|
|
|
|
return 'yellow'
|
|
|
|
|
else if (val === 2)
|
|
|
|
|
return 'orange'
|
|
|
|
|
else if (val === 1)
|
|
|
|
|
return 'red'
|
|
|
|
|
|
|
|
|
|
return val
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-14 17:23:03 +02:00
|
|
|
public gettextcolor(mianave) {
|
2020-05-13 01:33:07 +02:00
|
|
|
return this.getval7(mianave) === 3 ? 'black' : 'white'
|
|
|
|
|
}
|
2020-05-14 17:23:03 +02:00
|
|
|
|
|
|
|
|
public getifdisableInvitante(imbarco, index) {
|
|
|
|
|
if ((index === 0) && (this.dashboard.arrposizioni.length <= 0)) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
}
|
2020-01-30 01:20:56 +01:00
|
|
|
}
|