main
parent
06ddb19335
commit
c2fe066c8d
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
<ejs-gantt #ganttObject id="ganttDefaultSum"
|
||||
<ejs-gantt *ngIf="data" #ganttObject id="ganttDefaultSum"
|
||||
[dataSource]="data"
|
||||
[includeWeekend]="true"
|
||||
[resources]="resources"
|
||||
|
|
@ -46,4 +46,5 @@
|
|||
</div>
|
||||
</ng-template>
|
||||
</ejs-gantt>
|
||||
<h1>TESTSS</h1>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { DataService } from 'src/app/data.service';
|
||||
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { GanttComponent } from '@syncfusion/ej2-angular-gantt';
|
||||
import { MAT_DATE_FORMATS } from '@angular/material/core';
|
||||
|
|
@ -24,9 +25,10 @@ export class PlanTimeBarComponent implements OnInit {
|
|||
@Input() inputData: Array<any> = [];
|
||||
@Input() splitterSettings: object;
|
||||
@Input() parentResources: Array<any> = [];
|
||||
@Input() filters: Array<any> = [];
|
||||
@ViewChild('ganttObjectSum')
|
||||
public ganttObjectSum!: GanttComponent;
|
||||
public data: any[] = [];
|
||||
public data: any[];
|
||||
public resources: any[] = [];
|
||||
public userSupportGroup: string;
|
||||
public taskSettings: object = {};
|
||||
|
|
@ -39,13 +41,15 @@ export class PlanTimeBarComponent implements OnInit {
|
|||
public columns: object[] = [];
|
||||
public toolbar: any[] = [];
|
||||
public timelineSettings: object = {};
|
||||
public renderTimeGantt: boolean = false;
|
||||
|
||||
constructor() {
|
||||
public filterObj: any;
|
||||
constructor(public dataService: DataService) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
//this.renderTimeGantt = false;
|
||||
this.splitterSettings = this.inputData[0];
|
||||
this.projectStartDate = this.inputData[1];
|
||||
this.projectEndDate = this.inputData[2];
|
||||
|
|
@ -53,22 +57,59 @@ export class PlanTimeBarComponent implements OnInit {
|
|||
taskLabel: '${taskData.planzeit}'
|
||||
}
|
||||
this.resources = [{resourceId: 1, resourceName: 'Planzeit Summen pro Woche'}];
|
||||
// this.data.push({
|
||||
// TaskID: '' + 0 , TaskName: "Woche " , StartDate: new Date(), EndDate: new Date() , planzeit: 0,
|
||||
// resources: [{resourceId: 1}], Progress: 0, work: 0, isRes: false
|
||||
// });
|
||||
|
||||
let calendarWeeks = this.getCalendarWeeks(this.projectStartDate , this.projectEndDate);
|
||||
if(!this.filters){
|
||||
this.filterObj ={
|
||||
filter: {
|
||||
filterElement: [{column: "SupportGroup", filter: "equals", criteria: [this.userSupportGroup]}]
|
||||
}
|
||||
}
|
||||
}else{
|
||||
this.filterObj ={
|
||||
filter: {
|
||||
filterElement: [this.filters]
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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(
|
||||
this.dataService.fetchPlanTimes( this.filterObj, this.projectStartDate, this.projectEndDate).then((res:any[])=>{
|
||||
console.log(res);
|
||||
let arr = [];
|
||||
res.forEach((week)=>{
|
||||
arr.push(
|
||||
{
|
||||
TaskID: '' + weekNr, index , TaskName: "Woche " + weekNr, StartDate: calendarWeeks[index].start.toISOString(), EndDate: calendarWeeks[index].end.toISOString() , planzeit: planzeit.toFixed(0),
|
||||
TaskID: '' + week.week , TaskName: "Woche " + week, StartDate: week.startDate, EndDate: week.endDate , planzeit: week.planTime,
|
||||
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
|
||||
});
|
||||
this.data = arr;
|
||||
});
|
||||
|
||||
// this.data = [];
|
||||
//this.data = arr;
|
||||
// let ress = [{resourceId: 1, resourceName: 'Planzeit Summen pro Woche'}];
|
||||
// this.resources = ress;
|
||||
console.log(this.data);
|
||||
this.renderTimeGantt = true;
|
||||
});
|
||||
|
||||
// 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.timelineSettings = {
|
||||
bottomTier: {
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@
|
|||
[inputData]="inputForTimeline"
|
||||
[splitterSettings]="splitterSettings"
|
||||
[parentResources]="allResources"
|
||||
[filters]="filters"
|
||||
></app-plan-time-bar>
|
||||
|
||||
<div *ngIf="this.showNoResultsError && this.language =='DE'"><h2>Die Suche lieferte keine Ergebnisse</h2></div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue