From bd6ccad2368af4522826191a852f57d795c48f93 Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Tue, 2 Jun 2020 22:19:20 +0200 Subject: [PATCH] Aggiornamenti Flotta, Nave, Dashboard, Tabelle, Popupmenu --- src/components/CGridTableRec/CGridTableRec.ts | 6 + .../CGridTableRec/CGridTableRec.vue | 3 +- src/components/CMyDashboard/CMyDashboard.ts | 54 ++- src/components/CMyDashboard/CMyDashboard.vue | 66 ++- src/components/CMyEditor/CMyEditor.ts | 16 + src/components/CMyEditor/CMyEditor.vue | 69 +-- .../CMyFlotta/CMyFlotta-validate.ts | 12 + src/components/CMyFlotta/CMyFlotta.scss | 174 ++++++++ src/components/CMyFlotta/CMyFlotta.ts | 166 +++++++ src/components/CMyFlotta/CMyFlotta.vue | 213 +++++++++ src/components/CMyFlotta/index.ts | 1 + src/components/CMyNave/CMyNave.ts | 14 +- src/components/CMyNave/CMyNave.vue | 26 +- src/components/CMyPopupEdit/CMyPopupEdit.ts | 7 + src/components/CMyPopupEdit/CMyPopupEdit.vue | 404 +++++++++--------- src/components/CSigninNoreg/CSigninNoreg.ts | 1 + src/components/CStatus/CStatus.vue | 14 + src/components/index.ts | 1 + 18 files changed, 993 insertions(+), 254 deletions(-) create mode 100755 src/components/CMyFlotta/CMyFlotta-validate.ts create mode 100755 src/components/CMyFlotta/CMyFlotta.scss create mode 100755 src/components/CMyFlotta/CMyFlotta.ts create mode 100755 src/components/CMyFlotta/CMyFlotta.vue create mode 100755 src/components/CMyFlotta/index.ts diff --git a/src/components/CGridTableRec/CGridTableRec.ts b/src/components/CGridTableRec/CGridTableRec.ts index 334b3e5..b623fbc 100755 --- a/src/components/CGridTableRec/CGridTableRec.ts +++ b/src/components/CGridTableRec/CGridTableRec.ts @@ -145,6 +145,12 @@ export default class CGridTableRec extends Vue { this.colsel = col this.idsel = row._id this.SaveValue(newval, valinitial) + + // this.rowclicksel = null + } + + public annulla(val) { + // this.rowclicksel = null } public SaveValue(newVal, valinitial) { diff --git a/src/components/CGridTableRec/CGridTableRec.vue b/src/components/CGridTableRec/CGridTableRec.vue index 2b44be6..2a0601d 100755 --- a/src/components/CGridTableRec/CGridTableRec.vue +++ b/src/components/CGridTableRec/CGridTableRec.vue @@ -185,7 +185,8 @@ :subfield="mycol.subfield" @save="SaveValdb" @show="selItem(rowclicksel, mycol)" - @showandsave="showandsel"> + @showandsave="showandsel" + @annulla="annulla"> diff --git a/src/components/CMyDashboard/CMyDashboard.ts b/src/components/CMyDashboard/CMyDashboard.ts index 3099bae..840aa31 100755 --- a/src/components/CMyDashboard/CMyDashboard.ts +++ b/src/components/CMyDashboard/CMyDashboard.ts @@ -61,6 +61,7 @@ export default class CMyDashboard extends MixinUsers { public ind_order_ingr: number = -1 public myrigaattuale: number = 0 public mycolattuale: number = 0 + public upgrade_graduatorie: boolean = false public dashboard: IDashboard = { myself: DefaultUser, aportador: DefaultUser, @@ -136,6 +137,8 @@ export default class CMyDashboard extends MixinUsers { this.loading = true + this.upgrade_graduatorie = tools.getValDb('UPDATE_GRAD', false, false) + UserStore.actions.getDashboard({ username: this.myusername }) .then((ris) => { this.dashboard = ris @@ -144,7 +147,7 @@ export default class CMyDashboard extends MixinUsers { this.invitante_username = this.dashboard.myself.username this.myrigaattuale = this.dashboard.lastnave.riga - this.mycolattuale = this.dashboard.lastnave.col + this.mycolattuale = this.dashboard.lastnave.col + 8 this.loading = false }) @@ -250,11 +253,13 @@ export default class CMyDashboard extends MixinUsers { } public colordono(mianave) { - if (mianave.made_gift) { + if (mianave.made_gift) return 'green' - } else { + else if (!!mianave.date_made_gift) + return 'blue' + else return 'grey' - } + } public getposizioneattuale(mianave, totali) { @@ -273,7 +278,7 @@ export default class CMyDashboard extends MixinUsers { }) this.shownuovoviaggio = false } - + public addNuovoImbarco() { this.NuovoImbarco(this.dashboard.myself.username, this.invitante_username) } @@ -288,7 +293,15 @@ export default class CMyDashboard extends MixinUsers { public getnuminvperc(index, myrec) { - return myrec.invattivi / 2 * 100 + let val1 = Math.round((myrec.numinvitatiattiviTot - myrec.numNaviEntrato * 2) - (myrec.indimbarco - 1) * 2) + if (val1 < 0) + val1 = 0 + + let valmax = val1; + if (valmax < 2) + valmax = 2 + + return val1 / valmax * 100 } public getcolorinvitati(index, myrec) { @@ -355,7 +368,14 @@ export default class CMyDashboard extends MixinUsers { } public getvalstrinv(posiz) { - return Math.round((posiz.numinvitatiattiviTot - posiz.numNaviEntrato * 2) - (posiz.indimbarco - 1) * 2) + '/' + Math.round((posiz.numinvitatiTot - posiz.numNaviEntrato * 2) - (posiz.indimbarco - 1) * 2) + let val1 = Math.round((posiz.numinvitatiattiviTot - posiz.numNaviEntrato * 2) - (posiz.indimbarco - 1) * 2) + let val2 = Math.round((posiz.numinvitatiTot - posiz.numNaviEntrato * 2) - (posiz.indimbarco - 1) * 2) + if (val1 < 0) + val1 = 0 + if (val2 < 0) + val2 = 0 + + return val1 + '/' + val2 } public isprovvisoria(mianave) { @@ -379,6 +399,14 @@ export default class CMyDashboard extends MixinUsers { tools.saveFieldToServer(this, 'navi', mianave._id, mydata) } + public change_mynote_imbarco(mioimbarco) { + + const mydata = { + note: mioimbarco.note + } + tools.saveFieldToServer(this, 'listaingressos', mioimbarco._id, mydata) + } + public getNaveSognatoreStr(mianave) { const mynavedest = tools.getfirstnaveSognatore(mianave.riga, mianave.col) const ris = mynavedest.riga + '.' + mynavedest.col @@ -440,7 +468,19 @@ export default class CMyDashboard extends MixinUsers { return val - tools.getRiganave(mianave.riga) + 1 } + public getposiz(posiz) { + + if (posiz.posiz === 100000) { + return '-----' + } else { + return posiz.posiz + ' su ' + posiz.totposiz + '°' + } + } + public getcolornave(mianave) { + if (this.isprovvisoria(mianave)) { + return 'grey' + } if (mianave.num_tess % 2 !== 0) return 'blue' else diff --git a/src/components/CMyDashboard/CMyDashboard.vue b/src/components/CMyDashboard/CMyDashboard.vue index 883432d..52d8d17 100755 --- a/src/components/CMyDashboard/CMyDashboard.vue +++ b/src/components/CMyDashboard/CMyDashboard.vue @@ -159,8 +159,15 @@ +
+ + -
+
+ +
-
+
{{ $t('dashboard.posizione') }}
+
+ +
- {{ $t('dashboard.data') }} + {{ $t('dashboard.data_rich') }}
{{ $t('dashboard.invitante') }} @@ -206,12 +216,13 @@ -
-
{{ mioimbarco.posiz.posiz }}° su {{ - mioimbarco.posiz.totposiz }} -
-
+
{{getposiz(mioimbarco.posiz) }}
+
+
+
{{ mioimbarco.navestr }}
+
+
{{ tools.getstrshortDate(mioimbarco.date_added) }}
@@ -247,6 +258,26 @@
+
+ + + + + + + + + + + + +
@@ -339,7 +370,8 @@ icon="fas fa-ship"> {{ $t('dashboard.nave_in_partenza') + ' ' + datagiftchat(mianave) }} - {{ $t('dashboard.nave_in_chiusura') + ' ' + datanave(mianave) }} @@ -417,7 +449,16 @@
+ {{ $t('steps.dono') + ' ' + $t('dashboard.dono_ricevuto_2') }} ! + +
+
+ {{ $t('dashboard.ho_effettuato_il_dono') }} @@ -426,7 +467,7 @@ - + @@ -546,7 +587,8 @@ - diff --git a/src/components/CMyEditor/CMyEditor.ts b/src/components/CMyEditor/CMyEditor.ts index 9389f48..912d847 100755 --- a/src/components/CMyEditor/CMyEditor.ts +++ b/src/components/CMyEditor/CMyEditor.ts @@ -22,6 +22,8 @@ export default class CMyEditor extends Vue { public myvalue = '' public mycolor = '' + public showeditor: boolean = true + public myfonts = { arial: 'Arial', arial_black: 'Arial Black', @@ -98,6 +100,20 @@ export default class CMyEditor extends Vue { this.$emit('update:value', newval) } + public annulla() { + this.$emit('annulla', true) + } + public saveval() { + // Converti i in + + this.myvalue = tools.convertiTagHTMLPerBOT(this.myvalue) + + console.log('saveval', this.myvalue) + this.$emit('showandsave', this.myvalue) + // this.$emit('update:value', this.myvalue) + this.showeditor = false + } + public mounted() { this.myvalue = this.value this.editor = this.$refs.editor_ref diff --git a/src/components/CMyEditor/CMyEditor.vue b/src/components/CMyEditor/CMyEditor.vue index b015e3b..3c065a4 100755 --- a/src/components/CMyEditor/CMyEditor.vue +++ b/src/components/CMyEditor/CMyEditor.vue @@ -1,39 +1,56 @@ diff --git a/src/components/CMyFlotta/CMyFlotta-validate.ts b/src/components/CMyFlotta/CMyFlotta-validate.ts new file mode 100755 index 0000000..528f948 --- /dev/null +++ b/src/components/CMyFlotta/CMyFlotta-validate.ts @@ -0,0 +1,12 @@ +import { ISignupOptions } from 'model' +import { email, minLength, required, sameAs } from 'vuelidate/lib/validators' +// import { ValidationRuleset } from 'vuelidate' +import { aportadorexist } from '../../validation' + +export const validations = { + + username_sostituire: { + aportadorexist, + required + } +} diff --git a/src/components/CMyFlotta/CMyFlotta.scss b/src/components/CMyFlotta/CMyFlotta.scss new file mode 100755 index 0000000..552f0db --- /dev/null +++ b/src/components/CMyFlotta/CMyFlotta.scss @@ -0,0 +1,174 @@ + +.title-nave { + padding: 2px 4px; + margin: 2px 4px; + color: white; + font-size: 1rem; + border-radius: 16px; +} + +.donatore, .mediatore, .sognatore, .intermedio1, .intermedio2, .intermedio4, .intermedio5{ + color: white; + background-color: lightblue; + padding: 1px 2px; + margin: 1px 2px; + font-size: 0.8rem; + border-radius: 32px; + font-weight: bold; + text-transform: uppercase; + max-width: 200px; + margin-left: auto; + margin-right: auto; +} + +.intermedio1{ + background-color: indigo; +} +.intermedio2{ + background-color: blue; +} +.intermedio4{ + background-color: yellow; + color: black; +} +.intermedio5{ + background-color: orange; +} + +.tutor{ + +} + +.selezione:hover { + background-color: yellow; +} + +.donatore { + background-color: red; + text-transform: uppercase; +} + +.mediatore { + background-color: green; + text-transform: uppercase; +} + +.sognatore { + background-color: purple; + text-transform: uppercase; +} + + +.cont_donatore, .cont_sognatore, .cont_mediatore, .cont_tragitto, .cont_pos, .cont_intestaz, .cont_pos_intest, .cont_intestaz_small { + border: solid 2px #4198ef; + padding: 2px 8px; + margin: 2px 4px; + font-size: 1rem; + border-radius: 16px; +} + +.cont_donatore { + justify-content: space-between; +} + +.you { + background-color: yellow; +} +.issognatore { + background-color: orangered; + color: white; + font-size: 1.10rem; + border-radius: 64px; + font-weight: bold; +} + +.cont_tragitto{ + color: blue; +} + +.cont_pos, .cont_pos_intest{ + padding-left: 12px; + padding-right: 12px; + border-radius: 64px !important; + color: red; +} + +.cont_pos_intest { + width: 37px; + font-size: 0.75rem; +} + +.extra{ + opacity: 1; +} + +.passo{ + font-weight: bold; + width: 110px; +} +.passoint{ + width: 100px; +} + +.gift{ + margin: 4px; +} + +.cont_intestaz, .cont_intestaz_small{ + font-size: 0.75rem; + margin: 4px; + border-radius: 16px !important; + +} + +.cont_intestaz_small{ + margin: 0; + margin-top: 4px; + margin-bottom: 4px; +} + +.title-nave { + color: blue; +} + +.titlenave{ + width: 75px; + text-align: center; +} + +.datanave{ + width: 80px; + text-align: center; +} + +.datanave_int{ + width: 60px; + text-align: center; +} + +.dati { + color: blue; + font-size: 1.25rem; + font-weight: bold; +} + +.mancanti { + color: red; + +} +.inviati { + color: blue; +} + +.pan_sognatore { + padding: 0px 0px; +} + +.ricevuti{ + color: green; +} + +.title-nave { + font-size: 1.25rem; + color: blue; +} diff --git a/src/components/CMyFlotta/CMyFlotta.ts b/src/components/CMyFlotta/CMyFlotta.ts new file mode 100755 index 0000000..52a6626 --- /dev/null +++ b/src/components/CMyFlotta/CMyFlotta.ts @@ -0,0 +1,166 @@ +import Vue from 'vue' +import { Component, Prop, Watch } from 'vue-property-decorator' + +import { tools } from '../../store/Modules/tools' +import { toolsext } from '@src/store/Modules/toolsext' +import MixinBase from '@src/mixins/mixin-base' +import MixinNave from '../../mixins/mixin-nave' +import { CTitleBanner } from '../CTitleBanner' +import { GlobalStore, UserStore } from '../../store/Modules' +import { lists } from '../../store/Modules/lists' +import translate from '../../globalroutines/util' +import { CMyChipList } from '../CMyChipList' +import { CVideo } from '../CVideo' +import { validations } from './CMyFlotta-validate' +import { validationMixin } from 'vuelidate' + +@Component({ + mixins: [validationMixin], + validations, + components: { CTitleBanner, CMyChipList, CVideo } +}) + +export default class CMyFlotta extends MixinNave { + @Prop({ required: false, default: null }) public flottaprop + public $t + public $v + public flotta: any = null + public flotta_completa: any = null + public arrdonatori: any[] = [] + public loading: boolean = false + public seluser = null + public showmsguser: boolean = false + public username_sostituire: string = '' + public userfreestr: string = '' + public MyPagination: { + sortBy: string, + descending: boolean, + page: number, + rowsNumber: number, // specifying this determines pagination is server-side + rowsPerPage: number + } = { sortBy: 'index', descending: false, page: 1, rowsNumber: 10, rowsPerPage: 10 } + public colflotte: any[] = [ + { + name: 'index', + required: true, + label: 'Num', + align: 'left', + field: '', + sortable: true + }, + { name: 'flotta', align: 'center', label: 'Flotta', field: 'flotta', sortable: true }, // da 8.1 a 8.8 + { + name: 'date_gift_chat_open', align: 'center', + label: '⏰ Gift Chat', field: 'date_gift_chat_open', sortable: true + }, + { name: 'date_start', align: 'center', label: '⏰ Chiusura', field: 'date_start', sortable: true }, // 4/6/2020 + { name: 'sognatore', align: 'center', label: 'Sognatore', field: 'sognatore_nomecognome', sortable: true }, // Username Sognatore + { name: 'provvisoria', align: 'center', label: 'Temp.', field: 'provvisoria', sortable: true }, // Flotta Provvisoria + // { name: 'tutor', align: 'left', label: 'Tutor', field: 'tutor', sortable: true }, + // { name: 'mediatore', align: 'center', label: '🌀 Mediatore', field: '', sortable: true }, + { name: 'DoniConfermati', align: 'center', label: '🎁 OK', field: 'DoniConfermati', sortable: true }, + { name: 'DoniAttesaDiConferma', align: 'center', label: '🎁 Wait', field: 'DoniAttesaDiConferma', sortable: true }, + { name: 'DoniMancanti', align: 'center', label: '🎁 Miss', field: 'DoniMancanti', sortable: true }, + { name: 'msg_inviato', align: 'center', label: 'Msg Sent', field: 'msg_inviato', sortable: true }, + ] + + public coldonatori: any[] = [ + { + name: 'index', + required: true, + label: 'Num', + align: 'left', + field: 'index', + sortable: true + }, + { name: 'rigacol', align: 'center', label: 'Posizione', field: '', sortable: true }, + { name: 'name', align: 'center', label: 'Nome', field: 'name', sortable: true }, + { name: 'num_tess', align: 'center', label: 'Tessitura', field: 'num_tess', sortable: true }, + { name: 'date_made_gift', align: 'center', label: 'Inviato', field: 'date_made_gift', sortable: true }, + { name: 'made_gift', align: 'center', label: 'Dono', field: 'made_gift', sortable: true }, + ] + + get getcol() { + // if (tools.isMobile()) + // return this.coldonatori_cell + // else + return this.coldonatori + } + + public mounted() { + this.flotta = this.flottaprop + this.aggiorna() + } + + public aggiorna() { + + } + + public getflottastr() { + if (!!this.flotta) + return 'Da ' + this.flotta.riga + '.' + this.flotta.col_prima + ' a ' + this.flotta.riga + '.' + this.flotta.col_ultima + else + return '' + } + + public gettitoloflotta() { + return 'Flotta ' + this.getflottastr() + } + + public getcolorflotta() { + return 'bg-blue' + } + + public async apriflotta() { + + console.log('apriflotta') + + this.loading = true + this.arrdonatori = await GlobalStore.actions.GetFlotta({ riga: this.flotta.riga, col_prima: this.flotta.col_prima, col_ultima: this.flotta.col_ultima }) + + this.aggiorna() + this.loading = false + } + + public getnavestr(row) { + return tools.getRiganave(row.riga) + '.' + tools.getColnave(row.col) + } + + public getlinkchat(row) { + return row.link_superchat + } + + public clickseluser(rec) { + this.seluser = rec + this.showmsguser = true + this.username_sostituire = '' + this.userfreestr = '' + } + get allowSubmit() { + let error = this.$v.$error || this.$v.$invalid + + error = error || (this.username_sostituire === this.seluser.username_sostituire) + + return !error + + } + + public async InviaMsgAFlotta(inviareale) { + + const msgtitle = translate('dialog.sendmsg') + + let msg = 'TEST msg alla Flotta ?'; + + if (inviareale) { + msg = 'Inviare a Tutta la Flotta il messaggio ?' + } + + tools.askConfirm(this.$q, msgtitle, msg , translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.INVIA_MSG_A_FLOTTA, 0, { + param1: this.flotta, + param2: inviareale, + param3: tools.TipoMsg.SEND_MSG_EFFETTUA_IL_DONO + }) + + } + +} diff --git a/src/components/CMyFlotta/CMyFlotta.vue b/src/components/CMyFlotta/CMyFlotta.vue new file mode 100755 index 0000000..8353265 --- /dev/null +++ b/src/components/CMyFlotta/CMyFlotta.vue @@ -0,0 +1,213 @@ + + + + + diff --git a/src/components/CMyFlotta/index.ts b/src/components/CMyFlotta/index.ts new file mode 100755 index 0000000..230313a --- /dev/null +++ b/src/components/CMyFlotta/index.ts @@ -0,0 +1 @@ +export {default as CMyFlotta} from './CMyFlotta.vue' diff --git a/src/components/CMyNave/CMyNave.ts b/src/components/CMyNave/CMyNave.ts index eab6ea2..22654a3 100755 --- a/src/components/CMyNave/CMyNave.ts +++ b/src/components/CMyNave/CMyNave.ts @@ -198,6 +198,14 @@ export default class CMyNave extends MixinNave { } } } + + if (this.sonoDonatore()) { + this.tabnave = 'donatore' + } else if (this.sonoMediatore()) { + this.tabnave = 'mediatore' + } else if (this.sonoSognatore()) { + this.tabnave = 'sognatore' + } } public getListaDonatoriDaConfermare() { @@ -676,7 +684,8 @@ export default class CMyNave extends MixinNave { const navemediatore = { id: this.mediatore._id, riga: this.mediatore.riga, - col: this.mediatore.col + col: this.mediatore.col, + username: this.mediatore.username } this.InviaMsgANave(msgobj, navemediatore) @@ -1076,5 +1085,8 @@ export default class CMyNave extends MixinNave { }) } + get rendivisibile() { + return !this.FattoDono && !this.sonoSecondaTessituraDonatore() && !this.listanavi + } } diff --git a/src/components/CMyNave/CMyNave.vue b/src/components/CMyNave/CMyNave.vue index cd748e8..b509eb3 100755 --- a/src/components/CMyNave/CMyNave.vue +++ b/src/components/CMyNave/CMyNave.vue @@ -1,10 +1,11 @@