GenerateCardsSteps.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <!--
  2. Contenu de la boite de dialogue "Assistant de création"
  3. -->
  4. <template>
  5. <v-container v-if="step === 1">
  6. <v-row>
  7. <v-col cols="6" v-if="ability.can('manage', 'users')">
  8. <LayoutHeaderUniversalCreationTypeCard
  9. title="a_person"
  10. text-content="add_new_person_student"
  11. icon="fa fa-user"
  12. type="access"
  13. @typeClick="onTypeClick"
  14. />
  15. </v-col>
  16. <v-col cols="6" v-if="ability.can('display', 'agenda_page')
  17. && (
  18. ability.can('display', 'course_page') ||
  19. ability.can('display', 'exam_page') ||
  20. ability.can('display', 'pedagogics_project_page')
  21. )">
  22. <LayoutHeaderUniversalCreationTypeCard
  23. title="an_event"
  24. text-content="add_an_event_course"
  25. icon="fa fa-calendar-alt"
  26. type="event"
  27. @typeClick="onTypeClick"
  28. />
  29. </v-col>
  30. <v-col cols="6" v-else-if="ability.can('display', 'agenda_page') && ability.can('manage', 'events')">
  31. <LayoutHeaderUniversalCreationTypeCard
  32. title="other_event"
  33. text-content="other_event_text_creation_card"
  34. icon="far fa-calendar"
  35. :link="makeAdminUrl('/calendar/create/events')"
  36. />
  37. </v-col>
  38. <v-col cols="6" v-if="ability.can('display', 'message_send_page')
  39. && (
  40. ability.can('manage', 'emails') ||
  41. ability.can('manage', 'mails') ||
  42. ability.can('manage', 'texto')
  43. )">
  44. <LayoutHeaderUniversalCreationTypeCard
  45. title="a_correspondence"
  46. text-content="sen_email_letter"
  47. icon="fa fa-comment"
  48. type="message"
  49. @typeClick="onTypeClick"
  50. />
  51. </v-col>
  52. <v-col cols="6" v-if="ability.can('manage', 'equipments')">
  53. <LayoutHeaderUniversalCreationTypeCard
  54. title="a_materiel"
  55. text-content="add_any_type_material"
  56. icon="fa fa-cube"
  57. :link="makeAdminUrl('/list/create/equipment')"
  58. />
  59. </v-col>
  60. </v-row>
  61. </v-container>
  62. <v-container v-if="step === 2">
  63. <v-row v-if="type === 'access'">
  64. <v-col cols="6" v-if="isLaw1901">
  65. <LayoutHeaderUniversalCreationTypeCard
  66. title="an_adherent"
  67. text-content="adherent_text_creation_card"
  68. icon="fa fa-user"
  69. :link="makeAdminUrl('/universal_creation_person/adherent')"
  70. />
  71. </v-col>
  72. <v-col cols="6" v-if="isLaw1901">
  73. <LayoutHeaderUniversalCreationTypeCard
  74. title="a_ca_member"
  75. text-content="ca_member_text_creation_card"
  76. icon="fa fa-users"
  77. :link="makeAdminUrl('/universal_creation_person/ca_member')"
  78. />
  79. </v-col>
  80. <v-col cols="6">
  81. <LayoutHeaderUniversalCreationTypeCard
  82. title="a_student"
  83. text-content="student_text_creation_card"
  84. icon="fa fa-user"
  85. :link="makeAdminUrl('/universal_creation_person/student')"
  86. />
  87. </v-col>
  88. <v-col cols="6">
  89. <LayoutHeaderUniversalCreationTypeCard
  90. title="a_guardian"
  91. text-content="guardian_text_creation_card"
  92. icon="fa fa-female"
  93. :link="makeAdminUrl('/universal_creation_person/guardian')"
  94. />
  95. </v-col>
  96. <v-col cols="6">
  97. <LayoutHeaderUniversalCreationTypeCard
  98. title="a_teacher"
  99. text-content="teacher_text_creation_card"
  100. icon="fa fa-graduation-cap"
  101. :link="makeAdminUrl('/universal_creation_person/teacher')"
  102. />
  103. </v-col>
  104. <v-col cols="6">
  105. <LayoutHeaderUniversalCreationTypeCard
  106. title="a_member_of_staff"
  107. text-content="personnel_text_creation_card"
  108. icon="fa fa-suitcase"
  109. :link="makeAdminUrl('/universal_creation_person/personnel')"
  110. />
  111. </v-col>
  112. <v-col cols="6">
  113. <LayoutHeaderUniversalCreationTypeCard
  114. title="a_legal_entity"
  115. text-content="moral_text_creation_card"
  116. icon="fa fa-building"
  117. :link="makeAdminUrl('/universal_creation_person/company')"
  118. />
  119. </v-col>
  120. <v-col cols="6" v-if="hasOnlineRegistrationModule">
  121. <LayoutHeaderUniversalCreationTypeCard
  122. title="online_registration"
  123. text-content="online_registration_text_creation_card"
  124. icon="fa fa-list-alt"
  125. :link="makeAdminUrl('/online/registration/new_registration')"
  126. />
  127. </v-col>
  128. <v-col cols="6">
  129. <LayoutHeaderUniversalCreationTypeCard
  130. title="another_type_of_contact"
  131. text-content="other_contact_text_creation_card"
  132. icon="fa fa-plus"
  133. :link="makeAdminUrl('/universal_creation_person/other_contact')"
  134. />
  135. </v-col>
  136. </v-row>
  137. <v-row v-if="type === 'event'">
  138. <!-- /?start=2023-06-12T08:00:00%2B0200&end=2023-06-12T09:00:00%2B0200 -->
  139. <v-col cols="6" v-if="ability.can('display', 'course_page')">
  140. <LayoutHeaderUniversalCreationTypeCard
  141. title="course"
  142. text-content="course_text_creation_card"
  143. icon="fa fa-users"
  144. :link="makeAdminUrl('/calendar/create/courses', {'start': eventDefaultStart, 'end': eventDefaultEnd})"
  145. />
  146. </v-col>
  147. <v-col cols="6" v-if="ability.can('display', 'exam_page')">
  148. <LayoutHeaderUniversalCreationTypeCard
  149. title="exam"
  150. text-content="exam_text_creation_card"
  151. icon="fa fa-graduation-cap"
  152. :link="makeAdminUrl('/calendar/create/examens')"
  153. />
  154. </v-col>
  155. <v-col cols="6" v-if="ability.can('display', 'pedagogics_project_page')">
  156. <LayoutHeaderUniversalCreationTypeCard
  157. title="educational_services"
  158. text-content="educational_services_text_creation_card"
  159. icon="fa fa-suitcase"
  160. :link="makeAdminUrl('/calendar/create/educational_projects')"
  161. />
  162. </v-col>
  163. <v-col cols="6" v-if="ability.can('manage', 'events')">
  164. <LayoutHeaderUniversalCreationTypeCard
  165. title="other_event"
  166. text-content="other_event_text_creation_card"
  167. icon="far fa-calendar"
  168. :link="adminLegacy + '/calendar/create/events'"
  169. />
  170. </v-col>
  171. </v-row>
  172. <v-row v-if="type === 'message'">
  173. <v-col cols="6" v-if="ability.can('manage', 'emails')">
  174. <LayoutHeaderUniversalCreationTypeCard
  175. title="an_email"
  176. text-content="email_text_creation_card"
  177. icon="far fa-envelope"
  178. :link="makeAdminUrl('/list/create/emails')"
  179. />
  180. </v-col>
  181. <v-col cols="6" v-if="ability.can('manage', 'mails')">
  182. <LayoutHeaderUniversalCreationTypeCard
  183. title="a_letter"
  184. text-content="letter_text_creation_card"
  185. icon="far fa-file-alt"
  186. :link="makeAdminUrl('/list/create/mails')"
  187. />
  188. </v-col>
  189. <v-col cols="6" v-if="ability.can('manage', 'texto')">
  190. <LayoutHeaderUniversalCreationTypeCard
  191. title="a_sms"
  192. text-content="sms_text_creation_card"
  193. icon="fa fa-mobile-alt"
  194. :link="makeAdminUrl('/list/create/sms')"
  195. />
  196. </v-col>
  197. </v-row>
  198. </v-container>
  199. </template>
  200. <script setup lang="ts">
  201. import {Ref, ref} from "@vue/reactivity";
  202. import {useOrganizationProfileStore} from "~/stores/organizationProfile";
  203. import {useAbility} from "@casl/vue";
  204. import {ComputedRef} from "vue";
  205. import UrlUtils from "~/services/utils/urlUtils";
  206. import {add, formatISO, startOfHour} from "date-fns";
  207. const props = defineProps({
  208. step: {
  209. type: Number,
  210. required: true
  211. }
  212. })
  213. const emit = defineEmits(['updateStep'])
  214. const ability = useAbility()
  215. const type: Ref<String> = ref('');
  216. const organizationProfile = useOrganizationProfileStore()
  217. const runtimeConfig = useRuntimeConfig()
  218. // Get the start of the next hour as a default event start
  219. const now: Date = new Date()
  220. const eventDefaultStart: string = formatISO(startOfHour(add(now, { 'hours': 1 })))
  221. const eventDefaultEnd: string = formatISO(startOfHour(add(now, { 'hours': 2 })))
  222. const onTypeClick = (step: Number, Cardtype: String) => {
  223. type.value = Cardtype;
  224. emit('updateStep', { stepChoice: step, typeChoice: Cardtype });
  225. }
  226. const adminLegacy: Ref<string> = ref(runtimeConfig.baseUrlAdminLegacy)
  227. const isLaw1901: ComputedRef<boolean> = organizationProfile.isAssociation
  228. const hasOnlineRegistrationModule: ComputedRef<boolean> = computed(
  229. () => organizationProfile.hasModule('IEL')
  230. )
  231. const makeAdminUrl = (tail: string, query: Record<string, string> = {}) => {
  232. let url = UrlUtils.join(runtimeConfig.baseUrlAdminLegacy, '#', tail)
  233. url = UrlUtils.addQuery(url, query)
  234. return url
  235. }
  236. </script>