last fixes

main
Manuel Tauber 2024-04-22 21:37:46 +02:00
parent 1f22001b2d
commit b0ca149fb7
4 changed files with 52 additions and 5 deletions

View File

@ -141,7 +141,20 @@ export class DataService {
* @returns the name of the corresponding contract
*/
public getContractName(contractId: string): string{
return this.contracts.find((contract)=> {return contract.id == contractId;}).name;
for (const contract of this.contracts) {
if(contract.id == contractId){
console.log(contract);
return contract.name;
}
}
console.log("KEIN VERTRAG GEFUNDEN");
return "";
// console.log(this.contracts);
// if(!this.contracts.find((contract)=> {contract.id == contractId;})){
// console.log("ERROR");
// console.log()
// }
// return this.contracts.find((contract)=> {return contract.id == contractId;}).name;
}
/**

View File

@ -193,9 +193,9 @@ export class FilterDialogComponent implements OnInit {
for (const contract of this.dataService.getContracts()) {
this.contracts.push(contract.name);
}
for (const paketType of this.dataService.getPaketTypes()) {
this.paketTypes.push(paketType.name);
}
// for (const paketType of this.dataService.getPaketTypes()) {
// this.paketTypes.push(paketType.name);
// }
}
/**

View File

@ -55,7 +55,7 @@
<button mat-basic-button *ngIf="isUserPreset" class="editButton" (click)="openRenameDialog()" color="" style="" ><mat-icon>edit</mat-icon></button>
<button mat-basic-button *ngIf="isUserPreset" class="deleteButton" (click)="openDeleteDialog()" color="" style="" ><mat-icon>delete_forever</mat-icon></button>
<button mat-raised-button style="margin-top: 5px; margin-left: 10px; height: 50px; margin-right: 5px;" aria-label="Refresh" (click)="refreshGanttwithPresets()">
<button mat-raised-button style="margin-top: 5px; margin-left: 10px; height: 50px; margin-right: 5px;" aria-label="Refresh" (click)="refreshGanttWithFilters()">
<mat-icon >restart_alt</mat-icon>
</button>
<h3 *ngIf="userId" style="font-family: Arial, Helvetica, sans-serif;"><mat-icon style="color: green;">verified_user</mat-icon>{{this.userId}}</h3>

View File

@ -507,6 +507,40 @@ export class NttGanttComponent implements OnInit {
}
});
}
/**
* The function refreshData fetches a new changes Array from the backend, therefore the mapRequestJSON function is called to map the requestJSON with all filter and sort parameters.
* Furthermore it evaluates the result if the applied filters delivered any Results.
* This function is the most called Funktion in the whole project, it is triggered by a pageEvent, when a filter gets applied and much more...
*/
refreshGanttWithFilters(){
this.resetBulkOpButtons();
this.disableSpin = false;
this.editUserPreferences();
this.showNoResultsError = false;
this.renderGantt = false;
this.dataService.fetchChanges(this.mapRequestJSON()).then((res: any[])=>{
this.allResources = res;
this.mapTasksToResources(this.sliceStart,this.sliceEnd);
if(res.length > 0){
if(res.length == 1){
this.disableSpin = true;
}
this.spin = true;
this.renderGantt = true;
this.showNoResultsError = false;
if(this.selectedScalar == this.scalars[1]){
this.renderplanTime = true;
}
}else{
this.renderGantt = false;
this.spin = false;
this.showNoResultsError = true;
this.renderplanTime = false;
}
});
}
/**
* The function clearFilter clears allFilter parameters and set them to inital values, then it triggers the refreshData function to fetch the changes without any filters except the supportGroup filter.
* This function is triggered if the user disables the apply filter switch