- Nave
- Requirements - Send Msg to Passeggeri
This commit is contained in:
73
src/components/CMyNave/CMyNave.scss
Normal file
73
src/components/CMyNave/CMyNave.scss
Normal file
@@ -0,0 +1,73 @@
|
||||
.donatore, .mediatore, .sognatore {
|
||||
padding: 4px;
|
||||
margin: 4px;
|
||||
color: white;
|
||||
font-size: 1.25rem;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.donatore {
|
||||
background-color: #2ba0fd;
|
||||
}
|
||||
|
||||
.mediatore {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.sognatore {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
.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;
|
||||
font-size: 1rem;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.you {
|
||||
background-color: yellow;
|
||||
}
|
||||
|
||||
.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: 0.6;
|
||||
}
|
||||
|
||||
.passo{
|
||||
font-weight: bold;
|
||||
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;
|
||||
}
|
||||
255
src/components/CMyNave/CMyNave.ts
Normal file
255
src/components/CMyNave/CMyNave.ts
Normal file
@@ -0,0 +1,255 @@
|
||||
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 { UserStore } from '../../store/Modules'
|
||||
import { lists } from '../../store/Modules/lists'
|
||||
import translate from '../../globalroutines/util'
|
||||
|
||||
@Component({
|
||||
components: { CTitleBanner },
|
||||
})
|
||||
|
||||
export default class CMyNave extends MixinNave {
|
||||
@Prop({ required: true }) public naveprop
|
||||
@Prop({ required: true }) public navi_partenzaprop: any[]
|
||||
public navi_partenza: any[]
|
||||
public $t
|
||||
public link_chat: string = ''
|
||||
public cosa: string = 'tragitto'
|
||||
public nave: any = null
|
||||
public numpercorso = 7
|
||||
public riga: number = 1
|
||||
public col: number = 1
|
||||
public rigadoni: number = 1
|
||||
public coldoni: number = 1
|
||||
public mediatore: any = {}
|
||||
|
||||
public tragitto = [
|
||||
{
|
||||
ind: 7,
|
||||
color: 'purple',
|
||||
title_lang: 'dashboard.sognatore',
|
||||
extracl: ''
|
||||
},
|
||||
{
|
||||
ind: 6,
|
||||
color: 'indigo',
|
||||
title_lang: 'dashboard.pos6',
|
||||
extracl: 'extra'
|
||||
},
|
||||
{
|
||||
ind: 5,
|
||||
color: 'blue',
|
||||
title_lang: 'dashboard.pos5',
|
||||
extracl: 'extra'
|
||||
},
|
||||
{
|
||||
ind: 4,
|
||||
color: 'green',
|
||||
title_lang: 'dashboard.mediatore',
|
||||
extracl: ''
|
||||
},
|
||||
{
|
||||
ind: 3,
|
||||
color: 'yellow',
|
||||
title_lang: 'dashboard.pos3',
|
||||
extracl: 'extra'
|
||||
},
|
||||
{
|
||||
ind: 2,
|
||||
color: 'orange',
|
||||
title_lang: 'dashboard.pos2',
|
||||
extracl: 'extra'
|
||||
},
|
||||
{
|
||||
ind: 1,
|
||||
color: 'red',
|
||||
title_lang: 'dashboard.donatore',
|
||||
extracl: ''
|
||||
},
|
||||
]
|
||||
|
||||
public mounted() {
|
||||
this.nave = this.naveprop
|
||||
this.navi_partenza = this.navi_partenzaprop
|
||||
|
||||
this.riga = tools.getValDb('riga', false, 1)
|
||||
this.col = tools.getValDb('col', false, 1)
|
||||
this.rigadoni = tools.getValDb('rigadoni', false, 1)
|
||||
this.coldoni = tools.getValDb('coldoni', false, 1)
|
||||
|
||||
this.mediatore = this.getmediatore()
|
||||
|
||||
if (!!this.mediatore) {
|
||||
this.link_chat = this.mediatore.link_chat
|
||||
}
|
||||
}
|
||||
|
||||
public getNavePartByInd(ind) {
|
||||
if (!!this.navi_partenza[ind])
|
||||
return this.navi_partenza[ind].date_start
|
||||
else
|
||||
return ' --/--/-- '
|
||||
}
|
||||
|
||||
public getRiganave(riga) {
|
||||
let ris = riga - 3
|
||||
if (ris <= 1)
|
||||
ris = 1
|
||||
return ris
|
||||
}
|
||||
|
||||
public getColnave(col) {
|
||||
let ris = Math.floor(col / (2 * 4))
|
||||
if (ris <= 1)
|
||||
ris = 1
|
||||
return ris
|
||||
}
|
||||
|
||||
public sonoMediatore() {
|
||||
if (!!this.nave) {
|
||||
if (!!this.nave.rec.donatore.recmediatore)
|
||||
return this.nave.rec.donatore.recmediatore.ind_order === this.nave.ind_order
|
||||
else {
|
||||
if (!!this.nave.rec.mediatore.recmediatore)
|
||||
return this.nave.rec.mediatore.recmediatore.ind_order === this.nave.ind_order
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
public getmediatore() {
|
||||
return this.nave.rec.donatore.recmediatore
|
||||
}
|
||||
|
||||
public change_link_chat() {
|
||||
const recmed = this.getmediatore()
|
||||
if (recmed.link_chat !== this.link_chat) {
|
||||
recmed.link_chat = this.link_chat
|
||||
|
||||
const mydata = {
|
||||
link_chat: recmed.link_chat
|
||||
}
|
||||
tools.saveFieldToServer(this, 'navi', recmed._id, mydata)
|
||||
}
|
||||
}
|
||||
|
||||
get linkchatopen() {
|
||||
return this.link_chat
|
||||
}
|
||||
|
||||
public sonoSognatore() {
|
||||
return this.nave.rec.donatore.recsognatore.ind_order === this.nave.ind_order
|
||||
}
|
||||
|
||||
public getclassSelect(rec) {
|
||||
if (rec.ind_order === this.nave.ind_order)
|
||||
return ' you'
|
||||
}
|
||||
|
||||
public gettitlenave(ind) {
|
||||
if (ind === 1)
|
||||
return this.getRiganave(this.nave.riga) + '.' + this.getColnave(this.nave.col)
|
||||
else
|
||||
return (this.getrigaNaveByInd(ind)) + '.x'
|
||||
}
|
||||
|
||||
public getdatanave(rec) {
|
||||
if (this.sonoDonatore()) {
|
||||
if (rec.ind === 1) {
|
||||
return tools.getstrshortDate(this.nave.date_start) // Donatore
|
||||
}
|
||||
}
|
||||
if (this.sonoMediatore()) {
|
||||
if (rec.ind === 4) {
|
||||
return tools.getstrshortDate(this.nave.date_start) // Mediatore
|
||||
}
|
||||
}
|
||||
|
||||
return this.getNavePartByInd(rec.ind)
|
||||
}
|
||||
|
||||
public getrigaNaveByInd(ind) {
|
||||
return this.getRiganave(this.nave.riga + ind - 1)
|
||||
}
|
||||
|
||||
public NaveeseguitabyInd(riga) {
|
||||
return (this.riga >= riga)
|
||||
}
|
||||
|
||||
public getclpos(rec) {
|
||||
if (this.NaveeseguitabyInd(this.getrigaNaveByInd(rec.ind))) {
|
||||
return 'you'
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
public geticon(rec) {
|
||||
|
||||
if (this.rigadoni >= this.getrigaNaveByInd(rec.ind)) {
|
||||
return 'fas fa-gift'
|
||||
}
|
||||
}
|
||||
|
||||
public async InviaMsgANave(msgobj, navemediatore) {
|
||||
|
||||
let msgtitle = translate('dashboard.controlla_donatori')
|
||||
if (msgobj.inviareale) {
|
||||
msgtitle = translate('dashboard.invia_link_chat')
|
||||
}
|
||||
|
||||
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, {
|
||||
param1: msgobj,
|
||||
param2: navemediatore
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
public async InviaMsgADonatori(msgobj) {
|
||||
|
||||
const navemediatore = {
|
||||
id: this.mediatore._id,
|
||||
riga: this.mediatore.riga,
|
||||
col: this.mediatore.col
|
||||
}
|
||||
|
||||
this.InviaMsgANave(msgobj, navemediatore)
|
||||
}
|
||||
|
||||
get linkchatesiste() {
|
||||
if (!!this.linkchatopen)
|
||||
return this.linkchatopen.length > 10
|
||||
return false
|
||||
}
|
||||
|
||||
public InviaLinkChatADonatori(inviareale) {
|
||||
|
||||
const msgobj = {
|
||||
tipomsg: tools.TipoMsg.SEND_LINK_CHAT_DONATORI,
|
||||
msgpar1: this.linkchatopen,
|
||||
inviareale,
|
||||
}
|
||||
|
||||
this.InviaMsgADonatori(msgobj)
|
||||
}
|
||||
|
||||
}
|
||||
177
src/components/CMyNave/CMyNave.vue
Normal file
177
src/components/CMyNave/CMyNave.vue
Normal file
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<div>
|
||||
<CTitleBanner v-if="nave" class="q-pa-xs"
|
||||
:title="$t('pages.nave') + ` ` + getRiganave(nave.riga) + `.`+getColnave(nave.col) + ` ` + $t('dashboard.nave_in_partenza') + ` ` + tools.getstrDate(nave.date_start)"
|
||||
bgcolor="bg-primary"
|
||||
clcolor="text-white"
|
||||
mystyle="" myclass="myshad" canopen="true">
|
||||
|
||||
|
||||
<div v-if="nave" class="flex flex-center column justify-center">
|
||||
<div class="">
|
||||
<!--IndPrimario: {{ nave.indprimario }} - IndOrder: {{ nave.ind_order }} -->
|
||||
</div>
|
||||
|
||||
<q-tabs
|
||||
v-model="cosa"
|
||||
dense
|
||||
class="text-blue"
|
||||
active-color="primary"
|
||||
indicator-color="primary"
|
||||
align="justify"
|
||||
narrow-indicator
|
||||
>
|
||||
<q-tab name="tragitto" label="Tragitto"></q-tab>
|
||||
<q-tab name="donatore" label="Donatore"></q-tab>
|
||||
<q-tab name="mediatore" label="Mediatore"></q-tab>
|
||||
<q-tab name="spiegazione" label="Spiegazione"></q-tab>
|
||||
</q-tabs>
|
||||
|
||||
|
||||
<q-tab-panels v-model="cosa" animated>
|
||||
<q-tab-panel name="spiegazione">
|
||||
|
||||
<div v-if="sonoMediatore()">
|
||||
<div class="text-left" v-html="$t('dashboard.sonomediatore')"></div>
|
||||
|
||||
<q-input v-model="link_chat" :label="$t('dashboard.link_chat')"
|
||||
debounce="1000"
|
||||
input-class="myinput-area"
|
||||
@input="change_link_chat">
|
||||
|
||||
</q-input>
|
||||
|
||||
<div class="">
|
||||
<div class="row justify-center centermydiv q-gutter-sm" style="max-width: 420px;">
|
||||
<q-btn rounded text-color="secondary" icon="fab fa-telegram"
|
||||
:label="$t('dashboard.controlla_donatori')"
|
||||
@click="InviaLinkChatADonatori(false)"></q-btn>
|
||||
|
||||
<q-btn rounded text-color="primary" icon="fab fa-telegram"
|
||||
:disable="!linkchatesiste"
|
||||
:label="$t('dashboard.invia_link_chat')"
|
||||
@click="InviaLinkChatADonatori(true)"></q-btn>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-else-if="sonoDonatore()">
|
||||
<div v-html="$t('dashboard.sonosognatore')">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="tragitto">
|
||||
<div class="row justify-between">
|
||||
<div class="cont_pos_intest">N</div>
|
||||
|
||||
<div class="cont_intestaz q-mx-sm"> Nome<br>dei Passaggi</div>
|
||||
|
||||
<div class="cont_intestaz">Nave</div>
|
||||
<div class="cont_intestaz">Data<br>Partenza</div>
|
||||
<div class="cont_intestaz_small">Doni<br>Inviati</div>
|
||||
</div>
|
||||
|
||||
<div v-for="rec in tragitto" :key="rec.ind">
|
||||
<div :class="`row items-center ` + rec.extracl">
|
||||
<div :class="`cont_pos ` + getclpos(rec)">
|
||||
{{ rec.ind }}
|
||||
</div>
|
||||
<div v-if="rec.title_lang" class="passo">
|
||||
<div :class="rec.extracl">
|
||||
<q-chip class="glossy" :color="rec.color" text-color="white">
|
||||
{{ $t(rec.title_lang) }}
|
||||
</q-chip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<q-chip class="glossy" :color="rec.color" text-color="white">
|
||||
{{ gettitlenave(rec.ind) }}
|
||||
</q-chip>
|
||||
</div>
|
||||
<div class="">
|
||||
<q-chip class="glossy" :color="rec.color" text-color="white">
|
||||
{{ getdatanave(rec) }}
|
||||
</q-chip>
|
||||
</div>
|
||||
<q-icon color="green" inverted size="sm" :name="geticon(rec)" class="gift"></q-icon>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="q-ma-md q-butter-sm" v-if="!!linkchatopen">
|
||||
Per entrare nella Gift Chat, clicca qui:<br>
|
||||
<div class="q-ma-md">
|
||||
<q-btn rounded color="primary" icon="fab fa-telegram" :label="$t('dashboard.entra_in_gift_chat')"
|
||||
type="a"
|
||||
:href="linkchatopen" target="_blank"></q-btn>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="donatore">
|
||||
|
||||
<div v-if="nave.rec.donatore.recsognatori">
|
||||
<div class="sognatore">SOGNATORI:</div>
|
||||
<div v-for="(sognatore, index) in nave.rec.donatore.recsognatori" :key="10+index">
|
||||
<div v-if="sognatore" :class="`cont_sognatore ` + getclassSelect(sognatore)">
|
||||
A{{3 - index}} - {{ sognatore.name }} {{ sognatore.surname }} ({{sognatore.username }})
|
||||
</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="mediatore">MEDIATORE:</div>
|
||||
<div :class="`cont_mediatore ` + getclassSelect(nave.rec.donatore.recmediatore)">
|
||||
{{ nave.rec.donatore.recmediatore.name }} {{ nave.rec.donatore.recmediatore.surname }} ({{
|
||||
nave.rec.donatore.recmediatore.username }})
|
||||
</div>
|
||||
</div>
|
||||
<div class="donatore">DONATORI:</div>
|
||||
<div v-for="(donatore, index) in nave.rec.donatore.arrdonatori" :key="index">
|
||||
<div v-if="donatore" :class="`cont_donatore ` + getclassSelect(donatore)">
|
||||
D{{index + 1}} - {{ donatore.name }} {{ donatore.surname }} ({{ donatore.username }}) {{
|
||||
donatore.riga}}.{{donatore.col}}<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</q-tab-panel>
|
||||
<q-tab-panel name="mediatore">
|
||||
|
||||
<div v-if="nave.rec.mediatore.recsognatori">
|
||||
<div class="sognatore">SOGNATORI:</div>
|
||||
<div v-for="(sognatore, index) in nave.rec.mediatore.recsognatori" :key="10+index">
|
||||
<div v-if="sognatore" :class="`cont_sognatore ` + getclassSelect(sognatore)">
|
||||
A{{3 - index}} - {{ sognatore.name }} {{ sognatore.surname }} ({{sognatore.username }})
|
||||
</div>
|
||||
</div>
|
||||
<div class="">
|
||||
<div class="mediatore">MEDIATORE:</div>
|
||||
<div :class="`cont_mediatore ` + getclassSelect(nave.rec.mediatore.recmediatore)">
|
||||
{{ nave.rec.mediatore.recmediatore.name }} {{ nave.rec.mediatore.recmediatore.surname }} ({{
|
||||
nave.rec.mediatore.recmediatore.username }})
|
||||
</div>
|
||||
</div>
|
||||
<div class="donatore">DONATORI:</div>
|
||||
<div v-for="(donatore, index) in nave.rec.mediatore.arrdonatori" :key="index">
|
||||
<div v-if="donatore" :class="`cont_donatore ` + getclassSelect(donatore)">
|
||||
D{{index + 1}} - {{ donatore.name }} {{ donatore.surname }} ({{ donatore.username }}) {{
|
||||
donatore.riga}}.{{donatore.col}}<br>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</q-tab-panel>
|
||||
</q-tab-panels>
|
||||
</div>
|
||||
</CTitleBanner>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" src="./CMyNave.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './CMyNave.scss';
|
||||
</style>
|
||||
1
src/components/CMyNave/index.ts
Normal file
1
src/components/CMyNave/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export {default as CMyNave} from './CMyNave.vue'
|
||||
Reference in New Issue
Block a user