main
manueltauber 2023-06-21 14:35:22 +02:00
parent 2c8527a35c
commit 38cb5c914b
2 changed files with 40 additions and 48 deletions

View File

@ -63,53 +63,8 @@ export class PlanTimeBarComponent implements OnInit {
// TaskID: '' + 0 , TaskName: "Woche " , StartDate: '28.11.2022', EndDate: '30.11.2022' , planzeit: 0, // TaskID: '' + 0 , TaskName: "Woche " , StartDate: '28.11.2022', EndDate: '30.11.2022' , planzeit: 0,
// resources: [{resourceId: 1}], Progress: 0, work: 0, isRes: false // resources: [{resourceId: 1}], Progress: 0, work: 0, isRes: false
// }); // });
this.dataService.fetchUserSupportGroup().then((res: any)=>{
this.userSupportGroup = res.name;
if(!this.filters){
this.filterObj ={
filter: {
filterElement: [{column: "SupportGroup", filter: "equals", criteria: [this.userSupportGroup]}]
}
}
}else{
this.filterObj ={
filter: {
filterElement: [this.filters]
}
}
}
this.dataService.fetchPlanTimes( this.filterObj, this.projectStartDate, this.projectEndDate).then((res:any[])=>{
res.forEach((week)=>{
this.data.push(
{
TaskID: '' + week.week , TaskName: "Woche " + week.week, StartDate: new Date(week.startDate.substring(6,11)+'-'+week.startDate.substring(3,5)+'-'+week.startDate.substring(0,2)), EndDate: new Date(week.endDate.substring(6,11)+'-'+week.endDate.substring(3,5)+'-'+week.endDate.substring(0,2)) , planzeit: week.planTime,
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
});
});
this.renderTimeGantt = true;
});
});
// let calendarWeeks = this.getCalendarWeeks(this.projectStartDate , this.projectEndDate);
// Ausgabe der Kalenderwochen
// 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(week);
// this.data.push(
// {
// 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
// });
// });
this.fetchPlanTimes();
this.timelineSettings = { this.timelineSettings = {
bottomTier: { bottomTier: {
format: 'WW', format: 'WW',
@ -141,6 +96,38 @@ export class PlanTimeBarComponent implements OnInit {
] ]
} }
public fetchPlanTimes(filter:any = null){
this.renderTimeGantt = false;
this.data = [];
this.dataService.fetchUserSupportGroup().then((res: any)=>{
this.userSupportGroup = res.name;
if(!this.filters || !filter){
this.filterObj ={
filter: {
filterElement: [{column: "SupportGroup", filter: "equals", criteria: [this.userSupportGroup]}]
}
}
}else{
this.filterObj ={
filter: {
filterElement: [filter]
}
}
}
console.log(this.filterObj);
this.dataService.fetchPlanTimes( this.filterObj, this.projectStartDate, this.projectEndDate).then((res:any[])=>{
res.forEach((week)=>{
this.data.push(
{
TaskID: '' + week.week , TaskName: "Woche " + week.week, StartDate: new Date(week.startDate.substring(6,11)+'-'+week.startDate.substring(3,5)+'-'+week.startDate.substring(0,2)), EndDate: new Date(week.endDate.substring(6,11)+'-'+week.endDate.substring(3,5)+'-'+week.endDate.substring(0,2)) , planzeit: week.planTime,
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
});
});
this.renderTimeGantt = true;
});
});
}
getPlantimeFromResources(resources: any[], week: string){ getPlantimeFromResources(resources: any[], week: string){
let planzeit = 0; let planzeit = 0;
for (const res of resources) { for (const res of resources) {

View File

@ -1,3 +1,4 @@
import { PlanTimeBarComponent } from './../app/plan-time-bar/plan-time-bar.component';
import { FilterDialogComponent } from './../app/filter-dialog/filter-dialog.component'; import { FilterDialogComponent } from './../app/filter-dialog/filter-dialog.component';
import { filteredData, editingData } from './../data'; import { filteredData, editingData } from './../data';
import { ImplementerDialogComponent } from './../app/implementer-dialog/implementer-dialog.component'; import { ImplementerDialogComponent } from './../app/implementer-dialog/implementer-dialog.component';
@ -36,6 +37,8 @@ export const MY_DATE_FORMATS = {
export class NttGanttComponent implements OnInit { export class NttGanttComponent implements OnInit {
@ViewChild('ganttObject') @ViewChild('ganttObject')
public ganttDefault!: GanttComponent; public ganttDefault!: GanttComponent;
@ViewChild('plantimeComponent')
public plantimeComponent!: PlanTimeBarComponent;
@ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatPaginator) paginator: MatPaginator;
@ -463,8 +466,8 @@ public logg(args){
return resource.resourceId == args.data.taskData.resources[0].resourceId; return resource.resourceId == args.data.taskData.resources[0].resourceId;
}); });
this.dataService.updateDatePerChange(found); this.dataService.updateDatePerChange(found);
this.renderplanTime = false; //this.renderplanTime = false;
this.refreshData(); this.plantimeComponent.fetchPlanTimes();
} }
} }
@ -1070,9 +1073,11 @@ private oldFilters:{};
this.oldFilters = this.filters this.oldFilters = this.filters
this.filters = null; this.filters = null;
this.refreshData(); this.refreshData();
this.plantimeComponent.fetchPlanTimes(this.filters);
}else{ }else{
this.filters = this.oldFilters; this.filters = this.oldFilters;
this.refreshData(); this.refreshData();
this.plantimeComponent.fetchPlanTimes(this.filters);
} }
} }