From 9094e13c3d23561b8979af22bc66f768af0be557 Mon Sep 17 00:00:00 2001 From: Paolo Arena Date: Sun, 15 Mar 2020 14:08:08 +0100 Subject: [PATCH] - Nave - Requirements - Send Msg to Passeggeri --- src/components/CMyDashboard/CMyDashboard.ts | 1 - src/components/CMyDashboard/CMyDashboard.vue | 2 +- src/components/CMyNave/CMyNave.scss | 35 +++- src/components/CMyNave/CMyNave.ts | 153 ++++++++++++-- src/components/CMyNave/CMyNave.vue | 203 ++++++++++++------- src/rootgen/admin/allnavi/allnavi.scss | 0 src/rootgen/admin/allnavi/allnavi.ts | 32 +++ src/rootgen/admin/allnavi/allnavi.vue | 24 +++ src/statics/i18n.js | 1 + src/statics/lang/it.js | 6 +- src/store/Modules/GlobalStore.ts | 22 ++ src/store/Modules/tools.ts | 14 +- src/views/admin/dbop/dbop.ts | 2 +- src/views/admin/dbop/dbop.vue | 11 + 14 files changed, 395 insertions(+), 111 deletions(-) create mode 100644 src/rootgen/admin/allnavi/allnavi.scss create mode 100644 src/rootgen/admin/allnavi/allnavi.ts create mode 100644 src/rootgen/admin/allnavi/allnavi.vue diff --git a/src/components/CMyDashboard/CMyDashboard.ts b/src/components/CMyDashboard/CMyDashboard.ts index 3d9b0ff..c8f8573 100644 --- a/src/components/CMyDashboard/CMyDashboard.ts +++ b/src/components/CMyDashboard/CMyDashboard.ts @@ -108,5 +108,4 @@ export default class CMyDashboard extends MixinUsers { } - } diff --git a/src/components/CMyDashboard/CMyDashboard.vue b/src/components/CMyDashboard/CMyDashboard.vue index 08e51ed..28b215c 100644 --- a/src/components/CMyDashboard/CMyDashboard.vue +++ b/src/components/CMyDashboard/CMyDashboard.vue @@ -4,7 +4,7 @@ mystyle=" " myclass="myshad">
-
+
diff --git a/src/components/CMyNave/CMyNave.scss b/src/components/CMyNave/CMyNave.scss index d10d180..49b62bf 100644 --- a/src/components/CMyNave/CMyNave.scss +++ b/src/components/CMyNave/CMyNave.scss @@ -1,27 +1,36 @@ -.donatore, .mediatore, .sognatore { - padding: 4px; - margin: 4px; +.donatore, .mediatore, .sognatore, .title-nave, .intermedio2, .intermedio3 { + padding: 2px 4px; + margin: 2px 4px; color: white; - font-size: 1.25rem; + font-size: 1rem; border-radius: 16px; } .donatore { - background-color: #2ba0fd; -} - -.mediatore { background-color: red; } -.sognatore { +.mediatore { background-color: green; } +.sognatore { + background-color: purple; +} + +.intermedio2{ + background-color: orange; +} + +.intermedio3{ + background-color: yellow; + color: black; +} + .cont_donatore, .cont_sognatore, .cont_mediatore, .cont_tragitto, .cont_pos, .cont_intestaz, .cont_pos_intest, .cont_intestaz_small { border: solid 2px #4198ef; - padding: 4px; - margin: 4px; + padding: 2px 8px; + margin: 2px 4px; font-size: 1rem; border-radius: 16px; } @@ -71,3 +80,7 @@ margin-top: 4px; margin-bottom: 4px; } + +.title-nave { + color: blue; +} diff --git a/src/components/CMyNave/CMyNave.ts b/src/components/CMyNave/CMyNave.ts index 0142798..f220f79 100644 --- a/src/components/CMyNave/CMyNave.ts +++ b/src/components/CMyNave/CMyNave.ts @@ -28,6 +28,7 @@ export default class CMyNave extends MixinNave { public rigadoni: number = 1 public coldoni: number = 1 public mediatore: any = {} + public donatore: any = {} public tragitto = [ { @@ -84,6 +85,10 @@ export default class CMyNave extends MixinNave { this.coldoni = tools.getValDb('coldoni', false, 1) this.mediatore = this.getmediatore() + this.donatore = this.getdonatore() + + // console.log('this.mediatore', this.mediatore) + // console.log('this.donatore', this.donatore) if (!!this.mediatore) { this.link_chat = this.mediatore.link_chat @@ -105,7 +110,7 @@ export default class CMyNave extends MixinNave { } public getColnave(col) { - let ris = Math.floor(col / (2 * 4)) + let ris = Math.ceil(col / (2 * 4)) if (ris <= 1) ris = 1 return ris @@ -113,10 +118,10 @@ export default class CMyNave extends MixinNave { public sonoMediatore() { if (!!this.nave) { - if (!!this.nave.rec.donatore.recmediatore) + if (!!this.nave.rec.donatore) return this.nave.rec.donatore.recmediatore.ind_order === this.nave.ind_order else { - if (!!this.nave.rec.mediatore.recmediatore) + if (!!this.nave.rec.mediatore) return this.nave.rec.mediatore.recmediatore.ind_order === this.nave.ind_order } } @@ -124,12 +129,88 @@ export default class CMyNave extends MixinNave { return false } + public partenza_primo_donatore() { + if (!!this.nave) { + if (!!this.nave.rec.mediatore) { + for (const rec of this.nave.rec.mediatore.arrdonatori) { + if (!!rec) + return rec.date_start + } + } + } + return '' + } + + public getGiornoDelDono() { + if (!!this.nave) { + return tools.getstrDate(this.nave.date_start) + } + } + public GiornoDelDonoArrivato() { + if (!!this.nave) { + return tools.isDateArrived(this.nave.date_start) + } + } + + public FattoDono() { + if (!!this.nave) { + if (!!this.nave.rec.donatore) { + for (const rec of this.nave.rec.donatore.arrdonatori) { + if (!!rec) { + if (rec.ind_order === this.nave.ind_order) + return rec.made_gift + } + } + } + } + return false + } + + public sognatoredelDono() { + if (!!this.nave) { + if (!!this.nave.rec.recsognatori) + return this.nave.rec.recsognatori[0] + } + return null + } + + public getMetodoPagamentoSognatore() { + const rec = this.sognatoredelDono() + if (!!rec) { + return rec.profile.paymenttypes + } + } + + public getemailPagamentoSognatore() { + const rec = this.sognatoredelDono() + if (!!rec) { + return rec.profile.email_paypal + } + } + + public DonoInviato() { + if (!!this.nave) { + if (!!this.nave.rec.donatore) { + for (const rec of this.nave.rec.donatore.arrdonatori) { + if (!!rec) { + if (rec.ind_order === this.nave.ind_order) + return !!rec.date_made_gift + } + } + } + } + + return null + } + public sonoDonatore() { if (!!this.nave) { - for (const rec of this.nave.rec.donatore.arrdonatori) { - if (!!rec) { - if (rec.ind_order === this.nave.ind_order) - return true + if (!!this.nave.rec.donatore) { + for (const rec of this.nave.rec.donatore.arrdonatori) { + if (!!rec) { + if (rec.ind_order === this.nave.ind_order) + return true + } } } } @@ -137,27 +218,37 @@ export default class CMyNave extends MixinNave { } public getmediatore() { - return this.nave.rec.donatore.recmediatore + if (!!this.nave.rec.mediatore) + return this.nave.rec.mediatore.recmediatore + return null + } + + public getdonatore() { + if (!!this.nave.rec.donatore) + return this.nave.rec.donatore.recmediatore + return null } public change_link_chat() { const recmed = this.getmediatore() - if (recmed.link_chat !== this.link_chat) { - recmed.link_chat = this.link_chat + if (!!recmed) { + if (recmed.link_chat !== this.link_chat) { + recmed.link_chat = this.link_chat - const mydata = { - link_chat: recmed.link_chat + const mydata = { + link_chat: recmed.link_chat + } + tools.saveFieldToServer(this, 'navi', recmed._id, mydata) } - tools.saveFieldToServer(this, 'navi', recmed._id, mydata) } } get linkchatopen() { - return this.link_chat + return this.donatore.link_chat } public sonoSognatore() { - return this.nave.rec.donatore.recsognatore.ind_order === this.nave.ind_order + // return this.nave.rec.donatore.recsognatore.ind_order === this.nave.ind_order } public getclassSelect(rec) { @@ -213,18 +304,20 @@ export default class CMyNave extends MixinNave { public async InviaMsgANave(msgobj, navemediatore) { let msgtitle = translate('dashboard.controlla_donatori') + let msginvia = msgtitle if (msgobj.inviareale) { msgtitle = translate('dashboard.invia_link_chat') + msginvia = translate('dashboard.inviare_msg_donatori') } - await tools.askConfirm(this.$q, msgtitle, translate('dashboard.inviare_msg_donatori') + ' ' + '?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.INVIA_MSG_A_DONATORI, 0, { + tools.askConfirm(this.$q, msgtitle, msginvia + ' ' + '?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.INVIA_MSG_A_DONATORI, 0, { param1: msgobj, param2: navemediatore }) } - public async InviaMsgADonatori(msgobj) { + public InviaMsgADonatori(msgobj) { const navemediatore = { id: this.mediatore._id, @@ -236,8 +329,8 @@ export default class CMyNave extends MixinNave { } get linkchatesiste() { - if (!!this.linkchatopen) - return this.linkchatopen.length > 10 + if (!!this.link_chat) + return this.link_chat.length > 10 return false } @@ -245,11 +338,31 @@ export default class CMyNave extends MixinNave { const msgobj = { tipomsg: tools.TipoMsg.SEND_LINK_CHAT_DONATORI, - msgpar1: this.linkchatopen, + msgpar1: this.link_chat, inviareale, } this.InviaMsgADonatori(msgobj) } + public getdatastr(mydata) { + return tools.getstrshortDate(mydata) + } + + public gettitlemediatore() { + return this.getdatastr(this.partenza_primo_donatore()) + ' ' + 'NAVE' + ' ' + this.mediatore.riga + '.' + this.mediatore.col + ' ' + '🎁' + 'AYNI' + } + + public gettitledonatore() { + return this.getdatastr(this.donatore.date_start) + ' ' + 'NAVE' + ' ' + this.donatore.riga + '.' + this.donatore.col + ' ' + '🎁' + 'AYNI' + } + + public gettesto() { + return this.$t('dashboard.sonomediatore', { nomenave: this.gettitlemediatore() }) + } + + public getposizione() { + return this.$t('dashboard.posizione') + ' ' + this.nave.riga + '.' + this.nave.col + } + } diff --git a/src/components/CMyNave/CMyNave.vue b/src/components/CMyNave/CMyNave.vue index e1a815d..a739e77 100644 --- a/src/components/CMyNave/CMyNave.vue +++ b/src/components/CMyNave/CMyNave.vue @@ -24,45 +24,12 @@ - - - -
-
- - - - - -
-
- - - - -
-
- -
-
-
-
-
- -
+ {{getposizione()}}
N
@@ -99,6 +66,56 @@
+ + + +
{{gettitledonatore()}}
+ +
+
+
+
SOGNATORI:
+
+
+ A{{3 - index}} - {{ sognatore.name }} {{ sognatore.surname }} ({{sognatore.username }}) +
+
+
+
MEDIATORE:
+
+ {{ nave.rec.donatore.recmediatore.name }} {{ nave.rec.donatore.recmediatore.surname }} ({{ + nave.rec.donatore.recmediatore.username }}) +
+
+
+
INTERMEDIO3:
+
+
+ B{{index + 1}} - {{ terra.name }} {{ terra.surname }} ({{ terra.username }}) - {{ + terra.riga}}.{{terra.col}}
+
+
+
+
+
INTERMEDIO2:
+
+
+ C{{index + 1}} - {{ aria.name }} {{ aria.surname }} ({{ aria.username }}) - {{ + aria.riga}}.{{aria.col}}
+
+
+
+
DONATORI:
+
+
+ D{{index + 1}} - {{ donatore.name }} {{ donatore.surname }} ({{ donatore.username }}) - {{ + donatore.riga}}.{{donatore.col}}
+
+
+
+
+
+
Per entrare nella Gift Chat, clicca qui:
@@ -110,28 +127,25 @@
- - +
+
+
-
-
SOGNATORI:
-
-
- A{{3 - index}} - {{ sognatore.name }} {{ sognatore.surname }} ({{sognatore.username }}) + {{ sognatoredelDono() }} + + Quando effettuare il Regalo: {{ getGiornoDelDono() }}
+ Metodo Utilizzato: {{ getMetodoPagamentoSognatore() }}
+ +
+
+ E' arrivato il momento di Effettuare il proprio Dono di 33€:
+ tramite {{ getMetodoPagamentoSognatore() }}
+ Inviarlo a: {{ getemailPagamentoSognatore() }} + +
-
-
-
MEDIATORE:
-
- {{ nave.rec.donatore.recmediatore.name }} {{ nave.rec.donatore.recmediatore.surname }} ({{ - nave.rec.donatore.recmediatore.username }}) -
-
-
DONATORI:
-
-
- D{{index + 1}} - {{ donatore.name }} {{ donatore.surname }} ({{ donatore.username }}) {{ - donatore.riga}}.{{donatore.col}}
+
+ Il tuo Dono è stato Ricevuto Correttamente.
@@ -139,26 +153,71 @@ -
-
SOGNATORI:
-
-
- A{{3 - index}} - {{ sognatore.name }} {{ sognatore.surname }} ({{sognatore.username }}) +
{{gettitlemediatore()}}
+ +
+
+
SOGNATORI:
+
+
+ A{{3 - index}} - {{ sognatore.name }} {{ sognatore.surname }} ({{sognatore.username }}) +
+
+
+
MEDIATORE:
+
+ {{ nave.rec.mediatore.recmediatore.name }} {{ nave.rec.mediatore.recmediatore.surname }} ({{ + nave.rec.mediatore.recmediatore.username }}) +
+
+
+
INTERMEDIO3:
+
+
+ B{{index + 1}} - {{ terra.name }} {{ terra.surname }} ({{ terra.username }}) - {{ + terra.riga}}.{{terra.col}}
+
+
+
+
+
INTERMEDIO2:
+
+
+ C{{index + 1}} - {{ aria.name }} {{ aria.surname }} ({{ aria.username }}) - {{ + aria.riga}}.{{aria.col}}
+
+
+
+
DONATORI:
+
+
+ D{{index + 1}} - {{ donatore.name }} {{ donatore.surname }} ({{ donatore.username }}) - {{ + donatore.riga}}.{{donatore.col}}
+
-
-
MEDIATORE:
-
- {{ nave.rec.mediatore.recmediatore.name }} {{ nave.rec.mediatore.recmediatore.surname }} ({{ - nave.rec.mediatore.recmediatore.username }}) -
-
-
DONATORI:
-
-
- D{{index + 1}} - {{ donatore.name }} {{ donatore.surname }} ({{ donatore.username }}) {{ - donatore.riga}}.{{donatore.col}}
-
+
+ +
+
+ + + + + +
+ + + +
diff --git a/src/rootgen/admin/allnavi/allnavi.scss b/src/rootgen/admin/allnavi/allnavi.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/rootgen/admin/allnavi/allnavi.ts b/src/rootgen/admin/allnavi/allnavi.ts new file mode 100644 index 0000000..792c6ca --- /dev/null +++ b/src/rootgen/admin/allnavi/allnavi.ts @@ -0,0 +1,32 @@ +import Vue from 'vue' +import { Component, Watch } from 'vue-property-decorator' +import { tools } from '@src/store/Modules/tools' +import { func_tools } from 'store/Modules/toolsext' +import { CalendarStore, GlobalStore, UserStore } from '@store' +import { CGridTableRec, CMyFieldDb, CTitleBanner } from '@components' +import { colnewstosent, coltemplemail, colopzemail, colmailinglist } from '@src/store/Modules/fieldsTable' +import { DefaultNewsState, INewsState } from '@src/model/index' +import translate from '../../../globalroutines/util' +import { getCookie } from 'utils/auth' +import { CTitle } from '../../../components/CTitle' +import { CMyPage } from '../../../components/CMyPage' +import MixinBase from '../../../mixins/mixin-base' +import { CMyNave } from '../../../components/CMyNave' + +const namespace = 'CalendarModule' + +@Component({ + components: { CTitle, CTitleBanner, CMyNave }, + mixins: [] +}) +export default class Allnavi extends MixinBase { + public $t: any + public $q + public myloadingload: boolean = false + public ris = {} + + public async mounted() { + this.ris = await GlobalStore.actions.GetArrNavi() + } + +} diff --git a/src/rootgen/admin/allnavi/allnavi.vue b/src/rootgen/admin/allnavi/allnavi.vue new file mode 100644 index 0000000..f1ac61a --- /dev/null +++ b/src/rootgen/admin/allnavi/allnavi.vue @@ -0,0 +1,24 @@ + + + diff --git a/src/statics/i18n.js b/src/statics/i18n.js index 48dff56..47b1c38 100644 --- a/src/statics/i18n.js +++ b/src/statics/i18n.js @@ -48,3 +48,4 @@ const messages = { }; export default messages; + diff --git a/src/statics/lang/it.js b/src/statics/lang/it.js index f05dd03..bd11cd7 100644 --- a/src/statics/lang/it.js +++ b/src/statics/lang/it.js @@ -30,6 +30,7 @@ const msg_it = { extralist: 'Lista Extra', dbop: 'Db Operations', tableslist: 'Lista Tabelle', + navi: 'Navi', newsletter: 'Newsletter', pages: 'Pagine', media: 'Media', @@ -207,10 +208,10 @@ const msg_it = { nave_in_partenza: 'in Partenza il', sonomediatore: 'Quando diventi Meditore vieni contattato da un TUTOR, con lui devi:
    ' + '
  1. Aprire la tua Gift Chat (tu come proprietario e il Tutor ' + - 'come amministratore) con questo nome: gg/mm - NAVE numero.numero 🎁AYNI
    (Esempio: 10/03 - NAVE 2.1 🎁 AYNI)
  2. ' + + 'come amministratore) con questo nome: {nomenave}' + '
  3. Clicca sul nome della chat in alto -> Modifica -> Amministratori -> "Aggiungi Amministratore", seleziona il Tutor nell’elenco.
  4. ' + '
  5. Devi configurare la chat in modo che chi entra vede anche i post precedenti (clicca sul nome della chat in alto, clicca su modifica, ' + - 'cambia la "cronologia per i nuovi membri" da nascosta a visibile
  6. ' + + 'cambia la "cronologia per i nuovi membri" da nascosta a visibile.' + '
  7. Per trovare il link della Chat appena creata: clicca sul nome della chat in alto, clicca sulla Matita -> "Tipo di Gruppo" -> "invita nel gruppo tramite link", clicca su "copia link" e incollalo qui sotto, sulla casella "Link Gift Chat"
  8. ' + '
  9. Invia il Link della Gift Chat a tutti i Donatori, cliccando sul bottone qui sotto.
', sonosognatore: '
  1. Quando sei in questa posizione, verrai invitato ad entrare in una Gift Chat (Telegram) e qui troverai anche gli altri 7 Donatori, il Mediatore, il Sognatore e un rappresentante dello Staff.
  2. ' + @@ -229,6 +230,7 @@ const msg_it = { invia_link_chat: 'Invia il Link della Gift Chat ai Donatori', inviare_msg_donatori: '5) Inviare messaggio ai Donatori', msg_donatori_ok: 'Inviato messaggio ai Donatori', + posizione: 'Posizione', }, reg: { registered: 'Registrato', diff --git a/src/store/Modules/GlobalStore.ts b/src/store/Modules/GlobalStore.ts index f5d7145..e0d84e1 100644 --- a/src/store/Modules/GlobalStore.ts +++ b/src/store/Modules/GlobalStore.ts @@ -808,6 +808,27 @@ namespace Actions { return null }) } + async function GetArrNavi(context) { + console.log('GetArrNavi') + + const mydata = { + idapp: process.env.APP_ID + } + + return await Api.SendReq('/dashboard/getnavi', 'POST', mydata) + .then((res) => { + if (res.status === 200) { + if (res.data.code === serv_constants.RIS_CODE_OK) { + return res.data.ris + } + } + return null + }) + .catch((error) => { + console.error(error) + return null + }) + } async function loadSite(context) { // console.log('CalendarStore: loadAfterLogin') @@ -958,6 +979,7 @@ namespace Actions { sendEmailTest: b.dispatch(sendEmailTest), DuplicateRec: b.dispatch(DuplicateRec), InviaMsgADonatori: b.dispatch(InviaMsgADonatori), + GetArrNavi: b.dispatch(GetArrNavi), addDynamicPages: b.dispatch(addDynamicPages) } diff --git a/src/store/Modules/tools.ts b/src/store/Modules/tools.ts index 6f6cce9..d3c2e0d 100644 --- a/src/store/Modules/tools.ts +++ b/src/store/Modules/tools.ts @@ -1502,7 +1502,8 @@ export const tools = { // console.log('param1', par.param1) GlobalStore.actions.InviaMsgADonatori({ msgobj: par.param1, navemediatore: par.param2 }).then((ris) => { if (ris) { - tools.showPositiveNotif(myself.$q, myself.$t('dashboard.msg_donatori_ok')) + if (par.param1.inviareale) + tools.showPositiveNotif(myself.$q, myself.$t('dashboard.msg_donatori_ok')) tools.askConfirm(myself.$q, '', ris.strout, translate('dialog.yes'), translate('dialog.no'), this, '', 0, 0, {}) } else tools.showNegativeNotif(myself.$q, myself.$t('db.recfailed')) @@ -2091,14 +2092,21 @@ export const tools = { } catch (e) { return value } - } - , + }, getDateNow() { const mydate = new Date() return mydate }, + isDateArrived(mydate) { + const datenow = tools.getDateNow() + if (date.getDateDiff(mydate, datenow) >= 0) { + return true + } + return false + }, + getDayOfWeek(date) { const dayOfWeek = new Date(date).getDay() diff --git a/src/views/admin/dbop/dbop.ts b/src/views/admin/dbop/dbop.ts index 6d92a3a..5818376 100644 --- a/src/views/admin/dbop/dbop.ts +++ b/src/views/admin/dbop/dbop.ts @@ -61,7 +61,7 @@ export default class Dbop extends Vue { if (miafunz === 'visuPlacca') { this.placca = ris.placca - } else if (miafunz === 'visuListaIngresso' || miafunz === 'visuListaNave' || miafunz === 'visuNave' || miafunz === 'creaNave') { + } else if (miafunz === 'visuListaIngresso' || miafunz === 'visuListaIngressoNew' || miafunz === 'visuListaNave' || miafunz === 'visuNave' || miafunz === 'creaNave') { this.placca = ris.mystr } else { this.ris = ris diff --git a/src/views/admin/dbop/dbop.vue b/src/views/admin/dbop/dbop.vue index fe8357c..fe17b10 100644 --- a/src/views/admin/dbop/dbop.vue +++ b/src/views/admin/dbop/dbop.vue @@ -23,12 +23,17 @@
+

+
+
+
+
+
+


+
+
+