From a99d2cafe10dd8364ac530e46153a919eadf2ce7 Mon Sep 17 00:00:00 2001
From: Marlene Simondant <msimondant@grandlyon.com>
Date: Thu, 12 Jan 2023 16:39:38 +0100
Subject: [PATCH 1/2] add structure type to edit mode

---
 src/app/form/form-view/form-view.component.ts |  4 ++++
 .../structure-edition-summary.component.html  | 22 +++++++++++++++++++
 src/app/utils/formUtils.ts                    |  2 +-
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/app/form/form-view/form-view.component.ts b/src/app/form/form-view/form-view.component.ts
index 168cd76d9..ac44e0183 100644
--- a/src/app/form/form-view/form-view.component.ts
+++ b/src/app/form/form-view/form-view.component.ts
@@ -412,6 +412,10 @@ export class FormViewComponent implements OnInit, AfterViewInit {
           structureName: this.structureForm.get('structureName').value,
           address: this.structureForm.get('address').value,
         };
+      case structureFormStep.structureType:
+        return {
+          structureType: this.structureForm.get('structureType').value,
+        };
       case structureFormStep.structureContact:
         return {
           contactPhone: this.structureForm.get('contactPhone').value,
diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html
index 79d354b62..a5eb0b1de 100644
--- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html
+++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html
@@ -37,6 +37,28 @@
       </div>
     </div>
 
+    <div class="section structureType">
+      <div class="sectionHeader">
+        <p>Type de structure</p>
+        <app-button
+          class="hide-on-mobile"
+          [text]="'Modifier'"
+          [style]="buttonTypeEnum.SecondaryWide"
+          [extraClass]="'editButton'"
+          (action)="goToEdit(structureFormStep.structureType)"
+        ></app-button>
+        <app-button
+          class="hide-on-desktop"
+          [iconBtn]="'edit'"
+          [style]="buttonTypeEnum.SecondaryOnlyIcon"
+          (action)="goToEdit(structureFormStep.structureType)"
+        ></app-button>
+      </div>
+      <div class="content">
+        <p>{{ structure.structureType.category }} - {{ structure.structureType.value }}</p>
+      </div>
+    </div>
+
     <div class="section phoneAndMail">
       <div class="sectionHeader">
         <p>Téléphone et email</p>
diff --git a/src/app/utils/formUtils.ts b/src/app/utils/formUtils.ts
index df9cf117a..56adeccf5 100644
--- a/src/app/utils/formUtils.ts
+++ b/src/app/utils/formUtils.ts
@@ -71,7 +71,7 @@ export class formUtils {
     return new UntypedFormGroup({
       _id: new UntypedFormControl(structure._id, Validators.required),
       coord: new UntypedFormControl(structure.coord),
-      structureType: new UntypedFormControl(structure.structureType, Validators.required),
+      structureType: new UntypedFormControl(structure.structureType?._id, Validators.required),
       structureName: new UntypedFormControl(structure.structureName, Validators.required),
       description: new UntypedFormControl(structure.description),
       lockdownActivity: new UntypedFormControl(structure.lockdownActivity),
-- 
GitLab


From 8b9651024e97850cfccbf50cab8653c61a278f2f Mon Sep 17 00:00:00 2001
From: Marlene Simondant <msimondant@grandlyon.com>
Date: Fri, 13 Jan 2023 15:16:35 +0100
Subject: [PATCH 2/2] display structure type label

---
 .../structure-edition-summary.component.html                    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html
index a5eb0b1de..caf119fa8 100644
--- a/src/app/profile/structure-edition-summary/structure-edition-summary.component.html
+++ b/src/app/profile/structure-edition-summary/structure-edition-summary.component.html
@@ -55,7 +55,7 @@
         ></app-button>
       </div>
       <div class="content">
-        <p>{{ structure.structureType.category }} - {{ structure.structureType.value }}</p>
+        <p>{{ structure.structureType.category }} - {{ structure.getLabelTypeStructure() }}</p>
       </div>
     </div>
 
-- 
GitLab