major on recurrent events
This commit is contained in:
@@ -60,11 +60,11 @@
|
||||
br
|
||||
span {{$t(`event.${event.type}_description`)}}
|
||||
el-select.ml-2(v-if='event.type==="recurrent"' v-model='event.recurrent.frequency' placeholder='Frequenza')
|
||||
el-option(label='Tutti i giorni' value='1d' key='1d')
|
||||
//- el-option(label='Tutti i giorni' value='1d' key='1d')
|
||||
el-option(label='Ogni settimana' value='1w' key='1w')
|
||||
el-option(label='Ogni due settimane' value='2w' key='2w')
|
||||
el-option(label='Ogni mese' value='1m' key='1m')
|
||||
el-option(label='Ogni due mesi' value='2m' key='2m')
|
||||
//- el-option(label='Ogni due mesi' value='2m' key='2m')
|
||||
|
||||
v-date-picker.mb-2.mt-3(
|
||||
:mode='event.type === "multidate" ? "range" : event.type === "recurrent" ? "multiple" : "single"'
|
||||
@@ -118,6 +118,7 @@ import { mapActions, mapState, mapGetters } from 'vuex'
|
||||
import uniq from 'lodash/uniq'
|
||||
import map from 'lodash/map'
|
||||
import moment from 'dayjs'
|
||||
|
||||
import List from '@/components/List'
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
@@ -170,8 +171,9 @@ export default {
|
||||
} catch(e) {
|
||||
console.error('Error ', e)
|
||||
}
|
||||
moment.locale(store.state.locale)
|
||||
},
|
||||
async asyncData ( { params, $axios, error }) {
|
||||
async asyncData ( { params, $axios, error, store }) {
|
||||
if (params.edit) {
|
||||
const data = { time: {}, event: { place: {} }}
|
||||
data.id = params.edit
|
||||
@@ -439,4 +441,4 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
@@ -11,18 +11,21 @@
|
||||
template(slot='label')
|
||||
v-icon(name='users')
|
||||
span.ml-1 {{$t('common.users')}}
|
||||
|
||||
//- ADD NEW USER
|
||||
el-collapse
|
||||
el-collapse-item
|
||||
template(slot='title')
|
||||
p {{$t('common.new_user')}}
|
||||
h4 <v-icon name='plus'/> {{$t('common.new_user')}}
|
||||
el-form(inline)
|
||||
el-form-item(:label="$t('common.email')")
|
||||
el-input(v-model='new_user.email')
|
||||
el-form-item(:label="$t('common.password')")
|
||||
el-input(v-model='new_user.password' type='password')
|
||||
//- el-form-item(:label="$t('common.password')")
|
||||
//- el-input(v-model='new_user.password' type='password')
|
||||
el-form-item(:label="$t('common.admin')")
|
||||
el-switch(v-model='new_user.admin')
|
||||
el-switch(v-model='new_user.is_admin')
|
||||
el-button.float-right(@click='create_user' type='success' plain) {{$t('common.send')}}
|
||||
|
||||
el-table(:data='paginatedUsers' small)
|
||||
el-table-column(label='Email')
|
||||
template(slot-scope='data')
|
||||
@@ -141,7 +144,6 @@ export default {
|
||||
loading: false,
|
||||
new_user: {
|
||||
email: '',
|
||||
password: '',
|
||||
admin: false,
|
||||
},
|
||||
tab: "0",
|
||||
@@ -266,7 +268,7 @@ export default {
|
||||
try {
|
||||
this.loading = true
|
||||
const user = await this.$axios.$post('/user', this.new_user)
|
||||
this.new_user = { email: '', password: '', is_admin: false }
|
||||
this.new_user = { email: '', is_admin: false }
|
||||
Message({
|
||||
showClose: true,
|
||||
type: 'success',
|
||||
|
||||
@@ -8,21 +8,21 @@
|
||||
h5 {{$t('event.not_found')}}
|
||||
|
||||
div(v-else)
|
||||
//- title, where, when
|
||||
//- title
|
||||
h5.text-center {{event.title}}
|
||||
div.nextprev
|
||||
nuxt-link(v-if='prev' :to='`/event/${prev.id}`')
|
||||
nuxt-link(v-if='prev' :to='`/event/${prev}`')
|
||||
el-button( type='success' size='mini')
|
||||
v-icon(name='chevron-left')
|
||||
nuxt-link.float-right(v-if='next' :to='`/event/${next.id}`')
|
||||
nuxt-link.float-right(v-if='next' :to='`/event/${next}`')
|
||||
el-button(type='success' size='mini')
|
||||
v-icon(name='chevron-right')
|
||||
|
||||
|
||||
//- image
|
||||
img.main(:src='imgPath' v-if='event.image_path')
|
||||
|
||||
.info
|
||||
div {{event|event_when}}
|
||||
div {{event|when}}
|
||||
div {{event.place.name}} - {{event.place.address}}
|
||||
|
||||
//- description and tags
|
||||
@@ -61,7 +61,8 @@ import { MessageBox } from 'element-ui'
|
||||
export default {
|
||||
name: 'Event',
|
||||
// transition: null,
|
||||
// Watch for $route.query.page to call Component methods (asyncData, fetch, validate, layout, etc.)
|
||||
// Watch for $route.query.page to call
|
||||
// Component methods (asyncData, fetch, validate, layout, etc.)
|
||||
// watchQuery: ['id'],
|
||||
// Key for <NuxtChild> (transitions)
|
||||
// key: to => to.fullPath,
|
||||
@@ -77,10 +78,12 @@ export default {
|
||||
title: this.event.title,
|
||||
meta: [
|
||||
// hid is used as unique identifier. Do not use `vmid` for it as it will not work
|
||||
{ hid: 'description', name: 'description', content: this.event.description.slice(0, 1000) },
|
||||
{ hid: 'og-description', name: 'og:description', content: this.event.description.slice(0, 100) },
|
||||
{ hid: 'og-title', property: 'og:title', content: this.event.title },
|
||||
{ hid: 'og-url', property: 'og:url', content: `event/${this.event.id}` },
|
||||
{ hid: 'description', name: 'description',
|
||||
content: this.event.description.slice(0, 1000) },
|
||||
{ hid: 'og-description', name: 'og:description',
|
||||
content: this.event.description.slice(0, 100) },
|
||||
{ hid: 'og-title', property: 'og:title', content: this.event.title },
|
||||
{ hid: 'og-url', property: 'og:url', content: `event/${this.event.id}` },
|
||||
{ property: 'og:type', content: 'event'},
|
||||
{ property: 'og:image', content: this.imgPath }
|
||||
]
|
||||
@@ -97,8 +100,10 @@ export default {
|
||||
},
|
||||
async asyncData ( { $axios, params, error }) {
|
||||
try {
|
||||
const event = await $axios.$get(`/event/${params.id}`)
|
||||
return { event, id: params.id }
|
||||
const [ id, start_datetime ] = params.id.split('_')
|
||||
const event = await $axios.$get(`/event/${id}`)
|
||||
event.start_datetime = start_datetime*1000
|
||||
return { event, id }
|
||||
} catch(e) {
|
||||
error({ statusCode: 404, message: 'Event not found'})
|
||||
}
|
||||
@@ -108,18 +113,27 @@ export default {
|
||||
...mapState(['settings']),
|
||||
next () {
|
||||
let found = false
|
||||
return this.filteredEvents.find(e => {
|
||||
const event = this.filteredEvents.find(e => {
|
||||
if (found) return e
|
||||
if (e.id === this.event.id) found = true
|
||||
if (e.start_datetime === this.event.start_datetime && e.id === this.event.id) found = true
|
||||
})
|
||||
if (!event) return false
|
||||
if (event.recurrent) {
|
||||
return `${event.id}_${event.start_datetime/1000}`
|
||||
}
|
||||
return event.id
|
||||
},
|
||||
prev () {
|
||||
let prev = false
|
||||
let event = false
|
||||
this.filteredEvents.find(e => {
|
||||
if (e.id === this.event.id) return true
|
||||
prev = e
|
||||
if (e.start_datetime === this.event.start_datetime && e.id === this.event.id) return true
|
||||
event = e
|
||||
})
|
||||
return prev
|
||||
if (!event) return false
|
||||
if (event.recurrent) {
|
||||
return `${event.id}_${event.start_datetime/1000}`
|
||||
}
|
||||
return event.id
|
||||
},
|
||||
imgPath () {
|
||||
return this.event.image_path && '/media/' + this.event.image_path
|
||||
|
||||
57
pages/user_confirm/_code.vue
Normal file
57
pages/user_confirm/_code.vue
Normal file
@@ -0,0 +1,57 @@
|
||||
<template lang="pug">
|
||||
el-card
|
||||
nuxt-link.float-right(to='/')
|
||||
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
|
||||
|
||||
h5 <img src='/favicon.ico'/> {{$t('common.activate_user')}}
|
||||
div(v-if='valid')
|
||||
el-form
|
||||
el-form-item {{$t('common.password')}}
|
||||
el-input(type='password', v-model='new_password')
|
||||
el-button(plain type="success" icon='el-icon-send', @click='change_password') {{$t('common.send')}}
|
||||
|
||||
div(v-else) {{$t('recover.not_valid_code')}}
|
||||
|
||||
|
||||
</template>
|
||||
<script>
|
||||
import { Message } from 'element-ui'
|
||||
|
||||
export default {
|
||||
name: 'Recover',
|
||||
data () {
|
||||
return { new_password: '' }
|
||||
},
|
||||
async asyncData({ params, $axios }) {
|
||||
const code = params.code
|
||||
try {
|
||||
const valid = await $axios.$post('/user/check_recover_code', { recover_code: code })
|
||||
return { valid, code }
|
||||
}
|
||||
catch (e) {
|
||||
return { valid: false }
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async change_password () {
|
||||
try {
|
||||
const res = await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
|
||||
Message({
|
||||
showClose: true,
|
||||
type: 'success',
|
||||
message: this.$t('common.password_updated')
|
||||
})
|
||||
this.$router.replace('/login')
|
||||
} catch(e) {
|
||||
Message({
|
||||
showClose: true,
|
||||
type: 'warning',
|
||||
message: e
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user