fix: can access quotation
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:
parent
6b55701afb
commit
9999a49fa0
4 changed files with 25 additions and 12 deletions
|
|
@ -20,6 +20,7 @@ const props = withDefaults(
|
||||||
pageSize?: number;
|
pageSize?: number;
|
||||||
hideBtnPreview?: boolean;
|
hideBtnPreview?: boolean;
|
||||||
hideAction?: boolean;
|
hideAction?: boolean;
|
||||||
|
hideDelete?: boolean;
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
row: () => [],
|
row: () => [],
|
||||||
|
|
@ -148,13 +149,12 @@ defineEmits<{
|
||||||
flat
|
flat
|
||||||
@click.stop="$emit('view', props.row)"
|
@click.stop="$emit('view', props.row)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<KebabAction
|
<KebabAction
|
||||||
v-if="!hideAction"
|
v-if="!hideAction"
|
||||||
:idName="`btn-kebab-${props.row.workName}`"
|
:idName="`btn-kebab-${props.row.workName}`"
|
||||||
status="'ACTIVE'"
|
status="'ACTIVE'"
|
||||||
hide-toggle
|
hide-toggle
|
||||||
hide-delete
|
:hide-delete
|
||||||
:hide-edit="hideEdit"
|
:hide-edit="hideEdit"
|
||||||
@view="$emit('view', props.row)"
|
@view="$emit('view', props.row)"
|
||||||
@edit="$emit('edit', props.row)"
|
@edit="$emit('edit', props.row)"
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,7 @@ async function filterBySellerId() {
|
||||||
hide-icon
|
hide-icon
|
||||||
style="z-index: 999"
|
style="z-index: 999"
|
||||||
@click.stop="triggerAddQuotationDialog"
|
@click.stop="triggerAddQuotationDialog"
|
||||||
v-if="canAccess('quotation', 'edit')"
|
v-if="canAccess('quotation', 'create')"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="column full-height no-wrap">
|
<div class="column full-height no-wrap">
|
||||||
|
|
@ -670,7 +670,7 @@ async function filterBySellerId() {
|
||||||
<NoData
|
<NoData
|
||||||
v-if="
|
v-if="
|
||||||
pageState.inputSearch ||
|
pageState.inputSearch ||
|
||||||
!canAccess('quotation', 'edit') ||
|
!canAccess('quotation', 'create') ||
|
||||||
pageState.currentTab !== 'Issued'
|
pageState.currentTab !== 'Issued'
|
||||||
"
|
"
|
||||||
:not-found="!!pageState.inputSearch"
|
:not-found="!!pageState.inputSearch"
|
||||||
|
|
@ -680,7 +680,7 @@ async function filterBySellerId() {
|
||||||
v-if="
|
v-if="
|
||||||
!pageState.inputSearch &&
|
!pageState.inputSearch &&
|
||||||
pageState.currentTab === 'Issued' &&
|
pageState.currentTab === 'Issued' &&
|
||||||
canAccess('quotation', 'edit')
|
canAccess('quotation', 'create')
|
||||||
"
|
"
|
||||||
@click="triggerAddQuotationDialog"
|
@click="triggerAddQuotationDialog"
|
||||||
label="general.add"
|
label="general.add"
|
||||||
|
|
@ -711,6 +711,8 @@ async function filterBySellerId() {
|
||||||
:visible-columns="pageState.fieldSelected"
|
:visible-columns="pageState.fieldSelected"
|
||||||
:grid="pageState.gridView"
|
:grid="pageState.gridView"
|
||||||
:hide-edit="pageState.currentTab !== 'Issued'"
|
:hide-edit="pageState.currentTab !== 'Issued'"
|
||||||
|
:hide-action="!canAccess('quotation', 'edit')"
|
||||||
|
:hide-delete="!canAccess('quotation', 'delete')"
|
||||||
:hide-btn-preview="pageState.currentTab === 'PaymentSuccess'"
|
:hide-btn-preview="pageState.currentTab === 'PaymentSuccess'"
|
||||||
@preview="(id: any) => storeDataLocal(id)"
|
@preview="(id: any) => storeDataLocal(id)"
|
||||||
@view="
|
@view="
|
||||||
|
|
@ -736,7 +738,8 @@ async function filterBySellerId() {
|
||||||
<div class="col-md-4 col-sm-6 col-12 column">
|
<div class="col-md-4 col-sm-6 col-12 column">
|
||||||
<QuotationCard
|
<QuotationCard
|
||||||
class="col"
|
class="col"
|
||||||
hide-kebab-delete
|
:hide-action="!canAccess('quotation', 'edit')"
|
||||||
|
:hide-kebab-delete="!canAccess('quotation', 'delete')"
|
||||||
:hide-kebab-edit="!(pageState.currentTab === 'Issued')"
|
:hide-kebab-edit="!(pageState.currentTab === 'Issued')"
|
||||||
:hide-preview="pageState.currentTab === 'PaymentSuccess'"
|
:hide-preview="pageState.currentTab === 'PaymentSuccess'"
|
||||||
:urgent="item.row.urgent"
|
:urgent="item.row.urgent"
|
||||||
|
|
|
||||||
|
|
@ -1563,7 +1563,7 @@ function covertToNode() {
|
||||||
}}
|
}}
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<nav class="q-ml-auto">
|
<nav v-if="canAccess('quotation', 'edit')" class="q-ml-auto">
|
||||||
<AddButton
|
<AddButton
|
||||||
id="btn-add-worker"
|
id="btn-add-worker"
|
||||||
for="btn-add-worker"
|
for="btn-add-worker"
|
||||||
|
|
@ -1740,7 +1740,9 @@ function covertToNode() {
|
||||||
:readonly="
|
:readonly="
|
||||||
{
|
{
|
||||||
quotation: quotationFormState.mode !== 'edit',
|
quotation: quotationFormState.mode !== 'edit',
|
||||||
invoice: isRoleInclude(['sale', 'head_of_sale']),
|
invoice:
|
||||||
|
isRoleInclude(['sale', 'head_of_sale']) ||
|
||||||
|
!canAccess('quotation', 'edit'),
|
||||||
accepted: true,
|
accepted: true,
|
||||||
}[view]
|
}[view]
|
||||||
"
|
"
|
||||||
|
|
@ -1944,7 +1946,10 @@ function covertToNode() {
|
||||||
view !== View.Receipt &&
|
view !== View.Receipt &&
|
||||||
view !== View.Complete
|
view !== View.Complete
|
||||||
"
|
"
|
||||||
:readonly="isRoleInclude(['sale', 'head_of_sale'])"
|
:readonly="
|
||||||
|
isRoleInclude(['sale', 'head_of_sale']) ||
|
||||||
|
!canAccess('quotation', 'edit')
|
||||||
|
"
|
||||||
:data="quotationFormState.source"
|
:data="quotationFormState.source"
|
||||||
v-model:first-code-payment="firstCodePayment"
|
v-model:first-code-payment="firstCodePayment"
|
||||||
@fetch-status="
|
@fetch-status="
|
||||||
|
|
@ -2274,6 +2279,7 @@ function covertToNode() {
|
||||||
class="q-ml-sm"
|
class="q-ml-sm"
|
||||||
v-if="
|
v-if="
|
||||||
view === View.Accepted &&
|
view === View.Accepted &&
|
||||||
|
canAccess('quotation', 'edit') &&
|
||||||
quotationFormData.quotationStatus === 'Issued'
|
quotationFormData.quotationStatus === 'Issued'
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
@ -2313,6 +2319,7 @@ function covertToNode() {
|
||||||
class="q-ml-sm"
|
class="q-ml-sm"
|
||||||
v-if="
|
v-if="
|
||||||
view === View.Invoice &&
|
view === View.Invoice &&
|
||||||
|
canAccess('quotation', 'edit') &&
|
||||||
((quotationFormData.quotationStatus !== 'PaymentPending' &&
|
((quotationFormData.quotationStatus !== 'PaymentPending' &&
|
||||||
quotationFormData.payCondition !== 'Full') ||
|
quotationFormData.payCondition !== 'Full') ||
|
||||||
quotationFormData.quotationStatus === 'Accepted') &&
|
quotationFormData.quotationStatus === 'Accepted') &&
|
||||||
|
|
@ -2339,6 +2346,7 @@ function covertToNode() {
|
||||||
style="gap: var(--size-2)"
|
style="gap: var(--size-2)"
|
||||||
v-if="
|
v-if="
|
||||||
(view === View.Quotation &&
|
(view === View.Quotation &&
|
||||||
|
canAccess('quotation', 'edit') &&
|
||||||
(quotationFormData.quotationStatus === 'Issued' ||
|
(quotationFormData.quotationStatus === 'Issued' ||
|
||||||
quotationFormData.quotationStatus === 'Expired')) ||
|
quotationFormData.quotationStatus === 'Expired')) ||
|
||||||
!quotationFormData.quotationStatus
|
!quotationFormData.quotationStatus
|
||||||
|
|
|
||||||
|
|
@ -276,8 +276,10 @@ const permissions = {
|
||||||
view: allRoles,
|
view: allRoles,
|
||||||
},
|
},
|
||||||
quotation: {
|
quotation: {
|
||||||
edit: allRoles.slice(0, 9).filter((r) => r !== 'branch_accountant'),
|
create: allRoles.slice(0, 9).filter((r) => r !== 'branch_accountant'),
|
||||||
view: allRoles.slice(0, 9),
|
edit: allRoles.slice(0, 9),
|
||||||
|
delete: allRoles.slice(0, 6),
|
||||||
|
view: allRoles,
|
||||||
},
|
},
|
||||||
taskOrder: {
|
taskOrder: {
|
||||||
create: [...allRoles.slice(0, 6), 'data_entry'],
|
create: [...allRoles.slice(0, 6), 'data_entry'],
|
||||||
|
|
@ -305,7 +307,7 @@ const permissions = {
|
||||||
|
|
||||||
export function canAccess(
|
export function canAccess(
|
||||||
menu: keyof typeof permissions,
|
menu: keyof typeof permissions,
|
||||||
action: 'edit' | 'create' | 'view' = 'view',
|
action: 'edit' | 'create' | 'delete' | 'view' = 'view',
|
||||||
): boolean {
|
): boolean {
|
||||||
// uma_authorization = all roles
|
// uma_authorization = all roles
|
||||||
const roles = getRole() ?? [];
|
const roles = getRole() ?? [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue