branch.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <form
  3. class="w-full h-full flex flex-col items-center justify-between pt-8 text-foreground animate__animated animate__fadeIn"
  4. @submit.prevent="nextPage"
  5. >
  6. <div class="flex flex-col justify-center items-center">
  7. <h1 class="text-4xl font-bold text-center">
  8. Филиал
  9. </h1>
  10. <p class="opacity-50">
  11. Где именно вы находитесь?
  12. </p>
  13. </div>
  14. <div>
  15. <ClientOnly>
  16. <lottie-player
  17. class="w-[200px] h-[200px]"
  18. autoplay
  19. loop
  20. mode="normal"
  21. src="/lottie/student.json"
  22. />
  23. </ClientOnly>
  24. </div>
  25. <div
  26. v-if="branches"
  27. class="mx-10 show"
  28. >
  29. <BaseSelect
  30. id="id"
  31. v-model:selected="selectedBranch"
  32. name="title"
  33. :data="branches"
  34. />
  35. </div>
  36. <ILoader
  37. v-else
  38. class="show w-20 h-20 text-foreground"
  39. />
  40. <div />
  41. <button
  42. class="w-full py-2 bg-primary flex gap-3 justify-center items-center group disabled:opacity-50 duration-150"
  43. type="submit"
  44. >
  45. <svg
  46. class="w-6 h-6 opacity-75 rotate-180 group-hover:opacity-100"
  47. width="48"
  48. height="48"
  49. viewBox="0 0 48 48"
  50. fill="none"
  51. xmlns="http://www.w3.org/2000/svg"
  52. >
  53. <path
  54. d="M8 24.0002H40"
  55. stroke="black"
  56. stroke-width="4"
  57. stroke-linecap="round"
  58. stroke-linejoin="round"
  59. />
  60. <path
  61. d="M20 12.0002L8.12502 23.8752C8.05598 23.9442 8.05598 24.0562 8.12502 24.1252L20 36.0002"
  62. stroke="black"
  63. stroke-width="4"
  64. stroke-linecap="round"
  65. stroke-linejoin="round"
  66. />
  67. </svg>
  68. <p
  69. class="text-2xl text-background-100 font-semibold opacity-75 group-hover:opacity-100 duration-150"
  70. v-text="'Далее'"
  71. />
  72. </button>
  73. </form>
  74. </template>
  75. <script setup lang="ts">
  76. import { useUser } from '~/store/useUser'
  77. definePageMeta({
  78. layout: 'none',
  79. middleware: ['user-only'],
  80. })
  81. const { $api } = useNuxtApp()
  82. const selectedBranch = ref()
  83. const router = useRouter()
  84. const user = useUser()
  85. const branches = ref()
  86. function nextPage() {
  87. if (selectedBranch.value !== null) {
  88. user.data.branch_id = selectedBranch.value
  89. router.push('/setup/role')
  90. }
  91. else {
  92. alert('Выберите филиал')
  93. }
  94. }
  95. onMounted(async () => {
  96. branches.value = await $api.branch.getBranches()
  97. })
  98. </script>
  99. <style scoped>
  100. @keyframes show {
  101. 0% {
  102. opacity: 0;
  103. }
  104. 100% {
  105. opacity: 1;
  106. }
  107. }
  108. .show {
  109. animation: show ease-in-out 300ms;
  110. animation-fill-mode: forwards;
  111. }
  112. </style>