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 paketTypes: any [];
private totalSize: number = null;
public userSupportGroup: string;
public selectedLanguage: string = 'DE';
/**
* This constructor builds the dataService and fetches the states from the backend
@ -38,6 +39,10 @@ export class DataService {
this.paketTypes = 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;
}
public getUserSupportGroup():string{
return this.userSupportGroup;
}
/**
* The function fetchStates fetches an array from the possible statuses per state
* @returns promise for the fetched Status Array
@ -124,6 +132,19 @@ export class DataService {
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
* @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>
<multiselect-autocomplete
[placeholder]="filterLabels[7]"
[placeholder]="userSupportGroup"
[data]="supportGroups"
[key]="'supportGroup'"
(result)="onResult($event)">

View File

@ -41,6 +41,7 @@ export class FilterDialogComponent implements OnInit {
public paketTypes: string[] = [];
public states: string[] = [];
public contracts: string[] = [];
public userSupportGroup: string;
public criteria: string;
public filterStartDate: Date;
@ -95,6 +96,8 @@ export class FilterDialogComponent implements OnInit {
}
ngOnInit(): void {
this.userSupportGroup = this.dataService.getUserSupportGroup();
console.log(this.userSupportGroup);
if(this.dataService.selectedLanguage == 'DE'){
for (const state of this.dataService.getStates()) {
this.states.push(state.stateNameDE);
@ -210,6 +213,12 @@ export class FilterDialogComponent implements OnInit {
      "filter": "equals",
      "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 allResources: any[] = [];
public resources: any[] = [];
public userSupportGroup: string;
public taskSettings: object = {};
public labelSettings: object = {};
public projectStartDate: Date = new Date('12/01/2022');
@ -257,16 +258,21 @@ public logg(args){
// });
// this.renderGantt = true;
// });
this.refreshData();
this.states = this.dataService.getStates();
this.dataService.fetchStates().then((res: any [])=>{
this.states = res;
this.stateList = res;
this.spin = false;
console.log(this.states);
this.dataService.fetchUserSupportGroup().then((res: any)=>{
console.log(res);
this.userSupportGroup = res.name;
this.refreshData();
this.states = this.dataService.getStates();
this.dataService.fetchStates().then((res: any [])=>{
this.states = res;
this.stateList = res;
this.spin = false;
console.log(this.states);
});
});
this.filterSettings = {
ignoreAccent: true
// columns: [
@ -923,7 +929,7 @@ public logg(args){
{
'sliceStart': this.sliceStart,
'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 : {
'column': 'ChangeNr',
        'mode': 'asc'