106 lines
3.0 KiB
TypeScript
106 lines
3.0 KiB
TypeScript
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
|
import { GanttComponent } from '@syncfusion/ej2-angular-gantt';
|
|
import { MAT_DATE_FORMATS } from '@angular/material/core';
|
|
|
|
export const MY_DATE_FORMATS = {
|
|
parse: {
|
|
dateInput: 'DD.MM.YYYY',
|
|
},
|
|
display: {
|
|
dateInput: 'DD.MM.YYYY',
|
|
monthYearLabel: 'MMMM YYYY',
|
|
dateA11yLabel: 'LL',
|
|
monthYearA11yLabel: 'MMMM YYYY'
|
|
},
|
|
};
|
|
|
|
@Component({
|
|
selector: 'app-plan-time-bar',
|
|
templateUrl: './plan-time-bar.component.html',
|
|
styleUrls: ['./plan-time-bar.component.css']
|
|
})
|
|
export class PlanTimeBarComponent implements OnInit {
|
|
@Input() inputData: Array<any> = [];
|
|
@Input() splitterSettings: object;
|
|
@ViewChild('ganttObjectSum')
|
|
public ganttDefault!: GanttComponent;
|
|
public data: any[] = [];
|
|
public resources: any[] = [];
|
|
public userSupportGroup: string;
|
|
public taskSettings: object = {};
|
|
public labelSettings: object = {};
|
|
public projectStartDate: Date;
|
|
public projectEndDate: Date;
|
|
public resourceFields: object ={};
|
|
public editSettings: object = {};
|
|
public tooltipSettings: object ={};
|
|
public columns: object[] = [];
|
|
public toolbar: any[] = [];
|
|
public timelineSettings: object = {};
|
|
|
|
constructor() { }
|
|
|
|
ngOnInit(): void {
|
|
this.splitterSettings = this.inputData[0];
|
|
this.projectStartDate = this.inputData[1];
|
|
this.projectEndDate = this.inputData[2];
|
|
this.labelSettings = {
|
|
taskLabel: '${taskData.planzeit} H'
|
|
}
|
|
|
|
this.resources = [{resourceId: 1, resourceName: 'Planzeit Summen pro Woche'}];
|
|
|
|
this.data.push(
|
|
{
|
|
TaskID: '01', TaskName: "Woche 1", StartDate: new Date ('01.02.2023'), Duration: 7, planzeit: 1,
|
|
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
|
|
});
|
|
|
|
this.data.push(
|
|
{
|
|
TaskID: '02', TaskName: "Woche 2", StartDate: new Date ('01.10.2023'), Duration: 7, planzeit: 4,
|
|
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
|
|
});
|
|
this.data.push(
|
|
{
|
|
TaskID: '03', TaskName: "Woche 3", StartDate: new Date ('01.18.2023'), Duration: 7, planzeit: 7,
|
|
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
|
|
});
|
|
|
|
this.data.push(
|
|
{
|
|
TaskID: '04', TaskName: "Woche 4", StartDate: new Date ('01.26.2023'), Duration: 7, planzeit: 11,
|
|
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
|
|
});
|
|
|
|
|
|
|
|
this.timelineSettings = {
|
|
bottomTier: {
|
|
format: 'WW',
|
|
unit: 'Week',
|
|
count: 1
|
|
}
|
|
};
|
|
this.taskSettings = {
|
|
id: 'TaskID',
|
|
name: 'TaskName',
|
|
startDate: 'StartDate',
|
|
endDate: 'EndDate',
|
|
duration: 'Duration',
|
|
progress: 'Progress',
|
|
dependency: 'Predecessor',
|
|
resourceInfo: 'resources',
|
|
work: 'work',
|
|
expandState: 'isExpand',
|
|
child: 'subtasks',
|
|
planzeit: 'planzeit'
|
|
};
|
|
this.resourceFields = {
|
|
id: 'resourceId',
|
|
name: 'resourceName',
|
|
};
|
|
}
|
|
|
|
}
|