From 554e249004e73061b24cdfd12a9862bf4c0ab61d Mon Sep 17 00:00:00 2001
From: Marlene Simondant <msimondant@grandlyon.com>
Date: Wed, 11 Jan 2023 12:10:53 +0100
Subject: [PATCH 1/3] un select a structure

---
 .../profile-structure-choice.component.ts          | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts b/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts
index 673af8d56..e5119631c 100644
--- a/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts
+++ b/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts
@@ -24,6 +24,7 @@ export class ProfileStructureChoiceComponent implements OnInit {
   public buttonTypeEnum = ButtonType;
   public profileStructuresLink: string[] = [];
   public profilePendingStructureLink: pendingStructureLink[] = [];
+  public itemSelected: string = null;
 
   constructor(private structureService: StructureService, private profileService: ProfileService) {}
 
@@ -54,9 +55,16 @@ export class ProfileStructureChoiceComponent implements OnInit {
     if (structure.alreadySelected) {
       return;
     }
-    this.selectedStructureItem = structure;
-    this.structureForm.patchValue({ _id: structure._id, structureName: structure.structureName });
-    this.validateForm.emit();
+    this.itemSelected == structure._id ? (this.itemSelected = null) : (this.itemSelected = structure._id);
+    if (this.itemSelected) {
+      this.selectedStructureItem = structure;
+      this.structureForm.patchValue({ _id: structure._id, structureName: structure.structureName });
+      this.validateForm.emit();
+    } else {
+      this.selectedStructureItem = null;
+      this.structureForm.patchValue({ _id: null, structureName: null });
+      this.validateForm.emit();
+    }
   }
 
   public isSelectedStructure(structure: Structure): boolean {
-- 
GitLab


From 19b341273f580955072a6a4b52a69d384958408a Mon Sep 17 00:00:00 2001
From: Marlene Simondant <msimondant@grandlyon.com>
Date: Wed, 11 Jan 2023 12:13:36 +0100
Subject: [PATCH 2/3] change - to / in date to match the date format used
 throughout the app

---
 .../profile/profile-structure/profile-structure.component.ts    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/app/profile/profile-structure/profile-structure.component.ts b/src/app/profile/profile-structure/profile-structure.component.ts
index 50031c9c6..81dd77b9e 100644
--- a/src/app/profile/profile-structure/profile-structure.component.ts
+++ b/src/app/profile/profile-structure/profile-structure.component.ts
@@ -137,7 +137,7 @@ export class ProfileStructureComponent implements OnInit {
   }
   public getFormattedDate(): string {
     if (this.joinRequestDate) {
-      return DateTime.fromISO(this.joinRequestDate, { zone: 'Europe/Paris' }).toFormat('dd-MM-yyyy');
+      return DateTime.fromISO(this.joinRequestDate, { zone: 'Europe/Paris' }).toFormat('dd/MM/yyyy');
     }
   }
 
-- 
GitLab


From fcc3601746c9b4869d3a4d4825db2c1af0effeaf Mon Sep 17 00:00:00 2001
From: Bastien DUMONT <bdumont@grandlyon.com>
Date: Fri, 13 Jan 2023 13:09:03 +0000
Subject: [PATCH 3/3] cleaner suggestion

---
 .../profile-structure-choice.component.ts                       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts b/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts
index e5119631c..6c615df2d 100644
--- a/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts
+++ b/src/app/form/form-view/profile-form/profile-structure-choice/profile-structure-choice.component.ts
@@ -55,7 +55,7 @@ export class ProfileStructureChoiceComponent implements OnInit {
     if (structure.alreadySelected) {
       return;
     }
-    this.itemSelected == structure._id ? (this.itemSelected = null) : (this.itemSelected = structure._id);
+    this.itemSelected = this.itemSelected == structure._id ? null : structure._id;
     if (this.itemSelected) {
       this.selectedStructureItem = structure;
       this.structureForm.patchValue({ _id: structure._id, structureName: structure.structureName });
-- 
GitLab