|
|
|
@ -32,6 +32,8 @@ export class HomeComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
isShown: boolean = false; |
|
|
|
|
|
|
|
|
|
joursRestant: number = 7; |
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
private http: HttpClient, |
|
|
|
|
private businessUnitService: BusinessunitService, |
|
|
|
@ -42,9 +44,9 @@ export class HomeComponent implements OnInit { |
|
|
|
|
) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static getNextWeek() { |
|
|
|
|
getDateJoursRestant() { |
|
|
|
|
let result = new Date(); |
|
|
|
|
result.setDate(new Date().getDate() + 7); |
|
|
|
|
result.setDate(new Date().getDate() + this.joursRestant); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -95,11 +97,12 @@ export class HomeComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getPeriodeEssais() { |
|
|
|
|
this.periodeEssaisEnCours = [] |
|
|
|
|
this.periodeEssaiService.getPeriodeEssais() |
|
|
|
|
.subscribe(periodeEssais => { |
|
|
|
|
this.periodeEssais = periodeEssais; |
|
|
|
|
periodeEssais.forEach(pe => { |
|
|
|
|
if (new Date(pe.plannedEndingDate).getTime() > new Date().getTime() && new Date(pe.plannedEndingDate).getTime() < HomeComponent.getNextWeek().getTime()) { |
|
|
|
|
if (new Date(pe.plannedEndingDate).getTime() > new Date().getTime() && new Date(pe.plannedEndingDate).getTime() < this.getDateJoursRestant().getTime()) { |
|
|
|
|
this.periodeEssaisEnCours.push(pe); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -114,4 +117,15 @@ export class HomeComponent implements OnInit { |
|
|
|
|
return date.split('T')[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
incrementJoursRestant() { |
|
|
|
|
this.joursRestant += 7; |
|
|
|
|
this.getPeriodeEssais(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
decrementJoursRestant() { |
|
|
|
|
if (this.joursRestant >= 7) { |
|
|
|
|
this.joursRestant -= 7; |
|
|
|
|
this.getPeriodeEssais(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|