CEventsCalendar.ts
calendarioeventi.ts CMySingleEvent.ts evento.ts
This commit is contained in:
95
src/components/CMySingleEvent/CMySingleEvent.ts
Executable file
95
src/components/CMySingleEvent/CMySingleEvent.ts
Executable file
@@ -0,0 +1,95 @@
|
||||
import { defineComponent, PropType, ref } from 'vue'
|
||||
|
||||
import { Logo } from '../../components/logo/index'
|
||||
|
||||
import { Footer } from '../../components/Footer/index'
|
||||
|
||||
import { tools } from '../../store/Modules/tools'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
|
||||
import { CImgText } from '../../components/CImgText/index'
|
||||
import { CCard, CMyAvatar, CMyTeacher, CMyPage } from '@components'
|
||||
import { IEvents, IOperators } from '@src/model'
|
||||
import MixinEvents from '@/mixins/mixin-events'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CMySingleEvent',
|
||||
components: { Logo, Footer, CImgText, CCard, CMyPage, CMyAvatar, CMyTeacher },
|
||||
props: {
|
||||
myevent: {
|
||||
type: Object as PropType<IEvents>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
setup(props, { emit }) {
|
||||
|
||||
const selected = ref(false)
|
||||
|
||||
const { isShowPrice, getImgEvent, getStyleByEvent, isAlreadyBooked, getWhereIcon, getWhereName,
|
||||
editable, getContribtypeById, getPrice, isEventEnabled, findEventIndex, UpdateDbByFields,
|
||||
} = MixinEvents()
|
||||
|
||||
function selectEvent(eventparam: IEvents) {
|
||||
selected.value = !selected.value
|
||||
}
|
||||
|
||||
function getTextEvent(myevent: IEvents) {
|
||||
if (myevent.bodytext === '') {
|
||||
return myevent.details
|
||||
} else {
|
||||
return myevent.bodytext
|
||||
}
|
||||
}
|
||||
|
||||
function duplicateEvent(event: any, numgg: number) {
|
||||
emit('duplicateEvent', event, numgg)
|
||||
}
|
||||
|
||||
function askForInfoEventMenu(event: any) {
|
||||
emit('askForInfoEventMenu', event)
|
||||
}
|
||||
|
||||
function deleteEvent(event: any) {
|
||||
emit('deleteEvent', event)
|
||||
}
|
||||
|
||||
function editEvent(event: any) {
|
||||
emit('editEvent', event)
|
||||
}
|
||||
|
||||
function addBookEventMenu(event: any) {
|
||||
emit('addBookEventMenu', event)
|
||||
}
|
||||
|
||||
function EditBookEvent(event: any) {
|
||||
emit('EditBookEvent', event)
|
||||
}
|
||||
|
||||
return {
|
||||
EditBookEvent,
|
||||
addBookEventMenu,
|
||||
editEvent,
|
||||
deleteEvent,
|
||||
askForInfoEventMenu,
|
||||
duplicateEvent,
|
||||
getTextEvent,
|
||||
tools,
|
||||
static_data,
|
||||
selectEvent,
|
||||
getImgEvent,
|
||||
getStyleByEvent,
|
||||
isAlreadyBooked,
|
||||
getWhereIcon,
|
||||
getWhereName,
|
||||
editable,
|
||||
getContribtypeById,
|
||||
getPrice,
|
||||
isShowPrice,
|
||||
isEventEnabled,
|
||||
findEventIndex,
|
||||
UpdateDbByFields,
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
@@ -1,85 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import { Component, Prop, Watch } from 'vue-property-decorator'
|
||||
import { CalendarStore, GlobalStore, UserStore } from '@store'
|
||||
|
||||
import { Logo } from '../../components/logo/index'
|
||||
|
||||
import { Footer } from '../../components/Footer/index'
|
||||
|
||||
import { tools } from '../../store/Modules/tools'
|
||||
import { toolsext } from '@src/store/Modules/toolsext'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
import { Screen } from 'quasar'
|
||||
|
||||
import { CImgText } from '../../components/CImgText/index'
|
||||
import { CCard, CMyAvatar, CMyTeacher, CMyPage } from '@components'
|
||||
import MixinOperator from '@src/mixins/mixin-operator'
|
||||
import MixinEvents from '../../mixins/mixin-events'
|
||||
import { IEvents } from '@src/model'
|
||||
import MixinBase from '@src/mixins/mixin-base'
|
||||
import MixinUsers from '@src/mixins/mixin-users'
|
||||
|
||||
@Component({
|
||||
name: 'CMySingleEvent',
|
||||
mixins: [MixinOperator, MixinBase, MixinEvents, MixinUsers],
|
||||
components: { Logo, Footer, CImgText, CCard, CMyPage, CMyAvatar, CMyTeacher }
|
||||
})
|
||||
export default class CMySingleEvent extends MixinEvents {
|
||||
@Prop({ required: true }) public myevent: IEvents
|
||||
public $q
|
||||
public $t
|
||||
public selected: boolean = false
|
||||
|
||||
get mythis() {
|
||||
return this
|
||||
}
|
||||
|
||||
set mythis(aa) {
|
||||
|
||||
}
|
||||
|
||||
public selectEvent(eventparam: IEvents) {
|
||||
this.selected = !this.selected
|
||||
}
|
||||
|
||||
public getTextEvent(myevent: IEvents) {
|
||||
if (myevent.bodytext === '') {
|
||||
return myevent.details
|
||||
} else {
|
||||
return myevent.bodytext
|
||||
}
|
||||
}
|
||||
|
||||
public mounted() {
|
||||
// console.log('MYSINGLEEVENT: myevent', this.myevent)
|
||||
}
|
||||
|
||||
get static_data() {
|
||||
return static_data
|
||||
}
|
||||
|
||||
public duplicateEvent(event, numgg) {
|
||||
this.$emit('duplicateEvent', event, numgg)
|
||||
}
|
||||
|
||||
public askForInfoEventMenu(event) {
|
||||
this.$emit('askForInfoEventMenu', event)
|
||||
}
|
||||
|
||||
public deleteEvent(event) {
|
||||
this.$emit('deleteEvent', event)
|
||||
}
|
||||
|
||||
public editEvent(event) {
|
||||
this.$emit('editEvent', event)
|
||||
}
|
||||
|
||||
public addBookEventMenu(event) {
|
||||
this.$emit('addBookEventMenu', event)
|
||||
}
|
||||
|
||||
public EditBookEvent(event) {
|
||||
this.$emit('EditBookEvent', event)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
<template>
|
||||
<div>
|
||||
<CMyPage
|
||||
v-if="myevent" :imgbackground="myevent.img" :title="myevent.title" keywords="" description=""
|
||||
nofooter="true">
|
||||
v-if="myevent" :imgbackground="myevent.img" :title="myevent.title" keywords="" description=""
|
||||
nofooter="true">
|
||||
|
||||
<div class="q-mx-md">
|
||||
<div class="listaev__align_chips q-ma-md">
|
||||
<img
|
||||
:src="getImgEvent(myevent)"
|
||||
@click="selectEvent(myevent)"
|
||||
class="text-left padding_cell listaev__tdimg listaev__singleevimg cursor-pointer"
|
||||
:style="getStyleByEvent(myevent, true)"
|
||||
:alt="myevent.title">
|
||||
:src="getImgEvent(myevent)"
|
||||
@click="selectEvent(myevent)"
|
||||
class="text-left padding_cell listaev__tdimg listaev__singleevimg cursor-pointer"
|
||||
:style="getStyleByEvent(myevent, true)"
|
||||
:alt="myevent.title">
|
||||
<q-chip
|
||||
dense v-if="isAlreadyBooked(myevent)" class="cltexth4 chipbooked shadow-5 q-mb-md"
|
||||
color="green" text-color="white"
|
||||
icon="event_available">{{ $t('cal.booked') }}
|
||||
dense v-if="isAlreadyBooked(myevent)" class="cltexth4 chipbooked shadow-5 q-mb-md"
|
||||
color="green" text-color="white"
|
||||
icon="event_available">{{ $t('cal.booked') }}
|
||||
</q-chip>
|
||||
<div v-if="selected">
|
||||
<q-chip v-if="editable" class="text-center shadow-5 glossy bg-blue chipmodif">
|
||||
@@ -38,27 +38,27 @@ dense v-if="isAlreadyBooked(myevent)" class="cltexth4 chipbooked shadow-5 q-mb-m
|
||||
</q-menu>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-if="editable" flat round color="white" icon="delete" v-close-popup
|
||||
@click="deleteEvent(myevent)"></q-btn>
|
||||
v-if="editable" flat round color="white" icon="delete" v-close-popup
|
||||
@click="deleteEvent(myevent)"></q-btn>
|
||||
<q-btn
|
||||
v-if="editable" flat round color="white" icon="edit" v-close-popup
|
||||
@click="editEvent(myevent)"></q-btn>
|
||||
v-if="editable" flat round color="white" icon="edit" v-close-popup
|
||||
@click="editEvent(myevent)"></q-btn>
|
||||
<q-btn
|
||||
v-if="editable" flat round color="white" icon="cancel"
|
||||
@click="selectEvent(null)"></q-btn>
|
||||
v-if="editable" flat round color="white" icon="cancel"
|
||||
@click="selectEvent(null)"></q-btn>
|
||||
</q-chip>
|
||||
</div>
|
||||
<q-chip
|
||||
v-if="myevent.news" class="cltexth4 chipnews shadow-5 glossy text-right" color="red"
|
||||
text-color="white" icon-right="star" icon="star" dense
|
||||
style="">
|
||||
v-if="myevent.news" class="cltexth4 chipnews shadow-5 glossy text-right" color="red"
|
||||
text-color="white" icon-right="star" icon="star" dense
|
||||
style="">
|
||||
{{ $t('event.news') }}
|
||||
</q-chip>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="listaev__date listaev__align_center_mobile">
|
||||
<span v-html="tools.getstrDateTimeEvent(mythis, myevent, true)"></span>
|
||||
<span v-html="tools.getstrDateTimeEvent($t, myevent, true)"></span>
|
||||
</div>
|
||||
|
||||
<div class="listaev__align_center_mobile">
|
||||
@@ -68,25 +68,25 @@ v-if="myevent.news" class="cltexth4 chipnews shadow-5 glossy text-right" color="
|
||||
<div class="q-pa-sm q-gutter-md text-center">
|
||||
<!-- Se c'è un link, allora -->
|
||||
<q-btn
|
||||
class="text-center boldhigh" v-if="myevent.linkpdf" size="md" type="a"
|
||||
:href="`../../public/` + myevent.linkpdf"
|
||||
target="_blank"
|
||||
ripple rounded :label="myevent.title"
|
||||
:color="myevent.bgcolor" text-color="white" glossy>
|
||||
class="text-center boldhigh" v-if="myevent.linkpdf" size="md" type="a"
|
||||
:href="`../../public/` + myevent.linkpdf"
|
||||
target="_blank"
|
||||
ripple rounded :label="myevent.title"
|
||||
:color="myevent.bgcolor" text-color="white" glossy>
|
||||
|
||||
</q-btn>
|
||||
<!-- altrimenti mostra solo Chip -->
|
||||
<div
|
||||
v-else-if="tools.isMobile()" class="cltexth3 text-center boldhigh"
|
||||
:style="`background-color: ${myevent.bgcolor} !important; color: white !important;`">
|
||||
v-else-if="tools.isMobile()" class="cltexth3 text-center boldhigh"
|
||||
:style="`background-color: ${myevent.bgcolor} !important; color: white !important;`">
|
||||
{{ myevent.title }}
|
||||
</div>
|
||||
<q-chip
|
||||
v-else class="cltexth3 text-center boldhigh"
|
||||
icon="bookmark"
|
||||
:style="`background-color: ${myevent.bgcolor} !important; color: white !important;`"
|
||||
text-color="white"
|
||||
dense>{{ myevent.title }}
|
||||
v-else class="cltexth3 text-center boldhigh"
|
||||
icon="bookmark"
|
||||
:style="`background-color: ${myevent.bgcolor} !important; color: white !important;`"
|
||||
text-color="white"
|
||||
dense>{{ myevent.title }}
|
||||
</q-chip>
|
||||
</div>
|
||||
|
||||
@@ -121,8 +121,8 @@ v-else class="cltexth3 text-center boldhigh"
|
||||
alt="località">
|
||||
</q-avatar>
|
||||
<q-avatar
|
||||
v-else color="blue" font-size="20px" text-color="white"
|
||||
icon="home">
|
||||
v-else color="blue" font-size="20px" text-color="white"
|
||||
icon="home">
|
||||
</q-avatar>
|
||||
<span
|
||||
class="cal__teacher-content">{{ getWhereName(myevent.wherecode) }}</span>
|
||||
@@ -142,8 +142,8 @@ v-else color="blue" font-size="20px" text-color="white"
|
||||
</span>
|
||||
|
||||
<q-chip
|
||||
v-if="myevent.price && isShowPrice(myevent)" class="glossy" color="orange"
|
||||
text-color="white" icon-right="star">
|
||||
v-if="myevent.price && isShowPrice(myevent)" class="glossy" color="orange"
|
||||
text-color="white" icon-right="star">
|
||||
<span class="cal__quota-content">{{ getPrice(myevent) }}</span>
|
||||
</q-chip>
|
||||
</div>
|
||||
@@ -151,11 +151,11 @@ v-if="myevent.price && isShowPrice(myevent)" class="glossy" color="orange"
|
||||
|
||||
<div class="row justify-start q-ma-md">
|
||||
<q-btn
|
||||
v-if="myevent.linkpdf"
|
||||
size="md" type="a" :href="`../../public/` + myevent.linkpdf"
|
||||
target="_blank" rounded outline
|
||||
color="primary" icon="info"
|
||||
:label="$t('cal.showpdf')">
|
||||
v-if="myevent.linkpdf"
|
||||
size="md" type="a" :href="`../../public/` + myevent.linkpdf"
|
||||
target="_blank" rounded outline
|
||||
color="primary" icon="info"
|
||||
:label="$t('cal.showpdf')">
|
||||
|
||||
</q-btn>
|
||||
<!--<q-btn v-if="myevent.bodytext" rounded outline class="q-mx-sm"
|
||||
@@ -166,22 +166,22 @@ v-if="myevent.linkpdf"
|
||||
</div>
|
||||
<div class="row text-center">
|
||||
<q-btn
|
||||
rounded outline class="q-mx-sm"
|
||||
color="primary" @click="askForInfoEventMenu(myevent)"
|
||||
:label="$t('event.askinfo')">
|
||||
rounded outline class="q-mx-sm"
|
||||
color="primary" @click="askForInfoEventMenu(myevent)"
|
||||
:label="$t('event.askinfo')">
|
||||
</q-btn>
|
||||
<q-btn
|
||||
rounded class="q-mx-sm"
|
||||
v-if="!myevent.nobookable && !isAlreadyBooked(myevent) && static_data.functionality.BOOKING_EVENTS"
|
||||
color="primary" @click="addBookEventMenu(myevent)"
|
||||
:label="$t('cal.booking')" :disable="!isEventEnabled(myevent)">
|
||||
rounded class="q-mx-sm"
|
||||
v-if="!myevent.nobookable && !isAlreadyBooked(myevent) && static_data.functionality.BOOKING_EVENTS"
|
||||
color="primary" @click="addBookEventMenu(myevent)"
|
||||
:label="$t('cal.booking')" :disable="!isEventEnabled(myevent)">
|
||||
</q-btn>
|
||||
<q-btn
|
||||
rounded outline class="q-mx-sm"
|
||||
v-if="!myevent.nobookable && isAlreadyBooked(myevent) && static_data.functionality.BOOKING_EVENTS"
|
||||
text-color="red"
|
||||
@click="EditBookEvent(myevent)"
|
||||
:label="$t('cal.modifybooking')">
|
||||
rounded outline class="q-mx-sm"
|
||||
v-if="!myevent.nobookable && isAlreadyBooked(myevent) && static_data.functionality.BOOKING_EVENTS"
|
||||
text-color="red"
|
||||
@click="EditBookEvent(myevent)"
|
||||
:label="$t('cal.modifybooking')">
|
||||
</q-btn>
|
||||
<br>
|
||||
<!--
|
||||
Reference in New Issue
Block a user