From d925591fe799c9a48f6a06db66d3ae4c5e7a9fe6 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Thu, 20 May 2021 15:12:21 +0200
Subject: [PATCH 1/4] feat: add remote accompaniment in form and details

---
 src/app/form/form.component.html              | 10 ++++++++++
 src/app/form/form.component.ts                | 11 ++++++++---
 src/app/form/pageType.enum.ts                 | 19 ++++++++++---------
 src/app/models/structure.model.ts             |  1 +
 .../structure-details.component.html          |  5 ++++-
 5 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html
index 635b6f601..455d10040 100644
--- a/src/app/form/form.component.html
+++ b/src/app/form/form.component.html
@@ -770,6 +770,16 @@
           </p>
         </div>
       </div>
+      <div *ngIf="currentPage == pageTypeEnum.structureRemoteAccompaniment" class="page">
+        <div class="title">
+          <h3>Proposez vous un accompagnement à distance ?</h3>
+        </div>
+        <app-radio-form
+          [selectedOption]="getStructureControl('remoteAccompaniment').value"
+          (selectedEvent)="onRadioBtnChange('remoteAccompaniment', $event)"
+        >
+        </app-radio-form>
+      </div>
       <div *ngIf="currentPage == pageTypeEnum.structureWorkshop" class="page">
         <div class="title">
           <h3>Quel(s) atelier(s) au numérique proposez-vous ?</h3>
diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts
index a54e3282a..8c61ff5b5 100644
--- a/src/app/form/form.component.ts
+++ b/src/app/form/form.component.ts
@@ -48,7 +48,7 @@ export class FormComponent implements OnInit {
   // Page and progress var
   public currentPage = 0; // Change this value to start on a different page for dev testing
   public progressStatus = 0;
-  public nbPagesForm = 23;
+  public nbPagesForm = 24;
   public isPageValid: boolean;
   public pagesValidation = [];
 
@@ -248,7 +248,7 @@ export class FormComponent implements OnInit {
   }
 
   private createStructureForm(structure): FormGroup {
-    const form = new FormGroup({
+    return new FormGroup({
       _id: new FormControl(structure._id),
       coord: new FormControl(structure.coord),
       structureType: new FormControl(structure.structureType, Validators.required),
@@ -280,6 +280,7 @@ export class FormComponent implements OnInit {
       accessModality: this.loadArrayForCheckbox(structure.accessModality, true),
       publicsAccompaniment: this.loadArrayForCheckbox(structure.publicsAccompaniment, false),
       proceduresAccompaniment: this.loadArrayForCheckbox(structure.proceduresAccompaniment, false),
+      remoteAccompaniment: new FormControl(structure.remoteAccompaniment, Validators.required),
       otherDescription: new FormControl(structure.otherDescription),
       equipmentsAndServices: this.loadArrayForCheckbox(structure.equipmentsAndServices, false),
       publics: this.loadArrayForCheckbox(structure.publics, true),
@@ -310,7 +311,7 @@ export class FormComponent implements OnInit {
       ]),
       freeWorkShop: new FormControl(structure.freeWorkShop, [Validators.required]),
     });
-    return form;
+    //return form;
   }
 
   private showCollapse(s: Structure): void {
@@ -544,6 +545,10 @@ export class FormComponent implements OnInit {
         valid: this.getStructureControl('otherDescription').value,
         name: 'Autres démarches proposés',
       };
+      this.pagesValidation[PageTypeEnum.structureRemoteAccompaniment] = {
+        valid: this.getStructureControl('remoteAccompaniment').valid,
+        name: 'Accompagnement à distance',
+      };
       this.pagesValidation[PageTypeEnum.structureWorkshop] = {
         valid:
           this.getStructureControl('accessRight').valid &&
diff --git a/src/app/form/pageType.enum.ts b/src/app/form/pageType.enum.ts
index 708f64b15..f8be2f0c8 100644
--- a/src/app/form/pageType.enum.ts
+++ b/src/app/form/pageType.enum.ts
@@ -13,13 +13,14 @@ export enum PageTypeEnum {
   structurePublicTarget = 11,
   structureAccompaniment = 12,
   structureOtherAccompaniment = 13,
-  structureWorkshop = 14,
-  structureWorkshopPrice = 15,
-  structureWifi = 16,
-  structureEquipments = 17,
-  structureLabels = 18,
-  structureOtherServices = 19,
-  structureDescription = 20,
-  structureCovidInfo = 21,
-  cgu = 22,
+  structureRemoteAccompaniment = 14,
+  structureWorkshop = 15,
+  structureWorkshopPrice = 16,
+  structureWifi = 17,
+  structureEquipments = 18,
+  structureLabels = 19,
+  structureOtherServices = 20,
+  structureDescription = 21,
+  structureCovidInfo = 22,
+  cgu = 23,
 }
diff --git a/src/app/models/structure.model.ts b/src/app/models/structure.model.ts
index 0aa47e7a1..5fe14f20b 100644
--- a/src/app/models/structure.model.ts
+++ b/src/app/models/structure.model.ts
@@ -25,6 +25,7 @@ export class Structure {
   public pmrAccess: boolean = null;
   public publicsAccompaniment: string[] = [];
   public proceduresAccompaniment: string[] = [];
+  public remoteAccompaniment: boolean = null;
   public accessModality: string[] = [];
   public labelsQualifications: string[] = [];
   public publics: string[] = [];
diff --git a/src/app/structure-list/components/structure-details/structure-details.component.html b/src/app/structure-list/components/structure-details/structure-details.component.html
index 49fff57c4..5d5fcd8d6 100644
--- a/src/app/structure-list/components/structure-details/structure-details.component.html
+++ b/src/app/structure-list/components/structure-details/structure-details.component.html
@@ -167,7 +167,7 @@
   </div>
   <!-- Accueil -->
   <div
-    *ngIf="structure.accessModality.length > 0 || structure.hours.hasData()"
+    *ngIf="structure.accessModality.length > 0 || structure.hours.hasData() || structure.remoteAccompaniment"
     fxLayout="column"
     class="structure-details-block"
     fxLayoutAlign="baseline baseline"
@@ -230,6 +230,9 @@
       <h3 class="subtitle">Précisions sur les horaires</h3>
       <p>{{ structure.exceptionalClosures }}</p>
     </div>
+    <div *ngIf="structure.remoteAccompaniment" class="bold-info">
+      <h3>Cette structure propose un accompagnement à distance.</h3>
+    </div>
   </div>
   <!-- Démarches en ligne -->
   <div
-- 
GitLab


From bd6f8351b1f463d67f2a28bf39f2a54d87a61cdb Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Thu, 20 May 2021 16:19:20 +0200
Subject: [PATCH 2/4] fix: remove number from form page enum

---
 src/app/form/pageType.enum.ts | 48 +++++++++++++++++------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/app/form/pageType.enum.ts b/src/app/form/pageType.enum.ts
index f8be2f0c8..7ce4cd632 100644
--- a/src/app/form/pageType.enum.ts
+++ b/src/app/form/pageType.enum.ts
@@ -1,26 +1,26 @@
 export enum PageTypeEnum {
-  summary = 0,
-  info = 1,
-  accountInfo = 2,
-  accountCredentials = 3,
-  structureNameAndAddress = 4,
-  structurePhone = 5,
-  structureType = 6,
-  structureAccessModality = 7,
-  structureHours = 8,
-  structurePmr = 9,
-  structureWebAndSocialNetwork = 10,
-  structurePublicTarget = 11,
-  structureAccompaniment = 12,
-  structureOtherAccompaniment = 13,
-  structureRemoteAccompaniment = 14,
-  structureWorkshop = 15,
-  structureWorkshopPrice = 16,
-  structureWifi = 17,
-  structureEquipments = 18,
-  structureLabels = 19,
-  structureOtherServices = 20,
-  structureDescription = 21,
-  structureCovidInfo = 22,
-  cgu = 23,
+  summary,
+  info,
+  accountInfo,
+  accountCredentials,
+  structureNameAndAddress,
+  structurePhone,
+  structureType,
+  structureAccessModality,
+  structureHours,
+  structurePmr,
+  structureWebAndSocialNetwork,
+  structurePublicTarget,
+  structureAccompaniment,
+  structureOtherAccompaniment,
+  structureRemoteAccompaniment,
+  structureWorkshop,
+  structureWorkshopPrice,
+  structureWifi,
+  structureEquipments,
+  structureLabels,
+  structureOtherServices,
+  structureDescription,
+  structureCovidInfo,
+  cgu,
 }
-- 
GitLab


From 9d91fd290354fdcc4576ad6eaa3baaf5c695b96e Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Thu, 20 May 2021 16:20:43 +0200
Subject: [PATCH 3/4] fix: remove commented code

---
 src/app/form/form.component.ts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts
index 8c61ff5b5..22134be0e 100644
--- a/src/app/form/form.component.ts
+++ b/src/app/form/form.component.ts
@@ -311,7 +311,6 @@ export class FormComponent implements OnInit {
       ]),
       freeWorkShop: new FormControl(structure.freeWorkShop, [Validators.required]),
     });
-    //return form;
   }
 
   private showCollapse(s: Structure): void {
-- 
GitLab


From 76625f163c3badd159359344406283e78eb95ca6 Mon Sep 17 00:00:00 2001
From: Antonin Coquet <ext.sopra.acoquet@grandlyon.com>
Date: Fri, 21 May 2021 09:58:53 +0200
Subject: [PATCH 4/4] fix: previous page on remote accompaniment

---
 src/app/form/form.component.ts | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts
index 22134be0e..21276568c 100644
--- a/src/app/form/form.component.ts
+++ b/src/app/form/form.component.ts
@@ -754,7 +754,10 @@ export class FormComponent implements OnInit {
       }
 
       // Check if "other" isn't check to hide "other description" page
-      if (this.currentPage === PageTypeEnum.structureWorkshop && !this.isInArray('autres', 'proceduresAccompaniment')) {
+      if (
+        this.currentPage === PageTypeEnum.structureRemoteAccompaniment &&
+        !this.isInArray('autres', 'proceduresAccompaniment')
+      ) {
         this.currentPage--; // page 14 skip and go to page 13
         this.progressStatus -= 100 / this.nbPagesForm;
       }
-- 
GitLab