Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/authorization/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ export default {
"APP_STORE_PERMISSIONS_VIEW": "APP_STORE_PERMISSIONS_VIEW",
"APP_SETTINGS_VIEW": "APP_SETTINGS_VIEW",
"APP_COUNT_VIEW": "APP_COUNT_VIEW",
"APP_PRODUCT_IDENTIFIER_UPDATE": "APP_PRODUCT_IDENTIFIER_UPDATE"
"APP_PRODUCT_IDENTIFIER_UPDATE": "APP_PRODUCT_IDENTIFIER_UPDATE",
"APP_COMMERCE_VIEW": "APP_COMMERCE_VIEW"
}
3 changes: 2 additions & 1 deletion src/authorization/Rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export default {
"APP_SETTINGS_VIEW": "",
"APP_COUNT_VIEW": "FULFILL_INVCUNT_ADMIN OR INV_COUNT_ADMIN",
"APP_PRODUCT_IDENTIFIER_UPDATE": "COMMON_ADMIN",
"INVCOUNT_APP_VIEW": "INVCOUNT_APP_VIEW"
"INVCOUNT_APP_VIEW": "INVCOUNT_APP_VIEW",
"APP_COMMERCE_VIEW": "COMMERCEUSER_VIEW"
} as any
2 changes: 1 addition & 1 deletion src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<ion-card-content>
{{ $t('This is the name of the OMS you are connected to right now. Make sure that you are connected to the right instance before proceeding.') }}
</ion-card-content>
<ion-button v-if="!authStore.isEmbedded" :disabled="!omsRedirectionInfo.token || !omsRedirectionInfo.url" @click="goToOms(omsRedirectionInfo.token, omsRedirectionInfo.url)" fill="clear">
<ion-button v-if="!authStore.isEmbedded" :disabled="!omsRedirectionInfo.token || !omsRedirectionInfo.url || !hasPermission(Actions.APP_COMMERCE_VIEW)" @click="goToOms(omsRedirectionInfo.token, omsRedirectionInfo.url)" fill="clear">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and maintainability, consider extracting the logic for the :disabled attribute into a computed property. This keeps the template cleaner and centralizes the logic in the script section.

You could add a computed property like this in your <script setup>:

const isGoToOmsDisabled = computed(() => {
  return !omsRedirectionInfo.value.token || !omsRedirectionInfo.value.url || !hasPermission(Actions.APP_COMMERCE_VIEW);
});

And then use it in the template:

<ion-button ... :disabled="isGoToOmsDisabled" ...>

{{ $t('Go to OMS') }}
<ion-icon slot="end" :icon="openOutline" />
</ion-button>
Expand Down
Loading