Commit 4ae2973a authored by Alex ORLUC's avatar Alex ORLUC

FEAT #11750 TIME 0:30 add filter doctypes

parent 4f6081a8
......@@ -23,6 +23,7 @@ export class FiltersListComponent implements OnInit {
categories: any[] = [];
entitiesList: any[] = [];
statuses: any[] = [];
doctypes: any[] = [];
loading: boolean = false;
......@@ -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 {
'label': element.label
});
}
});
this.updateFilters();
}
......
<div class="filtersContent">
<form [formGroup]="stateForm" class="filterTool">
<mat-form-field floatLabel="never" class="basket-search">
<input class="metaSearch" type="text" matInput placeholder="{{title}}"
formControlName="stateGroup" [matAutocomplete]="autoGroup" (focus)="initFilters()"
(keyup.enter)="metaSearch($event);">
<input class="metaSearch" type="text" matInput placeholder="{{title}}" formControlName="stateGroup"
[matAutocomplete]="autoGroup" (focus)="initFilters()" (keyup.enter)="metaSearch($event);">
<button mat-icon-button matPrefix>
<mat-icon class="fa fa-search"></mat-icon>
</button>
<mat-button-toggle matSuffix class="processLimitButton" (click)="$event.stopPropagation();" [checked]="this.listProperties.delayed" value="delayed"
title="{{lang.displayProcessLimitRes}}" (change)="setFilters($event, 'delayed')">
<mat-button-toggle matSuffix class="processLimitButton" (click)="$event.stopPropagation();"
[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-button-toggle>
<mat-autocomplete #autoGroup="matAutocomplete" (optionSelected)="selectFilter($event)"
[class]="'autoCompletePanelFilter'">
[class]="'autoCompletePanelFilter'">
<mat-option *ngIf="isLoading" class="is-loading">
<mat-spinner diameter="50"></mat-spinner>
</mat-option>
......@@ -94,4 +94,8 @@
*ngFor="let subEntity of this.listProperties.subEntities; let i=index"
(click)="removeFilter('subEntities', i)">{{subEntity.label}}
<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>
\ No newline at end of file
......@@ -161,11 +161,17 @@
}
.filterBadges>.badge-subEntities {
margin: 5px;
margin: 5px;
background: #9440D5;
cursor: pointer;
}
.filterBadges>.badge-doctypes {
margin: 5px;
background: #d6716f;
cursor: pointer;
}
::ng-deep.autoCompletePanelFilter {
left: 25px;
min-width: 400px !important;
......
......@@ -196,6 +196,10 @@ export class FiltersToolComponent implements OnInit {
letter: this.lang.subEntities,
names: []
},
{
letter: this.lang.doctypes,
names: []
},
];
this.http.get('../..' + this.routeDatas + '?init' + this.filtersListService.getUrlFilters())
......@@ -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;
if (this.metaSearchInput.length > 0) {
setTimeout(() => {
......
......@@ -13,7 +13,8 @@ interface listProperties {
'priorities': string[],
'entities': string[],
'subEntities': string[],
'statuses': string[]
'statuses': string[],
'doctypes': string[],
}
@Injectable()
......@@ -60,6 +61,7 @@ export class FiltersListService {
'entities': [],
'subEntities': [],
'statuses': [],
'doctypes': [],
};
this.listsProperties.push(listProperties);
this.listsPropertiesIndex = this.listsProperties.length -1;
......@@ -139,6 +141,14 @@ export class FiltersListService {
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment