Skip to content
Snippets Groups Projects
Commit 4ae2973a authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #11750 TIME 0:30 add filter doctypes

parent 4f6081a8
No related branches found
No related tags found
No related merge requests found
...@@ -23,6 +23,7 @@ export class FiltersListComponent implements OnInit { ...@@ -23,6 +23,7 @@ export class FiltersListComponent implements OnInit {
categories: any[] = []; categories: any[] = [];
entitiesList: any[] = []; entitiesList: any[] = [];
statuses: any[] = []; statuses: any[] = [];
doctypes: any[] = [];
loading: boolean = false; loading: boolean = false;
...@@ -70,9 +71,22 @@ export class FiltersListComponent implements OnInit { ...@@ -70,9 +71,22 @@ export class FiltersListComponent implements OnInit {
} }
}); });
}); });
this.http.get("../../rest/doctypes/types")
.subscribe((data: any) => {
this.doctypes = data.doctypes;
this.doctypes.forEach(element => {
element.selected = false;
this.listProperties.doctypes.forEach((listPropertyDoctype: any) => {
if (element.type_id === listPropertyDoctype.id) {
element.selected = true;
}
});
});
this.loading = false;
});
this.loading = false;
}); });
}); });
}); });
...@@ -88,7 +102,7 @@ export class FiltersListComponent implements OnInit { ...@@ -88,7 +102,7 @@ export class FiltersListComponent implements OnInit {
'label': element.label 'label': element.label
}); });
} }
}); });
this.updateFilters(); this.updateFilters();
} }
......
<div class="filtersContent"> <div class="filtersContent">
<form [formGroup]="stateForm" class="filterTool"> <form [formGroup]="stateForm" class="filterTool">
<mat-form-field floatLabel="never" class="basket-search"> <mat-form-field floatLabel="never" class="basket-search">
<input class="metaSearch" type="text" matInput placeholder="{{title}}" <input class="metaSearch" type="text" matInput placeholder="{{title}}" formControlName="stateGroup"
formControlName="stateGroup" [matAutocomplete]="autoGroup" (focus)="initFilters()" [matAutocomplete]="autoGroup" (focus)="initFilters()" (keyup.enter)="metaSearch($event);">
(keyup.enter)="metaSearch($event);">
<button mat-icon-button matPrefix> <button mat-icon-button matPrefix>
<mat-icon class="fa fa-search"></mat-icon> <mat-icon class="fa fa-search"></mat-icon>
</button> </button>
<mat-button-toggle matSuffix class="processLimitButton" (click)="$event.stopPropagation();" [checked]="this.listProperties.delayed" value="delayed" <mat-button-toggle matSuffix class="processLimitButton" (click)="$event.stopPropagation();"
title="{{lang.displayProcessLimitRes}}" (change)="setFilters($event, 'delayed')"> [checked]="this.listProperties.delayed" value="delayed" title="{{lang.displayProcessLimitRes}}"
(change)="setFilters($event, 'delayed')">
<mat-icon fontSet="fas" fontIcon="fa-stopwatch fa-2x"></mat-icon> <mat-icon fontSet="fas" fontIcon="fa-stopwatch fa-2x"></mat-icon>
</mat-button-toggle> </mat-button-toggle>
<mat-autocomplete #autoGroup="matAutocomplete" (optionSelected)="selectFilter($event)" <mat-autocomplete #autoGroup="matAutocomplete" (optionSelected)="selectFilter($event)"
[class]="'autoCompletePanelFilter'"> [class]="'autoCompletePanelFilter'">
<mat-option *ngIf="isLoading" class="is-loading"> <mat-option *ngIf="isLoading" class="is-loading">
<mat-spinner diameter="50"></mat-spinner> <mat-spinner diameter="50"></mat-spinner>
</mat-option> </mat-option>
...@@ -94,4 +94,8 @@ ...@@ -94,4 +94,8 @@
*ngFor="let subEntity of this.listProperties.subEntities; let i=index" *ngFor="let subEntity of this.listProperties.subEntities; let i=index"
(click)="removeFilter('subEntities', i)">{{subEntity.label}} (click)="removeFilter('subEntities', i)">{{subEntity.label}}
<i class="fa fa-times-circle"></i></span> <i class="fa fa-times-circle"></i></span>
<span class="label badge-doctypes" title="{{lang.doctypes}}"
*ngFor="let doctype of this.listProperties.doctypes; let i=index"
(click)="removeFilter('doctypes', i)">{{doctype.label}}
<i class="fa fa-times-circle"></i></span>
</div> </div>
\ No newline at end of file
...@@ -161,11 +161,17 @@ ...@@ -161,11 +161,17 @@
} }
.filterBadges>.badge-subEntities { .filterBadges>.badge-subEntities {
margin: 5px; margin: 5px;
background: #9440D5; background: #9440D5;
cursor: pointer; cursor: pointer;
} }
.filterBadges>.badge-doctypes {
margin: 5px;
background: #d6716f;
cursor: pointer;
}
::ng-deep.autoCompletePanelFilter { ::ng-deep.autoCompletePanelFilter {
left: 25px; left: 25px;
min-width: 400px !important; min-width: 400px !important;
......
...@@ -196,6 +196,10 @@ export class FiltersToolComponent implements OnInit { ...@@ -196,6 +196,10 @@ export class FiltersToolComponent implements OnInit {
letter: this.lang.subEntities, letter: this.lang.subEntities,
names: [] names: []
}, },
{
letter: this.lang.doctypes,
names: []
},
]; ];
this.http.get('../..' + this.routeDatas + '?init' + this.filtersListService.getUrlFilters()) this.http.get('../..' + this.routeDatas + '?init' + this.filtersListService.getUrlFilters())
...@@ -264,6 +268,19 @@ export class FiltersToolComponent implements OnInit { ...@@ -264,6 +268,19 @@ export class FiltersToolComponent implements OnInit {
) )
} }
}); });
data.doctypes.forEach((element: any) => {
if (this.listProperties.doctypes.map((doctype: any) => (doctype.id)).indexOf(element.id) === -1 && this.listProperties.doctypes == 0) {
this.stateGroups[5].names.push(
{
id: 'doctypes',
value: element.id,
label: (element.id !== null ? element.label : this.lang.undefined),
count: element.count
}
)
}
});
this.isLoading = false; this.isLoading = false;
if (this.metaSearchInput.length > 0) { if (this.metaSearchInput.length > 0) {
setTimeout(() => { setTimeout(() => {
......
...@@ -13,7 +13,8 @@ interface listProperties { ...@@ -13,7 +13,8 @@ interface listProperties {
'priorities': string[], 'priorities': string[],
'entities': string[], 'entities': string[],
'subEntities': string[], 'subEntities': string[],
'statuses': string[] 'statuses': string[],
'doctypes': string[],
} }
@Injectable() @Injectable()
...@@ -60,6 +61,7 @@ export class FiltersListService { ...@@ -60,6 +61,7 @@ export class FiltersListService {
'entities': [], 'entities': [],
'subEntities': [], 'subEntities': [],
'statuses': [], 'statuses': [],
'doctypes': [],
}; };
this.listsProperties.push(listProperties); this.listsProperties.push(listProperties);
this.listsPropertiesIndex = this.listsProperties.length -1; this.listsPropertiesIndex = this.listsProperties.length -1;
...@@ -139,6 +141,14 @@ export class FiltersListService { ...@@ -139,6 +141,14 @@ export class FiltersListService {
filters += '&entitiesChildren=' + ent.join(','); filters += '&entitiesChildren=' + ent.join(',');
} }
if (this.listsProperties[this.listsPropertiesIndex].doctypes.length > 0) {
let doct: any[] = [];
this.listsProperties[this.listsPropertiesIndex].doctypes.forEach((element: any) => {
doct.push(element.id);
});
filters += '&doctypes=' + doct.join(',');
}
} }
return filters; return filters;
} }
......
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