pridane tlacitko pre zmazanie reportu
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
<template>
|
||||
<FullScreenLoader v-if="loading" />
|
||||
|
||||
<div id="report">
|
||||
<div class="report-header">
|
||||
<div>
|
||||
@ -21,6 +23,9 @@
|
||||
<span>Skupina</span>
|
||||
<strong>{{ report.report_group }}</strong>
|
||||
</div>
|
||||
<div>
|
||||
<button @click="reportDelete"><font-awesome-icon :icon="['fas', 'trash-can']" /> Zmazať</button>
|
||||
</div>
|
||||
</div>
|
||||
<h1 contenteditable="true" @blur="onTitleChange" ref="reportTitle">
|
||||
{{ report.report_title }}
|
||||
@ -31,10 +36,14 @@
|
||||
|
||||
<script>
|
||||
import { backend } from "../backend";
|
||||
import FullScreenLoader from "../components/FullScreenLoader.vue";
|
||||
|
||||
export default {
|
||||
name: "Report",
|
||||
components: { FullScreenLoader },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
report_id: this.$route.params.id,
|
||||
report: {
|
||||
report_id: 0,
|
||||
@ -65,6 +74,13 @@ export default {
|
||||
onDescriptionChange(event) {
|
||||
backend.update(this.report_id, { report_description: event.target.innerText });
|
||||
},
|
||||
reportDelete() {
|
||||
if (!confirm("Naozaj chcete report zmazať?")) return;
|
||||
this.loading = true;
|
||||
backend.delete(this.report_id).then(() => {
|
||||
this.$router.push("/");
|
||||
});
|
||||
},
|
||||
},
|
||||
components: {},
|
||||
watch: {},
|
||||
|
||||
Reference in New Issue
Block a user