From 313997f22b4c7395e185de81a7ea98b6ed05c68e Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Fri, 16 Feb 2024 08:26:57 +0100
Subject: [PATCH 1/8] Moved structureOrientator when requesting a structure
 list

---
 .../form/orientation-form-view/enums/orientation.enums.ts   | 2 +-
 src/app/utils/orientationUtils.ts                           | 6 +++---
 2 files changed, 4 insertions(+), 4 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 84c3b9ee7..3294d74fe 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -58,8 +58,8 @@ export enum StructuresListSteps {
   pmrAccess,
   address,
   structureChoice,
-  structureOrientator,
   mediationBeneficiaryInfo,
   comments,
+  structureOrientator,
   orientationRecap,
 }
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index f46437089..b459be80d 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -171,13 +171,13 @@ export class OrientationUtils {
     pagesValidation[StructuresListSteps.structureChoice] = {
       valid: form.get('structureChoice').valid,
     };
-    pagesValidation[StructuresListSteps.structureOrientator] = {
-      valid: form.get('structureOrientator').valid,
-    };
     pagesValidation[StructuresListSteps.mediationBeneficiaryInfo] = {
       valid: form.get('name').valid && form.get('surname').valid,
     };
     pagesValidation[StructuresListSteps.comments] = { valid: true };
+    pagesValidation[StructuresListSteps.structureOrientator] = {
+      valid: form.get('structureOrientator').valid,
+    };
     pagesValidation[StructuresListSteps.orientationRecap] = { valid: true };
     updatePageValid(pagesValidation[step].valid);
   }
-- 
GitLab


From 27e576331abab49f91405088d1a68e4bdeea65b0 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Mon, 19 Feb 2024 10:58:47 +0100
Subject: [PATCH 2/8] Added the recap screen after taking an appointment

