SuperAdmin.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div>
  3. <v-container>
  4. <v-row>
  5. <v-col cols="1">
  6. </v-col>
  7. <v-col cols="4">
  8. <div class="explanation">
  9. <div class="px-6 d-flex flex-row align-center">
  10. <v-icon class="theme-primary">fa fa-info</v-icon>
  11. </div>
  12. <div class="px-2">
  13. {{ $t('super_admin_explanation_text')}}
  14. </div>
  15. </div>
  16. </v-col>
  17. <v-col cols="1" />
  18. <v-col cols="6">
  19. <v-row>
  20. </v-row>
  21. <v-row v-if="pending">
  22. <UiLoadingPanel/>
  23. </v-row>
  24. <v-row v-else>
  25. <UiForm
  26. ref="form"
  27. :model="AdminAccess"
  28. :entity="adminAccess"
  29. class="w-100"
  30. >
  31. <div class="d-flex flex-row mx-4 my-6">
  32. <span>{{ $t('username') }} :</span> <pre> {{ adminAccess.username }}</pre>
  33. </div>
  34. <UiInputText
  35. field="email"
  36. v-model="adminAccess.email"
  37. :rules="rules()"
  38. />
  39. </UiForm>
  40. </v-row>
  41. </v-col>
  42. </v-row>
  43. </v-container>
  44. </div>
  45. </template>
  46. <script setup lang="ts">
  47. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  48. import { useAccessProfileStore } from '~/stores/accessProfile'
  49. import AdminAccess from '~/models/Access/AdminAccess'
  50. import {useValidationUtils} from "~/composables/utils/useValidationUtils";
  51. const { fetch } = useEntityFetch()
  52. const accessProfile = useAccessProfileStore()
  53. if (accessProfile.id === null) {
  54. throw new Error('Missing access profile id')
  55. }
  56. const { data: adminAccess, pending } = fetch(AdminAccess, accessProfile.id)
  57. const i18n = useI18n()
  58. const validationUtils = useValidationUtils()
  59. const rules = () => [
  60. (email: string | null) =>
  61. (email && validationUtils.validEmail(email)) || i18n.t('email_error')
  62. ]
  63. </script>
  64. <style scoped lang="scss">
  65. .explanation {
  66. display: flex;
  67. flex-direction: row;
  68. padding: 60px 26px;
  69. text-align: justify;
  70. color: rgb(var(--v-theme-neutral-strong));
  71. .v-icon {
  72. background-color: rgb(var(--v-theme-primary));
  73. font-size: 22px;
  74. border-radius: 16px;
  75. margin: 3px;
  76. padding: 3px;
  77. height: 28px;
  78. width: 28px;
  79. }
  80. div:first-child {
  81. border-right: solid 1px rgb(var(--v-theme-primary));
  82. }
  83. }
  84. </style>