Skip to content

Commit

Permalink
fix wrong toast (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
Der-Alex-K authored Sep 16, 2024
1 parent 9d87d6d commit 76da2ac
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
20 changes: 16 additions & 4 deletions frontend/src/components/common/PdfReportMenue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
class="text-none"
color="secondary"
text="Aktualisiere PDF Report"
:disabled="!somethingToAdd"
@click="saveItems"
/>
<v-spacer />
Expand All @@ -82,7 +83,7 @@

<script setup lang="ts">
import _ from "lodash";
import { ref } from "vue";
import { computed, ref } from "vue";
import PdfReportMenueListItem from "@/components/zaehlstelle/PdfReportMenueListItem.vue";
import { usePdfReportStore } from "@/store/PdfReportStore";
Expand Down Expand Up @@ -110,6 +111,15 @@ const zaehlungsinfo = ref(false);
const legende = ref(false);
const zaehlungskenngroessen = ref(false);
const somethingToAdd = computed(() => {
return (
zaehlstelleinfo.value ||
zaehlungsinfo.value ||
zaehlungskenngroessen.value ||
legende.value
);
});
function closeDialog(): void {
dialog.value = false;
resetData();
Expand All @@ -135,9 +145,11 @@ function saveItems(): void {
createLegende();
}
snackbarStore.showSuccess(
`Die ausgewählten Informationen wurden dem PDF Report hinzugefügt.`
);
if (somethingToAdd.value) {
snackbarStore.showSuccess(
`Die ausgewählten Informationen wurden dem PDF Report hinzugefügt.`
);
}
closeDialog();
}
Expand Down
13 changes: 10 additions & 3 deletions frontend/src/components/messstelle/PdfReportMenueMessstelle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
class="text-none"
color="secondary"
text="Aktualisiere PDF Report"
:disabled="!somethingToAdd"
@click="saveItems"
/>
<v-spacer />
Expand Down Expand Up @@ -109,6 +110,10 @@ const options = computed<MessstelleOptionsDTO>(() => {
return messstelleStore.getFilteroptions;
});
const somethingToAdd = computed(() => {
return messstelleninfo.value || messinfo.value || legende.value;
});
function closeDialog(): void {
dialog.value = false;
resetCheckboxes();
Expand All @@ -133,9 +138,11 @@ function saveItems(): void {
createLegende();
}
snackbarStore.showSuccess(
`Die ausgewählten Informationen wurden dem PDF Report hinzugefügt.`
);
if (somethingToAdd.value) {
snackbarStore.showSuccess(
`Die ausgewählten Informationen wurden dem PDF Report hinzugefügt.`
);
}
closeDialog();
}
Expand Down

0 comments on commit 76da2ac

Please sign in to comment.