fix recurrent event edit
This commit is contained in:
@@ -9,16 +9,14 @@
|
|||||||
Nav
|
Nav
|
||||||
#content
|
#content
|
||||||
nuxt
|
nuxt
|
||||||
el-footer#footer
|
el-footer.mt-1#footer
|
||||||
.row
|
#links
|
||||||
.col.col-7
|
a(href='https://gancio.org') Gancio {{settings.version}}</a>
|
||||||
small <a href='https://gancio.org'>Gancio {{settings.version}}</a>
|
span ⇒
|
||||||
.col#links
|
a(rel='me' :href='settings.baseurl' @click.prevent='showFollowMe=true') follow me
|
||||||
a(rel='me' :href='settings.baseurl' @click.prevent='showFollowMe=true') follow me
|
nuxt-link(to='/about') about
|
||||||
nuxt-link(to='/about') about
|
a(href='https://blog.gancio.org') blog
|
||||||
a(href='https://gancio.org') docs
|
a(href='https://framagit.org/les/gancio') source
|
||||||
a(href='https://blog.gancio.org') blog
|
|
||||||
a(href='https://framagit.org/les/gancio') source
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
i.el-icon-location-outline
|
i.el-icon-location-outline
|
||||||
span {{$t('common.where')}}
|
span {{$t('common.where')}}
|
||||||
p(v-html="$t('event.where_description')")
|
p(v-html="$t('event.where_description')")
|
||||||
|
|
||||||
el-autocomplete(v-model='event.place.name' @blur='selectPlace($event.target.value)'
|
el-autocomplete(v-model='event.place.name' @blur='selectPlace($event.target.value)'
|
||||||
highlight-first-item
|
highlight-first-item
|
||||||
:fetch-suggestions='filterPlaces' @select='selectPlace')
|
:fetch-suggestions='filterPlaces' @select='selectPlace')
|
||||||
@@ -39,7 +38,6 @@
|
|||||||
|
|
||||||
//- WHEN
|
//- WHEN
|
||||||
el-divider <v-icon name='clock'/> {{$t('common.when')}}
|
el-divider <v-icon name='clock'/> {{$t('common.when')}}
|
||||||
|
|
||||||
.text-center
|
.text-center
|
||||||
el-radio-group(v-model="event.type")
|
el-radio-group(v-model="event.type")
|
||||||
el-radio-button(label="normal") <v-icon name='calendar-day'/> {{$t('event.normal')}}
|
el-radio-button(label="normal") <v-icon name='calendar-day'/> {{$t('event.normal')}}
|
||||||
@@ -70,7 +68,6 @@
|
|||||||
el-radio-button(v-for='whenPattern in whenPatterns' :label='whenPattern.key' :key='whenPatterns.key')
|
el-radio-button(v-for='whenPattern in whenPatterns' :label='whenPattern.key' :key='whenPatterns.key')
|
||||||
span {{whenPattern.label}}
|
span {{whenPattern.label}}
|
||||||
|
|
||||||
//- form.el-form.text-center.inline.el-form-inline
|
|
||||||
.text-center
|
.text-center
|
||||||
el-form-item(:label="$t('event.from')" width='100')
|
el-form-item(:label="$t('event.from')" width='100')
|
||||||
el-time-select.mr-2(ref='time_start'
|
el-time-select.mr-2(ref='time_start'
|
||||||
@@ -126,26 +123,26 @@ export default {
|
|||||||
error({ statusCode: 404, message: 'Event not found!' })
|
error({ statusCode: 404, message: 'Event not found!' })
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
data.event.recurrent = {}
|
||||||
data.event.place.name = event.place.name
|
data.event.place.name = event.place.name
|
||||||
data.event.place.address = event.place.address || ''
|
data.event.place.address = event.place.address || ''
|
||||||
if (event.multidate) {
|
if (event.multidate) {
|
||||||
data.date = { start: moment.unix(event.start_datetime), end: moment.unix(event.end_datetime) }
|
data.date = { start: moment.unix(event.start_datetime).toDate(), end: moment.unix(event.end_datetime).toDate() }
|
||||||
data.event.type = 'multidate'
|
data.event.type = 'multidate'
|
||||||
} else if (event.recurrent) {
|
} else if (event.recurrent) {
|
||||||
data.event.type = 'recurrent'
|
data.event.type = 'recurrent'
|
||||||
data.event.recurrent = event.recurrent
|
data.event.recurrent = event.recurrent
|
||||||
} else {
|
} else {
|
||||||
data.event.type = 'normal'
|
data.event.type = 'normal'
|
||||||
data.date = moment.unix(event.start_datetime)
|
data.date = moment.unix(event.start_datetime).toDate()
|
||||||
}
|
}
|
||||||
|
|
||||||
data.time.start = moment.unix(event.start_datetime).format('HH:mm')
|
data.time.start = moment.unix(event.start_datetime).format('HH:mm')
|
||||||
data.time.end = moment.unix(event.end_datetime).format('HH:mm')
|
data.time.end = moment.unix(event.end_datetime).format('HH:mm')
|
||||||
|
data.date = [moment.unix(event.start_datetime).toDate()]
|
||||||
data.event.title = event.title
|
data.event.title = event.title
|
||||||
data.event.description = event.description
|
data.event.description = event.description
|
||||||
data.event.id = event.id
|
data.event.id = event.id
|
||||||
data.event.recurrent = {}
|
|
||||||
data.event.tags = event.tags
|
data.event.tags = event.tags
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
@@ -224,10 +221,10 @@ export default {
|
|||||||
...mapState(['events']),
|
...mapState(['events']),
|
||||||
attributes () {
|
attributes () {
|
||||||
let attributes = []
|
let attributes = []
|
||||||
attributes.push({ key: 'today', dates: new Date(), highlight: { color: 'red' } })
|
// attributes.push({ key: 'today', dates: new Date(), highlight: { color: 'red' } })
|
||||||
|
|
||||||
attributes = attributes.concat(this.events
|
attributes = attributes.concat(this.events
|
||||||
.filter(e => !e.multidate && (!e.recurrent || this.event.type === 'recurrent'))
|
.filter(e => !e.multidate && (!e.parentId || this.event.type === 'recurrent'))
|
||||||
.map(e => ({ key: e.id, dot: { color: this.event.type === 'recurrent' ? 'orange' : 'green' }, 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() })))
|
||||||
|
|
||||||
if (this.event.type === 'recurrent' && this.date && this.date.length) {
|
if (this.event.type === 'recurrent' && this.date && this.date.length) {
|
||||||
@@ -235,14 +232,14 @@ export default {
|
|||||||
key: 'recurrent',
|
key: 'recurrent',
|
||||||
dot: { color: 'orange' },
|
dot: { color: 'orange' },
|
||||||
dates: {
|
dates: {
|
||||||
weeklyInterval: this.event.recurrent.frequency === '1w' ? 1 : 2, // this.event.recurrent.freq,
|
weeklyInterval: this.event.recurrent.frequency === '1w' ? 1 : 2,
|
||||||
weekdays: _.map(this.date, date => moment(date).day() + 1),
|
weekdays: _.map(this.date, date => moment(date).day() + 1),
|
||||||
start: new Date(this.date[0])
|
start: new Date(this.date[0])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
attributes = attributes.concat(this.events
|
attributes = attributes.concat(this.events
|
||||||
.filter(e => e.multidate && !e.recurrent)
|
.filter(e => e.multidate && !e.parentId)
|
||||||
.map(e => ({
|
.map(e => ({
|
||||||
key: e.id,
|
key: e.id,
|
||||||
highlight: {},
|
highlight: {},
|
||||||
|
|||||||
Reference in New Issue
Block a user