approve/reject/cancel Done
parent
4db28dd98e
commit
27fa61cb9c
|
|
@ -199,13 +199,13 @@ export class DataService {
|
|||
return promise;
|
||||
}
|
||||
|
||||
public async approve(change: any){
|
||||
public async updateApproval(change: any, approvalAction){
|
||||
const promise = new Promise(resolve=>{
|
||||
let obj = {changeNr : change.changeNr, resourceId : change.resourceId, state: 1};
|
||||
let obj = {changeNr : change.changeNr, approvalAction: approvalAction};
|
||||
let stringyfiedData = JSON.stringify(obj);
|
||||
let dataJson = JSON.parse(stringyfiedData) as typeof stringyfiedData;
|
||||
console.log(dataJson);
|
||||
this.http.post('http://localhost:8080/api/approve', dataJson).subscribe((response:any)=>{
|
||||
this.http.post('http://localhost:8080/api/updateApproval', dataJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
console.log(error);
|
||||
|
|
@ -216,41 +216,6 @@ export class DataService {
|
|||
return promise;
|
||||
}
|
||||
|
||||
public async reject(change: any){
|
||||
const promise = new Promise(resolve=>{
|
||||
// console.log(change);
|
||||
let obj = {pkgId : change.resourceId, loginId : change.loginId};
|
||||
let stringyfiedData = JSON.stringify(obj);
|
||||
let dataJson = JSON.parse(stringyfiedData) as typeof stringyfiedData;
|
||||
// console.log(dataJson);
|
||||
this.http.post('http://localhost:8080/api/updateImplementer', dataJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
console.log(error);
|
||||
resolve(error);
|
||||
});
|
||||
})
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
public async cancel(change: any){
|
||||
const promise = new Promise(resolve=>{
|
||||
// console.log(change);
|
||||
let obj = {pkgId : change.resourceId, loginId : change.loginId};
|
||||
let stringyfiedData = JSON.stringify(obj);
|
||||
let dataJson = JSON.parse(stringyfiedData) as typeof stringyfiedData;
|
||||
// console.log(dataJson);
|
||||
this.http.post('http://localhost:8080/api/updateImplementer', dataJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
console.log(error);
|
||||
resolve(error);
|
||||
});
|
||||
})
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
/**
|
||||
* The function fetchChanges fetches the changes from backend and maps them to a structure that the Gannt component can interpret
|
||||
|
|
|
|||
|
|
@ -497,12 +497,16 @@ export class NttGanttComponent implements OnInit {
|
|||
this.toolbar = ['Cancel',{text: "Statusübergang", id: "6"} ,{text: "Implementer eintragen", id: "10"}];
|
||||
}else{
|
||||
this.toolbar = ['Cancel',{text: "Statusübergang", id: "6"}];
|
||||
if(this.selRecs[0].taskData.state == 0){
|
||||
this.toolbar = [{text: "stornieren", id: "11"},{text: "Statusübergang", id: "6"} ,{text: "Implementer eintragen", id: "10"}];
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
this.toolbar = ['Cancel'];
|
||||
}
|
||||
|
||||
|
||||
this.approvalPending = false;
|
||||
this.selRecs = [];
|
||||
this.selectedrecords = [];
|
||||
|
|
@ -556,6 +560,9 @@ export class NttGanttComponent implements OnInit {
|
|||
this.toolbar = ['Cancel',{text: "Statusübergang", id: "6"} ,{text: "Implementer eintragen", id: "10"}];
|
||||
}else{
|
||||
this.toolbar = ['Cancel',{text: "Statusübergang", id: "6"}];
|
||||
if(this.selRecs[0].taskData.state == 0){
|
||||
this.toolbar = [{text: "stornieren", id: "11"},{text: "Statusübergang", id: "6"} ,{text: "Implementer eintragen", id: "10"}];
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
|
@ -615,7 +622,7 @@ export class NttGanttComponent implements OnInit {
|
|||
for (const selectedRescourceId of this.selectedRescourceIds) {
|
||||
for (const change of this.resources) {
|
||||
if(change.resourceId == selectedRescourceId){
|
||||
this.dataService.approve(change);
|
||||
this.dataService.updateApproval(change, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -623,22 +630,34 @@ export class NttGanttComponent implements OnInit {
|
|||
}
|
||||
|
||||
|
||||
|
||||
if(args.item.text === "ablehnen"){
|
||||
for (const selectedRescourceId of this.selectedRescourceIds) {
|
||||
for (const iterator of this.resources) {
|
||||
if(iterator.resourceId == selectedRescourceId){
|
||||
for (const i of iterator.tasks) {
|
||||
i.isFixed = true;
|
||||
}
|
||||
iterator.state = iterator.state - 1;
|
||||
this.dataService.updateDatePerChange(iterator);
|
||||
}
|
||||
for (const change of this.resources) {
|
||||
if(change.resourceId == selectedRescourceId){
|
||||
this.dataService.updateApproval(change, 2);
|
||||
}
|
||||
}
|
||||
this.ganttDefault.refresh();
|
||||
}
|
||||
//this.ganttDefault.refresh();
|
||||
}
|
||||
|
||||
if(args.item.text === "stornieren"){
|
||||
for (const selectedRescourceId of this.selectedRescourceIds) {
|
||||
for (const change of this.resources) {
|
||||
if(change.resourceId == selectedRescourceId){
|
||||
this.dataService.updateApproval(change, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
//this.ganttDefault.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
quickRefresh(){
|
||||
this.renderGantt = false;
|
||||
let newData = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue