refactor: role admin view
This commit is contained in:
parent
b2290ddf0e
commit
8286ea19b9
2 changed files with 201 additions and 168 deletions
|
|
@ -1,104 +1,121 @@
|
|||
<script setup lang="ts">
|
||||
import MenuItem from 'components/00_home/MenuItem.vue';
|
||||
import useUtilsStore from 'stores/utils';
|
||||
import { onMounted } from 'vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { getRole } from 'src/services/keycloak';
|
||||
|
||||
const utilsStore = useUtilsStore();
|
||||
const menu = [
|
||||
{
|
||||
value: 'branch-management',
|
||||
icon: 'mdi-chart-donut',
|
||||
color: 'green',
|
||||
title: 'mainBranchTitle',
|
||||
caption: 'mainBranchCaption',
|
||||
},
|
||||
{
|
||||
value: 'personnel-management',
|
||||
icon: 'fa6-solid:building-user',
|
||||
color: 'cyan',
|
||||
title: 'mainPersonnelTitle',
|
||||
caption: 'mainPersonnelCaption',
|
||||
},
|
||||
{
|
||||
value: 'customer-management',
|
||||
icon: 'isax-frame5',
|
||||
color: 'cyan',
|
||||
title: 'mainCustomerTitle',
|
||||
caption: 'mainCustomerCaption',
|
||||
isax: true,
|
||||
},
|
||||
{
|
||||
value: 'product-service',
|
||||
icon: 'heroicons-truck-solid',
|
||||
color: 'orange',
|
||||
title: 'mainProductTitle',
|
||||
caption: 'mainProductCaption',
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'mdi-file-document',
|
||||
color: 'violet',
|
||||
title: 'mainQuotationTitle',
|
||||
caption: 'mainQuotationCaption',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'isax-device-message5',
|
||||
color: 'purple',
|
||||
title: 'mainRequestTitle',
|
||||
caption: 'mainRequestCaption',
|
||||
isax: true,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'isax-receipt-2-15',
|
||||
color: 'red',
|
||||
title: 'mainOrderTitle',
|
||||
caption: 'mainOrderCaption',
|
||||
isax: true,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'material-symbols:box',
|
||||
color: 'camo',
|
||||
title: 'mainReceiptTitle',
|
||||
caption: 'mainReceiptCaption',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'isax-dollar-circle4',
|
||||
color: 'lime',
|
||||
title: 'mainFinanceTitle',
|
||||
caption: 'mainFinanceCaption',
|
||||
isax: true,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'isax-element-35',
|
||||
color: 'cyan',
|
||||
title: 'mainDashboardTitle',
|
||||
caption: 'mainDashboardCaption',
|
||||
isax: true,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'mdi-file-document',
|
||||
color: 'indigo',
|
||||
title: 'mainReportTitle',
|
||||
caption: 'mainReportCaption',
|
||||
disabled: true,
|
||||
},
|
||||
] satisfies InstanceType<typeof MenuItem>['$props']['list'];
|
||||
const menu = ref<InstanceType<typeof MenuItem>['$props']['list']>([]);
|
||||
const role = ref();
|
||||
|
||||
onMounted(() => {
|
||||
utilsStore.currentTitle.title = '';
|
||||
utilsStore.currentTitle.path = [{ text: '' }];
|
||||
|
||||
role.value = getRole();
|
||||
menu.value = [
|
||||
{
|
||||
value: 'branch-management',
|
||||
icon: 'mdi-chart-donut',
|
||||
color: 'green',
|
||||
title: 'mainBranchTitle',
|
||||
caption: 'mainBranchCaption',
|
||||
hidden:
|
||||
role.value.includes('admin') ||
|
||||
role.value.includes('branch_admin') ||
|
||||
role.value.includes('head_of_admin')
|
||||
? false
|
||||
: true,
|
||||
},
|
||||
{
|
||||
value: 'personnel-management',
|
||||
icon: 'fa6-solid:building-user',
|
||||
color: 'cyan',
|
||||
title: 'mainPersonnelTitle',
|
||||
caption: 'mainPersonnelCaption',
|
||||
hidden:
|
||||
role.value.includes('admin') ||
|
||||
role.value.includes('branch_admin') ||
|
||||
role.value.includes('head_of_admin')
|
||||
? false
|
||||
: true,
|
||||
},
|
||||
{
|
||||
value: 'customer-management',
|
||||
icon: 'isax-frame5',
|
||||
color: 'cyan',
|
||||
title: 'mainCustomerTitle',
|
||||
caption: 'mainCustomerCaption',
|
||||
isax: true,
|
||||
},
|
||||
{
|
||||
value: 'product-service',
|
||||
icon: 'heroicons-truck-solid',
|
||||
color: 'orange',
|
||||
title: 'mainProductTitle',
|
||||
caption: 'mainProductCaption',
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'mdi-file-document',
|
||||
color: 'violet',
|
||||
title: 'mainQuotationTitle',
|
||||
caption: 'mainQuotationCaption',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'isax-device-message5',
|
||||
color: 'purple',
|
||||
title: 'mainRequestTitle',
|
||||
caption: 'mainRequestCaption',
|
||||
isax: true,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'isax-receipt-2-15',
|
||||
color: 'red',
|
||||
title: 'mainOrderTitle',
|
||||
caption: 'mainOrderCaption',
|
||||
isax: true,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'material-symbols:box',
|
||||
color: 'camo',
|
||||
title: 'mainReceiptTitle',
|
||||
caption: 'mainReceiptCaption',
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'isax-dollar-circle4',
|
||||
color: 'lime',
|
||||
title: 'mainFinanceTitle',
|
||||
caption: 'mainFinanceCaption',
|
||||
isax: true,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'isax-element-35',
|
||||
color: 'cyan',
|
||||
title: 'mainDashboardTitle',
|
||||
caption: 'mainDashboardCaption',
|
||||
isax: true,
|
||||
disabled: true,
|
||||
},
|
||||
{
|
||||
value: '',
|
||||
icon: 'mdi-file-document',
|
||||
color: 'indigo',
|
||||
title: 'mainReportTitle',
|
||||
caption: 'mainReportCaption',
|
||||
disabled: true,
|
||||
},
|
||||
];
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue