Browse Source

add missing menus

Olivier Massot 6 months ago
parent
commit
deceff8697

+ 9 - 0
config/abilities/pages/billing.yaml

@@ -93,3 +93,12 @@ afi_page:
         function: accessHasAnyRoleAbility,
         function: accessHasAnyRoleAbility,
         parameters: [{ action: 'manage', subject: 'billings-administration' }],
         parameters: [{ action: 'manage', subject: 'billings-administration' }],
       }
       }
+
+sdd_regie_page:
+  action: 'display'
+  conditions:
+    - { function: organizationHasAnyModule, parameters: ['SddRegie'] }
+    - {
+      function: accessHasAnyRoleAbility,
+      parameters: [{ action: 'manage', subject: 'billings-administration' }],
+    }

+ 33 - 0
config/abilities/pages/parameters.yaml

@@ -254,3 +254,36 @@ import_page:
       parameters:
       parameters:
         - { action: 'manage', subject: 'user' }
         - { action: 'manage', subject: 'user' }
         - { action: 'manage', subject: 'equipments' }
         - { action: 'manage', subject: 'equipments' }
+
+parcours_page:
+  action: 'display'
+  conditions:
+    - {
+      function: organizationHasAnyModule,
+      parameters: ['PedagogicsAdministation'],
+    }
+    - {
+      function: accessHasAnyRoleAbility,
+      parameters: [{ action: 'read', subject: 'pedagogics-administration' }],
+    }
+
+family_quotient_models_page:
+  action: 'display'
+  conditions:
+    - {
+      function: organizationHasAnyModule,
+      parameters: ['BillingAdministration'],
+    }
+    - {
+      function: accessHasAnyRoleAbility,
+      parameters: [{ action: 'read', subject: 'billings-seizure' }],
+    }
+
+pseudonymization_page:
+  action: 'display'
+  conditions:
+    - { function: organizationHasAnyModule, parameters: ['GeneralConfig'] }
+    - {
+      function: accessHasAnyRoleAbility,
+      parameters: [{ action: 'read', subject: 'organization' }],
+    }

+ 4 - 0
i18n/lang/fr.json

@@ -20,6 +20,7 @@
   "access_rewards_command": "Commande de distinctions",
   "access_rewards_command": "Commande de distinctions",
   "access_rewards": "Distinctions",
   "access_rewards": "Distinctions",
   "afi_export": "Export AFI",
   "afi_export": "Export AFI",
+  "sdd_regie_export": "Export prélèvements SDD Régie",
   "item": "Détails",
   "item": "Détails",
   "organization_breadcrumbs": "Fiche de la structure",
   "organization_breadcrumbs": "Fiche de la structure",
   "subscription_breadcrumbs": "Mon abonnement",
   "subscription_breadcrumbs": "Mon abonnement",
@@ -523,6 +524,9 @@
   "cmf_licence_details_url": "Consulter les avantages de la licence CMF",
   "cmf_licence_details_url": "Consulter les avantages de la licence CMF",
   "generate": "Générer",
   "generate": "Générer",
   "parameters": "Préférences",
   "parameters": "Préférences",
+  "parcours": "Parcours",
+  "family_quotient_models": "Modèles de quotients familiaux",
+  "pseudonymization": "Pseudonymisation",
   "parameters_page": "Préférences",
   "parameters_page": "Préférences",
   "places": "Lieux",
   "places": "Lieux",
   "education": "Enseignements",
   "education": "Enseignements",

+ 1 - 1
pages/subscription.vue

@@ -6,7 +6,7 @@ Page 'Mon abonnement'
 <template>
 <template>
   <div>
   <div>
     <LayoutContainer>
     <LayoutContainer>
-      <v-expansion-panels v-model="openedPanels" :multiple="true">
+      <v-expansion-panels v-model="openedPanels" :multiple="true" class="mt-4">
         <UiExpansionPanel title="subscription_page" icon="fas fa-info">
         <UiExpansionPanel title="subscription_page" icon="fas fa-info">
           <v-container fluid class="container">
           <v-container fluid class="container">
             <v-row>
             <v-row>

+ 11 - 0
services/layout/menuBuilder/billingMenuBuilder.ts

@@ -113,6 +113,17 @@ export default class BillingMenuBuilder extends AbstractMenuBuilder {
       )
       )
     }
     }
 
 
+    if (this.ability.can('display', 'sdd_regie_page')) {
+      children.push(
+        this.createItem(
+          'sdd_regie_export',
+          { name: 'fas fa-align-justify' },
+          '/sdd_regies/list/',
+          MENU_LINK_TYPE.V1,
+        ),
+      )
+    }
+
     if (children.length > 1) {
     if (children.length > 1) {
       // Plusieurs éléments, on retourne un groupe
       // Plusieurs éléments, on retourne un groupe
       return this.createGroup('billing', { name: 'fas fa-euro-sign' }, children)
       return this.createGroup('billing', { name: 'fas fa-euro-sign' }, children)

+ 44 - 10
services/layout/menuBuilder/configurationMenuBuilder.ts

@@ -129,16 +129,6 @@ export default class ConfigurationMenuBuilder extends AbstractMenuBuilder {
       )
       )
     }
     }
 
 
