Manuel Tauber 2024-04-17 15:16:47 +02:00
parent 392068b485
commit 65cfc0eabd
3 changed files with 126 additions and 11 deletions

View File

@ -663,10 +663,10 @@ export class DataService {
} }
//let approval = this.validateApproval(resp.approvalStatus); //let approval = this.validateApproval(resp.approvalStatus);
res.push({ res.push({
// flagApproval: resp.flagApproval, flagApproval: resp.flagApproval,
// flagCancel: resp.flagCancel, flagCancel: resp.flagCancel,
// flagPermit: resp.flagPermit, flagPermit: resp.flagPermit,
// flagReject: resp.flagReject, flagReject: resp.flagReject,
approval: resp.approval, approval: resp.approval,
resourceId: resp.resourceId, resourceId: resp.resourceId,

View File

@ -81,8 +81,12 @@
<mat-slide-toggle class="showDetails" color="primary" [(ngModel)]="showDetails" [checked]="showDetails" (change)="refreshData()">{{languageService.lMap.get('detailButton')}}</mat-slide-toggle> <mat-slide-toggle class="showDetails" color="primary" [(ngModel)]="showDetails" [checked]="showDetails" (change)="refreshData()">{{languageService.lMap.get('detailButton')}}</mat-slide-toggle>
</div> </div>
<button *ngIf="transitionButton" mat-raised-button style="margin-bottom: 2px; background-color: #00a79d;" class="filterButton" aria-label="Filtern" (click)=" openStatTransitionDialog()">Statusübergang</button>
<button *ngIf="approveButton" mat-raised-button style="margin-bottom: 2px;" class="filterButton" aria-label="Filtern" (click)="approve()">Genehmigen</button>
<button *ngIf="rejectButton" mat-raised-button style="margin-bottom: 2px;" class="filterButton" aria-label="Filtern" (click)="reject()">Ablehnen</button>
<button *ngIf="cancelButton" mat-raised-button style="margin-bottom: 2px;" class="filterButton" aria-label="Filtern" (click)="cancel()">Stornieren</button>
<button *ngIf="reApproveButton" mat-raised-button style="margin-bottom: 2px;" class="filterButton" aria-label="Filtern" (click)="reApprove()">Erneut zur Genehmigung</button>
<button *ngIf="implementerButton" mat-raised-button style="margin-bottom: 2px;" class="filterButton" aria-label="Filtern" (click)="openImplementerDialog()">Implementer Eintragen</button>
<div <div
*ngIf="!this.disableSpin && !this.showNoResultsError && !this.errorService.critical && !this.errorService.rsso && !this.errorService.error" id="showSpin" data-bind="visible: spin" *ngIf="!this.disableSpin && !this.showNoResultsError && !this.errorService.critical && !this.errorService.rsso && !this.errorService.error" id="showSpin" data-bind="visible: spin"
style=" position: absolute; top: auto; left: 30%;"> style=" position: absolute; top: auto; left: 30%;">

View File

@ -177,6 +177,15 @@ export class NttGanttComponent implements OnInit {
public showInitPresetsError: boolean = false; public showInitPresetsError: boolean = false;
public filterBadge: 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 ######################################################################*/ /**###################################################################### 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... * 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(){ refreshData(){
this.resetBulkOpButtons();
this.disableSpin = false; this.disableSpin = false;
this.editUserPreferences(); this.editUserPreferences();
this.showNoResultsError = false; this.showNoResultsError = false;
@ -1268,6 +1278,8 @@ export class NttGanttComponent implements OnInit {
} }
public evaluateBulkOperationButtons(){ public evaluateBulkOperationButtons(){
this.resetBulkOpButtons();
let allStates: boolean = true; let allStates: boolean = true;
let allPermit: boolean = true; let allPermit: boolean = true;
let allApprove: boolean = true; let allApprove: boolean = true;
@ -1333,7 +1345,8 @@ export class NttGanttComponent implements OnInit {
if(allStates){ if(allStates){
this.toolbar = ['']; this.toolbar = [''];
if(allTransition && !this.approvalPending){ 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")); // console.log(document.getElementById("st6"));
// let element: any = document.querySelectorAll(".e-tbar-btn .e-tbtn-txt .e-control .e-btn .e-lib")[0]; // 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){ 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){ 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){ 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){ 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) // console.log(this.toolbar)
@ -1376,6 +1393,100 @@ export class NttGanttComponent implements OnInit {
this.selectedrecords = []; this.selectedrecords = [];
this.selectedrowindex = []; 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(){
}
} }