ff-operation/src/views/admin/operation/mission/MissionOverview.vue

80 lines
2.3 KiB
Vue
Raw Normal View History

2025-02-20 12:01:12 +01:00
<template>
<MainTemplate :showBack="false">
<template #headerInsert>
<RouterLink :to="{ name: 'admin-operation-mission-default' }" class="text-primary">zurück zur Liste</RouterLink>
</template>
<template #diffMain>
<div class="flex flex-col gap-2 grow px-7 overflow-hidden">
<div class="flex flex-col grow gap-2 overflow-hidden">
<div class="w-full flex flex-row max-lg:flex-wrap justify-center">
<RouterLink
v-for="tab in tabs"
:key="tab.hash"
:to="{ hash: tab.hash }"
replace
class="w-1/2 md:w-1/3 lg:w-full p-0.5 first:pl-0 last:pr-0"
>
<p
:class="[
'w-full rounded-lg py-2.5 text-sm text-center font-medium leading-5 focus:ring-0 outline-none',
routeHash == tab.hash
? 'bg-red-200 shadow border-b-2 border-primary rounded-b-none'
: ' hover:bg-red-200',
]"
>
{{ tab.title }}
</p>
</RouterLink>
</div>
<div v-if="routeHash == '#edit'">hi</div>
</div>
</div>
</template>
</MainTemplate>
</template>
<script setup lang="ts">
import { defineComponent } from "vue";
import { mapActions, mapState } from "pinia";
import MainTemplate from "@/templates/Main.vue";
import { useAbilityStore } from "@/stores/ability";
2025-02-21 11:55:49 +01:00
import { useConnectionStore } from "@/stores/admin/operation/connection";
2025-02-20 12:01:12 +01:00
</script>
<script lang="ts">
export default defineComponent({
data() {
return {
tabs: [
{ hash: "#edit", title: "Einträge" },
{ hash: "#presence", title: "Anwesenheit" },
{ hash: "#protocol", title: "Protokoll" },
],
};
},
watch: {
"$route.hash"() {
this.manageHash();
},
},
computed: {
...mapState(useAbilityStore, ["can"]),
routeHash() {
return this.$route.hash;
},
},
mounted() {
this.manageHash();
2025-02-21 11:55:49 +01:00
this.connectClient();
2025-02-20 12:01:12 +01:00
},
methods: {
2025-02-21 11:55:49 +01:00
...mapActions(useConnectionStore, ["connectClient"]),
2025-02-20 12:01:12 +01:00
manageHash() {
if (!this.$route.hash || !this.tabs.map((t) => t.hash).includes(this.$route.hash)) {
this.$router.replace({ hash: this.tabs[0].hash });
}
},
},
});
</script>