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