super_admin.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. 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>{{ adminAccess.username }}</td>
  23. </tr>
  24. </tbody>
  25. </v-table>
  26. <UiInputText
  27. v-model="adminAccess.email"
  28. field="email"
  29. :rules="rules()"
  30. class="mx-4"
  31. variant="underlined"
  32. />
  33. </UiForm>
  34. <span v-else>{{ $t('no_admin_access_recorded') }}</span>
  35. </div>
  36. </template>
  37. <script setup lang="ts">
  38. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  39. import { useAccessProfileStore } from '~/stores/accessProfile'
  40. import AdminAccess from '~/models/Access/AdminAccess'
  41. import { useValidationUtils } from '~/composables/utils/useValidationUtils'
  42. definePageMeta({
  43. name: 'parameters_super_admin_page',
  44. })
  45. const { fetch } = useEntityFetch()
  46. const accessProfile = useAccessProfileStore()
  47. if (accessProfile.id === null) {
  48. throw new Error('Missing access profile id')
  49. }
  50. const { data: adminAccess, pending } = fetch(AdminAccess, accessProfile.id)
  51. const i18n = useI18n()
  52. const validationUtils = useValidationUtils()
  53. const rules = () => [
  54. (email: string | null) =>
  55. (email && validationUtils.validEmail(email)) || i18n.t('email_error'),
  56. ]
  57. </script>
  58. <style scoped lang="scss">
  59. .explanation {
  60. display: flex;
  61. flex-direction: row;
  62. padding: 60px 26px;
  63. text-align: justify;
  64. color: rgb(var(--v-theme-neutral-strong));
  65. .v-icon {
  66. background-color: rgb(var(--v-theme-primary));
  67. font-size: 22px;
  68. border-radius: 16px;
  69. margin: 3px;
  70. padding: 3px;
  71. height: 28px;
  72. width: 28px;
  73. }
  74. div:first-child {
  75. border-right: solid 1px rgb(var(--v-theme-primary));
  76. }
  77. }
  78. .v-table td:first-child {
  79. width: 180px;
  80. }
  81. </style>