Skip to content
Snippets Groups Projects
Verified Commit 6f412a79 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #8956 add erase all filters button

parent 49dcbe44
No related branches found
No related tags found
No related merge requests found
......@@ -60,6 +60,8 @@
</mat-menu>
</mat-button-toggle-group>
<div class="filterBadges">
<span *ngIf="haveFilters()" class="label badge-eraser" title="{{lang.eraseAllFilters}}" (click)="this.listProperties.search='';removeFilters();"><i class="fas fa-eraser"></i></span>
<span class="label badge-search" *ngIf="this.listProperties.search !== ''" title="{{lang.subject}} / {{lang.chronoNumber}}" (click)="this.listProperties.search='';updateFilters();">{{this.listProperties.search}}
<i class="fa fa-times-circle"></i></span>
<span class="label badge-categories" title="{{lang.categories}}" *ngFor="let category of this.listProperties.categories; let i=index" (click)="removeFilter('categories', i)">{{category.label}}
......
......@@ -18,6 +18,18 @@
font-size: 11px;
}
.filterBadges>.badge-eraser {
margin: 5px;
background: none;
cursor: pointer;
color: red;
font-size: 20px;
}
.filterBadges>.label {
white-space: inherit;
}
.filterBadges>.badge-search {
margin: 5px;
background: #666;
......
......@@ -134,6 +134,27 @@ export class FiltersToolComponent implements OnInit {
this.updateFilters();
}
removeFilters() {
Object.keys(this.listProperties).forEach((key) => {
if (Array.isArray(this.listProperties[key])) {
this.listProperties[key] = [];
} else if (key == 'search') {
this.listProperties[key] = '';
}
});
this.updateFilters();
}
haveFilters() {
let state = false;
Object.keys(this.listProperties).forEach((key) => {
if ((Array.isArray(this.listProperties[key]) && this.listProperties[key].length > 0) || (key == 'search' && this.listProperties[key] != '')) {
state = true;
}
});
return state;
}
setInputSearch(value: string) {
$j('.metaSearch').focus();
this.metaSearchInput = value;
......@@ -168,7 +189,6 @@ export class FiltersToolComponent implements OnInit {
this.http.get('../../rest/resourcesList/users/' + this.currentBasketInfo.ownerId + '/groups/' + this.currentBasketInfo.groupId + '/baskets/' + this.currentBasketInfo.basketId + '/filters?init' + this.filtersListService.getUrlFilters())
.subscribe((data: any) => {
console.log(data);
data.categories.forEach((element: any) => {
if (this.listProperties.categories.map((category: any) => (category.id)).indexOf(element.id) === -1) {
this.stateGroups[0].names.push(
......
......@@ -731,4 +731,5 @@ export const LANG_EN = {
"configurationUpdated" : "Configuration updated",
"port" : "Port",
"mailFrom" : "Mail address used",
"eraseAllFilters" : "Erase all filters",
};
......@@ -757,4 +757,7 @@ export const LANG_FR = {
"configurationUpdated" : "Configuration mise à jour",
"port" : "Port",
"mailFrom" : "Adresse e-mail utilisée",
"eraseAllFilters" : "Effacer tous les filtres",
};
......@@ -760,4 +760,5 @@ export const LANG_NL = {
"configurationUpdated" : "_TO_TRANSLATE",
"port" : "_TO_TRANSLATE",
"mailFrom" : "_TO_TRANSLATE",
"eraseAllFilters" : "_TO_TRANSLATE",
};
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