super_admin.vue 2.4 KB

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