From b0ca149fb7b531e67b17e4645d576020700d4e22 Mon Sep 17 00:00:00 2001 From: Manuel Tauber Date: Mon, 22 Apr 2024 21:37:46 +0200 Subject: [PATCH] last fixes --- frontend/src/app/data.service.ts | 15 +++++++- .../filter-dialog/filter-dialog.component.ts | 6 ++-- .../app/ntt-gantt/ntt-gantt.component.html | 2 +- .../src/app/ntt-gantt/ntt-gantt.component.ts | 34 +++++++++++++++++++ 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/data.service.ts b/frontend/src/app/data.service.ts index 8c25620..7412fac 100644 --- a/frontend/src/app/data.service.ts +++ b/frontend/src/app/data.service.ts @@ -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; } /** diff --git a/frontend/src/app/filter-dialog/filter-dialog.component.ts b/frontend/src/app/filter-dialog/filter-dialog.component.ts index 8898f19..d53eadc 100644 --- a/frontend/src/app/filter-dialog/filter-dialog.component.ts +++ b/frontend/src/app/filter-dialog/filter-dialog.component.ts @@ -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); + // } } /** diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.html b/frontend/src/app/ntt-gantt/ntt-gantt.component.html index 0c33aa8..d448d98 100644 --- a/frontend/src/app/ntt-gantt/ntt-gantt.component.html +++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.html @@ -55,7 +55,7 @@ -

verified_user{{this.userId}}

diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts index c9697b6..beac961 100644 --- a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts +++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts @@ -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