super_admin.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <div>
  3. <h3>{{ $t("parameters_super_admin_page")}}</h3>
  4. <div class="explanation">
  5. <div class="px-4 d-flex flex-row align-center justify-center py-2">
  6. <v-icon class="theme-info">fa fa-info</v-icon>
  7. </div>
  8. <div class="px-2">
  9. {{ $t('super_admin_explanation_text') }}
  10. </div>
  11. </div>
  12. <UiLoadingPanel v-if="pending" />
  13. <UiForm
  14. v-else-if="adminAccess"
  15. ref="form"
  16. v-model="adminAccess"
  17. class="w-100"
  18. >
  19. <v-table class="mb-4">
  20. <tbody>
  21. <tr>
  22. <td>{{ $t('username') }} :</td>
  23. <td><b>{{ adminAccess.username }}</b></td>
  24. </tr>
  25. </tbody>
  26. </v-table>
  27. <UiInputEmail
  28. v-model="adminAccess.email"
  29. field="email"
  30. :label="$t('associated_email')"
  31. class="mx-4"
  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. margin: 32px;
  63. padding: 8px 4px;
  64. border-radius: 6px;
  65. text-align: justify;
  66. color: rgb(var(--v-theme-info));
  67. border: solid 1px rgb(var(--v-theme-info));
  68. .v-icon {
  69. color: rgb(var(--v-theme-info));
  70. font-size: 22px;
  71. border-radius: 16px;
  72. margin: 3px 1px;
  73. padding: 3px;
  74. height: 28px;
  75. width: 28px;
  76. }
  77. @media (max-width: 600px) {
  78. flex-direction: column;
  79. justify-content: center;
  80. }
  81. }
  82. .v-table td:first-child {
  83. width: 180px;
  84. }
  85. </style>