summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/EventModuleDelete.vue
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/src/components/EventModuleDelete.vue')
-rw-r--r--webapp/src/components/EventModuleDelete.vue66
1 files changed, 66 insertions, 0 deletions
diff --git a/webapp/src/components/EventModuleDelete.vue b/webapp/src/components/EventModuleDelete.vue
new file mode 100644
index 0000000..f22fc41
--- /dev/null
+++ b/webapp/src/components/EventModuleDelete.vue
@@ -0,0 +1,66 @@
+<i18n>
+{
+ "en": {
+ "delete-are-you-sure": "Are you sure you want to delete this event? | Are you sure you want to delete these events?"
+ },
+ "de": {
+ "delete-are-you-sure": "Sind sie sicher, dass sie diese Veranstaltung Löschen wollen? | Sind sie sicher, dass sie diese Veranstaltungen löschen wollen?"
+ }
+}
+</i18n>
+
+<template>
+ <v-card>
+ <v-card-title class="elevation-3">
+ <div class="headline">{{ $t('title') }}</div>
+ </v-card-title>
+ <v-card-text>
+ {{ $tc('delete-are-you-sure', dialog.info.length) }}
+ <template v-for="item in dialog.info">
+ <div class="grey--text" :key="item.id">{{ item.name }} ({{ item.description }})</div>
+ </template>
+ </v-card-text>
+ <v-divider></v-divider>
+ <v-card-actions>
+ <v-spacer></v-spacer>
+ <v-btn flat="flat" @click="cancelDelete">{{ $t('cancel') }}</v-btn>
+ <v-btn color="error" @click="deleteEvents">{{ $t('delete') }}</v-btn>
+ </v-card-actions>
+ </v-card>
+</template>
+
+<script>
+import { mapState, mapMutations } from 'vuex'
+
+export default {
+ name: 'EventModuleDelete',
+ data () {
+ return {
+ }
+ },
+ computed: {
+ ...mapState('events', ['dialog'])
+ },
+ methods: {
+ ...mapMutations('events', ['setDialog', 'loadEvents']),
+ cancelDelete () {
+ this.setDialog({ show: false })
+ },
+ async deleteEvents () {
+ var deleteIds = []
+ for (let i = 0; i < this.dialog.info.length; i++) {
+ deleteIds.push(this.dialog.info[i].id)
+ }
+ await this.$http.post('/api/events?delete', { ids: deleteIds })
+ this.setDialog({ show: false })
+ this.$snackbar({ color: 'success', text: this.$t('eventDeleteSuccess') })
+ this.$store.dispatch('events/loadEvents')
+ }
+ }
+}
+</script>
+
+<!-- Add "scoped" attribute to limit CSS to this component only -->
+<style scoped>
+
+</style>