Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NWK Ansichtseinstellungen an PDF übergeben #93

Merged
merged 2 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/components/SideMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,24 @@
<span>Kennzahlen exportieren</span>
</button>

<a href="/#/Pdf" target="_blank" class="button">
<a
:href="
'/#/Pdf?pseudo=' +
pseudonyms +
'&hor=' +
horizons +
'&con=' +
connections +
'&alt=' +
alteriNames +
'&age=' +
showAge +
'&role=' +
showRole
"
target="_blank"
class="button"
>
<!-- Button richtig stylen-->
<span class="icon">
<font-awesome-icon icon="file-pdf" />
Expand Down Expand Up @@ -201,6 +218,10 @@ export default defineComponent({
toggleConnections: () => store.commit("view/toggle", "connections"),
alteriNames: computed(() => store.state.view.alteriNames),
toggleAlteriNames: () => store.commit("view/toggle", "alteriNames"),
showAge: computed(() => store.state.view.ageInNwk),
toggleAge: () => store.commit("view/toggle", "ageInNwk"),
showRole: computed(() => store.state.view.roleInNwk),
toggleRoleShort: () => store.commit("view/toggle", "roleInNwk"),
};
},
});
Expand Down
37 changes: 36 additions & 1 deletion src/views/Pdf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@
import NetworkMap from "@/components/NetworkMap.vue";
import { useStore } from "@/store";
import { defineComponent, computed, onMounted } from "vue";
import { useRouter } from "vue-router";

export default defineComponent({
name: "Pdf",
components: { NetworkMap },
setup() {
setup: function () {
const store = useStore();
// knows list of Alter from vuex
const alteri = computed(() => store.state.nwk.alteri);
Expand All @@ -92,9 +93,43 @@ export default defineComponent({
window.print();
};

// TODO currently: workaround -> schönere Lösung
const readHttpGet = () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let pseudo: any = useRouter().currentRoute.value.query.pseudo;
pseudo = /true/i.test(pseudo);
pseudo ? store.commit("pseudonym/toggle") : "";

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let hor: any = useRouter().currentRoute.value.query.hor;
hor = /true/i.test(hor);
hor ? "" : store.commit("view/toggle", "horizons");

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let con: any = useRouter().currentRoute.value.query.con;
con = /true/i.test(con);
con ? "" : store.commit("view/toggle", "connections");

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let alt: any = useRouter().currentRoute.value.query.alt;
alt = /true/i.test(alt);
alt ? "" : store.commit("view/toggle", "alteriNames");

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let age: any = useRouter().currentRoute.value.query.age;
age = /true/i.test(age);
age ? store.commit("view/toggle", "ageInNwk") : "";

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let role: any = useRouter().currentRoute.value.query.role;
role = /true/i.test(role);
role ? store.commit("view/toggle", "roleInNwk") : "";
};

onMounted(() => {
// the print dialog will open immediately
createPdf();
readHttpGet();
});

return {
Expand Down