super_admin.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div>
  3. <div class="explanation">
  4. <div class="px-6 d-flex flex-row align-center">
  5. <v-icon class="theme-primary">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. :model="AdminAccess"
  16. :entity="adminAccess"
  17. class="w-100"
  18. action-position="bottom"
  19. >
  20. <v-table class="mb-4">
  21. <tbody>
  22. <tr>
  23. <td>{{ $t('username') }} :</td>
  24. <td>{{ adminAccess.username }}</td>
  25. </tr>
  26. </tbody>
  27. </v-table>
  28. <UiInputText
  29. v-model="adminAccess.email"
  30. field="email"
  31. :rules="rules()"
  32. class="mx-4"
  33. variant="underlined"
  34. />
  35. </UiForm>
  36. <span v-else>{{ $t('no_admin_access_recorded') }}</span>
  37. </div>
  38. </template>
  39. <script setup lang="ts">
  40. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  41. import { useAccessProfileStore } from '~/stores/accessProfile'
  42. import AdminAccess from '~/models/Access/AdminAccess'
  43. import { useValidationUtils } from '~/composables/utils/useValidationUtils'
  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. padding: 60px 26px;
  62. text-align: justify;
  63. color: rgb(var(--v-theme-neutral-strong));
  64. .v-icon {
  65. background-color: rgb(var(--v-theme-primary));
  66. font-size: 22px;
  67. border-radius: 16px;
  68. margin: 3px;
  69. padding: 3px;
  70. height: 28px;
  71. width: 28px;
  72. }
  73. div:first-child {
  74. border-right: solid 1px rgb(var(--v-theme-primary));
  75. }
  76. }
  77. .v-table td:first-child {
  78. width: 180px;
  79. }
  80. </style>