Skip to content

Commit

Permalink
removed unnecessary code and fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Robin Kaggl committed Mar 13, 2024
1 parent 7dbf54c commit 20c05bd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 42 deletions.
11 changes: 1 addition & 10 deletions components/generic-listbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,10 @@ const model: ModelRef<{ label: string; value: string } | null> = defineModel({
default: null,
});
const props = defineProps<{
defineProps<{
items: Array<{ label: string; value: string }>;
}>();
defineEmits(["change"]);
watch(
() => props.items,
(to) => {
console.log("items changed:", props.items, model.value);
model.value = to[0] ? to[0] : null;
},
);
</script>

<template>
Expand Down
64 changes: 32 additions & 32 deletions pages/hierarchy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,38 @@ const comQuery = computed({
},
});
const showArgs = computed(() => {
switch (route.query.model) {
case "Institution": {
const instArgs = [
{
value: "show only institutions",
label: t("pages.hierarchy.options.show only institutions"),
},
{ value: "add functions", label: t("pages.hierarchy.options.add functions") },
{
value: "add functions and persons",
label: t("pages.hierarchy.options.add functions and persons"),
},
];
return instArgs;
}
case "Funktion": {
const funcArgs = [
{
value: "show institution hierarchy",
label: t("pages.hierarchy.options.show institution hierarchy"),
},
{ value: "show amt and persons", label: t("pages.hierarchy.options.show amt and persons") },
];
return funcArgs;
}
default: {
return [{ value: "normal", label: t("pages.hierarchy.options.normal") }];
}
}
});
const comOptions = computed({
get() {
const { direction, show } = route.query;
Expand Down Expand Up @@ -78,38 +110,6 @@ const query = ref(
}),
);
const showArgs = computed(() => {
switch (route.query.model) {
case "Institution": {
const instArgs = [
{
value: "show only institutions",
label: t("pages.hierarchy.options.show only institutions"),
},
{ value: "add functions", label: t("pages.hierarchy.options.add functions") },
{
value: "add functions and persons",
label: t("pages.hierarchy.options.add functions and persons"),
},
];
return instArgs;
}
case "Funktion": {
const funcArgs = [
{
value: "show institution hierarchy",
label: t("pages.hierarchy.options.show institution hierarchy"),
},
{ value: "show amt and persons", label: t("pages.hierarchy.options.show amt and persons") },
];
return funcArgs;
}
default: {
return [{ value: "normal", label: t("pages.hierarchy.options.normal") }];
}
}
});
definePageMeta({
title: "pages.hierarchy.title",
});
Expand Down

0 comments on commit 20c05bd

Please sign in to comment.