super_admin.vue 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div>
  3. <div class="explanation">
  4. <div class="px-6 d-flex flex-row align-center">
  5. <v-icon class="theme-primary">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. :model="AdminAccess"
  16. :entity="adminAccess"
  17. class="w-100"
  18. action-position="bottom"
  19. >
  20. <v-table class="mb-4">
  21. <tbody>
  22. <tr>
  23. <td>{{ $t('username') }} :</td>
  24. <td>{{ adminAccess.username }}</td>
  25. </tr>
  26. </tbody>
  27. </v-table>
  28. <UiInputText
  29. v-model="adminAccess.email"
  30. field="email"
  31. :rules="rules()"
  32. class="mx-4"
  33. variant="underlined"
  34. />
  35. </UiForm>
  36. <span v-else>{{ $t('no_admin_access_recorded') }}</span>
  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. padding: 60px 26px;
  65. text-align: justify;
  66. color: rgb(var(--v-theme-neutral-strong));
  67. .v-icon {
  68. background-color: rgb(var(--v-theme-primary));
  69. font-size: 22px;
  70. border-radius: 16px;
  71. margin: 3px;
  72. padding: 3px;
  73. height: 28px;
  74. width: 28px;
  75. }
  76. div:first-child {
  77. border-right: solid 1px rgb(var(--v-theme-primary));
  78. }
  79. }
  80. .v-table td:first-child {
  81. width: 180px;
  82. }
  83. </style>