2020-01-15 23:40:44 +01:00
|
|
|
<template lang="pug">
|
2020-07-25 21:41:22 +02:00
|
|
|
v-container
|
2020-08-05 17:30:41 +02:00
|
|
|
v-card
|
|
|
|
v-tabs
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2020-08-05 17:30:41 +02:00
|
|
|
//- SETTINGS
|
|
|
|
v-tab {{$t('common.settings')}}
|
|
|
|
v-tab-item
|
|
|
|
Settings
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2020-08-05 17:30:41 +02:00
|
|
|
//- THEME
|
|
|
|
v-tab {{$t('common.theme')}}
|
|
|
|
v-tab-item
|
|
|
|
Theme
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2020-08-05 17:30:41 +02:00
|
|
|
//- USERS
|
|
|
|
v-tab
|
2020-09-07 02:23:03 +02:00
|
|
|
v-badge(:value='!!unconfirmedUsers.length' :content='unconfirmedUsers.length') {{$t('common.users')}}
|
2020-08-05 17:30:41 +02:00
|
|
|
v-tab-item
|
|
|
|
Users(:users='users')
|
2020-07-28 12:24:39 +02:00
|
|
|
|
2020-08-05 17:30:41 +02:00
|
|
|
//- PLACES
|
|
|
|
v-tab {{$t('common.places')}}
|
|
|
|
v-tab-item
|
|
|
|
Places
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2020-08-05 17:30:41 +02:00
|
|
|
//- EVENTS
|
|
|
|
v-tab
|
2020-09-07 02:23:03 +02:00
|
|
|
v-badge(:value='!!unconfirmedEvents.length' :content='unconfirmedEvents.length') {{$t('common.events')}}
|
2020-08-05 17:30:41 +02:00
|
|
|
v-tab-item
|
2020-09-07 02:23:03 +02:00
|
|
|
Events(:unconfirmedEvents='unconfirmedEvents')
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2020-08-05 17:30:41 +02:00
|
|
|
//- ANNOUNCEMENTS
|
|
|
|
v-tab {{$t('common.announcements')}}
|
|
|
|
v-tab-item
|
|
|
|
Announcement
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2020-08-05 17:30:41 +02:00
|
|
|
//- FEDERATION
|
|
|
|
v-tab {{$t('common.federation')}}
|
|
|
|
v-tab-item
|
|
|
|
Federation
|
2020-01-15 23:40:44 +01:00
|
|
|
|
2020-08-05 17:30:41 +02:00
|
|
|
//- MODERATION
|
|
|
|
v-tab(v-if='settings.enable_federation') {{$t('common.moderation')}}
|
|
|
|
v-tab-item
|
|
|
|
Moderation
|
2020-02-16 21:03:50 +01:00
|
|
|
|
2020-01-15 23:40:44 +01:00
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { mapState } from 'vuex'
|
|
|
|
import Users from '../components/admin/Users'
|
2020-09-07 02:23:03 +02:00
|
|
|
import Events from '../components/admin/Events'
|
2020-01-15 23:40:44 +01:00
|
|
|
import Places from '../components/admin/Places'
|
|
|
|
import Settings from '../components/admin/Settings'
|
|
|
|
import Federation from '../components/admin/Federation'
|
2020-02-05 00:44:20 +01:00
|
|
|
import Moderation from '../components/admin/Moderation'
|
2020-02-16 21:03:50 +01:00
|
|
|
import Announcement from '../components/admin/Announcement'
|
2020-07-28 12:24:39 +02:00
|
|
|
import Theme from '../components/admin/Theme'
|
2020-01-15 23:40:44 +01:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Admin',
|
2020-09-07 02:23:03 +02:00
|
|
|
components: { Users, Events, Places, Settings, Federation, Moderation, Announcement, Theme },
|
2020-01-15 23:40:44 +01:00
|
|
|
middleware: ['auth'],
|
2020-06-02 00:02:02 +02:00
|
|
|
async asyncData ({ $axios, params, store }) {
|
|
|
|
try {
|
|
|
|
const users = await $axios.$get('/users')
|
2020-09-07 02:23:03 +02:00
|
|
|
const unconfirmedEvents = await $axios.$get('/event/unconfirmed')
|
|
|
|
return { users, unconfirmedEvents }
|
2020-06-02 00:02:02 +02:00
|
|
|
} catch (e) {
|
|
|
|
console.error(e)
|
2020-09-07 02:23:03 +02:00
|
|
|
return { users: [], unconfirmedEvents: [] }
|
2020-06-02 00:02:02 +02:00
|
|
|
}
|
|
|
|
},
|
2020-01-15 23:40:44 +01:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
description: '',
|
2020-09-07 02:23:03 +02:00
|
|
|
unconfirmedEvents: []
|
2020-01-15 23:40:44 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(['settings']),
|
|
|
|
unconfirmedUsers () {
|
|
|
|
return this.users.filter(u => !u.is_active)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
preview (id) {
|
|
|
|
this.$router.push(`/event/${id}`)
|
|
|
|
},
|
|
|
|
async confirm (id) {
|
|
|
|
try {
|
|
|
|
this.loading = true
|
|
|
|
await this.$axios.$get(`/event/confirm/${id}`)
|
|
|
|
this.loading = false
|
2020-07-31 01:03:19 +02:00
|
|
|
this.$root.$message({
|
2020-01-15 23:40:44 +01:00
|
|
|
message: this.$t('event.confirmed'),
|
|
|
|
type: 'success'
|
|
|
|
})
|
2020-09-07 02:23:03 +02:00
|
|
|
this.unconfirmedEvents = this.unconfirmedEvents.filter(e => e.id !== id)
|
2020-01-15 23:40:44 +01:00
|
|
|
} catch (e) {
|
|
|
|
}
|
|
|
|
}
|
2020-07-25 21:41:22 +02:00
|
|
|
},
|
|
|
|
head () {
|
|
|
|
return { title: `${this.settings.title} - ${this.$t('common.admin')}` }
|
2020-01-15 23:40:44 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|