Merge branch 'develop'
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s
This commit is contained in:
commit
1101fa68d8
4 changed files with 118 additions and 29 deletions
|
|
@ -7,6 +7,7 @@ import useMyBranch from 'stores/my-branch';
|
||||||
import { getUserId, getRole } from 'src/services/keycloak';
|
import { getUserId, getRole } from 'src/services/keycloak';
|
||||||
import { useQuasar } from 'quasar';
|
import { useQuasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { isRoleInclude } from 'src/stores/utils';
|
||||||
|
|
||||||
type Menu = {
|
type Menu = {
|
||||||
label: string;
|
label: string;
|
||||||
|
|
@ -70,44 +71,82 @@ function initMenu() {
|
||||||
{
|
{
|
||||||
label: 'branch',
|
label: 'branch',
|
||||||
route: '/branch-management',
|
route: '/branch-management',
|
||||||
hidden: !(
|
hidden: !isRoleInclude([
|
||||||
role.value.includes('admin') ||
|
'system',
|
||||||
role.value.includes('branch_manager') ||
|
'head_of_admin',
|
||||||
role.value.includes('head_of_admin') ||
|
'admin',
|
||||||
role.value.includes('system') ||
|
'branch_manager',
|
||||||
role.value.includes('owner') ||
|
'head_of_accountant',
|
||||||
role.value.includes('head_of_account')
|
]),
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'personnel',
|
label: 'personnel',
|
||||||
route: '/personnel-management',
|
route: '/personnel-management',
|
||||||
hidden: !(
|
hidden: !isRoleInclude([
|
||||||
role.value.includes('admin') ||
|
'owner',
|
||||||
role.value.includes('head_of_admin') ||
|
'system',
|
||||||
role.value.includes('system') ||
|
'head_of_admin',
|
||||||
role.value.includes('owner') ||
|
'admin',
|
||||||
role.value.includes('branch_manager')
|
'branch_manager',
|
||||||
),
|
]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'workflow',
|
||||||
|
route: '/workflow',
|
||||||
|
hidden: !isRoleInclude(['system', 'head_of_admin', 'admin']),
|
||||||
},
|
},
|
||||||
{ label: 'workflow', route: '/workflow' },
|
|
||||||
{
|
{
|
||||||
label: 'property',
|
label: 'property',
|
||||||
route: '/property',
|
route: '/property',
|
||||||
hidden: !(
|
hidden: !isRoleInclude(['system', 'head_of_admin', 'admin']),
|
||||||
role.value.includes('admin') ||
|
},
|
||||||
role.value.includes('head_of_admin') ||
|
{
|
||||||
role.value.includes('system')
|
label: 'productService',
|
||||||
),
|
route: '/product-service',
|
||||||
|
hidden: !isRoleInclude([
|
||||||
|
'system',
|
||||||
|
'head_of_admin',
|
||||||
|
'admin',
|
||||||
|
'branch_manager',
|
||||||
|
'head_of_accountant',
|
||||||
|
'head_of_sale',
|
||||||
|
'sale',
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'customer',
|
||||||
|
route: '/customer-management',
|
||||||
|
hidden: !isRoleInclude([
|
||||||
|
'system',
|
||||||
|
'head_of_admin',
|
||||||
|
'admin',
|
||||||
|
'branch_manager',
|
||||||
|
'head_of_accountant',
|
||||||
|
'accountant',
|
||||||
|
'head_of_sale',
|
||||||
|
'sale',
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'agencies',
|
||||||
|
route: '/agencies-management',
|
||||||
|
hidden: !isRoleInclude(['system', 'head_of_admin', 'admin']),
|
||||||
},
|
},
|
||||||
{ label: 'productService', route: '/product-service' },
|
|
||||||
{ label: 'customer', route: '/customer-management' },
|
|
||||||
{ label: 'agencies', route: '/agencies-management' },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'menu.sales',
|
label: 'menu.sales',
|
||||||
icon: 'mdi-store-settings-outline',
|
icon: 'mdi-store-settings-outline',
|
||||||
|
hidden: !isRoleInclude([
|
||||||
|
'system',
|
||||||
|
'head_of_admin',
|
||||||
|
'admin',
|
||||||
|
'branch_manager',
|
||||||
|
'head_of_accountant',
|
||||||
|
'accountant',
|
||||||
|
'head_of_sale',
|
||||||
|
'sale',
|
||||||
|
]),
|
||||||
children: [
|
children: [
|
||||||
{ label: 'quotation', route: '/quotation' },
|
{ label: 'quotation', route: '/quotation' },
|
||||||
{ label: 'invoice', route: '/invoice' },
|
{ label: 'invoice', route: '/invoice' },
|
||||||
|
|
@ -130,6 +169,16 @@ function initMenu() {
|
||||||
label: 'menu.account',
|
label: 'menu.account',
|
||||||
icon: 'mdi-bank-outline',
|
icon: 'mdi-bank-outline',
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
hidden: !isRoleInclude([
|
||||||
|
'system',
|
||||||
|
'head_of_admin',
|
||||||
|
'admin',
|
||||||
|
'branch_manager',
|
||||||
|
'head_of_accountant',
|
||||||
|
'accountant',
|
||||||
|
'head_of_sale',
|
||||||
|
'sale',
|
||||||
|
]),
|
||||||
children: [
|
children: [
|
||||||
{ label: 'receipt', route: '/receipt' },
|
{ label: 'receipt', route: '/receipt' },
|
||||||
{ label: 'creditNote', route: '/credit-note' },
|
{ label: 'creditNote', route: '/credit-note' },
|
||||||
|
|
@ -151,6 +200,7 @@ function initMenu() {
|
||||||
{
|
{
|
||||||
label: 'menu.overall',
|
label: 'menu.overall',
|
||||||
icon: 'mdi-monitor-dashboard',
|
icon: 'mdi-monitor-dashboard',
|
||||||
|
hidden: !isRoleInclude(['system', 'head_of_admin', 'admin', 'executive']),
|
||||||
children: [
|
children: [
|
||||||
{ label: 'report', route: '/report' },
|
{ label: 'report', route: '/report' },
|
||||||
{ label: 'dashboard', route: '/dash-board' },
|
{ label: 'dashboard', route: '/dash-board' },
|
||||||
|
|
@ -163,7 +213,7 @@ function initMenu() {
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
label: 'usage',
|
label: 'usage',
|
||||||
route: `/manual`,
|
route: '/manual',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
@ -250,7 +300,13 @@ onMounted(async () => {
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div id="drawer-menu" class="q-pl-md q-mr-xs q-gutter-y-sm">
|
<div id="drawer-menu" class="q-pl-md q-mr-xs q-gutter-y-sm">
|
||||||
<template v-for="(menu, i) in menuData" :key="i">
|
<template
|
||||||
|
v-for="(menu, i) in menuData.filter(
|
||||||
|
(v) =>
|
||||||
|
!(v.children?.length === 0 || v.children?.every((i) => i.hidden)),
|
||||||
|
)"
|
||||||
|
:key="i"
|
||||||
|
>
|
||||||
<q-expansion-item
|
<q-expansion-item
|
||||||
v-if="!menu.hidden"
|
v-if="!menu.hidden"
|
||||||
:id="menu.label"
|
:id="menu.label"
|
||||||
|
|
@ -444,8 +500,9 @@ onMounted(async () => {
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- v-if="!mini" -->
|
||||||
<q-btn
|
<q-btn
|
||||||
v-if="!mini"
|
v-if="false"
|
||||||
dense
|
dense
|
||||||
flat
|
flat
|
||||||
rounded
|
rounded
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import { useRequestList } from 'src/stores/request-list';
|
||||||
import { RequestData, RequestDataStatus } from 'src/stores/request-list/types';
|
import { RequestData, RequestDataStatus } from 'src/stores/request-list/types';
|
||||||
import { dialogWarningClose } from 'src/stores/utils';
|
import { dialogWarningClose } from 'src/stores/utils';
|
||||||
import { CancelButton, SaveButton } from 'src/components/button';
|
import { CancelButton, SaveButton } from 'src/components/button';
|
||||||
|
import { getRole } from 'src/services/keycloak';
|
||||||
|
|
||||||
const $q = useQuasar();
|
const $q = useQuasar();
|
||||||
const navigatorStore = useNavigator();
|
const navigatorStore = useNavigator();
|
||||||
|
|
@ -92,6 +93,19 @@ function triggerCancel(id: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hideAction = computed(() => {
|
||||||
|
const role = getRole();
|
||||||
|
const allowedRoles = [
|
||||||
|
'head_of_admin',
|
||||||
|
'head_of_sale',
|
||||||
|
'admin',
|
||||||
|
'sale',
|
||||||
|
'system',
|
||||||
|
];
|
||||||
|
|
||||||
|
return !role || !role.some((r) => allowedRoles.includes(r));
|
||||||
|
});
|
||||||
|
|
||||||
function triggerView(opts: { requestData: RequestData }) {
|
function triggerView(opts: { requestData: RequestData }) {
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
`/request-list/${opts.requestData.id}`,
|
`/request-list/${opts.requestData.id}`,
|
||||||
|
|
@ -379,6 +393,7 @@ watch([() => pageState.inputSearch, () => pageState.statusFilter], () => {
|
||||||
:rows="data"
|
:rows="data"
|
||||||
:grid="pageState.gridView"
|
:grid="pageState.gridView"
|
||||||
:visible-columns="pageState.fieldSelected"
|
:visible-columns="pageState.fieldSelected"
|
||||||
|
:hide-action
|
||||||
@view="(data) => triggerView({ requestData: data })"
|
@view="(data) => triggerView({ requestData: data })"
|
||||||
@delete="(data) => triggerCancel(data.id)"
|
@delete="(data) => triggerCancel(data.id)"
|
||||||
@reject-cancel="
|
@reject-cancel="
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import { baseUrl } from 'src/stores/utils';
|
||||||
import { ProductRelation, PayCondition } from 'src/stores/quotations/types';
|
import { ProductRelation, PayCondition } from 'src/stores/quotations/types';
|
||||||
import { Step, RequestWorkStatus } from 'src/stores/request-list/types';
|
import { Step, RequestWorkStatus } from 'src/stores/request-list/types';
|
||||||
import BadgeComponent from 'src/components/BadgeComponent.vue';
|
import BadgeComponent from 'src/components/BadgeComponent.vue';
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { getRole } from 'src/services/keycloak';
|
||||||
|
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
(
|
(
|
||||||
|
|
@ -34,6 +36,19 @@ const props = defineProps<{
|
||||||
orderAble?: boolean;
|
orderAble?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const canCanceled = computed(() => {
|
||||||
|
const role = getRole();
|
||||||
|
const allowedRoles = [
|
||||||
|
'head_of_admin',
|
||||||
|
'head_of_sale',
|
||||||
|
'admin',
|
||||||
|
'sale',
|
||||||
|
'system',
|
||||||
|
];
|
||||||
|
|
||||||
|
return !role || role.some((r) => allowedRoles.includes(r));
|
||||||
|
});
|
||||||
|
|
||||||
function changeableStatus(currentStatus?: RequestWorkStatus) {
|
function changeableStatus(currentStatus?: RequestWorkStatus) {
|
||||||
switch (currentStatus) {
|
switch (currentStatus) {
|
||||||
case RequestWorkStatus.Ready:
|
case RequestWorkStatus.Ready:
|
||||||
|
|
@ -53,7 +68,7 @@ function changeableStatus(currentStatus?: RequestWorkStatus) {
|
||||||
RequestWorkStatus.Ready,
|
RequestWorkStatus.Ready,
|
||||||
RequestWorkStatus.Ended,
|
RequestWorkStatus.Ended,
|
||||||
RequestWorkStatus.Canceled,
|
RequestWorkStatus.Canceled,
|
||||||
];
|
].filter((v) => canCanceled.value || v !== RequestWorkStatus.Canceled);
|
||||||
if (props.orderAble) {
|
if (props.orderAble) {
|
||||||
return props.requestCancel && !props.rejectRequestCancel
|
return props.requestCancel && !props.rejectRequestCancel
|
||||||
? [...statuses, RequestWorkStatus.RejectCancel]
|
? [...statuses, RequestWorkStatus.RejectCancel]
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ const props = withDefaults(
|
||||||
columns: QTableProps['columns'];
|
columns: QTableProps['columns'];
|
||||||
grid?: boolean;
|
grid?: boolean;
|
||||||
visibleColumns?: string[];
|
visibleColumns?: string[];
|
||||||
|
hideAction?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
row: () => [],
|
row: () => [],
|
||||||
|
|
@ -224,6 +225,7 @@ function getEmployeeName(
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<KebabAction
|
<KebabAction
|
||||||
|
v-if="!hideAction"
|
||||||
:id-name="`btn-kebab-${props.row.code}`"
|
:id-name="`btn-kebab-${props.row.code}`"
|
||||||
hide-edit
|
hide-edit
|
||||||
hide-toggle
|
hide-toggle
|
||||||
|
|
@ -255,7 +257,7 @@ function getEmployeeName(
|
||||||
hide-kebab-view
|
hide-kebab-view
|
||||||
hide-kebab-edit
|
hide-kebab-edit
|
||||||
hide-kebab-delete
|
hide-kebab-delete
|
||||||
use-cancel
|
:use-cancel="!hideAction"
|
||||||
class="full-height"
|
class="full-height"
|
||||||
:use-reject-cancel="
|
:use-reject-cancel="
|
||||||
props.row.customerRequestCancel && !props.row.rejectRequestCancel
|
props.row.customerRequestCancel && !props.row.rejectRequestCancel
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue