ff-admin/src/views/admin/management/user/User.vue

57 lines
1.8 KiB
Vue
Raw Normal View History

2024-08-27 11:46:24 +02:00
<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">Benutzer</h1>
</div>
</template>
2024-09-01 14:54:49 +02:00
<template #diffMain>
2025-01-09 12:59:14 +01:00
<div class="flex flex-col gap-4 h-full pl-7">
2024-09-01 14:54:49 +02:00
<div class="flex flex-col gap-2 grow overflow-y-scroll pr-7">
<UserListItem v-for="user in users" :key="user.id" :user="user" />
</div>
<div class="flex flex-row gap-4">
2025-02-15 11:26:34 +01:00
<button v-if="can('create', 'management', 'user')" primary class="!w-fit" @click="inviteUser">
2024-11-24 15:31:08 +01:00
Nutzer einladen
</button>
2025-02-15 11:41:27 +01:00
<RouterLink button primary-outline :to="{ name: 'admin-management-user-invites' }" class="!w-fit">
2024-11-23 14:25:41 +01:00
offene Einladungen
</RouterLink>
2024-09-01 14:54:49 +02:00
</div>
</div>
2024-08-27 11:46:24 +02:00
</template>
</MainTemplate>
</template>
<script setup lang="ts">
2024-11-23 14:25:41 +01:00
import { defineComponent, markRaw, defineAsyncComponent } from "vue";
import { RouterLink } from "vue-router";
2024-09-01 14:54:49 +02:00
import { mapState, mapActions } from "pinia";
2024-08-27 11:46:24 +02:00
import MainTemplate from "@/templates/Main.vue";
2025-02-15 11:08:09 +01:00
import { useUserStore } from "@/stores/admin/management/user";
2024-11-23 14:25:41 +01:00
import { useModalStore } from "@/stores/modal";
2025-02-15 11:08:09 +01:00
import UserListItem from "@/components/admin/management/user/UserListItem.vue";
2024-11-24 15:31:08 +01:00
import { useAbilityStore } from "@/stores/ability";
2024-08-27 11:46:24 +02:00
</script>
<script lang="ts">
2024-09-01 14:54:49 +02:00
export default defineComponent({
computed: {
...mapState(useUserStore, ["users"]),
2024-11-24 15:31:08 +01:00
...mapState(useAbilityStore, ["can"]),
2024-09-01 14:54:49 +02:00
},
mounted() {
this.fetchUsers();
},
methods: {
...mapActions(useUserStore, ["fetchUsers"]),
2024-11-24 12:36:03 +01:00
...mapActions(useModalStore, ["openModal"]),
inviteUser() {
2025-02-15 11:08:09 +01:00
this.openModal(
markRaw(defineAsyncComponent(() => import("@/components/admin/management/user/InviteUserModal.vue")))
);
2024-11-24 12:36:03 +01:00
},
2024-09-01 14:54:49 +02:00
},
});
2024-08-27 11:46:24 +02:00
</script>