super_admin.vue 2.1 KB

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