gancio-upstream/components/admin/Events.vue

61 lines
1.9 KiB
Vue
Raw Normal View History

<template lang='pug'>
v-container
v-card-title {{$t('common.events')}}
v-card-subtitle {{$t('admin.event_confirm_description')}}
v-card-text
v-data-table(
2021-01-25 01:17:25 +01:00
:hide-default-footer='unconfirmedEvents.length<10'
2022-03-07 16:39:02 +01:00
:footer-props='{ prevIcon: mdiChevronLeft, nextIcon: mdiChevronRight }'
:items='unconfirmedEvents'
:headers='headers')
2022-04-29 14:25:22 +02:00
template(v-slot:item.when='{ item }') {{item|when}}
template(v-slot:item.actions='{ item }')
2020-10-28 01:27:58 +01:00
v-btn(text small @click='confirm(item)' color='success') {{$t('common.confirm')}}
2021-11-20 21:02:48 +01:00
v-btn(text small :to='`/event/${item.slug || item.id}`' color='success') {{$t('common.preview')}}
2020-10-28 01:27:58 +01:00
v-btn(text small :to='`/add/${item.id}`' color='warning') {{$t('common.edit')}}
v-btn(text small @click='remove(item)'
color='error') {{$t('common.delete')}}
</template>
<script>
2022-03-07 16:39:02 +01:00
import { mdiChevronLeft, mdiChevronRight } from '@mdi/js'
export default {
props: {
unconfirmedEvents: { type: Array, default: () => [] }
},
data () {
return {
2022-03-07 16:39:02 +01:00
mdiChevronLeft, mdiChevronRight,
valid: false,
dialog: false,
editing: false,
headers: [
{ value: 'title', text: 'Title' },
2022-04-29 14:25:22 +02:00
{ value: 'place.name', text: 'Place' },
{ value: 'when', text: 'When' },
{ value: 'actions', text: 'Actions', align: 'right' }
]
}
},
methods: {
edit (event) {
this.$router.push(`/add/${event.id}`)
},
2020-10-28 01:27:58 +01:00
async confirm (event) {
try {
2020-10-28 01:27:58 +01:00
await this.$axios.$put(`/event/confirm/${event.id}`)
this.$emit('confirmed', event.id)
2022-02-26 21:19:59 +01:00
this.$root.$message('event.confirmed', { color: 'success' })
} catch (e) {}
},
async remove (event) {
2020-10-07 11:12:13 +02:00
const ret = await this.$root.$confirm('event.remove_confirmation')
if (!ret) { return }
await this.$axios.delete(`/event/${event.id}`)
2020-10-07 11:12:13 +02:00
this.$root.$message('admin.event_remove_ok')
}
}
}
</script>