pridane tlacitko pre zmazanie reportu

This commit is contained in:
Igor Miňo 2025-05-06 20:32:50 +02:00
parent 726a9b0f43
commit 31d719a07a
2 changed files with 19 additions and 0 deletions

View File

@ -342,16 +342,19 @@ button:focus-visible,
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin-right: 20px; margin-right: 20px;
align-items: center;
} }
#report .report-header div span { #report .report-header div span {
background-color: var(--color-bg0); background-color: var(--color-bg0);
color: var(--color-text0); color: var(--color-text0);
padding: 2px 10px; padding: 2px 10px;
align-items: center;
} }
#report .report-header div strong { #report .report-header div strong {
background-color: var(--color-bg1); background-color: var(--color-bg1);
color: var(--color-text0); color: var(--color-text0);
padding: 2px 10px; padding: 2px 10px;
align-items: center;
} }
#report .description { #report .description {
background-color: var(--color-bg2); background-color: var(--color-bg2);

View File

@ -1,4 +1,6 @@
<template> <template>
<FullScreenLoader v-if="loading" />
<div id="report"> <div id="report">
<div class="report-header"> <div class="report-header">
<div> <div>
@ -21,6 +23,9 @@
<span>Skupina</span> <span>Skupina</span>
<strong>{{ report.report_group }}</strong> <strong>{{ report.report_group }}</strong>
</div> </div>
<div>
<button @click="reportDelete"><font-awesome-icon :icon="['fas', 'trash-can']" /> Zmazať</button>
</div>
</div> </div>
<h1 contenteditable="true" @blur="onTitleChange" ref="reportTitle"> <h1 contenteditable="true" @blur="onTitleChange" ref="reportTitle">
{{ report.report_title }} {{ report.report_title }}
@ -31,10 +36,14 @@
<script> <script>
import { backend } from "../backend"; import { backend } from "../backend";
import FullScreenLoader from "../components/FullScreenLoader.vue";
export default { export default {
name: "Report", name: "Report",
components: { FullScreenLoader },
data() { data() {
return { return {
loading: false,
report_id: this.$route.params.id, report_id: this.$route.params.id,
report: { report: {
report_id: 0, report_id: 0,
@ -65,6 +74,13 @@ export default {
onDescriptionChange(event) { onDescriptionChange(event) {
backend.update(this.report_id, { report_description: event.target.innerText }); 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: {}, components: {},
watch: {}, watch: {},