SummenPlanzeit/inProgress
parent
c5d9c5f549
commit
262eab4e68
|
|
@ -321,7 +321,9 @@ export class DataService {
|
||||||
flagPermit: this.validatePermit(resp.state),
|
flagPermit: this.validatePermit(resp.state),
|
||||||
changeImplementerLogin: resp.changeImplementerLogin,
|
changeImplementerLogin: resp.changeImplementerLogin,
|
||||||
packageName: resp.packageName,
|
packageName: resp.packageName,
|
||||||
coordinatorSg: resp.coordinatorSg
|
coordinatorSg: resp.coordinatorSg,
|
||||||
|
planTime: 1,
|
||||||
|
calenderWeek: this.getWeekNumber(new Date(resp.d2))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -333,6 +335,21 @@ export class DataService {
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getWeekNumber(d) {
|
||||||
|
// Copy date so don't modify original
|
||||||
|
d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
|
||||||
|
// Set to nearest Thursday: current date + 4 - current day number
|
||||||
|
// Make Sunday's day number 7
|
||||||
|
d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay()||7));
|
||||||
|
// Get first day of year
|
||||||
|
let yearStart : any;
|
||||||
|
yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1));
|
||||||
|
// Calculate full weeks to nearest Thursday
|
||||||
|
let weekNo = Math.ceil(( ( (d - yearStart) / 86400000) + 1)/7);
|
||||||
|
// Return array of year and week number
|
||||||
|
return '' + d.getUTCFullYear() + weekNo;
|
||||||
|
}
|
||||||
|
|
||||||
validateImplementerEdit(state):boolean{
|
validateImplementerEdit(state):boolean{
|
||||||
if(state == 1 || state == 3 || state == 6){
|
if(state == 1 || state == 3 || state == 6){
|
||||||
return true
|
return true
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ export const MY_DATE_FORMATS = {
|
||||||
export class PlanTimeBarComponent implements OnInit {
|
export class PlanTimeBarComponent implements OnInit {
|
||||||
@Input() inputData: Array<any> = [];
|
@Input() inputData: Array<any> = [];
|
||||||
@Input() splitterSettings: object;
|
@Input() splitterSettings: object;
|
||||||
|
@Input() parentResources: Array<any> = [];
|
||||||
@ViewChild('ganttObjectSum')
|
@ViewChild('ganttObjectSum')
|
||||||
public ganttDefault!: GanttComponent;
|
public ganttDefault!: GanttComponent;
|
||||||
public data: any[] = [];
|
public data: any[] = [];
|
||||||
|
|
@ -53,17 +54,18 @@ export class PlanTimeBarComponent implements OnInit {
|
||||||
}
|
}
|
||||||
this.resources = [{resourceId: 1, resourceName: 'Planzeit Summen pro Woche'}];
|
this.resources = [{resourceId: 1, resourceName: 'Planzeit Summen pro Woche'}];
|
||||||
|
|
||||||
|
console.log(this.parentResources);
|
||||||
let calendarWeeks = this.getCalendarWeeks(this.projectStartDate , this.projectEndDate);
|
let calendarWeeks = this.getCalendarWeeks(this.projectStartDate , this.projectEndDate);
|
||||||
|
|
||||||
// Ausgabe der Kalenderwochen
|
// Ausgabe der Kalenderwochen
|
||||||
calendarWeeks.forEach((week, index) => {
|
calendarWeeks.forEach((week, index) => {
|
||||||
console.log(`Kalenderwoche ${index + 1}: ${week.start} - ${week.end}`);
|
|
||||||
|
|
||||||
|
|
||||||
|
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}`);
|
||||||
this.data.push(
|
this.data.push(
|
||||||
{
|
{
|
||||||
TaskID: '' + this.getWeekNumber(new Date(calendarWeeks[index].start.toISOString())), index , TaskName: "Woche " + this.getWeekNumber(new Date(calendarWeeks[index].start.toISOString())), StartDate: calendarWeeks[index].start.toISOString(),EndDate: calendarWeeks[index].end.toISOString() , planzeit: 1,
|
TaskID: '' + weekNr, index , TaskName: "Woche " + weekNr, StartDate: calendarWeeks[index].start.toISOString(),EndDate: calendarWeeks[index].end.toISOString() , planzeit: planzeit,
|
||||||
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
|
resources: [{resourceId: this.resources[0].resourceId},], Progress: 0, work: 0, isRes: false
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -97,6 +99,19 @@ export class PlanTimeBarComponent implements OnInit {
|
||||||
name: 'resourceName',
|
name: 'resourceName',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPlantimeFromResources(resources: any[], week: string){
|
||||||
|
let planzeit = 0;
|
||||||
|
for (const res of resources) {
|
||||||
|
console.log(res);
|
||||||
|
if(res.calenderWeek == week){
|
||||||
|
planzeit+= res.plantime;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return planzeit
|
||||||
|
}
|
||||||
|
|
||||||
getWeekNumber(d) {
|
getWeekNumber(d) {
|
||||||
// Copy date so don't modify original
|
// Copy date so don't modify original
|
||||||
d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
|
d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@
|
||||||
<app-plan-time-bar
|
<app-plan-time-bar
|
||||||
[inputData]="inputForTimeline"
|
[inputData]="inputForTimeline"
|
||||||
[splitterSettings]="splitterSettings"
|
[splitterSettings]="splitterSettings"
|
||||||
|
[parentResources]="resources"
|
||||||
></app-plan-time-bar>
|
></app-plan-time-bar>
|
||||||
<div *ngIf="this.showNoResultsError && this.language =='DE'"><h2>Die Suche lieferte keine Ergebnisse</h2></div>
|
<div *ngIf="this.showNoResultsError && this.language =='DE'"><h2>Die Suche lieferte keine Ergebnisse</h2></div>
|
||||||
<div *ngIf="this.showNoResultsError && this.language =='EN'"><h2>The search did not return any results</h2></div>
|
<div *ngIf="this.showNoResultsError && this.language =='EN'"><h2>The search did not return any results</h2></div>
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,7 @@ public logg(args){
|
||||||
this.stateList = res;
|
this.stateList = res;
|
||||||
this.spin = false;
|
this.spin = false;
|
||||||
console.log(this.states);
|
console.log(this.states);
|
||||||
|
this.inputForTimeline = [this.splitterSettings, this.projectStartDate, this.projectEndDate];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue