CEventsCalendar.ts
calendarioeventi.ts CMySingleEvent.ts evento.ts
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Api } from '@api'
|
||||
import { IBookedEvent, ICalendarState, IEvents } from 'model'
|
||||
import { IBookedEvent, ICalendarState, IEvents, IOperators } from 'model'
|
||||
|
||||
import { serv_constants } from './Modules/serv_constants'
|
||||
import { tools } from './Modules/tools'
|
||||
@@ -84,25 +84,6 @@ export const useCalendarStore = defineStore('CalendarStore', {
|
||||
|
||||
},
|
||||
|
||||
getOperatorByUsername: (mystate: ICalendarState) => (username: string) => {
|
||||
const ctrec = mystate.operators.find((rec) => rec.username === username)
|
||||
return (ctrec)
|
||||
|
||||
},
|
||||
|
||||
getImgTeacherByUsername: (mystate: ICalendarState) => (username: string): string => {
|
||||
if (username === '')
|
||||
return ''
|
||||
// Check if is this User!
|
||||
// @ts-ignore
|
||||
const myop = this.getOperatorByUsername(username)
|
||||
if (myop && !!myop.img && myop.img !== '' && myop.img !== 'undefined') {
|
||||
return myop.img
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
|
||||
getContribtypeById: (mystate: ICalendarState) => (id: string) => {
|
||||
const ctrec = mystate.contribtype.find((mycontr) => mycontr._id === id)
|
||||
return (ctrec) ? ctrec.label : ''
|
||||
@@ -117,6 +98,23 @@ export const useCalendarStore = defineStore('CalendarStore', {
|
||||
},
|
||||
actions: {
|
||||
|
||||
getOperatorByUsername (username: string): IOperators | undefined {
|
||||
const ctrec = this.operators.find((rec: IOperators) => rec.username === username)
|
||||
return ctrec
|
||||
},
|
||||
|
||||
getImgTeacherByUsername(username: string): string {
|
||||
if (username === '')
|
||||
return ''
|
||||
// Check if is this User!
|
||||
const myop = this.getOperatorByUsername(username)
|
||||
if (myop && !!myop.img && myop.img !== '' && myop.img !== 'undefined') {
|
||||
return myop.img
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
|
||||
getparambyevent(bookevent: IBookedEvent) {
|
||||
const userStore = useUserStore()
|
||||
return {
|
||||
@@ -135,7 +133,7 @@ export const useCalendarStore = defineStore('CalendarStore', {
|
||||
}
|
||||
},
|
||||
|
||||
async BookEvent( bookevent: IBookedEvent) {
|
||||
async BookEvent(bookevent: IBookedEvent) {
|
||||
console.log('BookEvent', bookevent)
|
||||
|
||||
const param = this.getparambyevent(bookevent)
|
||||
@@ -167,12 +165,20 @@ export const useCalendarStore = defineStore('CalendarStore', {
|
||||
|
||||
},
|
||||
|
||||
async CancelEvent( { id }: { id: string }) {
|
||||
async CancelEvent({ id }: {id: string}) {
|
||||
const globalStore = useGlobalStore()
|
||||
return globalStore.DeleteRec({ table: costanti.TABEVENTS, id })
|
||||
},
|
||||
|
||||
async CancelBookingEvent( { ideventbook, notify }: { ideventbook: string, notify: string }) {
|
||||
intervalStart() {
|
||||
return this.intervalRange.min * (1 / this.intervalRangeStep)
|
||||
},
|
||||
|
||||
intervalCount() {
|
||||
return (this.intervalRange.max - this.intervalRange.min) * (1 / this.intervalRangeStep)
|
||||
},
|
||||
|
||||
async CancelBookingEvent({ ideventbook, notify }: {ideventbook: string, notify: string}) {
|
||||
console.log('CALSTORE: CancelBookingEvent', ideventbook, notify)
|
||||
|
||||
return Api.SendReq('/booking/' + ideventbook + '/' + notify + '/' + process.env.APP_ID, 'DELETE', null)
|
||||
|
||||
@@ -2288,29 +2288,29 @@ export const tools = {
|
||||
}
|
||||
},
|
||||
|
||||
getstrDateTimeEvent(mythis: any, myevent: IEvents, withhtml: boolean) {
|
||||
getstrDateTimeEvent($t: any, myevent: IEvents, withhtml: boolean) {
|
||||
let mystr = ''
|
||||
// is same day?
|
||||
if (this.getstrDate(myevent.dateTimeStart) === this.getstrDate(myevent.dateTimeEnd)) {
|
||||
if (withhtml) {
|
||||
mystr += `<span class="cal__where-content">${this.getstrDateLong(myevent.dateTimeStart)}</span>
|
||||
<span class="cal__hours-content">${mythis.$t('cal.starttime')} ${this.getstrTime(myevent.dateTimeStart)}
|
||||
${mythis.$t('cal.endtime')} ${this.getstrTime(myevent.dateTimeEnd)}`
|
||||
<span class="cal__hours-content">${$t('cal.starttime')} ${this.getstrTime(myevent.dateTimeStart)}
|
||||
${$t('cal.endtime')} ${this.getstrTime(myevent.dateTimeEnd)}`
|
||||
} else {
|
||||
mystr = `${this.getstrDateLong(myevent.dateTimeStart)}
|
||||
${mythis.$t('cal.starttime')} ${this.getstrTime(myevent.dateTimeStart)}
|
||||
${mythis.$t('cal.endtime')} ${this.getstrTime(myevent.dateTimeEnd)}`
|
||||
${$t('cal.starttime')} ${this.getstrTime(myevent.dateTimeStart)}
|
||||
${$t('cal.endtime')} ${this.getstrTime(myevent.dateTimeEnd)}`
|
||||
}
|
||||
} else {
|
||||
mystr = `<span class="cal__where-content">${this.getstrDateLong(myevent.dateTimeStart)}</span>
|
||||
<span class="cal__hours-content">${mythis.$t('cal.starttime')} ${this.getstrTime(myevent.dateTimeStart)} </span>
|
||||
${mythis.$t('cal.enddate')} ${this.getstrDateLong(myevent.dateTimeEnd)}
|
||||
<span class="cal__hours-content">${mythis.$t('cal.endtime')} ${this.getstrTime(myevent.dateTimeEnd)} </span>`
|
||||
<span class="cal__hours-content">${$t('cal.starttime')} ${this.getstrTime(myevent.dateTimeStart)} </span>
|
||||
${$t('cal.enddate')} ${this.getstrDateLong(myevent.dateTimeEnd)}
|
||||
<span class="cal__hours-content">${$t('cal.endtime')} ${this.getstrTime(myevent.dateTimeEnd)} </span>`
|
||||
}
|
||||
|
||||
if (myevent.infoextra) {
|
||||
mystr += `<span class="cal__hours">
|
||||
<span class="cal__hours-title">${mythis.$t('cal.hours')}: </span>
|
||||
<span class="cal__hours-title">${$t('cal.hours')}: </span>
|
||||
<span class="cal__hours-content">${myevent.infoextra} </span>
|
||||
</span>
|
||||
</span>`
|
||||
|
||||
Reference in New Issue
Block a user