Files
freeplanet/src/components/CMyNave/CMyNave.ts

841 lines
21 KiB
TypeScript
Raw Normal View History

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'
2020-04-07 14:33:56 +02:00
import { GlobalStore, UserStore } from '../../store/Modules'
import { lists } from '../../store/Modules/lists'
import translate from '../../globalroutines/util'
2020-03-21 10:33:10 +01:00
import { CMyChipList } from '../CMyChipList'
import { CVideo } from '../CVideo'
@Component({
2020-04-07 14:33:56 +02:00
components: { CTitleBanner, CMyChipList, CVideo }
})
export default class CMyNave extends MixinNave {
2020-04-07 14:33:56 +02:00
@Prop({ required: false, default: null }) public naveprop
@Prop({ required: false, default: null }) public posizprop
@Prop({ required: true }) public navi_partenzaprop: any[]
2020-04-07 14:33:56 +02:00
@Prop({ required: true }) public listanavi: boolean
public navi_partenza: any[]
public $t
public link_chat: string = ''
public cosa: string = 'tragitto'
2020-03-21 10:33:10 +01:00
public cosa2: string = 'donatore'
public nave: any = null
2020-04-07 14:33:56 +02:00
public posiz: any = null
public numpercorso = 7
public riga: number = 1
public col: number = 1
public rigadoni: number = 1
public coldoni: number = 1
2020-04-07 14:33:56 +02:00
public mediatore: any = null
2020-03-21 10:33:10 +01:00
public donatore: any = {}
2020-03-25 18:28:39 +01:00
public donatore_navepers: any = {}
public mediatore_navepers: any = {}
2020-03-21 10:33:10 +01:00
public iodonatore: any = {}
public iosognatore: any = {}
public donoinviato: boolean = false
public arrdonatori: any[] = []
public recsel = null
2020-04-07 14:33:56 +02:00
public loading: boolean = false
public showmsguser: boolean = false
public seluser = null
public msg_tosend_user: string = ''
2020-03-21 10:33:10 +01:00
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 coldonatori: any[] = [
/*{
name: 'index',
required: true,
label: 'Num',
align: 'left',
field: 'index',
sortable: true
},*/
2020-04-07 14:33:56 +02:00
{ name: 'name', align: 'center', label: translate('reg.name'), field: 'name', sortable: true },
{ name: 'surname', align: 'center', label: translate('reg.surname'), field: 'surname', sortable: true },
{ name: 'posizione', align: 'center', label: 'Posizione', field: 'riga', sortable: true },
2020-03-21 10:33:10 +01:00
{ name: 'date_made_gift', align: 'center', label: 'Inviato', field: 'date_made_gift', sortable: true },
2020-04-07 14:33:56 +02:00
{ name: 'tel', align: 'center', label: 'Tel', field: 'tel', sortable: true },
2020-03-21 10:33:10 +01:00
{ name: 'made_gift', align: 'center', label: 'Confermato', field: 'made_gift', sortable: true },
]
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() {
2020-04-07 14:33:56 +02:00
this.posiz = this.posizprop
this.navi_partenza = this.navi_partenzaprop
2020-04-07 14:33:56 +02:00
this.nave = this.naveprop
if (!this.listanavi) {
this.apri()
}
this.aggiorna()
}
public aggiorna() {
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)
2020-04-07 14:33:56 +02:00
if (!!this.nave) {
if (!!this.nave.rec) {
if (!!this.nave.rec.donatore)
this.donatore_navepers = this.nave.rec.donatore.navepersistente
if (!!this.nave.rec.mediatore) {
this.mediatore = this.getmediatore()
this.donatore = this.getdonatore()
if (!!this.nave.rec.mediatore)
this.mediatore_navepers = this.nave.rec.mediatore.navepersistente
this.iodonatore = this.getIoDonatore()
this.iosognatore = this.getIoSognatore()
this.donoinviato = this.getDonoInviato
// console.log('this.mediatore', this.mediatore)
// console.log('this.donatore', this.donatore)
if (!!this.mediatore_navepers) {
this.link_chat = this.mediatore_navepers.link_chat
}
2020-04-07 14:33:56 +02:00
this.arrdonatori = this.creaarrDonatori()
}
}
}
2020-03-21 10:33:10 +01:00
}
public getListaDonatoriDaConfermare() {
let mystr = ''
if (!!this.nave.listadonatoridelsognatore) {
if (this.nave.listadonatoridelsognatore.length > 0) {
for (const rec of this.nave.listadonatoridelsognatore) {
mystr += rec.name + ' ' + rec.surname + ' [' + rec.riga + '.' + rec.col + ']<br>'
}
}
}
return mystr
}
public creaarrDonatori() {
const arr = []
if (!!this.nave.listadonatoridelsognatore) {
if (this.nave.listadonatoridelsognatore.length > 0) {
let index = 0
for (const rec of this.nave.listadonatoridelsognatore) {
index++
2020-03-25 09:26:08 +01:00
arr.push({ index, ...rec })
2020-03-21 10:33:10 +01:00
}
}
}
return arr
}
2020-04-07 14:33:56 +02:00
public getRiganave() {
if (this.listanavi) {
return this.nave.riga
} else {
if (!!this.posiz) {
let ris = this.posiz.riga - 3
if (ris <= 1)
ris = 1
2020-03-31 20:34:49 +02:00
2020-04-07 14:33:56 +02:00
return ris
}
2020-03-31 20:34:49 +02:00
2020-04-07 14:33:56 +02:00
return 1
}
}
2020-04-07 14:33:56 +02:00
public getColnave() {
if (this.listanavi) {
return this.nave.col
} else {
if (!this.posiz) {
return 1
} else {
let ris = Math.ceil(this.posiz.col / (2 * 4))
if (ris <= 1)
ris = 1
return ris
}
}
}
2020-04-07 14:33:56 +02:00
public getColnaveriduci(col) {
2020-03-21 10:33:10 +01:00
let ris = Math.ceil(col / (2 * 4))
if (ris <= 1)
ris = 1
return ris
}
public sonoMediatore() {
if (!!this.nave) {
2020-03-21 10:33:10 +01:00
if (!!this.nave.rec.donatore)
2020-04-07 14:33:56 +02:00
return this.nave.rec.donatore.recmediatore.ind_order === this.myindorder
else {
2020-03-21 10:33:10 +01:00
if (!!this.nave.rec.mediatore)
2020-04-07 14:33:56 +02:00
return this.nave.rec.mediatore.recmediatore.ind_order === this.myindorder
}
}
return false
}
2020-03-21 10:33:10 +01:00
public partenza_primo_donatore() {
if (!!this.nave) {
2020-03-25 18:28:39 +01:00
if (!!this.mediatore_navepers) {
return this.mediatore_navepers.date_start
}
}
2020-03-21 10:33:10 +01:00
return ''
}
public getGiornoDelDono() {
if (!!this.nave) {
2020-03-25 18:28:39 +01:00
return tools.getstrDate(this.donatore_navepers.date_start)
2020-03-21 10:33:10 +01:00
}
}
get GiornoDelDonoArrivato() {
if (!!this.nave) {
2020-03-25 18:28:39 +01:00
return tools.isDateArrived(this.donatore_navepers.date_start)
2020-03-21 10:33:10 +01:00
}
return false
}
get FattoDono() {
if (!!this.iodonatore) {
return this.iodonatore.made_gift
}
return false
}
2020-03-21 10:33:10 +01:00
public getIoDonatore() {
if (!!this.nave) {
if (!!this.nave.rec.donatore) {
2020-04-07 14:33:56 +02:00
if (this.nave.rec.donatore.arrdonatori) {
for (const rec of this.nave.rec.donatore.arrdonatori) {
if (!!rec) {
if (rec.ind_order === this.myindorder)
return rec
}
2020-03-21 10:33:10 +01:00
}
}
}
}
return null
}
2020-04-07 14:33:56 +02:00
get myindorder() {
if (this.listanavi)
return this.nave.ind_order
else
return this.posiz.ind_order
}
2020-03-21 10:33:10 +01:00
public getIoSognatore() {
const sognatore = this.sognatoredelDono()
if (!!sognatore) {
2020-04-07 14:33:56 +02:00
return sognatore.ind_order === this.myindorder
2020-03-21 10:33:10 +01:00
}
return null
}
public sognatoredelDono() {
if (!!this.nave) {
if (!!this.nave.rec.donatore.recsognatori)
return this.nave.rec.donatore.recsognatori[0]
}
return null
}
public HoRicevutoIlDono(rec) {
this.recsel = rec
const msgtitle = this.$t('dashboard.dono_ricevuto_2')
const msginvia = this.$t('dashboard.confermi_dono_ricevuto', {
donatore: rec.name + ' ' + rec.surname
})
const mymsg = this.$t('dashboard.confermi_dono_ricevuto_msg', {
2020-04-07 14:33:56 +02:00
donatore: rec.name + ' ' + rec.surname + ' (' + this.$t('dashboard.posizione') + ' ' + rec.riga + '.' + rec.col + ')'
2020-03-21 10:33:10 +01:00
})
tools.askConfirm(this.$q, msgtitle, msginvia + ' ' + '?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.DONO_RICEVUTO, 0, {
param1: {
_id: rec._id,
made_gift: true
},
param2: rec.username,
param3: mymsg
})
}
public HoEffettuatoIlDono() {
const msgtitle = translate('dashboard.confermi_dono')
const msginvia = msgtitle
const mymsg = this.$t('dashboard.msg_bot_conferma', {
donatore: this.iodonatore.name + ' ' + this.iodonatore.surname,
sognatore: this.sognatoredelDono().name + ' ' + this.sognatoredelDono().surname
})
tools.askConfirm(this.$q, msgtitle, msginvia + ' ' + '?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.DONO_INVIATO, 0, {
param1: {
_id: this.iodonatore._id,
date_made_gift: tools.getDateNow()
},
param2: this.sognatoredelDono().username,
param3: mymsg
})
}
public ActionAfterYes(action, item, data) {
console.log('ActionAfterYes...')
if (action === lists.MenuAction.DONO_INVIATO) {
if (!!this.iodonatore) {
this.iodonatore.date_made_gift = tools.getDateNow()
this.donoinviato = true
console.log('date_made_gift', this.iodonatore.date_made_gift)
}
// this.refresh()
} else if (action === lists.MenuAction.DONO_RICEVUTO) {
if (!!this.recsel) {
this.recsel.made_gift = true
}
}
}
public getMetodoPagamentoSognatore() {
const rec = this.sognatoredelDono()
if (!!rec) {
try {
return rec.profile.paymenttypes
} catch (e) {
return ''
}
}
}
public getemailPagamentoSognatore() {
const rec = this.sognatoredelDono()
if (!!rec) {
if (!!rec.profile)
return rec.profile.email_paypal
}
return ''
}
get getDonoInviato() {
if (!!this.iodonatore) {
return !!this.iodonatore.date_made_gift
}
return false
}
public sonoDonatore() {
return !!this.iodonatore
}
2020-03-25 09:26:08 +01:00
public sonoSecondaTessituraDonatore() {
const mediatore = this.getmediatore()
for (const rec of this.nave.rec.donatore.arrdonatori) {
if (!!rec) {
if (mediatore) {
2020-04-07 14:33:56 +02:00
if ((mediatore.ind_order === rec.ind_order) && (rec.num_tess % 2) === 0)
2020-03-25 09:26:08 +01:00
return true
}
}
}
return false
}
2020-03-21 10:33:10 +01:00
public sonoSognatore() {
return !!this.iosognatore
}
public getmediatore() {
2020-03-21 10:33:10 +01:00
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() {
2020-03-25 18:28:39 +01:00
const recmedpers = this.mediatore_navepers
if (!!recmedpers) {
if (recmedpers.link_chat !== this.link_chat) {
recmedpers.link_chat = this.link_chat
2020-03-21 10:33:10 +01:00
const mydata = {
2020-03-25 18:28:39 +01:00
link_chat: recmedpers.link_chat
2020-03-21 10:33:10 +01:00
}
2020-03-25 18:28:39 +01:00
tools.saveFieldToServer(this, 'navepersistente', recmedpers._id, mydata)
}
}
}
get linkchatopen() {
2020-03-25 18:28:39 +01:00
return this.donatore_navepers.link_chat
}
public getclassSelect(rec) {
2020-04-07 14:33:56 +02:00
if (rec.ind_order === this.myindorder)
return ' you'
}
public gettitlenave(ind) {
2020-03-31 20:34:49 +02:00
let ris = ''
if (ind === 1)
2020-04-07 14:33:56 +02:00
return this.getRiganave() + '.' + this.getColnave()
2020-03-31 20:34:49 +02:00
else {
ris = (this.getrigaNaveByInd(ind)) + '.' + this.getcolNaveByInd(ind)
}
let add = ''
// for (let index = 0; index < (4 - ris.length); index++) {
// add += '&nbsp;'
// }
ris = add + ris
return ris
}
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
}
}
2020-03-31 20:34:49 +02:00
const riga = this.getrigaNaveByInd(rec.ind)
const col = this.getcolNaveByInd(rec.ind)
const mynavepart = this.getnavePartenzaByRigaCol(riga, col)
if (!!mynavepart) {
if (!!mynavepart.date_start)
return tools.getstrshortDate(mynavepart.date_start)
}
return ' --/-- '
// return this.getNavePartByInd(rec.ind)
}
2020-04-07 14:33:56 +02:00
public getTutor(rec) {
const mynavepart = this.getnavePartenzaByRigaCol(rec.riga, rec.col)
if (!!mynavepart)
return mynavepart.tutor_namesurname
return ''
}
public getTutor_username(rec) {
const mynavepart = this.getnavePartenzaByRigaCol(rec.riga, rec.col)
if (!!mynavepart)
return mynavepart.tutor
return ''
}
2020-03-31 20:34:49 +02:00
public getnavePartenzaByRigaCol(riga, col) {
for (const mynave of this.navi_partenza) {
if (!!mynave) {
if ((mynave.riga === riga) && (mynave.col === col)) {
return mynave
}
}
}
return null
}
public getrigaNaveByInd(ind) {
2020-04-07 14:33:56 +02:00
if (this.listanavi) {
return this.nave.riga + ind - 1
} else {
let ris = this.posiz.riga + ind - 1 - 3
if (ris <= 1)
ris = 1
return ris
}
}
2020-03-31 20:34:49 +02:00
public getcolNaveByInd(ind) {
2020-04-07 14:33:56 +02:00
if (this.listanavi) {
return this.nave.col * Math.pow(2, ind - 1)
} else {
let ris = Math.ceil(this.posiz.col * Math.pow(2, ind - 1) / (2 * 4))
if (ris <= 1)
ris = 1
return ris
}
2020-03-31 20:34:49 +02:00
}
public NaveeseguitabyInd(riga) {
return (this.riga >= riga)
}
public getclpos(rec) {
if (this.NaveeseguitabyInd(this.getrigaNaveByInd(rec.ind))) {
return 'you'
} else {
return ''
}
}
public geticon(rec) {
2020-03-25 09:26:08 +01:00
if (!rec)
return ''
// console.log('this.rigadoni', this.rigadoni, 'ind', rec.ind)
2020-03-21 10:33:10 +01:00
if (!rec.ind)
return ''
2020-03-31 20:34:49 +02:00
const riga = this.getrigaNaveByInd(rec.ind)
const col = this.getcolNaveByInd(rec.ind)
const mynavepart = this.getnavePartenzaByRigaCol(riga, col)
if (!!mynavepart) {
if (mynavepart.DoniConfermati > 0) {
return 'fas fa-gift'
}
}
if (this.rigadoni >= this.getrigaNaveByInd(rec.ind)) {
2020-03-31 20:34:49 +02:00
// return 'fas fa-gift'
}
}
public async InviaMsgANave(msgobj, navemediatore) {
2020-03-31 20:34:49 +02:00
let msgtitle = translate('dashboard.controlla_donatori')
2020-03-21 10:33:10 +01:00
let msginvia = msgtitle
if (msgobj.inviareale) {
msgtitle = translate('dashboard.invia_link_chat')
2020-03-21 10:33:10 +01:00
msginvia = translate('dashboard.inviare_msg_donatori')
}
2020-03-21 10:33:10 +01:00
tools.askConfirm(this.$q, msgtitle, msginvia + ' ' + '?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.INVIA_MSG_A_DONATORI, 0, {
param1: msgobj,
2020-03-25 09:26:08 +01:00
param2: navemediatore,
param3: tools.TipoMsg.SEND_LINK_CHAT_DONATORI
})
}
2020-03-21 10:33:10 +01:00
public InviaMsgADonatori(msgobj) {
const navemediatore = {
id: this.mediatore._id,
riga: this.mediatore.riga,
col: this.mediatore.col
}
this.InviaMsgANave(msgobj, navemediatore)
}
get linkchatesiste() {
2020-03-21 10:33:10 +01:00
if (!!this.link_chat)
return this.link_chat.length > 10
return false
}
public InviaLinkChatADonatori(inviareale) {
const msgobj = {
tipomsg: tools.TipoMsg.SEND_LINK_CHAT_DONATORI,
2020-03-21 10:33:10 +01:00
msgpar1: this.link_chat,
inviareale,
2020-04-07 14:33:56 +02:00
username_mitt: ''
}
2020-04-07 14:33:56 +02:00
if (!!this.nave.username)
msgobj.username_mitt = this.nave.username
else
msgobj.username_mitt = UserStore.state.my.username
this.InviaMsgADonatori(msgobj)
}
2020-03-21 10:33:10 +01:00
public getdatastr(mydata) {
return tools.getstrshortDate(mydata)
}
public gettitlemediatore() {
2020-03-31 20:34:49 +02:00
return this.getdatastr(this.partenza_primo_donatore()) + ' ' + this.$t('dashboard.nave') + ' ' + this.getisProvvisoriaMediatoreStr() + this.mediatore.riga + '.' + this.mediatore.col + ' ' + '🎁' + 'AYNI'
2020-03-21 10:33:10 +01:00
}
public gettitledonatore() {
2020-03-31 20:34:49 +02:00
return this.getdatastr(this.donatore_navepers.date_start) + ' ' + this.$t('dashboard.nave') + ' ' + this.getisProvvisoriaStr() + this.donatore_navepers.riga + '.' + this.donatore_navepers.col + ' ' + '🎁' + 'AYNI'
2020-03-21 10:33:10 +01:00
}
public gettesto() {
return this.$t('dashboard.sonomediatore', { nomenave: this.gettitlemediatore() })
}
public getisProvvisoriaStr() {
2020-03-31 20:34:49 +02:00
let istemp = false
2020-03-25 18:28:39 +01:00
if (!!this.donatore_navepers) {
if (this.donatore_navepers.provvisoria) {
2020-03-31 20:34:49 +02:00
istemp = true
2020-03-21 10:33:10 +01:00
}
2020-03-31 20:34:49 +02:00
} else {
istemp = true
}
if (istemp) {
return ' ' + this.$t('dashboard.temporanea') + ' '
2020-03-21 10:33:10 +01:00
}
return ''
}
2020-03-31 20:34:49 +02:00
public getisProvvisoriaMediatoreStr() {
let istemp = false
if (!!this.mediatore_navepers) {
if (this.mediatore_navepers.provvisoria) {
istemp = true
}
} else {
istemp = true
}
if (istemp) {
return ' ' + this.$t('dashboard.temporanea') + ' '
}
2020-04-07 14:33:56 +02:00
return ''
2020-03-31 20:34:49 +02:00
}
public isDefinitivaMediatore() {
if (!!this.mediatore_navepers)
return (!this.mediatore_navepers.provvisoria)
return false
}
2020-03-25 09:26:08 +01:00
public getindex(recdonatore, index) {
2020-04-07 14:33:56 +02:00
if (recdonatore.ind_order === this.nave.rec.donatore.recmediatore.ind_order && (recdonatore.num_tess % 2) === 0)
2020-03-31 20:34:49 +02:00
return this.$t('dashboard.ritessitura')
2020-03-25 09:26:08 +01:00
return 'D' + (index)
}
2020-03-21 10:33:10 +01:00
public getposizione() {
2020-04-07 14:33:56 +02:00
let pos = ''
if (!this.listanavi) {
pos = this.$t('dashboard.posizione') + ' ' + this.getisProvvisoriaStr() + this.posiz.riga + '.' + this.posiz.col
}
return pos
2020-03-21 10:33:10 +01:00
}
public getDoniAttesaDiConferma() {
return this.arrdonatori.filter((rec) => (!!rec.date_made_gift && !rec.made_gift)).reduce((sum, item) => sum + 1, 0)
}
public getDoniConfermati() {
return this.arrdonatori.filter((rec) => rec.made_gift).reduce((sum, item) => sum + 1, 0)
}
public getDoniMancanti() {
return this.arrdonatori.filter((rec) => (!rec.made_gift && !rec.date_made_gift)).reduce((sum, item) => sum + 1, 0)
}
2020-04-07 14:33:56 +02:00
public async apri() {
let riga = 0
let col = 0
let riga1don = 1
let col1don = 1
let ind_order = -1;
if (this.listanavi) {
riga = this.nave.riga
col = this.nave.col
riga1don = riga + 3
col1don = col * Math.pow(2, 3)
if (!!this.sognatoredelDono())
ind_order = this.sognatoredelDono().ind_order
} else {
riga1don = this.posiz.riga
col1don = this.posiz.col
ind_order = this.posiz.ind_order
riga = this.posiz.riga - 3
col = this.getColnaveriduci(this.posiz.col)
if (riga < 1)
riga = 1
if (col < 1)
col = 1
}
this.loading = true
const ris = await GlobalStore.actions.GetNave({ riga, col, riga1don, col1don, ind_order })
this.navi_partenza = ris.navi_partenza
this.nave = ris.nave
// console.log('apri', ris)
this.aggiorna()
this.loading = false
}
public getstrinpartenza() {
if (this.GiornoDelDonoArrivato) {
return this.$t('dashboard.nave_partita')
}
return this.$t('dashboard.nave_in_partenza')
}
public getpartenza() {
let myrec = null
if (this.listanavi)
myrec = this.nave.rec
else {
if (!!this.posiz)
myrec = this.posiz.rec
}
if (!!myrec)
return tools.getstrDate(myrec.donatore.navepersistente.date_start)
return ''
}
public titolonave() {
if (this.listanavi && !this.nave) {
return ''
}
let str = this.$t('pages.nave') + ` ` + this.getisProvvisoriaStr() + this.getRiganave() + `.` + this.getColnave() + ` ` + this.getstrinpartenza() + ` ` + this.getpartenza()
if (!!this.nave) {
if (this.GiornoDelDonoArrivato && !!this.nave.DoniConfermati) {
str += ' (' + this.$t('dashboard.doni_ricevuti') + ' = ' + this.nave.DoniConfermati + ')'
}
if (this.GiornoDelDonoArrivato && this.nave.DoniMancanti > 0) {
str += ' (' + this.$t('dashboard.doni_mancanti') + ' = ' + this.nave.DoniMancanti + ')'
}
}
return str
}
public getcolortitle() {
if (this.listanavi && !this.nave) {
return 'bg-primary'
}
if (this.listanavi) {
if (!!this.nave.DoniConfermati && this.nave.DoniMancanti > 0)
return 'bg-negative'
if (!!this.nave.DoniConfermati && this.nave.DoniConfermati > 0)
return 'bg-positive'
}
return 'bg-primary'
}
public clickseluser(rec) {
this.seluser = rec
this.showmsguser = true
}
public async InviaMsgAUserConfirm(msgobj, navemediatore) {
const msgtitle = translate('dialog.sendmsg')
tools.askConfirm(this.$q, msgtitle, msgobj.msgpar1 + ' ' + '?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.INVIA_MSG_A_SINGOLO, 0, {
param1: msgobj,
param2: navemediatore,
})
}
public Chiudi() {
this.showmsguser = false
}
public InviaMsgAUser() {
if (!this.msg_tosend_user)
return
const msgobj = {
tipomsg: tools.TipoMsg.SEND_MSG_SINGOLO,
msgpar1: this.msg_tosend_user,
username: this.seluser.username,
inviareale: true,
username_mitt: '',
}
if (!!this.nave.username)
msgobj.username_mitt = this.nave.username
else
msgobj.username_mitt = UserStore.state.my.username
const naveuser = this.seluser
this.InviaMsgAUserConfirm(msgobj, naveuser)
}
}