initialSupportGroupFilter/Done

main
manueltauber 2023-06-01 14:57:58 +02:00
parent 54deb83297
commit 7deb69fd3d
4 changed files with 45 additions and 9 deletions

View File

@ -19,6 +19,7 @@ export class DataService {
private contracts: any []; private contracts: any [];
private paketTypes: any []; private paketTypes: any [];
private totalSize: number = null; private totalSize: number = null;
public userSupportGroup: string;
public selectedLanguage: string = 'DE'; public selectedLanguage: string = 'DE';
/** /**
* This constructor builds the dataService and fetches the states from the backend * This constructor builds the dataService and fetches the states from the backend
@ -38,6 +39,10 @@ export class DataService {
this.paketTypes = res; this.paketTypes = res;
// console.log(res); // console.log(res);
}); });
this.fetchUserSupportGroup().then((res: any)=>{
this.userSupportGroup = res.name;
console.log(this.userSupportGroup);
});
} }
/** /**
@ -64,6 +69,9 @@ export class DataService {
return this.totalSize; return this.totalSize;
} }
public getUserSupportGroup():string{
return this.userSupportGroup;
}
/** /**
* The function fetchStates fetches an array from the possible statuses per state * The function fetchStates fetches an array from the possible statuses per state
* @returns promise for the fetched Status Array * @returns promise for the fetched Status Array
@ -124,6 +132,19 @@ export class DataService {
return promise; return promise;
} }
public async fetchUserSupportGroup(){
const promise = new Promise(resolve=>{
let res : any = {};
this.http.get('http://localhost:8080/api/getUserSupportGroup')
.subscribe((response: any)=>{
this.userSupportGroup = res.name;
res = response;
resolve(res);
})
})
return promise;
}
/** /**
* The function updateDatePerChange sends the new date to the backend if the date was moved * The function updateDatePerChange sends the new date to the backend if the date was moved
* @param change the Change (the Resource) from which the date should be changed * @param change the Change (the Resource) from which the date should be changed

View File

@ -6,7 +6,7 @@
<h3 class="filterHeading">{{filterLabels[1]}}</h3> <h3 class="filterHeading">{{filterLabels[1]}}</h3>
<multiselect-autocomplete <multiselect-autocomplete
[placeholder]="filterLabels[7]" [placeholder]="userSupportGroup"
[data]="supportGroups" [data]="supportGroups"
[key]="'supportGroup'" [key]="'supportGroup'"
(result)="onResult($event)"> (result)="onResult($event)">

View File

@ -41,6 +41,7 @@ export class FilterDialogComponent implements OnInit {
public paketTypes: string[] = []; public paketTypes: string[] = [];
public states: string[] = []; public states: string[] = [];
public contracts: string[] = []; public contracts: string[] = [];
public userSupportGroup: string;
public criteria: string; public criteria: string;
public filterStartDate: Date; public filterStartDate: Date;
@ -95,6 +96,8 @@ export class FilterDialogComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.userSupportGroup = this.dataService.getUserSupportGroup();
console.log(this.userSupportGroup);
if(this.dataService.selectedLanguage == 'DE'){ if(this.dataService.selectedLanguage == 'DE'){
for (const state of this.dataService.getStates()) { for (const state of this.dataService.getStates()) {
this.states.push(state.stateNameDE); this.states.push(state.stateNameDE);
@ -210,6 +213,12 @@ export class FilterDialogComponent implements OnInit {
      "filter": "equals",       "filter": "equals",
      "criteria": this.supportGroupsFilter       "criteria": this.supportGroupsFilter
}); });
}else{
filter.push({
"column": "SupportGroup",
      "filter": "equals",
      "criteria": [this.dataService.userSupportGroup]
});
} }

View File

@ -47,6 +47,7 @@ export class NttGanttComponent implements OnInit {
public data: any[] = []; public data: any[] = [];
public allResources: any[] = []; public allResources: any[] = [];
public resources: any[] = []; public resources: any[] = [];
public userSupportGroup: string;
public taskSettings: object = {}; public taskSettings: object = {};
public labelSettings: object = {}; public labelSettings: object = {};
public projectStartDate: Date = new Date('12/01/2022'); public projectStartDate: Date = new Date('12/01/2022');
@ -257,16 +258,21 @@ public logg(args){
// }); // });
// this.renderGantt = true; // this.renderGantt = true;
// }); // });
this.refreshData(); this.dataService.fetchUserSupportGroup().then((res: any)=>{
this.states = this.dataService.getStates(); console.log(res);
this.dataService.fetchStates().then((res: any [])=>{ this.userSupportGroup = res.name;
this.states = res; this.refreshData();
this.stateList = res; this.states = this.dataService.getStates();
this.spin = false; this.dataService.fetchStates().then((res: any [])=>{
console.log(this.states); this.states = res;
this.stateList = res;
this.spin = false;
console.log(this.states);
});
}); });
this.filterSettings = { this.filterSettings = {
ignoreAccent: true ignoreAccent: true
// columns: [ // columns: [
@ -923,7 +929,7 @@ public logg(args){
{ {
'sliceStart': this.sliceStart, 'sliceStart': this.sliceStart,
'sliceEnd': this.sliceEnd, 'sliceEnd': this.sliceEnd,
filter: this.filterEnabled ? this.filters : null, filter: this.filterEnabled ? this.filters : [{column: "SupportGroup", filter: "equals", criteria: [this.userSupportGroup]}],
sort: this.sortEnabled ? this.sort : { sort: this.sortEnabled ? this.sort : {
'column': 'ChangeNr', 'column': 'ChangeNr',
        'mode': 'asc'         'mode': 'asc'