super_admin.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <div>
  3. <h3 class="my-8">{{ $t("parameters_super_admin_page")}}</h3>
  4. <v-card class="parameters-page-card">
  5. <div class="explanation">
  6. <div class="px-4 d-flex flex-row align-center justify-center py-2">
  7. <v-icon class="theme-info">fa fa-info</v-icon>
  8. </div>
  9. <div class="px-2 d-flex flex-row align-center justify-center">
  10. {{ $t('super_admin_explanation_text') }}
  11. </div>
  12. </div>
  13. <UiLoadingPanel v-if="pending" />
  14. <UiForm
  15. v-else-if="adminAccess"
  16. ref="form"
  17. v-model="adminAccess"
  18. class="w-100"
  19. >
  20. <v-table class="mb-4">
  21. <tbody>
  22. <tr>
  23. <td>{{ $t('username') }} :</td>
  24. <td><b>{{ adminAccess.username }}</b></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. </v-card>
  37. </div>
  38. </template>
  39. <script setup lang="ts">
  40. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  41. import { useAccessProfileStore } from '~/stores/accessProfile'
  42. import AdminAccess from '~/models/Access/AdminAccess'
  43. import { useValidationUtils } from '~/composables/utils/useValidationUtils'
  44. definePageMeta({
  45. name: 'parameters_super_admin_page',
  46. })
  47. const { fetch } = useEntityFetch()
  48. const accessProfile = useAccessProfileStore()
  49. if (accessProfile.id === null) {
  50. throw new Error('Missing access profile id')
  51. }
  52. const { data: adminAccess, pending } = fetch(AdminAccess, accessProfile.id)
  53. const i18n = useI18n()
  54. const validationUtils = useValidationUtils()
  55. const rules = () => [
  56. (email: string | null) =>
  57. (email && validationUtils.validEmail(email)) || i18n.t('email_error'),
  58. ]
  59. </script>
  60. <style scoped lang="scss">
  61. .explanation {
  62. display: flex;
  63. flex-direction: row;
  64. margin: 32px;
  65. padding: 8px 4px;
  66. border-radius: 6px;
  67. text-align: justify;
  68. color: rgb(var(--v-theme-info));
  69. border: solid 1px rgb(var(--v-theme-info));
  70. .v-icon {
  71. color: rgb(var(--v-theme-info));
  72. font-size: 22px;
  73. border-radius: 16px;
  74. margin: 3px 1px;
  75. padding: 3px;
  76. height: 28px;
  77. width: 28px;
  78. }
  79. @media (max-width: 600px) {
  80. flex-direction: column;
  81. justify-content: center;
  82. }
  83. }
  84. .v-table td:first-child {
  85. width: 180px;
  86. }
  87. </style>