ff-admin/src/components/admin/user/role/RoleListItem.vue

39 lines
1.2 KiB
Vue
Raw Normal View History

2024-09-01 14:54:49 +02:00
<template>
<div class="flex flex-col h-fit w-full border border-primary rounded-md">
<div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
<p>{{ role.role }} <small v-if="role.permissions?.isAdmin">(Admin)</small></p>
2024-09-01 19:19:48 +02:00
<PencilIcon class="w-5 h-5 p-1 box-content cursor-pointer" @click="openUpdateModal" />
2024-09-01 14:54:49 +02:00
</div>
</div>
</template>
<script setup lang="ts">
2024-09-01 19:19:48 +02:00
import { defineComponent, defineAsyncComponent, markRaw, type PropType } from "vue";
2024-09-01 14:54:49 +02:00
import { mapState, mapActions } from "pinia";
import { PencilIcon } from "@heroicons/vue/outline";
import type { RoleViewModel } from "@/viewmodels/admin/role.models";
2024-09-01 19:19:48 +02:00
import { useModalStore } from "@/stores/modal";
import { useNavigationStore } from "@/stores/admin/navigation";
2024-09-01 14:54:49 +02:00
</script>
<script lang="ts">
export default defineComponent({
props: {
role: { type: Object as PropType<RoleViewModel>, default: {} },
},
data() {
return {};
},
mounted() {},
2024-09-01 19:19:48 +02:00
methods: {
...mapActions(useModalStore, ["openModal"]),
openUpdateModal() {
this.openModal(
markRaw(defineAsyncComponent(() => import("@/components/admin/user/role/UpdateRoleModal.vue"))),
this.role.id
);
},
},
2024-09-01 14:54:49 +02:00
});
</script>