diff --git a/src/app/structure-list/components/search/search.component.html b/src/app/structure-list/components/search/search.component.html index 8915f8038264b83a127ca7ef60d0bed7fea037c0..367f9dae121eb760bbc4c603feae1bedb6aa68d8 100644 --- a/src/app/structure-list/components/search/search.component.html +++ b/src/app/structure-list/components/search/search.component.html @@ -63,7 +63,7 @@ <div class="arrow"></div> </button> </div> - <div *ngIf="modalTypeOpened != null"> + <div *ngIf="isOpenModal"> <app-modal-filter [modalType]="modalTypeOpened" [categories]="categories" diff --git a/src/app/structure-list/components/search/search.component.ts b/src/app/structure-list/components/search/search.component.ts index 783819ea6af0af71600a8cb9d1266642539bc79c..a8b05a6678fa3559cc5b31203920af0cb45fd4e0 100644 --- a/src/app/structure-list/components/search/search.component.ts +++ b/src/app/structure-list/components/search/search.component.ts @@ -121,20 +121,18 @@ export class SearchComponent implements OnInit { // Open the modal and display the list according to the right filter button public openModal(modalType: TypeModal): void { this.categories = []; - if (this.modalTypeOpened !== modalType) { - if (!this.isOpenModal) { - this.modalTypeOpened = modalType; - this.fakeData(modalType); - this.isOpenModal = true; - } else { - this.isOpenModal = false; - } - } else { - this.modalTypeOpened = null; + // if modal already closed, reset type + if (this.modalTypeOpened === modalType && !this.isOpenModal) { + this.modalTypeOpened = undefined; + } else if (!this.isOpenModal && this.modalTypeOpened !== modalType) { + this.modalTypeOpened = modalType; + this.fakeData(modalType); + this.isOpenModal = true; } } + public closeModal(): void { - this.modalTypeOpened = null; + this.isOpenModal = false; } private fromStringToIdExcel(categ: string): string {