Browse Source

fix universal creation and alert bar icon

Vincent GUFFON 3 years ago
parent
commit
335091aefa

+ 4 - 4
components/Layout/AlertBar/Cotisation.vue

@@ -7,7 +7,7 @@ Cotisation bar : Barre qui s'affiche pour donner l'état de la cotisation
     <UiSystemBar color="ot_info" v-if="show_cotisation_access">
       <template #bar.text>
         <a @click="goOn('AFFILIATION')" class="ot_white--text">
-          <v-icon small>fas fa-exclamation-triangle</v-icon> {{$t('cotisation_access')}}
+          <v-icon small>fas fa-info-circle</v-icon> {{$t('cotisation_access')}}
         </a>
       </template>
     </UiSystemBar>
@@ -15,7 +15,7 @@ Cotisation bar : Barre qui s'affiche pour donner l'état de la cotisation
     <UiSystemBar color="ot_info" v-else-if="show_upload_invoice">
       <template #bar.text>
         <a @click="goOn('INVOICE')" class="ot_white--text">
-          <v-icon small>fas fa-exclamation-triangle</v-icon> {{$t('upload_cotisation_invoice')}}
+          <v-icon small>fas fa-info-circle</v-icon> {{$t('upload_cotisation_invoice')}}
         </a>
       </template>
     </UiSystemBar>
@@ -23,7 +23,7 @@ Cotisation bar : Barre qui s'affiche pour donner l'état de la cotisation
     <UiSystemBar color="ot_info" v-else-if="show_renew_insurance">
       <template #bar.text>
         <a @click="goOn('INSURANCE')" class="ot_white--text">
-          <v-icon small>fas fa-exclamation-triangle</v-icon> {{$t('renew_insurance_cmf')}}
+          <v-icon small>fas fa-info-circle</v-icon> {{$t('renew_insurance_cmf')}}
         </a>
       </template>
     </UiSystemBar>
@@ -31,7 +31,7 @@ Cotisation bar : Barre qui s'affiche pour donner l'état de la cotisation
     <UiSystemBar color="ot_info" v-else-if="show_insurance_subscription">
       <template #bar.text>
         <a @click="goOn('ADVERTISINGINSURANCE')" class="ot_white--text">
-          <v-icon small>fas fa-exclamation-triangle</v-icon> {{$t('insurance_cmf_subscription')}}
+          <v-icon small>fas fa-info-circle</v-icon> {{$t('insurance_cmf_subscription')}}
         </a>
       </template>
     </UiSystemBar>

+ 1 - 1
components/Layout/AlertBar/SwitchUser.vue

@@ -5,7 +5,7 @@ Switch year bar : Barre qui s'affiche lorsque l'utilisateur possède un compte m
 <template>
   <UiSystemBar color="ot_info" v-if="show">
     <template #bar.text>
-      <v-icon small>fas fa-exclamation-triangle</v-icon>
+      <v-icon small>fas fa-info-circle</v-icon>
       <span v-html="$t('multi_account_alert', { fullname })"></span>
        <v-icon class="ml-1" small>fa fa-users</v-icon>
       {{$t('multi_account_alert_next')}}

+ 1 - 0
components/Layout/Dialog.vue

