modification des stats et ajout du choix du nombre de jours restants pour les périodes d'essai proches de la fin

pull/26/head
Clement FERRERE 2 years ago
parent 56be2bafe2
commit 67890acbba
  1. 2
      src/app/app.module.ts
  2. 28
      src/app/components/home/home.component.html
  3. 20
      src/app/components/home/home.component.ts

@ -28,6 +28,7 @@ import {MatCardModule} from '@angular/material/card';
import {MatProgressBarModule} from "@angular/material/progress-bar";
import {MatDividerModule} from "@angular/material/divider";
import {MatButtonModule} from "@angular/material/button";
import {MatIconModule} from "@angular/material/icon";
@NgModule({
declarations: [
@ -64,6 +65,7 @@ import {MatButtonModule} from "@angular/material/button";
MatProgressBarModule,
MatDividerModule,
MatButtonModule,
MatIconModule,
],
providers: [Title],
bootstrap: [AppComponent]

@ -4,7 +4,15 @@
<mat-card class="home-card">
<mat-card-title class="title-center">Fins de périodes d'essai</mat-card-title>
<mat-card-subtitle class="subtitle-center">7 jours restants ou moins</mat-card-subtitle>
<mat-card-subtitle class="subtitle-center">
{{joursRestant}} jours restants ou moins
<button (click)="incrementJoursRestant()" aria-label="Add a day to look for" mat-icon-button>
<mat-icon>add_box</mat-icon>
</button>
<button (click)="decrementJoursRestant()" aria-label="Add a day to look for" mat-icon-button>
<mat-icon>remove_circle</mat-icon>
</button>
</mat-card-subtitle>
<mat-card-content>
<div class="col-12">
<table class="table">
@ -15,7 +23,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let periodeEssai of periodeEssaisEnCours | slice:0:5;">
<tr *ngFor="let periodeEssai of periodeEssaisEnCours | slice:0:10;">
<td>{{getCollaborateurById(periodeEssai.collaborateurId).name}} {{getCollaborateurById(periodeEssai.collaborateurId).firstName}}</td>
<td> {{getSplitDate(periodeEssai.plannedEndingDate.toString())}}</td>
</tr>
@ -41,7 +49,7 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let collaborateur of collaborateursSansRef | slice:0:5;">
<tr *ngFor="let collaborateur of collaborateursSansRef | slice:0:10;">
<td> {{collaborateur.name}} </td>
<td> {{collaborateur.firstName}} </td>
</tr>
@ -97,8 +105,22 @@
<mat-card class="home-card">
<mat-card-title class="title-center">Statistiques</mat-card-title>
<br/>
<mat-card-content>
<div class="col-12">
<table class="table">
<tbody>
<tr>
<th>Collaborateurs sans référencement</th>
<td>{{collaborateursSansRef.length}}</td>
</tr>
<tr>
<th>Périodes d'essai à moins de {{joursRestant}} jours</th>
<td>{{periodeEssaisEnCours.length}}</td>
</tr>
</tbody>
</table>
<table class="table">
<thead>
<tr>

@ -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();
}
}
}

Loading…
Cancel
Save