Skip to content
Snippets Groups Projects
Commit a3647cd0 authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

fix(annuaire): research fix with empty filter

parent c52da940
No related branches found
No related tags found
3 merge requests!418V2.1.0,!400V2.0,!230V2.0
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
[userList]="userList" [userList]="userList"
[totalUserResult]="totalUserResult" [totalUserResult]="totalUserResult"
[isLogged]="true" [isLogged]="true"
[filterActive]="filterActive"
(resetEvent)="shouldResetFilters()" (resetEvent)="shouldResetFilters()"
(showMoreEvent)="showMore($event)" (showMoreEvent)="showMore($event)"
></app-result-list> ></app-result-list>
......
...@@ -16,12 +16,18 @@ export class AnnuaireComponent implements OnInit { ...@@ -16,12 +16,18 @@ export class AnnuaireComponent implements OnInit {
public totalUserResult: number; public totalUserResult: number;
public resetFilters: number = 0; public resetFilters: number = 0;
public nextPage: number = 1; public nextPage: number = 1;
public filterActive: boolean = false;
ngOnInit(): void { ngOnInit(): void {
this.getUsers({ queryParam: '', page: 1, jobFilters: [], employerFilter: [] }); this.getUsers({ queryParam: '', page: 1, jobFilters: [], employerFilter: [] });
} }
public getUsers(params: SearchQuery): void { public getUsers(params: SearchQuery): void {
if (this.userIsLoggedIn()) { if (this.userIsLoggedIn()) {
if (params.employerFilter?.length || params.jobFilters.length) {
this.filterActive = true;
} else {
this.filterActive = false;
}
this.searchService this.searchService
.searchUserRegistry(params.queryParam, params.page, params.jobFilters, params.employerFilter) .searchUserRegistry(params.queryParam, params.page, params.jobFilters, params.employerFilter)
.subscribe((res: SearchResults) => { .subscribe((res: SearchResults) => {
......
<div class="results notEmpty" *ngIf="isLogged && userList.length"> <div class="results notEmpty" *ngIf="isLogged && userList.length" [ngClass]="{ filterActive: filterActive }">
<div class="userNumber"> <div class="userNumber">
{{ userList.length }} <span *ngIf="showPagination"> sur {{ totalUserResult }} </span> utilisateurs trouvés {{ userList.length }} <span *ngIf="showPagination"> sur {{ totalUserResult }} </span> utilisateurs trouvés
</div> </div>
......
...@@ -34,7 +34,10 @@ ...@@ -34,7 +34,10 @@
} }
&.notEmpty { &.notEmpty {
//make sure it fits the correct height no matter the content lengtj and screen height //make sure it fits the correct height no matter the content lengtj and screen height
max-height: calc(100vh - $footer-height - $header-height - $header-height - 5rem); max-height: calc(100vh - $footer-height - $header-height - $header-height - 2rem);
&.filterActive {
max-height: calc(100vh - $footer-height - $header-height - $header-height - 5rem);
}
@media #{$large-phone} { @media #{$large-phone} {
height: 100%; height: 100%;
} }
......
...@@ -13,6 +13,7 @@ export class ResultListComponent implements OnInit, OnChanges { ...@@ -13,6 +13,7 @@ export class ResultListComponent implements OnInit, OnChanges {
@Input() userList: UserAnnuary[]; @Input() userList: UserAnnuary[];
@Input() totalUserResult: number; @Input() totalUserResult: number;
@Input() isLogged: boolean; @Input() isLogged: boolean;
@Input() filterActive: boolean;
@Output() resetEvent = new EventEmitter<any>(); @Output() resetEvent = new EventEmitter<any>();
@Output() showMoreEvent = new EventEmitter<any>(); @Output() showMoreEvent = new EventEmitter<any>();
public maxPerPage: number = 20; public maxPerPage: number = 20;
......
...@@ -171,7 +171,7 @@ export class SearchBarComponent implements OnInit, OnChanges { ...@@ -171,7 +171,7 @@ export class SearchBarComponent implements OnInit, OnChanges {
this.splitFilters(this.checkedFilterList); this.splitFilters(this.checkedFilterList);
this.countCheckedFilters(); this.countCheckedFilters();
this.searchEvent.emit({ this.searchEvent.emit({
queryParam: inputTerm, queryParam: inputTerm || '',
jobFilters: this.checkedFilterList.length ? this.jobFilterChecked : [], jobFilters: this.checkedFilterList.length ? this.jobFilterChecked : [],
employerFilter: this.checkedFilterList.length ? this.employerFilterChecked : [], employerFilter: this.checkedFilterList.length ? this.employerFilterChecked : [],
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment