From d2bf9eb202441534bb8ca59d905d4303274f0b77 Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Thu, 14 May 2020 17:23:03 +0200 Subject: [PATCH] Ultimo aggiornamento Nuova versione del Sito ! --- src/components/CMyDashboard/CMyDashboard.ts | 156 +++- src/components/CMyDashboard/CMyDashboard.vue | 107 ++- .../CMyRequirement/CMyRequirement.ts | 29 +- src/components/CRequisiti/CRequisiti.vue | 2 +- src/components/CStatus/CStatus.ts | 6 +- src/components/CStatus/CStatus.vue | 775 +++++++++--------- src/components/CUserBadge/CUserBadge.ts | 22 +- src/components/CUserBadge/CUserBadge.vue | 4 +- src/model/UserStore.ts | 10 +- src/statics/lang/de.js | 4 + src/statics/lang/enUs.js | 12 +- src/statics/lang/es.js | 18 +- src/statics/lang/fr.js | 14 +- src/statics/lang/it.js | 15 +- src/statics/lang/pt.js | 18 +- src/statics/lang/si.js | 16 +- src/store/Modules/UserStore.ts | 24 +- src/store/Modules/fieldsTable.ts | 7 +- src/store/Modules/tools.ts | 3 +- src/views/admin/dbop/dbop.vue | 11 +- 20 files changed, 740 insertions(+), 513 deletions(-) diff --git a/src/components/CMyDashboard/CMyDashboard.ts b/src/components/CMyDashboard/CMyDashboard.ts index 5b6240c..31c20ce 100755 --- a/src/components/CMyDashboard/CMyDashboard.ts +++ b/src/components/CMyDashboard/CMyDashboard.ts @@ -10,7 +10,7 @@ import { CMyFieldDb } from '../CMyFieldDb' import { CCopyBtn } from '../CCopyBtn' import { CUserBadge } from '../CUserBadge' import { CLegenda } from '../CLegenda' -import { IDashboard, IUserProfile } from '../../model' +import { IDashboard, IDownline, IUserProfile } from '../../model' import { IUserFields } from '../../model/UserStore' import { CRequisito } from '../CRequisito' import translate from '../../globalroutines/util' @@ -52,6 +52,7 @@ export default class CMyDashboard extends MixinUsers { public shownuovoviaggio: boolean = false public notifBot: boolean = true public loading: boolean = false + public loading_invitati: boolean = false public seluser: IUserFields = null public aportador_solidario: string = '' public invitante_username: string = '' @@ -64,9 +65,6 @@ export default class CMyDashboard extends MixinUsers { myself: DefaultUser, aportador: DefaultUser, numpeople_aportador: 0, - downline: [], - downnotreg: [], - downbyuser: [], arrimbarchi: [], arrposizioni: [], navi_partenza: [], @@ -74,6 +72,12 @@ export default class CMyDashboard extends MixinUsers { arrusers: [], } + public downline: IDownline = { + downline: [], + downnotreg: [], + downbyuser: [] + } + @Prop({ required: true }) public username @Watch('UserStore.state.my.dashboard') @@ -98,6 +102,15 @@ export default class CMyDashboard extends MixinUsers { public changetab(val) { tools.setCookie(tools.TABBED_DASHBOARD, val) + 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 + }) + } + } // console.log('setcook', val) } @@ -123,21 +136,36 @@ export default class CMyDashboard extends MixinUsers { this.loading = true - await UserStore.actions.getDashboard({ username: this.myusername }).then((ris) => { - this.dashboard = ris + UserStore.actions.getDashboard({ username: this.myusername }) + .then((ris) => { + this.dashboard = ris - if (!!this.dashboard) - this.invitante_username = this.dashboard.myself.username + if (!!this.dashboard) + this.invitante_username = this.dashboard.myself.username - this.myrigaattuale = this.dashboard.lastnave.riga - this.mycolattuale = this.dashboard.lastnave.col + this.myrigaattuale = this.dashboard.lastnave.riga + this.mycolattuale = this.dashboard.lastnave.col - // console.log('this.invitante_username', this.invitante_username) - this.loading = false - }) + 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 + }) + + } this.showuserinfo = false - this.loading = false } get getRefLink() { @@ -145,34 +173,42 @@ export default class CMyDashboard extends MixinUsers { } get invitatinotreg() { - if (this.dashboard) - if (this.dashboard.downnotreg) - return this.dashboard.downnotreg.length > 0 + if (this.downline) + if (this.downline.downnotreg) + return this.downline.downnotreg.length > 0 return false } - public selectclick(user, showregalainv, ind_order_ingr, id_listaingr) { - this.showuserinfo = true - this.seluser = user - this.showregalainv = showregalainv - this.ind_order_ingr = ind_order_ingr - this.id_listaingr = id_listaingr + 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 + } } get Completato7Req() { // return tools.Is7ReqOk(this.dashboard.myself) - return this.dashboard.myself.qualified + if (!!this.dashboard.myself) + return this.dashboard.myself.qualified + + return false } get Completato9Req() { // return tools.Is9ReqOk(this.dashboard.myself) - if (!!this.dashboard) + if (!!this.dashboard.myself) return this.dashboard.myself.qualified && (this.dashboard.myself.numinvitatiattivi >= 2) return false } - public HasNave() { - return this.dashboard.arrposizioni.length > 0 + get HasNave() { + if (!!this.dashboard.arrposizioni) + return this.dashboard.arrposizioni.length > 0 + else + return false } public getnavePartenzaByRigaCol(riga, col) { @@ -187,10 +223,19 @@ export default class CMyDashboard extends MixinUsers { } public datanave(mianave) { + // 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) { // const mynavepart = this.getnavePartenzaByRigaCol(tools.getRiganave(mianave.riga), tools.getColnave(mianave.col)) if (!!mianave.nave_partenza) { if (!!mianave.nave_partenza.date_gift_chat_open) - return tools.getstrshortDate(mianave.nave_partenza.date_gift_chat_open) + return tools.getstrDate(mianave.nave_partenza.date_gift_chat_open) } return ' --/-- ' } @@ -223,7 +268,7 @@ export default class CMyDashboard extends MixinUsers { public async NuovoImbarco(username, invitante_username) { - 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, { + 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, { param1: { username, invitante_username } }) this.shownuovoviaggio = false @@ -234,7 +279,7 @@ export default class CMyDashboard extends MixinUsers { } public async cancellaImbarco(imbarco) { - 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, { + 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, { param1: { ind_order: imbarco.ind_order, username: imbarco.username }, param2: { num_tess: imbarco.num_tess } }) @@ -258,7 +303,7 @@ export default class CMyDashboard extends MixinUsers { if (invattivi > 2) invattivi = 2 - return invattivi + '/' + inv + return invattivi + '/' + inv } public getinvit(index, myuser, posiz) { @@ -281,21 +326,25 @@ export default class CMyDashboard extends MixinUsers { return { invattivi, inv } } + public getnuminv(index, myuser, posiz) { const ris = this.getinvit(index, myuser, posiz) return ris.inv } + public getnuminvattivi(index, myuser, posiz) { const ris = this.getinvit(index, myuser, posiz) return ris.invattivi } + public getnuminvperc(index, myuser, posiz) { const ris = this.getinvit(index, myuser, posiz) return ris.invattivi / 2 * 100 } + public getcolorinvitati(index, myuser, posiz) { const ris = this.getinvit(index, myuser, posiz) @@ -352,7 +401,7 @@ export default class CMyDashboard extends MixinUsers { } public imbarchipresenti() { - let presente = false; + let presente = false for (const rec of this.dashboard.arrimbarchi) { if (!rec.added) presente = true @@ -393,14 +442,37 @@ export default class CMyDashboard extends MixinUsers { } get getstrinvitati() { - if (this.dashboard.myself.numinvitati) - return this.dashboard.myself.numinvitati + ` ` + this.$t('dashboard.downline') - else + if (!!this.dashboard && !!this.dashboard.myself) + if (!!this.dashboard.myself.numinvitati) + return this.dashboard.myself.numinvitati + ` ` + this.$t('dashboard.downline') + + if (this.loading_invitati) return ` (...) ` + this.$t('dashboard.downline') + else + return this.$t('dashboard.downline') } - public getmyrigaattuale(rigamin) { + public getmyrigaattuale(mianave) { + const rigamin = tools.getRiganave(mianave.riga) + const colmin = tools.getColnave(mianave.col) + let riga = this.myrigaattuale + 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) if (riga < rigamin) riga = rigamin @@ -411,7 +483,7 @@ export default class CMyDashboard extends MixinUsers { } public getval7(mianave) { - let val = this.getmyrigaattuale(tools.getRiganave(mianave.riga)) + let val = this.getmyrigaattuale(mianave) return val - tools.getRiganave(mianave.riga) + 1 } @@ -436,7 +508,15 @@ export default class CMyDashboard extends MixinUsers { return val } - gettextcolor(mianave) { + public gettextcolor(mianave) { return this.getval7(mianave) === 3 ? 'black' : 'white' } + + public getifdisableInvitante(imbarco, index) { + if ((index === 0) && (this.dashboard.arrposizioni.length <= 0)) { + return true + } + return false + + } } diff --git a/src/components/CMyDashboard/CMyDashboard.vue b/src/components/CMyDashboard/CMyDashboard.vue index 75f59b5..405f8ec 100755 --- a/src/components/CMyDashboard/CMyDashboard.vue +++ b/src/components/CMyDashboard/CMyDashboard.vue @@ -16,28 +16,34 @@ -
- -
- -
- - - - +
+
+
+
+ + + + + +
+
+ + + + @@ -52,34 +58,33 @@ - - - -
+
+ +
+ + +
-
@@ -89,7 +94,9 @@
- {{ $t('dashboard.nessun_invitato')}} +
+ {{ $t('dashboard.nessun_invitato')}} +
@@ -148,20 +155,24 @@ +
+ +
+
-
+
{{ $t('dashboard.downline') }}
-
- {{ $t('reg.elimina') }} + {{ $t('dialog.delete') }}
@@ -206,7 +214,7 @@ :ind_order_ingr="mioimbarco.ind_order" :id_listaingr="mioimbarco._id" :index="index" - :numpeople="0" + :mydisabled="getifdisableInvitante(mioimbarco, index)" @myclick="selectclick">
@@ -253,7 +261,7 @@
-
+
@@ -282,7 +290,7 @@ + + +
@@ -306,7 +317,7 @@
@@ -317,14 +328,17 @@
- -   - {{ $t('dashboard.nave_in_partenza') + ' ' + datanave(mianave) }} + {{ $t('dashboard.nave_in_partenza') + ' ' + datagiftchat(mianave) }} + + + {{ $t('dashboard.nave_in_chiusura') + ' ' + datanave(mianave) }}
-
+
@@ -368,7 +382,7 @@ + + + @@ -420,6 +437,22 @@ + + + + + + + + + + + +
@@ -461,7 +494,7 @@
-
+

UTENTE CANCELLATO (Nascosto: true) !

@@ -507,7 +540,7 @@ diff --git a/src/components/CMyRequirement/CMyRequirement.ts b/src/components/CMyRequirement/CMyRequirement.ts index f4f6562..3fed5fe 100755 --- a/src/components/CMyRequirement/CMyRequirement.ts +++ b/src/components/CMyRequirement/CMyRequirement.ts @@ -10,7 +10,7 @@ import { CMyFieldDb } from '../CMyFieldDb' import { CCopyBtn } from '../CCopyBtn' import { CUserBadge } from '../CUserBadge' import { CLegenda } from '../CLegenda' -import { IDashboard, IUserProfile } from '../../model' +import { IDashboard, IDownline, IUserProfile } from '../../model' import { IUserFields } from '../../model/UserStore' import { CRequisito } from '../CRequisito' import translate from '../../globalroutines/util' @@ -31,6 +31,7 @@ export default class CMyRequirement extends MixinUsers { @Prop({ required: false, default: -1 }) public ind_order_ingr: number @Prop({ required: false, default: -1 }) public id_listaingr: number @Prop({ required: true }) public mydashboard + @Prop({ required: true }) public mydownline @Prop({ required: false, default: false }) public notitle @Prop({ required: false, default: false }) public showregalainv public $t @@ -42,7 +43,10 @@ export default class CMyRequirement extends MixinUsers { public dashboard: IDashboard = { myself: DefaultUser, aportador: DefaultUser, - numpeople_aportador: 0, + numpeople_aportador: 0 + } + + public downline: IDownline = { downline: [], downnotreg: [], downbyuser: [] @@ -54,6 +58,12 @@ export default class CMyRequirement extends MixinUsers { this.dashboard = this.mydashboard } + @Watch('mydownline') + public changedl() { + console.log('changedl') + this.downline = this.mydownline + } + @Watch('myusersel') public changemyusersel() { console.log('myseluser') @@ -211,6 +221,7 @@ export default class CMyRequirement extends MixinUsers { public created() { this.dashboard = this.mydashboard + this.downline = this.mydownline this.seluser = this.myseluser } @@ -219,8 +230,14 @@ export default class CMyRequirement extends MixinUsers { await UserStore.actions.getDashboard({ username: this.dashboard.myself.username }).then((ris) => { this.dashboard = ris - this.$emit('aggiorna') + + UserStore.actions.getDownline({ username: this.dashboard.myself.username }).then((ris2) => { + this.downline = ris2 + this.$emit('aggiorna') + }) + }) + } public isextralist(user) { @@ -232,7 +249,7 @@ export default class CMyRequirement extends MixinUsers { } public ismydownline(user) { - return this.dashboard.downline.find((rec) => rec.username === user.username) + return this.downline.downline.find((rec) => rec.username === user.username) } public async deleteUserFromExtraList(user) { @@ -305,7 +322,9 @@ export default class CMyRequirement extends MixinUsers { get allowSubmit() { let error = this.$v.$error || this.$v.$invalid - error = error || (this.aportador_solidario === this.seluser.aportador_solidario) + if (!this.showregalainv) { + error = error || (this.aportador_solidario === this.seluser.aportador_solidario) + } return !error diff --git a/src/components/CRequisiti/CRequisiti.vue b/src/components/CRequisiti/CRequisiti.vue index 9ce62a4..3a5075e 100755 --- a/src/components/CRequisiti/CRequisiti.vue +++ b/src/components/CRequisiti/CRequisiti.vue @@ -1,6 +1,6 @@