From 9c16644c23b0d15fb2f03d7183ab503c4b194f55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marl=C3=A8ne=20SIMONDANT?= <msimondant@grandlyon.com> Date: Fri, 13 Jan 2023 15:56:02 +0000 Subject: [PATCH] feat(structure): unselect structure in creation form --- .../profile-structure-choice.component.ts | 14 +++++++++++--- .../profile-structure.component.ts | 2 +- 2 files changed, 12 insertions(+), 4 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..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 @@ -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 = this.itemSelected == structure._id ? null : 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 { 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