47 lines
1.4 KiB
Vue
47 lines
1.4 KiB
Vue
|
<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">Rollen</h1>
|
||
|
</div>
|
||
|
</template>
|
||
|
<template #diffMain>
|
||
|
<div class="flex flex-col gap-4 grow pl-7">
|
||
|
<div class="flex flex-col gap-2 grow overflow-y-scroll pr-7">
|
||
|
<RoleListItem v-for="role in roles" :key="role.id" :role="role" />
|
||
|
</div>
|
||
|
<div class="flex flex-row gap-4">
|
||
|
<button primary class="!w-fit" @click="openCreateModal">Rolle erstellen</button>
|
||
|
</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 { useRoleStore } from "../../../stores/admin/role";
|
||
|
import RoleListItem from "@/components/admin/user/role/RoleListItem.vue";
|
||
|
import { useModalStore } from "@/stores/modal";
|
||
|
</script>
|
||
|
|
||
|
<script lang="ts">
|
||
|
export default defineComponent({
|
||
|
computed: {
|
||
|
...mapState(useRoleStore, ["roles"]),
|
||
|
},
|
||
|
mounted() {
|
||
|
this.fetchRoles();
|
||
|
},
|
||
|
methods: {
|
||
|
...mapActions(useRoleStore, ["fetchRoles"]),
|
||
|
...mapActions(useModalStore, ["openModal"]),
|
||
|
openCreateModal() {
|
||
|
this.openModal(markRaw(defineAsyncComponent(() => import("@/components/admin/user/role/CreateRoleModal.vue"))));
|
||
|
},
|
||
|
},
|
||
|
});
|
||
|
</script>
|