refactor: update role checks and access control in MainPage and QuotationFormProductSelect components
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s

This commit is contained in:
puriphatt 2025-07-03 15:19:41 +07:00
parent 2269038e11
commit e9d995fa3e
2 changed files with 20 additions and 22 deletions

View file

@ -41,7 +41,7 @@ import PaginationPageSize from 'src/components/PaginationPageSize.vue';
import useFlowStore from 'stores/flow';
import { dateFormat } from 'src/utils/datetime';
import { formatNumberDecimal, isRoleInclude, notify } from 'stores/utils';
import { formatNumberDecimal, isRoleInclude, canAccess } from 'stores/utils';
const { getWorkflowTemplate } = useWorkflowTemplate();
import { Status } from 'stores/types';
@ -143,27 +143,25 @@ const { t } = useI18n();
const baseUrl = ref<string>(import.meta.env.VITE_API_BASE_URL);
const priceDisplay = computed(() => ({
price: !isRoleInclude(['sale_agent']),
// price: !isRoleInclude(['sale_agent']),
price: true,
agentPrice: isRoleInclude([
'admin',
'head_of_admin',
'head_of_sale',
'system',
'owner',
'head_of_admin',
'admin',
'executive',
'accountant',
'sale_agent',
'head_of_sale',
]),
serviceCharge: isRoleInclude([
'admin',
'head_of_admin',
'system',
'owner',
'head_of_admin',
'admin',
'executive',
'accountant',
]),
}));
const actionDisplay = computed(() =>
isRoleInclude(['admin', 'head_of_admin', 'system', 'owner', 'accountant']),
);
const actionDisplay = computed(() => canAccess('product', 'edit'));
const splitterModel = computed(() =>
$q.screen.lt.md ? (productMode.value !== 'group' ? 0 : 100) : 25,
);

View file

@ -66,21 +66,21 @@ const serviceList = defineModel<Partial<Record<ProductGroupId, Service[]>>>(
);
const priceDisplay = computed(() => ({
price: !isRoleInclude(['sale_agent']),
// price: !isRoleInclude(['sale_agent']),
price: true,
agentPrice: isRoleInclude([
'admin',
'head_of_admin',
'head_of_sale',
'system',
'owner',
'head_of_admin',
'admin',
'executive',
'accountant',
'sale_agent',
'head_of_sale',
]),
serviceCharge: isRoleInclude([
'admin',
'head_of_admin',
'system',
'owner',
'head_of_admin',
'admin',
'executive',
'accountant',
]),
}));