Skip to content
Snippets Groups Projects
Commit a5bf5ae4 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FEAT #15550 TIME 0:05 not being able to save active filters in the history

parent 231fdb8a
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@
shape="round" size="small" slot="start" color="primary" (click)="clearFilters()" [title]="'lang.clearFilters' | translate">
<ion-icon slot="icon-only" name="backspace" color="light"></ion-icon>
</ion-button>
<ion-chip *ngFor="let filter of uniqueArray(this.filters.messageTypes)" [title]="'lang.actions' | translate" color="light" (click)="removeFilter(filter)">
<ion-chip *ngFor="let filter of this.filters.messageTypes" [title]="'lang.actions' | translate" color="light" (click)="removeFilter(filter)">
<ion-icon name="options-outline"></ion-icon>
<ion-label>{{ 'lang.' + filter | translate }}</ion-label>
<ion-icon name="close-circle"></ion-icon>
......
......@@ -87,19 +87,15 @@ export class HistoryListComponent {
this.menu.open('right-menu');
}
ionViewWillEnter() {
ionViewWillEnter() {
this.filters.messageTypes = [];
this.filters.user = '';
this.filters.date.start = this.filters.date.end = null;
this.menu.enable(true, 'left-menu');
this.menu.enable(true, 'right-menu');
this.signaturesService.initTemplate(this.rightContent, this.viewContainerRef, 'rightContent');
this.gesActions();
this.getDatas();
setTimeout(() => {
$(".checkedAction").each((index, element) => {
if (this.filters.messageTypes.includes($(element).val())) {
$(element).prop("checked", true);
}
});
}, 100);
}
gesActions() {
......@@ -175,8 +171,8 @@ export class HistoryListComponent {
if (this.filters.date.end !== null) {
nb++;
}
if (this.uniqueArray(this.filters.messageTypes).length > 0) {
nb += this.uniqueArray(this.filters.messageTypes).length;
if (this.filters.messageTypes.length > 0) {
nb += this.filters.messageTypes.length;
}
return nb;
}
......@@ -199,6 +195,7 @@ export class HistoryListComponent {
});
this.filters.user = '';
this.filters.date.start = this.filters.date.end = null;
this.getDatas();
}
removeFilter(filter: any) {
......@@ -224,20 +221,4 @@ export class HistoryListComponent {
}
this.getDatas();
}
// to remove duplicates in array
uniqueArray(array: any[]) {
let i: number, j: any;
const length = array.length;
const uniqueArray = [];
const obj = {};
for (i = 0; i < length; i++) {
obj[array[i]] = 0;
}
for (j in obj) {
uniqueArray.push(j);
}
array = uniqueArray;
return array;
}
}
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