-    if (this.ability.can('display', 'billing_schedules_settings_page')) {
-      children.push(
-        this.createItem(
-          'billing_schedules',
-          undefined,
-          '/bill_schedules/list/',
-          MENU_LINK_TYPE.V1,
-        ),
-      )
-    }
 
 
     if (this.ability.can('display', 'online_registration_settings_page')) {
     if (this.ability.can('display', 'online_registration_settings_page')) {
       children.push(
       children.push(
@@ -171,6 +161,50 @@ export default class ConfigurationMenuBuilder extends AbstractMenuBuilder {
       )
       )
     }
     }
 
 
+    if (this.ability.can('display', 'parcours_page')) {
+      children.push(
+        this.createItem(
+          'parcours',
+          undefined,
+          '/family_quotient_models/list/',
+          MENU_LINK_TYPE.V1,
+        ),
+      )
+    }
+
+    if (this.ability.can('display', 'family_quotient_models_page')) {
+      children.push(
+        this.createItem(
+          'family_quotient_models',
+          undefined,
+          '/family_quotient_models/list/',
+          MENU_LINK_TYPE.V1,
+        ),
+      )
+    }
+
+    if (this.ability.can('display', 'billing_schedules_settings_page')) {
+      children.push(
+        this.createItem(
+          'billing_schedules',
+          undefined,
+          '/bill_schedules/list/',
+          MENU_LINK_TYPE.V1,
+        ),
+      )
+    }
+
+    if (this.ability.can('display', 'pseudonymization_page')) {
+      children.push(
+        this.createItem(
+          'pseudonymization',
+          undefined,
+          '/pseudonymizationList/list/',
+          MENU_LINK_TYPE.V1,
+        ),
+      )
+    }
+
     if (children.length > 1) {
     if (children.length > 1) {
       // Plusieurs éléments, on retourne un groupe
       // Plusieurs éléments, on retourne un groupe
       return this.createGroup(
       return this.createGroup(

+ 17 - 1
tests/units/services/layout/menuBuilder/billingMenuBuilder.test.ts

@@ -49,7 +49,7 @@ describe('build', () => {
     expect(result.label).toEqual('billing')
     expect(result.label).toEqual('billing')
     expect(result.icon).toEqual({ name: 'fas fa-euro-sign' })
     expect(result.icon).toEqual({ name: 'fas fa-euro-sign' })
     // @ts-ignore
     // @ts-ignore
-    expect(result.children.length).toEqual(9)
+    expect(result.children.length).toEqual(10)
   })
   })
 
 
   test('has no items', () => {
   test('has no items', () => {
@@ -200,4 +200,20 @@ describe('build', () => {
       active: false,
       active: false,
     })
     })
   })
   })
+
+  test('has only rights for menu sdd_regie_export', () => {
+    ability.can = vi.fn(
+      (action: string, subject: string) =>
+        action === 'display' && subject === 'sdd_regie_page',
+    )
+
+    expect(menuBuilder.build()).toEqual({
+      label: 'sdd_regie_export',
+      icon: { name: 'fas fa-align-justify' },
+      to: 'https://mydomain.com/#/sdd_regies/list/',
+      target: '_self',
+      type: MENU_LINK_TYPE.V1,
+      active: false,
+    })
+  })
 })
 })

+ 65 - 1
tests/units/services/layout/menuBuilder/configurationMenuBuilder.test.ts

@@ -52,7 +52,7 @@ describe('build', () => {
     expect(result.label).toEqual('configuration')
     expect(result.label).toEqual('configuration')
     expect(result.icon).toEqual({ name: 'fas fa-cogs' })
     expect(result.icon).toEqual({ name: 'fas fa-cogs' })
     // @ts-ignore
     // @ts-ignore
-    expect(result.children.length).toEqual(13)
+    expect(result.children.length).toEqual(16)
   })
   })
 
 
   test('has no items', () => {
   test('has no items', () => {
@@ -221,4 +221,68 @@ describe('build', () => {
       active: false,
       active: false,
     })
     })
   })
   })
+
+  test('has only rights for menu parcours', () => {
+    ability.can = vi.fn(
+      (action: string, subject: string) =>
+        action === 'display' && subject === 'parcours_page',
+    )
+
+    expect(menuBuilder.build()).toEqual({
+      label: 'parcours',
+      icon: undefined,
+      to: 'https://mydomain.com/#/family_quotient_models/list/',
+      target: '_self',
+      type: MENU_LINK_TYPE.V1,
+      active: false,
+    })
+  })
+
+  test('has only rights for menu family_quotient_models', () => {
+    ability.can = vi.fn(
+      (action: string, subject: string) =>
+        action === 'display' && subject === 'family_quotient_models_page',
+    )
+
+    expect(menuBuilder.build()).toEqual({
+      label: 'family_quotient_models',
+      icon: undefined,
+      to: 'https://mydomain.com/#/family_quotient_models/list/',
+      target: '_self',
+      type: MENU_LINK_TYPE.V1,
+      active: false,
+    })
+  })
+
+  test('has only rights for menu billing_schedules', () => {
+    ability.can = vi.fn(
+      (action: string, subject: string) =>
+        action === 'display' && subject === 'billing_schedules_settings_page',
+    )
+
+    expect(menuBuilder.build()).toEqual({
+      label: 'billing_schedules',
+      icon: undefined,
+      to: 'https://mydomain.com/#/bill_schedules/list/',
+      target: '_self',
+      type: MENU_LINK_TYPE.V1,
+      active: false,
+    })
+  })
+
+  test('has only rights for menu pseudonymization', () => {
+    ability.can = vi.fn(
+      (action: string, subject: string) =>
+        action === 'display' && subject === 'pseudonymization_page',
+    )
+
+    expect(menuBuilder.build()).toEqual({
+      label: 'pseudonymization',
+      icon: undefined,
+      to: 'https://mydomain.com/#/pseudonymizationList/list/',
+      target: '_self',
+      type: MENU_LINK_TYPE.V1,
+      active: false,
+    })
+  })
 })
 })