super_admin.vue 2.4 KB

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