From 4f458c7ad599ba33999bc7b939483d18da322405 Mon Sep 17 00:00:00 2001
From: Jeremie BRISON <ext.sopra.jbrison@grandlyon.com>
Date: Mon, 25 Jan 2021 15:39:12 +0100
Subject: [PATCH] fix(form): add page(Description)

---
 src/app/form/form.component.html | 17 +++++++++++++++++
 src/app/form/form.component.scss | 20 ++++++++++++++++++++
 src/app/form/form.component.ts   |  5 +++--
 3 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/app/form/form.component.html b/src/app/form/form.component.html
index 5323073aa..fc6389b2e 100644
--- a/src/app/form/form.component.html
+++ b/src/app/form/form.component.html
@@ -445,6 +445,23 @@
           [isEditMode]="!isEditMode"
         ></app-hour-picker>
       </div>
+      <div *ngIf="currentPage == 8" class="page">
+        <div class="title">
+          <h3>Avez-vous des précisions à apporter sur les horaires ?</h3>
+          <p class="notRequired">facultatif</p>
+        </div>
+        <div class="textareaBlock" fxLayout="column">
+          <textarea
+            rows="8"
+            placeholder="Exemple : nous ne sommes ouvert que le 1er mercredi du mois."
+            maxlength="500"
+            formControlName="description"
+          ></textarea>
+          <p>
+            {{ getStructureControl('description').value ? getStructureControl('description').value.length : 0 }}/500
+          </p>
+        </div>
+      </div>
     </form>
   </div>
   <div
diff --git a/src/app/form/form.component.scss b/src/app/form/form.component.scss
index f3b0feea5..6f033f414 100644
--- a/src/app/form/form.component.scss
+++ b/src/app/form/form.component.scss
@@ -111,6 +111,26 @@ $progressBar-height: 50px;
     margin-top: 10px;
     margin-bottom: 0;
     @include cn-regular-18;
+
+    &.notRequired {
+      font-style: italic;
+      color: $secondary-color;
+    }
+  }
+  .textareaBlock {
+    max-width: 90%;
+
+    textarea {
+      padding: 13px 8px;
+      background: $grey-6;
+      border: 1px solid $grey-4;
+      border-radius: 4px;
+      resize: none;
+      @include cn-regular-16;
+    }
+    p {
+      text-align: right;
+    }
   }
 }
 
diff --git a/src/app/form/form.component.ts b/src/app/form/form.component.ts
index 3b4aea128..a9c98ed3d 100644
--- a/src/app/form/form.component.ts
+++ b/src/app/form/form.component.ts
@@ -45,7 +45,7 @@ export class FormComponent implements OnInit {
   public structureId: string;
 
   //New var form
-  public currentPage = 7;
+  public currentPage = 8;
   public progressStatus = 0;
   public nbPagesForm = 13;
   public accountForm: FormGroup;
@@ -129,7 +129,7 @@ export class FormComponent implements OnInit {
       structureType: new FormControl(structure.structureType, Validators.required),
       structureName: new FormControl(structure.structureName, Validators.required),
       structureRepresentation: new FormControl(structure.structureRepresentation, Validators.required),
-      description: new FormControl(structure.description, Validators.required),
+      description: new FormControl(structure.description),
       lockdownActivity: new FormControl(structure.lockdownActivity),
       address: new FormGroup({
         numero: new FormControl(structure.address.numero),
@@ -303,6 +303,7 @@ export class FormComponent implements OnInit {
     this.pagesValidation[5] = { valid: this.getStructureControl('structureType').valid };
     this.pagesValidation[6] = { valid: this.getStructureControl('accessModality').valid };
     this.pagesValidation[7] = { valid: this.hoursForm.valid };
+    this.pagesValidation[8] = { valid: this.getStructureControl('description').valid };
 
     this.updatePageValid();
   }
-- 
GitLab