diff --git a/frontend/src/ntt-gantt/ntt-gantt.component.ts b/frontend/src/ntt-gantt/ntt-gantt.component.ts index 40e86e2..2883625 100644 --- a/frontend/src/ntt-gantt/ntt-gantt.component.ts +++ b/frontend/src/ntt-gantt/ntt-gantt.component.ts @@ -167,6 +167,8 @@ export class NttGanttComponent implements OnInit { this.deMap.set('tooltipDate', 'Geplantes Start Datum'); this.enMap.set('tooltipDate', 'Planned Start Date'); + this.deMap.set('permit', 'Zur Genehmigung'); + this.enMap.set('permit', 'Permit'); this.deMap.set('genehmigen', 'Genehmigen'); this.enMap.set('genehmigen', 'Approve'); this.deMap.set('ablehnen', 'Ablehnen'); @@ -222,14 +224,11 @@ export class NttGanttComponent implements OnInit { } - - public logg(args){ console.log(args); } - /** * The function ngOnInit sets values which are required for rendering the gantt Chart. Furthermore it trims the resources (Changes Array) and sets the paginator to the first page. */ @@ -609,6 +608,11 @@ public logg(args){ this.selRecs = this.selectedrecords; } let allStates: boolean = true; + let allPermit: boolean = true; + let allApprove: boolean = true; + let allReject: boolean = true; + let allCancel: boolean = true; + let allImplementer: boolean = true; this.selectedRescourceIds = []; for (const change of this.selRecs) { if(change.taskData.approvalStatus == 1){ @@ -622,23 +626,54 @@ public logg(args){ }else{ allStates = false; } + + if(change.taskData.flagPermit == true && allPermit == true){ + allPermit = true; + }else{ + allPermit = false; + } + if(change.taskData.flagApproval == true && allApprove == true){ + allApprove = true; + }else{ + allApprove = false; + } + if(change.taskData.flagReject == true && allCancel == true){ + allReject = true; + }else{ + allReject = false; + } + if(change.taskData.flagCancel == true && allCancel == true){ + allCancel = true; + }else{ + allCancel = false; + } + if(change.taskData.implementerEdit == true && allImplementer == true){ + allImplementer = true; + }else{ + allImplementer = false; + } } if(allStates){ - if(this.approvalPending == true){ - this.toolbar = ['Cancel',{text: this.lMap.get("genehmigen"), id: "7"},{text:this.lMap.get("ablehnen"), id: "8"}]; + this.toolbar = []; + this.toolbar.push({text:this.lMap.get("stateChange"), id: "6"}); + if(allPermit){ + this.toolbar.push({text: this.lMap.get("permit"), id: "5"}); } - else{ - if(this.selRecs[0].taskData.state > 0 &&this.selRecs[0].taskData.state < 4){ - this.toolbar = ['Cancel',{text: this.lMap.get("stateChange"), id: "6"} ,{text: this.lMap.get("implementer"), id: "10"}]; - }else{ - this.toolbar = ['Cancel',{text: this.lMap.get("stateChange"), id: "6"}]; - if(this.selRecs[0].taskData.state == 0){ - this.toolbar = [{text: this.lMap.get("stornieren"), id: "11"},{text:this.lMap.get("stateChange"), id: "6"} ,{text: this.lMap.get("implementer"), id: "10"}]; - } - } + if(allApprove){ + this.toolbar.push({text: this.lMap.get("genehmigen"), id: "7"}); } + if(allReject){ + this.toolbar.push({text: this.lMap.get("ablehnen"), id: "8"}); + } + if(allCancel){ + this.toolbar.push({text: this.lMap.get("stornieren"), id: "11"}); + } + if(allImplementer){ + this.toolbar.push({text: this.lMap.get("implementer"), id: "10"}); + } + }else{ - this.toolbar = ['Cancel']; + this.toolbar = []; } @@ -672,6 +707,11 @@ public logg(args){ this.selRecs = this.selectedrecords; } let allStates: boolean = true; + let allPermit: boolean = true; + let allApprove: boolean = true; + let allReject: boolean = true; + let allCancel: boolean = true; + let allImplementer: boolean = true; this.selectedRescourceIds = []; for (const change of this.selRecs) { if(change.taskData.state == this.selRecs[0].taskData.state){ @@ -685,24 +725,57 @@ public logg(args){ }else{ allStates = false; } - } - if(allStates){ - if(this.approvalPending == true){ - this.toolbar = ['Cancel',{text: this.lMap.get("genehmigen"), id: "7"},{text: this.lMap.get("ablehnen"), id: "8"}]; - } - else{ - if(this.selRecs[0].taskData.state > 0 &&this.selRecs[0].taskData.state < 4){ - this.toolbar = ['Cancel',{text: this.lMap.get("stateChange"), id: "6"} ,{text: this.lMap.get("implementer"), id: "10"}]; - }else{ - this.toolbar = ['Cancel',{text: this.lMap.get("stateChange"), id: "6"}]; - if(this.selRecs[0].taskData.state == 0){ - this.toolbar = [{text: this.lMap.get("stornieren"), id: "11"},{text: this.lMap.get("stateChange"), id: "6"} ,{text: this.lMap.get("implementer"), id: "10"}]; - } - } - } - }else{ - this.toolbar = ['Cancel']; - } + + + if(change.taskData.flagPermit == true && allPermit == true){ + allPermit = true; + }else{ + allPermit = false; + } + if(change.taskData.flagApproval == true && allApprove == true){ + allApprove = true; + }else{ + allApprove = false; + } + if(change.taskData.flagReject == true && allReject == true){ + allReject = true; + }else{ + allReject = false; + } + if(change.taskData.flagCancel == true && allCancel == true){ + allCancel = true; + }else{ + allCancel = false; + } + if(change.taskData.implementerEdit == true && allImplementer == true){ + allImplementer = true; + }else{ + allImplementer = false; + } + + } + if(allStates){ + this.toolbar = []; + this.toolbar.push({text:this.lMap.get("stateChange"), id: "6"}); + if(allPermit){ + this.toolbar.push({text: this.lMap.get("permit"), id: "5"}); + } + if(allApprove){ + this.toolbar.push({text: this.lMap.get("genehmigen"), id: "7"}); + } + if(allReject){ + this.toolbar.push({text: this.lMap.get("ablehnen"), id: "8"}); + } + if(allCancel){ + this.toolbar.push({text: this.lMap.get("stornieren"), id: "11"}); + } + if(allImplementer){ + this.toolbar.push({text: this.lMap.get("implementer"), id: "10"}); + } + + }else{ + this.toolbar = []; + } this.selRecs = []; this.selectedrecords = []; this.selectedrowindex = [];