|
|
|
@ -15,6 +15,11 @@ export class PeriodeEssaiComponent implements OnInit { |
|
|
|
|
collaborateurs: Collaborateur[] = []; |
|
|
|
|
periodeEssais: PeriodeEssai[] = []; |
|
|
|
|
|
|
|
|
|
periodeEssaisEnCours: PeriodeEssai[] = []; |
|
|
|
|
periodeEssaisPassees: PeriodeEssai[] = []; |
|
|
|
|
|
|
|
|
|
isOld: boolean = false; |
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
|
private http: HttpClient, |
|
|
|
|
private collaborateurService: CollaborateurService, |
|
|
|
@ -25,6 +30,24 @@ export class PeriodeEssaiComponent implements OnInit { |
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.getCollaborateurs(); |
|
|
|
|
this.getPeriodeEssais(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onIsOldChange() { |
|
|
|
|
this.isOld = !this.isOld; |
|
|
|
|
this.initPeriodeEssai(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
initPeriodeEssai(){ |
|
|
|
|
if (this.isOld) { |
|
|
|
|
this.periodeEssais = this.periodeEssaisPassees; |
|
|
|
|
} |
|
|
|
|
else{ |
|
|
|
|
this.periodeEssais = this.periodeEssaisEnCours; |
|
|
|
|
} |
|
|
|
|
console.log(this.periodeEssais) |
|
|
|
|
console.log(this.periodeEssaisEnCours) |
|
|
|
|
console.log(this.periodeEssaisPassees) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getCollaborateurs(): void { |
|
|
|
@ -46,7 +69,23 @@ export class PeriodeEssaiComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
getPeriodeEssais() { |
|
|
|
|
this.periodeEssaiService.getPeriodeEssais() |
|
|
|
|
.subscribe(periodeEssais => this.periodeEssais = periodeEssais); |
|
|
|
|
.subscribe(periodeEssais => { |
|
|
|
|
periodeEssais.forEach(pe => { |
|
|
|
|
if (new Date(pe.plannedEndingDate).getTime() > new Date().getTime()) { |
|
|
|
|
this.periodeEssaisEnCours.push(pe); |
|
|
|
|
} else { |
|
|
|
|
this.periodeEssaisPassees.push(pe); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
this.initPeriodeEssai(); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getSplitDate(date: string | undefined): string { |
|
|
|
|
if (date == undefined) { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
return date.split('T')[0]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|