GenerateCardsSteps.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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">
  121. <LayoutHeaderUniversalCreationTypeCard
  122. title="another_type_of_contact"
  123. text-content="other_contact_text_creation_card"
  124. icon="fa fa-plus"
  125. :link="makeAdminUrl('/universal_creation_person/other_contact')"
  126. />
  127. </v-col>
  128. </v-row>
  129. <v-row v-if="type === 'event'">
  130. <v-col cols="6" v-if="ability.can('display', 'course_page')">
  131. <LayoutHeaderUniversalCreationTypeCard
  132. title="course"
  133. text-content="course_text_creation_card"
  134. icon="fa fa-users"
  135. :link="makeAdminUrl('/calendar/create/courses')"
  136. />
  137. </v-col>
  138. <v-col cols="6" v-if="ability.can('display', 'exam_page')">
  139. <LayoutHeaderUniversalCreationTypeCard
  140. title="exam"
  141. text-content="exam_text_creation_card"
  142. icon="fa fa-graduation-cap"
  143. :link="makeAdminUrl('/calendar/create/examens')"
  144. />
  145. </v-col>
  146. <v-col cols="6" v-if="ability.can('display', 'pedagogics_project_page')">
  147. <LayoutHeaderUniversalCreationTypeCard
  148. title="educational_services"
  149. text-content="educational_services_text_creation_card"
  150. icon="fa fa-suitcase"
  151. :link="makeAdminUrl('/calendar/create/educational_projects')"
  152. />
  153. </v-col>
  154. <v-col cols="6" v-if="ability.can('manage', 'events')">
  155. <LayoutHeaderUniversalCreationTypeCard
  156. title="other_event"
  157. text-content="other_event_text_creation_card"
  158. icon="far fa-calendar"
  159. :link="adminLegacy + '/calendar/create/events'"
  160. />
  161. </v-col>
  162. </v-row>
  163. <v-row v-if="type === 'message'">
  164. <v-col cols="6" v-if="ability.can('manage', 'emails')">
  165. <LayoutHeaderUniversalCreationTypeCard
  166. title="an_email"
  167. text-content="email_text_creation_card"
  168. icon="far fa-envelope"
  169. :link="makeAdminUrl('/list/create/emails')"
  170. />
  171. </v-col>
  172. <v-col cols="6" v-if="ability.can('manage', 'mails')">
  173. <LayoutHeaderUniversalCreationTypeCard
  174. title="a_letter"
  175. text-content="letter_text_creation_card"
  176. icon="far fa-file-alt"
  177. :link="makeAdminUrl('/list/create/mails')"
  178. />
  179. </v-col>
  180. <v-col cols="6" v-if="ability.can('manage', 'texto')">
  181. <LayoutHeaderUniversalCreationTypeCard
  182. title="a_sms"
  183. text-content="sms_text_creation_card"
  184. icon="fa fa-mobile-alt"
  185. :link="makeAdminUrl('/list/create/sms')"
  186. />
  187. </v-col>
  188. </v-row>
  189. </v-container>
  190. </template>
  191. <script setup lang="ts">
  192. import {Ref, ref} from "@vue/reactivity";
  193. import {useOrganizationProfileStore} from "~/stores/organizationProfile";
  194. import {useAbility} from "@casl/vue";
  195. import {ComputedRef} from "vue";
  196. import UrlUtils from "~/services/utils/urlUtils";
  197. const props = defineProps({
  198. step: {
  199. type: Number,
  200. required: true
  201. }
  202. })
  203. const emit = defineEmits(['updateStep'])
  204. const ability = useAbility()
  205. const type: Ref<String> = ref('');
  206. const organizationProfile = useOrganizationProfileStore()
  207. const runtimeConfig = useRuntimeConfig()
  208. const onTypeClick = (step: Number, Cardtype: String) => {
  209. type.value = Cardtype;
  210. emit('updateStep', { stepChoice: step, typeChoice: Cardtype });
  211. }
  212. const adminLegacy: Ref<string> = ref(runtimeConfig.baseUrlAdminLegacy)
  213. const isLaw1901: ComputedRef<boolean> = organizationProfile.isAssociation
  214. const makeAdminUrl = (tail: string) => {
  215. return UrlUtils.join(runtimeConfig.baseUrlAdminLegacy, '#', tail)
  216. }
  217. </script>