From 67890acbba36ad49f87e10a2100bc414527b2f79 Mon Sep 17 00:00:00 2001 From: Clement FERRERE Date: Wed, 27 Jul 2022 10:41:27 +0200 Subject: [PATCH] =?UTF-8?q?modification=20des=20stats=20et=20ajout=20du=20?= =?UTF-8?q?choix=20du=20nombre=20de=20jours=20restants=20pour=20les=20p?= =?UTF-8?q?=C3=A9riodes=20d'essai=20proches=20de=20la=20fin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.module.ts | 2 ++ src/app/components/home/home.component.html | 28 ++++++++++++++++++--- src/app/components/home/home.component.ts | 20 ++++++++++++--- 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 962e6e6..33d2c86 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.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] diff --git a/src/app/components/home/home.component.html b/src/app/components/home/home.component.html index 05f9745..a926bb6 100644 --- a/src/app/components/home/home.component.html +++ b/src/app/components/home/home.component.html @@ -4,7 +4,15 @@ Fins de périodes d'essai - 7 jours restants ou moins + + {{joursRestant}} jours restants ou moins + + +
@@ -15,7 +23,7 @@ - + @@ -41,7 +49,7 @@ - + @@ -97,8 +105,22 @@ Statistiques +
+
{{getCollaborateurById(periodeEssai.collaborateurId).name}} {{getCollaborateurById(periodeEssai.collaborateurId).firstName}} {{getSplitDate(periodeEssai.plannedEndingDate.toString())}}
{{collaborateur.name}} {{collaborateur.firstName}}
+ + + + + + + + + + +
Collaborateurs sans référencement{{collaborateursSansRef.length}}
Périodes d'essai à moins de {{joursRestant}} jours{{periodeEssaisEnCours.length}}
+ diff --git a/src/app/components/home/home.component.ts b/src/app/components/home/home.component.ts index 3f1d810..fda21ca 100644 --- a/src/app/components/home/home.component.ts +++ b/src/app/components/home/home.component.ts @@ -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(); + } + } }