2020-03-10 21:42:30 +01:00
|
|
|
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'
|
2020-03-10 21:42:30 +01:00
|
|
|
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'
|
2020-05-10 21:06:42 +02:00
|
|
|
import { validations } from './CMyNave-validate'
|
|
|
|
|
import { validationMixin } from 'vuelidate'
|
2020-03-10 21:42:30 +01:00
|
|
|
|
|
|
|
|
@Component({
|
2020-05-10 21:06:42 +02:00
|
|
|
mixins: [validationMixin],
|
|
|
|
|
validations,
|
2020-04-07 14:33:56 +02:00
|
|
|
components: { CTitleBanner, CMyChipList, CVideo }
|
2020-03-10 21:42:30 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
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
|
2020-03-10 21:42:30 +01:00
|
|
|
@Prop({ required: true }) public navi_partenzaprop: any[]
|
2020-04-07 14:33:56 +02:00
|
|
|
@Prop({ required: true }) public listanavi: boolean
|
2020-05-11 22:43:54 +02:00
|
|
|
@Prop({ required: false, default: null }) public dashboard: any
|
2020-03-10 21:42:30 +01:00
|
|
|
public navi_partenza: any[]
|
|
|
|
|
public $t
|
2020-05-10 21:06:42 +02:00
|
|
|
public $v
|
2020-03-10 21:42:30 +01:00
|
|
|
public link_chat: string = ''
|
2020-05-11 22:43:54 +02:00
|
|
|
public tabnave: string = 'donatore'
|
2020-03-10 21:42:30 +01:00
|
|
|
public cosa: string = 'tragitto'
|
2020-03-21 10:33:10 +01:00
|
|
|
public cosa2: string = 'donatore'
|
2020-03-10 21:42:30 +01:00
|
|
|
public nave: any = null
|
2020-04-07 14:33:56 +02:00
|
|
|
public posiz: any = null
|
2020-03-10 21:42:30 +01:00
|
|
|
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-06-08 13:31:44 +02:00
|
|
|
public flotta: any = null
|
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
|
2020-05-11 22:43:54 +02:00
|
|
|
public showtesto: boolean = false
|
|
|
|
|
public notifBot: boolean = true
|
|
|
|
|
public deleteUser: boolean = true
|
2020-05-13 01:33:07 +02:00
|
|
|
public AddImbarco: boolean = false
|
2020-05-11 22:43:54 +02:00
|
|
|
public seltesto: string = ''
|
2020-04-07 14:33:56 +02:00
|
|
|
public msg_tosend_user: string = ''
|
2020-05-10 21:06:42 +02:00
|
|
|
public username_sostituire: string = ''
|
2020-05-19 00:18:55 +02:00
|
|
|
public userfreestr: string = ''
|
2020-06-08 13:31:44 +02:00
|
|
|
public commento_al_sognatore: 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 }
|
2020-05-11 22:43:54 +02:00
|
|
|
public coldonatori_cell: any[] = [
|
2020-03-21 10:33:10 +01:00
|
|
|
/*{
|
|
|
|
|
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 },
|
2020-05-10 21:06:42 +02:00
|
|
|
// { name: 'surname', align: 'center', label: translate('reg.surname'), field: 'surname', sortable: true },
|
2020-05-11 22:43:54 +02:00
|
|
|
// { name: 'date_made_gift', align: 'center', label: 'Inviato', field: 'date_made_gift', sortable: true },
|
|
|
|
|
// { name: 'tel', align: 'center', label: 'Tel', field: 'tel', sortable: true },
|
|
|
|
|
{ name: 'made_gift', align: 'center', label: 'Conferm.', field: 'made_gift', sortable: true },
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
public coldonatori: any[] = [
|
|
|
|
|
{
|
|
|
|
|
name: 'index',
|
|
|
|
|
required: true,
|
|
|
|
|
label: 'Num',
|
|
|
|
|
align: 'left',
|
|
|
|
|
field: 'index',
|
|
|
|
|
sortable: true
|
|
|
|
|
},
|
|
|
|
|
{ name: 'nave', align: 'center', label: 'Gift Chat', field: 'nave', sortable: true },
|
|
|
|
|
{ name: 'name', align: 'center', label: 'Nome Cognome', field: 'name', sortable: true },
|
|
|
|
|
{ name: 'posizione', align: 'center', label: 'Posizione', field: 'posizione', 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-05-10 21:06:42 +02:00
|
|
|
// { name: 'tel', align: 'center', label: 'Tel', field: 'tel', sortable: true },
|
|
|
|
|
{ name: 'made_gift', align: 'center', label: 'Conferm.', field: 'made_gift', sortable: true },
|
2020-06-08 13:31:44 +02:00
|
|
|
{ name: 'commento_al_sognatore', align: 'center', label: 'Commento', field: 'commento_al_sognatore', sortable: true },
|
2020-03-21 10:33:10 +01:00
|
|
|
]
|
2020-03-10 21:42:30 +01:00
|
|
|
|
|
|
|
|
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
|
2020-03-10 21:42:30 +01:00
|
|
|
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()
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 22:43:54 +02:00
|
|
|
public created() {
|
|
|
|
|
if (!!tools.getCookie(tools.TABBED_NAVE)) {
|
|
|
|
|
this.tabnave = tools.getCookie(tools.TABBED_NAVE)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public changetab(val) {
|
|
|
|
|
tools.setCookie(tools.TABBED_NAVE, val)
|
|
|
|
|
// console.log('setcook', val)
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 14:33:56 +02:00
|
|
|
public aggiorna() {
|
2020-03-10 21:42:30 +01:00
|
|
|
|
|
|
|
|
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) {
|
2020-06-08 13:31:44 +02:00
|
|
|
if (!!this.nave.rec.donatore.flotta)
|
|
|
|
|
this.flotta = this.nave.rec.donatore.flotta
|
2020-04-07 14:33:56 +02:00
|
|
|
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-03-10 21:42:30 +01:00
|
|
|
|
2020-04-07 14:33:56 +02:00
|
|
|
this.arrdonatori = this.creaarrDonatori()
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
2020-06-02 22:19:20 +02:00
|
|
|
|
|
|
|
|
if (this.sonoDonatore()) {
|
|
|
|
|
this.tabnave = 'donatore'
|
|
|
|
|
} else if (this.sonoMediatore()) {
|
|
|
|
|
this.tabnave = 'mediatore'
|
|
|
|
|
} else if (this.sonoSognatore()) {
|
|
|
|
|
this.tabnave = 'sognatore'
|
|
|
|
|
}
|
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-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
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-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
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-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
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))
|
2020-03-10 21:42:30 +01:00
|
|
|
if (ris <= 1)
|
|
|
|
|
ris = 1
|
|
|
|
|
return ris
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public sonoMediatore() {
|
2020-05-11 22:43:54 +02:00
|
|
|
if (!this.nave)
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
|
if (!this.nave.rec.donatore.recmediatore)
|
|
|
|
|
return false
|
|
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
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
|
2020-03-10 21:42:30 +01:00
|
|
|
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
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-21 10:33:10 +01:00
|
|
|
public partenza_primo_donatore() {
|
2020-05-11 22:43:54 +02:00
|
|
|
if (!!this.nave) {
|
|
|
|
|
if (!!this.mediatore_navepers) {
|
|
|
|
|
return this.mediatore_navepers.date_gift_chat_open
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public fine_doni() {
|
2020-03-10 21:42:30 +01:00
|
|
|
if (!!this.nave) {
|
2020-03-25 18:28:39 +01:00
|
|
|
if (!!this.mediatore_navepers) {
|
|
|
|
|
return this.mediatore_navepers.date_start
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-03-21 10:33:10 +01:00
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getGiornoDelDono() {
|
|
|
|
|
if (!!this.nave) {
|
2020-05-11 22:43:54 +02:00
|
|
|
return tools.getstrDate(this.donatore_navepers.date_gift_chat_open)
|
2020-03-21 10:33:10 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get GiornoDelDonoArrivato() {
|
|
|
|
|
if (!!this.nave) {
|
2020-05-11 22:43:54 +02:00
|
|
|
return tools.isDateArrived(this.donatore_navepers.date_gift_chat_open)
|
2020-03-21 10:33:10 +01:00
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-08 13:31:44 +02:00
|
|
|
get getsuperchat(){
|
|
|
|
|
if (!!this.flotta) {
|
|
|
|
|
return this.flotta.link_superchat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-21 10:33:10 +01:00
|
|
|
get FattoDono() {
|
|
|
|
|
if (!!this.iodonatore) {
|
|
|
|
|
return this.iodonatore.made_gift
|
|
|
|
|
}
|
2020-03-10 21:42:30 +01:00
|
|
|
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
|
|
|
|
|
})
|
|
|
|
|
|
2020-06-08 13:31:44 +02:00
|
|
|
let 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
|
|
|
})
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
tools.askConfirm(this.$q, msgtitle, msginvia + ' ' + '? (Pos ' + rec.riga + '.' + rec.col + ')', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.DONO_RICEVUTO, 0, {
|
2020-03-21 10:33:10 +01:00
|
|
|
param1: {
|
|
|
|
|
_id: rec._id,
|
2020-05-10 21:06:42 +02:00
|
|
|
made_gift: true,
|
|
|
|
|
riga: rec.riga,
|
|
|
|
|
col: rec.col,
|
2020-03-21 10:33:10 +01:00
|
|
|
},
|
|
|
|
|
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,
|
2020-06-08 13:31:44 +02:00
|
|
|
date_made_gift: tools.getDateNow(),
|
|
|
|
|
commento_al_sognatore: this.commento_al_sognatore,
|
2020-03-21 10:33:10 +01:00
|
|
|
},
|
|
|
|
|
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 ''
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-08 13:31:44 +02:00
|
|
|
public getpaypalmePagamentoSognatore() {
|
|
|
|
|
const rec = this.sognatoredelDono()
|
|
|
|
|
if (!!rec) {
|
|
|
|
|
if (!!rec.profile)
|
|
|
|
|
return rec.profile.link_payment
|
|
|
|
|
}
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getnoteaggiuntivePagamentoSognatore() {
|
|
|
|
|
const rec = this.sognatoredelDono()
|
|
|
|
|
if (!!rec) {
|
|
|
|
|
if (!!rec.profile)
|
|
|
|
|
return rec.profile.note_payment
|
|
|
|
|
}
|
|
|
|
|
return ''
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-21 10:33:10 +01:00
|
|
|
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() {
|
2020-05-11 22:43:54 +02:00
|
|
|
if (!!this.nave) {
|
|
|
|
|
const mediatore = this.getmediatore()
|
|
|
|
|
if (!!this.nave.rec.donatore && !!mediatore) {
|
|
|
|
|
if (!!this.nave.rec.donatore.arrdonatori) {
|
|
|
|
|
for (const rec of this.nave.rec.donatore.arrdonatori) {
|
|
|
|
|
if (!!rec) {
|
|
|
|
|
if (mediatore) {
|
|
|
|
|
if ((mediatore.ind_order === rec.ind_order) && (rec.num_tess % 2) === 0)
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-25 09:26:08 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-21 10:33:10 +01:00
|
|
|
public sonoSognatore() {
|
|
|
|
|
return !!this.iosognatore
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
public getmediatore() {
|
2020-05-11 22:43:54 +02:00
|
|
|
if (!!this.nave) {
|
|
|
|
|
if (!!this.nave.rec.mediatore)
|
|
|
|
|
return this.nave.rec.mediatore.recmediatore
|
|
|
|
|
}
|
2020-03-21 10:33:10 +01:00
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getdonatore() {
|
|
|
|
|
if (!!this.nave.rec.donatore)
|
|
|
|
|
return this.nave.rec.donatore.recmediatore
|
|
|
|
|
return null
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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-10 21:42:30 +01:00
|
|
|
|
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)
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get linkchatopen() {
|
2020-03-25 18:28:39 +01:00
|
|
|
return this.donatore_navepers.link_chat
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
2020-05-11 22:43:54 +02:00
|
|
|
public getclassSelect(rec, sognatore, index) {
|
|
|
|
|
if (sognatore && index === 0) {
|
|
|
|
|
return ' issognatore'
|
|
|
|
|
}
|
2020-04-07 14:33:56 +02:00
|
|
|
if (rec.ind_order === this.myindorder)
|
2020-03-10 21:42:30 +01:00
|
|
|
return ' you'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public gettitlenave(ind) {
|
2020-03-31 20:34:49 +02:00
|
|
|
let ris = ''
|
2020-03-10 21:42:30 +01:00
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
return ris
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getdatanave(rec) {
|
2020-05-11 22:43:54 +02:00
|
|
|
if (!this.nave)
|
|
|
|
|
return ''
|
|
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
if (this.sonoDonatore()) {
|
|
|
|
|
if (rec.ind === 1) {
|
2020-05-11 22:43:54 +02:00
|
|
|
return tools.getstrshortDate(this.nave.date_gift_chat_open) // Donatore
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (this.sonoMediatore()) {
|
2020-05-11 22:43:54 +02:00
|
|
|
if (!rec)
|
|
|
|
|
return false
|
|
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
if (rec.ind === 4) {
|
2020-05-11 22:43:54 +02:00
|
|
|
return tools.getstrshortDate(this.nave.date_gift_chat_open) // Mediatore
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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) {
|
2020-05-11 22:43:54 +02:00
|
|
|
if (!!mynavepart.date_gift_chat_open)
|
|
|
|
|
return tools.getstrshortDate(mynavepart.date_gift_chat_open)
|
2020-03-31 20:34:49 +02:00
|
|
|
}
|
|
|
|
|
return ' --/-- '
|
|
|
|
|
// return this.getNavePartByInd(rec.ind)
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 22:43:54 +02:00
|
|
|
public getlinkchat(row) {
|
|
|
|
|
const riga = tools.getRiganave(row.riga)
|
|
|
|
|
const col = tools.getColnave(row.col)
|
|
|
|
|
|
|
|
|
|
const mynavepart = this.getnavePartenzaByRigaCol(riga, col)
|
|
|
|
|
if (!!mynavepart) {
|
|
|
|
|
if (!!mynavepart.link_chat)
|
|
|
|
|
return mynavepart.link_chat
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
public NaveeseguitabyInd(riga) {
|
|
|
|
|
return (this.riga >= riga)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getclpos(rec) {
|
2020-05-11 22:43:54 +02:00
|
|
|
if (!!this.dashboard) {
|
|
|
|
|
if (this.dashboard.lastnave.riga >= this.getrigaNaveByInd(rec.ind)) {
|
|
|
|
|
return 'you'
|
|
|
|
|
} else {
|
|
|
|
|
return ''
|
|
|
|
|
}
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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'
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-10 21:42:30 +01:00
|
|
|
if (this.rigadoni >= this.getrigaNaveByInd(rec.ind)) {
|
2020-03-31 20:34:49 +02:00
|
|
|
// return 'fas fa-gift'
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
2020-03-10 21:42:30 +01:00
|
|
|
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-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
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, {
|
2020-03-10 21:42:30 +01:00
|
|
|
param1: msgobj,
|
2020-03-25 09:26:08 +01:00
|
|
|
param2: navemediatore,
|
|
|
|
|
param3: tools.TipoMsg.SEND_LINK_CHAT_DONATORI
|
2020-03-10 21:42:30 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-21 10:33:10 +01:00
|
|
|
public InviaMsgADonatori(msgobj) {
|
2020-03-10 21:42:30 +01:00
|
|
|
|
|
|
|
|
const navemediatore = {
|
|
|
|
|
id: this.mediatore._id,
|
|
|
|
|
riga: this.mediatore.riga,
|
2020-06-02 22:19:20 +02:00
|
|
|
col: this.mediatore.col,
|
|
|
|
|
username: this.mediatore.username
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.InviaMsgANave(msgobj, navemediatore)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get linkchatesiste() {
|
2020-03-21 10:33:10 +01:00
|
|
|
if (!!this.link_chat)
|
|
|
|
|
return this.link_chat.length > 10
|
2020-03-10 21:42:30 +01:00
|
|
|
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,
|
2020-03-10 21:42:30 +01:00
|
|
|
inviareale,
|
2020-04-07 14:33:56 +02:00
|
|
|
username_mitt: ''
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
this.InviaMsgADonatori(msgobj)
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-21 10:33:10 +01:00
|
|
|
public getdatastr(mydata) {
|
|
|
|
|
return tools.getstrshortDate(mydata)
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 22:43:54 +02:00
|
|
|
public datefromto() {
|
|
|
|
|
if (this.partenza_primo_donatore() !== this.fine_doni())
|
|
|
|
|
// return this.$t('words.da') + ' ' + this.getdatastr(this.partenza_primo_donatore()) + ' ' + this.$t('words.a') + ' ' + this.getdatastr(this.fine_doni())
|
|
|
|
|
return this.getdatastr(this.partenza_primo_donatore()) + ' - ' + this.getdatastr(this.fine_doni())
|
|
|
|
|
else
|
|
|
|
|
return this.getdatastr(this.fine_doni())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public gettitlemediatore(acapo) {
|
|
|
|
|
let add = ' - '
|
|
|
|
|
if (acapo)
|
|
|
|
|
add = ' '
|
|
|
|
|
return this.datefromto() + add + this.$t('dashboard.nave') + ' ' + this.getisProvvisoriaMediatoreStr() + this.mediatore.riga + '.' + this.mediatore.col + ' ' + '🎁' + this.$t('ws.sitename')
|
2020-03-21 10:33:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public gettitledonatore() {
|
2020-05-11 22:43:54 +02:00
|
|
|
return this.getdatastr(this.donatore_navepers.date_gift_chat_open) + ' ' + this.$t('dashboard.nave') + ' ' + this.getisProvvisoriaStr() + this.donatore_navepers.riga + '.' + this.donatore_navepers.col + ' ' + '🎁' + this.$t('ws.sitename')
|
2020-03-21 10:33:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public gettesto() {
|
2020-05-11 22:43:54 +02:00
|
|
|
return this.$t('dashboard.sonomediatore', { nomenave: this.gettitlemediatore(false) })
|
2020-03-21 10:33:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
2020-05-10 21:06:42 +02:00
|
|
|
let ind_order = -1
|
2020-04-07 14:33:56 +02:00
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
public async update_nave() {
|
|
|
|
|
this.showmsguser = false
|
|
|
|
|
this.apri()
|
|
|
|
|
this.aggiorna()
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-08 13:31:44 +02:00
|
|
|
public async EseguiCallServer() {
|
|
|
|
|
this.Chiudi()
|
|
|
|
|
this.loading = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Callback() {
|
|
|
|
|
this.loading = false
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-07 14:33:56 +02:00
|
|
|
public getstrinpartenza() {
|
|
|
|
|
if (this.GiornoDelDonoArrivato) {
|
|
|
|
|
return this.$t('dashboard.nave_partita')
|
|
|
|
|
}
|
|
|
|
|
return this.$t('dashboard.nave_in_partenza')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getpartenza() {
|
|
|
|
|
let myrec = null
|
2020-05-11 22:43:54 +02:00
|
|
|
if (this.listanavi) {
|
|
|
|
|
if (!!this.nave)
|
|
|
|
|
myrec = this.nave.rec
|
|
|
|
|
} else {
|
2020-04-07 14:33:56 +02:00
|
|
|
if (!!this.posiz)
|
|
|
|
|
myrec = this.posiz.rec
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!!myrec)
|
2020-05-10 21:06:42 +02:00
|
|
|
if (!!myrec.donatore.navepersistente)
|
2020-05-11 22:43:54 +02:00
|
|
|
return tools.getstrDate(myrec.donatore.navepersistente.date_gift_chat_open)
|
2020-04-07 14:33:56 +02:00
|
|
|
|
|
|
|
|
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
|
2020-05-19 00:18:55 +02:00
|
|
|
this.username_sostituire = ''
|
|
|
|
|
this.userfreestr = ''
|
2020-04-07 14:33:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
2020-05-11 22:43:54 +02:00
|
|
|
this.showtesto = false
|
2020-04-07 14:33:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-10 21:06:42 +02:00
|
|
|
get isAdmin() {
|
|
|
|
|
return UserStore.state.isAdmin
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get isManager() {
|
|
|
|
|
return UserStore.state.isManager
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get isTutor() {
|
|
|
|
|
return UserStore.state.isTutor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get isTratuttrici() {
|
|
|
|
|
return UserStore.state.isTratuttrici
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get allowSubmit() {
|
|
|
|
|
let error = this.$v.$error || this.$v.$invalid
|
|
|
|
|
|
|
|
|
|
error = error || (this.username_sostituire === this.seluser.username_sostituire)
|
|
|
|
|
|
|
|
|
|
return !error
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get getnotifBotTxt() {
|
2020-06-08 13:31:44 +02:00
|
|
|
return this.seluser.name + ' (' + this.seluser.surname + ') è stato sostituito con ' + this.username_sostituire
|
2020-05-10 21:06:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async SostituisciUtente(user, usernamesost, notifBottxt) {
|
|
|
|
|
usernamesost = usernamesost.trim()
|
|
|
|
|
|
|
|
|
|
await tools.askConfirm(this.$q, 'Sostituisci', notifBottxt + ' ?', translate('dialog.yes'), translate('dialog.no'), this, '', lists.MenuAction.SOSTITUISCI, 0, {
|
|
|
|
|
param1: user,
|
2020-05-11 22:43:54 +02:00
|
|
|
param2: {
|
|
|
|
|
username: usernamesost,
|
|
|
|
|
username_da_sostituire: user.username,
|
|
|
|
|
riga: user.riga,
|
|
|
|
|
col: user.col,
|
|
|
|
|
notifBot: this.notifBot,
|
|
|
|
|
deleteUser: this.deleteUser,
|
|
|
|
|
AddImbarco: this.AddImbarco,
|
|
|
|
|
},
|
2020-05-10 21:06:42 +02:00
|
|
|
param3: notifBottxt
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getnavestr(row) {
|
|
|
|
|
return tools.getRiganave(row.riga) + '.' + tools.getColnave(row.col)
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 22:43:54 +02:00
|
|
|
get gettitolonave() {
|
|
|
|
|
if (this.listanavi)
|
|
|
|
|
return this.titolonave()
|
|
|
|
|
else
|
|
|
|
|
return this.$t('dashboard.tragitto')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
get getcol() {
|
|
|
|
|
if (tools.isMobile())
|
|
|
|
|
return this.coldonatori_cell
|
|
|
|
|
else
|
|
|
|
|
return this.coldonatori
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getlivellostr(index) {
|
|
|
|
|
|
|
|
|
|
let str = ''
|
|
|
|
|
str += (7 - index) + '° - '
|
|
|
|
|
if (index === 0)
|
|
|
|
|
str += this.$t('dashboard.sognatore')
|
|
|
|
|
else if ((index === 1) || (index === 2) || (index === 4) || (index === 5))
|
|
|
|
|
str += this.$t('dashboard.intermedio')
|
|
|
|
|
else if (index === 3)
|
|
|
|
|
str += this.$t('dashboard.mediatore')
|
|
|
|
|
else if (index === 6)
|
|
|
|
|
str += this.$t('dashboard.donatori')
|
|
|
|
|
|
|
|
|
|
return str
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getclasselivello(index) {
|
|
|
|
|
if (index === 0)
|
|
|
|
|
return 'sognatore'
|
|
|
|
|
else if (index === 3)
|
|
|
|
|
return 'mediatore'
|
|
|
|
|
else if (index === 6)
|
|
|
|
|
return 'donatore'
|
|
|
|
|
else
|
|
|
|
|
return 'intermedio' + index
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Mostraplacca(riga, col) {
|
|
|
|
|
const data = {
|
|
|
|
|
riga,
|
|
|
|
|
col
|
|
|
|
|
}
|
|
|
|
|
this.showtesto = true
|
|
|
|
|
this.seltesto = await GlobalStore.actions.GetData({ data })
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-19 00:18:55 +02:00
|
|
|
public async TrovaUserFree(username) {
|
|
|
|
|
|
|
|
|
|
this.ChiamaFunz(null, lists.MenuAction.DAMMI_PRIMO_UTENTE_LIBERO, null)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async ChiamaFunz(username, func, data) {
|
|
|
|
|
|
|
|
|
|
const mydatatosave = {
|
|
|
|
|
username,
|
|
|
|
|
ind_order: -1,
|
|
|
|
|
myfunc: func,
|
|
|
|
|
notifBot: null,
|
|
|
|
|
data: null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!!data) {
|
|
|
|
|
mydatatosave.data = data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.loading = true
|
|
|
|
|
|
|
|
|
|
GlobalStore.actions.askFunz({ mydata: mydatatosave }).then((ris) => {
|
|
|
|
|
this.loading = false
|
|
|
|
|
if (ris) {
|
|
|
|
|
if (func === lists.MenuAction.DAMMI_PRIMO_UTENTE_LIBERO) {
|
|
|
|
|
this.userfreestr = ris.username + ' (' + ris.name + ' ' + ris.surname + ')'
|
|
|
|
|
this.username_sostituire = ris.username
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-02 22:19:20 +02:00
|
|
|
get rendivisibile() {
|
|
|
|
|
return !this.FattoDono && !this.sonoSecondaTessituraDonatore() && !this.listanavi
|
|
|
|
|
}
|
2020-05-19 00:18:55 +02:00
|
|
|
|
2020-03-10 21:42:30 +01:00
|
|
|
}
|