SuperAdmin.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!--
  2. Super Admin bar : Barre qui s'affiche lorsque l'utilisateur est un super admin en mode switch
  3. -->
  4. <template>
  5. <UiSystemBar v-if="show" color="ot_danger">
  6. <template #bar.text>
  7. <v-icon small>
  8. fas fa-exclamation-triangle
  9. </v-icon>
  10. <span>{{ $t('super_admin_switch_account') }}</span>
  11. <a :href="url" class="ot_black--text text-decoration-none"><strong>{{ $t('click_here') }}</strong></a>
  12. </template>
  13. </UiSystemBar>
  14. </template>
  15. <script lang="ts">
  16. import { defineComponent, useContext } from '@nuxtjs/composition-api'
  17. export default defineComponent({
  18. setup () {
  19. const { $config, store } = useContext()
  20. const baseLegacyUrl:string = $config.baseURL_adminLegacy
  21. const originalAccess = store.state.profile.access.originalAccess
  22. let show = false
  23. let url = ''
  24. if (originalAccess !== null) {
  25. show = originalAccess.isSuperAdminAccess
  26. url = `${baseLegacyUrl}/switch_user/${originalAccess.organization.id}/${originalAccess.id}/exit`
  27. }
  28. return { show, url }
  29. }
  30. })
  31. </script>
  32. <style scoped>
  33. </style>