Whalebird-desktop-client-ma.../src/renderer/components/TimelineSpace/Modals/Report.vue

55 lines
1.6 KiB
Vue
Raw Normal View History

2018-09-30 16:01:40 +02:00
<template>
2022-04-27 12:53:52 +02:00
<el-dialog :title="$t('modals.report.title')" v-model="reportModal" width="400px" custom-class="report">
2022-04-19 12:18:29 +02:00
<el-input type="textarea" v-model="comment" :placeholder="$t('modals.report.comment')"></el-input>
2022-04-25 11:20:18 +02:00
<template #footer>
<span class="dialog-footer">
<el-button @click="closeModal">{{ $t('modals.report.cancel') }}</el-button>
<el-button type="primary" @click="submit">{{ $t('modals.report.ok') }}</el-button>
</span>
</template>
2022-04-18 15:41:52 +02:00
</el-dialog>
2018-09-30 16:01:40 +02:00
</template>
<script lang="ts">
import { defineComponent, computed, ref } from 'vue'
import { useStore } from '@/store'
import { MUTATION_TYPES, ACTION_TYPES } from '@/store/TimelineSpace/Modals/Report'
2018-09-30 16:01:40 +02:00
export default defineComponent({
2018-09-30 16:01:40 +02:00
name: 'Report',
setup() {
const space = 'TimelineSpace/Modals/Report'
const store = useStore()
const comment = ref<string>('')
const status = computed(() => store.state.TimelineSpace.Modals.Report.message)
const reportModal = computed({
get: () => store.state.TimelineSpace.Modals.Report.modalOpen,
set: (value: boolean) => store.commit(`${space}/${MUTATION_TYPES.CHANGE_MODAL_OPEN}`, value)
})
const closeModal = () => {
store.commit(`${space}/${MUTATION_TYPES.CHANGE_MODAL_OPEN}`, false)
2022-04-19 12:18:29 +02:00
}
const submit = async () => {
closeModal()
await store.dispatch(`${space}/${ACTION_TYPES.SUBMIT}`, {
account_id: status.value?.account.id,
status_id: status.value?.id,
comment: comment.value
2018-09-30 16:01:40 +02:00
})
2022-04-19 12:18:29 +02:00
}
return {
comment,
reportModal,
closeModal,
submit
}
2022-04-19 12:18:29 +02:00
}
})
2018-09-30 16:01:40 +02:00
</script>
2022-04-18 15:41:52 +02:00
<style lang="scss" scoped></style>