- Delete Event with ask confirmation
- Fix dateStart only 1 view if is the same day - Sending a message from the Event Page: to a user or to a "Event" - Add button "Ask Info" - Starting view msg into the messagepopup component
This commit is contained in:
@@ -22,7 +22,7 @@ import QDateTimeScroller from '@quasar/quasar-app-extension-qscroller/src/compon
|
||||
import { CTodo } from '@src/components/todos/CTodo'
|
||||
import { SingleProject } from '@src/components/projects/SingleProject'
|
||||
import { IEvents } from '@src/model'
|
||||
import { IBookedEvent, IBookedEventPage, EState } from '@src/model/Calendar'
|
||||
import { IBookedEvent, IBookedEventPage, IMessagePage, EState, IMessage, IDest, IOrigin } from '@src/model/Calendar'
|
||||
import { costanti } from '@src/store/Modules/costanti'
|
||||
import router from '@router'
|
||||
import { static_data } from '@src/db/static_data'
|
||||
@@ -58,6 +58,17 @@ export default class CEventsCalendar extends Vue {
|
||||
modified: false
|
||||
}
|
||||
|
||||
public formAskForDefault: IMessage = {
|
||||
dest: {
|
||||
idapp: process.env.APP_ID,
|
||||
username: ''
|
||||
},
|
||||
origin: {
|
||||
userId: ''
|
||||
},
|
||||
message: ''
|
||||
}
|
||||
|
||||
public mioalert = false
|
||||
|
||||
public dateFormatter: any = ''
|
||||
@@ -78,10 +89,16 @@ export default class CEventsCalendar extends Vue {
|
||||
bookedevent: null,
|
||||
state: EState.None
|
||||
}
|
||||
public askInfopage: IMessagePage = {
|
||||
show: false,
|
||||
msg: null,
|
||||
state: EState.None
|
||||
}
|
||||
|
||||
public contextDay = null
|
||||
public eventForm: IEvents = { ...this.formDefault }
|
||||
public bookEventForm = { ...this.formbookEventDefault }
|
||||
public askInfoForm: IMessage = { ...this.formAskForDefault }
|
||||
public displayEvent = false
|
||||
public myevent = null
|
||||
// public events = []
|
||||
@@ -355,7 +372,6 @@ export default class CEventsCalendar extends Vue {
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
public $refs: {
|
||||
calendar: any
|
||||
}
|
||||
@@ -434,6 +450,7 @@ export default class CEventsCalendar extends Vue {
|
||||
this.myevent = eventparam
|
||||
this.bookEventForm.msgbooking = ''
|
||||
this.bookEventForm.numpeople = 1
|
||||
this.bookEventForm.booked = true
|
||||
this.bookEventpage.state = EState.Creating
|
||||
|
||||
this.displayEvent = false
|
||||
@@ -441,6 +458,28 @@ export default class CEventsCalendar extends Vue {
|
||||
}
|
||||
}
|
||||
|
||||
public askForInfoEventMenu(eventparam) {
|
||||
if (!UserStore.state.isLogged || !UserStore.state.verified_email) {
|
||||
// Visu right Toolbar to make SignIn
|
||||
GlobalStore.state.RightDrawerOpen = true
|
||||
// this.$router.push('/signin')
|
||||
} else {
|
||||
console.log('askForInfoEventMenu')
|
||||
this.askInfoForm = { ...this.formAskForDefault }
|
||||
|
||||
this.myevent = eventparam
|
||||
|
||||
this.askInfoForm = {
|
||||
message: ''
|
||||
}
|
||||
|
||||
this.askInfopage.state = EState.Creating
|
||||
|
||||
this.displayEvent = false
|
||||
this.askInfopage.show = true // show dialog
|
||||
}
|
||||
}
|
||||
|
||||
public clEvent(event: IEvents) {
|
||||
return (this.isAlreadyBooked(event) ? 'text-left bg-light-green-1' : 'text-left')
|
||||
}
|
||||
@@ -460,10 +499,7 @@ export default class CEventsCalendar extends Vue {
|
||||
}
|
||||
|
||||
public deleteEvent(eventparam) {
|
||||
const index = this.findEventIndex(eventparam)
|
||||
if (index >= 0) {
|
||||
CalendarStore.state.eventlist.splice(index, 1)
|
||||
}
|
||||
tools.CancelEvent(this, eventparam)
|
||||
}
|
||||
|
||||
public findEventIndex(eventparam) {
|
||||
@@ -514,7 +550,7 @@ export default class CEventsCalendar extends Vue {
|
||||
|
||||
const mydatatosave = {
|
||||
id: myrec._id,
|
||||
table: 'myevents',
|
||||
table: tools.TABEVENTS,
|
||||
fieldsvalue: myrec
|
||||
}
|
||||
|
||||
@@ -557,7 +593,7 @@ export default class CEventsCalendar extends Vue {
|
||||
// ++Save into the Database
|
||||
const mydatatosave = {
|
||||
id: data._id,
|
||||
table: 'myevents',
|
||||
table: tools.TABEVENTS,
|
||||
fieldsvalue: data
|
||||
}
|
||||
|
||||
@@ -565,7 +601,7 @@ export default class CEventsCalendar extends Vue {
|
||||
this.UpdateDbByFields(data, true)
|
||||
} else {
|
||||
const mydataadd = {
|
||||
table: 'myevents',
|
||||
table: tools.TABEVENTS,
|
||||
data
|
||||
}
|
||||
|
||||
@@ -623,7 +659,36 @@ export default class CEventsCalendar extends Vue {
|
||||
}
|
||||
|
||||
public sendMsg(myevent: IEvents) {
|
||||
// ..
|
||||
const self = this
|
||||
this.askInfopage.show = false
|
||||
|
||||
const data: IMessage = {
|
||||
idapp: process.env.APP_ID,
|
||||
origin: {
|
||||
userId: UserStore.state.userId,
|
||||
page: '',
|
||||
event_id: myevent._id,
|
||||
infoevent: tools.gettextevent(this, myevent)
|
||||
},
|
||||
dest: {
|
||||
idapp: process.env.APP_ID,
|
||||
username: myevent.teacher
|
||||
},
|
||||
read: false,
|
||||
deleted: false,
|
||||
message: this.askInfoForm.message,
|
||||
datemsg: tools.getDateNow()
|
||||
}
|
||||
|
||||
this.SendMsgEvent(data).then((ris) => {
|
||||
self.contextDay = null
|
||||
if (ris)
|
||||
tools.showPositiveNotif(self.$q, self.$t('cal.sendmsg_sent'))
|
||||
else
|
||||
tools.showNegativeNotif(self.$q, self.$t('cal.sendmsg_error'))
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
public saveBookEvent(myevent: IEvents) {
|
||||
@@ -772,6 +837,10 @@ export default class CEventsCalendar extends Vue {
|
||||
return await CalendarStore.actions.BookEvent(eventparam)
|
||||
}
|
||||
|
||||
public async SendMsgEvent(param: IMessage) {
|
||||
return await UserStore.actions.SendMsgEvent(param)
|
||||
}
|
||||
|
||||
public isAlreadyBooked(eventparam: IEvents) {
|
||||
return CalendarStore.getters.findEventBooked(eventparam, true)
|
||||
}
|
||||
@@ -961,6 +1030,8 @@ export default class CEventsCalendar extends Vue {
|
||||
// check if event is in the past
|
||||
const datenow = tools.addDays(tools.getDateNow(), -1)
|
||||
|
||||
return (myevent.dateTimeEnd >= datenow)
|
||||
// console.log('datenow', datenow, 'end', myevent.dateTimeEnd)
|
||||
|
||||
return (new Date(myevent.dateTimeEnd) >= datenow)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,23 +74,9 @@
|
||||
</q-chip>
|
||||
</div>
|
||||
<div v-if="myevent.dateTimeStart" class="cal__when">
|
||||
<span class="cal__where-title">{{$t('cal.when')}}: </span>
|
||||
<span class="cal__where-content">{{ tools.getstrDate(myevent.dateTimeStart)}} - {{ tools.getstrDate(myevent.dateTimeEnd)}}</span>
|
||||
|
||||
<span v-if="myevent.infoextra" class="cal__hours">
|
||||
<span class="cal__hours-title">{{$t('cal.hours')}}: </span>
|
||||
<span class="cal__hours-content">{{ myevent.infoextra }} </span>
|
||||
</span>
|
||||
<span v-else>
|
||||
<span v-if="!tools.hasManyDays(myevent.dateTimeStart, myevent.dateTimeEnd)"
|
||||
class="cal__hours">
|
||||
-
|
||||
<span class="cal__hours-title">{{$t('cal.hours')}}: </span>
|
||||
<span class="cal__hours-content">{{$t('cal.starttime')}} {{ tools.getstrTime(myevent.dateTimeStart) }}
|
||||
<span v-if="myevent.dateTimeEnd">{{ $t('cal.endtime')}}: {{ tools.getstrTime(myevent.dateTimeEnd) }}</span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span class="cal__where-title">{{$t('cal.when')}}:
|
||||
<span v-html="tools.getstrDateTimeEvent(mythis, myevent, true)"></span>
|
||||
</span>
|
||||
</div>
|
||||
<p v-if="myevent.linkpdf" style="margin-top: 10px; text-align: center">
|
||||
<q-btn size="md" type="a" :href="`../../statics/` + myevent.linkpdf"
|
||||
@@ -307,29 +293,9 @@
|
||||
{{myevent.title}}
|
||||
</q-chip>
|
||||
<div v-if="myevent.dateTimeStart" class="cal__when">
|
||||
<span class="cal__where-title">{{$t('cal.when')}}: </span>
|
||||
<span class="cal__where-content">{{func_tools.getDateStr(myevent.dateTimeStart)}}</span>
|
||||
<span v-if="tools.hasManyDays(myevent.dateTimeStart)" class="cal__where-content"> - {{func_tools.getDateStr(myevent.dateTimeEnd)}}<br/></span>
|
||||
<span v-if="myevent.infoextra" class="cal__hours">
|
||||
<span class="cal__hours-title">{{$t('cal.hours')}}: </span>
|
||||
<span class="cal__hours-content">{{ myevent.infoextra }} </span>
|
||||
</span>
|
||||
<span v-else>
|
||||
<span v-if="!tools.hasManyDays(myevent.dateTimeStart, myevent.dateTimeEnd)"
|
||||
class="cal__hours">
|
||||
-
|
||||
<span class="cal__hours-title">{{$t('cal.hours')}}: </span>
|
||||
<span class="cal__hours-content"><span v-if="!tools.isMobile()">{{$t('cal.starttime')}} </span>{{ tools.getstrTime(myevent.dateTimeStart) }}
|
||||
<span v-if="myevent.dateTimeEnd">
|
||||
<span v-if="!tools.isMobile()">
|
||||
{{$t('cal.endtime')}}
|
||||
</span>
|
||||
<span v-else> - </span>
|
||||
{{ tools.getstrTime(myevent.dateTimeEnd) }}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span class="cal__where-title">{{$t('cal.when')}}:
|
||||
<span v-html="tools.getstrDateTimeEvent(mythis, myevent, true)"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="q-pa-xs">
|
||||
<q-card class="text-white windowcol">
|
||||
@@ -369,7 +335,7 @@
|
||||
<q-btn v-if="bookEventpage.state === EState.Modifying" flat :label="$t('cal.cancelbooking')"
|
||||
color="negative"
|
||||
@click="tools.CancelBookingEvent(mythis, myevent, bookEventForm._id, true)"></q-btn>
|
||||
<q-btn v-if="checkseinviaMsg" flat :label="$t('dialog.sendmsg')" color="primary"
|
||||
<q-btn v-if="checkseinviaMsg" flat :label="$t('dialog.sendonlymsg')" color="primary"
|
||||
@click="sendMsg(myevent)"></q-btn>
|
||||
<q-btn v-else flat :label="getTitleBtnBooking" color="primary" @click="saveBookEvent(myevent)"
|
||||
:disable="!(bookEventpage.state === EState.Creating || hasModifiedBooking)"></q-btn>
|
||||
@@ -380,6 +346,53 @@
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<q-dialog v-model="askInfopage.show" no-backdrop-dismiss>
|
||||
<q-card v-if="askInfopage.show" :style="`min-width: `+ tools.myheight_dialog() + `px;`">
|
||||
<q-toolbar class="bg-primary text-white">
|
||||
<q-toolbar-title>
|
||||
{{$t('cal.booking')}}
|
||||
</q-toolbar-title>
|
||||
<q-btn flat round color="white" icon="close" v-close-popup></q-btn>
|
||||
</q-toolbar>
|
||||
|
||||
<q-card-section class="inset-shadow">
|
||||
<q-img :src="getImgEvent(myevent)"
|
||||
class="absolute-top"
|
||||
style="height: 150px;">
|
||||
</q-img>
|
||||
<div style="margin-top: 150px;">
|
||||
|
||||
<q-chip
|
||||
:style="`background-color: ${myevent.bgcolor} !important; color: white !important;`"
|
||||
text-color="white"
|
||||
class="shadow-5 q-mb-md" dense>
|
||||
{{myevent.title}}
|
||||
</q-chip>
|
||||
<div v-if="myevent.dateTimeStart" class="cal__when">
|
||||
<span class="cal__where-title">{{$t('cal.when')}}:
|
||||
<span v-html="tools.getstrDateTimeEvent(mythis, myevent, true)"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="q-pa-xs">
|
||||
<q-card class="text-white windowcol">
|
||||
<q-card-section>
|
||||
<q-input v-model="askInfoForm.message" :label="$t('cal.msgbooking')+':'"
|
||||
autogrow>
|
||||
</q-input>
|
||||
</q-card-section>
|
||||
</q-card>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</q-card-section>
|
||||
<q-card-actions align="right">
|
||||
<q-btn flat :label="$t('dialog.sendmsg')" color="primary"
|
||||
@click="sendMsg(myevent)"></q-btn>
|
||||
<q-btn flat :label="$t('dialog.cancel')" color="primary" v-close-popup></q-btn>
|
||||
</q-card-actions>
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<!--v-touch-swipe.mouse.left.right="handleSwipe" -->
|
||||
|
||||
<!-- the calendar -->
|
||||
@@ -547,17 +560,7 @@
|
||||
|
||||
</p>
|
||||
<div class="listaev__date listaev__align_center_mobile">
|
||||
|
||||
<div v-if="event.infoextra">
|
||||
<span class="listaev__date">{{func_tools.getDateStr(event.dateTimeStart)}} - <span
|
||||
class="cal__hours-content">{{ event.infoextra }}</span> </span>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div v-if="event.dateTimeStart" class="listaev__date">
|
||||
{{tools.getstrDateTime(event.dateTimeStart)}} -
|
||||
{{tools.getstrDateTime(event.dateTimeEnd)}}
|
||||
</div>
|
||||
</div>
|
||||
<span v-html="tools.getstrDateTimeEvent(mythis, event, true)"></span>
|
||||
</div>
|
||||
|
||||
<div class="listaev__align_center_mobile">
|
||||
@@ -649,12 +652,16 @@
|
||||
</span>
|
||||
</p>
|
||||
<div class="row justify-end">
|
||||
<q-btn rounded outline
|
||||
<q-btn rounded outline class="q-mx-sm"
|
||||
color="primary" @click="askForInfoEventMenu(event)"
|
||||
:label="$t('event.askinfo')">
|
||||
</q-btn>
|
||||
<q-btn rounded outline class="q-mx-sm"
|
||||
v-if="!event.nobookable && !isAlreadyBooked(event) && static_data.functionality.BOOKING_EVENTS"
|
||||
color="primary" @click="addBookEventMenu(event)"
|
||||
:label="$t('cal.booking')" :disable="!isEventEnabled(event)">
|
||||
</q-btn>
|
||||
<q-btn rounded outline
|
||||
<q-btn rounded outline class="q-mx-sm"
|
||||
v-if="!event.nobookable && isAlreadyBooked(event) && static_data.functionality.BOOKING_EVENTS"
|
||||
text-color="red"
|
||||
@click.native="EditBookEvent(event)"
|
||||
|
||||
@@ -93,9 +93,7 @@
|
||||
</q-btn-dropdown>
|
||||
|
||||
|
||||
<!--
|
||||
<message-popover></message-popover>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<div class="right-itens">
|
||||
|
||||
Reference in New Issue
Block a user