calculatePlanTimes/Done

main
manueltauber 2023-06-21 14:18:22 +02:00
parent c2fe066c8d
commit 2c8527a35c
4 changed files with 40 additions and 44 deletions

View File

@ -1,5 +1,5 @@
<ejs-gantt *ngIf="data" #ganttObject id="ganttDefaultSum"
<ejs-gantt *ngIf="renderTimeGantt" #ganttObject id="ganttDefaultSum"
[dataSource]="data"
[includeWeekend]="true"
[resources]="resources"
@ -46,5 +46,4 @@
</div>
</ng-template>
</ejs-gantt>
<h1>TESTSS</h1>

View File

@ -10,9 +10,9 @@ export const MY_DATE_FORMATS = {
},
display: {
dateInput: 'DD.MM.YYYY',
monthYearLabel: 'MMMM YYYY',
monthYearLabel: 'MM YYYY',
dateA11yLabel: 'LL',
monthYearA11yLabel: 'MMMM YYYY'
monthYearA11yLabel: 'MM YYYY'
},
};
@ -26,9 +26,10 @@ export class PlanTimeBarComponent implements OnInit {
@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 = {};
@ -58,44 +59,42 @@ export class PlanTimeBarComponent implements OnInit {
}
this.resources = [{resourceId: 1, resourceName: 'Planzeit Summen pro Woche'}];
// this.data.push({
// TaskID: '' + 0 , TaskName: "Woche " , StartDate: new Date(), EndDate: new Date() , 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
// });
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;
});
});
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);
this.dataService.fetchPlanTimes( this.filterObj, this.projectStartDate, this.projectEndDate).then((res:any[])=>{
console.log(res);
let arr = [];
res.forEach((week)=>{
arr.push(
{
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) => {
@ -138,9 +137,7 @@ 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 },
{ field: 'TaskName', headerText: 'Planzeit pro Woche', width: 250 }
]
}

View File

@ -144,6 +144,7 @@
[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>

View File

@ -124,7 +124,7 @@ export class NttGanttComponent implements OnInit {
public showCriterea: boolean = false;
public criteria: string = '';
public filterEnabled: boolean = false;
public filters:any = null;
public filters: any = null;
public sortEnabled: boolean = false;
public sortedData: any[] = [];
@ -136,6 +136,7 @@ export class NttGanttComponent implements OnInit {
private approvalPending: boolean;
public sort = null;
public oldSort = null;
public planTimes : any[] = [];
/**
@ -274,9 +275,7 @@ public logg(args){
this.inputForTimeline = [this.splitterSettings, this.projectStartDate, this.projectEndDate];
});
});
this.dataService.fetchPlanTimes({filter: this.filterEnabled ? this.filters : {filterElement: [{column: "SupportGroup", filter: "equals", criteria: [this.userSupportGroup]}]}}, this.projectStartDate, this.projectEndDate).then((res:any[])=>{
console.log(res);
});