super_admin.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div>
  3. <div class="explanation">
  4. <div class="px-4 d-flex flex-row align-center justify-center py-2">
  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. @media (max-width: 600px) {
  77. flex-direction: column;
  78. justify-content: center;
  79. }
  80. }
  81. .v-table td:first-child {
  82. width: 180px;
  83. }
  84. </style>