super_admin.vue 2.1 KB

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