| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <!--
- Contenu de la boite de dialogue "Assistant de création"
- @see https://vuetifyjs.com/en/components/steppers/
- -->
- <template>
- <v-stepper v-model="step">
- <v-stepper-items>
- <v-stepper-content step="1">
- <!-- Menu Accueil -->
- <v-container v-if="location === 'home'">
- <v-row>
- <!-- Une personne -->
- <v-col v-if="ability.can('manage', 'users')" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_person"
- text-content="add_new_person_student"
- icon="fa fa-user"
- @click="onCardClick('access')"
- />
- </v-col>
- <v-col
- v-if="
- ability.can('display', 'agenda_page') &&
- (ability.can('display', 'course_page') ||
- ability.can('display', 'exam_page') ||
- ability.can('display', 'pedagogics_project_page'))
- "
- cols="12"
- md="6"
- >
- <!-- Un évènement -->
- <LayoutHeaderUniversalCreationCard
- title="an_event"
- text-content="add_an_event_course"
- icon="fa fa-calendar"
- @click="onCardClick('event')"
- />
- </v-col>
- <!-- Autre évènement -->
- <v-col
- v-else-if="
- ability.can('display', 'agenda_page') &&
- ability.can('manage', 'events')
- "
- cols="12"
- md="6"
- >
- <LayoutHeaderUniversalCreationCard
- to="event-params"
- title="other_event"
- text-content="other_event_text_creation_card"
- icon="far fa-calendar"
- href="/calendar/create/events"
- @click="onCardClick"
- />
- </v-col>
- <!-- Une correspondance -->
- <v-col
- v-if="
- ability.can('display', 'message_send_page') &&
- (ability.can('manage', 'emails') ||
- ability.can('manage', 'mails') ||
- ability.can('manage', 'texto'))
- "
- cols="12"
- md="6"
- >
- <LayoutHeaderUniversalCreationCard
- title="a_correspondence"
- text-content="send_email_letter"
- icon="fa fa-envelope"
- @click="onCardClick('message')"
- />
- </v-col>
- <!-- Un matériel (direct link) -->
- <v-col v-if="ability.can('manage', 'equipments')" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_materiel"
- text-content="add_any_type_material"
- icon="fa fa-laptop"
- href="/list/create/equipment"
- @click="onCardClick"
- />
- </v-col>
- </v-row>
- </v-container>
- </v-stepper-content>
- <v-stepper-content step="2">
- <!-- Menu creer une personne -->
- <v-container v-if="location === 'access'">
- <v-row>
- <!-- Un adhérent -->
- <v-col v-if="isLaw1901" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="an_adherent"
- text-content="adherent_text_creation_card"
- icon="fa fa-user"
- href="/universal_creation_person/adherent"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un membre du CA -->
- <v-col v-if="isLaw1901" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_ca_member"
- text-content="ca_member_text_creation_card"
- icon="fa fa-users"
- href="/universal_creation_person/ca_member"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un élève -->
- <v-col cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_student"
- text-content="student_text_creation_card"
- icon="fa fa-user"
- href="/universal_creation_person/student"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un tuteur -->
- <v-col cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_guardian"
- text-content="guardian_text_creation_card"
- icon="fa fa-female"
- href="/universal_creation_person/guardian"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un professeur -->
- <v-col cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_teacher"
- text-content="teacher_text_creation_card"
- icon="fa fa-graduation-cap"
- href="/universal_creation_person/teacher"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un membre du personnel -->
- <v-col cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_member_of_staff"
- text-content="personnel_text_creation_card"
- icon="fa fa-suitcase"
- href="/universal_creation_person/personnel"
- @click="onCardClick"
- />
- </v-col>
- <!-- Une entité légale -->
- <v-col cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_legal_entity"
- text-content="moral_text_creation_card"
- icon="fa fa-building"
- href="/universal_creation_person/company"
- @click="onCardClick"
- />
- </v-col>
- <!-- Une inscription en ligne -->
- <v-col v-if="hasOnlineRegistrationModule" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="online_registration"
- text-content="online_registration_text_creation_card"
- icon="fa fa-list-alt"
- href="/online/registration/new_registration"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un autre type de contact -->
- <v-col cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="another_type_of_contact"
- text-content="other_contact_text_creation_card"
- icon="fa fa-plus"
- href="/universal_creation_person/other_contact"
- @click="onCardClick"
- />
- </v-col>
- </v-row>
- </v-container>
- <!-- Menu créer un evenement-->
- <v-container v-if="location === 'event'">
- <v-row>
- <!-- Un cours -->
- <v-col
- v-if="ability.can('display', 'course_page')"
- cols="12"
- md="6"
- >
- <LayoutHeaderUniversalCreationCard
- title="course"
- text-content="course_text_creation_card"
- icon="fa fa-book"
- href="/universal_creation_event/course"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un examen -->
- <v-col v-if="ability.can('display', 'exam_page')" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="exam"
- text-content="exam_text_creation_card"
- icon="fa fa-clipboard"
- href="/universal_creation_event/exam"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un projet pédagogique -->
- <v-col
- v-if="ability.can('display', 'pedagogics_project_page')"
- cols="12"
- md="6"
- >
- <LayoutHeaderUniversalCreationCard
- title="educational_services"
- text-content="educational_services_text_creation_card"
- icon="fa fa-graduation-cap"
- href="/universal_creation_event/pedagogical_project"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un autre évènement -->
- <v-col v-if="ability.can('manage', 'events')" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- to="event-params"
- href="/calendar/create/events"
- title="other_event"
- text-content="other_event_text_creation_card"
- icon="far fa-calendar"
- @click="onCardClick"
- />
- </v-col>
- </v-row>
- </v-container>
- <!-- Menu créer une correspondance -->
- <v-container v-if="location === 'message'">
- <v-row>
- <!-- Un email -->
- <v-col v-if="ability.can('manage', 'emails')" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="an_email"
- text-content="email_text_creation_card"
- icon="far fa-envelope"
- href="/list/create/emails"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un courrier -->
- <v-col v-if="ability.can('manage', 'mails')" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_letter"
- text-content="letter_text_creation_card"
- icon="far fa-file-alt"
- href="/list/create/mails"
- @click="onCardClick"
- />
- </v-col>
- <!-- Un SMS -->
- <v-col v-if="ability.can('manage', 'texto')" cols="12" md="6">
- <LayoutHeaderUniversalCreationCard
- title="a_sms"
- text-content="sms_text_creation_card"
- icon="fa fa-mobile-alt"
- href="/list/create/sms"
- @click="onCardClick"
- />
- </v-col>
- </v-row>
- </v-container>
- </v-stepper-content>
- <v-stepper-content step="3">
- <!-- Page de pré-paramétrage des évènements -->
- <LayoutHeaderUniversalCreationEventParams
- v-if="location === 'event-params'"
- @params-updated="onEventParamsUpdated"
- />
- </v-stepper-content>
- </v-stepper-items>
- </v-stepper>
- </template>
- <script setup lang="ts">
- import { ref, computed } from 'vue'
- import { useAbility } from '@casl/vue'
- import { useOrganizationProfileStore } from '~/stores/organizationProfile'
- const props = defineProps({
- /**
- * The path that the user followed throughout the wizard
- */
- path: {
- type: Array<string>,
- required: true,
- },
- })
- const step = ref(1)
- const location: ComputedRef<string> = computed(() => {
- return props.path.at(-1) ?? 'home'
- })
- const ability = useAbility()
- const organizationProfile = useOrganizationProfileStore()
- const isLaw1901 = computed(() => organizationProfile.isAssociation)
- const hasOnlineRegistrationModule: Ref<boolean> = ref(
- organizationProfile.hasModule('IEL'),
- )
- const emit = defineEmits(['cardClick', 'urlUpdate'])
- /**
- * Called when a card is clicked
- * @param to Target location in the wizard
- * @param href Target absolute url
- */
- const onCardClick = (to: string | null, href: string | null = null) => {
- if (href) {
- // If a href is provided, redirect to it directly
- window.location.href = href
- } else if (to) {
- // If only 'to' is provided, navigate to the next step
- step.value++
- emit('cardClick', to)
- }
- }
- /**
- * Called when the event parameters page is updated
- * @param event
- */
- const onEventParamsUpdated = (event: { start: string; end: string }) => {
- emit('urlUpdate', {
- start: event.start,
- end: event.end,
- })
- }
- onUnmounted(() => {
- // Reset the step when the component is unmounted
- step.value = 1
- })
- </script>
|