diff --git a/frontend/src/app/data.service.ts b/frontend/src/app/data.service.ts
index 34a91f7..8c25620 100644
--- a/frontend/src/app/data.service.ts
+++ b/frontend/src/app/data.service.ts
@@ -663,10 +663,10 @@ export class DataService {
}
//let approval = this.validateApproval(resp.approvalStatus);
res.push({
- // flagApproval: resp.flagApproval,
- // flagCancel: resp.flagCancel,
- // flagPermit: resp.flagPermit,
- // flagReject: resp.flagReject,
+ flagApproval: resp.flagApproval,
+ flagCancel: resp.flagCancel,
+ flagPermit: resp.flagPermit,
+ flagReject: resp.flagReject,
approval: resp.approval,
resourceId: resp.resourceId,
diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.html b/frontend/src/app/ntt-gantt/ntt-gantt.component.html
index d819754..fcd6e6b 100644
--- a/frontend/src/app/ntt-gantt/ntt-gantt.component.html
+++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.html
@@ -81,8 +81,12 @@
{{languageService.lMap.get('detailButton')}}
-
-
+
+
+
+
+
+
diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts
index 8affe52..f432062 100644
--- a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts
+++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts
@@ -177,6 +177,15 @@ export class NttGanttComponent implements OnInit {
public showInitPresetsError: boolean = false;
public filterBadge: boolean = false;
+ public transitionButton: boolean = false;
+ public approveButton: boolean = false;
+ public rejectButton: boolean = false;
+ public cancelButton: boolean = false;
+ public reApproveButton: boolean = false;
+ public implementerButton: boolean = false;
+
+
+
/**###################################################################### Initial Loading functions ######################################################################*/
@@ -471,6 +480,7 @@ export class NttGanttComponent implements OnInit {
* 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...
*/
refreshData(){
+ this.resetBulkOpButtons();
this.disableSpin = false;
this.editUserPreferences();
this.showNoResultsError = false;
@@ -1268,6 +1278,8 @@ export class NttGanttComponent implements OnInit {
}
public evaluateBulkOperationButtons(){
+ this.resetBulkOpButtons();
+
let allStates: boolean = true;
let allPermit: boolean = true;
let allApprove: boolean = true;
@@ -1333,7 +1345,8 @@ export class NttGanttComponent implements OnInit {
if(allStates){
this.toolbar = [''];
if(allTransition && !this.approvalPending){
- this.toolbar.push({text:this.languageService.lMap.get("stateChange"), id: "6"});
+ //this.toolbar.push({text:this.languageService.lMap.get("stateChange"), id: "6"});
+ this.transitionButton = true;
// console.log(document.getElementById("st6"));
// let element: any = document.querySelectorAll(".e-tbar-btn .e-tbtn-txt .e-control .e-btn .e-lib")[0];
@@ -1343,16 +1356,20 @@ export class NttGanttComponent implements OnInit {
}
if(allApprove){
- this.toolbar.push({text: this.languageService.lMap.get("genehmigen"), id: "7"});
+ //this.toolbar.push({text: this.languageService.lMap.get("genehmigen"), id: "7"});
+ this.approveButton = true;
}
if(allReject){
- this.toolbar.push({text: this.languageService.lMap.get("ablehnen"), id: "8"});
+ //this.toolbar.push({text: this.languageService.lMap.get("ablehnen"), id: "8"});
+ this.rejectButton = true;
}
if(allCancel){
- this.toolbar.push({text: this.languageService.lMap.get("stornieren"), id: "11"});
+ //this.toolbar.push({text: this.languageService.lMap.get("stornieren"), id: "11"});
+ this.cancelButton = true;
}
if(allImplementer){
- this.toolbar.push({text: this.languageService.lMap.get("implementer"), id: "10"});
+ //this.toolbar.push({text: this.languageService.lMap.get("implementer"), id: "10"});
+ this.implementerButton = true;
}
// console.log(this.toolbar)
@@ -1376,6 +1393,100 @@ export class NttGanttComponent implements OnInit {
this.selectedrecords = [];
this.selectedrowindex = [];
}
+
+ public resetBulkOpButtons(){
+ this.transitionButton = false;
+ this.approveButton = false;
+ this.rejectButton = false;
+ this.cancelButton = false;
+ this.reApproveButton = false;
+ this.implementerButton = false
+ }
+
+ public openStatTransitionDialog(){
+ let data = {changes: [], states: this.states};
+ for (const selectedRescourceId of this.selectedRescourceIds) {
+ for (const iterator of this.resources) {
+ if(iterator.resourceId == selectedRescourceId){
+ data.changes.push({resourceId: iterator.resourceId, changeNr: iterator.changeNr, currentState: iterator.state});
+ }
+ }
+ }
+ let dialogRef = StateDialogComponent;
+ this.matDialog.open(dialogRef,{data : data}).afterClosed().subscribe((res)=>{
+ console.log(res);
+ if(res == "Success"){
+ this.refreshData();
+ }
+ });
+ }
+
+ public openImplementerDialog(){
+ let data = {changes: []};
+ for (const selectedRescourceId of this.selectedRescourceIds) {
+ for (const change of this.resources) {
+ if(change.resourceId == selectedRescourceId){
+ data.changes.push({resourceId: change.resourceId, pkgId: change.changeNr, supportGroupId: change.supportGroupId});
+ }
+ }
+ }
+ this.matDialog.open(ImplementerDialogComponent,{data : data});
+ }
+
+ public approve(){
+ for (const selectedRescourceId of this.selectedRescourceIds) {
+ for (const change of this.resources) {
+ if(change.resourceId == selectedRescourceId){
+ this.dataService.updateApproval(change, 1).then((res: any)=>{
+ if(res.status == 200){
+ this._snackBar.open("Genehmigung erfolgreich", 'Schließen', { horizontalPosition: this.horizontalPosition, verticalPosition: this.verticalPosition, panelClass: ['green-snackbar']});
+ }else{
+ this._snackBar.open(res.HttpErrorResponse.message, 'Schließen', {horizontalPosition: this.horizontalPosition, verticalPosition: this.verticalPosition, panelClass: ['red-snackbar']});
+ }
+ this.refreshData();
+ });
+ }
+ }
+ }
+ }
+
+ public reject(){
+ for (const selectedRescourceId of this.selectedRescourceIds) {
+ for (const change of this.resources) {
+ if(change.resourceId == selectedRescourceId){
+ this.dataService.updateApproval(change, 2).then((res: any)=>{
+ if(res.status == 200){
+ this._snackBar.open("Ablehnen erfolgreich", 'Schließen', {horizontalPosition: this.horizontalPosition,verticalPosition: this.verticalPosition, panelClass: ['green-snackbar']});
+ this.refreshData();
+ }else{
+ this._snackBar.open(res.HttpErrorResponse.message, 'Schließen', {horizontalPosition: this.horizontalPosition, verticalPosition: this.verticalPosition, panelClass: ['red-snackbar']});
+ }
+ });
+ }
+ }
+ }
+ }
+
+ public cancel(){
+ for (const selectedRescourceId of this.selectedRescourceIds) {
+ for (const change of this.resources) {
+ if(change.resourceId == selectedRescourceId){
+ this.dataService.updateApproval(change, 3).then((res: any)=>{
+ if(res.status == 200){
+ this._snackBar.open("Stornieren erfolgreich", 'Schließen', {horizontalPosition: this.horizontalPosition, verticalPosition: this.verticalPosition, panelClass: ['mat-primary']});
+ this.refreshData();
+ }else{
+ this._snackBar.open(res.HttpErrorResponse.message, 'Schließen', {horizontalPosition: this.horizontalPosition, verticalPosition: this.verticalPosition, panelClass: ['mat-primary']});
+ }
+ });
+ }
+ }
+ }
+ }
+
+ public reApprove(){
+
+ }
}