refactor: handle roles executive
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 8s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 8s
This commit is contained in:
parent
724f71ae4f
commit
49d860a108
4 changed files with 11 additions and 18 deletions
|
|
@ -1344,10 +1344,7 @@ export default {
|
|||
Document: 'Document Status Report',
|
||||
Invoice: 'Payment Report',
|
||||
Product: 'Product and Service Report',
|
||||
admin: {
|
||||
Product: 'Product Movement Report',
|
||||
Sale: 'Sales Summary Report',
|
||||
},
|
||||
Sale: 'Sales Summary Report',
|
||||
},
|
||||
document: {
|
||||
code: 'Code',
|
||||
|
|
|
|||
|
|
@ -1322,10 +1322,7 @@ export default {
|
|||
Document: 'รายงานสถานะเอกสาร',
|
||||
Invoice: 'รายงานการชำระเงิน',
|
||||
Product: 'รายงานสินค้าและบริการ',
|
||||
admin: {
|
||||
Product: 'รายงานการเคลื่อนไหวของสินค้า',
|
||||
Sale: 'รายงานสรุปยอดขาย',
|
||||
},
|
||||
Sale: 'รายงานสรุปยอดขาย',
|
||||
},
|
||||
document: {
|
||||
code: 'รหัส',
|
||||
|
|
|
|||
|
|
@ -62,24 +62,23 @@ onMounted(async () => {
|
|||
navigatorStore.current.path = [{ text: '' }];
|
||||
});
|
||||
|
||||
const isAdmin = computed(() => {
|
||||
const isExecutive = computed(() => {
|
||||
const roles = userRoles.value;
|
||||
|
||||
return roles.includes('head_of_admin') || roles.includes('head_of_account');
|
||||
return roles.includes('executive');
|
||||
});
|
||||
|
||||
const filteredTabs = computed(() => {
|
||||
return pageTabs.filter((tab) => {
|
||||
if (isAdmin.value) {
|
||||
return !(tab.by.length === 1 && tab.by.includes('user'));
|
||||
} else {
|
||||
return !(tab.by.length === 1 && tab.by.includes('admin'));
|
||||
if (!isExecutive.value) {
|
||||
return !tab.by.includes('admin');
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
const pageState = reactive({
|
||||
currentTab: isAdmin.value ? ViewMode.Product : ViewMode.Document,
|
||||
currentTab: isExecutive.value ? ViewMode.Product : ViewMode.Document,
|
||||
});
|
||||
|
||||
async function fetchReportTab() {
|
||||
|
|
@ -152,7 +151,7 @@ watch([() => pageState.currentTab], async () => {
|
|||
: 'app-text-muted'
|
||||
"
|
||||
>
|
||||
{{ $t(`report.view${isAdmin ? '.admin' : ''}.${tab.label}`) }}
|
||||
{{ $t(`report.view.${tab.label}`) }}
|
||||
</div>
|
||||
</q-tab>
|
||||
</q-tabs>
|
||||
|
|
|
|||
|
|
@ -148,6 +148,6 @@ export const colReportBySale = [
|
|||
export const pageTabs = [
|
||||
{ label: 'Document', value: ViewMode.Document, by: ['user'] },
|
||||
{ label: 'Invoice', value: ViewMode.Invoice, by: ['user'] },
|
||||
{ label: 'Product', value: ViewMode.Product, by: ['user', 'admin'] },
|
||||
{ label: 'Product', value: ViewMode.Product, by: ['user'] },
|
||||
{ label: 'Sale', value: ViewMode.Sale, by: ['admin'] },
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue