<template> <MainTemplate> <template #topBar> <div class="flex flex-row items-center justify-between pt-5 pb-3 px-7"> <h1 class="font-bold text-xl h-8">Backups</h1> </div> </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.route" v-slot="{ isActive }" :to="{ name: tab.route }" class="w-1/2 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-hidden', isActive ? 'bg-red-200 shadow-sm border-b-2 border-primary rounded-b-none' : ' hover:bg-red-200', ]" > {{ tab.title }} </p> </RouterLink> </div> <RouterView /> </div> </div> </template> </MainTemplate> </template> <script setup lang="ts"> import { defineAsyncComponent, defineComponent, markRaw } from "vue"; import { mapState, mapActions } from "pinia"; import MainTemplate from "@/templates/Main.vue"; import { useBackupStore } from "@/stores/admin/management/backup"; import BackupListItem from "@/components/admin/management/backup/BackupListItem.vue"; import { useModalStore } from "@/stores/modal"; import { useAbilityStore } from "@/stores/ability"; </script> <script lang="ts"> export default defineComponent({ data() { return { tabs: [ { route: "admin-management-backup-generated", title: "Erstellt" }, { route: "admin-management-backup-uploaded", title: "Uploads" }, ], }; }, computed: { ...mapState(useBackupStore, ["backups"]), ...mapState(useAbilityStore, ["can"]), }, mounted() { this.fetchBackups(); }, methods: { ...mapActions(useBackupStore, ["fetchBackups"]), ...mapActions(useModalStore, ["openModal"]), openCreateModal() { this.openModal( markRaw(defineAsyncComponent(() => import("@/components/admin/management/backup/CreateBackupModal.vue"))) ); }, openUploadModal() { this.openModal( markRaw(defineAsyncComponent(() => import("@/components/admin/management/backup/UploadBackupModal.vue"))) ); }, }, }); </script>