@@ -60,6 +60,7 @@ export default defineComponent({
   .dialog-type{
     background: var(--v-ot_green-base, #00AD8E);
     color: #fff;
+    width: 160px;
    h3{
      font-size: 25px;
      font-weight: normal;

+ 2 - 2
components/Layout/Header/Menu.vue

@@ -16,7 +16,7 @@ header principal (configuration, paramètres du compte...)
             @click="click"
           >
             <v-avatar
-              v-if="menu.icon.avatarId"
+              v-if="menu.icon.avatarByDefault"
               size="30"
             >
               <UiImage :id="menu.icon.avatarId" :imageByDefault="menu.icon.avatarByDefault" :width="30"></UiImage>
@@ -47,7 +47,7 @@ header principal (configuration, paramètres du compte...)
               <v-list-item-title>
                 <span v-if="item.icon">
                   <v-avatar
-                    v-if="item.icon.avatarId"
+                    v-if="item.icon.avatarByDefault"
                     size="30"
                   >
                     <UiImage :id="item.icon.avatarId" :imageByDefault="item.icon.avatarByDefault" :width="30"></UiImage>

+ 1 - 1
components/Layout/Header/Notification.vue

@@ -29,7 +29,7 @@
       <v-card-title class="ot_header_menu text-body-2 font-weight-bold">
         {{ $t('notification') }}
       </v-card-title>
-      <v-card-text class="ma-0 pa-0 header_menu">
+      <v-card-text class="ma-0 pa-0 header-menu">
         <v-list dense :subheader="true">
           <template v-for="(notification, index) in notifications">
             <v-list-item :key="index" :class="`${notification.notificationUsers.length === 0 ? 'unread' : ''}`">

+ 17 - 6
components/Layout/Header/UniversalCreation/CreateButton.vue

@@ -16,23 +16,27 @@ bouton Créer
     >
 
       <template #dialogType>{{ $t('creative_assistant') }}</template>
-      <template #dialogTitle>{{ $t('what_do_you_want_to_create') }}</template>
+      <template #dialogTitle>
+        <span v-if="type=='home'">{{ $t('what_do_you_want_to_create') }}</span>
+        <span v-else-if="type=='access'">{{ $t('universal_create_title_access') }}</span>
+        <span v-else-if="type=='event'">{{ $t('universal_create_title_event') }}</span>
+        <span v-else-if="type=='message'">{{ $t('universal_create_title_message') }}</span>
+      </template>
       <template #dialogText>
-        <LayoutHeaderUniversalCreationGenerateCardsSteps :step="step" @updateStep="step=$event" />
-
+        <LayoutHeaderUniversalCreationGenerateCardsSteps :step="step" @updateStep="updateStep" />
       </template>
       <template #dialogBtn>
         <div class="text-center">
           <v-btn
             color="ot_super_light_grey"
-            @click="showDialog=false;step=1"
+            @click="showDialog=false;step=1;type='home'"
           >
             {{ $t('cancel') }}
           </v-btn>
           <v-btn
             v-if="step > 1"
             color="ot_super_light_grey"
-            @click="step=1"
+            @click="step=1;type='home'"
           >
             {{ $t('previous') }}
           </v-btn>
@@ -49,9 +53,16 @@ export default defineComponent({
   setup () {
     const showDialog:Ref<Boolean> = ref(false);
     const step:Ref<Number> = ref(1);
+    const type:Ref<String> = ref('home');
+    const updateStep = ({stepChoice, typeChoice}: any) =>{
+      step.value = stepChoice
+      type.value = typeChoice
+    }
     return {
       showDialog,
-      step
+      updateStep,
+      step,
+      type
     }
   }
 })

+ 32 - 27
components/Layout/Header/UniversalCreation/GenerateCardsSteps.vue

@@ -15,21 +15,23 @@
             icon="fa fa-user"
             type="access"
             @typeClick="onTypeClick"
-          >
-          </LayoutHeaderUniversalCreationTypeCard>
+          />
           <LayoutHeaderUniversalCreationTypeCard
             v-if="$can('display', 'agenda_page')
-                && ($ability.can('manage', 'courses')
-            || $ability.can('manage', 'examens')
-            || $ability.can('manage', 'educationalprojects')
-            || $ability.can('manage', 'events'))"
+                && ($ability.can('display', 'course_page')
+            || $ability.can('display', 'exam_page')
+            || $ability.can('display', 'pedagogics_project_page'))"
             title="an_event"
             text-content="add_an_event_course"
             icon="fa fa-calendar-alt"
             type="event"
             @typeClick="onTypeClick"
-          >
-          </LayoutHeaderUniversalCreationTypeCard>
+          />
+          <LayoutHeaderUniversalCreationTypeCard
+            v-else-if="$can('display', 'agenda_page') && $can('manage', 'events')"
+            title="other_event" text-content="other_event_text_creation_card"
+            icon="far fa-calendar" :link="adminLegacy+ '/calendar/create/events'" />
+
           <LayoutHeaderUniversalCreationTypeCard
             v-if="$can('display', 'message_send_page')
             && ($ability.can('manage', 'emails')
@@ -40,34 +42,34 @@
             icon="fa fa-comment"
             type="message"
             @typeClick="onTypeClick"
-          >
-          </LayoutHeaderUniversalCreationTypeCard>
+          />
           <LayoutHeaderUniversalCreationTypeCard
             v-if="$can('manage', 'equipments')"
             title="a_materiel"
             text-content="add_any_type_material"
             icon="fa fa-cube"
             :link="adminLegacy+ '/list/create/equipment'"
-          >
-          </LayoutHeaderUniversalCreationTypeCard>
+          />
         </div>
       </v-stepper-content>
 
       <v-stepper-content step="2">
         <div class="row">
           <div v-if="type === 'access'" class="row">
-            <LayoutHeaderUniversalCreationTypeCard title="a_student" text-content="student_text_creation_card" icon="fa fa-user" :link="adminLegacy+ '/universal_creation_person/student'"></LayoutHeaderUniversalCreationTypeCard>
-            <LayoutHeaderUniversalCreationTypeCard title="a_guardian" text-content="guardian_text_creation_card" icon="fa fa-female" :link="adminLegacy+ '/universal_creation_person/guardian'"></LayoutHeaderUniversalCreationTypeCard>
-            <LayoutHeaderUniversalCreationTypeCard title="a_teacher" text-content="teacher_text_creation_card" icon="fa fa-graduation-cap" :link="adminLegacy+ '/universal_creation_person/teacher'"></LayoutHeaderUniversalCreationTypeCard>
-            <LayoutHeaderUniversalCreationTypeCard title="a_member_of_staff" text-content="personnel_text_creation_card" icon="fa fa-suitcase" :link="adminLegacy+ '/universal_creation_person/personnel'"></LayoutHeaderUniversalCreationTypeCard>
-            <LayoutHeaderUniversalCreationTypeCard title="a_legal_entity" text-content="moral_text_creation_card" icon="fa fa-building" :link="adminLegacy+ '/universal_creation_person/company'"></LayoutHeaderUniversalCreationTypeCard>
-            <LayoutHeaderUniversalCreationTypeCard title="another_type_of_contact" text-content="other_contact_text_creation_card" icon="fa fa-plus" :link="adminLegacy+ '/universal_creation_person/other_contact'"></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard v-if="isLaw1901" title="an_adherent" text-content="adherent_text_creation_card" icon="fa fa-user" :link="adminLegacy+ '/universal_creation_person/adherent'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard v-if="isLaw1901" title="a_ca_member" text-content="ca_member_text_creation_card" icon="fa fa-users" :link="adminLegacy+ '/universal_creation_person/ca_member'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard title="a_student" text-content="student_text_creation_card" icon="fa fa-user" :link="adminLegacy+ '/universal_creation_person/student'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard title="a_guardian" text-content="guardian_text_creation_card" icon="fa fa-female" :link="adminLegacy+ '/universal_creation_person/guardian'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard title="a_teacher" text-content="teacher_text_creation_card" icon="fa fa-graduation-cap" :link="adminLegacy+ '/universal_creation_person/teacher'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard title="a_member_of_staff" text-content="personnel_text_creation_card" icon="fa fa-suitcase" :link="adminLegacy+ '/universal_creation_person/personnel'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard title="a_legal_entity" text-content="moral_text_creation_card" icon="fa fa-building" :link="adminLegacy+ '/universal_creation_person/company'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard title="another_type_of_contact" text-content="other_contact_text_creation_card" icon="fa fa-plus" :link="adminLegacy+ '/universal_creation_person/other_contact'" ></LayoutHeaderUniversalCreationTypeCard>
           </div>
           <div v-if="type === 'event'" class="row">
-            <LayoutHeaderUniversalCreationTypeCard v-if="$can('manage', 'courses')" title="course" text-content="course_text_creation_card" icon="fa fa-users" :link="adminLegacy+ '/calendar/create/courses'"></LayoutHeaderUniversalCreationTypeCard>
-            <LayoutHeaderUniversalCreationTypeCard v-if="$can('manage', 'examens')" title="exam" text-content="exam_text_creation_card" icon="fa fa-graduation-cap" :link="adminLegacy+ '/calendar/create/examens'"></LayoutHeaderUniversalCreationTypeCard>
-            <LayoutHeaderUniversalCreationTypeCard v-if="$can('manage', 'educationalprojects')" title="educational_services" text-content="educational_services_text_creation_card" icon="fa fa-suitcase" :link="adminLegacy+ '/calendar/create/educational_projects'"></LayoutHeaderUniversalCreationTypeCard>
-            <LayoutHeaderUniversalCreationTypeCard v-if="$can('manage', 'events')" title="other_event" text-content="other_event_text_creation_card" icon="far fa-calendar" :link="adminLegacy+ '/calendar/create/events'"></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard v-if="$can('display', 'course_page')" title="course" text-content="course_text_creation_card" icon="fa fa-users" :link="adminLegacy+ '/calendar/create/courses'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard v-if="$can('display', 'exam_page')" title="exam" text-content="exam_text_creation_card" icon="fa fa-graduation-cap" :link="adminLegacy+ '/calendar/create/examens'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard v-if="$can('display', 'pedagogics_project_page')" title="educational_services" text-content="educational_services_text_creation_card" icon="fa fa-suitcase" :link="adminLegacy+ '/calendar/create/educational_projects'" ></LayoutHeaderUniversalCreationTypeCard>
+            <LayoutHeaderUniversalCreationTypeCard v-if="$can('manage', 'events')" title="other_event" text-content="other_event_text_creation_card" icon="far fa-calendar" :link="adminLegacy+ '/calendar/create/events'" ></LayoutHeaderUniversalCreationTypeCard>
           </div>
           <div v-if="type === 'message'" class="row">
             <LayoutHeaderUniversalCreationTypeCard v-if="$can('manage', 'emails')" title="an_email" text-content="email_text_creation_card" icon="far fa-envelope" :link="adminLegacy+ '/list/create/emails'"></LayoutHeaderUniversalCreationTypeCard>
@@ -84,6 +86,7 @@
 
 <script lang="ts">
 import {defineComponent, ref, Ref, useContext} from '@nuxtjs/composition-api'
+import { $organizationProfile } from '~/services/profile/organizationProfile'
 
 export default defineComponent({
   props: {
@@ -93,16 +96,20 @@ export default defineComponent({
     }
   },
   setup (_,{emit}) {
-    const { $config } = useContext()
+    const { $config, store } = useContext()
+
     const onTypeClick = (step:Number,Cardtype:String)=>{
       type.value = Cardtype;
-      emit('updateStep',step);
+      emit('updateStep', {stepChoice: step, typeChoice: Cardtype});
     }
     const type:Ref<String> = ref('');
+    const organizationProfile = $organizationProfile(store)
+
     return {
       type,
       onTypeClick,
-      adminLegacy: $config.baseURL_adminLegacy
+      adminLegacy: $config.baseURL_adminLegacy,
+      isLaw1901: organizationProfile.isAssociation()
     }
   }
 })
@@ -137,7 +144,5 @@ export default defineComponent({
         background: var(--v-ot_light_green-base, #a9e0d6);
       }
     }
-
-
   }
 </style>

+ 1 - 1
components/Layout/Header/UniversalCreation/TypeCard.vue

@@ -29,7 +29,7 @@
 </template>
 
 <script lang="ts">
-import {defineComponent, Ref,ref} from '@nuxtjs/composition-api'
+import {defineComponent} from '@nuxtjs/composition-api'
 
 export default defineComponent({
   props: {

+ 1 - 1
composables/layout/Menus/accountMenu.ts

@@ -90,7 +90,7 @@ class AccountMenu extends BaseMenu implements Menu {
     }
 
     const accountMenu = this.constructMenu('my_account', {
-      avatarId: this.$store.state.profile.access.avatarId ?? true,
+      avatarId: this.$store.state.profile.access.avatarId,
       avatarByDefault: this.$store.state.profile.access.gender == 'MISTER' ? 'men-1.png' : 'women-1.png'
     }, undefined, undefined, children, false)
 

+ 1 - 1
composables/layout/Menus/myFamilyMenu.ts

@@ -34,7 +34,7 @@ class MyFamilyMenu extends BaseMenu implements Menu {
     _.each(this.$store.state.profile.access.familyAccesses, (access) => {
       const url = `/switch_user/${this.$store.state.profile.organization.id}/${this.$store.state.profile.access.id}/${access.id}`
       children.push(this.constructMenu(`${access.givenName} ${access.name}`, {
-        avatarId: access.avatarId ?? true,
+        avatarId: access.avatarId,
         avatarByDefault: access.gender == 'MISTER' ? 'men-1.png' : 'women-1.png'
       }, url, true))
     })

+ 25 - 1
config/abilities/pages/schedule.yaml

@@ -14,7 +14,7 @@
             - 'Events'
             - 'Courses'
             - 'Examens'
-            - 'EducationnalProjects'
+            - 'EducationalProjects'
 
   attendance_page:
     action: 'display'
@@ -23,3 +23,27 @@
         - {function: hasAbility, parameters: [{action: 'read', subject: 'attendances'}]}
       organization:
         - {function: hasModule, parameters: ['Attendances']}
+
+  course_page:
+    action: 'display'
+    services:
+      access:
+        - { function: hasAbility, parameters: [ { action: 'read', subject: 'courses' } ] }
+      organization:
+        - { function: hasModule, parameters: [ 'Courses' ] }
+
+  exam_page:
+    action: 'display'
+    services:
+      access:
+        - { function: hasAbility, parameters: [ { action: 'read', subject: 'examens' } ] }
+      organization:
+        - { function: hasModule, parameters: [ 'Examens' ] }
+
+  pedagogics_project_page:
+    action: 'display'
+    services:
+      access:
+        - { function: hasAbility, parameters: [ { action: 'read', subject: 'educationalprojects' } ] }
+      organization:
+        - { function: hasModule, parameters: [ 'EducationalProjects' ] }

+ 7 - 0
lang/layout/fr-FR.js

@@ -1,5 +1,12 @@
 export default (context, locale) => {
   return ({
+    universal_create_title_access: 'Quel type de contact souhaitez-vous créer ?',
+    universal_create_title_event: 'Que souhaitez-vous ajouter à votre planning ?',
+    universal_create_title_message: 'Que souhaitez-vous envoyer ?',
+    an_adherent: 'Un adhérent',
+    adherent_text_creation_card: 'Ajoutez un membre à votre structure le statut d\'adhérent',
+    a_ca_member: 'Un membre du CA',
+    ca_member_text_creation_card: 'Ajoutez un président, trésorier, secrétaire, membre actif... à votre Conseil d\'Administration',
     modif_picture:'Modifier l\'image',
     image_assistant:'Assistant de téléchargement',
     delete_assistant:'Assistant de suppression',

+ 9 - 0
services/profile/organizationProfile.ts

@@ -136,6 +136,14 @@ class OrganizationProfile {
     return this.organizationProfile.showAdherentList;
   }
 
+  /**
+   * L'organization est elle une association ?
+   * @return {boolean|null}
+   */
+  isAssociation():any{
+    return this.organizationProfile.legalStatus === 'ASSOCIATION_LAW_1901';
+  }
+
   /**
    * Factory
    *
@@ -148,6 +156,7 @@ class OrganizationProfile {
       isArtist: this.isArtist.bind(this),
       isManagerProduct: this.isManagerProduct.bind(this),
       isOrganizationWithChildren: this.hasChildren.bind(this),
+      isAssociation: this.isAssociation.bind(this),
       isShowAdherentList: this.isShowAdherentList.bind(this),
       isCmf: this.isCmf.bind(this)
     }

+ 5 - 0
store/profile/organization.ts

@@ -8,6 +8,7 @@ export const state = () => ({
   currentActivityYear: '',
   modules: [],
   hasChildren: false,
+  legalStatus: '',
   showAdherentList: false,
   networks: [],
   website: '',
@@ -37,6 +38,9 @@ export const mutations = {
   setShowAdherentList(state:organizationState, showAdherentList:boolean) {
     state.showAdherentList = showAdherentList
   },
+  setLegalStatus(state:organizationState, legalStatus:string) {
+    state.legalStatus = legalStatus
+  },
   setNetworks(state:organizationState, networks:Array<string>) {
     state.networks = networks
   },
@@ -64,6 +68,7 @@ export const actions = {
     context.commit('setSubDomain', profile.subDomain)
     context.commit('setModules', profile.modules)
     context.commit('setHasChildren', profile.hasChildren)
+    context.commit('setLegalStatus', profile.legalStatus)
     context.commit('setShowAdherentList', profile.showAdherentList)
     context.commit('setNetworks', profile.networks)
 

+ 1 - 0
types/interfaces.d.ts

@@ -147,6 +147,7 @@ interface organizationState extends baseOrganizationState {
   modules?: Array<string>,
   hasChildren?: boolean,
   showAdherentList?: boolean,
+  legalStatus?: string,
   networks: Array<string>,
   parents: Array<organizationState>,
 }