GenerateCardsSteps.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <!--
  2. Contenu de la boite de dialogue "Assistant de création"
  3. -->
  4. <template>
  5. <v-stepper v-model="step">
  6. <v-stepper-items>
  7. <v-stepper-content step="1">
  8. <!-- Menu Accueil -->
  9. <v-container v-if="location === 'home'">
  10. <v-row>
  11. <!-- Une personne -->
  12. <v-col cols="6" v-if="ability.can('manage', 'users')">
  13. <LayoutHeaderUniversalCreationCard
  14. @click="onCardClick('access')"
  15. title="a_person"
  16. text-content="add_new_person_student"
  17. icon="fa fa-user"
  18. />
  19. </v-col>
  20. <v-col
  21. cols="6"
  22. v-if="
  23. ability.can('display', 'agenda_page') &&
  24. (ability.can('display', 'course_page') ||
  25. ability.can('display', 'exam_page') ||
  26. ability.can('display', 'pedagogics_project_page'))
  27. "
  28. >
  29. <!-- Un évènement -->
  30. <LayoutHeaderUniversalCreationCard
  31. @click="onCardClick('event')"
  32. title="an_event"
  33. text-content="add_an_event_course"
  34. icon="fa fa-calendar"
  35. />
  36. </v-col>
  37. <!-- Autre évènement -->
  38. <v-col
  39. cols="6"
  40. v-else-if="
  41. ability.can('display', 'agenda_page') &&
  42. ability.can('manage', 'events')
  43. "
  44. >
  45. <LayoutHeaderUniversalCreationCard
  46. to="event-params"
  47. title="other_event"
  48. text-content="other_event_text_creation_card"
  49. icon="far fa-calendar"
  50. href="/calendar/create/events"
  51. @click="onCardClick"
  52. />
  53. </v-col>
  54. <!-- Une correspondance -->
  55. <v-col
  56. cols="6"
  57. v-if="
  58. ability.can('display', 'message_send_page') &&
  59. (ability.can('manage', 'emails') ||
  60. ability.can('manage', 'mails') ||
  61. ability.can('manage', 'texto'))
  62. "
  63. >
  64. <LayoutHeaderUniversalCreationCard
  65. @click="onCardClick('message')"
  66. title="a_correspondence"
  67. text-content="send_email_letter"
  68. icon="fa fa-envelope"
  69. />
  70. </v-col>
  71. <!-- Un matériel (direct link) -->
  72. <v-col cols="6" v-if="ability.can('manage', 'equipments')">
  73. <LayoutHeaderUniversalCreationCard
  74. title="a_materiel"
  75. text-content="add_any_type_material"
  76. icon="fa fa-laptop"
  77. href="/list/create/equipment"
  78. @click="onCardClick"
  79. />
  80. </v-col>
  81. </v-row>
  82. </v-container>
  83. </v-stepper-content>
  84. <v-stepper-content step="2">
  85. <!-- Menu creer une personne -->
  86. <v-container v-if="location === 'access'">
  87. <v-row>
  88. <!-- Un adhérent -->
  89. <v-col cols="6" v-if="isLaw1901">
  90. <LayoutHeaderUniversalCreationCard
  91. title="an_adherent"
  92. text-content="adherent_text_creation_card"
  93. icon="fa fa-user"
  94. href="/universal_creation_person/adherent"
  95. @click="onCardClick"
  96. />
  97. </v-col>
  98. <!-- Un membre du CA -->
  99. <v-col cols="6" v-if="isLaw1901">
  100. <LayoutHeaderUniversalCreationCard
  101. title="a_ca_member"
  102. text-content="ca_member_text_creation_card"
  103. icon="fa fa-users"
  104. href="/universal_creation_person/ca_member"
  105. @click="onCardClick"
  106. />
  107. </v-col>
  108. <!-- Un élève -->
  109. <v-col cols="6">
  110. <LayoutHeaderUniversalCreationCard
  111. title="a_student"
  112. text-content="student_text_creation_card"
  113. icon="fa fa-user"
  114. href="/universal_creation_person/student"
  115. @click="onCardClick"
  116. />
  117. </v-col>
  118. <!-- Un tuteur -->
  119. <v-col cols="6">
  120. <LayoutHeaderUniversalCreationCard
  121. title="a_guardian"
  122. text-content="guardian_text_creation_card"
  123. icon="fa fa-female"
  124. href="/universal_creation_person/guardian"
  125. @click="onCardClick"
  126. />
  127. </v-col>
  128. <!-- Un professeur -->
  129. <v-col cols="6">
  130. <LayoutHeaderUniversalCreationCard
  131. title="a_teacher"
  132. text-content="teacher_text_creation_card"
  133. icon="fa fa-graduation-cap"
  134. href="/universal_creation_person/teacher"
  135. @click="onCardClick"
  136. />
  137. </v-col>
  138. <!-- Un membre du personnel -->
  139. <v-col cols="6">
  140. <LayoutHeaderUniversalCreationCard
  141. title="a_member_of_staff"
  142. text-content="personnel_text_creation_card"
  143. icon="fa fa-suitcase"
  144. href="/universal_creation_person/personnel"
  145. @click="onCardClick"
  146. />
  147. </v-col>
  148. <!-- Une entité légale -->
  149. <v-col cols="6">
  150. <LayoutHeaderUniversalCreationCard
  151. title="a_legal_entity"
  152. text-content="moral_text_creation_card"
  153. icon="fa fa-building"
  154. href="/universal_creation_person/company"
  155. @click="onCardClick"
  156. />
  157. </v-col>
  158. <!-- Une inscription en ligne -->
  159. <v-col cols="6" v-if="hasOnlineRegistrationModule">
  160. <LayoutHeaderUniversalCreationCard
  161. title="online_registration"
  162. text-content="online_registration_text_creation_card"
  163. icon="fa fa-list-alt"
  164. href="/online/registration/new_registration"
  165. @click="onCardClick"
  166. />
  167. </v-col>
  168. <!-- Un autre type de contact -->
  169. <v-col cols="6">
  170. <LayoutHeaderUniversalCreationCard
  171. title="another_type_of_contact"
  172. text-content="other_contact_text_creation_card"
  173. icon="fa fa-plus"
  174. href="/universal_creation_person/other_contact"
  175. @click="onCardClick"
  176. />
  177. </v-col>
  178. </v-row>
  179. </v-container>
  180. <!-- Menu créer un evenement-->
  181. <v-container v-if="location === 'event'">
  182. <v-row>
  183. <!-- Un cours -->
  184. <v-col cols="6" v-if="ability.can('display', 'course_page')">
  185. <LayoutHeaderUniversalCreationCard
  186. title="course"
  187. text-content="course_text_creation_card"
  188. icon="fa fa-book"
  189. href="/universal_creation_event/course"
  190. @click="onCardClick"
  191. />
  192. </v-col>
  193. <!-- Un examen -->
  194. <v-col cols="6" v-if="ability.can('display', 'exam_page')">
  195. <LayoutHeaderUniversalCreationCard
  196. title="exam"
  197. text-content="exam_text_creation_card"
  198. icon="fa fa-clipboard"
  199. href="/universal_creation_event/exam"
  200. @click="onCardClick"
  201. />
  202. </v-col>
  203. <!-- Un projet pédagogique -->
  204. <v-col
  205. cols="6"
  206. v-if="ability.can('display', 'pedagogics_project_page')"
  207. >
  208. <LayoutHeaderUniversalCreationCard
  209. title="educational_services"
  210. text-content="educational_services_text_creation_card"
  211. icon="fa fa-graduation-cap"
  212. href="/universal_creation_event/pedagogical_project"
  213. @click="onCardClick"
  214. />
  215. </v-col>
  216. <!-- Un autre évènement -->
  217. <v-col cols="6" v-if="ability.can('manage', 'events')">
  218. <LayoutHeaderUniversalCreationCard
  219. to="event-params"
  220. href="/calendar/create/events"
  221. title="other_event"
  222. text-content="other_event_text_creation_card"
  223. icon="far fa-calendar"
  224. @click="onCardClick"
  225. />
  226. </v-col>
  227. </v-row>
  228. </v-container>
  229. <!-- Menu créer une correspondance -->
  230. <v-container v-if="location === 'message'">
  231. <v-row>
  232. <!-- Un email -->
  233. <v-col cols="6" v-if="ability.can('manage', 'emails')">
  234. <LayoutHeaderUniversalCreationCard
  235. title="an_email"
  236. text-content="email_text_creation_card"
  237. icon="far fa-envelope"
  238. href="/list/create/emails"
  239. @click="onCardClick"
  240. />
  241. </v-col>
  242. <!-- Un courrier -->
  243. <v-col cols="6" v-if="ability.can('manage', 'mails')">
  244. <LayoutHeaderUniversalCreationCard
  245. title="a_letter"
  246. text-content="letter_text_creation_card"
  247. icon="far fa-file-alt"
  248. href="/list/create/mails"
  249. @click="onCardClick"
  250. />
  251. </v-col>
  252. <!-- Un SMS -->
  253. <v-col cols="6" v-if="ability.can('manage', 'texto')">
  254. <LayoutHeaderUniversalCreationCard
  255. title="a_sms"
  256. text-content="sms_text_creation_card"
  257. icon="fa fa-mobile-alt"
  258. href="/list/create/sms"
  259. @click="onCardClick"
  260. />
  261. </v-col>
  262. </v-row>
  263. </v-container>
  264. </v-stepper-content>
  265. <v-stepper-content step="3">
  266. <!-- Event parameters page -->
  267. <LayoutHeaderUniversalCreationEventParams
  268. v-if="location === 'event-params'"
  269. @params-updated="onEventParamsUpdated"
  270. />
  271. </v-stepper-content>
  272. </v-stepper-items>
  273. </v-stepper>
  274. </template>
  275. <script setup lang="ts">
  276. import { ref, computed } from 'vue'
  277. import { useOrganizationProfileStore } from '~/stores/organizationProfile'
  278. import { useAbility } from '@casl/vue'
  279. const props = defineProps({
  280. path: {
  281. type: Array<string>,
  282. required: true,
  283. },
  284. })
  285. const step = ref(1)
  286. const location = computed(() => {
  287. return props.path.at(-1) ?? 'home'
  288. })
  289. const ability = useAbility()
  290. const organizationProfile = useOrganizationProfileStore()
  291. const isLaw1901 = computed(() => organizationProfile.isAssociation)
  292. const hasOnlineRegistrationModule: Ref<boolean> = ref(
  293. organizationProfile.hasModule('IEL'),
  294. )
  295. const emit = defineEmits(['cardClick', 'urlUpdate'])
  296. const onCardClick = (to: string | null, href: string | null = null) => {
  297. if (href) {
  298. // If a href is provided, redirect to it directly
  299. window.location.href = href
  300. } else if (to) {
  301. // If only 'to' is provided, navigate to the next step
  302. step.value++
  303. emit('cardClick', to)
  304. }
  305. }
  306. const onEventParamsUpdated = (event: { start: string; end: string }) => {
  307. // Handle event parameters update
  308. }
  309. onUnmounted(() => {
  310. // Clean up if necessary
  311. })
  312. </script>