27 lines
1.0 KiB
Vue
27 lines
1.0 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue';
|
|
import { RowDeleteAction, RowEditAction } from '@/components/button';
|
|
import { useCan } from '@/composables/useCan';
|
|
import { edit, destroy } from '@/routes/admin/system/roles';
|
|
import type { RoleListItem } from './columns';
|
|
|
|
const props = defineProps<{
|
|
role: RoleListItem;
|
|
}>();
|
|
|
|
const { can } = useCan();
|
|
|
|
const isSystemRole = computed(() => {
|
|
return ['developer', 'owner', 'admin-toko', 'admin-bahan-baku', 'direktur', 'marketing-offline', 'marketing-online', 'cashier', 'non-operator'].includes(props.role.name);
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex items-center justify-end gap-1">
|
|
<RowEditAction v-if="can('roles.update')" :href="edit.url(role.id)" />
|
|
<RowDeleteAction v-if="can('roles.delete') && !isSystemRole" :action-url="destroy.url(role.id)" title="Hapus role?"
|
|
:description="`Role ${role.name} akan dihapus secara permanen. Tindakan ini tidak dapat dibatalkan.`"
|
|
error-message="Gagal menghapus role." />
|
|
</div>
|
|
</template>
|