show recurrent events while creating a new one
This commit is contained in:
parent
ce3fd08c22
commit
80d9b7fc4d
3 changed files with 5 additions and 30 deletions
|
@ -273,39 +273,14 @@ export default {
|
||||||
attributes.push ({ key: 'today', dates: new Date(), highlight: { color: 'yellow' }})
|
attributes.push ({ key: 'today', dates: new Date(), highlight: { color: 'yellow' }})
|
||||||
|
|
||||||
attributes = attributes.concat(this.filteredEvents
|
attributes = attributes.concat(this.filteredEvents
|
||||||
.filter(e => !e.multidate && !e.recurrent)
|
.filter(e => !e.multidate && (!e.recurrent || this.event.type === 'recurrent'))
|
||||||
.map(e => ({ key: e.id, dot: {}, dates: moment.unix(e.start_datetime).toDate()})))
|
.map(e => ({ key: e.id, dot: { color: this.event.type === 'recurrent' ? 'orange' : 'green' }, dates: moment.unix(e.start_datetime).toDate()})))
|
||||||
|
|
||||||
attributes = attributes.concat(this.filteredEvents
|
attributes = attributes.concat(this.filteredEvents
|
||||||
.filter(e => e.multidate && !e.recurrent)
|
.filter(e => e.multidate && !e.recurrent)
|
||||||
.map( e => ({ key: e.id, highlight: {}, dates: {
|
.map( e => ({ key: e.id, highlight: {}, dates: {
|
||||||
start: moment.unix(e.start_datetime).toDate(), end: moment.unix(e.end_datetime).toDate() }})))
|
start: moment.unix(e.start_datetime).toDate(), end: moment.unix(e.end_datetime).toDate() }})))
|
||||||
|
|
||||||
if (this.event.type === 'recurrent' && this.event.recurrent.frequency) {
|
|
||||||
const recurrent = {}
|
|
||||||
const frequency = this.event.recurrent.frequency
|
|
||||||
if (Array.isArray(this.date) && (frequency === '1w' || frequency === '2w')) {
|
|
||||||
recurrent.weekdays = uniq(map(this.date, d => moment(d).day()+1 ))
|
|
||||||
recurrent.weeklyInterval = frequency[0]*1
|
|
||||||
recurrent.start = new Date(this.date[0])
|
|
||||||
} else if (Array.isArray(this.date) && (frequency === '1m' || frequency === '2m')) {
|
|
||||||
if (!this.date || !this.date.length) return attributes
|
|
||||||
if (this.event.recurrent.type === 'weekday') {
|
|
||||||
const days = uniq(map(this.date, d => moment(d).date()))
|
|
||||||
const n = Math.floor((days[0]-1)/7)+1
|
|
||||||
recurrent.ordinalWeekdays = { [n]: this.date.map(d => moment(d).day()+1) }
|
|
||||||
} else if (this.event.recurrent.type === 'ordinal') {
|
|
||||||
recurrent.days = uniq(map(this.date, d => moment(d).date()))
|
|
||||||
}
|
|
||||||
recurrent.monthlyInterval = frequency[0]*1
|
|
||||||
recurrent.start = new Date(this.date[0])
|
|
||||||
} else if (this.event.recurrent.frequency === '1d') {
|
|
||||||
recurrent.dailyInterval = 1
|
|
||||||
} else {
|
|
||||||
return attributes
|
|
||||||
}
|
|
||||||
attributes.push({name: 'recurrent', dates: recurrent, dot: { color: 'red'}})
|
|
||||||
}
|
|
||||||
return attributes
|
return attributes
|
||||||
},
|
},
|
||||||
disableAddress () {
|
disableAddress () {
|
||||||
|
|
|
@ -14,7 +14,7 @@ export default ({ app, store }) => {
|
||||||
// Vue.filter('hour', value => moment(value).locale(store.state.locale).format('HH:mm'))
|
// Vue.filter('hour', value => moment(value).locale(store.state.locale).format('HH:mm'))
|
||||||
|
|
||||||
// shown in mobile homepage
|
// shown in mobile homepage
|
||||||
Vue.filter('day', value => moment.unix(value).locale(store.state.locale).format('dddd, D MMMM'))
|
Vue.filter('day', value => moment.unix(value).locale(store.state.locale).format('dddd, D MMM'))
|
||||||
// Vue.filter('month', value => moment(value).locale(store.state.locale).format('MMM'))
|
// Vue.filter('month', value => moment(value).locale(store.state.locale).format('MMM'))
|
||||||
|
|
||||||
// format event start/end datetime based on page
|
// format event start/end datetime based on page
|
||||||
|
|
|
@ -91,7 +91,7 @@ const userController = {
|
||||||
|
|
||||||
let event = await Event.create(eventDetails)
|
let event = await Event.create(eventDetails)
|
||||||
|
|
||||||
// create place if needs to
|
// create place if needed
|
||||||
let place
|
let place
|
||||||
try {
|
try {
|
||||||
place = await Place.findOrCreate({ where: { name: body.place_name },
|
place = await Place.findOrCreate({ where: { name: body.place_name },
|
||||||
|
|
Loading…
Reference in a new issue