super_admin.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div>
  3. <div class="explanation">
  4. <div class="px-4 d-flex flex-row align-center">
  5. <v-icon class="theme-info">fa fa-info</v-icon>
  6. </div>
  7. <div class="px-2">
  8. {{ $t('super_admin_explanation_text') }}
  9. </div>
  10. </div>
  11. <UiLoadingPanel v-if="pending" />
  12. <UiForm
  13. v-else-if="adminAccess"
  14. ref="form"
  15. v-model="adminAccess"
  16. class="w-100"
  17. >
  18. <v-table class="mb-4">
  19. <tbody>
  20. <tr>
  21. <td>{{ $t('username') }} :</td>
  22. <td><b>{{ adminAccess.username }}</b></td>
  23. </tr>
  24. </tbody>
  25. </v-table>
  26. <UiInputEmail
  27. v-model="adminAccess.email"
  28. field="email"
  29. :label="$t('associated_email')"
  30. class="mx-4"
  31. />
  32. </UiForm>
  33. <span v-else>{{ $t('no_admin_access_recorded') }}</span>
  34. </div>
  35. </template>
  36. <script setup lang="ts">
  37. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  38. import { useAccessProfileStore } from '~/stores/accessProfile'
  39. import AdminAccess from '~/models/Access/AdminAccess'
  40. import { useValidationUtils } from '~/composables/utils/useValidationUtils'
  41. definePageMeta({
  42. name: 'parameters_super_admin_page',
  43. })
  44. const { fetch } = useEntityFetch()
  45. const accessProfile = useAccessProfileStore()
  46. if (accessProfile.id === null) {
  47. throw new Error('Missing access profile id')
  48. }
  49. const { data: adminAccess, pending } = fetch(AdminAccess, accessProfile.id)
  50. const i18n = useI18n()
  51. const validationUtils = useValidationUtils()
  52. const rules = () => [
  53. (email: string | null) =>
  54. (email && validationUtils.validEmail(email)) || i18n.t('email_error'),
  55. ]
  56. </script>
  57. <style scoped lang="scss">
  58. .explanation {
  59. display: flex;
  60. flex-direction: row;
  61. margin: 32px;
  62. padding: 8px 4px;
  63. border-radius: 6px;
  64. text-align: justify;
  65. color: rgb(var(--v-theme-info));
  66. border: solid 1px rgb(var(--v-theme-info));
  67. .v-icon {
  68. color: rgb(var(--v-theme-info));
  69. font-size: 22px;
  70. border-radius: 16px;
  71. margin: 3px 1px;
  72. padding: 3px;
  73. height: 28px;
  74. width: 28px;
  75. }
  76. }
  77. .v-table td:first-child {
  78. width: 180px;
  79. }
  80. </style>