From dbc268c263654933a165a255da6768663224c199 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Wed, 7 Aug 2024 14:17:02 +0200
Subject: [PATCH 01/23] fix progress bar

---
 .../global-components/progress-bar/progress-bar.component.scss   | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss
index 0c0d3cbe8..eb67d687b 100644
--- a/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss
+++ b/src/app/form/form-view/global-components/progress-bar/progress-bar.component.scss
@@ -53,7 +53,6 @@
   label {
     @include font-bold-14;
     color: $red;
-    min-width: 26px;
   }
 }
 .topSpacing {
-- 
GitLab


From c632689031b9e83f699900843e6c03d7a2c31e67 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Wed, 7 Aug 2024 15:11:28 +0200
Subject: [PATCH 02/23] Revert "Merge branch
 '597-accessibilite-radio-option-component' into 'dev'"

This reverts commit d549009bb9cfa2989a8ed5cee39d5af88131fa09, reversing
changes made to e34d34a9d12afa8fcb26a3496dbd9ee1f73e76e6.
---
 .../structure-wifi/structure-wifi.component.html       |  4 ++--
 .../structure-wifi/structure-wifi.component.ts         |  6 +++---
 .../needs-selection/needs-selection.component.html     |  4 ++--
 .../needs-selection/needs-selection.component.ts       | 10 ++++++++--
 .../radio-option/radio-option.component.html           |  2 +-
 .../components/radio-option/radio-option.component.ts  |  8 ++++++--
 src/app/shared/components/radio/radio.component.html   | 10 +++++++++-
 src/app/shared/components/radio/radio.component.ts     |  4 ++--
 8 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html
index c85199c84..3f70cab9e 100644
--- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html
+++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html
@@ -12,7 +12,7 @@
       [selected]="
         isEditMode ? isInArray('selfServiceMaterial', 'wifiEnAccesLibre') : structureForm.get('freeWifi').value
       "
-      (click)="onCheckChange(true, 'categories.selfServiceMaterial', 'wifiEnAccesLibre')"
+      (selectedEvent)="onCheckChange($event, 'categories.selfServiceMaterial', 'wifiEnAccesLibre')"
     />
     <app-radio-option
       [id]="'no'"
@@ -22,7 +22,7 @@
         (isEditMode ? isInArray('selfServiceMaterial', 'wifiEnAccesLibre') : structureForm.get('freeWifi').value) ===
         false
       "
-      (click)="onCheckChange(false, 'categories.selfServiceMaterial', 'wifiEnAccesLibre')"
+      (selectedEvent)="onCheckChange($event, 'categories.selfServiceMaterial', 'wifiEnAccesLibre')"
     />
   </div>
 </form>
diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts
index a7f3414de..c63a6aaad 100644
--- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts
+++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts
@@ -20,9 +20,9 @@ export class StructureWifiComponent implements OnInit {
   public isInArray(formControlName: string, term: string): boolean {
     return this.formUtils.isInCategoryArray(term, formControlName, this.structureForm);
   }
-  public onCheckChange(value: boolean, catId: string, modId: string): void {
-    this.checkChange.emit({ event: value, formControlName: catId, value: modId });
-    this.onRadioChange('freeWifi', value);
+  public onCheckChange(event: { name: string; value: string | boolean }, catId: string, modId: string): void {
+    this.checkChange.emit({ event: event.value, formControlName: catId, value: modId });
+    this.onRadioChange('freeWifi', event.value);
   }
 
   public onRadioChange(name: string, value: string | boolean): void {
diff --git a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html
index 1b01c2213..98778d9e3 100644
--- a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html
+++ b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html
@@ -10,8 +10,8 @@
       [label]="option.title"
       [description]="option.hint"
       [iconName]="option.icon"
-      [selected]="currentNeed === option.key"
-      (click)="selectNeed(option.key)"
+      [selected]="getSelected() === option.key"
+      (selectedEvent)="selectNeed(option.key)"
     />
   </div>
 </div>
diff --git a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
index d3ac80aeb..544db2f1b 100644
--- a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
+++ b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
@@ -4,7 +4,7 @@ import { PersonalOffer } from '../../../../models/personalOffer.model';
 import { OrientationService } from '../../../../services/orientation.service';
 import { PersonalOfferService } from '../../../../services/personal-offer.service';
 import { INeedItem } from '../../../../utils/orientationUtils';
-import { NeedsType } from '../../enums/orientation.enums';
+import { NeedsType, OnlineDemarche } from '../../enums/orientation.enums';
 
 @Component({
   selector: 'app-needs-selection',
@@ -74,6 +74,12 @@ export class NeedsSelectionComponent implements OnInit {
 
   public selectNeed(event: string): void {
     this.setNeedType.emit(event);
-    this.validate.emit();
+  }
+  public getSelected(): NeedsType | OnlineDemarche {
+    const selected = this.needsList.filter((need) => need.key === this.currentNeed)[0];
+    if (selected) {
+      this.validate.emit();
+      return selected.key;
+    }
   }
 }
diff --git a/src/app/shared/components/radio-option/radio-option.component.html b/src/app/shared/components/radio-option/radio-option.component.html
index bad3eb0d3..c5477d582 100644
--- a/src/app/shared/components/radio-option/radio-option.component.html
+++ b/src/app/shared/components/radio-option/radio-option.component.html
@@ -1,4 +1,4 @@
-<div class="radioContainer" tabindex="-1" [ngClass]="{ selected: selected }">
+<div class="radioContainer" tabindex="-1" [ngClass]="{ selected: selected }" (click)="clicked()" (keydown)="clicked()">
   <app-radio
     [id]="id"
     [checked]="selected === true"
diff --git a/src/app/shared/components/radio-option/radio-option.component.ts b/src/app/shared/components/radio-option/radio-option.component.ts
index 6be330903..cd34e7833 100644
--- a/src/app/shared/components/radio-option/radio-option.component.ts
+++ b/src/app/shared/components/radio-option/radio-option.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input } from '@angular/core';
+import { Component, EventEmitter, Input, Output } from '@angular/core';
 
 @Component({
   selector: 'app-radio-option',
@@ -27,5 +27,9 @@ export class RadioOptionComponent {
   /** Optional icon to display between the radio and label */
   @Input() iconName?: string;
 
-  // For a better accessibility support, use the native html output events (change, click, etc.) emitted by the inner input radio element
+  @Output() selectedEvent = new EventEmitter<{ name: string; value: string | boolean }>();
+
+  public clicked(): void {
+    this.selectedEvent.emit({ name: this.id, value: this.value });
+  }
 }
diff --git a/src/app/shared/components/radio/radio.component.html b/src/app/shared/components/radio/radio.component.html
index fec967762..2ce3ca4e9 100644
--- a/src/app/shared/components/radio/radio.component.html
+++ b/src/app/shared/components/radio/radio.component.html
@@ -1,5 +1,13 @@
 <div class="radioContainer">
-  <input type="radio" [id]="id" [checked]="checked" [disabled]="disabled" [ngClass]="classes" />
+  <input
+    type="radio"
+    [id]="id"
+    [checked]="checked"
+    [disabled]="disabled"
+    [ngClass]="classes"
+    (click)="action.emit($event)"
+    (keydown)="action.emit($event)"
+  />
   <app-svg-icon *ngIf="iconName" [iconClass]="'icon-44'" [folder]="'form'" [icon]="iconName" />
   <div class="details">
     <label [for]="id">{{ label }}</label>
diff --git a/src/app/shared/components/radio/radio.component.ts b/src/app/shared/components/radio/radio.component.ts
index 27c09c57a..ee4010b2d 100644
--- a/src/app/shared/components/radio/radio.component.ts
+++ b/src/app/shared/components/radio/radio.component.ts
@@ -1,4 +1,4 @@
-import { Component, Input } from '@angular/core';
+import { Component, EventEmitter, Input, Output } from '@angular/core';
 
 @Component({
   selector: 'app-radio',
@@ -26,7 +26,7 @@ export class RadioComponent {
   /** Optional icon to display between the radio and label */
   @Input() iconName?: string;
 
-  // For a better accessibility support, use the native html output events (change, click, etc.) emitted by the inner input radio element
+  @Output() action = new EventEmitter<Event>();
 
   public get classes(): string[] {
     return [this.size];
-- 
GitLab


From 32794312d398c909e78539f2f8d6b213af131ec3 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Wed, 7 Aug 2024 16:50:32 +0200
Subject: [PATCH 03/23] Added missing clicks for radio-options

---
 .../structure-wifi/structure-wifi.component.html       |  4 ++--
 .../structure-wifi/structure-wifi.component.ts         |  6 +++---
 .../needs-selection/needs-selection.component.html     |  4 ++--
 .../needs-selection/needs-selection.component.ts       | 10 ++--------
 .../mediation-language-selection.component.html        |  2 +-
 .../accompaniment-type.component.html                  |  2 +-
 .../radio-option/radio-option.component.html           |  2 +-
 .../components/radio-option/radio-option.component.ts  |  8 ++------
 src/app/shared/components/radio/radio.component.html   | 10 +---------
 src/app/shared/components/radio/radio.component.ts     |  4 ++--
 10 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html
index 3f70cab9e..c85199c84 100644
--- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html
+++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.html
@@ -12,7 +12,7 @@
       [selected]="
         isEditMode ? isInArray('selfServiceMaterial', 'wifiEnAccesLibre') : structureForm.get('freeWifi').value
       "
-      (selectedEvent)="onCheckChange($event, 'categories.selfServiceMaterial', 'wifiEnAccesLibre')"
+      (click)="onCheckChange(true, 'categories.selfServiceMaterial', 'wifiEnAccesLibre')"
     />
     <app-radio-option
       [id]="'no'"
@@ -22,7 +22,7 @@
         (isEditMode ? isInArray('selfServiceMaterial', 'wifiEnAccesLibre') : structureForm.get('freeWifi').value) ===
         false
       "
-      (selectedEvent)="onCheckChange($event, 'categories.selfServiceMaterial', 'wifiEnAccesLibre')"
+      (click)="onCheckChange(false, 'categories.selfServiceMaterial', 'wifiEnAccesLibre')"
     />
   </div>
 </form>
diff --git a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts
index c63a6aaad..a7f3414de 100644
--- a/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts
+++ b/src/app/form/form-view/structure-form/structure-wifi/structure-wifi.component.ts
@@ -20,9 +20,9 @@ export class StructureWifiComponent implements OnInit {
   public isInArray(formControlName: string, term: string): boolean {
     return this.formUtils.isInCategoryArray(term, formControlName, this.structureForm);
   }
-  public onCheckChange(event: { name: string; value: string | boolean }, catId: string, modId: string): void {
-    this.checkChange.emit({ event: event.value, formControlName: catId, value: modId });
-    this.onRadioChange('freeWifi', event.value);
+  public onCheckChange(value: boolean, catId: string, modId: string): void {
+    this.checkChange.emit({ event: value, formControlName: catId, value: modId });
+    this.onRadioChange('freeWifi', value);
   }
 
   public onRadioChange(name: string, value: string | boolean): void {
diff --git a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html
index 98778d9e3..1b01c2213 100644
--- a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html
+++ b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html
@@ -10,8 +10,8 @@
       [label]="option.title"
       [description]="option.hint"
       [iconName]="option.icon"
-      [selected]="getSelected() === option.key"
-      (selectedEvent)="selectNeed(option.key)"
+      [selected]="currentNeed === option.key"
+      (click)="selectNeed(option.key)"
     />
   </div>
 </div>
diff --git a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
index 544db2f1b..d3ac80aeb 100644
--- a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
+++ b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
@@ -4,7 +4,7 @@ import { PersonalOffer } from '../../../../models/personalOffer.model';
 import { OrientationService } from '../../../../services/orientation.service';
 import { PersonalOfferService } from '../../../../services/personal-offer.service';
 import { INeedItem } from '../../../../utils/orientationUtils';
-import { NeedsType, OnlineDemarche } from '../../enums/orientation.enums';
+import { NeedsType } from '../../enums/orientation.enums';
 
 @Component({
   selector: 'app-needs-selection',
@@ -74,12 +74,6 @@ export class NeedsSelectionComponent implements OnInit {
 
   public selectNeed(event: string): void {
     this.setNeedType.emit(event);
-  }
-  public getSelected(): NeedsType | OnlineDemarche {
-    const selected = this.needsList.filter((need) => need.key === this.currentNeed)[0];
-    if (selected) {
-      this.validate.emit();
-      return selected.key;
-    }
+    this.validate.emit();
   }
 }
diff --git a/src/app/form/orientation-form-view/online-demarch/mediation-language-selection/mediation-language-selection.component.html b/src/app/form/orientation-form-view/online-demarch/mediation-language-selection/mediation-language-selection.component.html
index 5c0440da5..f7c92bd02 100644
--- a/src/app/form/orientation-form-view/online-demarch/mediation-language-selection/mediation-language-selection.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/mediation-language-selection/mediation-language-selection.component.html
@@ -7,7 +7,7 @@
       [id]="lang.key"
       [label]="lang.title"
       [selected]="selected === lang.key"
-      (selectedEvent)="handleSelect(lang.key)"
+      (click)="handleSelect(lang.key)"
     />
   </div>
 </div>
diff --git a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.html b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.html
index 5a6defbe0..10f543b7e 100644
--- a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.html
@@ -7,7 +7,7 @@
       [label]="option.title"
       [description]="option.hint"
       [selected]="selected === option.key"
-      (selectedEvent)="handleSelect(option.key)"
+      (click)="handleSelect(option.key)"
     />
   </div>
 </div>
diff --git a/src/app/shared/components/radio-option/radio-option.component.html b/src/app/shared/components/radio-option/radio-option.component.html
index c5477d582..bad3eb0d3 100644
--- a/src/app/shared/components/radio-option/radio-option.component.html
+++ b/src/app/shared/components/radio-option/radio-option.component.html
@@ -1,4 +1,4 @@
-<div class="radioContainer" tabindex="-1" [ngClass]="{ selected: selected }" (click)="clicked()" (keydown)="clicked()">
+<div class="radioContainer" tabindex="-1" [ngClass]="{ selected: selected }">
   <app-radio
     [id]="id"
     [checked]="selected === true"
diff --git a/src/app/shared/components/radio-option/radio-option.component.ts b/src/app/shared/components/radio-option/radio-option.component.ts
index cd34e7833..6be330903 100644
--- a/src/app/shared/components/radio-option/radio-option.component.ts
+++ b/src/app/shared/components/radio-option/radio-option.component.ts
@@ -1,4 +1,4 @@
-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, Input } from '@angular/core';
 
 @Component({
   selector: 'app-radio-option',
@@ -27,9 +27,5 @@ export class RadioOptionComponent {
   /** Optional icon to display between the radio and label */
   @Input() iconName?: string;
 
-  @Output() selectedEvent = new EventEmitter<{ name: string; value: string | boolean }>();
-
-  public clicked(): void {
-    this.selectedEvent.emit({ name: this.id, value: this.value });
-  }
+  // For a better accessibility support, use the native html output events (change, click, etc.) emitted by the inner input radio element
 }
diff --git a/src/app/shared/components/radio/radio.component.html b/src/app/shared/components/radio/radio.component.html
index 2ce3ca4e9..fec967762 100644
--- a/src/app/shared/components/radio/radio.component.html
+++ b/src/app/shared/components/radio/radio.component.html
@@ -1,13 +1,5 @@
 <div class="radioContainer">
-  <input
-    type="radio"
-    [id]="id"
-    [checked]="checked"
-    [disabled]="disabled"
-    [ngClass]="classes"
-    (click)="action.emit($event)"
-    (keydown)="action.emit($event)"
-  />
+  <input type="radio" [id]="id" [checked]="checked" [disabled]="disabled" [ngClass]="classes" />
   <app-svg-icon *ngIf="iconName" [iconClass]="'icon-44'" [folder]="'form'" [icon]="iconName" />
   <div class="details">
     <label [for]="id">{{ label }}</label>
diff --git a/src/app/shared/components/radio/radio.component.ts b/src/app/shared/components/radio/radio.component.ts
index ee4010b2d..27c09c57a 100644
--- a/src/app/shared/components/radio/radio.component.ts
+++ b/src/app/shared/components/radio/radio.component.ts
@@ -1,4 +1,4 @@
-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, Input } from '@angular/core';
 
 @Component({
   selector: 'app-radio',
@@ -26,7 +26,7 @@ export class RadioComponent {
   /** Optional icon to display between the radio and label */
   @Input() iconName?: string;
 
-  @Output() action = new EventEmitter<Event>();
+  // For a better accessibility support, use the native html output events (change, click, etc.) emitted by the inner input radio element
 
   public get classes(): string[] {
     return [this.size];
-- 
GitLab


From 4fe8b0d3a6aaa2402db7e9eb697280d3948af13a Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Fri, 9 Aug 2024 12:48:20 +0200
Subject: [PATCH 04/23] renamed filtersForm

---
 .../base-skills-choice.component.ts           |   4 +-
 .../base-skills/base-skills.component.html    |   2 +-
 .../base-skills/base-skills.component.ts      |   4 +-
 .../equipment-access-choice.component.ts      |   5 +-
 .../equipment-access.component.html           |   4 +-
 .../equipment-access.component.ts             |   4 +-
 .../equipment-buy-type.component.ts           |   4 +-
 .../equipment-buy.component.html              |   2 +-
 .../equipment-buy/equipment-buy.component.ts  |   4 +-
 .../select/select.component.ts                |   4 +-
 .../onlineDemarch-form.component.html         |   2 +-
 .../orientation-form-view.component.html      |   6 +-
 .../orientation-form-view.component.ts        | 177 +++++++++---------
 13 files changed, 115 insertions(+), 107 deletions(-)

diff --git a/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.ts b/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.ts
index 6e61f7c6e..4efb4ea7e 100644
--- a/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.ts
+++ b/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.ts
@@ -15,7 +15,7 @@ import { FiltersForm } from '../../interfaces/filtersForm.interface';
   templateUrl: './base-skills-choice.component.html',
 })
 export class BaseSkillsChoiceComponent extends SelectComponent implements OnInit {
-  @Input() form: FormGroup<FiltersForm>;
+  @Input() filtersForm: FormGroup<FiltersForm>;
   public orientationUtils = new OrientationUtils();
   public baseSkills: Module[] = [];
 
@@ -28,7 +28,7 @@ export class BaseSkillsChoiceComponent extends SelectComponent implements OnInit
   }
 
   ngOnInit(): void {
-    this.selectedModules = this.form.get('filters').value;
+    this.selectedModules = this.filtersForm.get('filters').value;
     this.searchService.getCategories().subscribe(async (categories: Category[]) => {
       this.baseSkills = categories.find((el) => el.id === CategoryEnum.baseSkills).modules;
 
diff --git a/src/app/form/orientation-form-view/base-skills/base-skills.component.html b/src/app/form/orientation-form-view/base-skills/base-skills.component.html
index 9c96ac4df..d895a7a99 100644
--- a/src/app/form/orientation-form-view/base-skills/base-skills.component.html
+++ b/src/app/form/orientation-form-view/base-skills/base-skills.component.html
@@ -1,5 +1,5 @@
 <app-base-skills-choice
   *ngIf="currentType === GenericOrientationSteps.common"
-  [form]="form"
+  [filtersForm]="filtersForm"
   (checkValidation)="checkValidation()"
 />
diff --git a/src/app/form/orientation-form-view/base-skills/base-skills.component.ts b/src/app/form/orientation-form-view/base-skills/base-skills.component.ts
index 2322cee8b..40f7fee64 100644
--- a/src/app/form/orientation-form-view/base-skills/base-skills.component.ts
+++ b/src/app/form/orientation-form-view/base-skills/base-skills.component.ts
@@ -12,7 +12,7 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
 export class BaseSkillsComponent {
   @Input() currentStep: FiltersSteps | MediationStepType;
   @Input() currentType: GenericOrientationSteps | MediationType;
-  @Input() form: FormGroup<FiltersForm>;
+  @Input() filtersForm: FormGroup<FiltersForm>;
   @Output() validatePage = new EventEmitter<any>();
 
   public orientationUtils = new OrientationUtils();
@@ -29,7 +29,7 @@ export class BaseSkillsComponent {
       case GenericOrientationSteps.common:
         this.orientationUtils.setValidationsEquipmentForm(
           this.pagesValidation,
-          this.form,
+          this.filtersForm,
           (isValid) => this.validatePage.emit(isValid),
           this.currentStep as FiltersSteps,
         );
diff --git a/src/app/form/orientation-form-view/equipment-access/equipment-access-choice/equipment-access-choice.component.ts b/src/app/form/orientation-form-view/equipment-access/equipment-access-choice/equipment-access-choice.component.ts
index ebd54d299..e688af66e 100644
--- a/src/app/form/orientation-form-view/equipment-access/equipment-access-choice/equipment-access-choice.component.ts
+++ b/src/app/form/orientation-form-view/equipment-access/equipment-access-choice/equipment-access-choice.component.ts
@@ -1,6 +1,5 @@
 import { Component, Input, OnInit } from '@angular/core';
 import { FormGroup } from '@angular/forms';
-
 import { CategoryEnum } from '../../../../shared/enum/category.enum';
 import { Category } from '../../../../structure-list/models/category.model';
 import { Module } from '../../../../structure-list/models/module.model';
@@ -13,7 +12,7 @@ import { FiltersForm } from '../../interfaces/filtersForm.interface';
   templateUrl: './equipment-access-choice.component.html',
 })
 export class EquipmentAccessChoiceComponent extends SelectComponent implements OnInit {
-  @Input() form: FormGroup<FiltersForm>;
+  @Input() filtersForm: FormGroup<FiltersForm>;
   public equipmentType: Module[] = [];
 
   constructor(private searchService: SearchService) {
@@ -21,7 +20,7 @@ export class EquipmentAccessChoiceComponent extends SelectComponent implements O
   }
 
   ngOnInit(): void {
-    this.selectedModules = this.form.get('filters').value;
+    this.selectedModules = this.filtersForm.get('filters').value;
     this.searchService.getCategories().subscribe((categories: Category[]) => {
       this.equipmentType = categories.find((el) => el.id === CategoryEnum.selfServiceMaterial).modules;
     });
diff --git a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html
index e091cd974..9d38ad1f3 100644
--- a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html
+++ b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html
@@ -1,12 +1,12 @@
 <app-equipment-access-choice
   *ngIf="currentType === GenericOrientationSteps.common"
-  [form]="form"
+  [filtersForm]="filtersForm"
   (checkValidation)="checkValidation()"
 />
 <app-orientation-structure-list
   *ngIf="currentType === GenericOrientationSteps.structureList"
-  [form]="orientationForm"
   [currentStep]="currentStep"
+  [form]="orientationForm"
   [filters]="filters"
   [profile]="profile"
   (validatePage)="checkValidation()"
diff --git a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
index 14da13579..bfa2d76fe 100644
--- a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
+++ b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
@@ -15,7 +15,7 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
 export class EquipmentAccessComponent {
   @Input() currentStep: FiltersSteps | StructuresListSteps | MediationStepType;
   @Input() currentType: GenericOrientationSteps | MediationType;
-  @Input() form: FormGroup<FiltersForm>;
+  @Input() filtersForm: FormGroup<FiltersForm>;
   @Input() orientationForm: FormGroup<StructureOrientationForm>;
   @Input() filters: Filter[] = [];
   @Input() profile: User;
@@ -34,7 +34,7 @@ export class EquipmentAccessComponent {
       case GenericOrientationSteps.common:
         this.orientationUtils.setValidationsEquipmentForm(
           this.pagesValidation,
-          this.form,
+          this.filtersForm,
           (isValid) => this.validatePage.emit(isValid),
           this.currentStep as FiltersSteps,
         );
diff --git a/src/app/form/orientation-form-view/equipment-buy/equipment-buy-type/equipment-buy-type.component.ts b/src/app/form/orientation-form-view/equipment-buy/equipment-buy-type/equipment-buy-type.component.ts
index c1a617264..c09791d08 100644
--- a/src/app/form/orientation-form-view/equipment-buy/equipment-buy-type/equipment-buy-type.component.ts
+++ b/src/app/form/orientation-form-view/equipment-buy/equipment-buy-type/equipment-buy-type.component.ts
@@ -12,14 +12,14 @@ import { FiltersForm } from '../../interfaces/filtersForm.interface';
   templateUrl: './equipment-buy-type.component.html',
 })
 export class EquipmentBuyTypeComponent extends SelectComponent implements OnInit {
-  @Input() form: FormGroup<FiltersForm>;
+  @Input() filtersForm: FormGroup<FiltersForm>;
   public equipmentType: Module[] = [];
   constructor(private searchService: SearchService) {
     super();
   }
 
   ngOnInit(): void {
-    this.selectedModules = this.form.get('filters').value;
+    this.selectedModules = this.filtersForm.get('filters').value;
     this.searchService.getCategories().subscribe((categories: Category[]) => {
       this.equipmentType = categories.find((el) => el.id === CategoryEnum.solidarityMaterial).modules;
     });
diff --git a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html
index 92e7d8724..db48013b0 100644
--- a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html
+++ b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html
@@ -1,6 +1,6 @@
 <app-equipment-buy-type
   *ngIf="currentType === GenericOrientationSteps.common"
-  [form]="form"
+  [filtersForm]="filtersForm"
   (checkValidation)="checkValidation()"
 />
 <app-orientation-structure-list
diff --git a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
index d34dd5dcd..b292e9d05 100644
--- a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
+++ b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
@@ -15,7 +15,7 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
 export class EquipmentBuyComponent {
   @Input() currentStep: FiltersSteps | StructuresListSteps | MediationStepType;
   @Input() currentType: GenericOrientationSteps | MediationType;
-  @Input() form: FormGroup<FiltersForm>;
+  @Input() filtersForm: FormGroup<FiltersForm>;
   @Input() orientationForm: FormGroup<StructureOrientationForm>;
   @Input() filters: Filter[] = [];
   @Input() profile: User;
@@ -34,7 +34,7 @@ export class EquipmentBuyComponent {
       case GenericOrientationSteps.common:
         this.orientationUtils.setValidationsEquipmentForm(
           this.pagesValidation,
-          this.form,
+          this.filtersForm,
           (isValid) => this.validatePage.emit(isValid),
           this.currentStep as FiltersSteps,
         );
diff --git a/src/app/form/orientation-form-view/global-components/select/select.component.ts b/src/app/form/orientation-form-view/global-components/select/select.component.ts
index aa11c141e..76c604ac7 100644
--- a/src/app/form/orientation-form-view/global-components/select/select.component.ts
+++ b/src/app/form/orientation-form-view/global-components/select/select.component.ts
@@ -4,7 +4,7 @@ import { Module } from '../../../../structure-list/models/module.model';
 
 @Component({ template: `` })
 export class SelectComponent {
-  @Input() form: FormGroup;
+  @Input() filtersForm: FormGroup;
   @Output() checkValidation = new EventEmitter<any>();
   public equipmentType: Module[] = [];
   public selectedModules: Module[] = [];
@@ -16,7 +16,7 @@ export class SelectComponent {
     } else {
       this.selectedModules.push(module);
     }
-    this.form.get('filters').patchValue(this.selectedModules);
+    this.filtersForm.get('filters').patchValue(this.selectedModules);
     this.checkValidation.emit();
   }
 
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
index 3dd7e4bf1..2d51b8e48 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
@@ -14,7 +14,7 @@
     *ngIf="needType === NeedsType.learnSkills && currentStep === OnlineDemarchesCommonSteps.onlineDemarche"
     [currentStep]="currentStep"
     [currentType]="currentType"
-    [form]="filtersForm"
+    [filtersForm]="filtersForm"
     (validatePage)="checkValidation()"
   />
 </ng-container>
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html
index 0f8dff1e1..2e6ff36f9 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.html
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.html
@@ -8,7 +8,7 @@
     <app-needs-selection
       *ngIf="currentStep === null"
       [currentNeed]="needType"
-      (setNeedType)="setCurrentNeedType($event)"
+      (setNeedType)="initializeNeedType($event)"
       (validate)="validatePage(true)"
     />
     <ng-container *ngIf="currentStep !== null">
@@ -16,7 +16,7 @@
         *ngIf="needType === needEnum.equipmentAccess"
         [currentStep]="currentStep"
         [currentType]="currentType"
-        [form]="filtersForm"
+        [filtersForm]="filtersForm"
         [orientationForm]="structureOrientationForm"
         [filters]="filters"
         [profile]="profile"
@@ -26,7 +26,7 @@
         *ngIf="needType === needEnum.equipmentBuy"
         [currentStep]="currentStep"
         [currentType]="currentType"
-        [form]="filtersForm"
+        [filtersForm]="filtersForm"
         [orientationForm]="structureOrientationForm"
         [filters]="filters"
         [profile]="profile"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index f100feab8..ad8230c2b 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -49,9 +49,9 @@ import { MediationStepType, MediationType } from './types/orientation.types';
 export class OrientationFormViewComponent implements OnInit, AfterContentChecked {
   public static readonly MAX_STEP =
     (Math.max(
-      Object.keys(HotlineMediationSteps).length,
-      Object.keys(AppointmentSteps).length,
       Object.keys(StructuresListSteps).length,
+      Object.keys(AppointmentSteps).length,
+      Object.keys(HotlineMediationSteps).length,
     ) +
       Object.keys(OnlineDemarchesCommonSteps).length) /
     2;
@@ -176,26 +176,28 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     if (!this.authService.isLoggedIn()) {
       this.showLoginModal = true;
-    } else {
-      this.profile = await this.profileService.getProfile();
-
-      if (this.profile?.structuresLink?.length === 1) {
-        this.structureService.getStructure(this.profile.structuresLink[0]).subscribe(
-          (_structure) =>
-            (this.orientator = this.orientationUtils.createStructureOrientatorForm({
-              structureName: _structure.structureName,
-              structureMail: _structure.contactMail,
-              structurePhone: _structure.contactPhone,
-            })),
-        );
-      }
+      return;
     }
 
-    if (history.state.mediationNumerique) {
-      this.currentStep = 0;
-      this.needType = this.needEnum.learnSkills;
-      this.setCurrentNeedType(NeedsType.learnSkills);
+    this.profile = await this.profileService.getProfile();
+
+    if (this.profile?.structuresLink?.length === 1) {
+      this.structureService.getStructure(this.profile.structuresLink[0]).subscribe(
+        (_structure) =>
+          (this.orientator = this.orientationUtils.createStructureOrientatorForm({
+            structureName: _structure.structureName,
+            structureMail: _structure.contactMail,
+            structurePhone: _structure.contactPhone,
+          })),
+      );
     }
+
+    // TODO: Remove ; the state mediationNumerique is never set
+    // if (history.state.mediationNumerique) {
+    //   this.currentStep = 0;
+    //   this.needType = this.needEnum.learnSkills;
+    //   this.setCurrentNeedType(NeedsType.learnSkills);
+    // }
   }
 
   ngAfterContentChecked(): void {
@@ -215,24 +217,13 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.nbSteps = enumLength / 2;
   }
 
-  public setCurrentNeedType(needType: NeedsType): void {
+  public initializeNeedType(needType: NeedsType): void {
     this.needType = needType;
-    this.validatePage(true);
-    // Init form according to needType
-    switch (needType) {
-      case NeedsType.onlineDemarch:
-        this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
-        break;
-      case NeedsType.equipmentAccess:
-      case NeedsType.equipmentBuy:
-        this.filtersForm = this.orientationUtils.createFiltersForm();
-        break;
-      case NeedsType.learnSkills:
-        this.filtersForm = this.orientationUtils.createFiltersForm();
-        this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
-        break;
-      default:
-        throw new Error(`Not implemented NeedsType in OrientationFormViewComponent ${needType}`);
+    if (this.isFilterForm()) {
+      this.filtersForm = this.orientationUtils.createFiltersForm();
+    }
+    if (this.isOnlineDemarcheOrLearnSkills()) {
+      this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
     }
   }
 
@@ -249,9 +240,9 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
    * summary. isPrevHidden flag prevents from going back in the form after validation.
    */
   public checkPrevHidden(): void {
-    const isOnlineMediationSuccess = this.currentStepIs(OnlineDemarche.onlineMediation, HotlineMediationSteps.rdvEnd);
     const isAppointmentSuccess = this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd);
-    this.isPrevHidden = this.isOnlineDemarcheOrLearnSkills() && (isOnlineMediationSuccess || isAppointmentSuccess);
+    const isOnlineMediationSuccess = this.currentStepIs(OnlineDemarche.onlineMediation, HotlineMediationSteps.rdvEnd);
+    this.isPrevHidden = this.isOnlineDemarcheOrLearnSkills() && (isAppointmentSuccess || isOnlineMediationSuccess);
   }
 
   public checkLastStep(): void {
@@ -323,42 +314,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     );
   }
 
-  public setOnlineProceduresForm(): void {
-    switch (this.onlineDemarcheForm.get('accompanimentType').value) {
-      case OnlineDemarche.structureList:
-        this.currentType = OnlineDemarche.structureList;
-        this.currentStep = StructuresListSteps.pmrAccess;
-        this.setStepNumber(Object.keys(StructuresListSteps).length);
-        this.onlineDemarcheForm = this.orientationUtils.createStructureOrientationForm(
-          this.utils.convertFiltersToModule(this.filters),
-        );
-        break;
-      case OnlineDemarche.appointment:
-        this.currentType = OnlineDemarche.appointment;
-        // Skip first screen appointment info for learnSkills
-        if (this.indicatorNeedType === NeedsType.learnSkills) {
-          this.currentStep = AppointmentSteps.infoScreen + 1;
-          this.skipStructureOrientator(true);
-        } else {
-          this.currentStep = AppointmentSteps.infoScreen;
-        }
-        this.setStepNumber(Object.keys(AppointmentSteps).length);
-        this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
-        break;
-      case OnlineDemarche.onlineMediation:
-        this.currentType = OnlineDemarche.onlineMediation;
-        this.currentStep = HotlineMediationSteps.infoScreen;
-        this.setStepNumber(Object.keys(HotlineMediationSteps).length);
-        this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
-          this.utils.convertFiltersToModule(this.filters),
-          this.orientator,
-        );
-        break;
-      default:
-        throw new Error('Not implemented value in nextPage()');
-    }
-  }
-
   private async setCategories(): Promise<void> {
     const categories = await this.searchService.getCategories().toPromise();
     categories.forEach((categ) => {
@@ -394,14 +349,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
   }
 
-  public setOnlineProcedureFilters(): void {
-    // Handle online procedures
-    const onlineProcedures: Filter[] = this.onlineDemarcheForm.value.onlineDemarcheType.map((module: Module) => {
-      return new Filter('onlineProcedures', module.id, module.displayText);
-    });
-    if (onlineProcedures.length > 0) this.filters = [...onlineProcedures, ...this.filters];
-  }
-
   public setFilters(category: string): void {
     // Handle online procedures
     this.filters = this.filtersForm.value.filters.map((module: Module) => {
@@ -412,6 +359,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   public async nextPage(): Promise<void> {
     this.isPageValid = false;
     this.hideNavButtons = false;
+
     // Handle filters form
     if (this.isFilterForm() && this.currentStepIs(GenericOrientationSteps.common, FiltersSteps.filterChoice)) {
       this.indicatorNeedType = this.needType;
@@ -428,9 +376,16 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
           // Switch to structure list form
           this.setOnlineEquipmentsForm();
           return;
+        // case NeedsType.onlineDemarch:
+        //   this.previousNeedType = NeedsType.onlineDemarch;
+        //   this.setFilters('onlineDemarch');
+        //   console.log('this.filters');
+        //   console.log(this.filters);
+        //   break;
         case NeedsType.learnSkills:
           this.previousNeedType = NeedsType.learnSkills;
           this.setFilters('baseSkills');
+          // TODO: Why this onlineDemarch here?
           this.needType = NeedsType.onlineDemarch;
           this.indicatorNeedType = NeedsType.learnSkills; // ugly but would need a big refacto to stop changing needtype to fit onlinedemarch form
           if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
@@ -443,8 +398,10 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
           break;
       }
     }
+
     // Online demarches or learn skills
-    if (this.needType === NeedsType.onlineDemarch || this.needType === NeedsType.learnSkills) {
+    if (this.isOnlineDemarcheOrLearnSkills()) {
+      // If appointment coming from the carto, we, need to patch the user / structure info + skip step where we chose to get an appointment
       if (
         this.currentStepIs(OnlineDemarche.common, OnlineDemarchesCommonSteps.accompanimentType - 1) &&
         (this.orientationService.rdvStructure || this.orientationService.rdvUser)
@@ -453,12 +410,14 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         this.currentStep++;
       }
 
+      // If we are choosing the accompaniment type (findStructure / appointment / online mediation)
       if (this.currentStepIs(OnlineDemarche.common, OnlineDemarchesCommonSteps.accompanimentType)) {
         this.setOnlineProcedureFilters();
         this.setOnlineProceduresForm();
         this.previousNeedType = this.needType;
         return;
       }
+
       // If no multiple structures, skip orientator
       if (this.currentStepIs(OnlineDemarche.onlineMediation, HotlineMediationSteps.structureOrientator - 1)) {
         this.skipStructureOrientator(true);
@@ -622,6 +581,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
           this.currentType = OnlineDemarche.common;
           this.currentStep = OnlineDemarchesCommonSteps.accompanimentType;
           this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
+          // this.needType = this.previousNeedType;
           this.previousNeedType = null;
           if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
             this.currentStep--;
@@ -671,6 +631,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     return (
       this.needType === NeedsType.equipmentAccess ||
       this.needType === NeedsType.equipmentBuy ||
+      // this.needType === NeedsType.onlineDemarch ||
       this.needType === NeedsType.learnSkills
     );
   }
@@ -772,7 +733,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   }
   public checkHideNavButtons(): void {
     if (
-      (this.needType === NeedsType.onlineDemarch || this.needType === NeedsType.learnSkills) &&
+      this.isOnlineDemarcheOrLearnSkills() &&
       this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.carto)
     ) {
       this.hideNavButtons = true;
@@ -791,4 +752,52 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   public goLogin(): void {
     this.router.navigate(['/connexion'], { queryParams: { returnUrl: '/orientation' } });
   }
+
+  /**
+   * Initialize online procedure (list of structures / appointment / online mediation)
+   */
+  public setOnlineProcedureFilters(): void {
+    // Handle online procedures
+    console.log('here');
+    const onlineProcedures: Filter[] = this.onlineDemarcheForm.value.onlineDemarcheType.map((module: Module) => {
+      return new Filter('onlineProcedures', module.id, module.displayText);
+    });
+    if (onlineProcedures.length > 0) this.filters = [...onlineProcedures, ...this.filters];
+  }
+
+  public setOnlineProceduresForm(): void {
+    switch (this.onlineDemarcheForm.get('accompanimentType').value) {
+      case OnlineDemarche.structureList:
+        this.currentType = OnlineDemarche.structureList;
+        this.currentStep = StructuresListSteps.pmrAccess;
+        this.setStepNumber(Object.keys(StructuresListSteps).length);
+        this.onlineDemarcheForm = this.orientationUtils.createStructureOrientationForm(
+          this.utils.convertFiltersToModule(this.filters),
+        );
+        break;
+      case OnlineDemarche.appointment:
+        this.currentType = OnlineDemarche.appointment;
+        // Skip first screen appointment info for learnSkills
+        if (this.indicatorNeedType === NeedsType.learnSkills) {
+          this.currentStep = AppointmentSteps.infoScreen + 1;
+          this.skipStructureOrientator(true);
+        } else {
+          this.currentStep = AppointmentSteps.infoScreen;
+        }
+        this.setStepNumber(Object.keys(AppointmentSteps).length);
+        this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
+        break;
+      case OnlineDemarche.onlineMediation:
+        this.currentType = OnlineDemarche.onlineMediation;
+        this.currentStep = HotlineMediationSteps.infoScreen;
+        this.setStepNumber(Object.keys(HotlineMediationSteps).length);
+        this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
+          this.utils.convertFiltersToModule(this.filters),
+          this.orientator,
+        );
+        break;
+      default:
+        throw new Error('Not implemented value in nextPage()');
+    }
+  }
 }
-- 
GitLab


From 601ea94fea39fa51118d757969c21317c790674e Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Fri, 9 Aug 2024 17:56:11 +0200
Subject: [PATCH 05/23] Added filtersForm in onlineDemarch

---
 .../base-skills/base-skills.component.html    | 21 +++++++---
 .../base-skills/base-skills.component.ts      | 24 ++++--------
 .../online-demarch.component.ts               | 38 ++++++++-----------
 .../onlineDemarch-form.component.html         | 12 +++---
 .../onlineDemarch-form.component.ts           | 33 ++++++----------
 .../orientation-form-view.component.html      |  2 +-
 .../orientation-form-view.component.ts        | 26 ++++++++-----
 src/app/utils/orientationUtils.ts             | 20 ++--------
 8 files changed, 78 insertions(+), 98 deletions(-)

diff --git a/src/app/form/orientation-form-view/base-skills/base-skills.component.html b/src/app/form/orientation-form-view/base-skills/base-skills.component.html
index d895a7a99..c08ed410e 100644
--- a/src/app/form/orientation-form-view/base-skills/base-skills.component.html
+++ b/src/app/form/orientation-form-view/base-skills/base-skills.component.html
@@ -1,5 +1,16 @@
-<app-base-skills-choice
-  *ngIf="currentType === GenericOrientationSteps.common"
-  [filtersForm]="filtersForm"
-  (checkValidation)="checkValidation()"
-/>
+<app-base-skills-choice [filtersForm]="filtersForm" (checkValidation)="checkValidation()" />
+<!-- <div class="orientationForm">
+  <h2>Quel est le besoin numérique de la personne&nbsp;?</h2>
+
+  <div class="tagList">
+    <app-tag-item
+      *ngFor="let module of baseSkills"
+      [label]="module.name"
+      [disabled]="module.disabled"
+      [color]="isSelectedModule(module.id) ? 'green' : 'white'"
+      [iconName]="isSelectedModule(module.id) ? 'tag-checked' : 'tag-unchecked'"
+      [clickable]="true"
+      (action)="handleClick(module)"
+    />
+  </div>
+</div> -->
diff --git a/src/app/form/orientation-form-view/base-skills/base-skills.component.ts b/src/app/form/orientation-form-view/base-skills/base-skills.component.ts
index 40f7fee64..b350270fa 100644
--- a/src/app/form/orientation-form-view/base-skills/base-skills.component.ts
+++ b/src/app/form/orientation-form-view/base-skills/base-skills.component.ts
@@ -1,9 +1,9 @@
 import { Component, EventEmitter, Input, Output } from '@angular/core';
 import { FormGroup } from '@angular/forms';
 import { OrientationUtils } from '../../../utils/orientationUtils';
-import { FiltersSteps, GenericOrientationSteps, RecapsType, StructuresListSteps } from '../enums/orientation.enums';
+import { FiltersSteps, RecapsType, StructuresListSteps } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
-import { MediationStepType, MediationType } from '../types/orientation.types';
+import { MediationStepType } from '../types/orientation.types';
 
 @Component({
   selector: 'app-base-skills',
@@ -11,7 +11,6 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
 })
 export class BaseSkillsComponent {
   @Input() currentStep: FiltersSteps | MediationStepType;
-  @Input() currentType: GenericOrientationSteps | MediationType;
   @Input() filtersForm: FormGroup<FiltersForm>;
   @Output() validatePage = new EventEmitter<any>();
 
@@ -22,20 +21,13 @@ export class BaseSkillsComponent {
   public StructuresListSteps = StructuresListSteps;
   public FiltersSteps = FiltersSteps;
   public RecapsType = RecapsType;
-  public GenericOrientationSteps = GenericOrientationSteps;
 
   public checkValidation(): void {
-    switch (this.currentType) {
-      case GenericOrientationSteps.common:
-        this.orientationUtils.setValidationsEquipmentForm(
-          this.pagesValidation,
-          this.filtersForm,
-          (isValid) => this.validatePage.emit(isValid),
-          this.currentStep as FiltersSteps,
-        );
-        break;
-      default:
-        throw new Error('Not implemented tunnel type in BaseSkillsComponent');
-    }
+    this.orientationUtils.setValidationsEquipmentForm(
+      this.pagesValidation,
+      this.filtersForm,
+      (isValid) => this.validatePage.emit(isValid),
+      this.currentStep as FiltersSteps,
+    );
   }
 }
diff --git a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/online-demarch.component.ts b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/online-demarch.component.ts
index 343423694..8ff38b3e7 100644
--- a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/online-demarch.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/online-demarch.component.ts
@@ -1,5 +1,5 @@
 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import { UntypedFormGroup } from '@angular/forms';
+import { FormGroup, UntypedFormGroup } from '@angular/forms';
 import { CategoryEnum } from 'src/app/shared/enum/category.enum';
 import { OrientationService } from '../../../../services/orientation.service';
 import { PersonalOfferService } from '../../../../services/personal-offer.service';
@@ -8,29 +8,34 @@ import { Category } from '../../../../structure-list/models/category.model';
 import { Module } from '../../../../structure-list/models/module.model';
 import { SearchService } from '../../../../structure-list/services/search.service';
 import { OrientationUtils } from '../../../../utils/orientationUtils';
+import { SelectComponent } from '../../global-components/select/select.component';
+import { FiltersForm } from '../../interfaces/filtersForm.interface';
 
 @Component({
   selector: 'app-online-demarch',
   templateUrl: './online-demarch.component.html',
 })
-export class OnlineDemarchComponent implements OnInit {
+export class OnlineDemarchComponent extends SelectComponent implements OnInit {
   @Input() form: UntypedFormGroup;
+  @Input() filtersForm: FormGroup<FiltersForm>;
   @Output() checkValidation = new EventEmitter<any>();
 
+  public orientationUtils = new OrientationUtils();
+  public accompanimentType: Module[];
+  public selectedModules: Module[] = [];
+  public showStrangersModal = false;
+
   constructor(
     private searchService: SearchService,
     public structureService: StructureService,
     public orientationService: OrientationService,
     public personalOfferService: PersonalOfferService,
-  ) {}
-  public orientationUtils = new OrientationUtils();
-  public accompanimentType: Module[];
-  public selectedModules: Module[] = [];
-  public showStrangersModal = false;
+  ) {
+    super();
+  }
 
   ngOnInit(): void {
-    this.selectedModules = this.form.get('onlineDemarcheType').value;
-    // TODO move this in form init categories
+    this.selectedModules = this.filtersForm.get('filters').value;
     this.searchService.getCategories().subscribe(async (categories: Category[]) => {
       this.accompanimentType = categories.find((el) => el.id === CategoryEnum.onlineProcedures).modules;
 
@@ -48,23 +53,12 @@ export class OnlineDemarchComponent implements OnInit {
   }
 
   public handleClick(module: Module): void {
-    if (module.id === 'foreigners' && !this.isSelectedModule(module.id)) {
+    if (module.id === 'foreigners' && !super.isSelectedModule(module.id)) {
       this.showStrangersModal = true;
     }
-    if (this.isSelectedModule(module.id)) {
-      const index = this.selectedModules.findIndex((_module) => _module.id === module.id);
-      this.selectedModules.splice(index, 1);
-    } else {
-      this.selectedModules.push(module);
-    }
-    this.form.get('onlineDemarcheType').patchValue(this.selectedModules);
-    this.checkValidation.emit();
+    super.handleClick(module);
   }
 
-  public isSelectedModule(moduleId: string): boolean {
-    if (this.selectedModules?.map((module) => module.id).includes(moduleId)) return true;
-    return false;
-  }
   public handleClose(): void {
     this.showStrangersModal = false;
   }
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
index 2d51b8e48..55f4a40cd 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
@@ -3,20 +3,20 @@
   <app-online-demarch
     *ngIf="needType === NeedsType.onlineDemarch && currentStep === OnlineDemarchesCommonSteps.onlineDemarche"
     [form]="form"
-    (checkValidation)="checkValidation()"
-  />
-  <app-accompaniment-type
-    *ngIf="currentStep === OnlineDemarchesCommonSteps.accompanimentType"
-    [form]="form"
+    [filtersForm]="filtersForm"
     (checkValidation)="checkValidation()"
   />
   <app-base-skills
     *ngIf="needType === NeedsType.learnSkills && currentStep === OnlineDemarchesCommonSteps.onlineDemarche"
     [currentStep]="currentStep"
-    [currentType]="currentType"
     [filtersForm]="filtersForm"
     (validatePage)="checkValidation()"
   />
+  <app-accompaniment-type
+    *ngIf="currentStep === OnlineDemarchesCommonSteps.accompanimentType"
+    [form]="form"
+    (checkValidation)="checkValidation()"
+  />
 </ng-container>
 <!-- APPOINTMENT FORM -->
 <ng-container *ngIf="currentType === OnlineDemarche.appointment">
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
index 14f707988..84d0889b6 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
@@ -55,12 +55,13 @@ export class OnlineDemarchFormComponent {
 
   public checkValidation(event?: any): void {
     switch (this.currentType) {
-      case OnlineDemarche.onlineMediation:
-        this.orientationUtils.setValidationsOnlineMediationForm(
+      case OnlineDemarche.common:
+        this.orientationUtils.setValidationsOnlineDemarchesForm(
           this.pagesValidation,
+          this.filtersForm,
           this.form,
           (isValid) => this.validatePage.emit(isValid),
-          this.currentStep as HotlineMediationSteps,
+          this.currentStep as OnlineDemarchesCommonSteps,
         );
         break;
       case OnlineDemarche.structureList:
@@ -71,24 +72,6 @@ export class OnlineDemarchFormComponent {
           this.currentStep as StructuresListSteps,
         );
         break;
-      case OnlineDemarche.common:
-        if (this.needType === NeedsType.learnSkills) {
-          this.orientationUtils.setValidationsLearnSkillsForm(
-            this.pagesValidation,
-            this.filtersForm,
-            this.form,
-            (isValid) => this.validatePage.emit(isValid),
-            this.currentStep as OnlineDemarchesCommonSteps,
-          );
-        } else {
-          this.orientationUtils.setValidationsOnlineDemarchesForm(
-            this.pagesValidation,
-            this.form,
-            (isValid) => this.validatePage.emit(isValid),
-            this.currentStep as OnlineDemarchesCommonSteps,
-          );
-        }
-        break;
       case OnlineDemarche.appointment:
         if (this.currentStep === AppointmentSteps.carto - 1) {
           // if rdv from structure details, don't reinit the structureRDV variable
@@ -106,6 +89,14 @@ export class OnlineDemarchFormComponent {
           this.currentStep as AppointmentSteps,
         );
         break;
+      case OnlineDemarche.onlineMediation:
+        this.orientationUtils.setValidationsOnlineMediationForm(
+          this.pagesValidation,
+          this.form,
+          (isValid) => this.validatePage.emit(isValid),
+          this.currentStep as HotlineMediationSteps,
+        );
+        break;
       default:
         throw new Error('Not implemented tunnel type in OnlineDemarchFormComponent');
     }
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html
index 2e6ff36f9..07453c542 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.html
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.html
@@ -33,7 +33,7 @@
         (validatePage)="validatePage($event)"
       />
       <app-online-demarch-form
-        *ngIf="needType === needEnum.onlineDemarch || needType === needEnum.learnSkills"
+        *ngIf="isOnlineDemarcheOrLearnSkills()"
         [needType]="needType"
         [currentStep]="currentStep"
         [currentType]="currentType"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index ad8230c2b..868154c91 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -231,7 +231,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     return this.currentType === orientationType && this.currentStep === orientationStep;
   }
 
-  private isOnlineDemarcheOrLearnSkills(): boolean {
+  public isOnlineDemarcheOrLearnSkills(): boolean {
     return this.needType === NeedsType.onlineDemarch || this.needType === NeedsType.learnSkills;
   }
 
@@ -376,17 +376,23 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
           // Switch to structure list form
           this.setOnlineEquipmentsForm();
           return;
-        // case NeedsType.onlineDemarch:
-        //   this.previousNeedType = NeedsType.onlineDemarch;
-        //   this.setFilters('onlineDemarch');
-        //   console.log('this.filters');
-        //   console.log(this.filters);
-        //   break;
+        case NeedsType.onlineDemarch:
+          this.previousNeedType = NeedsType.onlineDemarch;
+          this.setFilters('onlineDemarch');
+          this.needType = NeedsType.onlineDemarch;
+          this.indicatorNeedType = NeedsType.onlineDemarch; // ugly but would need a big refacto to stop changing needtype to fit onlinedemarch form
+          if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
+            // if rdv from structure details or user, continue function below to skip accompanimentType and init onlineDemarcheForm
+            this.currentStep = OnlineDemarchesCommonSteps.accompanimentType - 1;
+          } else {
+            this.currentStep = OnlineDemarchesCommonSteps.accompanimentType;
+            return;
+          }
+          break;
         case NeedsType.learnSkills:
           this.previousNeedType = NeedsType.learnSkills;
           this.setFilters('baseSkills');
-          // TODO: Why this onlineDemarch here?
-          this.needType = NeedsType.onlineDemarch;
+          this.needType = NeedsType.learnSkills;
           this.indicatorNeedType = NeedsType.learnSkills; // ugly but would need a big refacto to stop changing needtype to fit onlinedemarch form
           if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
             // if rdv from structure details or user, continue function below to skip accompanimentType and init onlineDemarcheForm
@@ -631,7 +637,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     return (
       this.needType === NeedsType.equipmentAccess ||
       this.needType === NeedsType.equipmentBuy ||
-      // this.needType === NeedsType.onlineDemarch ||
+      this.needType === NeedsType.onlineDemarch ||
       this.needType === NeedsType.learnSkills
     );
   }
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index 5e4b435c0..2729bc735 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -126,32 +126,18 @@ export class OrientationUtils {
     });
   }
 
-  public setValidationsLearnSkillsForm(
-    pagesValidation: any[],
-    filterForm: FormGroup<FiltersForm>,
-    form: UntypedFormGroup,
-    updatePageValid: (isValid: boolean) => void,
-    step: OnlineDemarchesCommonSteps,
-  ): void {
-    pagesValidation[OnlineDemarchesCommonSteps.onlineDemarche] = {
-      valid: filterForm.get('filters').value.length > 0,
-    };
-    pagesValidation[OnlineDemarchesCommonSteps.accompanimentType] = {
-      valid: form.get('accompanimentType')?.value !== null,
-    };
-    updatePageValid(pagesValidation[step].valid);
-  }
   public setValidationsOnlineDemarchesForm(
     pagesValidation: any[],
+    filtersForm: FormGroup<FiltersForm>,
     form: UntypedFormGroup,
     updatePageValid: (isValid: boolean) => void,
     step: OnlineDemarchesCommonSteps,
   ): void {
     pagesValidation[OnlineDemarchesCommonSteps.onlineDemarche] = {
-      valid: form.get('onlineDemarcheType').value.length > 0,
+      valid: filtersForm.get('filters').value.length > 0,
     };
     pagesValidation[OnlineDemarchesCommonSteps.accompanimentType] = {
-      valid: form.get('accompanimentType').value !== null,
+      valid: form.get('accompanimentType')?.value !== null,
     };
     updatePageValid(pagesValidation[step].valid);
   }
-- 
GitLab


From 314eb91623e36caa4f90dbe883effd05ebcc97f1 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Fri, 9 Aug 2024 18:12:27 +0200
Subject: [PATCH 06/23] removed isFilterForm, they all are now

---
 .../orientation-form-view.component.ts         | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index 868154c91..d7a399cc0 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -160,6 +160,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     private router: Router,
   ) {
     this.setCategories();
+    this.filtersForm = this.orientationUtils.createFiltersForm();
   }
 
   async ngOnInit(): Promise<void> {
@@ -219,9 +220,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
   public initializeNeedType(needType: NeedsType): void {
     this.needType = needType;
-    if (this.isFilterForm()) {
-      this.filtersForm = this.orientationUtils.createFiltersForm();
-    }
     if (this.isOnlineDemarcheOrLearnSkills()) {
       this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
     }
@@ -361,7 +359,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.hideNavButtons = false;
 
     // Handle filters form
-    if (this.isFilterForm() && this.currentStepIs(GenericOrientationSteps.common, FiltersSteps.filterChoice)) {
+    if (this.currentStepIs(GenericOrientationSteps.common, FiltersSteps.filterChoice)) {
       this.indicatorNeedType = this.needType;
       switch (this.needType) {
         case NeedsType.equipmentAccess:
@@ -630,18 +628,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.filters = [];
   }
 
-  /**
-   * Return if it's a filter form
-   */
-  private isFilterForm(): boolean {
-    return (
-      this.needType === NeedsType.equipmentAccess ||
-      this.needType === NeedsType.equipmentBuy ||
-      this.needType === NeedsType.onlineDemarch ||
-      this.needType === NeedsType.learnSkills
-    );
-  }
-
   public canExit(): Promise<boolean> {
     // Avoid confirmation when user submit form and leave.
     if (this.canDeactivate || this.currentStep === null) {
-- 
GitLab


From cc0910bf329dc89663dab00f54ac07b0adff7b3b Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Mon, 12 Aug 2024 16:28:02 +0200
Subject: [PATCH 07/23] fixed goBack, but filters have an issue now

---
 .../orientation-form-view.component.ts        | 84 ++++++-------------
 1 file changed, 26 insertions(+), 58 deletions(-)

diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index d7a399cc0..0a495b9e7 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -70,7 +70,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   public formType = formType;
   // Global
   public needType: NeedsType;
-  public indicatorNeedType: NeedsType;
   public previousNeedType: NeedsType;
   public currentType: MediationType = OnlineDemarche.common;
   public currentStep: MediationStepType = null;
@@ -160,7 +159,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     private router: Router,
   ) {
     this.setCategories();
-    this.filtersForm = this.orientationUtils.createFiltersForm();
   }
 
   async ngOnInit(): Promise<void> {
@@ -193,12 +191,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       );
     }
 
-    // TODO: Remove ; the state mediationNumerique is never set
-    // if (history.state.mediationNumerique) {
-    //   this.currentStep = 0;
-    //   this.needType = this.needEnum.learnSkills;
-    //   this.setCurrentNeedType(NeedsType.learnSkills);
-    // }
+    this.filtersForm = this.orientationUtils.createFiltersForm();
   }
 
   ngAfterContentChecked(): void {
@@ -360,7 +353,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     // Handle filters form
     if (this.currentStepIs(GenericOrientationSteps.common, FiltersSteps.filterChoice)) {
-      this.indicatorNeedType = this.needType;
       switch (this.needType) {
         case NeedsType.equipmentAccess:
           this.previousNeedType = NeedsType.equipmentAccess;
@@ -377,29 +369,10 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         case NeedsType.onlineDemarch:
           this.previousNeedType = NeedsType.onlineDemarch;
           this.setFilters('onlineDemarch');
-          this.needType = NeedsType.onlineDemarch;
-          this.indicatorNeedType = NeedsType.onlineDemarch; // ugly but would need a big refacto to stop changing needtype to fit onlinedemarch form
-          if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
-            // if rdv from structure details or user, continue function below to skip accompanimentType and init onlineDemarcheForm
-            this.currentStep = OnlineDemarchesCommonSteps.accompanimentType - 1;
-          } else {
-            this.currentStep = OnlineDemarchesCommonSteps.accompanimentType;
-            return;
-          }
           break;
         case NeedsType.learnSkills:
           this.previousNeedType = NeedsType.learnSkills;
           this.setFilters('baseSkills');
-          this.needType = NeedsType.learnSkills;
-          this.indicatorNeedType = NeedsType.learnSkills; // ugly but would need a big refacto to stop changing needtype to fit onlinedemarch form
-          if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
-            // if rdv from structure details or user, continue function below to skip accompanimentType and init onlineDemarcheForm
-            this.currentStep = OnlineDemarchesCommonSteps.accompanimentType - 1;
-          } else {
-            this.currentStep = OnlineDemarchesCommonSteps.accompanimentType;
-            return;
-          }
-          break;
       }
     }
 
@@ -533,7 +506,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   }
 
   public prevPage(): void {
-    this.hideNavButtons = false;
     // Structure list previous page
     if (this.currentType === OnlineDemarche.structureList) {
       if (this.currentStep === StructuresListSteps.structureChoice) {
@@ -555,7 +527,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       ) {
         this.currentStep--;
       }
-      if (this.indicatorNeedType === NeedsType.learnSkills && this.currentStep === AppointmentSteps.infoScreen + 1) {
+      if (this.needType === NeedsType.learnSkills && this.currentStep === AppointmentSteps.infoScreen + 1) {
         this.currentStep--;
       }
       if (this.currentStep === AppointmentSteps.carto) {
@@ -579,35 +551,31 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     // Default case for first form step. If there was a previous form (like filterForm) we go back to this form
     if (this.currentStep === 0) {
-      switch (this.previousNeedType) {
-        case NeedsType.learnSkills:
-        case NeedsType.onlineDemarch:
-          this.currentType = OnlineDemarche.common;
-          this.currentStep = OnlineDemarchesCommonSteps.accompanimentType;
-          this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
-          // this.needType = this.previousNeedType;
-          this.previousNeedType = null;
-          if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
-            this.currentStep--;
-          }
-          return;
-        case NeedsType.equipmentAccess:
-        case NeedsType.equipmentBuy:
-          this.needType = this.previousNeedType;
-          this.currentType = OnlineDemarche.common;
-          this.currentStep = OnlineDemarchesCommonSteps.accompanimentType;
-          this.previousNeedType = null;
-          break;
-        default:
-          // Last step, reset all
-          this.reset();
-          return;
+      // If back to beginning of the form, reset
+      if (this.currentType === OnlineDemarche.common || !this.previousNeedType) {
+        this.reset();
+        return;
+      }
+
+      // Else, we are in middle of form, going back to choice of accompaniment type
+      this.needType = this.previousNeedType;
+      this.previousNeedType = null;
+      this.currentType = OnlineDemarche.common;
+      this.currentStep = OnlineDemarchesCommonSteps.accompanimentType;
+      if (this.isOnlineDemarcheOrLearnSkills()) {
+        this.filtersForm = this.orientationUtils.createFiltersForm();
+        this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
+        if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
+          this.currentStep--;
+        }
+        return;
       }
-      // return;
-      // handle the form start
     }
+
+    // Go back routine
     if (this.currentStep > 0) {
       this.currentStep--;
+      this.hideNavButtons = false;
       this.checkPrevHidden();
       this.checkLastStep();
       this.checkHideNavButtons();
@@ -617,7 +585,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   public reset(): void {
     this.onlineDemarcheForm = undefined;
     this.onlineDemarcheType = undefined;
-    this.filtersForm = undefined;
+    this.filtersForm = this.orientationUtils.createFiltersForm();
     this.currentStep = null;
     this.currentType = OnlineDemarche.common;
     this.isLastStep = false;
@@ -682,7 +650,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
   private orientationType(filters: Filter[]): OrientationIndicatorType {
     const orientationType: OrientationIndicatorType = {
-      typeOrientation: this.displayTextNeedType(this.indicatorNeedType ?? this.needType),
+      typeOrientation: this.displayTextNeedType(this.needType),
       filtres: [],
       typeAccompagnement: this.currentType,
     };
@@ -770,7 +738,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       case OnlineDemarche.appointment:
         this.currentType = OnlineDemarche.appointment;
         // Skip first screen appointment info for learnSkills
-        if (this.indicatorNeedType === NeedsType.learnSkills) {
+        if (this.needType === NeedsType.learnSkills) {
           this.currentStep = AppointmentSteps.infoScreen + 1;
           this.skipStructureOrientator(true);
         } else {
-- 
GitLab


From e3bea2dff9223505f5cf7b6d81a47f9d950cb739 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Mon, 12 Aug 2024 17:09:36 +0200
Subject: [PATCH 08/23] renamed navButtons + fixed filter issue

---
 .../navigation/navigation.component.ts        |  4 +--
 .../orientation-form-view.component.html      |  2 +-
 .../orientation-form-view.component.ts        | 35 +++++++------------
 src/app/services/structure.service.ts         |  6 ++--
 4 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
index 232206597..a4492e1be 100644
--- a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
+++ b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
@@ -15,8 +15,8 @@ export class NavigationComponent {
   @Input() isPageValid: boolean;
   @Input() needType: NeedsType;
   @Input() isPrevHidden = false;
+  @Input() isNextHidden = false;
   @Input() isLastStep = false;
-  @Input() hideNavButtons = false;
   @Input() failedOrientation = false;
 
   @Output() goNext = new EventEmitter<boolean>();
@@ -34,7 +34,7 @@ export class NavigationComponent {
     return this.currentStep !== null && !(this.isPrevHidden || this.isLastStep);
   }
   public showNextButton(): boolean {
-    return !this.hideNavButtons;
+    return !this.isNextHidden;
   }
 
   public nextPage(isPrint?: boolean): void {
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html
index 07453c542..d0ea9ccb7 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.html
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.html
@@ -52,11 +52,11 @@
   <app-navigation
     [currentStep]="currentStep"
     [isPrevHidden]="isPrevHidden"
+    [isNextHidden]="isNextHidden"
     [isLastStep]="isLastStep"
     [needType]="needType"
     [currentType]="currentType"
     [isPageValid]="isPageValid"
-    [hideNavButtons]="hideNavButtons"
     [failedOrientation]="failedOrientation"
     (goNext)="nextPage()"
     (goPrev)="prevPage()"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index 0a495b9e7..65a42accb 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -74,8 +74,8 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   public currentType: MediationType = OnlineDemarche.common;
   public currentStep: MediationStepType = null;
   public isPrevHidden = false;
+  public isNextHidden = false;
   public isLastStep = false;
-  public hideNavButtons = false;
   public nbSteps = OrientationFormViewComponent.MAX_STEP;
   public isPageValid = false;
   public filters: Filter[] = [];
@@ -226,14 +226,15 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     return this.needType === NeedsType.onlineDemarch || this.needType === NeedsType.learnSkills;
   }
 
-  /**
-   * In online procedures (online mediation and appointment), a request is sent to the server before the orientation
-   * summary. isPrevHidden flag prevents from going back in the form after validation.
-   */
-  public checkPrevHidden(): void {
+  private checkHiddenNavButtons(): void {
+    // Only needs to hide in appointment / online mediation
+    if (!this.isOnlineDemarcheOrLearnSkills()) return;
+
+    const isCartoStep = this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd);
     const isAppointmentSuccess = this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd);
     const isOnlineMediationSuccess = this.currentStepIs(OnlineDemarche.onlineMediation, HotlineMediationSteps.rdvEnd);
-    this.isPrevHidden = this.isOnlineDemarcheOrLearnSkills() && (isAppointmentSuccess || isOnlineMediationSuccess);
+    this.isPrevHidden = isAppointmentSuccess || isOnlineMediationSuccess;
+    this.isNextHidden = isCartoStep;
   }
 
   public checkLastStep(): void {
@@ -349,7 +350,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
   public async nextPage(): Promise<void> {
     this.isPageValid = false;
-    this.hideNavButtons = false;
+    this.isNextHidden = false;
 
     // Handle filters form
     if (this.currentStepIs(GenericOrientationSteps.common, FiltersSteps.filterChoice)) {
@@ -368,7 +369,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
           return;
         case NeedsType.onlineDemarch:
           this.previousNeedType = NeedsType.onlineDemarch;
-          this.setFilters('onlineDemarch');
+          this.setFilters('onlineProcedures');
           break;
         case NeedsType.learnSkills:
           this.previousNeedType = NeedsType.learnSkills;
@@ -499,9 +500,8 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
     if (this.currentStep < this.nbSteps) {
       this.currentStep++;
-      this.checkPrevHidden();
+      this.checkHiddenNavButtons();
       this.checkLastStep();
-      this.checkHideNavButtons();
     }
   }
 
@@ -575,10 +575,9 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     // Go back routine
     if (this.currentStep > 0) {
       this.currentStep--;
-      this.hideNavButtons = false;
-      this.checkPrevHidden();
+      this.isNextHidden = false;
+      this.checkHiddenNavButtons();
       this.checkLastStep();
-      this.checkHideNavButtons();
     }
   }
 
@@ -691,14 +690,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     this.indicatorService.createOrientationIndicator(orientationIndicator).subscribe();
   }
-  public checkHideNavButtons(): void {
-    if (
-      this.isOnlineDemarcheOrLearnSkills() &&
-      this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.carto)
-    ) {
-      this.hideNavButtons = true;
-    }
-  }
   public setFailedOrientation(): void {
     this.failedOrientation = true;
   }
diff --git a/src/app/services/structure.service.ts b/src/app/services/structure.service.ts
index 848b1e654..acd3e5a6d 100644
--- a/src/app/services/structure.service.ts
+++ b/src/app/services/structure.service.ts
@@ -84,10 +84,10 @@ export class StructureService {
       const filterPMR = filters.find((filter) => filter.text === 'Accessible PMR');
       if (filterPMR) filterPMR.name = 'pmrAccess';
 
-      const andFormatedFilters = this.formatFilters(filters.filter((e) => !e.orOperator));
-      const orFormatedFilters = this.formatFilters(filters.filter((e) => e.orOperator));
+      const andFormattedFilters = this.formatFilters(filters.filter((e) => !e.orOperator));
+      const orFormattedFilters = this.formatFilters(filters.filter((e) => e.orOperator));
       requestFilters = {
-        filters: [andFormatedFilters, orFormatedFilters],
+        filters: [andFormattedFilters, orFormattedFilters],
         onlyOffersWithAppointment,
         limit,
       };
-- 
GitLab


From 193675e3559cab4334e65243c85258a60e02d28d Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Mon, 12 Aug 2024 17:30:15 +0200
Subject: [PATCH 09/23] simplified initialization

---
 .../needs-selection.component.html              |  2 +-
 .../needs-selection.component.ts                |  6 +++---
 .../orientation-form-view.component.html        |  7 +------
 .../orientation-form-view.component.ts          | 17 ++++++++---------
 4 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html
index 1b01c2213..3139ed09a 100644
--- a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html
+++ b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.html
@@ -10,7 +10,7 @@
       [label]="option.title"
       [description]="option.hint"
       [iconName]="option.icon"
-      [selected]="currentNeed === option.key"
+      [selected]="needType === option.key"
       (click)="selectNeed(option.key)"
     />
   </div>
diff --git a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
index d3ac80aeb..2aa52d739 100644
--- a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
+++ b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
@@ -11,8 +11,8 @@ import { NeedsType } from '../../enums/orientation.enums';
   templateUrl: './needs-selection.component.html',
 })
 export class NeedsSelectionComponent implements OnInit {
-  @Input() currentNeed: NeedsType;
-  @Output() setNeedType = new EventEmitter<any>();
+  @Input() needType: NeedsType;
+  @Output() needTypeChange = new EventEmitter<NeedsType>();
   @Output() validate = new EventEmitter<any>();
 
   public needsList: INeedItem[] = [
@@ -73,7 +73,7 @@ export class NeedsSelectionComponent implements OnInit {
   }
 
   public selectNeed(event: string): void {
-    this.setNeedType.emit(event);
+    this.needTypeChange.emit(event as NeedsType);
     this.validate.emit();
   }
 }
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html
index d0ea9ccb7..a256a0f1b 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.html
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.html
@@ -5,12 +5,7 @@
   </div>
   <app-progress-bar [currentPage]="currentStep" [nbSteps]="nbSteps" [formType]="formType.orientation" />
   <div class="container" [ngClass]="{ 'no-max-width': fullScreen }">
-    <app-needs-selection
-      *ngIf="currentStep === null"
-      [currentNeed]="needType"
-      (setNeedType)="initializeNeedType($event)"
-      (validate)="validatePage(true)"
-    />
+    <app-needs-selection *ngIf="currentStep === null" [(needType)]="needType" (validate)="validatePage(true)" />
     <ng-container *ngIf="currentStep !== null">
       <app-equipment-access
         *ngIf="needType === needEnum.equipmentAccess"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index 65a42accb..d867fa2fb 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -190,8 +190,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
           })),
       );
     }
-
-    this.filtersForm = this.orientationUtils.createFiltersForm();
   }
 
   ngAfterContentChecked(): void {
@@ -200,6 +198,14 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
   public validatePage(event: boolean): void {
     this.isPageValid = event;
+
+    // If first step, perform some initialization
+    if (this.currentStep === null) {
+      this.filtersForm = this.orientationUtils.createFiltersForm();
+      if (this.isOnlineDemarcheOrLearnSkills()) {
+        this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
+      }
+    }
   }
 
   public validateStructureRDV(event: Structure): void {
@@ -211,13 +217,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.nbSteps = enumLength / 2;
   }
 
-  public initializeNeedType(needType: NeedsType): void {
-    this.needType = needType;
-    if (this.isOnlineDemarcheOrLearnSkills()) {
-      this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
-    }
-  }
-
   private currentStepIs(orientationType: MediationType, orientationStep: MediationStepType): boolean {
     return this.currentType === orientationType && this.currentStep === orientationStep;
   }
-- 
GitLab


From d68825669a12692a1095da28d02a3c8d6403dc81 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Tue, 13 Aug 2024 13:15:12 +0200
Subject: [PATCH 10/23] Renamed learnSkills to baseSkills + removed base skills
 choice

---
 .../base-skills-choice.component.html         | 15 -------
 .../base-skills-choice.component.ts           | 43 ------------------
 .../base-skills/base-skills.component.html    |  7 ++-
 .../base-skills/base-skills.component.ts      | 45 +++++++++++--------
 .../enums/orientation.enums.ts                |  2 +-
 .../needs-selection.component.ts              |  4 +-
 .../select/select.component.ts                |  2 +-
 .../accompaniment-type.component.ts           |  2 +-
 .../online-demarch.component.ts               |  2 +-
 .../onlineDemarch-form.component.html         |  5 +--
 .../orientation-form-view.component.html      |  2 +-
 .../orientation-form-view.component.ts        | 32 ++++++-------
 .../orientation.module.ts                     |  2 -
 src/app/utils/orientationUtils.ts             |  4 +-
 14 files changed, 58 insertions(+), 109 deletions(-)
 delete mode 100644 src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.html
 delete mode 100644 src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.ts

diff --git a/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.html b/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.html
deleted file mode 100644
index cef06288d..000000000
--- a/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<div class="orientationForm">
-  <h2>Quel est le besoin numérique de la personne&nbsp;?</h2>
-
-  <div class="tagList">
-    <app-tag-item
-      *ngFor="let module of baseSkills"
-      [label]="module.name"
-      [disabled]="module.disabled"
-      [color]="isSelectedModule(module.id) ? 'green' : 'white'"
-      [iconName]="isSelectedModule(module.id) ? 'tag-checked' : 'tag-unchecked'"
-      [clickable]="true"
-      (action)="handleClick(module)"
-    />
-  </div>
-</div>
diff --git a/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.ts b/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.ts
deleted file mode 100644
index 4efb4ea7e..000000000
--- a/src/app/form/orientation-form-view/base-skills/base-skills-choice/base-skills-choice.component.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import { Component, Input, OnInit } from '@angular/core';
-import { FormGroup } from '@angular/forms';
-import { OrientationService } from '../../../../services/orientation.service';
-import { PersonalOfferService } from '../../../../services/personal-offer.service';
-import { CategoryEnum } from '../../../../shared/enum/category.enum';
-import { Category } from '../../../../structure-list/models/category.model';
-import { Module } from '../../../../structure-list/models/module.model';
-import { SearchService } from '../../../../structure-list/services/search.service';
-import { OrientationUtils } from '../../../../utils/orientationUtils';
-import { SelectComponent } from '../../global-components/select/select.component';
-import { FiltersForm } from '../../interfaces/filtersForm.interface';
-
-@Component({
-  selector: 'app-base-skills-choice',
-  templateUrl: './base-skills-choice.component.html',
-})
-export class BaseSkillsChoiceComponent extends SelectComponent implements OnInit {
-  @Input() filtersForm: FormGroup<FiltersForm>;
-  public orientationUtils = new OrientationUtils();
-  public baseSkills: Module[] = [];
-
-  constructor(
-    private searchService: SearchService,
-    public orientationService: OrientationService,
-    public personalOfferService: PersonalOfferService,
-  ) {
-    super();
-  }
-
-  ngOnInit(): void {
-    this.selectedModules = this.filtersForm.get('filters').value;
-    this.searchService.getCategories().subscribe(async (categories: Category[]) => {
-      this.baseSkills = categories.find((el) => el.id === CategoryEnum.baseSkills).modules;
-
-      // For rdv from structure or annuaire, disable items which are not offered
-      if (this.orientationService.rdvUser || this.orientationService.rdvStructure) {
-        await this.orientationUtils.rdvDisableItemsNotOffered(this.baseSkills, this.orientationService, 'baseSkills');
-      }
-    });
-
-    this.checkValidation.emit();
-  }
-}
diff --git a/src/app/form/orientation-form-view/base-skills/base-skills.component.html b/src/app/form/orientation-form-view/base-skills/base-skills.component.html
index c08ed410e..497d1e252 100644
--- a/src/app/form/orientation-form-view/base-skills/base-skills.component.html
+++ b/src/app/form/orientation-form-view/base-skills/base-skills.component.html
@@ -1,5 +1,4 @@
-<app-base-skills-choice [filtersForm]="filtersForm" (checkValidation)="checkValidation()" />
-<!-- <div class="orientationForm">
+<div class="orientationForm">
   <h2>Quel est le besoin numérique de la personne&nbsp;?</h2>
 
   <div class="tagList">
@@ -9,8 +8,8 @@
       [disabled]="module.disabled"
       [color]="isSelectedModule(module.id) ? 'green' : 'white'"
       [iconName]="isSelectedModule(module.id) ? 'tag-checked' : 'tag-unchecked'"
-      [clickable]="true"
+      [clickable]="!module.disabled"
       (action)="handleClick(module)"
     />
   </div>
-</div> -->
+</div>
diff --git a/src/app/form/orientation-form-view/base-skills/base-skills.component.ts b/src/app/form/orientation-form-view/base-skills/base-skills.component.ts
index b350270fa..4a0705413 100644
--- a/src/app/form/orientation-form-view/base-skills/base-skills.component.ts
+++ b/src/app/form/orientation-form-view/base-skills/base-skills.component.ts
@@ -1,33 +1,42 @@
-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
 import { FormGroup } from '@angular/forms';
+import { OrientationService } from '../../../services/orientation.service';
+import { CategoryEnum } from '../../../shared/enum/category.enum';
+import { Category } from '../../../structure-list/models/category.model';
+import { Module } from '../../../structure-list/models/module.model';
+import { SearchService } from '../../../structure-list/services/search.service';
 import { OrientationUtils } from '../../../utils/orientationUtils';
-import { FiltersSteps, RecapsType, StructuresListSteps } from '../enums/orientation.enums';
+import { SelectComponent } from '../global-components/select/select.component';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
-import { MediationStepType } from '../types/orientation.types';
 
 @Component({
   selector: 'app-base-skills',
   templateUrl: './base-skills.component.html',
 })
-export class BaseSkillsComponent {
-  @Input() currentStep: FiltersSteps | MediationStepType;
+export class BaseSkillsComponent extends SelectComponent implements OnInit {
   @Input() filtersForm: FormGroup<FiltersForm>;
-  @Output() validatePage = new EventEmitter<any>();
 
   public orientationUtils = new OrientationUtils();
-  public pagesValidation: any[] = [];
+  public baseSkills: Module[] = [];
 
-  // Enums
-  public StructuresListSteps = StructuresListSteps;
-  public FiltersSteps = FiltersSteps;
-  public RecapsType = RecapsType;
+  constructor(
+    private searchService: SearchService,
+    public orientationService: OrientationService,
+  ) {
+    super();
+  }
+
+  ngOnInit(): void {
+    this.selectedModules = this.filtersForm.get('filters').value;
+    this.searchService.getCategories().subscribe(async (categories: Category[]) => {
+      this.baseSkills = categories.find((el) => el.id === CategoryEnum.baseSkills).modules;
+
+      // For rdv from structure or annuaire, disable items which are not offered
+      if (this.orientationService.rdvUser || this.orientationService.rdvStructure) {
+        await this.orientationUtils.rdvDisableItemsNotOffered(this.baseSkills, this.orientationService, 'baseSkills');
+      }
+    });
 
-  public checkValidation(): void {
-    this.orientationUtils.setValidationsEquipmentForm(
-      this.pagesValidation,
-      this.filtersForm,
-      (isValid) => this.validatePage.emit(isValid),
-      this.currentStep as FiltersSteps,
-    );
+    this.checkValidation.emit();
   }
 }
diff --git a/src/app/form/orientation-form-view/enums/orientation.enums.ts b/src/app/form/orientation-form-view/enums/orientation.enums.ts
index f6f0eced3..c3f9b138b 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -48,7 +48,7 @@ export enum NeedsType {
   equipmentAccess = 'equipmentAccess',
   equipmentBuy = 'equipmentBuy',
   onlineDemarch = 'onlineDemarch',
-  learnSkills = 'learnSkills',
+  baseSkills = 'baseSkills',
 }
 export enum PreferredLanguages {
   french = 'Français',
diff --git a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
index 2aa52d739..c7a3cf7b5 100644
--- a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
+++ b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
@@ -37,7 +37,7 @@ export class NeedsSelectionComponent implements OnInit {
     {
       title: 'Acquérir les compétences numériques de base',
       hint: '(Ordinateur et smartphone, mails, réseaux sociaux et bureautique...)',
-      key: NeedsType.learnSkills,
+      key: NeedsType.baseSkills,
       icon: 'orientationIndex3',
     },
   ];
@@ -50,7 +50,7 @@ export class NeedsSelectionComponent implements OnInit {
   ngOnInit(): void {
     if (this.orientationService.rdvUser || this.orientationService.rdvStructure) {
       this.needsList = this.needsList.filter(
-        (item) => item.key === NeedsType.onlineDemarch || item.key === NeedsType.learnSkills,
+        (item) => item.key === NeedsType.onlineDemarch || item.key === NeedsType.baseSkills,
       );
     }
 
diff --git a/src/app/form/orientation-form-view/global-components/select/select.component.ts b/src/app/form/orientation-form-view/global-components/select/select.component.ts
index 76c604ac7..0e47cfdb0 100644
--- a/src/app/form/orientation-form-view/global-components/select/select.component.ts
+++ b/src/app/form/orientation-form-view/global-components/select/select.component.ts
@@ -5,7 +5,7 @@ import { Module } from '../../../../structure-list/models/module.model';
 @Component({ template: `` })
 export class SelectComponent {
   @Input() filtersForm: FormGroup;
-  @Output() checkValidation = new EventEmitter<any>();
+  @Output() checkValidation = new EventEmitter<void>();
   public equipmentType: Module[] = [];
   public selectedModules: Module[] = [];
 
diff --git a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.ts b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.ts
index 1108e53ef..5e1d53846 100644
--- a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.ts
@@ -9,7 +9,7 @@ import { OnlineDemarche } from '../../../enums/orientation.enums';
 })
 export class AccompanimentTypeComponent implements OnInit {
   @Input() form: UntypedFormGroup;
-  @Output() checkValidation = new EventEmitter<any>();
+  @Output() checkValidation = new EventEmitter<void>();
 
   public selected: string;
   public accompanimentTypes: INeedItem[] = [
diff --git a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/online-demarch.component.ts b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/online-demarch.component.ts
index 8ff38b3e7..f4e8fb3f5 100644
--- a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/online-demarch.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/online-demarch.component.ts
@@ -18,7 +18,7 @@ import { FiltersForm } from '../../interfaces/filtersForm.interface';
 export class OnlineDemarchComponent extends SelectComponent implements OnInit {
   @Input() form: UntypedFormGroup;
   @Input() filtersForm: FormGroup<FiltersForm>;
-  @Output() checkValidation = new EventEmitter<any>();
+  @Output() checkValidation = new EventEmitter<void>();
 
   public orientationUtils = new OrientationUtils();
   public accompanimentType: Module[];
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
index 55f4a40cd..f4a9b30f8 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
@@ -7,10 +7,9 @@
     (checkValidation)="checkValidation()"
   />
   <app-base-skills
-    *ngIf="needType === NeedsType.learnSkills && currentStep === OnlineDemarchesCommonSteps.onlineDemarche"
-    [currentStep]="currentStep"
+    *ngIf="needType === NeedsType.baseSkills && currentStep === OnlineDemarchesCommonSteps.onlineDemarche"
     [filtersForm]="filtersForm"
-    (validatePage)="checkValidation()"
+    (checkValidation)="checkValidation()"
   />
   <app-accompaniment-type
     *ngIf="currentStep === OnlineDemarchesCommonSteps.accompanimentType"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html
index a256a0f1b..65ce1516b 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.html
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.html
@@ -28,7 +28,7 @@
         (validatePage)="validatePage($event)"
       />
       <app-online-demarch-form
-        *ngIf="isOnlineDemarcheOrLearnSkills()"
+        *ngIf="isOnlineDemarcheOrBaseSkills()"
         [needType]="needType"
         [currentStep]="currentStep"
         [currentType]="currentType"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index d867fa2fb..df26cb95a 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -202,7 +202,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     // If first step, perform some initialization
     if (this.currentStep === null) {
       this.filtersForm = this.orientationUtils.createFiltersForm();
-      if (this.isOnlineDemarcheOrLearnSkills()) {
+      if (this.isOnlineDemarcheOrBaseSkills()) {
         this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
       }
     }
@@ -221,13 +221,13 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     return this.currentType === orientationType && this.currentStep === orientationStep;
   }
 
-  public isOnlineDemarcheOrLearnSkills(): boolean {
-    return this.needType === NeedsType.onlineDemarch || this.needType === NeedsType.learnSkills;
+  public isOnlineDemarcheOrBaseSkills(): boolean {
+    return this.needType === NeedsType.onlineDemarch || this.needType === NeedsType.baseSkills;
   }
 
   private checkHiddenNavButtons(): void {
     // Only needs to hide in appointment / online mediation
-    if (!this.isOnlineDemarcheOrLearnSkills()) return;
+    if (!this.isOnlineDemarcheOrBaseSkills()) return;
 
     const isCartoStep = this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd);
     const isAppointmentSuccess = this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd);
@@ -251,7 +251,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     );
     this.isLastStep =
       isStructureListOrientationRecap ||
-      (this.isOnlineDemarcheOrLearnSkills() && (isAppointmentOrientationRecap || isOnlineMediationOrientationRecap));
+      (this.isOnlineDemarcheOrBaseSkills() && (isAppointmentOrientationRecap || isOnlineMediationOrientationRecap));
   }
 
   /**
@@ -370,14 +370,14 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
           this.previousNeedType = NeedsType.onlineDemarch;
           this.setFilters('onlineProcedures');
           break;
-        case NeedsType.learnSkills:
-          this.previousNeedType = NeedsType.learnSkills;
+        case NeedsType.baseSkills:
+          this.previousNeedType = NeedsType.baseSkills;
           this.setFilters('baseSkills');
       }
     }
 
-    // Online demarches or learn skills
-    if (this.isOnlineDemarcheOrLearnSkills()) {
+    // Online demarches or base skills
+    if (this.isOnlineDemarcheOrBaseSkills()) {
       // If appointment coming from the carto, we, need to patch the user / structure info + skip step where we chose to get an appointment
       if (
         this.currentStepIs(OnlineDemarche.common, OnlineDemarchesCommonSteps.accompanimentType - 1) &&
@@ -526,7 +526,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       ) {
         this.currentStep--;
       }
-      if (this.needType === NeedsType.learnSkills && this.currentStep === AppointmentSteps.infoScreen + 1) {
+      if (this.needType === NeedsType.baseSkills && this.currentStep === AppointmentSteps.infoScreen + 1) {
         this.currentStep--;
       }
       if (this.currentStep === AppointmentSteps.carto) {
@@ -561,7 +561,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       this.previousNeedType = null;
       this.currentType = OnlineDemarche.common;
       this.currentStep = OnlineDemarchesCommonSteps.accompanimentType;
-      if (this.isOnlineDemarcheOrLearnSkills()) {
+      if (this.isOnlineDemarcheOrBaseSkills()) {
         this.filtersForm = this.orientationUtils.createFiltersForm();
         this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
         if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
@@ -586,6 +586,8 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.filtersForm = this.orientationUtils.createFiltersForm();
     this.currentStep = null;
     this.currentType = OnlineDemarche.common;
+    this.isPrevHidden = false;
+    this.isNextHidden = false;
     this.isLastStep = false;
     this.failedOrientation = false;
     this.nbSteps = OrientationFormViewComponent.MAX_STEP;
@@ -637,10 +639,10 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         return 'accès matériel';
       case NeedsType.equipmentBuy:
         return 'achat matériel';
-      case NeedsType.learnSkills:
-        return 'compétences';
       case NeedsType.onlineDemarch:
         return 'démarche en ligne';
+      case NeedsType.baseSkills:
+        return 'compétences';
       default:
         return '';
     }
@@ -727,8 +729,8 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         break;
       case OnlineDemarche.appointment:
         this.currentType = OnlineDemarche.appointment;
-        // Skip first screen appointment info for learnSkills
-        if (this.needType === NeedsType.learnSkills) {
+        // Skip first screen appointment info for baseSkills
+        if (this.needType === NeedsType.baseSkills) {
           this.currentStep = AppointmentSteps.infoScreen + 1;
           this.skipStructureOrientator(true);
         } else {
diff --git a/src/app/form/orientation-form-view/orientation.module.ts b/src/app/form/orientation-form-view/orientation.module.ts
index 3057ae869..3323a1760 100644
--- a/src/app/form/orientation-form-view/orientation.module.ts
+++ b/src/app/form/orientation-form-view/orientation.module.ts
@@ -2,7 +2,6 @@ import { A11yModule } from '@angular/cdk/a11y';
 import { NgModule } from '@angular/core';
 import { CartoModule } from '../../carto/carto.module';
 import { SharedModule } from '../../shared/shared.module';
-import { BaseSkillsChoiceComponent } from './base-skills/base-skills-choice/base-skills-choice.component';
 import { BaseSkillsComponent } from './base-skills/base-skills.component';
 import { EquipmentAccessChoiceComponent } from './equipment-access/equipment-access-choice/equipment-access-choice.component';
 import { EquipmentAccessComponent } from './equipment-access/equipment-access.component';
@@ -50,7 +49,6 @@ import { OrientationStructureListComponent } from './orientation-structure-list/
     DetailledStructureCardComponent,
     OrientationCommentsComponent,
     EquipmentAccessComponent,
-    BaseSkillsChoiceComponent,
     MediationLanguageSelectionComponent,
     SelectComponent,
     MakeAppointmentComponent,
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index 2729bc735..c3c257b71 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -225,12 +225,12 @@ export class OrientationUtils {
 
   public setValidationsEquipmentForm(
     pagesValidation: any[],
-    form: FormGroup<FiltersForm>,
+    filtersForm: FormGroup<FiltersForm>,
     updatePageValid: (isValid: boolean) => void,
     step: FiltersSteps,
   ): void {
     pagesValidation[FiltersSteps.filterChoice] = {
-      valid: form.get('filters').valid,
+      valid: filtersForm.get('filters').value.length > 0,
     };
     updatePageValid(pagesValidation[step].valid);
   }
-- 
GitLab


From a65e09ce359ae5f804a99cbe953297ed5a3ef8d9 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Tue, 13 Aug 2024 14:15:43 +0200
Subject: [PATCH 11/23] cleaned up orientation enums

---
 .../enums/orientation.enums.ts                |  86 ++++++------
 .../equipment-access.component.ts             |   8 +-
 .../equipment-buy/equipment-buy.component.ts  |   8 +-
 .../orientation-recap.component.ts            |  42 +++---
 .../mediation-language-selection.component.ts |  32 ++---
 .../onlineDemarch-form.component.html         |  32 ++---
 .../onlineDemarch-form.component.ts           |  18 +--
 .../orientation-form-view.component.ts        | 122 +++++++++---------
 .../orientation-structure-list.component.html |   2 +-
 .../orientation-structure-list.component.ts   |   6 +-
 .../types/orientation.types.ts                |  13 +-
 src/app/utils/orientationUtils.ts             |  37 +++---
 12 files changed, 199 insertions(+), 207 deletions(-)

diff --git a/src/app/form/orientation-form-view/enums/orientation.enums.ts b/src/app/form/orientation-form-view/enums/orientation.enums.ts
index c3f9b138b..1c278b0d9 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -1,66 +1,47 @@
-export enum AppointmentSteps {
-  infoScreen,
-  pmrAccess,
-  location,
-  carto,
-  makeAppointment,
-  mediationBeneficiaryInfo,
-  structureOrientator,
-  orientationRecap,
-  rdvEnd,
-  orientationPrint,
-}
-
-export enum FiltersSteps {
-  filterChoice,
-}
-
 export enum GenericOrientationSteps {
   common = 'Common',
   structureList = 'Trouver une structure',
 }
 
-export enum HotlineMediationSteps {
-  infoScreen,
-  mediationBeneficiaryInfo,
-  mediationHoursSelection,
-  mediationLanguageSelection,
-  comments,
-  structureOrientator,
-  orientationRecap,
-  rdvEnd,
-  orientationPrint,
-}
-
 export enum OnlineDemarche {
+  common = 'Common',
   structureList = 'Trouver une structure',
   appointment = 'RDV Conseiller Numérique',
   onlineMediation = 'Médiation Numérique à distance',
-  common = 'Common',
-}
-
-export enum OnlineDemarchesCommonSteps {
-  onlineDemarche,
-  accompanimentType,
 }
 
+/**
+ * Names of needs, leading to one of the three orientations
+ */
 export enum NeedsType {
   equipmentAccess = 'equipmentAccess',
   equipmentBuy = 'equipmentBuy',
   onlineDemarch = 'onlineDemarch',
   baseSkills = 'baseSkills',
 }
-export enum PreferredLanguages {
-  french = 'Français',
-  english = 'Anglais',
-  arabic = 'Arabe',
+
+/**
+ * To prepare each need, a set of filters must be chosen. In Online procedures
+ * (onlineDemarch or baseSkills), there is also a choice of the accompaniment
+ * type.
+ */
+export enum CommonSteps {
+  filtersChoice,
+  accompanimentType,
 }
-export enum RecapsType {
+
+/**
+ * Names of different orientations
+ */
+export enum AccompanimentTypes {
+  structuresList,
   appointment,
   onlineMediation,
-  structure,
 }
 
+/**
+ * Steps of different orientations
+ */
 export enum StructuresListSteps {
   pmrAccess,
   address,
@@ -70,3 +51,26 @@ export enum StructuresListSteps {
   structureOrientator,
   orientationRecap,
 }
+export enum AppointmentSteps {
+  infoScreen,
+  pmrAccess,
+  location,
+  carto,
+  makeAppointment,
+  mediationBeneficiaryInfo,
+  structureOrientator,
+  orientationRecap,
+  rdvEnd,
+  orientationPrint,
+}
+export enum OnlineMediationSteps {
+  infoScreen,
+  mediationBeneficiaryInfo,
+  mediationHoursSelection,
+  mediationLanguageSelection,
+  comments,
+  structureOrientator,
+  orientationRecap,
+  rdvEnd,
+  orientationPrint,
+}
diff --git a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
index bfa2d76fe..e4d824ac4 100644
--- a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
+++ b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
@@ -3,7 +3,7 @@ import { FormGroup } from '@angular/forms';
 import { User } from '../../../models/user.model';
 import { Filter } from '../../../structure-list/models/filter.model';
 import { OrientationUtils } from '../../../utils/orientationUtils';
-import { FiltersSteps, GenericOrientationSteps, RecapsType, StructuresListSteps } from '../enums/orientation.enums';
+import { CommonSteps, GenericOrientationSteps, StructuresListSteps } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
 import { StructureOrientationForm } from '../interfaces/structureOrientationForm.interface';
 import { MediationStepType, MediationType } from '../types/orientation.types';
@@ -13,7 +13,7 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
   templateUrl: './equipment-access.component.html',
 })
 export class EquipmentAccessComponent {
-  @Input() currentStep: FiltersSteps | StructuresListSteps | MediationStepType;
+  @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType;
   @Input() currentType: GenericOrientationSteps | MediationType;
   @Input() filtersForm: FormGroup<FiltersForm>;
   @Input() orientationForm: FormGroup<StructureOrientationForm>;
@@ -25,8 +25,6 @@ export class EquipmentAccessComponent {
   public pagesValidation: any[] = [];
 
   // Enums
-  public FiltersSteps = FiltersSteps;
-  public RecapsType = RecapsType;
   public GenericOrientationSteps = GenericOrientationSteps;
 
   public checkValidation(): void {
@@ -36,7 +34,7 @@ export class EquipmentAccessComponent {
           this.pagesValidation,
           this.filtersForm,
           (isValid) => this.validatePage.emit(isValid),
-          this.currentStep as FiltersSteps,
+          this.currentStep as CommonSteps,
         );
         break;
       case GenericOrientationSteps.structureList:
diff --git a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
index b292e9d05..2aa775e7d 100644
--- a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
+++ b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
@@ -3,7 +3,7 @@ import { FormGroup } from '@angular/forms';
 import { User } from '../../../models/user.model';
 import { Filter } from '../../../structure-list/models/filter.model';
 import { OrientationUtils } from '../../../utils/orientationUtils';
-import { FiltersSteps, GenericOrientationSteps, RecapsType, StructuresListSteps } from '../enums/orientation.enums';
+import { CommonSteps, GenericOrientationSteps, StructuresListSteps } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
 import { StructureOrientationForm } from '../interfaces/structureOrientationForm.interface';
 import { MediationStepType, MediationType } from '../types/orientation.types';
@@ -13,7 +13,7 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
   templateUrl: './equipment-buy.component.html',
 })
 export class EquipmentBuyComponent {
-  @Input() currentStep: FiltersSteps | StructuresListSteps | MediationStepType;
+  @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType;
   @Input() currentType: GenericOrientationSteps | MediationType;
   @Input() filtersForm: FormGroup<FiltersForm>;
   @Input() orientationForm: FormGroup<StructureOrientationForm>;
@@ -25,8 +25,6 @@ export class EquipmentBuyComponent {
   public pagesValidation: any[] = [];
 
   // Enums
-  public FiltersSteps = FiltersSteps;
-  public RecapsType = RecapsType;
   public GenericOrientationSteps = GenericOrientationSteps;
 
   public checkValidation(): void {
@@ -36,7 +34,7 @@ export class EquipmentBuyComponent {
           this.pagesValidation,
           this.filtersForm,
           (isValid) => this.validatePage.emit(isValid),
-          this.currentStep as FiltersSteps,
+          this.currentStep as CommonSteps,
         );
         break;
       case GenericOrientationSteps.structureList:
diff --git a/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.ts b/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.ts
index b361d3e16..783e733f1 100644
--- a/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.ts
+++ b/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.ts
@@ -5,7 +5,7 @@ import { Owner } from '../../../../models/owner.model';
 import { Structure } from '../../../../models/structure.model';
 import { Module } from '../../../../structure-list/models/module.model';
 import { Utils } from '../../../../utils/utils';
-import { RecapsType } from '../../enums/orientation.enums';
+import { AccompanimentTypes } from '../../enums/orientation.enums';
 
 @Component({
   selector: 'app-orientation-recap',
@@ -14,7 +14,7 @@ import { RecapsType } from '../../enums/orientation.enums';
 })
 export class OrientationRecapComponent implements OnInit {
   @Input() form: UntypedFormGroup;
-  @Input() recapType: RecapsType;
+  @Input() accompanimentType: AccompanimentTypes;
   @Input() socialWorker?: Owner;
   @Input() structureRDV?: Structure;
   @Input() isToPrint = true;
@@ -34,7 +34,7 @@ export class OrientationRecapComponent implements OnInit {
     this.checkValidation.emit();
     // When requesting for an appointments, we save Filters within the form 'onlineDemarcheType',
     // instead of Modules within the form 'filters'. This harmonizes it.
-    if (this.recapType === RecapsType.appointment) {
+    if (this.accompanimentType === AccompanimentTypes.appointment) {
       this.needs = this.utils.convertFiltersToModule(this.form.get('onlineDemarcheType').value);
     } else {
       this.needs = this.form.get('filters').value;
@@ -43,23 +43,23 @@ export class OrientationRecapComponent implements OnInit {
       name: this.form.get('name').value,
       surname: this.form.get('surname').value,
     };
-    switch (this.recapType) {
-      case RecapsType.onlineMediation:
-        this.handleOnlineOrientationRecap();
+    switch (this.accompanimentType) {
+      case AccompanimentTypes.structuresList:
+        this.handleStructureRecap();
         break;
-      case RecapsType.appointment:
+      case AccompanimentTypes.appointment:
         this.handleAppointmentRecap();
         break;
-      case RecapsType.structure:
-        this.handleStructureRecap();
+      case AccompanimentTypes.onlineMediation:
+        this.handleOnlineOrientationRecap();
         break;
       default:
-        throw new Error(`Not implemented recap type ${this.recapType}`);
+        throw new Error(`Not implemented recap type ${this.accompanimentType}`);
     }
   }
 
   public shouldDisplayAppointmentRecap(): boolean {
-    return this.recapType === RecapsType.appointment;
+    return this.accompanimentType === AccompanimentTypes.appointment;
   }
 
   public handleAppointmentRecap(): void {
@@ -92,28 +92,28 @@ export class OrientationRecapComponent implements OnInit {
   }
 
   public getRecapTitle(): string {
-    switch (this.recapType) {
-      case RecapsType.structure:
+    switch (this.accompanimentType) {
+      case AccompanimentTypes.structuresList:
         return 'Orientation vers un lieu de médiation numérique';
-      case RecapsType.appointment:
+      case AccompanimentTypes.appointment:
         return 'Demande de rendez-vous d’aide numérique';
-      case RecapsType.onlineMediation:
+      case AccompanimentTypes.onlineMediation:
         return 'Rappel téléphonique';
       default:
-        throw new Error(`Not implemented recap type ${this.recapType}`);
+        throw new Error(`Not implemented recap type ${this.accompanimentType}`);
     }
   }
 
   public getRecapInfo(): string | null {
-    switch (this.recapType) {
-      case RecapsType.structure:
+    switch (this.accompanimentType) {
+      case AccompanimentTypes.structuresList:
         return null;
-      case RecapsType.appointment:
+      case AccompanimentTypes.appointment:
         return 'Votre demande de rendez-vous d’aide numérique a bien été envoyée.<br>Un·e professionnel·le vous rappellera pour fixer une date.';
-      case RecapsType.onlineMediation:
+      case AccompanimentTypes.onlineMediation:
         return 'Vous avez effectué une demande de rappel téléphonique.<br>Vous serez contacté(e) par un·e professionnel·le pour le créneau sélectionné.';
       default:
-        throw new Error(`Not implemented recap type ${this.recapType}`);
+        throw new Error(`Not implemented recap type ${this.accompanimentType}`);
     }
   }
 
diff --git a/src/app/form/orientation-form-view/online-demarch/mediation-language-selection/mediation-language-selection.component.ts b/src/app/form/orientation-form-view/online-demarch/mediation-language-selection/mediation-language-selection.component.ts
index 73b426d07..a02e553d6 100644
--- a/src/app/form/orientation-form-view/online-demarch/mediation-language-selection/mediation-language-selection.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/mediation-language-selection/mediation-language-selection.component.ts
@@ -1,6 +1,15 @@
 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
 import { UntypedFormGroup } from '@angular/forms';
-import { PreferredLanguages } from '../../enums/orientation.enums';
+
+export enum PreferredLanguages {
+  french = 'Français',
+  english = 'Anglais',
+  arabic = 'Arabe',
+}
+interface LanguageOption {
+  title: PreferredLanguages;
+  key: PreferredLanguages;
+}
 
 @Component({
   selector: 'app-mediation-language-selection',
@@ -8,22 +17,13 @@ import { PreferredLanguages } from '../../enums/orientation.enums';
 })
 export class MediationLanguageSelectionComponent implements OnInit {
   @Input() form: UntypedFormGroup;
-  @Output() checkValidation = new EventEmitter<any>();
+  @Output() checkValidation = new EventEmitter<void>();
   public selected: string;
-  public languages: any[] = [
-    {
-      title: 'Français',
-      key: PreferredLanguages.french,
-    },
-    {
-      title: 'Anglais',
-      key: PreferredLanguages.english,
-    },
-    {
-      title: 'Arabe',
-      key: PreferredLanguages.arabic,
-    },
-  ];
+  public languages: LanguageOption[] = Object.values(PreferredLanguages).map((language) => ({
+    title: language,
+    key: language,
+  }));
+
   ngOnInit(): void {
     this.selected = this.form.get('preferredLanguage').value;
     this.checkValidation.emit();
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
index f4a9b30f8..f1f0c9ba5 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
@@ -1,18 +1,18 @@
 <!-- COMMON FORM -->
 <ng-container *ngIf="currentType === OnlineDemarche.common">
   <app-online-demarch
-    *ngIf="needType === NeedsType.onlineDemarch && currentStep === OnlineDemarchesCommonSteps.onlineDemarche"
+    *ngIf="needType === NeedsType.onlineDemarch && currentStep === CommonSteps.filtersChoice"
     [form]="form"
     [filtersForm]="filtersForm"
     (checkValidation)="checkValidation()"
   />
   <app-base-skills
-    *ngIf="needType === NeedsType.baseSkills && currentStep === OnlineDemarchesCommonSteps.onlineDemarche"
+    *ngIf="needType === NeedsType.baseSkills && currentStep === CommonSteps.filtersChoice"
     [filtersForm]="filtersForm"
     (checkValidation)="checkValidation()"
   />
   <app-accompaniment-type
-    *ngIf="currentStep === OnlineDemarchesCommonSteps.accompanimentType"
+    *ngIf="currentStep === CommonSteps.accompanimentType"
     [form]="form"
     (checkValidation)="checkValidation()"
   />
@@ -68,7 +68,7 @@
   <app-orientation-recap
     *ngIf="currentStep === OnlineDemarchesAppointmentSteps.orientationRecap"
     [form]="form"
-    [recapType]="RecapsType.appointment"
+    [accompanimentType]="AccompanimentTypes.appointment"
     [socialWorker]="socialWorker"
     [structureRDV]="structureRDV"
     [isToPrint]="false"
@@ -85,7 +85,7 @@
   <app-orientation-recap
     *ngIf="currentStep === OnlineDemarchesAppointmentSteps.orientationPrint"
     [form]="form"
-    [recapType]="RecapsType.appointment"
+    [accompanimentType]="AccompanimentTypes.appointment"
     [socialWorker]="socialWorker"
     [structureRDV]="structureRDV"
     (checkValidation)="checkValidation()"
@@ -94,53 +94,53 @@
 <!-- ONLINE MEDIATION FORM -->
 <ng-container *ngIf="currentType === OnlineDemarche.onlineMediation">
   <app-information-screen
-    *ngIf="currentStep === HotlineMediationSteps.infoScreen"
+    *ngIf="currentStep === OnlineMediationSteps.infoScreen"
     [currentType]="currentType"
     (checkValidation)="checkValidation()"
   />
   <app-mediation-beneficiary-info
-    *ngIf="currentStep === HotlineMediationSteps.mediationBeneficiaryInfo"
+    *ngIf="currentStep === OnlineMediationSteps.mediationBeneficiaryInfo"
     [form]="form"
     (checkValidation)="checkValidation()"
   />
   <app-mediation-hours-selection
-    *ngIf="currentStep === HotlineMediationSteps.mediationHoursSelection"
+    *ngIf="currentStep === OnlineMediationSteps.mediationHoursSelection"
     [form]="form"
     (checkValidation)="checkValidation()"
   />
   <app-mediation-language-selection
-    *ngIf="currentStep === HotlineMediationSteps.mediationLanguageSelection"
+    *ngIf="currentStep === OnlineMediationSteps.mediationLanguageSelection"
     [form]="form"
     (checkValidation)="checkValidation()"
   />
   <app-orientation-comments
-    *ngIf="currentStep === HotlineMediationSteps.comments"
+    *ngIf="currentStep === OnlineMediationSteps.comments"
     [form]="form"
     (checkValidation)="checkValidation()"
   />
   <app-structure-orientator
-    *ngIf="currentStep === HotlineMediationSteps.structureOrientator"
+    *ngIf="currentStep === OnlineMediationSteps.structureOrientator"
     [profile]="profile"
     [form]="form"
     (validatePage)="checkValidation()"
   />
   <app-orientation-recap
-    *ngIf="currentStep === HotlineMediationSteps.orientationRecap"
+    *ngIf="currentStep === OnlineMediationSteps.orientationRecap"
     [form]="form"
-    [recapType]="RecapsType.onlineMediation"
+    [accompanimentType]="AccompanimentTypes.onlineMediation"
     [isToPrint]="false"
     (checkValidation)="checkValidation()"
   />
   <app-appointment-end
-    *ngIf="currentStep === HotlineMediationSteps.rdvEnd"
+    *ngIf="currentStep === OnlineMediationSteps.rdvEnd"
     [form]="form"
     [isOnlineMediation]="true"
     (checkValidation)="checkValidation()"
   />
   <app-orientation-recap
-    *ngIf="currentStep === HotlineMediationSteps.orientationPrint"
+    *ngIf="currentStep === OnlineMediationSteps.orientationPrint"
     [form]="form"
-    [recapType]="RecapsType.onlineMediation"
+    [accompanimentType]="AccompanimentTypes.onlineMediation"
     (checkValidation)="checkValidation()"
   />
 </ng-container>
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
index 84d0889b6..0deb0d8e7 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
@@ -8,16 +8,16 @@ import { Category } from '../../../structure-list/models/category.model';
 import { Filter } from '../../../structure-list/models/filter.model';
 import { OrientationUtils } from '../../../utils/orientationUtils';
 import {
+  AccompanimentTypes,
   AppointmentSteps,
-  HotlineMediationSteps,
+  CommonSteps,
   NeedsType,
   OnlineDemarche,
-  OnlineDemarchesCommonSteps,
-  RecapsType,
+  OnlineMediationSteps,
   StructuresListSteps,
 } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
-import { MediationStepType, MediationType, OnlineMediationSteps } from '../types/orientation.types';
+import { MediationStepType, MediationType } from '../types/orientation.types';
 
 @Component({
   selector: 'app-online-demarch-form',
@@ -43,13 +43,13 @@ export class OnlineDemarchFormComponent {
   public socialWorker: Owner;
 
   // Enums
-  public HotlineMediationSteps = HotlineMediationSteps;
-  public OnlineDemarchesCommonSteps = OnlineDemarchesCommonSteps;
+  public OnlineMediationSteps = OnlineMediationSteps;
+  public CommonSteps = CommonSteps;
   public StructuresListSteps = StructuresListSteps;
   public OnlineDemarche = OnlineDemarche;
   public OnlineDemarchesAppointmentSteps = AppointmentSteps;
   public NeedsType = NeedsType;
-  public RecapsType = RecapsType;
+  public AccompanimentTypes = AccompanimentTypes;
 
   constructor(public orientationService: OrientationService) {}
 
@@ -61,7 +61,7 @@ export class OnlineDemarchFormComponent {
           this.filtersForm,
           this.form,
           (isValid) => this.validatePage.emit(isValid),
-          this.currentStep as OnlineDemarchesCommonSteps,
+          this.currentStep as CommonSteps,
         );
         break;
       case OnlineDemarche.structureList:
@@ -94,7 +94,7 @@ export class OnlineDemarchFormComponent {
           this.pagesValidation,
           this.form,
           (isValid) => this.validatePage.emit(isValid),
-          this.currentStep as HotlineMediationSteps,
+          this.currentStep as OnlineMediationSteps,
         );
         break;
       default:
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index df26cb95a..26675d130 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -20,12 +20,11 @@ import { CanExitResolver, Utils } from '../../utils/utils';
 import { formType } from '../form-view/formType.enum';
 import {
   AppointmentSteps,
-  FiltersSteps,
+  CommonSteps,
   GenericOrientationSteps,
-  HotlineMediationSteps,
   NeedsType,
   OnlineDemarche,
-  OnlineDemarchesCommonSteps,
+  OnlineMediationSteps,
   StructuresListSteps,
 } from './enums/orientation.enums';
 import { NavigationComponent } from './global-components/navigation/navigation.component';
@@ -51,9 +50,9 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     (Math.max(
       Object.keys(StructuresListSteps).length,
       Object.keys(AppointmentSteps).length,
-      Object.keys(HotlineMediationSteps).length,
+      Object.keys(OnlineMediationSteps).length,
     ) +
-      Object.keys(OnlineDemarchesCommonSteps).length) /
+      Object.keys(CommonSteps).length) /
     2;
   public orientationUtils = new OrientationUtils();
   public utils = new Utils();
@@ -231,7 +230,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     const isCartoStep = this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd);
     const isAppointmentSuccess = this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd);
-    const isOnlineMediationSuccess = this.currentStepIs(OnlineDemarche.onlineMediation, HotlineMediationSteps.rdvEnd);
+    const isOnlineMediationSuccess = this.currentStepIs(OnlineDemarche.onlineMediation, OnlineMediationSteps.rdvEnd);
     this.isPrevHidden = isAppointmentSuccess || isOnlineMediationSuccess;
     this.isNextHidden = isCartoStep;
   }
@@ -247,7 +246,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     );
     const isOnlineMediationOrientationRecap = this.currentStepIs(
       OnlineDemarche.onlineMediation,
-      HotlineMediationSteps.orientationPrint,
+      OnlineMediationSteps.orientationPrint,
     );
     this.isLastStep =
       isStructureListOrientationRecap ||
@@ -305,6 +304,42 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     );
   }
 
+  public setOnlineProceduresForm(): void {
+    switch (this.onlineDemarcheForm.get('accompanimentType').value) {
+      case OnlineDemarche.structureList:
+        this.currentType = OnlineDemarche.structureList;
+        this.currentStep = StructuresListSteps.pmrAccess;
+        this.setStepNumber(Object.keys(StructuresListSteps).length);
+        this.onlineDemarcheForm = this.orientationUtils.createStructureOrientationForm(
+          this.utils.convertFiltersToModule(this.filters),
+        );
+        break;
+      case OnlineDemarche.appointment:
+        this.currentType = OnlineDemarche.appointment;
+        // Skip first screen appointment info for baseSkills
+        if (this.needType === NeedsType.baseSkills) {
+          this.currentStep = AppointmentSteps.infoScreen + 1;
+          this.skipStructureOrientator(true);
+        } else {
+          this.currentStep = AppointmentSteps.infoScreen;
+        }
+        this.setStepNumber(Object.keys(AppointmentSteps).length);
+        this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
+        break;
+      case OnlineDemarche.onlineMediation:
+        this.currentType = OnlineDemarche.onlineMediation;
+        this.currentStep = OnlineMediationSteps.infoScreen;
+        this.setStepNumber(Object.keys(OnlineMediationSteps).length);
+        this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
+          this.utils.convertFiltersToModule(this.filters),
+          this.orientator,
+        );
+        break;
+      default:
+        throw new Error('Not implemented value in nextPage()');
+    }
+  }
+
   private async setCategories(): Promise<void> {
     const categories = await this.searchService.getCategories().toPromise();
     categories.forEach((categ) => {
@@ -340,6 +375,17 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
   }
 
+  /**
+   * Initialize online procedure (list of structures / appointment / online mediation)
+   */
+  public setOnlineProcedureFilters(): void {
+    // Handle online procedures
+    const onlineProcedures: Filter[] = this.onlineDemarcheForm.value.onlineDemarcheType.map((module: Module) => {
+      return new Filter('onlineProcedures', module.id, module.displayText);
+    });
+    if (onlineProcedures.length > 0) this.filters = [...onlineProcedures, ...this.filters];
+  }
+
   public setFilters(category: string): void {
     // Handle online procedures
     this.filters = this.filtersForm.value.filters.map((module: Module) => {
@@ -352,7 +398,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.isNextHidden = false;
 
     // Handle filters form
-    if (this.currentStepIs(GenericOrientationSteps.common, FiltersSteps.filterChoice)) {
+    if (this.currentStepIs(GenericOrientationSteps.common, CommonSteps.filtersChoice)) {
       switch (this.needType) {
         case NeedsType.equipmentAccess:
           this.previousNeedType = NeedsType.equipmentAccess;
@@ -380,7 +426,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     if (this.isOnlineDemarcheOrBaseSkills()) {
       // If appointment coming from the carto, we, need to patch the user / structure info + skip step where we chose to get an appointment
       if (
-        this.currentStepIs(OnlineDemarche.common, OnlineDemarchesCommonSteps.accompanimentType - 1) &&
+        this.currentStepIs(OnlineDemarche.common, CommonSteps.filtersChoice) &&
         (this.orientationService.rdvStructure || this.orientationService.rdvUser)
       ) {
         this.onlineDemarcheForm.get('accompanimentType').patchValue(OnlineDemarche.appointment);
@@ -388,7 +434,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       }
 
       // If we are choosing the accompaniment type (findStructure / appointment / online mediation)
-      if (this.currentStepIs(OnlineDemarche.common, OnlineDemarchesCommonSteps.accompanimentType)) {
+      if (this.currentStepIs(OnlineDemarche.common, CommonSteps.accompanimentType)) {
         this.setOnlineProcedureFilters();
         this.setOnlineProceduresForm();
         this.previousNeedType = this.needType;
@@ -396,15 +442,15 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       }
 
       // If no multiple structures, skip orientator
-      if (this.currentStepIs(OnlineDemarche.onlineMediation, HotlineMediationSteps.structureOrientator - 1)) {
+      if (this.currentStepIs(OnlineDemarche.onlineMediation, OnlineMediationSteps.structureOrientator - 1)) {
         this.skipStructureOrientator(true);
       }
       // Handle Online appointment
-      if (this.currentStepIs(OnlineDemarche.onlineMediation, HotlineMediationSteps.rdvEnd - 1)) {
+      if (this.currentStepIs(OnlineDemarche.onlineMediation, OnlineMediationSteps.rdvEnd - 1)) {
         await this.handleOnlineAppointment();
       }
       // Handle last screen Online appointment and print
-      if (this.currentStepIs(OnlineDemarche.onlineMediation, HotlineMediationSteps.orientationPrint)) {
+      if (this.currentStepIs(OnlineDemarche.onlineMediation, OnlineMediationSteps.orientationPrint)) {
         this.printForm();
         return;
       }
@@ -560,7 +606,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       this.needType = this.previousNeedType;
       this.previousNeedType = null;
       this.currentType = OnlineDemarche.common;
-      this.currentStep = OnlineDemarchesCommonSteps.accompanimentType;
+      this.currentStep = CommonSteps.accompanimentType;
       if (this.isOnlineDemarcheOrBaseSkills()) {
         this.filtersForm = this.orientationUtils.createFiltersForm();
         this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
@@ -704,52 +750,4 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   public goLogin(): void {
     this.router.navigate(['/connexion'], { queryParams: { returnUrl: '/orientation' } });
   }
-
-  /**
-   * Initialize online procedure (list of structures / appointment / online mediation)
-   */
-  public setOnlineProcedureFilters(): void {
-    // Handle online procedures
-    console.log('here');
-    const onlineProcedures: Filter[] = this.onlineDemarcheForm.value.onlineDemarcheType.map((module: Module) => {
-      return new Filter('onlineProcedures', module.id, module.displayText);
-    });
-    if (onlineProcedures.length > 0) this.filters = [...onlineProcedures, ...this.filters];
-  }
-
-  public setOnlineProceduresForm(): void {
-    switch (this.onlineDemarcheForm.get('accompanimentType').value) {
-      case OnlineDemarche.structureList:
-        this.currentType = OnlineDemarche.structureList;
-        this.currentStep = StructuresListSteps.pmrAccess;
-        this.setStepNumber(Object.keys(StructuresListSteps).length);
-        this.onlineDemarcheForm = this.orientationUtils.createStructureOrientationForm(
-          this.utils.convertFiltersToModule(this.filters),
-        );
-        break;
-      case OnlineDemarche.appointment:
-        this.currentType = OnlineDemarche.appointment;
-        // Skip first screen appointment info for baseSkills
-        if (this.needType === NeedsType.baseSkills) {
-          this.currentStep = AppointmentSteps.infoScreen + 1;
-          this.skipStructureOrientator(true);
-        } else {
-          this.currentStep = AppointmentSteps.infoScreen;
-        }
-        this.setStepNumber(Object.keys(AppointmentSteps).length);
-        this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
-        break;
-      case OnlineDemarche.onlineMediation:
-        this.currentType = OnlineDemarche.onlineMediation;
-        this.currentStep = HotlineMediationSteps.infoScreen;
-        this.setStepNumber(Object.keys(HotlineMediationSteps).length);
-        this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
-          this.utils.convertFiltersToModule(this.filters),
-          this.orientator,
-        );
-        break;
-      default:
-        throw new Error('Not implemented value in nextPage()');
-    }
-  }
 }
diff --git a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.html b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.html
index e62fa7112..175cb0c0e 100644
--- a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.html
+++ b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.html
@@ -40,7 +40,7 @@
   <app-orientation-recap
     *ngIf="currentStep === StructuresListSteps.orientationRecap"
     [form]="form"
-    [recapType]="RecapsType.structure"
+    [accompanimentType]="AccompanimentTypes.structuresList"
     (checkValidation)="checkValidation()"
   />
 </ng-container>
diff --git a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
index f2a34f123..1394f20b6 100644
--- a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
+++ b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
@@ -4,7 +4,7 @@ import { Structure } from '../../../models/structure.model';
 import { User } from '../../../models/user.model';
 import { Filter } from '../../../structure-list/models/filter.model';
 import { OrientationUtils } from '../../../utils/orientationUtils';
-import { FiltersSteps, NeedsType, RecapsType, StructuresListSteps } from '../enums/orientation.enums';
+import { AccompanimentTypes, CommonSteps, NeedsType, StructuresListSteps } from '../enums/orientation.enums';
 import { MediationStepType } from '../types/orientation.types';
 
 @Component({
@@ -12,7 +12,7 @@ import { MediationStepType } from '../types/orientation.types';
   templateUrl: './orientation-structure-list.component.html',
 })
 export class OrientationStructureListComponent implements OnChanges {
-  @Input() currentStep: StructuresListSteps | FiltersSteps | MediationStepType | NeedsType;
+  @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType | NeedsType;
   @Input() profile: User;
   @Input() form: UntypedFormGroup;
   @Input() filters: Filter[] = [];
@@ -22,7 +22,7 @@ export class OrientationStructureListComponent implements OnChanges {
 
   // Enum
   public StructuresListSteps = StructuresListSteps;
-  public RecapsType = RecapsType;
+  public AccompanimentTypes = AccompanimentTypes;
   // Init data for form
   public selectedStructures: Structure[] = [];
 
diff --git a/src/app/form/orientation-form-view/types/orientation.types.ts b/src/app/form/orientation-form-view/types/orientation.types.ts
index 2a9694d2a..31719fe95 100644
--- a/src/app/form/orientation-form-view/types/orientation.types.ts
+++ b/src/app/form/orientation-form-view/types/orientation.types.ts
@@ -1,19 +1,14 @@
 import {
   AppointmentSteps,
-  FiltersSteps,
+  CommonSteps,
   GenericOrientationSteps,
-  HotlineMediationSteps,
   OnlineDemarche,
-  OnlineDemarchesCommonSteps,
+  OnlineMediationSteps,
   StructuresListSteps,
 } from '../enums/orientation.enums';
 
 export type MediationType = OnlineDemarche | GenericOrientationSteps;
 
-export type OnlineMediationSteps =
-  | HotlineMediationSteps
-  | StructuresListSteps
-  | OnlineDemarchesCommonSteps
-  | AppointmentSteps;
+export type OrientationSteps = CommonSteps | StructuresListSteps | AppointmentSteps | OnlineMediationSteps;
 
-export type MediationStepType = OnlineMediationSteps | FiltersSteps;
+export type MediationStepType = OrientationSteps;
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index c3c257b71..557367fa7 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -2,12 +2,10 @@ import { FormControl, FormGroup, UntypedFormControl, UntypedFormGroup, Validator
 import { structureFormStep } from '../form/form-view/structure-form/structureFormStep.enum';
 import {
   AppointmentSteps,
-  FiltersSteps,
-  HotlineMediationSteps,
+  CommonSteps,
   NeedsType,
   OnlineDemarche,
-  OnlineDemarchesCommonSteps,
-  PreferredLanguages,
+  OnlineMediationSteps,
   StructuresListSteps,
 } from '../form/orientation-form-view/enums/orientation.enums';
 import { AppointmentForm } from '../form/orientation-form-view/interfaces/appointmentForm.interface';
@@ -15,6 +13,7 @@ import { FiltersForm } from '../form/orientation-form-view/interfaces/filtersFor
 import { OnlineDemarchesForm } from '../form/orientation-form-view/interfaces/onlineDemarchesForm.interface';
 import { StructureOrientationForm } from '../form/orientation-form-view/interfaces/structureOrientationForm.interface';
 import { StructureOrientator } from '../form/orientation-form-view/interfaces/structureOrientator.interface';
+import { PreferredLanguages } from '../form/orientation-form-view/online-demarch/mediation-language-selection/mediation-language-selection.component';
 import { PersonalOffer } from '../models/personalOffer.model';
 import { OrientationService } from '../services/orientation.service';
 import { Filter } from '../structure-list/models/filter.model';
@@ -131,12 +130,12 @@ export class OrientationUtils {
     filtersForm: FormGroup<FiltersForm>,
     form: UntypedFormGroup,
     updatePageValid: (isValid: boolean) => void,
-    step: OnlineDemarchesCommonSteps,
+    step: CommonSteps,
   ): void {
-    pagesValidation[OnlineDemarchesCommonSteps.onlineDemarche] = {
+    pagesValidation[CommonSteps.filtersChoice] = {
       valid: filtersForm.get('filters').value.length > 0,
     };
-    pagesValidation[OnlineDemarchesCommonSteps.accompanimentType] = {
+    pagesValidation[CommonSteps.accompanimentType] = {
       valid: form.get('accompanimentType')?.value !== null,
     };
     updatePageValid(pagesValidation[step].valid);
@@ -146,23 +145,23 @@ export class OrientationUtils {
     pagesValidation: any[],
     form: UntypedFormGroup,
     updatePageValid: (isValid: boolean) => void,
-    step: HotlineMediationSteps,
+    step: OnlineMediationSteps,
   ): void {
-    pagesValidation[HotlineMediationSteps.infoScreen] = { valid: true };
-    pagesValidation[HotlineMediationSteps.mediationBeneficiaryInfo] = {
+    pagesValidation[OnlineMediationSteps.infoScreen] = { valid: true };
+    pagesValidation[OnlineMediationSteps.mediationBeneficiaryInfo] = {
       valid: form.get('name').valid && form.get('surname').valid && form.get('phone').valid,
     };
-    pagesValidation[HotlineMediationSteps.mediationHoursSelection] = {
+    pagesValidation[OnlineMediationSteps.mediationHoursSelection] = {
       valid: form.get('dateSlot').value !== null,
     };
-    pagesValidation[HotlineMediationSteps.mediationLanguageSelection] = { valid: true };
-    pagesValidation[HotlineMediationSteps.comments] = { valid: true };
-    pagesValidation[HotlineMediationSteps.structureOrientator] = {
+    pagesValidation[OnlineMediationSteps.mediationLanguageSelection] = { valid: true };
+    pagesValidation[OnlineMediationSteps.comments] = { valid: true };
+    pagesValidation[OnlineMediationSteps.structureOrientator] = {
       valid: this.isStructureOrientatorFormValid(form.get('structureOrientator') as FormGroup),
     };
-    pagesValidation[HotlineMediationSteps.orientationRecap] = { valid: true };
-    pagesValidation[HotlineMediationSteps.rdvEnd] = { valid: true };
-    pagesValidation[HotlineMediationSteps.orientationPrint] = { valid: true };
+    pagesValidation[OnlineMediationSteps.orientationRecap] = { valid: true };
+    pagesValidation[OnlineMediationSteps.rdvEnd] = { valid: true };
+    pagesValidation[OnlineMediationSteps.orientationPrint] = { valid: true };
     updatePageValid(pagesValidation[step].valid);
   }
 
@@ -227,9 +226,9 @@ export class OrientationUtils {
     pagesValidation: any[],
     filtersForm: FormGroup<FiltersForm>,
     updatePageValid: (isValid: boolean) => void,
-    step: FiltersSteps,
+    step: CommonSteps,
   ): void {
-    pagesValidation[FiltersSteps.filterChoice] = {
+    pagesValidation[CommonSteps.filtersChoice] = {
       valid: filtersForm.get('filters').value.length > 0,
     };
     updatePageValid(pagesValidation[step].valid);
-- 
GitLab


From 0602bde0a2570bb8f635aac0773fd0aed8943c74 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Tue, 13 Aug 2024 14:26:21 +0200
Subject: [PATCH 12/23] renamed accompanimentTunnel

---
 .../enums/orientation.enums.ts                | 29 +++++++++++--------
 .../equipment-access.component.html           |  2 +-
 .../equipment-access.component.ts             |  2 +-
 .../equipment-buy.component.html              |  2 +-
 .../equipment-buy/equipment-buy.component.ts  |  2 +-
 5 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/app/form/orientation-form-view/enums/orientation.enums.ts b/src/app/form/orientation-form-view/enums/orientation.enums.ts
index 1c278b0d9..ccfff65e3 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -1,15 +1,3 @@
-export enum GenericOrientationSteps {
-  common = 'Common',
-  structureList = 'Trouver une structure',
-}
-
-export enum OnlineDemarche {
-  common = 'Common',
-  structureList = 'Trouver une structure',
-  appointment = 'RDV Conseiller Numérique',
-  onlineMediation = 'Médiation Numérique à distance',
-}
-
 /**
  * Names of needs, leading to one of the three orientations
  */
@@ -20,6 +8,23 @@ export enum NeedsType {
   baseSkills = 'baseSkills',
 }
 
+/**
+ * We are either in the common first steps (filtersChoice, accompanimentChoice),
+ * or in the accompaniment tunnel (either a structuresList, an appointment, or
+ * an online Mediation)
+ */
+export enum GenericOrientationSteps {
+  common,
+  accompanimentTunnel,
+}
+
+export enum OnlineDemarche {
+  common = 'Common',
+  structureList = 'Trouver une structure',
+  appointment = 'RDV Conseiller Numérique',
+  onlineMediation = 'Médiation Numérique à distance',
+}
+
 /**
  * To prepare each need, a set of filters must be chosen. In Online procedures
  * (onlineDemarch or baseSkills), there is also a choice of the accompaniment
diff --git a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html
index 9d38ad1f3..15fbac437 100644
--- a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html
+++ b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html
@@ -4,7 +4,7 @@
   (checkValidation)="checkValidation()"
 />
 <app-orientation-structure-list
-  *ngIf="currentType === GenericOrientationSteps.structureList"
+  *ngIf="currentType === GenericOrientationSteps.accompanimentTunnel"
   [currentStep]="currentStep"
   [form]="orientationForm"
   [filters]="filters"
diff --git a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
index e4d824ac4..bfbc440b5 100644
--- a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
+++ b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
@@ -37,7 +37,7 @@ export class EquipmentAccessComponent {
           this.currentStep as CommonSteps,
         );
         break;
-      case GenericOrientationSteps.structureList:
+      case GenericOrientationSteps.accompanimentTunnel:
         this.orientationUtils.setValidationsStructuresForm(
           this.pagesValidation,
           this.orientationForm,
diff --git a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html
index db48013b0..1214021f3 100644
--- a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html
+++ b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html
@@ -4,7 +4,7 @@
   (checkValidation)="checkValidation()"
 />
 <app-orientation-structure-list
-  *ngIf="currentType === GenericOrientationSteps.structureList"
+  *ngIf="currentType === GenericOrientationSteps.accompanimentTunnel"
   [form]="orientationForm"
   [currentStep]="currentStep"
   [filters]="filters"
diff --git a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
index 2aa775e7d..eeb88782a 100644
--- a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
+++ b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
@@ -37,7 +37,7 @@ export class EquipmentBuyComponent {
           this.currentStep as CommonSteps,
         );
         break;
-      case GenericOrientationSteps.structureList:
+      case GenericOrientationSteps.accompanimentTunnel:
         this.orientationUtils.setValidationsStructuresForm(
           this.pagesValidation,
           this.orientationForm,
-- 
GitLab


From 4d9ac601ad46e4909f262dfebc1f41949b92b377 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Tue, 13 Aug 2024 14:36:23 +0200
Subject: [PATCH 13/23] Renamed needsTypes

---
 .../enums/orientation.enums.ts                | 32 +++++++--------
 .../navigation/navigation.component.ts        |  6 +--
 .../needs-selection.component.ts              | 18 ++++-----
 .../accompaniment-type.component.ts           |  8 ++--
 .../onlineDemarch-form.component.html         |  4 +-
 .../onlineDemarch-form.component.ts           |  6 +--
 .../orientation-form-view.component.ts        | 40 +++++++++----------
 .../orientation-structure-list.component.ts   |  4 +-
 src/app/utils/orientationUtils.ts             |  6 +--
 9 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/src/app/form/orientation-form-view/enums/orientation.enums.ts b/src/app/form/orientation-form-view/enums/orientation.enums.ts
index ccfff65e3..9ea791a4d 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -1,7 +1,7 @@
 /**
  * Names of needs, leading to one of the three orientations
  */
-export enum NeedsType {
+export enum NeedsTypes {
   equipmentAccess = 'equipmentAccess',
   equipmentBuy = 'equipmentBuy',
   onlineDemarch = 'onlineDemarch',
@@ -9,13 +9,12 @@ export enum NeedsType {
 }
 
 /**
- * We are either in the common first steps (filtersChoice, accompanimentChoice),
- * or in the accompaniment tunnel (either a structuresList, an appointment, or
- * an online Mediation)
+ * Names of different orientations
  */
-export enum GenericOrientationSteps {
-  common,
-  accompanimentTunnel,
+export enum AccompanimentTypes {
+  structuresList = 'Trouver une structure',
+  appointment = 'RDV Conseiller Numérique',
+  onlineMediation = 'Médiation Numérique à distance',
 }
 
 export enum OnlineDemarche {
@@ -25,6 +24,16 @@ export enum OnlineDemarche {
   onlineMediation = 'Médiation Numérique à distance',
 }
 
+/**
+ * We are either in the common first steps (filtersChoice, accompanimentChoice),
+ * or in the accompaniment tunnel (either a structuresList, an appointment, or
+ * an online Mediation)
+ */
+export enum GenericOrientationSteps {
+  common,
+  accompanimentTunnel,
+}
+
 /**
  * To prepare each need, a set of filters must be chosen. In Online procedures
  * (onlineDemarch or baseSkills), there is also a choice of the accompaniment
@@ -35,15 +44,6 @@ export enum CommonSteps {
   accompanimentType,
 }
 
-/**
- * Names of different orientations
- */
-export enum AccompanimentTypes {
-  structuresList,
-  appointment,
-  onlineMediation,
-}
-
 /**
  * Steps of different orientations
  */
diff --git a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
index a4492e1be..16f3c1759 100644
--- a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
+++ b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
@@ -1,7 +1,7 @@
 import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
 import { Router } from '@angular/router';
 import { ButtonComponent } from '../../../../shared/components';
-import { NeedsType, OnlineDemarche } from '../../enums/orientation.enums';
+import { NeedsTypes, OnlineDemarche } from '../../enums/orientation.enums';
 import { MediationStepType, MediationType } from '../../types/orientation.types';
 
 @Component({
@@ -13,7 +13,7 @@ export class NavigationComponent {
   @Input() currentStep: MediationStepType;
   @Input() currentType: OnlineDemarche | MediationType;
   @Input() isPageValid: boolean;
-  @Input() needType: NeedsType;
+  @Input() needType: NeedsTypes;
   @Input() isPrevHidden = false;
   @Input() isNextHidden = false;
   @Input() isLastStep = false;
@@ -26,7 +26,7 @@ export class NavigationComponent {
   @ViewChild('prevButton', { read: ButtonComponent }) prevButton: ButtonComponent;
   @ViewChild('nextButton', { read: ButtonComponent }) nextButton: ButtonComponent;
 
-  public NeedsTypeEnum = NeedsType;
+  public NeedsTypeEnum = NeedsTypes;
 
   constructor(private router: Router) {}
 
diff --git a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
index c7a3cf7b5..722098182 100644
--- a/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
+++ b/src/app/form/orientation-form-view/global-components/needs-selection/needs-selection.component.ts
@@ -4,40 +4,40 @@ import { PersonalOffer } from '../../../../models/personalOffer.model';
 import { OrientationService } from '../../../../services/orientation.service';
 import { PersonalOfferService } from '../../../../services/personal-offer.service';
 import { INeedItem } from '../../../../utils/orientationUtils';
-import { NeedsType } from '../../enums/orientation.enums';
+import { NeedsTypes } from '../../enums/orientation.enums';
 
 @Component({
   selector: 'app-needs-selection',
   templateUrl: './needs-selection.component.html',
 })
 export class NeedsSelectionComponent implements OnInit {
-  @Input() needType: NeedsType;
-  @Output() needTypeChange = new EventEmitter<NeedsType>();
+  @Input() needType: NeedsTypes;
+  @Output() needTypeChange = new EventEmitter<NeedsTypes>();
   @Output() validate = new EventEmitter<any>();
 
   public needsList: INeedItem[] = [
     {
       title: 'Accéder à du matériel numérique en libre service',
       hint: '(Wifi, ordinateur, imprimante, scanner…)',
-      key: NeedsType.equipmentAccess,
+      key: NeedsTypes.equipmentAccess,
       icon: 'orientationIndex0',
     },
     {
       title: 'Acheter du matériel numérique à tarif solidaire',
       hint: '(Ordinateur, smartphone, clé 4G, forfait internet…)',
-      key: NeedsType.equipmentBuy,
+      key: NeedsTypes.equipmentBuy,
       icon: 'orientationIndex1',
     },
     {
       title: 'Réaliser une démarche en ligne',
       hint: '(Démarche Caf, CPAM, France Travail…)',
-      key: NeedsType.onlineDemarch,
+      key: NeedsTypes.onlineDemarch,
       icon: 'orientationIndex2',
     },
     {
       title: 'Acquérir les compétences numériques de base',
       hint: '(Ordinateur et smartphone, mails, réseaux sociaux et bureautique...)',
-      key: NeedsType.baseSkills,
+      key: NeedsTypes.baseSkills,
       icon: 'orientationIndex3',
     },
   ];
@@ -50,7 +50,7 @@ export class NeedsSelectionComponent implements OnInit {
   ngOnInit(): void {
     if (this.orientationService.rdvUser || this.orientationService.rdvStructure) {
       this.needsList = this.needsList.filter(
-        (item) => item.key === NeedsType.onlineDemarch || item.key === NeedsType.baseSkills,
+        (item) => item.key === NeedsTypes.onlineDemarch || item.key === NeedsTypes.baseSkills,
       );
     }
 
@@ -73,7 +73,7 @@ export class NeedsSelectionComponent implements OnInit {
   }
 
   public selectNeed(event: string): void {
-    this.needTypeChange.emit(event as NeedsType);
+    this.needTypeChange.emit(event as NeedsTypes);
     this.validate.emit();
   }
 }
diff --git a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.ts b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.ts
index 5e1d53846..690297db9 100644
--- a/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/online-demarch-common/accompaniment-type/accompaniment-type.component.ts
@@ -1,7 +1,7 @@
 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
 import { UntypedFormGroup } from '@angular/forms';
 import { INeedItem } from '../../../../../utils/orientationUtils';
-import { OnlineDemarche } from '../../../enums/orientation.enums';
+import { AccompanimentTypes } from '../../../enums/orientation.enums';
 
 @Component({
   selector: 'app-accompaniment-type',
@@ -16,17 +16,17 @@ export class AccompanimentTypeComponent implements OnInit {
     {
       title: "Trouver une structure proposant l'accompagnement adapté",
       hint: 'La personne pourra prendre contact avec la structure ou s’y rendre directement',
-      key: OnlineDemarche.structureList,
+      key: AccompanimentTypes.structuresList,
     },
     {
       title: 'Demander un rendez-vous auprès d’un·e accompagnant·e numérique',
       hint: 'Les coordonnées de la personne seront transmises à l’accompagnant·e',
-      key: OnlineDemarche.appointment,
+      key: AccompanimentTypes.appointment,
     },
     {
       title: 'Choisir un créneau de médiation numérique à distance',
       hint: 'La personne sera recontactée par téléphone sur le créneau de son choix',
-      key: OnlineDemarche.onlineMediation,
+      key: AccompanimentTypes.onlineMediation,
     },
   ];
   ngOnInit(): void {
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
index f1f0c9ba5..2e0f46f39 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
@@ -1,13 +1,13 @@
 <!-- COMMON FORM -->
 <ng-container *ngIf="currentType === OnlineDemarche.common">
   <app-online-demarch
-    *ngIf="needType === NeedsType.onlineDemarch && currentStep === CommonSteps.filtersChoice"
+    *ngIf="needType === NeedsTypes.onlineDemarch && currentStep === CommonSteps.filtersChoice"
     [form]="form"
     [filtersForm]="filtersForm"
     (checkValidation)="checkValidation()"
   />
   <app-base-skills
-    *ngIf="needType === NeedsType.baseSkills && currentStep === CommonSteps.filtersChoice"
+    *ngIf="needType === NeedsTypes.baseSkills && currentStep === CommonSteps.filtersChoice"
     [filtersForm]="filtersForm"
     (checkValidation)="checkValidation()"
   />
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
index 0deb0d8e7..c4e11b78c 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
@@ -11,7 +11,7 @@ import {
   AccompanimentTypes,
   AppointmentSteps,
   CommonSteps,
-  NeedsType,
+  NeedsTypes,
   OnlineDemarche,
   OnlineMediationSteps,
   StructuresListSteps,
@@ -24,7 +24,7 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
   templateUrl: './onlineDemarch-form.component.html',
 })
 export class OnlineDemarchFormComponent {
-  @Input() needType: NeedsType;
+  @Input() needType: NeedsTypes;
   @Input() currentStep: OnlineMediationSteps | StructuresListSteps | AppointmentSteps | MediationStepType;
   @Input() currentType: OnlineDemarche | MediationType;
   @Input() form: UntypedFormGroup;
@@ -48,7 +48,7 @@ export class OnlineDemarchFormComponent {
   public StructuresListSteps = StructuresListSteps;
   public OnlineDemarche = OnlineDemarche;
   public OnlineDemarchesAppointmentSteps = AppointmentSteps;
-  public NeedsType = NeedsType;
+  public NeedsTypes = NeedsTypes;
   public AccompanimentTypes = AccompanimentTypes;
 
   constructor(public orientationService: OrientationService) {}
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index 26675d130..e5ac8ec8a 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -22,7 +22,7 @@ import {
   AppointmentSteps,
   CommonSteps,
   GenericOrientationSteps,
-  NeedsType,
+  NeedsTypes,
   OnlineDemarche,
   OnlineMediationSteps,
   StructuresListSteps,
@@ -65,11 +65,11 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   // Orientator
   public orientator: FormGroup<StructureOrientator>;
   // Enum
-  public needEnum = NeedsType;
+  public needEnum = NeedsTypes;
   public formType = formType;
   // Global
-  public needType: NeedsType;
-  public previousNeedType: NeedsType;
+  public needType: NeedsTypes;
+  public previousNeedType: NeedsTypes;
   public currentType: MediationType = OnlineDemarche.common;
   public currentStep: MediationStepType = null;
   public isPrevHidden = false;
@@ -221,7 +221,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   }
 
   public isOnlineDemarcheOrBaseSkills(): boolean {
-    return this.needType === NeedsType.onlineDemarch || this.needType === NeedsType.baseSkills;
+    return this.needType === NeedsTypes.onlineDemarch || this.needType === NeedsTypes.baseSkills;
   }
 
   private checkHiddenNavButtons(): void {
@@ -317,7 +317,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       case OnlineDemarche.appointment:
         this.currentType = OnlineDemarche.appointment;
         // Skip first screen appointment info for baseSkills
-        if (this.needType === NeedsType.baseSkills) {
+        if (this.needType === NeedsTypes.baseSkills) {
           this.currentStep = AppointmentSteps.infoScreen + 1;
           this.skipStructureOrientator(true);
         } else {
@@ -400,24 +400,24 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     // Handle filters form
     if (this.currentStepIs(GenericOrientationSteps.common, CommonSteps.filtersChoice)) {
       switch (this.needType) {
-        case NeedsType.equipmentAccess:
-          this.previousNeedType = NeedsType.equipmentAccess;
+        case NeedsTypes.equipmentAccess:
+          this.previousNeedType = NeedsTypes.equipmentAccess;
           this.setFilters('selfServiceMaterial');
           // Switch to structure list form
           this.setOnlineEquipmentsForm();
           return;
-        case NeedsType.equipmentBuy:
-          this.previousNeedType = NeedsType.equipmentBuy;
+        case NeedsTypes.equipmentBuy:
+          this.previousNeedType = NeedsTypes.equipmentBuy;
           this.setFilters('solidarityMaterial');
           // Switch to structure list form
           this.setOnlineEquipmentsForm();
           return;
-        case NeedsType.onlineDemarch:
-          this.previousNeedType = NeedsType.onlineDemarch;
+        case NeedsTypes.onlineDemarch:
+          this.previousNeedType = NeedsTypes.onlineDemarch;
           this.setFilters('onlineProcedures');
           break;
-        case NeedsType.baseSkills:
-          this.previousNeedType = NeedsType.baseSkills;
+        case NeedsTypes.baseSkills:
+          this.previousNeedType = NeedsTypes.baseSkills;
           this.setFilters('baseSkills');
       }
     }
@@ -572,7 +572,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       ) {
         this.currentStep--;
       }
-      if (this.needType === NeedsType.baseSkills && this.currentStep === AppointmentSteps.infoScreen + 1) {
+      if (this.needType === NeedsTypes.baseSkills && this.currentStep === AppointmentSteps.infoScreen + 1) {
         this.currentStep--;
       }
       if (this.currentStep === AppointmentSteps.carto) {
@@ -679,15 +679,15 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     return targetStructures;
   }
 
-  private displayTextNeedType(needType: NeedsType): string {
+  private displayTextNeedType(needType: NeedsTypes): string {
     switch (needType) {
-      case NeedsType.equipmentAccess:
+      case NeedsTypes.equipmentAccess:
         return 'accès matériel';
-      case NeedsType.equipmentBuy:
+      case NeedsTypes.equipmentBuy:
         return 'achat matériel';
-      case NeedsType.onlineDemarch:
+      case NeedsTypes.onlineDemarch:
         return 'démarche en ligne';
-      case NeedsType.baseSkills:
+      case NeedsTypes.baseSkills:
         return 'compétences';
       default:
         return '';
diff --git a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
index 1394f20b6..38aca848a 100644
--- a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
+++ b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
@@ -4,7 +4,7 @@ import { Structure } from '../../../models/structure.model';
 import { User } from '../../../models/user.model';
 import { Filter } from '../../../structure-list/models/filter.model';
 import { OrientationUtils } from '../../../utils/orientationUtils';
-import { AccompanimentTypes, CommonSteps, NeedsType, StructuresListSteps } from '../enums/orientation.enums';
+import { AccompanimentTypes, CommonSteps, NeedsTypes, StructuresListSteps } from '../enums/orientation.enums';
 import { MediationStepType } from '../types/orientation.types';
 
 @Component({
@@ -12,7 +12,7 @@ import { MediationStepType } from '../types/orientation.types';
   templateUrl: './orientation-structure-list.component.html',
 })
 export class OrientationStructureListComponent implements OnChanges {
-  @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType | NeedsType;
+  @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType | NeedsTypes;
   @Input() profile: User;
   @Input() form: UntypedFormGroup;
   @Input() filters: Filter[] = [];
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index 557367fa7..8009c9aea 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -1,10 +1,10 @@
 import { FormControl, FormGroup, UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';
 import { structureFormStep } from '../form/form-view/structure-form/structureFormStep.enum';
 import {
+  AccompanimentTypes,
   AppointmentSteps,
   CommonSteps,
-  NeedsType,
-  OnlineDemarche,
+  NeedsTypes,
   OnlineMediationSteps,
   StructuresListSteps,
 } from '../form/orientation-form-view/enums/orientation.enums';
@@ -29,7 +29,7 @@ export interface IStructureSummary {
 export interface INeedItem {
   title: string;
   hint: string;
-  key: NeedsType | OnlineDemarche;
+  key: NeedsTypes | AccompanimentTypes;
   icon?: string;
 }
 export class OrientationUtils {
-- 
GitLab


From 2bc9c1a1f610b86e8dcf254ad25af9de96f79a61 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Tue, 13 Aug 2024 15:51:34 +0200
Subject: [PATCH 14/23] Removed confusing OnlineDemarche

---
 .../enums/orientation.enums.ts                |   7 -
 .../equipment-access.component.html           |   4 +-
 .../equipment-access.component.ts             |   6 +-
 .../equipment-buy.component.html              |   4 +-
 .../equipment-buy/equipment-buy.component.ts  |   6 +-
 .../information-screen.component.html         |   4 +-
 .../information-screen.component.ts           |   6 +-
 .../navigation/navigation.component.ts        |   5 +-
 .../onlineDemarch-form.component.html         | 267 +++++++++---------
 .../onlineDemarch-form.component.ts           |  43 +--
 .../orientation-form-view.component.html      |   8 +-
 .../orientation-form-view.component.ts        |  96 ++++---
 .../types/orientation.types.ts                |   4 +-
 13 files changed, 239 insertions(+), 221 deletions(-)

diff --git a/src/app/form/orientation-form-view/enums/orientation.enums.ts b/src/app/form/orientation-form-view/enums/orientation.enums.ts
index 9ea791a4d..d59f37299 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -17,13 +17,6 @@ export enum AccompanimentTypes {
   onlineMediation = 'Médiation Numérique à distance',
 }
 
-export enum OnlineDemarche {
-  common = 'Common',
-  structureList = 'Trouver une structure',
-  appointment = 'RDV Conseiller Numérique',
-  onlineMediation = 'Médiation Numérique à distance',
-}
-
 /**
  * We are either in the common first steps (filtersChoice, accompanimentChoice),
  * or in the accompaniment tunnel (either a structuresList, an appointment, or
diff --git a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html
index 15fbac437..516739745 100644
--- a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html
+++ b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.html
@@ -1,10 +1,10 @@
 <app-equipment-access-choice
-  *ngIf="currentType === GenericOrientationSteps.common"
+  *ngIf="genericStep === GenericOrientationSteps.common"
   [filtersForm]="filtersForm"
   (checkValidation)="checkValidation()"
 />
 <app-orientation-structure-list
-  *ngIf="currentType === GenericOrientationSteps.accompanimentTunnel"
+  *ngIf="genericStep === GenericOrientationSteps.accompanimentTunnel"
   [currentStep]="currentStep"
   [form]="orientationForm"
   [filters]="filters"
diff --git a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
index bfbc440b5..3cfc308b1 100644
--- a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
+++ b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
@@ -6,7 +6,7 @@ import { OrientationUtils } from '../../../utils/orientationUtils';
 import { CommonSteps, GenericOrientationSteps, StructuresListSteps } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
 import { StructureOrientationForm } from '../interfaces/structureOrientationForm.interface';
-import { MediationStepType, MediationType } from '../types/orientation.types';
+import { MediationStepType } from '../types/orientation.types';
 
 @Component({
   selector: 'app-equipment-access',
@@ -14,7 +14,7 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
 })
 export class EquipmentAccessComponent {
   @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType;
-  @Input() currentType: GenericOrientationSteps | MediationType;
+  @Input() genericStep: GenericOrientationSteps;
   @Input() filtersForm: FormGroup<FiltersForm>;
   @Input() orientationForm: FormGroup<StructureOrientationForm>;
   @Input() filters: Filter[] = [];
@@ -28,7 +28,7 @@ export class EquipmentAccessComponent {
   public GenericOrientationSteps = GenericOrientationSteps;
 
   public checkValidation(): void {
-    switch (this.currentType) {
+    switch (this.genericStep) {
       case GenericOrientationSteps.common:
         this.orientationUtils.setValidationsEquipmentForm(
           this.pagesValidation,
diff --git a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html
index 1214021f3..e5e8a9aaa 100644
--- a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html
+++ b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.html
@@ -1,10 +1,10 @@
 <app-equipment-buy-type
-  *ngIf="currentType === GenericOrientationSteps.common"
+  *ngIf="genericStep === GenericOrientationSteps.common"
   [filtersForm]="filtersForm"
   (checkValidation)="checkValidation()"
 />
 <app-orientation-structure-list
-  *ngIf="currentType === GenericOrientationSteps.accompanimentTunnel"
+  *ngIf="genericStep === GenericOrientationSteps.accompanimentTunnel"
   [form]="orientationForm"
   [currentStep]="currentStep"
   [filters]="filters"
diff --git a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
index eeb88782a..1a3adc829 100644
--- a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
+++ b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
@@ -6,7 +6,7 @@ import { OrientationUtils } from '../../../utils/orientationUtils';
 import { CommonSteps, GenericOrientationSteps, StructuresListSteps } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
 import { StructureOrientationForm } from '../interfaces/structureOrientationForm.interface';
-import { MediationStepType, MediationType } from '../types/orientation.types';
+import { MediationStepType } from '../types/orientation.types';
 
 @Component({
   selector: 'app-equipment-buy',
@@ -14,7 +14,7 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
 })
 export class EquipmentBuyComponent {
   @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType;
-  @Input() currentType: GenericOrientationSteps | MediationType;
+  @Input() genericStep: GenericOrientationSteps;
   @Input() filtersForm: FormGroup<FiltersForm>;
   @Input() orientationForm: FormGroup<StructureOrientationForm>;
   @Input() filters: Filter[] = [];
@@ -28,7 +28,7 @@ export class EquipmentBuyComponent {
   public GenericOrientationSteps = GenericOrientationSteps;
 
   public checkValidation(): void {
-    switch (this.currentType) {
+    switch (this.genericStep) {
       case GenericOrientationSteps.common:
         this.orientationUtils.setValidationsEquipmentForm(
           this.pagesValidation,
diff --git a/src/app/form/orientation-form-view/global-components/information-screen/information-screen.component.html b/src/app/form/orientation-form-view/global-components/information-screen/information-screen.component.html
index 6d9cd7560..3050064bd 100644
--- a/src/app/form/orientation-form-view/global-components/information-screen/information-screen.component.html
+++ b/src/app/form/orientation-form-view/global-components/information-screen/information-screen.component.html
@@ -1,6 +1,6 @@
 <div class="container">
   <img src="../../../../../assets/img/orientationBeginning.svg" alt="" />
-  <ng-container *ngIf="currentType === currentTypeEnum.appointment">
+  <ng-container *ngIf="accompanimentType === AccompanimentTypes.appointment">
     <h2>Vous vous apprêtez à demander un rendez-vous auprès d'un·e accompagnant·e numérique</h2>
     <p>
       Ces professionnel·les peuvent aider à la prise en main des services administratifs en ligne, mais ne sont pas
@@ -8,7 +8,7 @@
       de l’orienter vers un lieu du type “Maison France Service”.
     </p>
   </ng-container>
-  <ng-container *ngIf="currentType === currentTypeEnum.onlineMediation">
+  <ng-container *ngIf="accompanimentType === AccompanimentTypes.onlineMediation">
     <h2>Vous vous apprêtez à choisir un créneau de médiation numérique à distance</h2>
     <p>
       Ce service d’accompagnement permettra à la personne d'être assistée depuis son domicile dans ses usages
diff --git a/src/app/form/orientation-form-view/global-components/information-screen/information-screen.component.ts b/src/app/form/orientation-form-view/global-components/information-screen/information-screen.component.ts
index 0c27c30d0..ccb5a6b2a 100644
--- a/src/app/form/orientation-form-view/global-components/information-screen/information-screen.component.ts
+++ b/src/app/form/orientation-form-view/global-components/information-screen/information-screen.component.ts
@@ -1,5 +1,5 @@
 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import { OnlineDemarche } from '../../enums/orientation.enums';
+import { AccompanimentTypes } from '../../enums/orientation.enums';
 
 @Component({
   selector: 'app-information-screen',
@@ -7,10 +7,10 @@ import { OnlineDemarche } from '../../enums/orientation.enums';
   styleUrls: ['./information-screen.component.scss'],
 })
 export class InformationScreenComponent implements OnInit {
-  @Input() currentType: OnlineDemarche;
+  @Input() accompanimentType: AccompanimentTypes;
   @Output() checkValidation = new EventEmitter<boolean>();
 
-  public currentTypeEnum = OnlineDemarche;
+  public AccompanimentTypes = AccompanimentTypes;
 
   ngOnInit(): void {
     this.checkValidation.emit();
diff --git a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
index 16f3c1759..595ef91fa 100644
--- a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
+++ b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
@@ -1,8 +1,8 @@
 import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core';
 import { Router } from '@angular/router';
 import { ButtonComponent } from '../../../../shared/components';
-import { NeedsTypes, OnlineDemarche } from '../../enums/orientation.enums';
-import { MediationStepType, MediationType } from '../../types/orientation.types';
+import { NeedsTypes } from '../../enums/orientation.enums';
+import { MediationStepType } from '../../types/orientation.types';
 
 @Component({
   selector: 'app-navigation',
@@ -11,7 +11,6 @@ import { MediationStepType, MediationType } from '../../types/orientation.types'
 })
 export class NavigationComponent {
   @Input() currentStep: MediationStepType;
-  @Input() currentType: OnlineDemarche | MediationType;
   @Input() isPageValid: boolean;
   @Input() needType: NeedsTypes;
   @Input() isPrevHidden = false;
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
index 2e0f46f39..af68fe523 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
@@ -1,5 +1,5 @@
 <!-- COMMON FORM -->
-<ng-container *ngIf="currentType === OnlineDemarche.common">
+<ng-container *ngIf="genericStep === GenericOrientationSteps.common">
   <app-online-demarch
     *ngIf="needType === NeedsTypes.onlineDemarch && currentStep === CommonSteps.filtersChoice"
     [form]="form"
@@ -17,139 +17,144 @@
     (checkValidation)="checkValidation()"
   />
 </ng-container>
-<!-- APPOINTMENT FORM -->
-<ng-container *ngIf="currentType === OnlineDemarche.appointment">
-  <app-information-screen
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.infoScreen"
-    [currentType]="currentType"
-    (checkValidation)="checkValidation()"
-  />
-  <app-structure-pmr
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.pmrAccess"
-    [structureForm]="form"
-    (validateForm)="checkValidation()"
-    (radioChange)="onRadioChange($event)"
-  />
-  <app-orientation-structure-address
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.location"
+
+<ng-container *ngIf="genericStep === GenericOrientationSteps.accompanimentTunnel">
+  <!-- STRUCTURE LIST FORM -->
+  <app-orientation-structure-list
+    *ngIf="accompanimentType === AccompanimentTypes.structuresList"
     [form]="form"
-    (addressStructure)="checkValidation()"
-  />
-  <app-carto
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.carto"
-    [isOrientationForm]="true"
-    [isOrientationRdv]="true"
+    [currentStep]="currentStep"
     [filters]="filters"
-    [userLongitude]="form.get('address').value?.coordinates[0]"
-    [userLatitude]="form.get('address').value?.coordinates[1]"
-    (structureSelectionRDV)="checkValidation($event)"
-  />
-  <app-make-appointment
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.makeAppointment"
-    [form]="form"
-    [structureRDV]="structureRDV"
-    (checkValidation)="checkValidation()"
-    (socialWorker)="getSocialWorker($event)"
-    (selectedStructureRDV)="getSelectedStructureRDV($event)"
-    (failedOrientation)="setFailedOrientation()"
-  />
-  <app-mediation-beneficiary-info
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.mediationBeneficiaryInfo"
-    [form]="form"
-    [isOrientationRdv]="true"
-    (checkValidation)="checkValidation()"
-  />
-  <app-structure-orientator
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.structureOrientator"
     [profile]="profile"
-    [form]="form"
     (validatePage)="checkValidation()"
   />
-  <app-orientation-recap
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.orientationRecap"
-    [form]="form"
-    [accompanimentType]="AccompanimentTypes.appointment"
-    [socialWorker]="socialWorker"
-    [structureRDV]="structureRDV"
-    [isToPrint]="false"
-    (checkValidation)="checkValidation()"
-  />
-  <app-appointment-end
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.rdvEnd"
-    [form]="form"
-    [structureRDV]="structureRDV"
-    [selectedStructureRDV]="selectedStructureRDV"
-    [socialWorker]="socialWorker"
-    (checkValidation)="checkValidation()"
-  />
-  <app-orientation-recap
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.orientationPrint"
-    [form]="form"
-    [accompanimentType]="AccompanimentTypes.appointment"
-    [socialWorker]="socialWorker"
-    [structureRDV]="structureRDV"
-    (checkValidation)="checkValidation()"
-  />
-</ng-container>
-<!-- ONLINE MEDIATION FORM -->
-<ng-container *ngIf="currentType === OnlineDemarche.onlineMediation">
-  <app-information-screen
-    *ngIf="currentStep === OnlineMediationSteps.infoScreen"
-    [currentType]="currentType"
-    (checkValidation)="checkValidation()"
-  />
-  <app-mediation-beneficiary-info
-    *ngIf="currentStep === OnlineMediationSteps.mediationBeneficiaryInfo"
-    [form]="form"
-    (checkValidation)="checkValidation()"
-  />
-  <app-mediation-hours-selection
-    *ngIf="currentStep === OnlineMediationSteps.mediationHoursSelection"
-    [form]="form"
-    (checkValidation)="checkValidation()"
-  />
-  <app-mediation-language-selection
-    *ngIf="currentStep === OnlineMediationSteps.mediationLanguageSelection"
-    [form]="form"
-    (checkValidation)="checkValidation()"
-  />
-  <app-orientation-comments
-    *ngIf="currentStep === OnlineMediationSteps.comments"
-    [form]="form"
-    (checkValidation)="checkValidation()"
-  />
-  <app-structure-orientator
-    *ngIf="currentStep === OnlineMediationSteps.structureOrientator"
-    [profile]="profile"
-    [form]="form"
-    (validatePage)="checkValidation()"
-  />
-  <app-orientation-recap
-    *ngIf="currentStep === OnlineMediationSteps.orientationRecap"
-    [form]="form"
-    [accompanimentType]="AccompanimentTypes.onlineMediation"
-    [isToPrint]="false"
-    (checkValidation)="checkValidation()"
-  />
-  <app-appointment-end
-    *ngIf="currentStep === OnlineMediationSteps.rdvEnd"
-    [form]="form"
-    [isOnlineMediation]="true"
-    (checkValidation)="checkValidation()"
-  />
-  <app-orientation-recap
-    *ngIf="currentStep === OnlineMediationSteps.orientationPrint"
-    [form]="form"
-    [accompanimentType]="AccompanimentTypes.onlineMediation"
-    (checkValidation)="checkValidation()"
-  />
+
+  <!-- APPOINTMENT FORM -->
+  <ng-container *ngIf="accompanimentType === AccompanimentTypes.appointment">
+    <app-information-screen
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.infoScreen"
+      [accompanimentType]="accompanimentType"
+      (checkValidation)="checkValidation()"
+    />
+    <app-structure-pmr
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.pmrAccess"
+      [structureForm]="form"
+      (validateForm)="checkValidation()"
+      (radioChange)="onRadioChange($event)"
+    />
+    <app-orientation-structure-address
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.location"
+      [form]="form"
+      (addressStructure)="checkValidation()"
+    />
+    <app-carto
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.carto"
+      [isOrientationForm]="true"
+      [isOrientationRdv]="true"
+      [filters]="filters"
+      [userLongitude]="form.get('address').value?.coordinates[0]"
+      [userLatitude]="form.get('address').value?.coordinates[1]"
+      (structureSelectionRDV)="checkValidation($event)"
+    />
+    <app-make-appointment
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.makeAppointment"
+      [form]="form"
+      [structureRDV]="structureRDV"
+      (checkValidation)="checkValidation()"
+      (socialWorker)="getSocialWorker($event)"
+      (selectedStructureRDV)="getSelectedStructureRDV($event)"
+      (failedOrientation)="setFailedOrientation()"
+    />
+    <app-mediation-beneficiary-info
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.mediationBeneficiaryInfo"
+      [form]="form"
+      [isOrientationRdv]="true"
+      (checkValidation)="checkValidation()"
+    />
+    <app-structure-orientator
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.structureOrientator"
+      [profile]="profile"
+      [form]="form"
+      (validatePage)="checkValidation()"
+    />
+    <app-orientation-recap
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.orientationRecap"
+      [form]="form"
+      [accompanimentType]="AccompanimentTypes.appointment"
+      [socialWorker]="socialWorker"
+      [structureRDV]="structureRDV"
+      [isToPrint]="false"
+      (checkValidation)="checkValidation()"
+    />
+    <app-appointment-end
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.rdvEnd"
+      [form]="form"
+      [structureRDV]="structureRDV"
+      [selectedStructureRDV]="selectedStructureRDV"
+      [socialWorker]="socialWorker"
+      (checkValidation)="checkValidation()"
+    />
+    <app-orientation-recap
+      *ngIf="currentStep === OnlineDemarchesAppointmentSteps.orientationPrint"
+      [form]="form"
+      [accompanimentType]="AccompanimentTypes.appointment"
+      [socialWorker]="socialWorker"
+      [structureRDV]="structureRDV"
+      (checkValidation)="checkValidation()"
+    />
+  </ng-container>
+
+  <!-- ONLINE MEDIATION FORM -->
+  <ng-container *ngIf="accompanimentType === AccompanimentTypes.onlineMediation">
+    <app-information-screen
+      *ngIf="currentStep === OnlineMediationSteps.infoScreen"
+      [accompanimentType]="accompanimentType"
+      (checkValidation)="checkValidation()"
+    />
+    <app-mediation-beneficiary-info
+      *ngIf="currentStep === OnlineMediationSteps.mediationBeneficiaryInfo"
+      [form]="form"
+      (checkValidation)="checkValidation()"
+    />
+    <app-mediation-hours-selection
+      *ngIf="currentStep === OnlineMediationSteps.mediationHoursSelection"
+      [form]="form"
+      (checkValidation)="checkValidation()"
+    />
+    <app-mediation-language-selection
+      *ngIf="currentStep === OnlineMediationSteps.mediationLanguageSelection"
+      [form]="form"
+      (checkValidation)="checkValidation()"
+    />
+    <app-orientation-comments
+      *ngIf="currentStep === OnlineMediationSteps.comments"
+      [form]="form"
+      (checkValidation)="checkValidation()"
+    />
+    <app-structure-orientator
+      *ngIf="currentStep === OnlineMediationSteps.structureOrientator"
+      [profile]="profile"
+      [form]="form"
+      (validatePage)="checkValidation()"
+    />
+    <app-orientation-recap
+      *ngIf="currentStep === OnlineMediationSteps.orientationRecap"
+      [form]="form"
+      [accompanimentType]="AccompanimentTypes.onlineMediation"
+      [isToPrint]="false"
+      (checkValidation)="checkValidation()"
+    />
+    <app-appointment-end
+      *ngIf="currentStep === OnlineMediationSteps.rdvEnd"
+      [form]="form"
+      [isOnlineMediation]="true"
+      (checkValidation)="checkValidation()"
+    />
+    <app-orientation-recap
+      *ngIf="currentStep === OnlineMediationSteps.orientationPrint"
+      [form]="form"
+      [accompanimentType]="AccompanimentTypes.onlineMediation"
+      (checkValidation)="checkValidation()"
+    />
+  </ng-container>
 </ng-container>
-<!-- STRUCTURE LIST FORM -->
-<app-orientation-structure-list
-  *ngIf="currentType === OnlineDemarche.structureList"
-  [form]="form"
-  [currentStep]="currentStep"
-  [filters]="filters"
-  [profile]="profile"
-  (validatePage)="checkValidation()"
-/>
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
index c4e11b78c..2bad8c580 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
@@ -11,13 +11,13 @@ import {
   AccompanimentTypes,
   AppointmentSteps,
   CommonSteps,
+  GenericOrientationSteps,
   NeedsTypes,
-  OnlineDemarche,
   OnlineMediationSteps,
   StructuresListSteps,
 } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
-import { MediationStepType, MediationType } from '../types/orientation.types';
+import { MediationStepType } from '../types/orientation.types';
 
 @Component({
   selector: 'app-online-demarch-form',
@@ -26,7 +26,8 @@ import { MediationStepType, MediationType } from '../types/orientation.types';
 export class OnlineDemarchFormComponent {
   @Input() needType: NeedsTypes;
   @Input() currentStep: OnlineMediationSteps | StructuresListSteps | AppointmentSteps | MediationStepType;
-  @Input() currentType: OnlineDemarche | MediationType;
+  @Input() genericStep: GenericOrientationSteps;
+  @Input() accompanimentType: AccompanimentTypes;
   @Input() form: UntypedFormGroup;
   @Input() filters: Filter[] = [];
   @Input() filtersForm: FormGroup<FiltersForm>;
@@ -43,28 +44,30 @@ export class OnlineDemarchFormComponent {
   public socialWorker: Owner;
 
   // Enums
-  public OnlineMediationSteps = OnlineMediationSteps;
+  public GenericOrientationSteps = GenericOrientationSteps;
+  public NeedsTypes = NeedsTypes;
+  public AccompanimentTypes = AccompanimentTypes;
   public CommonSteps = CommonSteps;
   public StructuresListSteps = StructuresListSteps;
-  public OnlineDemarche = OnlineDemarche;
   public OnlineDemarchesAppointmentSteps = AppointmentSteps;
-  public NeedsTypes = NeedsTypes;
-  public AccompanimentTypes = AccompanimentTypes;
+  public OnlineMediationSteps = OnlineMediationSteps;
 
   constructor(public orientationService: OrientationService) {}
 
   public checkValidation(event?: any): void {
-    switch (this.currentType) {
-      case OnlineDemarche.common:
-        this.orientationUtils.setValidationsOnlineDemarchesForm(
-          this.pagesValidation,
-          this.filtersForm,
-          this.form,
-          (isValid) => this.validatePage.emit(isValid),
-          this.currentStep as CommonSteps,
-        );
-        break;
-      case OnlineDemarche.structureList:
+    if (this.genericStep === GenericOrientationSteps.common) {
+      this.orientationUtils.setValidationsOnlineDemarchesForm(
+        this.pagesValidation,
+        this.filtersForm,
+        this.form,
+        (isValid) => this.validatePage.emit(isValid),
+        this.currentStep as CommonSteps,
+      );
+      return;
+    }
+
+    switch (this.accompanimentType) {
+      case AccompanimentTypes.structuresList:
         this.orientationUtils.setValidationsStructuresForm(
           this.pagesValidation,
           this.form,
@@ -72,7 +75,7 @@ export class OnlineDemarchFormComponent {
           this.currentStep as StructuresListSteps,
         );
         break;
-      case OnlineDemarche.appointment:
+      case AccompanimentTypes.appointment:
         if (this.currentStep === AppointmentSteps.carto - 1) {
           // if rdv from structure details, don't reinit the structureRDV variable
           if (!this.orientationService.rdvStructure) this.structureRDV = null;
@@ -89,7 +92,7 @@ export class OnlineDemarchFormComponent {
           this.currentStep as AppointmentSteps,
         );
         break;
-      case OnlineDemarche.onlineMediation:
+      case AccompanimentTypes.onlineMediation:
         this.orientationUtils.setValidationsOnlineMediationForm(
           this.pagesValidation,
           this.form,
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html
index 65ce1516b..10fdd94b7 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.html
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.html
@@ -10,7 +10,7 @@
       <app-equipment-access
         *ngIf="needType === needEnum.equipmentAccess"
         [currentStep]="currentStep"
-        [currentType]="currentType"
+        [genericStep]="genericStep"
         [filtersForm]="filtersForm"
         [orientationForm]="structureOrientationForm"
         [filters]="filters"
@@ -20,7 +20,7 @@
       <app-equipment-buy
         *ngIf="needType === needEnum.equipmentBuy"
         [currentStep]="currentStep"
-        [currentType]="currentType"
+        [genericStep]="genericStep"
         [filtersForm]="filtersForm"
         [orientationForm]="structureOrientationForm"
         [filters]="filters"
@@ -31,7 +31,8 @@
         *ngIf="isOnlineDemarcheOrBaseSkills()"
         [needType]="needType"
         [currentStep]="currentStep"
-        [currentType]="currentType"
+        [genericStep]="genericStep"
+        [accompanimentType]="accompanimentType"
         [form]="onlineDemarcheForm"
         [filters]="filters"
         [filtersForm]="filtersForm"
@@ -50,7 +51,6 @@
     [isNextHidden]="isNextHidden"
     [isLastStep]="isLastStep"
     [needType]="needType"
-    [currentType]="currentType"
     [isPageValid]="isPageValid"
     [failedOrientation]="failedOrientation"
     (goNext)="nextPage()"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index e5ac8ec8a..83cc4d876 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -19,11 +19,11 @@ import { OrientationUtils } from '../../utils/orientationUtils';
 import { CanExitResolver, Utils } from '../../utils/utils';
 import { formType } from '../form-view/formType.enum';
 import {
+  AccompanimentTypes,
   AppointmentSteps,
   CommonSteps,
   GenericOrientationSteps,
   NeedsTypes,
-  OnlineDemarche,
   OnlineMediationSteps,
   StructuresListSteps,
 } from './enums/orientation.enums';
@@ -38,7 +38,7 @@ import {
 } from './interfaces/orientationIndicator.interface';
 import { StructureOrientationForm } from './interfaces/structureOrientationForm.interface';
 import { StructureOrientator } from './interfaces/structureOrientator.interface';
-import { MediationStepType, MediationType } from './types/orientation.types';
+import { MediationStepType } from './types/orientation.types';
 
 @Component({
   selector: 'app-orientation-form-view',
@@ -58,7 +58,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   public utils = new Utils();
   // OnlineDemarches
   public onlineDemarcheForm: UntypedFormGroup;
-  public onlineDemarcheType: OnlineDemarche;
+  public onlineDemarcheType: string;
   // Equipments
   public filtersForm: FormGroup<FiltersForm>;
   public structureOrientationForm: FormGroup<StructureOrientationForm>;
@@ -70,7 +70,8 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   // Global
   public needType: NeedsTypes;
   public previousNeedType: NeedsTypes;
-  public currentType: MediationType = OnlineDemarche.common;
+  public genericStep: GenericOrientationSteps = GenericOrientationSteps.common;
+  public accompanimentType: AccompanimentTypes;
   public currentStep: MediationStepType = null;
   public isPrevHidden = false;
   public isNextHidden = false;
@@ -216,8 +217,19 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.nbSteps = enumLength / 2;
   }
 
-  private currentStepIs(orientationType: MediationType, orientationStep: MediationStepType): boolean {
-    return this.currentType === orientationType && this.currentStep === orientationStep;
+  private commonStepIs(step: CommonSteps): boolean {
+    return this.genericStep === GenericOrientationSteps.common && this.currentStep === step;
+  }
+
+  private tunnelingStepIs(
+    accompanimentType: AccompanimentTypes,
+    step: StructuresListSteps | AppointmentSteps | OnlineMediationSteps,
+  ): boolean {
+    return (
+      this.genericStep === GenericOrientationSteps.accompanimentTunnel &&
+      this.accompanimentType === accompanimentType &&
+      this.currentStep === step
+    );
   }
 
   public isOnlineDemarcheOrBaseSkills(): boolean {
@@ -228,24 +240,27 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     // Only needs to hide in appointment / online mediation
     if (!this.isOnlineDemarcheOrBaseSkills()) return;
 
-    const isCartoStep = this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd);
-    const isAppointmentSuccess = this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd);
-    const isOnlineMediationSuccess = this.currentStepIs(OnlineDemarche.onlineMediation, OnlineMediationSteps.rdvEnd);
+    const isCartoStep = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd);
+    const isAppointmentSuccess = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd);
+    const isOnlineMediationSuccess = this.tunnelingStepIs(
+      AccompanimentTypes.onlineMediation,
+      OnlineMediationSteps.rdvEnd,
+    );
     this.isPrevHidden = isAppointmentSuccess || isOnlineMediationSuccess;
     this.isNextHidden = isCartoStep;
   }
 
   public checkLastStep(): void {
-    const isStructureListOrientationRecap = this.currentStepIs(
-      OnlineDemarche.structureList,
+    const isStructureListOrientationRecap = this.tunnelingStepIs(
+      AccompanimentTypes.structuresList,
       StructuresListSteps.orientationRecap,
     );
-    const isAppointmentOrientationRecap = this.currentStepIs(
-      OnlineDemarche.appointment,
+    const isAppointmentOrientationRecap = this.tunnelingStepIs(
+      AccompanimentTypes.appointment,
       AppointmentSteps.orientationPrint,
     );
-    const isOnlineMediationOrientationRecap = this.currentStepIs(
-      OnlineDemarche.onlineMediation,
+    const isOnlineMediationOrientationRecap = this.tunnelingStepIs(
+      AccompanimentTypes.onlineMediation,
       OnlineMediationSteps.orientationPrint,
     );
     this.isLastStep =
@@ -294,7 +309,8 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   }
 
   public setOnlineEquipmentsForm(): void {
-    this.currentType = OnlineDemarche.structureList;
+    this.genericStep = GenericOrientationSteps.accompanimentTunnel;
+    this.accompanimentType = AccompanimentTypes.structuresList;
     this.currentStep = StructuresListSteps.pmrAccess;
     // first filter screen + regular StructureList form
     this.setStepNumber(Object.keys(StructuresListSteps).length);
@@ -305,17 +321,18 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   }
 
   public setOnlineProceduresForm(): void {
+    this.genericStep = GenericOrientationSteps.accompanimentTunnel;
     switch (this.onlineDemarcheForm.get('accompanimentType').value) {
-      case OnlineDemarche.structureList:
-        this.currentType = OnlineDemarche.structureList;
+      case AccompanimentTypes.structuresList:
+        this.accompanimentType = AccompanimentTypes.structuresList;
         this.currentStep = StructuresListSteps.pmrAccess;
         this.setStepNumber(Object.keys(StructuresListSteps).length);
         this.onlineDemarcheForm = this.orientationUtils.createStructureOrientationForm(
           this.utils.convertFiltersToModule(this.filters),
         );
         break;
-      case OnlineDemarche.appointment:
-        this.currentType = OnlineDemarche.appointment;
+      case AccompanimentTypes.appointment:
+        this.accompanimentType = AccompanimentTypes.appointment;
         // Skip first screen appointment info for baseSkills
         if (this.needType === NeedsTypes.baseSkills) {
           this.currentStep = AppointmentSteps.infoScreen + 1;
@@ -326,8 +343,8 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         this.setStepNumber(Object.keys(AppointmentSteps).length);
         this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
         break;
-      case OnlineDemarche.onlineMediation:
-        this.currentType = OnlineDemarche.onlineMediation;
+      case AccompanimentTypes.onlineMediation:
+        this.accompanimentType = AccompanimentTypes.onlineMediation;
         this.currentStep = OnlineMediationSteps.infoScreen;
         this.setStepNumber(Object.keys(OnlineMediationSteps).length);
         this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
@@ -398,7 +415,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.isNextHidden = false;
 
     // Handle filters form
-    if (this.currentStepIs(GenericOrientationSteps.common, CommonSteps.filtersChoice)) {
+    if (this.commonStepIs(CommonSteps.filtersChoice)) {
       switch (this.needType) {
         case NeedsTypes.equipmentAccess:
           this.previousNeedType = NeedsTypes.equipmentAccess;
@@ -426,15 +443,15 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     if (this.isOnlineDemarcheOrBaseSkills()) {
       // If appointment coming from the carto, we, need to patch the user / structure info + skip step where we chose to get an appointment
       if (
-        this.currentStepIs(OnlineDemarche.common, CommonSteps.filtersChoice) &&
+        this.commonStepIs(CommonSteps.filtersChoice) &&
         (this.orientationService.rdvStructure || this.orientationService.rdvUser)
       ) {
-        this.onlineDemarcheForm.get('accompanimentType').patchValue(OnlineDemarche.appointment);
+        this.onlineDemarcheForm.get('accompanimentType').patchValue(AccompanimentTypes.appointment);
         this.currentStep++;
       }
 
       // If we are choosing the accompaniment type (findStructure / appointment / online mediation)
-      if (this.currentStepIs(OnlineDemarche.common, CommonSteps.accompanimentType)) {
+      if (this.commonStepIs(CommonSteps.accompanimentType)) {
         this.setOnlineProcedureFilters();
         this.setOnlineProceduresForm();
         this.previousNeedType = this.needType;
@@ -442,20 +459,20 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       }
 
       // If no multiple structures, skip orientator
-      if (this.currentStepIs(OnlineDemarche.onlineMediation, OnlineMediationSteps.structureOrientator - 1)) {
+      if (this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.structureOrientator - 1)) {
         this.skipStructureOrientator(true);
       }
       // Handle Online appointment
-      if (this.currentStepIs(OnlineDemarche.onlineMediation, OnlineMediationSteps.rdvEnd - 1)) {
+      if (this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.rdvEnd - 1)) {
         await this.handleOnlineAppointment();
       }
       // Handle last screen Online appointment and print
-      if (this.currentStepIs(OnlineDemarche.onlineMediation, OnlineMediationSteps.orientationPrint)) {
+      if (this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.orientationPrint)) {
         this.printForm();
         return;
       }
       // Handle last screen appointment
-      if (this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.rdvEnd - 1)) {
+      if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd - 1)) {
         try {
           await this.handleAppointment();
         } catch (e) {
@@ -468,7 +485,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
 
     // Structure list handling
-    if (this.currentType === OnlineDemarche.structureList) {
+    if (this.accompanimentType === AccompanimentTypes.structuresList) {
       // If no multiple structures, skip orientator
       if (this.currentStep === StructuresListSteps.structureOrientator - 1) {
         this.skipStructureOrientator(true);
@@ -490,7 +507,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
 
     // Appointment handling
-    if (this.currentType === OnlineDemarche.appointment) {
+    if (this.accompanimentType === AccompanimentTypes.appointment) {
       if (this.currentStep === AppointmentSteps.structureOrientator - 1) {
         this.skipStructureOrientator(true);
       }
@@ -527,7 +544,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
 
     if (
-      this.currentStepIs(OnlineDemarche.appointment, AppointmentSteps.pmrAccess - 1) &&
+      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess - 1) &&
       (this.orientationService.rdvStructure || this.orientationService.rdvUser)
     ) {
       if (this.orientationService.rdvStructure) {
@@ -552,7 +569,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
   public prevPage(): void {
     // Structure list previous page
-    if (this.currentType === OnlineDemarche.structureList) {
+    if (this.accompanimentType === AccompanimentTypes.structuresList) {
       if (this.currentStep === StructuresListSteps.structureChoice) {
         this.fullScreen = false;
       }
@@ -565,7 +582,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
 
     // Appointment previous page
-    if (this.currentType === OnlineDemarche.appointment) {
+    if (this.accompanimentType === AccompanimentTypes.appointment) {
       if (
         this.currentStep === AppointmentSteps.pmrAccess + 1 &&
         (this.orientationService.rdvStructure || this.orientationService.rdvUser)
@@ -597,7 +614,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     // Default case for first form step. If there was a previous form (like filterForm) we go back to this form
     if (this.currentStep === 0) {
       // If back to beginning of the form, reset
-      if (this.currentType === OnlineDemarche.common || !this.previousNeedType) {
+      if (this.genericStep === GenericOrientationSteps.common || !this.previousNeedType) {
         this.reset();
         return;
       }
@@ -605,7 +622,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       // Else, we are in middle of form, going back to choice of accompaniment type
       this.needType = this.previousNeedType;
       this.previousNeedType = null;
-      this.currentType = OnlineDemarche.common;
+      this.genericStep = GenericOrientationSteps.common;
       this.currentStep = CommonSteps.accompanimentType;
       if (this.isOnlineDemarcheOrBaseSkills()) {
         this.filtersForm = this.orientationUtils.createFiltersForm();
@@ -631,7 +648,8 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.onlineDemarcheType = undefined;
     this.filtersForm = this.orientationUtils.createFiltersForm();
     this.currentStep = null;
-    this.currentType = OnlineDemarche.common;
+    this.genericStep = GenericOrientationSteps.common;
+    this.accompanimentType = undefined;
     this.isPrevHidden = false;
     this.isNextHidden = false;
     this.isLastStep = false;
@@ -698,7 +716,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     const orientationType: OrientationIndicatorType = {
       typeOrientation: this.displayTextNeedType(this.needType),
       filtres: [],
-      typeAccompagnement: this.currentType,
+      typeAccompagnement: this.accompanimentType,
     };
     filters.forEach((filter) => {
       orientationType.filtres.push(filter.text);
diff --git a/src/app/form/orientation-form-view/types/orientation.types.ts b/src/app/form/orientation-form-view/types/orientation.types.ts
index 31719fe95..c7d457697 100644
--- a/src/app/form/orientation-form-view/types/orientation.types.ts
+++ b/src/app/form/orientation-form-view/types/orientation.types.ts
@@ -1,13 +1,13 @@
 import {
+  AccompanimentTypes,
   AppointmentSteps,
   CommonSteps,
   GenericOrientationSteps,
-  OnlineDemarche,
   OnlineMediationSteps,
   StructuresListSteps,
 } from '../enums/orientation.enums';
 
-export type MediationType = OnlineDemarche | GenericOrientationSteps;
+export type MediationType = GenericOrientationSteps | AccompanimentTypes;
 
 export type OrientationSteps = CommonSteps | StructuresListSteps | AppointmentSteps | OnlineMediationSteps;
 
-- 
GitLab


From 6957afadb4200285c3e0c8fb2cd9091fae8b73a0 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Wed, 14 Aug 2024 13:20:29 +0200
Subject: [PATCH 15/23] allOrientationSteps + structure orientator must valid
 itself when init + fixed the +3 steps issue

---
 .../equipment-access.component.ts             |   4 +-
 .../equipment-buy/equipment-buy.component.ts  |   4 +-
 .../navigation/navigation.component.ts        |   4 +-
 .../structure-orientator.component.ts         |   1 +
 .../onlineDemarch-form.component.ts           |   4 +-
 .../orientation-form-view.component.html      |   4 +-
 .../orientation-form-view.component.ts        | 222 ++++++++----------
 .../orientation-structure-list.component.ts   |   7 +-
 .../types/orientation.types.ts                |   4 +-
 9 files changed, 110 insertions(+), 144 deletions(-)

diff --git a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
index 3cfc308b1..f538bbdad 100644
--- a/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
+++ b/src/app/form/orientation-form-view/equipment-access/equipment-access.component.ts
@@ -6,14 +6,14 @@ import { OrientationUtils } from '../../../utils/orientationUtils';
 import { CommonSteps, GenericOrientationSteps, StructuresListSteps } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
 import { StructureOrientationForm } from '../interfaces/structureOrientationForm.interface';
-import { MediationStepType } from '../types/orientation.types';
+import { AllOrientationSteps } from '../types/orientation.types';
 
 @Component({
   selector: 'app-equipment-access',
   templateUrl: './equipment-access.component.html',
 })
 export class EquipmentAccessComponent {
-  @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType;
+  @Input() currentStep: AllOrientationSteps;
   @Input() genericStep: GenericOrientationSteps;
   @Input() filtersForm: FormGroup<FiltersForm>;
   @Input() orientationForm: FormGroup<StructureOrientationForm>;
diff --git a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
index 1a3adc829..2e1a7c8ec 100644
--- a/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
+++ b/src/app/form/orientation-form-view/equipment-buy/equipment-buy.component.ts
@@ -6,14 +6,14 @@ import { OrientationUtils } from '../../../utils/orientationUtils';
 import { CommonSteps, GenericOrientationSteps, StructuresListSteps } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
 import { StructureOrientationForm } from '../interfaces/structureOrientationForm.interface';
-import { MediationStepType } from '../types/orientation.types';
+import { AllOrientationSteps } from '../types/orientation.types';
 
 @Component({
   selector: 'app-equipment-buy',
   templateUrl: './equipment-buy.component.html',
 })
 export class EquipmentBuyComponent {
-  @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType;
+  @Input() currentStep: AllOrientationSteps;
   @Input() genericStep: GenericOrientationSteps;
   @Input() filtersForm: FormGroup<FiltersForm>;
   @Input() orientationForm: FormGroup<StructureOrientationForm>;
diff --git a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
index 595ef91fa..05758e934 100644
--- a/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
+++ b/src/app/form/orientation-form-view/global-components/navigation/navigation.component.ts
@@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, Output, ViewChild } from '@angular/core
 import { Router } from '@angular/router';
 import { ButtonComponent } from '../../../../shared/components';
 import { NeedsTypes } from '../../enums/orientation.enums';
-import { MediationStepType } from '../../types/orientation.types';
+import { AllOrientationSteps } from '../../types/orientation.types';
 
 @Component({
   selector: 'app-navigation',
@@ -10,7 +10,7 @@ import { MediationStepType } from '../../types/orientation.types';
   styleUrls: ['./navigation.component.scss'],
 })
 export class NavigationComponent {
-  @Input() currentStep: MediationStepType;
+  @Input() currentStep: AllOrientationSteps;
   @Input() isPageValid: boolean;
   @Input() needType: NeedsTypes;
   @Input() isPrevHidden = false;
diff --git a/src/app/form/orientation-form-view/global-components/structure-orientator/structure-orientator.component.ts b/src/app/form/orientation-form-view/global-components/structure-orientator/structure-orientator.component.ts
index c9bce5bad..55e12b573 100644
--- a/src/app/form/orientation-form-view/global-components/structure-orientator/structure-orientator.component.ts
+++ b/src/app/form/orientation-form-view/global-components/structure-orientator/structure-orientator.component.ts
@@ -37,6 +37,7 @@ export class StructureOrientatorComponent implements OnInit {
     } else {
       this.hasStructures = false;
     }
+    this.validatePage.emit(this.form.valid);
   }
 
   public select(structure: Structure): void {
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
index 2bad8c580..9076c8d04 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
@@ -17,7 +17,7 @@ import {
   StructuresListSteps,
 } from '../enums/orientation.enums';
 import { FiltersForm } from '../interfaces/filtersForm.interface';
-import { MediationStepType } from '../types/orientation.types';
+import { AllOrientationSteps } from '../types/orientation.types';
 
 @Component({
   selector: 'app-online-demarch-form',
@@ -25,7 +25,7 @@ import { MediationStepType } from '../types/orientation.types';
 })
 export class OnlineDemarchFormComponent {
   @Input() needType: NeedsTypes;
-  @Input() currentStep: OnlineMediationSteps | StructuresListSteps | AppointmentSteps | MediationStepType;
+  @Input() currentStep: AllOrientationSteps;
   @Input() genericStep: GenericOrientationSteps;
   @Input() accompanimentType: AccompanimentTypes;
   @Input() form: UntypedFormGroup;
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html
index 10fdd94b7..1893f6f97 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.html
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.html
@@ -8,7 +8,7 @@
     <app-needs-selection *ngIf="currentStep === null" [(needType)]="needType" (validate)="validatePage(true)" />
     <ng-container *ngIf="currentStep !== null">
       <app-equipment-access
-        *ngIf="needType === needEnum.equipmentAccess"
+        *ngIf="needType === NeedsTypes.equipmentAccess"
         [currentStep]="currentStep"
         [genericStep]="genericStep"
         [filtersForm]="filtersForm"
@@ -18,7 +18,7 @@
         (validatePage)="validatePage($event)"
       />
       <app-equipment-buy
-        *ngIf="needType === needEnum.equipmentBuy"
+        *ngIf="needType === NeedsTypes.equipmentBuy"
         [currentStep]="currentStep"
         [genericStep]="genericStep"
         [filtersForm]="filtersForm"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index 83cc4d876..e8564922a 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -38,7 +38,7 @@ import {
 } from './interfaces/orientationIndicator.interface';
 import { StructureOrientationForm } from './interfaces/structureOrientationForm.interface';
 import { StructureOrientator } from './interfaces/structureOrientator.interface';
-import { MediationStepType } from './types/orientation.types';
+import { AllOrientationSteps } from './types/orientation.types';
 
 @Component({
   selector: 'app-orientation-form-view',
@@ -58,21 +58,19 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   public utils = new Utils();
   // OnlineDemarches
   public onlineDemarcheForm: UntypedFormGroup;
-  public onlineDemarcheType: string;
   // Equipments
   public filtersForm: FormGroup<FiltersForm>;
   public structureOrientationForm: FormGroup<StructureOrientationForm>;
   // Orientator
   public orientator: FormGroup<StructureOrientator>;
   // Enum
-  public needEnum = NeedsTypes;
+  public NeedsTypes = NeedsTypes;
   public formType = formType;
   // Global
   public needType: NeedsTypes;
-  public previousNeedType: NeedsTypes;
   public genericStep: GenericOrientationSteps = GenericOrientationSteps.common;
   public accompanimentType: AccompanimentTypes;
-  public currentStep: MediationStepType = null;
+  public currentStep: AllOrientationSteps = null;
   public isPrevHidden = false;
   public isNextHidden = false;
   public isLastStep = false;
@@ -236,11 +234,15 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     return this.needType === NeedsTypes.onlineDemarch || this.needType === NeedsTypes.baseSkills;
   }
 
+  public isComingFromCartoOrRegistry(): boolean {
+    return Boolean(this.orientationService.rdvStructure || this.orientationService.rdvUser);
+  }
+
   private checkHiddenNavButtons(): void {
     // Only needs to hide in appointment / online mediation
     if (!this.isOnlineDemarcheOrBaseSkills()) return;
 
-    const isCartoStep = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd);
+    const isCartoStep = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto);
     const isAppointmentSuccess = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd);
     const isOnlineMediationSuccess = this.tunnelingStepIs(
       AccompanimentTypes.onlineMediation,
@@ -250,6 +252,12 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.isNextHidden = isCartoStep;
   }
 
+  private checkFullScreen(): void {
+    this.fullScreen =
+      this.tunnelingStepIs(AccompanimentTypes.structuresList, StructuresListSteps.structureChoice) ||
+      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto);
+  }
+
   public checkLastStep(): void {
     const isStructureListOrientationRecap = this.tunnelingStepIs(
       AccompanimentTypes.structuresList,
@@ -333,13 +341,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         break;
       case AccompanimentTypes.appointment:
         this.accompanimentType = AccompanimentTypes.appointment;
-        // Skip first screen appointment info for baseSkills
-        if (this.needType === NeedsTypes.baseSkills) {
-          this.currentStep = AppointmentSteps.infoScreen + 1;
-          this.skipStructureOrientator(true);
-        } else {
-          this.currentStep = AppointmentSteps.infoScreen;
-        }
+        this.currentStep = AppointmentSteps.infoScreen;
         this.setStepNumber(Object.keys(AppointmentSteps).length);
         this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
         break;
@@ -381,17 +383,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     });
   }
 
-  private skipStructureOrientator(isNextPage: boolean): void {
-    if (this.profile?.structuresLink?.length === 1) {
-      // skip structureOrientator if user with only one structure
-      if (isNextPage) {
-        this.currentStep++;
-      } else {
-        this.currentStep--;
-      }
-    }
-  }
-
   /**
    * Initialize online procedure (list of structures / appointment / online mediation)
    */
@@ -418,23 +409,17 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     if (this.commonStepIs(CommonSteps.filtersChoice)) {
       switch (this.needType) {
         case NeedsTypes.equipmentAccess:
-          this.previousNeedType = NeedsTypes.equipmentAccess;
           this.setFilters('selfServiceMaterial');
-          // Switch to structure list form
           this.setOnlineEquipmentsForm();
           return;
         case NeedsTypes.equipmentBuy:
-          this.previousNeedType = NeedsTypes.equipmentBuy;
           this.setFilters('solidarityMaterial');
-          // Switch to structure list form
           this.setOnlineEquipmentsForm();
           return;
         case NeedsTypes.onlineDemarch:
-          this.previousNeedType = NeedsTypes.onlineDemarch;
           this.setFilters('onlineProcedures');
           break;
         case NeedsTypes.baseSkills:
-          this.previousNeedType = NeedsTypes.baseSkills;
           this.setFilters('baseSkills');
       }
     }
@@ -442,10 +427,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     // Online demarches or base skills
     if (this.isOnlineDemarcheOrBaseSkills()) {
       // If appointment coming from the carto, we, need to patch the user / structure info + skip step where we chose to get an appointment
-      if (
-        this.commonStepIs(CommonSteps.filtersChoice) &&
-        (this.orientationService.rdvStructure || this.orientationService.rdvUser)
-      ) {
+      if (this.commonStepIs(CommonSteps.filtersChoice) && this.isComingFromCartoOrRegistry()) {
         this.onlineDemarcheForm.get('accompanimentType').patchValue(AccompanimentTypes.appointment);
         this.currentStep++;
       }
@@ -454,14 +436,20 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       if (this.commonStepIs(CommonSteps.accompanimentType)) {
         this.setOnlineProcedureFilters();
         this.setOnlineProceduresForm();
-        this.previousNeedType = this.needType;
+        this.checkSkipInfoScreen(true);
+        if (
+          this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess) &&
+          this.isComingFromCartoOrRegistry()
+        ) {
+          if (this.orientationService.rdvStructure) {
+            this.onlineDemarcheForm.get('structureRDV').patchValue(this.orientationService.rdvStructure._id);
+          }
+          // skip pmrAccess, location and carto
+          this.currentStep += 3;
+        }
         return;
       }
 
-      // If no multiple structures, skip orientator
-      if (this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.structureOrientator - 1)) {
-        this.skipStructureOrientator(true);
-      }
       // Handle Online appointment
       if (this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.rdvEnd - 1)) {
         await this.handleOnlineAppointment();
@@ -486,32 +474,15 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     // Structure list handling
     if (this.accompanimentType === AccompanimentTypes.structuresList) {
-      // If no multiple structures, skip orientator
-      if (this.currentStep === StructuresListSteps.structureOrientator - 1) {
-        this.skipStructureOrientator(true);
-      }
       // Print last screen
       if (this.currentStep === StructuresListSteps.orientationRecap) {
         this.printForm();
         return;
       }
-      // Carto display case for full screen
-      // Set to full screen
-      if (this.currentStep === StructuresListSteps.address) {
-        this.fullScreen = true;
-      }
-      // Unset fullscreen
-      if (this.currentStep === StructuresListSteps.structureChoice) {
-        this.fullScreen = false;
-      }
     }
 
     // Appointment handling
     if (this.accompanimentType === AccompanimentTypes.appointment) {
-      if (this.currentStep === AppointmentSteps.structureOrientator - 1) {
-        this.skipStructureOrientator(true);
-      }
-
       // If no structure found, go to the end
       if (this.currentStep === AppointmentSteps.pmrAccess) {
         if (
@@ -526,16 +497,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         }
       }
 
-      // Carto display case for full screen
-      // Set to full screen
-      if (this.currentStep === AppointmentSteps.location) {
-        this.fullScreen = true;
-      }
-      // Unset fullscreen
-      if (this.currentStep === AppointmentSteps.carto) {
-        this.fullScreen = false;
-      }
-
       // After last page, print and go to new orientation
       if (this.currentStep === AppointmentSteps.orientationPrint) {
         this.printForm();
@@ -545,7 +506,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     if (
       this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess - 1) &&
-      (this.orientationService.rdvStructure || this.orientationService.rdvUser)
+      this.isComingFromCartoOrRegistry()
     ) {
       if (this.orientationService.rdvStructure) {
         this.onlineDemarcheForm.get('structureRDV').patchValue(this.orientationService.rdvStructure._id);
@@ -562,93 +523,99 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
     if (this.currentStep < this.nbSteps) {
       this.currentStep++;
+      this.checkSkipStructureOrientator(true);
       this.checkHiddenNavButtons();
+      this.checkFullScreen();
       this.checkLastStep();
     }
   }
 
   public prevPage(): void {
-    // Structure list previous page
-    if (this.accompanimentType === AccompanimentTypes.structuresList) {
-      if (this.currentStep === StructuresListSteps.structureChoice) {
-        this.fullScreen = false;
-      }
-      if (this.currentStep === StructuresListSteps.structureOrientator + 1) {
-        this.skipStructureOrientator(false);
-      }
-      if (this.currentStep === StructuresListSteps.structureChoice + 1) {
-        this.fullScreen = true;
-      }
-    }
-
-    // Appointment previous page
-    if (this.accompanimentType === AccompanimentTypes.appointment) {
-      if (
-        this.currentStep === AppointmentSteps.pmrAccess + 1 &&
-        (this.orientationService.rdvStructure || this.orientationService.rdvUser)
-      ) {
+    //
+    if (this.isComingFromCartoOrRegistry()) {
+      if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess + 1)) {
         this.currentStep--;
       }
-      if (this.needType === NeedsTypes.baseSkills && this.currentStep === AppointmentSteps.infoScreen + 1) {
-        this.currentStep--;
-      }
-      if (this.currentStep === AppointmentSteps.carto) {
-        this.fullScreen = false;
-      }
-      if (this.currentStep === AppointmentSteps.makeAppointment) {
-        this.fullScreen = true;
-      }
-      if (
-        this.currentStep === AppointmentSteps.makeAppointment &&
-        (this.orientationService.rdvStructure || this.orientationService.rdvUser)
-      ) {
-        this.fullScreen = false;
+      if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.makeAppointment)) {
         this.currentStep -= 3;
-        this.skipStructureOrientator(false);
-      }
-      if (this.currentStep === AppointmentSteps.structureOrientator + 1) {
-        this.skipStructureOrientator(false);
       }
     }
 
-    // Default case for first form step. If there was a previous form (like filterForm) we go back to this form
+    // Go back routine
+    this.goToPreviousStep();
+
+    // Check if the new screen must be skipped
+    this.checkSkipInfoScreen(false);
+    this.checkSkipStructureOrientator(false);
+
+    // Additional params (fullScreen, Nav buttons, ..)
+    this.checkHiddenNavButtons();
+    this.checkFullScreen();
+    this.checkLastStep();
+  }
+
+  private goToPreviousStep(): void {
     if (this.currentStep === 0) {
-      // If back to beginning of the form, reset
-      if (this.genericStep === GenericOrientationSteps.common || !this.previousNeedType) {
-        this.reset();
-        return;
+      switch (this.genericStep) {
+        // If back to beginning of the form, reset
+        case GenericOrientationSteps.common:
+          this.reset();
+          break;
+
+        // Else, we are in middle of form, going back to choice of accompaniment type
+        case GenericOrientationSteps.accompanimentTunnel:
+          this.genericStep = GenericOrientationSteps.common;
+          this.currentStep = CommonSteps.accompanimentType;
+          if (this.isOnlineDemarcheOrBaseSkills()) {
+            this.filtersForm = this.orientationUtils.createFiltersForm();
+            this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
+            if (this.isComingFromCartoOrRegistry()) {
+              this.currentStep = CommonSteps.filtersChoice;
+            }
+          }
+          break;
       }
+      return;
+    }
 
-      // Else, we are in middle of form, going back to choice of accompaniment type
-      this.needType = this.previousNeedType;
-      this.previousNeedType = null;
-      this.genericStep = GenericOrientationSteps.common;
-      this.currentStep = CommonSteps.accompanimentType;
-      if (this.isOnlineDemarcheOrBaseSkills()) {
-        this.filtersForm = this.orientationUtils.createFiltersForm();
-        this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
-        if (this.orientationService.rdvStructure || this.orientationService.rdvUser) {
-          this.currentStep--;
+    this.currentStep--;
+  }
+
+  private checkSkipInfoScreen(goNext: boolean): void {
+    // Info screen should be skipped for appointment, if coming from baseSkills
+    if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.infoScreen)) {
+      if (this.needType === NeedsTypes.baseSkills) {
+        if (goNext) {
+          this.currentStep++;
+        } else {
+          this.goToPreviousStep();
         }
-        return;
       }
     }
+  }
 
-    // Go back routine
-    if (this.currentStep > 0) {
-      this.currentStep--;
-      this.isNextHidden = false;
-      this.checkHiddenNavButtons();
-      this.checkLastStep();
+  private checkSkipStructureOrientator(goNext: boolean): void {
+    if (
+      this.tunnelingStepIs(AccompanimentTypes.structuresList, StructuresListSteps.structureOrientator) ||
+      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.structureOrientator) ||
+      this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.structureOrientator)
+    ) {
+      if (this.profile?.structuresLink?.length === 1) {
+        if (goNext) {
+          this.currentStep++;
+        } else {
+          this.goToPreviousStep();
+        }
+      }
     }
   }
 
   public reset(): void {
     this.onlineDemarcheForm = undefined;
-    this.onlineDemarcheType = undefined;
     this.filtersForm = this.orientationUtils.createFiltersForm();
     this.currentStep = null;
     this.genericStep = GenericOrientationSteps.common;
+    this.needType = undefined;
     this.accompanimentType = undefined;
     this.isPrevHidden = false;
     this.isNextHidden = false;
@@ -656,7 +623,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.failedOrientation = false;
     this.nbSteps = OrientationFormViewComponent.MAX_STEP;
     this.isPageValid = false;
-    this.needType = undefined;
     this.filters = [];
   }
 
diff --git a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
index 38aca848a..ce7e98068 100644
--- a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
+++ b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
@@ -4,15 +4,15 @@ import { Structure } from '../../../models/structure.model';
 import { User } from '../../../models/user.model';
 import { Filter } from '../../../structure-list/models/filter.model';
 import { OrientationUtils } from '../../../utils/orientationUtils';
-import { AccompanimentTypes, CommonSteps, NeedsTypes, StructuresListSteps } from '../enums/orientation.enums';
-import { MediationStepType } from '../types/orientation.types';
+import { AccompanimentTypes, StructuresListSteps } from '../enums/orientation.enums';
+import { AllOrientationSteps } from '../types/orientation.types';
 
 @Component({
   selector: 'app-orientation-structure-list',
   templateUrl: './orientation-structure-list.component.html',
 })
 export class OrientationStructureListComponent implements OnChanges {
-  @Input() currentStep: CommonSteps | StructuresListSteps | MediationStepType | NeedsTypes;
+  @Input() currentStep: AllOrientationSteps;
   @Input() profile: User;
   @Input() form: UntypedFormGroup;
   @Input() filters: Filter[] = [];
@@ -23,6 +23,7 @@ export class OrientationStructureListComponent implements OnChanges {
   // Enum
   public StructuresListSteps = StructuresListSteps;
   public AccompanimentTypes = AccompanimentTypes;
+
   // Init data for form
   public selectedStructures: Structure[] = [];
 
diff --git a/src/app/form/orientation-form-view/types/orientation.types.ts b/src/app/form/orientation-form-view/types/orientation.types.ts
index c7d457697..9c91f7f1c 100644
--- a/src/app/form/orientation-form-view/types/orientation.types.ts
+++ b/src/app/form/orientation-form-view/types/orientation.types.ts
@@ -9,6 +9,4 @@ import {
 
 export type MediationType = GenericOrientationSteps | AccompanimentTypes;
 
-export type OrientationSteps = CommonSteps | StructuresListSteps | AppointmentSteps | OnlineMediationSteps;
-
-export type MediationStepType = OrientationSteps;
+export type AllOrientationSteps = CommonSteps | StructuresListSteps | AppointmentSteps | OnlineMediationSteps;
-- 
GitLab


From fa1eb9c0ad011bf218cdc8064596a3e5b39a7361 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Wed, 14 Aug 2024 13:32:02 +0200
Subject: [PATCH 16/23] refactored prevPage function

---
 .../orientation-form-view.component.ts        | 28 ++++++++++++-------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index e8564922a..a83f0de3a 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -531,20 +531,11 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
   }
 
   public prevPage(): void {
-    //
-    if (this.isComingFromCartoOrRegistry()) {
-      if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess + 1)) {
-        this.currentStep--;
-      }
-      if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.makeAppointment)) {
-        this.currentStep -= 3;
-      }
-    }
-
     // Go back routine
     this.goToPreviousStep();
 
     // Check if the new screen must be skipped
+    this.checkSkipCartoScreens(false);
     this.checkSkipInfoScreen(false);
     this.checkSkipStructureOrientator(false);
 
@@ -594,6 +585,23 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
   }
 
+  private checkSkipCartoScreens(goNext: boolean): void {
+    // When coming from carto or registry, we need to skip the carto steps
+    if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto)) {
+      if (this.isComingFromCartoOrRegistry()) {
+        if (goNext) {
+          this.currentStep++;
+          this.currentStep++;
+          this.currentStep++;
+        } else {
+          this.goToPreviousStep();
+          this.goToPreviousStep();
+          this.goToPreviousStep();
+        }
+      }
+    }
+  }
+
   private checkSkipStructureOrientator(goNext: boolean): void {
     if (
       this.tunnelingStepIs(AccompanimentTypes.structuresList, StructuresListSteps.structureOrientator) ||
-- 
GitLab


From fa356ce694847bb0636902bb75c6ffd334d27459 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Wed, 14 Aug 2024 14:51:54 +0200
Subject: [PATCH 17/23] fixed previous in equipments + started refacto nextPage

---
 .../enums/orientation.enums.ts                |   6 +-
 .../orientation-form-view.component.html      |   2 +-
 .../orientation-form-view.component.ts        | 217 ++++++++----------
 src/app/utils/orientationUtils.ts             |   2 +-
 4 files changed, 103 insertions(+), 124 deletions(-)

diff --git a/src/app/form/orientation-form-view/enums/orientation.enums.ts b/src/app/form/orientation-form-view/enums/orientation.enums.ts
index d59f37299..e2579eb76 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -2,9 +2,9 @@
  * Names of needs, leading to one of the three orientations
  */
 export enum NeedsTypes {
-  equipmentAccess = 'equipmentAccess',
-  equipmentBuy = 'equipmentBuy',
-  onlineDemarch = 'onlineDemarch',
+  equipmentAccess = 'selfServiceMaterial',
+  equipmentBuy = 'solidarityMaterial',
+  onlineDemarch = 'onlineProcedures',
   baseSkills = 'baseSkills',
 }
 
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html
index 1893f6f97..95950ac09 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.html
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.html
@@ -28,7 +28,7 @@
         (validatePage)="validatePage($event)"
       />
       <app-online-demarch-form
-        *ngIf="isOnlineDemarcheOrBaseSkills()"
+        *ngIf="isOnlineDemarchOrBaseSkills()"
         [needType]="needType"
         [currentStep]="currentStep"
         [genericStep]="genericStep"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index a83f0de3a..ff789ce94 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -200,7 +200,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     // If first step, perform some initialization
     if (this.currentStep === null) {
       this.filtersForm = this.orientationUtils.createFiltersForm();
-      if (this.isOnlineDemarcheOrBaseSkills()) {
+      if (this.isOnlineDemarchOrBaseSkills()) {
         this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
       }
     }
@@ -230,7 +230,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     );
   }
 
-  public isOnlineDemarcheOrBaseSkills(): boolean {
+  public isOnlineDemarchOrBaseSkills(): boolean {
     return this.needType === NeedsTypes.onlineDemarch || this.needType === NeedsTypes.baseSkills;
   }
 
@@ -240,7 +240,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
   private checkHiddenNavButtons(): void {
     // Only needs to hide in appointment / online mediation
-    if (!this.isOnlineDemarcheOrBaseSkills()) return;
+    if (!this.isOnlineDemarchOrBaseSkills()) return;
 
     const isCartoStep = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto);
     const isAppointmentSuccess = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd);
@@ -273,7 +273,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     );
     this.isLastStep =
       isStructureListOrientationRecap ||
-      (this.isOnlineDemarcheOrBaseSkills() && (isAppointmentOrientationRecap || isOnlineMediationOrientationRecap));
+      (this.isOnlineDemarchOrBaseSkills() && (isAppointmentOrientationRecap || isOnlineMediationOrientationRecap));
   }
 
   /**
@@ -316,49 +316,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }, 100);
   }
 
-  public setOnlineEquipmentsForm(): void {
-    this.genericStep = GenericOrientationSteps.accompanimentTunnel;
-    this.accompanimentType = AccompanimentTypes.structuresList;
-    this.currentStep = StructuresListSteps.pmrAccess;
-    // first filter screen + regular StructureList form
-    this.setStepNumber(Object.keys(StructuresListSteps).length);
-    this.structureOrientationForm = this.orientationUtils.createStructureOrientationForm(
-      this.filtersForm.value.filters,
-      this.orientator,
-    );
-  }
-
-  public setOnlineProceduresForm(): void {
-    this.genericStep = GenericOrientationSteps.accompanimentTunnel;
-    switch (this.onlineDemarcheForm.get('accompanimentType').value) {
-      case AccompanimentTypes.structuresList:
-        this.accompanimentType = AccompanimentTypes.structuresList;
-        this.currentStep = StructuresListSteps.pmrAccess;
-        this.setStepNumber(Object.keys(StructuresListSteps).length);
-        this.onlineDemarcheForm = this.orientationUtils.createStructureOrientationForm(
-          this.utils.convertFiltersToModule(this.filters),
-        );
-        break;
-      case AccompanimentTypes.appointment:
-        this.accompanimentType = AccompanimentTypes.appointment;
-        this.currentStep = AppointmentSteps.infoScreen;
-        this.setStepNumber(Object.keys(AppointmentSteps).length);
-        this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
-        break;
-      case AccompanimentTypes.onlineMediation:
-        this.accompanimentType = AccompanimentTypes.onlineMediation;
-        this.currentStep = OnlineMediationSteps.infoScreen;
-        this.setStepNumber(Object.keys(OnlineMediationSteps).length);
-        this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
-          this.utils.convertFiltersToModule(this.filters),
-          this.orientator,
-        );
-        break;
-      default:
-        throw new Error('Not implemented value in nextPage()');
-    }
-  }
-
   private async setCategories(): Promise<void> {
     const categories = await this.searchService.getCategories().toPromise();
     categories.forEach((categ) => {
@@ -405,51 +362,14 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.isPageValid = false;
     this.isNextHidden = false;
 
-    // Handle filters form
-    if (this.commonStepIs(CommonSteps.filtersChoice)) {
-      switch (this.needType) {
-        case NeedsTypes.equipmentAccess:
-          this.setFilters('selfServiceMaterial');
-          this.setOnlineEquipmentsForm();
-          return;
-        case NeedsTypes.equipmentBuy:
-          this.setFilters('solidarityMaterial');
-          this.setOnlineEquipmentsForm();
-          return;
-        case NeedsTypes.onlineDemarch:
-          this.setFilters('onlineProcedures');
-          break;
-        case NeedsTypes.baseSkills:
-          this.setFilters('baseSkills');
-      }
-    }
-
     // Online demarches or base skills
-    if (this.isOnlineDemarcheOrBaseSkills()) {
+    if (this.isOnlineDemarchOrBaseSkills()) {
       // If appointment coming from the carto, we, need to patch the user / structure info + skip step where we chose to get an appointment
       if (this.commonStepIs(CommonSteps.filtersChoice) && this.isComingFromCartoOrRegistry()) {
         this.onlineDemarcheForm.get('accompanimentType').patchValue(AccompanimentTypes.appointment);
         this.currentStep++;
       }
 
-      // If we are choosing the accompaniment type (findStructure / appointment / online mediation)
-      if (this.commonStepIs(CommonSteps.accompanimentType)) {
-        this.setOnlineProcedureFilters();
-        this.setOnlineProceduresForm();
-        this.checkSkipInfoScreen(true);
-        if (
-          this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess) &&
-          this.isComingFromCartoOrRegistry()
-        ) {
-          if (this.orientationService.rdvStructure) {
-            this.onlineDemarcheForm.get('structureRDV').patchValue(this.orientationService.rdvStructure._id);
-          }
-          // skip pmrAccess, location and carto
-          this.currentStep += 3;
-        }
-        return;
-      }
-
       // Handle Online appointment
       if (this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.rdvEnd - 1)) {
         await this.handleOnlineAppointment();
@@ -504,40 +424,94 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       }
     }
 
-    if (
-      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess - 1) &&
-      this.isComingFromCartoOrRegistry()
-    ) {
-      if (this.orientationService.rdvStructure) {
-        this.onlineDemarcheForm.get('structureRDV').patchValue(this.orientationService.rdvStructure._id);
-      }
-      // skip pmrAccess, location and carto
-      this.currentStep += 3;
-    }
+    // Go next routine
+    this.goToNextStep();
+
+    // Check if the new screen must be skipped
+    this.checkSkipInfoScreen(true);
+    this.checkSkipCartoScreensNext();
+    this.checkSkipStructureOrientator(true);
+
+    // Additional params (fullScreen, Nav buttons, ..)
+    this.checkHiddenNavButtons();
+    this.checkFullScreen();
+    this.checkLastStep();
+  }
 
-    // Default case
+  private goToNextStep(): void {
+    // Form starts
     if (this.currentStep === null) {
-      // handle the form start
       this.currentStep = 0;
       return;
     }
-    if (this.currentStep < this.nbSteps) {
-      this.currentStep++;
-      this.checkSkipStructureOrientator(true);
-      this.checkHiddenNavButtons();
-      this.checkFullScreen();
-      this.checkLastStep();
+
+    // Deals with last steps
+    if (this.currentStep === this.nbSteps) {
+      return;
+    }
+
+    // End of common steps, need to enter the accompaniment tunnels
+    const commonEquipmentFinished = !this.isOnlineDemarchOrBaseSkills() && this.commonStepIs(CommonSteps.filtersChoice);
+    const commonOnlineFinished = this.isOnlineDemarchOrBaseSkills() && this.commonStepIs(CommonSteps.accompanimentType);
+
+    if (commonEquipmentFinished || commonOnlineFinished) {
+      this.setFilters(this.needType);
+      this.genericStep = GenericOrientationSteps.accompanimentTunnel;
+      if (this.isOnlineDemarchOrBaseSkills()) {
+        this.setOnlineProcedureFilters();
+        this.accompanimentType = this.onlineDemarcheForm.get('accompanimentType').value;
+      } else {
+        this.accompanimentType = AccompanimentTypes.structuresList;
+      }
+
+      switch (this.accompanimentType) {
+        case AccompanimentTypes.structuresList:
+          this.currentStep = StructuresListSteps.pmrAccess;
+          this.setStepNumber(Object.keys(StructuresListSteps).length);
+          if (this.isOnlineDemarchOrBaseSkills()) {
+            this.onlineDemarcheForm = this.orientationUtils.createStructuresListForm(
+              this.utils.convertFiltersToModule(this.filters),
+            );
+          } else {
+            this.structureOrientationForm = this.orientationUtils.createStructuresListForm(
+              this.filtersForm.value.filters,
+              this.orientator,
+            );
+          }
+          break;
+        case AccompanimentTypes.appointment:
+          this.currentStep = AppointmentSteps.infoScreen;
+          this.setStepNumber(Object.keys(AppointmentSteps).length);
+          this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
+          break;
+        case AccompanimentTypes.onlineMediation:
+          this.currentStep = OnlineMediationSteps.infoScreen;
+          this.setStepNumber(Object.keys(OnlineMediationSteps).length);
+          this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
+            this.utils.convertFiltersToModule(this.filters),
+            this.orientator,
+          );
+          break;
+        default:
+          throw new Error('Not implemented value in nextPage()');
+      }
+      return;
     }
+
+    this.currentStep++;
   }
 
   public prevPage(): void {
     // Go back routine
+    console.log('prev');
+    console.log(this.genericStep, this.currentStep);
     this.goToPreviousStep();
+    console.log(this.genericStep, this.currentStep);
 
     // Check if the new screen must be skipped
-    this.checkSkipCartoScreens(false);
-    this.checkSkipInfoScreen(false);
     this.checkSkipStructureOrientator(false);
+    this.checkSkipCartoScreensPrev();
+    this.checkSkipInfoScreen(false);
 
     // Additional params (fullScreen, Nav buttons, ..)
     this.checkHiddenNavButtons();
@@ -556,12 +530,12 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         // Else, we are in middle of form, going back to choice of accompaniment type
         case GenericOrientationSteps.accompanimentTunnel:
           this.genericStep = GenericOrientationSteps.common;
-          this.currentStep = CommonSteps.accompanimentType;
-          if (this.isOnlineDemarcheOrBaseSkills()) {
+          this.currentStep = CommonSteps.filtersChoice;
+          if (this.isOnlineDemarchOrBaseSkills()) {
             this.filtersForm = this.orientationUtils.createFiltersForm();
             this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
-            if (this.isComingFromCartoOrRegistry()) {
-              this.currentStep = CommonSteps.filtersChoice;
+            if (!this.isComingFromCartoOrRegistry()) {
+              this.currentStep = CommonSteps.accompanimentType;
             }
           }
           break;
@@ -585,19 +559,24 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
   }
 
-  private checkSkipCartoScreens(goNext: boolean): void {
+  private checkSkipCartoScreensPrev(): void {
     // When coming from carto or registry, we need to skip the carto steps
     if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto)) {
       if (this.isComingFromCartoOrRegistry()) {
-        if (goNext) {
-          this.currentStep++;
-          this.currentStep++;
-          this.currentStep++;
-        } else {
-          this.goToPreviousStep();
-          this.goToPreviousStep();
-          this.goToPreviousStep();
-        }
+        this.goToPreviousStep();
+        this.goToPreviousStep();
+        this.goToPreviousStep();
+      }
+    }
+  }
+
+  private checkSkipCartoScreensNext(): void {
+    // When coming from carto or registry, we need to skip the carto steps
+    if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess)) {
+      if (this.isComingFromCartoOrRegistry()) {
+        this.goToNextStep();
+        this.goToNextStep();
+        this.goToNextStep();
       }
     }
   }
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index 8009c9aea..f7180922f 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -62,7 +62,7 @@ export class OrientationUtils {
     });
   }
 
-  public createStructureOrientationForm(
+  public createStructuresListForm(
     filters: Module[] = [],
     orientatorForm?: FormGroup<StructureOrientator>,
   ): FormGroup<StructureOrientationForm> {
-- 
GitLab


From 768d966cfb773f99c1b3d143df3b50fbfc244f18 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Wed, 14 Aug 2024 17:41:35 +0200
Subject: [PATCH 18/23] Finished refactor goNext + reorganization

---
 .../orientation-form-view.component.ts        | 599 ++++++++----------
 1 file changed, 271 insertions(+), 328 deletions(-)

diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index ff789ce94..33257bab3 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -28,9 +28,7 @@ import {
   StructuresListSteps,
 } from './enums/orientation.enums';
 import { NavigationComponent } from './global-components/navigation/navigation.component';
-import { IAppointment } from './interfaces/appointment.interface';
 import { FiltersForm } from './interfaces/filtersForm.interface';
-import { IOnlineMediation } from './interfaces/onlineMediation.interface';
 import {
   IOrientationIndicator,
   OrientationIndicatorStructure,
@@ -167,7 +165,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     this.orientationService.rdvStructure = null;
     if (history.state.rdvStructure) {
-      // Create new Structure object to call Structure functions (getTypeStructureIcon,...)
+      // Create new Structure object to call Structure functions (getTypeStructureIcon, ...)
       this.orientationService.rdvStructure = new Structure(history.state.rdvStructure);
     }
 
@@ -196,14 +194,10 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
   public validatePage(event: boolean): void {
     this.isPageValid = event;
+  }
 
-    // If first step, perform some initialization
-    if (this.currentStep === null) {
-      this.filtersForm = this.orientationUtils.createFiltersForm();
-      if (this.isOnlineDemarchOrBaseSkills()) {
-        this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
-      }
-    }
+  public setFailedOrientation(): void {
+    this.failedOrientation = true;
   }
 
   public validateStructureRDV(event: Structure): void {
@@ -211,106 +205,33 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.nextPage();
   }
 
-  public setStepNumber(enumLength: number): void {
-    this.nbSteps = enumLength / 2;
-  }
-
-  private commonStepIs(step: CommonSteps): boolean {
-    return this.genericStep === GenericOrientationSteps.common && this.currentStep === step;
-  }
-
-  private tunnelingStepIs(
-    accompanimentType: AccompanimentTypes,
-    step: StructuresListSteps | AppointmentSteps | OnlineMediationSteps,
-  ): boolean {
-    return (
-      this.genericStep === GenericOrientationSteps.accompanimentTunnel &&
-      this.accompanimentType === accompanimentType &&
-      this.currentStep === step
-    );
-  }
-
-  public isOnlineDemarchOrBaseSkills(): boolean {
-    return this.needType === NeedsTypes.onlineDemarch || this.needType === NeedsTypes.baseSkills;
-  }
-
-  public isComingFromCartoOrRegistry(): boolean {
-    return Boolean(this.orientationService.rdvStructure || this.orientationService.rdvUser);
-  }
-
-  private checkHiddenNavButtons(): void {
-    // Only needs to hide in appointment / online mediation
-    if (!this.isOnlineDemarchOrBaseSkills()) return;
-
-    const isCartoStep = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto);
-    const isAppointmentSuccess = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd);
-    const isOnlineMediationSuccess = this.tunnelingStepIs(
-      AccompanimentTypes.onlineMediation,
-      OnlineMediationSteps.rdvEnd,
-    );
-    this.isPrevHidden = isAppointmentSuccess || isOnlineMediationSuccess;
-    this.isNextHidden = isCartoStep;
-  }
-
-  private checkFullScreen(): void {
-    this.fullScreen =
-      this.tunnelingStepIs(AccompanimentTypes.structuresList, StructuresListSteps.structureChoice) ||
-      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto);
-  }
-
-  public checkLastStep(): void {
-    const isStructureListOrientationRecap = this.tunnelingStepIs(
-      AccompanimentTypes.structuresList,
-      StructuresListSteps.orientationRecap,
-    );
-    const isAppointmentOrientationRecap = this.tunnelingStepIs(
-      AccompanimentTypes.appointment,
-      AppointmentSteps.orientationPrint,
-    );
-    const isOnlineMediationOrientationRecap = this.tunnelingStepIs(
-      AccompanimentTypes.onlineMediation,
-      OnlineMediationSteps.orientationPrint,
-    );
-    this.isLastStep =
-      isStructureListOrientationRecap ||
-      (this.isOnlineDemarchOrBaseSkills() && (isAppointmentOrientationRecap || isOnlineMediationOrientationRecap));
-  }
-
-  /**
-   * Handle appointment, send to server
-   */
-  public async handleAppointment(): Promise<void> {
-    const appointment: IAppointment = {
-      ...this.onlineDemarcheForm.value,
-      onlineDemarcheType: this.onlineDemarcheForm.value.onlineDemarcheType.filter((item) => item.name !== 'pmrAccess'),
-    };
-
-    await lastValueFrom(this.orientationService.createAppointment(appointment));
-    this.canDeactivate = true;
-  }
-
-  /**
-   * Handle online mediation, send to server then print
-   */
-  public async handleOnlineAppointment(): Promise<void> {
-    const toCreate: IOnlineMediation = {
-      ...this.onlineDemarcheForm.value,
-      onlineDemarcheType: this.onlineDemarcheForm.value.filters.map((module: Module) => module.displayText),
-    };
-    await lastValueFrom(this.orientationService.createOnlineMediation(toCreate))
-      .then(() => {
-        this.notificationService.showSuccess('Votre démarche en ligne a bien été enregistrée');
-      })
-      .catch(() => {
-        this.notificationService.showErrorPleaseRetry('Échec de la création de votre démarche en ligne');
-      });
+  private async handleAppointment(): Promise<void> {
+    switch (this.accompanimentType) {
+      case AccompanimentTypes.appointment:
+        await lastValueFrom(
+          this.orientationService.createAppointment({
+            ...this.onlineDemarcheForm.value,
+            onlineDemarcheType: this.onlineDemarcheForm.value.onlineDemarcheType.filter(
+              (item) => item.name !== 'pmrAccess',
+            ),
+          }),
+        );
+        break;
+      case AccompanimentTypes.onlineMediation:
+        await lastValueFrom(
+          this.orientationService.createOnlineMediation({
+            ...this.onlineDemarcheForm.value,
+            onlineDemarcheType: this.onlineDemarcheForm.value.filters.map((module: Module) => module.displayText),
+          }),
+        );
+        break;
+    }
   }
 
-  public async printForm(): Promise<void> {
+  private async printForm(): Promise<void> {
     await this.sendOrientationIndicator(this.structureOrientationForm ?? this.onlineDemarcheForm);
     window.print();
     setTimeout(() => {
-      this.canDeactivate = true;
       history.pushState({ rdvStructure: null, rdvUser: null }, '', '/orientation');
       window.location.reload();
     }, 100);
@@ -318,207 +239,112 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
   private async setCategories(): Promise<void> {
     const categories = await this.searchService.getCategories().toPromise();
-    categories.forEach((categ) => {
-      switch (categ.id) {
+    categories.forEach((category) => {
+      switch (category.id) {
         case CategoryEnum.age: {
-          this.categories.age = categ;
+          this.categories.age = category;
           break;
         }
         case CategoryEnum.languageAndIlliteracy: {
-          this.categories.languageAndIlliteracy = categ;
+          this.categories.languageAndIlliteracy = category;
           break;
         }
         case CategoryEnum.genre: {
-          this.categories.genre = categ;
+          this.categories.genre = category;
           break;
         }
         case CategoryEnum.handicaps: {
-          this.categories.handicaps = categ;
+          this.categories.handicaps = category;
           break;
         }
       }
     });
   }
 
-  /**
-   * Initialize online procedure (list of structures / appointment / online mediation)
-   */
-  public setOnlineProcedureFilters(): void {
-    // Handle online procedures
-    const onlineProcedures: Filter[] = this.onlineDemarcheForm.value.onlineDemarcheType.map((module: Module) => {
-      return new Filter('onlineProcedures', module.id, module.displayText);
-    });
-    if (onlineProcedures.length > 0) this.filters = [...onlineProcedures, ...this.filters];
-  }
-
-  public setFilters(category: string): void {
-    // Handle online procedures
-    this.filters = this.filtersForm.value.filters.map((module: Module) => {
-      return new Filter(category, module.id, module.displayText);
-    });
-  }
-
   public async nextPage(): Promise<void> {
     this.isPageValid = false;
     this.isNextHidden = false;
 
-    // Online demarches or base skills
-    if (this.isOnlineDemarchOrBaseSkills()) {
-      // If appointment coming from the carto, we, need to patch the user / structure info + skip step where we chose to get an appointment
-      if (this.commonStepIs(CommonSteps.filtersChoice) && this.isComingFromCartoOrRegistry()) {
-        this.onlineDemarcheForm.get('accompanimentType').patchValue(AccompanimentTypes.appointment);
-        this.currentStep++;
-      }
+    // Go next routine
+    this.goToNextStep();
 
-      // Handle Online appointment
-      if (this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.rdvEnd - 1)) {
-        await this.handleOnlineAppointment();
-      }
-      // Handle last screen Online appointment and print
-      if (this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.orientationPrint)) {
-        this.printForm();
-        return;
-      }
-      // Handle last screen appointment
-      if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd - 1)) {
-        try {
-          await this.handleAppointment();
-        } catch (e) {
-          console.log(e);
-          this.notificationService.showErrorPleaseRetry("Échec de l'envoi de votre demande de RDV");
-          // If appointment fails, don't go to next page
-          return;
-        }
-      }
-    }
+    // Check if the new screen must be skipped
+    this.checkSkipInfoScreen(true);
+    this.checkHasEligibleStructures();
+    this.checkSkipCartoScreens('next');
+    this.checkSkipStructureOrientator(true);
 
-    // Structure list handling
-    if (this.accompanimentType === AccompanimentTypes.structuresList) {
-      // Print last screen
-      if (this.currentStep === StructuresListSteps.orientationRecap) {
-        this.printForm();
-        return;
-      }
+    // Handle appointments
+    if (this.shouldHandleAppointment()) {
+      await this.handleAppointment()
+        .then(() => {
+          this.notificationService.showSuccess('Votre demande a bien été enregistrée');
+          this.canDeactivate = true;
+        })
+        .catch(() => {
+          this.notificationService.showErrorPleaseRetry('Échec de la création de votre rendez-vous');
+          this.goToPreviousStep();
+        });
     }
 
-    // Appointment handling
-    if (this.accompanimentType === AccompanimentTypes.appointment) {
-      // If no structure found, go to the end
-      if (this.currentStep === AppointmentSteps.pmrAccess) {
-        if (
-          // For orientation rdv, structure categories must be ignored: we filter only on personalOffers with appointment of the structure
-          (await lastValueFrom(this.structureService.getStructures(this.filters, 'search', true))).filter(
-            (structure) => structure.hasUserWithAppointmentDN,
-          ).length === 0
-        ) {
-          this.sendOrientationIndicator(this.structureOrientationForm ?? this.onlineDemarcheForm);
-          this.failedOrientation = true;
-          this.currentStep = AppointmentSteps.rdvEnd - 1;
-        }
-      }
-
-      // After last page, print and go to new orientation
-      if (this.currentStep === AppointmentSteps.orientationPrint) {
-        this.printForm();
-        return;
-      }
-    }
+    // Additional params (fullScreen, Nav buttons, ..)
+    this.updateHiddenNavButtons();
+    this.updateFullScreen();
+    this.updateLastStep();
+  }
 
-    // Go next routine
-    this.goToNextStep();
+  public prevPage(): void {
+    // Go back routine
+    this.goToPreviousStep();
 
     // Check if the new screen must be skipped
-    this.checkSkipInfoScreen(true);
-    this.checkSkipCartoScreensNext();
-    this.checkSkipStructureOrientator(true);
+    this.checkSkipStructureOrientator(false);
+    this.checkSkipCartoScreens('prev');
+    this.checkSkipInfoScreen(false);
 
     // Additional params (fullScreen, Nav buttons, ..)
-    this.checkHiddenNavButtons();
-    this.checkFullScreen();
-    this.checkLastStep();
+    this.updateHiddenNavButtons();
+    this.updateFullScreen();
+    this.updateLastStep();
   }
 
   private goToNextStep(): void {
     // Form starts
     if (this.currentStep === null) {
       this.currentStep = 0;
+      this.filtersForm = this.orientationUtils.createFiltersForm();
+      if (this.isOnlineDemarchOrBaseSkills()) {
+        this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
+      }
       return;
     }
 
     // Deals with last steps
-    if (this.currentStep === this.nbSteps) {
+    if (
+      this.tunnelingStepIs(AccompanimentTypes.structuresList, StructuresListSteps.orientationRecap) ||
+      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.orientationPrint) ||
+      this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.orientationPrint)
+    ) {
+      this.printForm();
       return;
     }
 
     // End of common steps, need to enter the accompaniment tunnels
     const commonEquipmentFinished = !this.isOnlineDemarchOrBaseSkills() && this.commonStepIs(CommonSteps.filtersChoice);
     const commonOnlineFinished = this.isOnlineDemarchOrBaseSkills() && this.commonStepIs(CommonSteps.accompanimentType);
+    const commonAppointmentFinished =
+      this.isComingFromCartoOrRegistry() && this.commonStepIs(CommonSteps.filtersChoice);
 
-    if (commonEquipmentFinished || commonOnlineFinished) {
-      this.setFilters(this.needType);
-      this.genericStep = GenericOrientationSteps.accompanimentTunnel;
-      if (this.isOnlineDemarchOrBaseSkills()) {
-        this.setOnlineProcedureFilters();
-        this.accompanimentType = this.onlineDemarcheForm.get('accompanimentType').value;
-      } else {
-        this.accompanimentType = AccompanimentTypes.structuresList;
-      }
-
-      switch (this.accompanimentType) {
-        case AccompanimentTypes.structuresList:
-          this.currentStep = StructuresListSteps.pmrAccess;
-          this.setStepNumber(Object.keys(StructuresListSteps).length);
-          if (this.isOnlineDemarchOrBaseSkills()) {
-            this.onlineDemarcheForm = this.orientationUtils.createStructuresListForm(
-              this.utils.convertFiltersToModule(this.filters),
-            );
-          } else {
-            this.structureOrientationForm = this.orientationUtils.createStructuresListForm(
-              this.filtersForm.value.filters,
-              this.orientator,
-            );
-          }
-          break;
-        case AccompanimentTypes.appointment:
-          this.currentStep = AppointmentSteps.infoScreen;
-          this.setStepNumber(Object.keys(AppointmentSteps).length);
-          this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
-          break;
-        case AccompanimentTypes.onlineMediation:
-          this.currentStep = OnlineMediationSteps.infoScreen;
-          this.setStepNumber(Object.keys(OnlineMediationSteps).length);
-          this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
-            this.utils.convertFiltersToModule(this.filters),
-            this.orientator,
-          );
-          break;
-        default:
-          throw new Error('Not implemented value in nextPage()');
-      }
-      return;
+    if (commonEquipmentFinished || commonOnlineFinished || commonAppointmentFinished) {
+      this.filters = this.filtersForm.value.filters.map((module: Module) => {
+        return new Filter(this.needType, module.id, module.displayText);
+      });
+      this.startsAccompanimentTunnel();
     }
 
     this.currentStep++;
   }
 
-  public prevPage(): void {
-    // Go back routine
-    console.log('prev');
-    console.log(this.genericStep, this.currentStep);
-    this.goToPreviousStep();
-    console.log(this.genericStep, this.currentStep);
-
-    // Check if the new screen must be skipped
-    this.checkSkipStructureOrientator(false);
-    this.checkSkipCartoScreensPrev();
-    this.checkSkipInfoScreen(false);
-
-    // Additional params (fullScreen, Nav buttons, ..)
-    this.checkHiddenNavButtons();
-    this.checkFullScreen();
-    this.checkLastStep();
-  }
-
   private goToPreviousStep(): void {
     if (this.currentStep === 0) {
       switch (this.genericStep) {
@@ -546,53 +372,63 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.currentStep--;
   }
 
-  private checkSkipInfoScreen(goNext: boolean): void {
-    // Info screen should be skipped for appointment, if coming from baseSkills
-    if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.infoScreen)) {
-      if (this.needType === NeedsTypes.baseSkills) {
-        if (goNext) {
-          this.currentStep++;
-        } else {
-          this.goToPreviousStep();
-        }
-      }
-    }
-  }
-
-  private checkSkipCartoScreensPrev(): void {
-    // When coming from carto or registry, we need to skip the carto steps
-    if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto)) {
-      if (this.isComingFromCartoOrRegistry()) {
-        this.goToPreviousStep();
-        this.goToPreviousStep();
-        this.goToPreviousStep();
-      }
+  private startsAccompanimentTunnel(): void {
+    this.genericStep = GenericOrientationSteps.accompanimentTunnel;
+    if (this.isComingFromCartoOrRegistry()) {
+      this.accompanimentType = AccompanimentTypes.appointment;
+      this.onlineDemarcheForm.get('accompanimentType').patchValue(AccompanimentTypes.appointment);
+    } else if (!this.isOnlineDemarchOrBaseSkills()) {
+      this.accompanimentType = AccompanimentTypes.structuresList;
+    } else {
+      const onlineProcedures: Filter[] = this.onlineDemarcheForm.value.onlineDemarcheType.map((module: Module) => {
+        return new Filter('onlineProcedures', module.id, module.displayText);
+      });
+      if (onlineProcedures.length > 0) this.filters = [...onlineProcedures, ...this.filters];
+      this.accompanimentType = this.onlineDemarcheForm.get('accompanimentType').value;
     }
-  }
 
-  private checkSkipCartoScreensNext(): void {
-    // When coming from carto or registry, we need to skip the carto steps
-    if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess)) {
-      if (this.isComingFromCartoOrRegistry()) {
-        this.goToNextStep();
-        this.goToNextStep();
-        this.goToNextStep();
-      }
+    switch (this.accompanimentType) {
+      case AccompanimentTypes.structuresList:
+        this.currentStep = StructuresListSteps.pmrAccess;
+        this.setStepNumber(Object.keys(StructuresListSteps).length);
+        if (this.isOnlineDemarchOrBaseSkills()) {
+          this.onlineDemarcheForm = this.orientationUtils.createStructuresListForm(
+            this.utils.convertFiltersToModule(this.filters),
+          );
+        } else {
+          this.structureOrientationForm = this.orientationUtils.createStructuresListForm(
+            this.filtersForm.value.filters,
+            this.orientator,
+          );
+        }
+        break;
+      case AccompanimentTypes.appointment:
+        this.currentStep = AppointmentSteps.infoScreen;
+        this.setStepNumber(Object.keys(AppointmentSteps).length);
+        this.onlineDemarcheForm = this.orientationUtils.createAppointmentForm(this.filters, this.orientator);
+        break;
+      case AccompanimentTypes.onlineMediation:
+        this.currentStep = OnlineMediationSteps.infoScreen;
+        this.setStepNumber(Object.keys(OnlineMediationSteps).length);
+        this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
+          this.utils.convertFiltersToModule(this.filters),
+          this.orientator,
+        );
+        break;
+      default:
+        throw new Error('Unknown tunnel routine');
     }
   }
 
-  private checkSkipStructureOrientator(goNext: boolean): void {
-    if (
-      this.tunnelingStepIs(AccompanimentTypes.structuresList, StructuresListSteps.structureOrientator) ||
-      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.structureOrientator) ||
-      this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.structureOrientator)
-    ) {
-      if (this.profile?.structuresLink?.length === 1) {
-        if (goNext) {
-          this.currentStep++;
-        } else {
-          this.goToPreviousStep();
-        }
+  private async checkHasEligibleStructures(): Promise<void> {
+    if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.location)) {
+      const eligibleStructures = (
+        await lastValueFrom(this.structureService.getStructures(this.filters, 'search', true))
+      ).filter((structure) => structure.hasUserWithAppointmentDN);
+      if (eligibleStructures.length === 0) {
+        this.sendOrientationIndicator(this.structureOrientationForm ?? this.onlineDemarcheForm);
+        this.failedOrientation = true;
+        this.currentStep = AppointmentSteps.rdvEnd - 1;
       }
     }
   }
@@ -613,27 +449,9 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     this.filters = [];
   }
 
-  public canExit(): Promise<boolean> {
-    // Avoid confirmation when user submit form and leave.
-    if (this.canDeactivate || this.currentStep === null) {
-      return Promise.resolve(true);
-    } else {
-      return new Promise((resolve) => this.showModal(resolve));
-    }
-  }
-  private showModal(resolve: CanExitResolver): void {
-    this.showConfirmationModal = true;
-    this.resolve = resolve;
-  }
-
-  public hasRedirectionAccepted(hasAccept: boolean): void {
-    this.resolve(hasAccept);
-    if (hasAccept) {
-      this.sendOrientationIndicator(this.structureOrientationForm ?? this.onlineDemarcheForm);
-    }
-    this.showConfirmationModal = false;
-  }
-
+  /**
+   * Indicators
+   */
   private targetStructures(structureChoice: AbstractControl): OrientationIndicatorStructure[] {
     const targetStructures: OrientationIndicatorStructure[] = [];
     if (structureChoice?.value) {
@@ -649,7 +467,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     }
     return targetStructures;
   }
-
   private displayTextNeedType(needType: NeedsTypes): string {
     switch (needType) {
       case NeedsTypes.equipmentAccess:
@@ -664,7 +481,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         return '';
     }
   }
-
   private orientationType(filters: Filter[]): OrientationIndicatorType {
     const orientationType: OrientationIndicatorType = {
       typeOrientation: this.displayTextNeedType(this.needType),
@@ -676,14 +492,12 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     });
     return orientationType;
   }
-
   private getProgress(): number {
     if (this.isLastStep) {
       return 100;
     }
     return Math.round((this.currentStep / this.nbSteps) * 100);
   }
-
   private async sendOrientationIndicator(orientationForm: FormGroup): Promise<void> {
     let isConnected = false;
     let profile: User = null;
@@ -708,17 +522,146 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     this.indicatorService.createOrientationIndicator(orientationIndicator).subscribe();
   }
-  public setFailedOrientation(): void {
-    this.failedOrientation = true;
+
+  /**
+   * Confirmation modal
+   */
+  public canExit(): Promise<boolean> {
+    // Avoid confirmation when user submit form and leave.
+    if (this.canDeactivate || this.currentStep === null) {
+      return Promise.resolve(true);
+    } else {
+      return new Promise((resolve) => this.showModal(resolve));
+    }
   }
-  public handleClose(value: boolean): void {
-    if (value) {
+  private showModal(resolve: CanExitResolver): void {
+    this.showConfirmationModal = true;
+    this.resolve = resolve;
+  }
+  public hasRedirectionAccepted(hasAccept: boolean): void {
+    this.resolve(hasAccept);
+    if (hasAccept) {
+      this.sendOrientationIndicator(this.structureOrientationForm ?? this.onlineDemarcheForm);
+    }
+    this.showConfirmationModal = false;
+  }
+
+  /**
+   * Login modal
+   */
+  public goLogin(): void {
+    this.router.navigate(['/connexion'], { queryParams: { returnUrl: '/orientation' } });
+  }
+  public handleClose(hasAccept: boolean): void {
+    if (hasAccept) {
       this.goLogin();
     } else {
       this.showLoginModal = false;
     }
   }
-  public goLogin(): void {
-    this.router.navigate(['/connexion'], { queryParams: { returnUrl: '/orientation' } });
+
+  /**
+   * Shortcuts
+   */
+  private checkSkipInfoScreen(goNext: boolean): void {
+    // Info screen should be skipped for appointment, if coming from baseSkills
+    if (this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.infoScreen)) {
+      if (this.needType === NeedsTypes.baseSkills) {
+        goNext ? this.goToNextStep() : this.goToPreviousStep();
+      }
+    }
+  }
+  private checkSkipCartoScreens(dir: 'prev' | 'next'): void {
+    // When coming from carto or registry, we need to skip the carto steps
+    if (this.isComingFromCartoOrRegistry()) {
+      if (dir === 'prev' && this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto)) {
+        this.currentStep = AppointmentSteps.infoScreen;
+      } else if (dir === 'next' && this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.pmrAccess)) {
+        this.currentStep = AppointmentSteps.makeAppointment;
+      }
+    }
+  }
+  private checkSkipStructureOrientator(goNext: boolean): void {
+    // When only one structure, no need to set orientator
+    if (
+      this.tunnelingStepIs(AccompanimentTypes.structuresList, StructuresListSteps.structureOrientator) ||
+      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.structureOrientator) ||
+      this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.structureOrientator)
+    ) {
+      if (this.profile?.structuresLink?.length === 1) {
+        goNext ? this.goToNextStep() : this.goToPreviousStep();
+      }
+    }
+  }
+
+  /**
+   * Update states
+   */
+  private updateHiddenNavButtons(): void {
+    // Only needs to hide in appointment / online mediation
+    if (!this.isOnlineDemarchOrBaseSkills()) return;
+
+    const isCartoStep = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto);
+    const isAppointmentSuccess = this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd);
+    const isOnlineMediationSuccess = this.tunnelingStepIs(
+      AccompanimentTypes.onlineMediation,
+      OnlineMediationSteps.rdvEnd,
+    );
+    this.isPrevHidden = isAppointmentSuccess || isOnlineMediationSuccess;
+    this.isNextHidden = isCartoStep;
+  }
+  private updateFullScreen(): void {
+    this.fullScreen =
+      this.tunnelingStepIs(AccompanimentTypes.structuresList, StructuresListSteps.structureChoice) ||
+      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.carto);
+  }
+  public updateLastStep(): void {
+    const isStructureListOrientationRecap = this.tunnelingStepIs(
+      AccompanimentTypes.structuresList,
+      StructuresListSteps.orientationRecap,
+    );
+    const isAppointmentOrientationRecap = this.tunnelingStepIs(
+      AccompanimentTypes.appointment,
+      AppointmentSteps.orientationPrint,
+    );
+    const isOnlineMediationOrientationRecap = this.tunnelingStepIs(
+      AccompanimentTypes.onlineMediation,
+      OnlineMediationSteps.orientationPrint,
+    );
+    this.isLastStep =
+      isStructureListOrientationRecap ||
+      (this.isOnlineDemarchOrBaseSkills() && (isAppointmentOrientationRecap || isOnlineMediationOrientationRecap));
+  }
+
+  /**
+   * Helpers
+   */
+  private commonStepIs(step: CommonSteps): boolean {
+    return this.genericStep === GenericOrientationSteps.common && this.currentStep === step;
+  }
+  private tunnelingStepIs(
+    accompanimentType: AccompanimentTypes,
+    step: StructuresListSteps | AppointmentSteps | OnlineMediationSteps,
+  ): boolean {
+    return (
+      this.genericStep === GenericOrientationSteps.accompanimentTunnel &&
+      this.accompanimentType === accompanimentType &&
+      this.currentStep === step
+    );
+  }
+  public isOnlineDemarchOrBaseSkills(): boolean {
+    return this.needType === NeedsTypes.onlineDemarch || this.needType === NeedsTypes.baseSkills;
+  }
+  private isComingFromCartoOrRegistry(): boolean {
+    return Boolean(this.orientationService.rdvStructure || this.orientationService.rdvUser);
+  }
+  private shouldHandleAppointment(): boolean {
+    return (
+      this.tunnelingStepIs(AccompanimentTypes.appointment, AppointmentSteps.rdvEnd) ||
+      this.tunnelingStepIs(AccompanimentTypes.onlineMediation, OnlineMediationSteps.rdvEnd)
+    );
+  }
+  private setStepNumber(enumLength: number): void {
+    this.nbSteps = enumLength / 2;
   }
 }
-- 
GitLab


From 66fb34c9b757c5aecb63ab12c99b24f273d2abb9 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Fri, 16 Aug 2024 10:53:27 +0200
Subject: [PATCH 19/23] Fixed bug from registry

---
 .../orientation-recap.component.ts            | 16 ++++++------
 .../make-appointment.component.html           |  2 +-
 .../make-appointment.component.ts             | 20 ++++++++-------
 .../onlineDemarch-form.component.html         |  6 ++---
 .../onlineDemarch-form.component.ts           | 25 +++++++++++++------
 .../orientation-form-view.component.html      |  1 -
 .../orientation-form-view.component.ts        |  1 +
 7 files changed, 41 insertions(+), 30 deletions(-)

diff --git a/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.ts b/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.ts
index 783e733f1..0cc17567d 100644
--- a/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.ts
+++ b/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.ts
@@ -62,21 +62,15 @@ export class OrientationRecapComponent implements OnInit {
     return this.accompanimentType === AccompanimentTypes.appointment;
   }
 
-  public handleAppointmentRecap(): void {
-    this.comment = this.form.get('details').value;
-    this.orientator = this.form.get('structureOrientator').value;
-  }
-
   public handleStructureRecap(): void {
     this.comment = this.form.get('comments').value;
     this.structuresToPrint = this.form.get('structureChoice').value;
     this.orientator = this.form.get('structureOrientator').value;
   }
-
-  public isOrientator(): boolean {
-    return Boolean(this.orientator?.structureName);
+  public handleAppointmentRecap(): void {
+    this.comment = this.form.get('details').value;
+    this.orientator = this.form.get('structureOrientator').value;
   }
-
   public handleOnlineOrientationRecap(): void {
     this.comment = this.form.get('comments').value;
     this.orientator = this.form.get('structureOrientator').value;
@@ -91,6 +85,10 @@ export class OrientationRecapComponent implements OnInit {
     };
   }
 
+  public isOrientator(): boolean {
+    return Boolean(this.orientator?.structureName);
+  }
+
   public getRecapTitle(): string {
     switch (this.accompanimentType) {
       case AccompanimentTypes.structuresList:
diff --git a/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.html b/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.html
index bb1cb5d3a..0a0ec9ae9 100644
--- a/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.html
@@ -50,7 +50,7 @@
           [structure]="structure"
           [redirectToStructure]="false"
           [showRadioButton]="true"
-          [isChecked]="selectedOption === structure._id"
+          [isChecked]="this.form.get('structureRDV')?.value === structure._id"
           (selectedStructure)="onStructureRadioChange(structure)"
         />
       </div>
diff --git a/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.ts b/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.ts
index eebc5c9b6..7d287ff42 100644
--- a/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.ts
@@ -24,7 +24,6 @@ export class MakeAppointmentComponent implements OnInit {
   public structures: Structure[] = [];
   public isBaseskills = false;
   public isOnlineProcedures = false;
-  public selectedOption: string;
   public structuresListReady: boolean;
 
   private onlineDemarcheType;
@@ -90,7 +89,6 @@ export class MakeAppointmentComponent implements OnInit {
       });
     } else if (this.orientationService.rdvUser) {
       // else if we come from the registry, list the registry's user's structures
-      this.selectedOption = this.form.get('structureRDV').value;
       const structures$: Observable<any>[] = [];
       this.structures = [];
       this.orientationService.rdvUser.structuresLink.forEach((structureId) => {
@@ -136,19 +134,23 @@ export class MakeAppointmentComponent implements OnInit {
   }
 
   public onSocialWorkerRadioChange(socialWorker: Owner): void {
-    this.form.patchValue({
-      socialWorkerId: socialWorker._id,
-    });
+    const structure = this.structureRDV ?? this.orientationService.rdvStructure;
+    if (this.structureRDV)
+      this.form.patchValue({
+        structureRDV: structure._id,
+        socialWorkerId: socialWorker._id,
+      });
     this.socialWorker.emit(socialWorker);
     this.checkValidation.emit();
   }
 
   public onStructureRadioChange(structure: Structure): void {
-    this.selectedOption = structure._id;
-    this.form.get('structureRDV').setValue(structure._id);
-    this.form.get('socialWorkerId').setValue(this.orientationService.rdvUser._id);
+    this.form.patchValue({
+      structureRDV: structure._id,
+      socialWorkerId: this.orientationService.rdvUser._id,
+    });
     this.selectedStructureRDV.emit(structure);
-    this.checkValidation.emit(structure);
+    this.checkValidation.emit();
   }
 
   public getFormattedNeeds(): string {
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
index af68fe523..06caabc75 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.html
@@ -61,8 +61,8 @@
       [form]="form"
       [structureRDV]="structureRDV"
       (checkValidation)="checkValidation()"
-      (socialWorker)="getSocialWorker($event)"
-      (selectedStructureRDV)="getSelectedStructureRDV($event)"
+      (socialWorker)="setSocialWorker($event)"
+      (selectedStructureRDV)="setStructureRDV($event)"
       (failedOrientation)="setFailedOrientation()"
     />
     <app-mediation-beneficiary-info
@@ -90,7 +90,7 @@
       *ngIf="currentStep === OnlineDemarchesAppointmentSteps.rdvEnd"
       [form]="form"
       [structureRDV]="structureRDV"
-      [selectedStructureRDV]="selectedStructureRDV"
+      [selectedStructureRDV]="structureRDV"
       [socialWorker]="socialWorker"
       (checkValidation)="checkValidation()"
     />
diff --git a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
index 9076c8d04..f0d87444d 100644
--- a/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/onlineDemarch-form.component.ts
@@ -1,4 +1,4 @@
-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
 import { FormGroup, UntypedFormArray, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
 import { Owner } from '../../../models/owner.model';
 import { Structure } from '../../../models/structure.model';
@@ -23,7 +23,7 @@ import { AllOrientationSteps } from '../types/orientation.types';
   selector: 'app-online-demarch-form',
   templateUrl: './onlineDemarch-form.component.html',
 })
-export class OnlineDemarchFormComponent {
+export class OnlineDemarchFormComponent implements OnInit {
   @Input() needType: NeedsTypes;
   @Input() currentStep: AllOrientationSteps;
   @Input() genericStep: GenericOrientationSteps;
@@ -33,14 +33,13 @@ export class OnlineDemarchFormComponent {
   @Input() filtersForm: FormGroup<FiltersForm>;
   @Input() profile: User;
   @Input() categories: Record<string, Category>;
-  @Input() structureRDV: Structure;
-  @Input() selectedStructureRDV: Structure;
   @Output() validatePage = new EventEmitter<any>();
   @Output() validateStructureRDV = new EventEmitter<Structure>();
   @Output() failedOrientation = new EventEmitter<any>();
 
   public orientationUtils = new OrientationUtils();
   public pagesValidation: any[] = [];
+  public structureRDV: Structure;
   public socialWorker: Owner;
 
   // Enums
@@ -54,6 +53,18 @@ export class OnlineDemarchFormComponent {
 
   constructor(public orientationService: OrientationService) {}
 
+  ngOnInit(): void {
+    // If coming from registry
+    if (this.orientationService.rdvUser) {
+      this.setSocialWorker(this.orientationService.rdvUser as unknown as Owner);
+    }
+
+    // If coming from carto
+    if (this.orientationService.rdvStructure) {
+      this.setStructureRDV(this.orientationService.rdvStructure);
+    }
+  }
+
   public checkValidation(event?: any): void {
     if (this.genericStep === GenericOrientationSteps.common) {
       this.orientationUtils.setValidationsOnlineDemarchesForm(
@@ -105,11 +116,11 @@ export class OnlineDemarchFormComponent {
     }
   }
 
-  public getSocialWorker(item: Owner): void {
+  public setSocialWorker(item: Owner): void {
     this.socialWorker = item;
   }
-  public getSelectedStructureRDV(structure: Structure): void {
-    this.selectedStructureRDV = structure;
+  public setStructureRDV(structure: Structure): void {
+    this.structureRDV = structure;
   }
 
   public updatePublicChoice({ formControlName, choice }: { formControlName: string; choice: string }): void {
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.html b/src/app/form/orientation-form-view/orientation-form-view.component.html
index 95950ac09..275900e98 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.html
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.html
@@ -38,7 +38,6 @@
         [filtersForm]="filtersForm"
         [profile]="profile"
         [categories]="categories"
-        [structureRDV]="orientationService.rdvStructure"
         (validatePage)="validatePage($event)"
         (validateStructureRDV)="validateStructureRDV($event)"
         (failedOrientation)="setFailedOrientation()"
diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index 33257bab3..005415a56 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -340,6 +340,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         return new Filter(this.needType, module.id, module.displayText);
       });
       this.startsAccompanimentTunnel();
+      return;
     }
 
     this.currentStep++;
-- 
GitLab


From 287b565476f9cc3e8be9bbaa55f8687f350fc3a8 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Tue, 20 Aug 2024 15:33:41 +0200
Subject: [PATCH 20/23] Fixed no appointment available, should go to last
 screen instead

---
 .../orientation-form-view/orientation-form-view.component.ts  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index 005415a56..f3ac82ca6 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -270,7 +270,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     // Check if the new screen must be skipped
     this.checkSkipInfoScreen(true);
-    this.checkHasEligibleStructures();
+    await this.checkHasEligibleStructures();
     this.checkSkipCartoScreens('next');
     this.checkSkipStructureOrientator(true);
 
@@ -429,7 +429,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       if (eligibleStructures.length === 0) {
         this.sendOrientationIndicator(this.structureOrientationForm ?? this.onlineDemarcheForm);
         this.failedOrientation = true;
-        this.currentStep = AppointmentSteps.rdvEnd - 1;
+        this.currentStep = AppointmentSteps.rdvEnd;
       }
     }
   }
-- 
GitLab


From c08249852ffdd3d49bebd5bd82f1f4203935b57f Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Tue, 20 Aug 2024 15:57:11 +0200
Subject: [PATCH 21/23] Fixed the filters reset when going back from tunnel

---
 .../orientation-form-view/orientation-form-view.component.ts   | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/app/form/orientation-form-view/orientation-form-view.component.ts b/src/app/form/orientation-form-view/orientation-form-view.component.ts
index f3ac82ca6..6bf919f90 100644
--- a/src/app/form/orientation-form-view/orientation-form-view.component.ts
+++ b/src/app/form/orientation-form-view/orientation-form-view.component.ts
@@ -270,7 +270,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
 
     // Check if the new screen must be skipped
     this.checkSkipInfoScreen(true);
-    await this.checkHasEligibleStructures();
+    this.checkHasEligibleStructures();
     this.checkSkipCartoScreens('next');
     this.checkSkipStructureOrientator(true);
 
@@ -359,7 +359,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
           this.genericStep = GenericOrientationSteps.common;
           this.currentStep = CommonSteps.filtersChoice;
           if (this.isOnlineDemarchOrBaseSkills()) {
-            this.filtersForm = this.orientationUtils.createFiltersForm();
             this.onlineDemarcheForm = this.orientationUtils.createOnlineDemarchesForm();
             if (!this.isComingFromCartoOrRegistry()) {
               this.currentStep = CommonSteps.accompanimentType;
-- 
GitLab


From 8f243bd995808f2d27f9d7c63f47da0a707a4730 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Tue, 20 Aug 2024 16:22:40 +0200
Subject: [PATCH 22/23] Removed the reset selectedStructures

---
 .../orientation-structure-list.component.ts                   | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
index ce7e98068..be95e999d 100644
--- a/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
+++ b/src/app/form/orientation-form-view/orientation-structure-list/orientation-structure-list.component.ts
@@ -39,10 +39,6 @@ export class OrientationStructureListComponent implements OnChanges {
   }
 
   public checkValidation(event?: any): void {
-    // Reset value of selected structure in case of multiple previous
-    if (this.currentStep === StructuresListSteps.address) {
-      this.selectedStructures = [];
-    }
     if (this.currentStep === StructuresListSteps.structureChoice) {
       this.selectedStructures = event;
       this.form.get('structureChoice').setValue(event);
-- 
GitLab


From 53d1a2634ff2cb38049000d52a2a840e3b29d1d9 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Wed, 21 Aug 2024 10:11:18 +0200
Subject: [PATCH 23/23] Fixed goPrev in make-appointment

---
 .../make-appointment.component.html                |  4 ++--
 .../make-appointment/make-appointment.component.ts | 14 ++++++--------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.html b/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.html
index 0a0ec9ae9..7037b1967 100644
--- a/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.html
@@ -8,7 +8,7 @@
   </div>
 
   <!-- If need to select a social worker -->
-  <section *ngIf="owners?.length > 0">
+  <section *ngIf="!comingFromRegistry">
     <div class="header-card">
       <app-card [structure]="structureRDV" [redirectToStructure]="false" />
     </div>
@@ -31,7 +31,7 @@
   </section>
 
   <!-- If need to select a structure -->
-  <section *ngIf="structures?.length > 0">
+  <section *ngIf="comingFromRegistry">
     <div class="header-card">
       <app-member-card
         [member]="orientationService.rdvUser"
diff --git a/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.ts b/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.ts
index 7d287ff42..0eeb9ea3f 100644
--- a/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/appointment/make-appointment/make-appointment.component.ts
@@ -22,9 +22,8 @@ export class MakeAppointmentComponent implements OnInit {
 
   public owners: Owner[];
   public structures: Structure[] = [];
-  public isBaseskills = false;
-  public isOnlineProcedures = false;
   public structuresListReady: boolean;
+  public comingFromRegistry: boolean;
 
   private onlineDemarcheType;
   private filtersOnOffers;
@@ -36,25 +35,24 @@ export class MakeAppointmentComponent implements OnInit {
 
   ngOnInit(): void {
     this.checkValidation.emit();
+    this.comingFromRegistry = this.orientationService.rdvUser !== null;
 
-    // build arrays containing the needs the user selected in the form
+    // When no appointment available, we need to know the name of the filters requested to display them
     if (this.structureRDV?._id || this.orientationService.rdvUser) {
       this.onlineDemarcheType = this.form.get('onlineDemarcheType').value;
       this.filtersOnOffers = { onlineProcedures: [], baseSkills: [] };
       this.onlineDemarcheType.forEach((filter) => {
         if (filter.name === 'onlineProcedures') {
           this.filtersOnOffers.onlineProcedures.push(filter.value);
-          this.isOnlineProcedures = true;
         }
         if (filter.name === 'baseSkills') {
           this.filtersOnOffers.baseSkills.push(filter.value);
-          this.isBaseskills = true;
         }
       });
     }
 
     // Filters owners that accept appointments, have personal offers in the selected structure and match the needs previously selected
-    if (this.structureRDV?._id) {
+    if (!this.comingFromRegistry) {
       this.findOwners(this.structureRDV._id).subscribe((owners) => {
         const filteredOwners = [];
         this.owners = owners.filter((owner) => owner.withAppointment && owner.job?.hasPersonalOffer);
@@ -87,8 +85,8 @@ export class MakeAppointmentComponent implements OnInit {
           this.failedOrientation.emit();
         }
       });
-    } else if (this.orientationService.rdvUser) {
-      // else if we come from the registry, list the registry's user's structures
+    } else {
+      // If we come from the registry, list the registry's user's structures
       const structures$: Observable<any>[] = [];
       this.structures = [];
       this.orientationService.rdvUser.structuresLink.forEach((structureId) => {
-- 
GitLab