diff --git a/src/app/structure-list/components/modal-filter/modal-filter.component.html b/src/app/structure-list/components/modal-filter/modal-filter.component.html index 803b9225d19bb27737f18adf063e286b899370e2..0b42de3f079b52e8dbcbf73c5b5eecaf09671e68 100644 --- a/src/app/structure-list/components/modal-filter/modal-filter.component.html +++ b/src/app/structure-list/components/modal-filter/modal-filter.component.html @@ -16,9 +16,17 @@ <label> <input type="checkbox" - [checked]="getIndex(module.id, c.name) > -1" + [checked]=" + c.name !== 'Équipements et services proposés' + ? getIndex(module.id, c.name) > -1 + : getIndex('True', module.id) > -1 + " [value]="module.id" - (change)="onCheckboxChange($event, c.name)" + (change)=" + c.name !== 'Équipements et services proposés' + ? onCheckboxChange($event, c.name, false) + : onCheckboxChange($event, module.id, true) + " /> <span class="customCheck"></span> <div class="label">{{ module.text }}</div> diff --git a/src/app/structure-list/components/modal-filter/modal-filter.component.ts b/src/app/structure-list/components/modal-filter/modal-filter.component.ts index d8b0096bb14b0788e465c79e4bb75f9336861c67..5bab3d8d2ebbdf3681dab33b0845da7ce585a6b8 100644 --- a/src/app/structure-list/components/modal-filter/modal-filter.component.ts +++ b/src/app/structure-list/components/modal-filter/modal-filter.component.ts @@ -35,8 +35,8 @@ export class ModalFilterComponent implements OnInit { } // Management of the checkbox event (Check / Uncheck) - public onCheckboxChange(event, categ: string): void { - const checkValue: string = event.target.value; + public onCheckboxChange(event, categ: string, isSpecial: boolean): void { + const checkValue: string = isSpecial ? 'True' : event.target.value; if (event.target.checked) { this.checkedModules.push(new Module(checkValue, categ)); } else { @@ -46,13 +46,16 @@ export class ModalFilterComponent implements OnInit { } } } - // Clear only filters in the current modal public clearFilters(): void { this.categories.forEach((categ: Category) => { categ.modules.forEach((module: Module) => { - if (this.getIndex(module.id, categ.name) > -1) { - this.checkedModules.splice(this.getIndex(module.id, categ.name), 1); + const index = this.getIndex(module.id, categ.name); + const indexSpecial = this.getIndex('True', module.id); + if (index > -1) { + this.checkedModules.splice(index, 1); + } else if (indexSpecial > -1) { + this.checkedModules.splice(indexSpecial, 1); } }); }); diff --git a/src/app/structure-list/components/search/search.component.ts b/src/app/structure-list/components/search/search.component.ts index c795a718817fca304cb68aeae5f4f96c3b97233b..a811558f67cbd043b041d729a8b34bac326df7cb 100644 --- a/src/app/structure-list/components/search/search.component.ts +++ b/src/app/structure-list/components/search/search.component.ts @@ -75,7 +75,7 @@ export class SearchComponent implements OnInit { public fetchResults(checkedModules: Module[]): void { const inputTerm = this.searchForm.get('searchTerm').value; - + console.log(checkedModules); // Check if some modules is checked in filters if (this.checkedModulesFilter !== checkedModules) { // First btn