diff --git a/frontend/src/app/data.service.ts b/frontend/src/app/data.service.ts
index 7d5d3e1..56fe37e 100644
--- a/frontend/src/app/data.service.ts
+++ b/frontend/src/app/data.service.ts
@@ -149,16 +149,31 @@ export class DataService {
* The function updateDatePerChange sends the new date to the backend if the date was moved
* @param change the Change (the Resource) from which the date should be changed
*/
- public updateDatePerChange(change: any){
- //console.log(change);
- let serializableResource = { resourceId: change.resourceId, d2: change.tasks[1].StartDate, changeNr: change.changeNr, state: change.state};
- let strigifiedResource = JSON.stringify(serializableResource);
- let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
- // console.log(resJson);
- this.http.post('http://localhost:8080/api/updateChange', resJson).toPromise().then((value)=>{
- console.log(value);
+ public async updateDatePerChange(change: any){
+ // //console.log(change);
+ // let serializableResource = { resourceId: change.resourceId, d2: change.tasks[1].StartDate, changeNr: change.changeNr, state: change.state};
+ // let strigifiedResource = JSON.stringify(serializableResource);
+ // let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
+ // // console.log(resJson);
+ // this.http.post('http://localhost:8080/api/updateChange', resJson).toPromise().then((value)=>{
+ // console.log(value);
+ // });
+ const promise = new Promise(resolve=>{
+ let serializableResource = { resourceId: change.resourceId, d2: change.tasks[1].StartDate, changeNr: change.changeNr, state: change.state};
+ let strigifiedResource = JSON.stringify(serializableResource);
+ let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
+ // console.log(dataJson);
+ this.http.post('http://localhost:8080/api/updateChange', resJson).subscribe((response:any)=>{
+ resolve(response);
+ },(error:any)=>{
+ resolve(error);
+ });
});
+ return promise;
+
+
+
}
/**
diff --git a/frontend/src/app/plan-time-bar/plan-time-bar.component.html b/frontend/src/app/plan-time-bar/plan-time-bar.component.html
index db41c0f..b0ce311 100644
--- a/frontend/src/app/plan-time-bar/plan-time-bar.component.html
+++ b/frontend/src/app/plan-time-bar/plan-time-bar.component.html
@@ -38,6 +38,9 @@
| Planzeit: {{data.taskData.planzeit}} |
+
+ | StartDate: {{data.taskData.StartDate| date:'dd.MM.yyyy'}} |
+
diff --git a/frontend/src/app/plan-time-bar/plan-time-bar.component.ts b/frontend/src/app/plan-time-bar/plan-time-bar.component.ts
index 22fca6e..64f3750 100644
--- a/frontend/src/app/plan-time-bar/plan-time-bar.component.ts
+++ b/frontend/src/app/plan-time-bar/plan-time-bar.component.ts
@@ -25,7 +25,7 @@ export class PlanTimeBarComponent implements OnInit {
@Input() splitterSettings: object;
@Input() parentResources: Array = [];
@ViewChild('ganttObjectSum')
- public ganttDefault!: GanttComponent;
+ public ganttObjectSum!: GanttComponent;
public data: any[] = [];
public resources: any[] = [];
public userSupportGroup: string;
@@ -60,10 +60,11 @@ export class PlanTimeBarComponent implements OnInit {
calendarWeeks.forEach((week, index) => {
let weekNr = this.getWeekNumber(new Date(calendarWeeks[index].start.toISOString()));
let planzeit = this.getPlantimeFromResources(this.parentResources, weekNr);
- //console.log(`Kalenderwoche ${index + 1}: ${week.start} - ${week.end}`);
+ // console.log(`Kalenderwoche ${index + 1}: ${week.start} - ${week.end}`);
+ // console.log(week);
this.data.push(
{
- TaskID: '' + weekNr, index , TaskName: "Woche " + weekNr, StartDate: calendarWeeks[index].start.toISOString(),EndDate: calendarWeeks[index].end.toISOString() , planzeit: planzeit,
+ TaskID: '' + weekNr, index , TaskName: "Woche " + weekNr, StartDate: calendarWeeks[index].start.toISOString(), EndDate: calendarWeeks[index].end.toISOString() , planzeit: planzeit.toFixed(0),
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
});
});
@@ -97,6 +98,8 @@ export class PlanTimeBarComponent implements OnInit {
this.columns = [
{ field: 'TaskName', headerText: 'Planzeit pro Woche', width: 250 },
+ { field: 'StartDate', headerText: 'Beginn', width: 250 },
+ { field: 'EndDate', headerText: 'Ende', width: 250 },
]
}
@@ -147,9 +150,30 @@ getCalendarWeeks(startDate: Date, endDate: Date): { start: Date, end: Date }[] {
public queryTaskbarInfo(args: any) {
// console.log(args);
- args.taskbarBgColor = "white";
- args.taskbarBorderColor = "white";
+ args.taskbarBgColor = "transparent";
+ args.taskbarBorderColor = "transparent";
args.taskLabelColor = "black";
}
+ public movePlanTime(oldDate: Date, newDate: Date, planTime: any){
+ if(planTime && planTime != 0){
+ let oldWeek = this.getWeekNumber(oldDate);
+ let newWeek = this.getWeekNumber(newDate);
+
+ for (let week of this.data) {
+ if(week.TaskID == oldWeek){
+ console.log(week);
+ week.planzeit - planTime;
+ }
+ }
+
+ for (let week of this.data) {
+ if(week.TaskID == newWeek){
+ console.log(week);
+ week.planzeit + planTime;
+ }
+ }
+ }
+ console.log(this.data);
+ }
}
diff --git a/frontend/src/ntt-gantt/ntt-gantt.component.html b/frontend/src/ntt-gantt/ntt-gantt.component.html
index b7062d7..8e2dc0e 100644
--- a/frontend/src/ntt-gantt/ntt-gantt.component.html
+++ b/frontend/src/ntt-gantt/ntt-gantt.component.html
@@ -139,7 +139,7 @@
-(new Date('12/01/2022')),
@@ -460,9 +462,17 @@ public logg(args){
const found = this.allResources.find((resource) => {
return resource.resourceId == args.data.taskData.resources[0].resourceId;
});
- this.dataService.updateDatePerChange(found);
- this.renderplanTime = false;
- this.refreshData();
+
+ this.dataService.updateDatePerChange(found).then((res:any)=>{
+ //console.log(args);
+ console.log(args.data.taskData.resources[0].plantime);
+ console.log(args.previousData.startDate);
+ console.log(args.editingFields.startDate);
+ this.plantimeComponent.movePlanTime(args.previousData.startDate, args.editingFields.startDate, args.data.taskData.resources[0].plantime)
+ });
+
+ //this.renderplanTime = false;
+ //this.refreshData();
}
}