super_admin.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <NuxtLayout name="parameters">
  3. <div>
  4. <v-container>
  5. <v-row>
  6. <v-col cols="1">
  7. </v-col>
  8. <v-col cols="4">
  9. <div class="explanation">
  10. <div class="px-6 d-flex flex-row align-center">
  11. <v-icon class="theme-primary">fa fa-info</v-icon>
  12. </div>
  13. <div class="px-2">
  14. {{ $t('super_admin_explanation_text')}}
  15. </div>
  16. </div>
  17. </v-col>
  18. <v-col cols="1" />
  19. <v-col cols="6">
  20. <v-row>
  21. </v-row>
  22. <v-row v-if="pending">
  23. <UiLoadingPanel/>
  24. </v-row>
  25. <v-row v-else>
  26. <UiForm
  27. ref="form"
  28. :model="AdminAccess"
  29. :entity="adminAccess"
  30. class="w-100"
  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. </NuxtLayout>
  47. </template>
  48. <script setup lang="ts">
  49. import { useEntityFetch } from '~/composables/data/useEntityFetch'
  50. import { useAccessProfileStore } from '~/stores/accessProfile'
  51. import AdminAccess from '~/models/Access/AdminAccess'
  52. import {useValidationUtils} from "~/composables/utils/useValidationUtils";
  53. /**
  54. * Disable the default layout, the page will use the layout defined with <NuxtLayout />
  55. * @see https://nuxt.com/docs/guide/directory-structure/layouts#overriding-a-layout-on-a-per-page-basis
  56. */
  57. definePageMeta({
  58. layout: false,
  59. });
  60. const { fetch } = useEntityFetch()
  61. const accessProfile = useAccessProfileStore()
  62. if (accessProfile.id === null) {
  63. throw new Error('Missing access profile id')
  64. }
  65. const { data: adminAccess, pending } = fetch(AdminAccess, accessProfile.id)
  66. const i18n = useI18n()
  67. const validationUtils = useValidationUtils()
  68. const rules = () => [
  69. (email: string | null) =>
  70. (email && validationUtils.validEmail(email)) || i18n.t('email_error')
  71. ]
  72. </script>
  73. <style scoped lang="scss">
  74. .explanation {
  75. display: flex;
  76. flex-direction: row;
  77. padding: 60px 26px;
  78. text-align: justify;
  79. color: rgb(var(--v-theme-neutral-strong));
  80. .v-icon {
  81. background-color: rgb(var(--v-theme-primary));
  82. font-size: 22px;
  83. border-radius: 16px;
  84. margin: 3px;
  85. padding: 3px;
  86. height: 28px;
  87. width: 28px;
  88. }
  89. div:first-child {
  90. border-right: solid 1px rgb(var(--v-theme-primary));
  91. }
  92. }
  93. </style>