---
 .../enums/orientation.enums.ts                |  2 +
 .../orientation-recap.component.html          | 39 ++++++++++++++-----
 .../orientation-recap.component.ts            | 29 ++++++++++++--
 .../make-appointment.component.html           |  1 +
 .../onlineDemarch-form.component.html         |  8 ++++
 .../orientation-form-view.component.ts        |  9 +++--
 src/app/structure-list/models/filter.model.ts |  2 +-
 src/app/utils/orientationUtils.ts             |  2 +
 8 files changed, 75 insertions(+), 17 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 3294d74fe..b92818424 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -7,6 +7,7 @@ export enum AppointmentSteps {
   makeAppointment,
   mediationBeneficiaryInfo,
   rdvEnd,
+  orientationRecap,
 }
 
 export enum FiltersSteps {
@@ -50,6 +51,7 @@ export enum PreferredLanguages {
   arabic = 'Arabe',
 }
 export enum RecapsType {
+  appointment,
   onlineMediation,
   structure,
 }
diff --git a/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.html b/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.html
index 3d06e8202..144f9e665 100644
--- a/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.html
+++ b/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.html
@@ -1,14 +1,7 @@
 <app-print-header />
 <div class="container" [ngClass]="{ onlineMediation: recap }">
   <div class="main">
-    <div *ngIf="isOrientator()" class="orientator header">
-      <h3 class="uppercase">Orienté par</h3>
-      <div class="content">
-        <div class="infos structureName">{{ orientator.structureName }}</div>
-        <div *ngIf="orientator.structureMail" class="infos">{{ orientator.structureMail }}</div>
-        <div *ngIf="orientator.structurePhone" class="infos">{{ orientator.structurePhone }}</div>
-      </div>
-    </div>
+    <!-- Client info -->
     <div class="beneficiary header">
       <h3 class="uppercase">Bénéficiaire</h3>
       <div class="content">
@@ -36,7 +29,34 @@
         </div>
       </div>
     </div>
+
+    <!-- Appointment requested -->
+    <div *ngIf="shouldDisplayAppointmentRecap()" class="orientator header">
+      <h3 class="uppercase">Demande de rendez-vous auprès de</h3>
+      <div class="content">
+        <div class="label">Nom</div>
+        <div class="info">{{ socialWorker?.name | userName }} {{ socialWorker?.surname | uppercase }}</div>
+        <div class="infos structureName">{{ structureRDV?.structureName }}</div>
+        <div *ngIf="structureRDV?.contactPersonEmail" class="infos">
+          {{ structureRDV?.contactPersonEmail }}
+        </div>
+        <div *ngIf="structureRDV?.contactPhone" class="infos">
+          {{ structureRDV?.contactPhone }}
+        </div>
+      </div>
+    </div>
+
+    <!-- Orientator -->
+    <div *ngIf="isOrientator()" class="orientator header">
+      <h3 class="uppercase">Orienté par</h3>
+      <div class="content">
+        <div class="infos structureName">{{ orientator.structureName }}</div>
+        <div *ngIf="orientator.structureMail" class="infos">{{ orientator.structureMail }}</div>
+        <div *ngIf="orientator.structurePhone" class="infos">{{ orientator.structurePhone }}</div>
+      </div>
+    </div>
   </div>
+
   <!-- Date display -->
   <div *ngIf="recap" class="date">
     <div class="bold">Informations du rendez-vous :</div>
@@ -46,8 +66,9 @@
     >&nbsp;<span class="red bold month">{{ recap.month }}</span
     >&nbsp;<span>entre {{ recap.hours }}</span>
   </div>
+
+  <!-- Structure list -->
   <div *ngFor="let structure of structuresToPrint" class="structure">
-    <!-- Structure list -->
     <div class="title">Informations de la structure :</div>
     <app-structure-detail-print [structure]="structure" />
   </div>
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 d6f6f83d2..e6cc24c4d 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
@@ -1,8 +1,10 @@
 import { DatePipe } from '@angular/common';
 import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
 import { UntypedFormGroup } from '@angular/forms';
+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';
 
 @Component({
@@ -13,20 +15,29 @@ import { RecapsType } from '../../enums/orientation.enums';
 export class OrientationRecapComponent implements OnInit {
   @Input() form: UntypedFormGroup;
   @Input() recapType: RecapsType;
+  @Input() socialWorker?: Owner;
+  @Input() structureRDV?: Structure;
   @Output() checkValidation = new EventEmitter<any>();
 
+  public utils = new Utils();
   public needs: Module[];
   public structuresToPrint: Structure[];
   public orientator: { structureName: string; structureMail: string; structurePhone: string };
   public comment: string;
-  public beneficiary: any;
+  public beneficiary: { name: string; surname: string };
   public recap: { day: string; hours: string; month: string; language?: string };
 
   constructor(private datePipe: DatePipe) {}
 
   ngOnInit(): void {
     this.checkValidation.emit();
-    this.needs = this.form.get('filters').value;
+    // 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) {
+      this.needs = this.utils.convertFiltersToModule(this.form.get('onlineDemarcheType').value);
+    } else {
+      this.needs = this.form.get('filters').value;
+    }
     this.beneficiary = {
       name: this.form.get('name').value,
       surname: this.form.get('surname').value,
@@ -35,6 +46,9 @@ export class OrientationRecapComponent implements OnInit {
       case RecapsType.onlineMediation:
         this.handleOnlineOrientationRecap();
         break;
+      case RecapsType.appointment:
+        this.handleAppointmentRecap();
+        break;
       case RecapsType.structure:
         this.handleStructureRecap();
         break;
@@ -43,6 +57,15 @@ export class OrientationRecapComponent implements OnInit {
     }
   }
 
+  public shouldDisplayAppointmentRecap(): boolean {
+    return this.recapType === RecapsType.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;
@@ -50,7 +73,7 @@ export class OrientationRecapComponent implements OnInit {
   }
 
   public isOrientator(): boolean {
-    return this.orientator?.structureName ? true : false;
+    return !!this.orientator?.structureName;
   }
 
   public handleOnlineOrientationRecap(): void {
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 ed446c3d1..ee3ef7452 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
@@ -17,6 +17,7 @@
           *ngFor="let owner of owners"
           role="listitem"
           [member]="owner"
+          [redirectToProfile]="false"
           [showRadioButton]="true"
           [showContactInfo]="false"
           [showEmployer]="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 551ec89f8..2d378abe8 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
@@ -75,6 +75,14 @@
     (checkValidation)="checkValidation()"
     (setResetOrientation)="showResetOrientation()"
   />
+  <app-orientation-recap
+    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.orientationRecap"
+    [form]="form"
+    [recapType]="RecapsType.appointment"
+    [socialWorker]="socialWorker"
+    [structureRDV]="structureRDV"
+    (checkValidation)="checkValidation()"
+  />
 </ng-container>
 <!-- ONLINE MEDIATION FORM -->
 <ng-container *ngIf="currentType === OnlineDemarche.onlineMediation">
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 1697d8c62..19e829a74 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
@@ -210,11 +210,12 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       this.currentStep === HotlineMediationSteps.orientationRecap;
     const isStructureListOrientationRecap =
       this.currentType === OnlineDemarche.structureList && this.currentStep === StructuresListSteps.orientationRecap;
-    const isAppointmentRdvEnd =
+    const isAppointmentOrientationRecap =
       isOnlineDemarcheOrLearnSkills &&
       this.currentType === OnlineDemarche.appointment &&
-      this.currentStep === AppointmentSteps.rdvEnd;
-    this.isLastStep = isOnlineMediationOrientationRecap || isStructureListOrientationRecap || isAppointmentRdvEnd;
+      this.currentStep === AppointmentSteps.orientationRecap;
+    this.isLastStep =
+      isOnlineMediationOrientationRecap || isStructureListOrientationRecap || isAppointmentOrientationRecap;
   }
 
   /**
@@ -485,7 +486,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       }
 
       // after last page, go to new orientation
-      if (this.currentStep === AppointmentSteps.rdvEnd) {
+      if (this.currentStep === AppointmentSteps.orientationRecap) {
         this.sendOrientationIndicator(this.structureOrientationForm ?? this.onlineDemarcheForm);
         history.pushState({ rdvStructure: null, rdvUser: null }, '', '/orientation');
         window.location.reload();
diff --git a/src/app/structure-list/models/filter.model.ts b/src/app/structure-list/models/filter.model.ts
index 87f5b5ae4..35bb660b7 100644
--- a/src/app/structure-list/models/filter.model.ts
+++ b/src/app/structure-list/models/filter.model.ts
@@ -5,7 +5,7 @@ export class Filter {
   checked: boolean;
   orOperator: boolean;
 
-  constructor(name: string, value: any, text?: string, orOperator = false) {
+  constructor(name: string, value: string, text?: string, orOperator = false) {
     this.name = name;
     this.value = value.toString();
     this.text = text;
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index b459be80d..7bc724279 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -94,6 +94,7 @@ export class OrientationUtils {
       structureRDV: new FormControl('', Validators.required),
       pmrAccess: new FormControl(null, Validators.required),
       address: new FormControl(''),
+      // filters: new FormControl<Module[]>(onlineDemarcheType, Validators.required),
       onlineDemarcheType: new FormControl(onlineDemarcheType),
       socialWorkerId: new FormControl('', Validators.required),
       details: new FormControl(''),
@@ -213,6 +214,7 @@ export class OrientationUtils {
     pagesValidation[AppointmentSteps.rdvEnd] = {
       valid: true,
     };
+    pagesValidation[AppointmentSteps.orientationRecap] = { valid: true };
 
     updatePageValid(pagesValidation[step].valid);
   }
-- 
GitLab


From cfd5644d4783c142e906c5fdfd063bd5899ce3bf Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Mon, 19 Feb 2024 11:32:15 +0100
Subject: [PATCH 3/8] Added comments page in Online Mediation

---
 .../form/orientation-form-view/enums/orientation.enums.ts    | 1 +
 .../orientation-recap/orientation-recap.component.ts         | 1 +
 .../interfaces/onlineMediation.interface.ts                  | 1 +
 .../online-demarch/onlineDemarch-form.component.html         | 5 +++++
 src/app/utils/orientationUtils.ts                            | 4 ++++
 5 files changed, 12 insertions(+)

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 b92818424..f9d56f05d 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -24,6 +24,7 @@ export enum HotlineMediationSteps {
   mediationBeneficiaryInfo,
   mediationHoursSelection,
   mediationLanguageSelection,
+  comments,
   orientationRecap,
 }
 
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 e6cc24c4d..f52139da8 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
@@ -77,6 +77,7 @@ export class OrientationRecapComponent implements OnInit {
   }
 
   public handleOnlineOrientationRecap(): void {
+    this.comment = this.form.get('comments').value;
     const monthNumber = parseInt(this.form.get('dateSlot').value.day.slice(-2));
     const monthName = this.datePipe.transform(`2000-${monthNumber}-01`, 'MMMM', 'fr');
 
diff --git a/src/app/form/orientation-form-view/interfaces/onlineMediation.interface.ts b/src/app/form/orientation-form-view/interfaces/onlineMediation.interface.ts
index fd27e71f0..ed306ca74 100644
--- a/src/app/form/orientation-form-view/interfaces/onlineMediation.interface.ts
+++ b/src/app/form/orientation-form-view/interfaces/onlineMediation.interface.ts
@@ -5,4 +5,5 @@ export interface IOnlineMediation {
   onlineDemarcheType: string[];
   dateSlot: { day: string; hours: string };
   preferredLanguage: string;
+  comment: 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 2d378abe8..32a8088fd 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
@@ -106,6 +106,11 @@
     [form]="form"
     (checkValidation)="checkValidation()"
   />
+  <app-orientation-comments
+    *ngIf="currentStep === HotlineMediationSteps.comments"
+    [form]="form"
+    (checkValidation)="checkValidation()"
+  />
   <app-orientation-recap
     *ngIf="currentStep === HotlineMediationSteps.orientationRecap"
     [form]="form"
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index 7bc724279..cbbc398df 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -55,6 +55,7 @@ export class OrientationUtils {
       phone: new UntypedFormControl('', [Validators.required, Validators.pattern(CustomRegExp.PHONE)]),
       dateSlot: new UntypedFormControl(null, Validators.required),
       preferredLanguage: new UntypedFormControl(PreferredLanguages.french, Validators.required),
+      comments: new UntypedFormControl('', Validators.required),
     });
   }
 
@@ -153,6 +154,9 @@ export class OrientationUtils {
     pagesValidation[HotlineMediationSteps.mediationLanguageSelection] = {
       valid: true,
     };
+    pagesValidation[HotlineMediationSteps.comments] = {
+      valid: true,
+    };
     pagesValidation[HotlineMediationSteps.orientationRecap] = {
       valid: true,
     };
-- 
GitLab


From 3b907b96a772e453db4771758eadaebb1d7cdea4 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Mon, 19 Feb 2024 13:58:02 +0100
Subject: [PATCH 4/8] Added structure orientator in online mediation

---
 .../orientation-form-view/enums/orientation.enums.ts   |  1 +
 .../orientation-recap/orientation-recap.component.ts   |  1 +
 .../interfaces/onlineMediation.interface.ts            |  1 +
 .../online-demarch/onlineDemarch-form.component.html   |  6 ++++++
 .../orientation-form-view.component.ts                 |  1 +
 src/app/utils/orientationUtils.ts                      | 10 ++++++++--
 6 files changed, 18 insertions(+), 2 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 f9d56f05d..d35c09b2c 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -25,6 +25,7 @@ export enum HotlineMediationSteps {
   mediationHoursSelection,
   mediationLanguageSelection,
   comments,
+  structureOrientator,
   orientationRecap,
 }
 
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 f52139da8..de9cc90c3 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
@@ -78,6 +78,7 @@ export class OrientationRecapComponent implements OnInit {
 
   public handleOnlineOrientationRecap(): void {
     this.comment = this.form.get('comments').value;
+    this.orientator = this.form.get('structureOrientator').value;
     const monthNumber = parseInt(this.form.get('dateSlot').value.day.slice(-2));
     const monthName = this.datePipe.transform(`2000-${monthNumber}-01`, 'MMMM', 'fr');
 
diff --git a/src/app/form/orientation-form-view/interfaces/onlineMediation.interface.ts b/src/app/form/orientation-form-view/interfaces/onlineMediation.interface.ts
index ed306ca74..0e7616003 100644
--- a/src/app/form/orientation-form-view/interfaces/onlineMediation.interface.ts
+++ b/src/app/form/orientation-form-view/interfaces/onlineMediation.interface.ts
@@ -6,4 +6,5 @@ export interface IOnlineMediation {
   dateSlot: { day: string; hours: string };
   preferredLanguage: string;
   comment: string;
+  structureOrientator: { structureName: string; structureMail: string; structurePhone: 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 32a8088fd..d8511dcad 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
@@ -111,6 +111,12 @@
     [form]="form"
     (checkValidation)="checkValidation()"
   />
+  <app-structure-orientator
+    *ngIf="currentStep === HotlineMediationSteps.structureOrientator"
+    [profile]="profile"
+    [form]="form"
+    (validatePage)="checkValidation()"
+  />
   <app-orientation-recap
     *ngIf="currentStep === HotlineMediationSteps.orientationRecap"
     [form]="form"
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 19e829a74..cfb242790 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
@@ -301,6 +301,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         this.setStepNumber(Object.keys(HotlineMediationSteps).length);
         this.onlineDemarcheForm = this.orientationUtils.createOnlineMediationForm(
           this.utils.convertFiltersToModule(this.filters),
+          this.orientator,
         );
         break;
       default:
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index cbbc398df..d5a5d3a1c 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -47,7 +47,10 @@ export class OrientationUtils {
     });
   }
 
-  public createOnlineMediationForm(onlineDemarcheType: Module[]): UntypedFormGroup {
+  public createOnlineMediationForm(
+    onlineDemarcheType: Module[],
+    orientatorForm?: FormGroup<StructureOrientator>,
+  ): UntypedFormGroup {
     return new UntypedFormGroup({
       filters: new FormControl<Module[]>(onlineDemarcheType, Validators.required),
       name: new UntypedFormControl('', [Validators.required, Validators.pattern(CustomRegExp.TEXT_WITHOUT_NUMBER)]),
@@ -56,6 +59,7 @@ export class OrientationUtils {
       dateSlot: new UntypedFormControl(null, Validators.required),
       preferredLanguage: new UntypedFormControl(PreferredLanguages.french, Validators.required),
       comments: new UntypedFormControl('', Validators.required),
+      structureOrientator: orientatorForm || this.createStructureOrientatorForm(),
     });
   }
 
@@ -95,7 +99,6 @@ export class OrientationUtils {
       structureRDV: new FormControl('', Validators.required),
       pmrAccess: new FormControl(null, Validators.required),
       address: new FormControl(''),
-      // filters: new FormControl<Module[]>(onlineDemarcheType, Validators.required),
       onlineDemarcheType: new FormControl(onlineDemarcheType),
       socialWorkerId: new FormControl('', Validators.required),
       details: new FormControl(''),
@@ -157,6 +160,9 @@ export class OrientationUtils {
     pagesValidation[HotlineMediationSteps.comments] = {
       valid: true,
     };
+    pagesValidation[HotlineMediationSteps.structureOrientator] = {
+      valid: form.get('structureOrientator').valid,
+    };
     pagesValidation[HotlineMediationSteps.orientationRecap] = {
       valid: true,
     };
-- 
GitLab


From f9470f85d08cf58665fc0b6dff4d56b756b30389 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Mon, 19 Feb 2024 14:03:23 +0100
Subject: [PATCH 5/8] Added the recap page before printing

---
 .../form/orientation-form-view/enums/orientation.enums.ts   | 1 +
 .../online-demarch/onlineDemarch-form.component.html        | 6 ++++++
 .../orientation-form-view.component.ts                      | 4 ++--
 src/app/utils/orientationUtils.ts                           | 3 +++
 4 files changed, 12 insertions(+), 2 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 d35c09b2c..30e7472fa 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -27,6 +27,7 @@ export enum HotlineMediationSteps {
   comments,
   structureOrientator,
   orientationRecap,
+  orientationPrint,
 }
 
 export enum OnlineDemarche {
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 d8511dcad..1335b05fe 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
@@ -123,6 +123,12 @@
     [recapType]="RecapsType.onlineMediation"
     (checkValidation)="checkValidation()"
   />
+  <app-orientation-recap
+    *ngIf="currentStep === HotlineMediationSteps.orientationPrint"
+    [form]="form"
+    [recapType]="RecapsType.onlineMediation"
+    (checkValidation)="checkValidation()"
+  />
 </ng-container>
 <!-- STRUCTURE LIST FORM -->
 <app-orientation-structure-list
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 cfb242790..9ce8f0350 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
@@ -207,7 +207,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     const isOnlineMediationOrientationRecap =
       isOnlineDemarcheOrLearnSkills &&
       this.currentType === OnlineDemarche.onlineMediation &&
-      this.currentStep === HotlineMediationSteps.orientationRecap;
+      this.currentStep === HotlineMediationSteps.orientationPrint;
     const isStructureListOrientationRecap =
       this.currentType === OnlineDemarche.structureList && this.currentStep === StructuresListSteps.orientationRecap;
     const isAppointmentOrientationRecap =
@@ -420,7 +420,7 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       // Handle last screen Online appointment and print
       if (
         this.currentType === OnlineDemarche.onlineMediation &&
-        this.currentStep === HotlineMediationSteps.orientationRecap
+        this.currentStep === HotlineMediationSteps.orientationPrint
       ) {
         await this.handleOnlineAppointment();
         return;
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index d5a5d3a1c..ab8181b1b 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -166,6 +166,9 @@ export class OrientationUtils {
     pagesValidation[HotlineMediationSteps.orientationRecap] = {
       valid: true,
     };
+    pagesValidation[HotlineMediationSteps.orientationPrint] = {
+      valid: true,
+    };
     updatePageValid(pagesValidation[step].valid);
   }
 
-- 
GitLab


From 7517e96441a3789264f7b2506da4280c1cffcb6e Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Mon, 19 Feb 2024 14:36:21 +0100
Subject: [PATCH 6/8] Added the success information page

---
 .../enums/orientation.enums.ts                     |  1 +
 .../appointment-end/appointment-end.component.html | 14 ++++++++++++--
 .../appointment-end/appointment-end.component.ts   |  7 ++++---
 .../onlineDemarch-form.component.html              |  7 +++++++
 .../orientation-form-view.component.ts             | 12 +++++++-----
 src/app/utils/orientationUtils.ts                  |  3 +++
 6 files changed, 34 insertions(+), 10 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 30e7472fa..1fbce46b1 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -27,6 +27,7 @@ export enum HotlineMediationSteps {
   comments,
   structureOrientator,
   orientationRecap,
+  rdvEnd,
   orientationPrint,
 }
 
diff --git a/src/app/form/orientation-form-view/online-demarch/appointment/appointment-end/appointment-end.component.html b/src/app/form/orientation-form-view/online-demarch/appointment/appointment-end/appointment-end.component.html
index 8882e6fe1..fd6834e67 100644
--- a/src/app/form/orientation-form-view/online-demarch/appointment/appointment-end/appointment-end.component.html
+++ b/src/app/form/orientation-form-view/online-demarch/appointment/appointment-end/appointment-end.component.html
@@ -1,4 +1,5 @@
-<div *ngIf="hasStructure" class="container">
+<!-- Appointment success -->
+<div *ngIf="!isOnlineMediation && hasStructure" class="container">
   <img src="../../../../../../assets/form/structureCreated.svg" alt="rdv illustration" />
   <h2>Votre demande de rendez-vous a été transmise !</h2>
   <p>
@@ -11,7 +12,16 @@
     <b>{{ structureRDV?.structureName || selectedStructureRDV?.structureName }}</b>
   </p>
 </div>
-<div *ngIf="!hasStructure" class="container">
+
+<!-- Hotline appointment success -->
+<div *ngIf="isOnlineMediation" class="container">
+  <img src="../../../../../../assets/form/structureCreated.svg" alt="rdv illustration" />
+  <h2>Votre demande de médiation à distance a été transmise !</h2>
+  <p>La demande de <b>médiation à distance</b> a bien été transmise.</p>
+</div>
+
+<!-- No structure found -->
+<div *ngIf="!isOnlineMediation && !hasStructure" class="container">
   <img src="../../../../../../assets/img/joinRefused.svg" alt="rdv illustration" />
   <h2>Aucune structure correspondant à votre recherche ne propose de rendez-vous</h2>
   <p>Merci de renouveler votre recherche avec des critères différents ou accédez à la cartographie</p>
diff --git a/src/app/form/orientation-form-view/online-demarch/appointment/appointment-end/appointment-end.component.ts b/src/app/form/orientation-form-view/online-demarch/appointment/appointment-end/appointment-end.component.ts
index b259b9fc9..9688588a2 100644
--- a/src/app/form/orientation-form-view/online-demarch/appointment/appointment-end/appointment-end.component.ts
+++ b/src/app/form/orientation-form-view/online-demarch/appointment/appointment-end/appointment-end.component.ts
@@ -12,9 +12,10 @@ import { OrientationService } from '../../../../../services/orientation.service'
 })
 export class AppointmentEndComponent implements OnInit {
   @Input() form: UntypedFormGroup;
-  @Input() structureRDV: Structure;
-  @Input() socialWorker: Owner;
-  @Input() selectedStructureRDV: Structure;
+  @Input() structureRDV?: Structure;
+  @Input() socialWorker?: Owner;
+  @Input() selectedStructureRDV?: Structure;
+  @Input() isOnlineMediation = false;
   @Output() setResetOrientation = new EventEmitter();
   @Output() checkValidation = new EventEmitter<any>();
 
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 1335b05fe..4bf5bf650 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
@@ -123,6 +123,13 @@
     [recapType]="RecapsType.onlineMediation"
     (checkValidation)="checkValidation()"
   />
+  <app-appointment-end
+    *ngIf="currentStep === HotlineMediationSteps.rdvEnd"
+    [form]="form"
+    [isOnlineMediation]="true"
+    (checkValidation)="checkValidation()"
+    (setResetOrientation)="showResetOrientation()"
+  />
   <app-orientation-recap
     *ngIf="currentStep === HotlineMediationSteps.orientationPrint"
     [form]="form"
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 9ce8f0350..31c6b4084 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
@@ -243,13 +243,11 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
     };
     await lastValueFrom(this.orientationService.createOnlineMediation(toCreate))
       .then(() => {
-        this.canDeactivate = true;
         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');
-      })
-      .finally(() => this.printForm());
+      });
   }
 
   public printForm(): void {
@@ -417,12 +415,16 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         this.previousNeedType = this.needType;
         return;
       }
-      // Handle last screen Online appointment and print
+      // Handle Online appointment
       if (
         this.currentType === OnlineDemarche.onlineMediation &&
-        this.currentStep === HotlineMediationSteps.orientationPrint
+        this.currentStep === HotlineMediationSteps.rdvEnd - 1
       ) {
         await this.handleOnlineAppointment();
+      }
+      // Handle last screen Online appointment and print
+      if (this.currentStep === HotlineMediationSteps.orientationPrint) {
+        this.printForm();
         return;
       }
       // Handle last screen appointment
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index ab8181b1b..6d6c6658f 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -166,6 +166,9 @@ export class OrientationUtils {
     pagesValidation[HotlineMediationSteps.orientationRecap] = {
       valid: true,
     };
+    pagesValidation[HotlineMediationSteps.rdvEnd] = {
+      valid: true,
+    };
     pagesValidation[HotlineMediationSteps.orientationPrint] = {
       valid: true,
     };
-- 
GitLab


From 0bcae81cc0089692b61ef1941b93441b43285c18 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Tue, 20 Feb 2024 15:38:04 +0100
Subject: [PATCH 7/8] Moved structureOrientator in appointment section

---
 .../orientation-form-view/enums/orientation.enums.ts |  2 +-
 .../online-demarch/onlineDemarch-form.component.html | 12 ++++++------
 .../orientation-form-view.component.ts               |  6 +++---
 src/app/utils/orientationUtils.ts                    |  6 +++---
 4 files changed, 13 insertions(+), 13 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 1fbce46b1..ef4c4b7b1 100644
--- a/src/app/form/orientation-form-view/enums/orientation.enums.ts
+++ b/src/app/form/orientation-form-view/enums/orientation.enums.ts
@@ -1,11 +1,11 @@
 export enum AppointmentSteps {
   infoScreen,
-  structureOrientator,
   pmrAccess,
   location,
   carto,
   makeAppointment,
   mediationBeneficiaryInfo,
+  structureOrientator,
   rdvEnd,
   orientationRecap,
 }
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 4bf5bf650..de89d9d6a 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
@@ -25,12 +25,6 @@
     [currentType]="currentType"
     (checkValidation)="checkValidation()"
   />
-  <app-structure-orientator
-    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.structureOrientator"
-    [profile]="profile"
-    [form]="form"
-    (validatePage)="checkValidation()"
-  />
   <app-structure-pmr
     *ngIf="currentStep === OnlineDemarchesAppointmentSteps.pmrAccess"
     [structureForm]="form"
@@ -66,6 +60,12 @@
     [isOrientationRdv]="true"
     (checkValidation)="checkValidation()"
   />
+  <app-structure-orientator
+    *ngIf="currentStep === OnlineDemarchesAppointmentSteps.structureOrientator"
+    [profile]="profile"
+    [form]="form"
+    (validatePage)="checkValidation()"
+  />
   <app-appointment-end
     *ngIf="currentStep === OnlineDemarchesAppointmentSteps.rdvEnd"
     [form]="form"
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 31c6b4084..7bc3a9ad5 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
@@ -545,9 +545,6 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
       ) {
         this.currentStep--;
       }
-      if (this.currentStep === AppointmentSteps.structureOrientator + 1) {
-        this.skipStructureOrientator(false);
-      }
       if (this.indicatorNeedType === NeedsType.learnSkills && this.currentStep === AppointmentSteps.infoScreen + 1) {
         this.currentStep--;
       }
@@ -565,6 +562,9 @@ export class OrientationFormViewComponent implements OnInit, AfterContentChecked
         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
diff --git a/src/app/utils/orientationUtils.ts b/src/app/utils/orientationUtils.ts
index 6d6c6658f..f2614aa0e 100644
--- a/src/app/utils/orientationUtils.ts
+++ b/src/app/utils/orientationUtils.ts
@@ -208,9 +208,6 @@ export class OrientationUtils {
     pagesValidation[AppointmentSteps.infoScreen] = {
       valid: true,
     };
-    pagesValidation[AppointmentSteps.structureOrientator] = {
-      valid: form.get('structureOrientator').valid,
-    };
     pagesValidation[AppointmentSteps.pmrAccess] = {
       valid: form.get('pmrAccess').valid,
     };
@@ -227,6 +224,9 @@ export class OrientationUtils {
       valid:
         form.get('name').valid && form.get('surname').valid && (form.get('phone').valid || form.get('email').valid),
     };
+    pagesValidation[AppointmentSteps.structureOrientator] = {
+      valid: form.get('structureOrientator').valid,
+    };
     pagesValidation[AppointmentSteps.rdvEnd] = {
       valid: true,
     };
-- 
GitLab


From ad660fa94104ebd7fb477aa215bcfdca6d3cf3f9 Mon Sep 17 00:00:00 2001
From: Pierre Ecarlat <pecarlat@grandlyon.com>
Date: Mon, 26 Feb 2024 15:22:19 +0100
Subject: [PATCH 8/8] Removed appointment details in recap page (will be in
 another MR)

---
 .../orientation-recap.component.html          | 39 +++++--------------
 1 file changed, 9 insertions(+), 30 deletions(-)

diff --git a/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.html b/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.html
index 144f9e665..3d06e8202 100644
--- a/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.html
+++ b/src/app/form/orientation-form-view/global-components/orientation-recap/orientation-recap.component.html
@@ -1,7 +1,14 @@
 <app-print-header />
 <div class="container" [ngClass]="{ onlineMediation: recap }">
   <div class="main">
-    <!-- Client info -->
+    <div *ngIf="isOrientator()" class="orientator header">
+      <h3 class="uppercase">Orienté par</h3>
+      <div class="content">
+        <div class="infos structureName">{{ orientator.structureName }}</div>
+        <div *ngIf="orientator.structureMail" class="infos">{{ orientator.structureMail }}</div>
+        <div *ngIf="orientator.structurePhone" class="infos">{{ orientator.structurePhone }}</div>
+      </div>
+    </div>
     <div class="beneficiary header">
       <h3 class="uppercase">Bénéficiaire</h3>
       <div class="content">
@@ -29,34 +36,7 @@
         </div>
       </div>
     </div>
-
-    <!-- Appointment requested -->
-    <div *ngIf="shouldDisplayAppointmentRecap()" class="orientator header">
-      <h3 class="uppercase">Demande de rendez-vous auprès de</h3>
-      <div class="content">
-        <div class="label">Nom</div>
-        <div class="info">{{ socialWorker?.name | userName }} {{ socialWorker?.surname | uppercase }}</div>
-        <div class="infos structureName">{{ structureRDV?.structureName }}</div>
-        <div *ngIf="structureRDV?.contactPersonEmail" class="infos">
-          {{ structureRDV?.contactPersonEmail }}
-        </div>
-        <div *ngIf="structureRDV?.contactPhone" class="infos">
-          {{ structureRDV?.contactPhone }}
-        </div>
-      </div>
-    </div>
-
-    <!-- Orientator -->
-    <div *ngIf="isOrientator()" class="orientator header">
-      <h3 class="uppercase">Orienté par</h3>
-      <div class="content">
-        <div class="infos structureName">{{ orientator.structureName }}</div>
-        <div *ngIf="orientator.structureMail" class="infos">{{ orientator.structureMail }}</div>
-        <div *ngIf="orientator.structurePhone" class="infos">{{ orientator.structurePhone }}</div>
-      </div>
-    </div>
   </div>
-
   <!-- Date display -->
   <div *ngIf="recap" class="date">
     <div class="bold">Informations du rendez-vous :</div>
@@ -66,9 +46,8 @@
     >&nbsp;<span class="red bold month">{{ recap.month }}</span
     >&nbsp;<span>entre {{ recap.hours }}</span>
   </div>
-
-  <!-- Structure list -->
   <div *ngFor="let structure of structuresToPrint" class="structure">
+    <!-- Structure list -->
     <div class="title">Informations de la structure :</div>
     <app-structure-detail-print [structure]="structure" />
   </div>
-- 
GitLab