diff --git a/src/app/home/home-assistante/home-assistante.component.html b/src/app/home/home-assistante/home-assistante.component.html
index 1135a74..52be11d 100644
--- a/src/app/home/home-assistante/home-assistante.component.html
+++ b/src/app/home/home-assistante/home-assistante.component.html
@@ -1,67 +1,3 @@
-
-
- Rechercher un collaborateur
-
-
- close
-
-
+
Liste des EP en cours
-
-
-
-
- Agence
- {{row.collaborateur.businessUnit.nom}}
-
-
-
- Collaborateur
-
- {{row.collaborateur.prenom}} {{row.collaborateur.nom}}
-
-
-
- Ancienneté
-
- {{row.collaborateur.dateArrivee | date: 'yyyy/MM/dd'}}
-
-
-
- Referent
-
- {{row.referent.nom}} {{row.referent.prenom}}
-
-
-
- Type
- {{getType(row.type)}}
-
-
-
- Etat
- {{getEtat(row.statut)}}
-
-
-
- Date envoie mail
- {{row.dateDisponibilite}}
-
-
-
- Date entretient
- {{row.datePrevisionnelle}}
-
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/app/home/home-assistante/home-assistante.component.ts b/src/app/home/home-assistante/home-assistante.component.ts
index 2fc7111..11f61aa 100644
--- a/src/app/home/home-assistante/home-assistante.component.ts
+++ b/src/app/home/home-assistante/home-assistante.component.ts
@@ -1,14 +1,7 @@
-import { Component, OnInit, OnDestroy, ViewChild, ViewChildren, AfterViewInit } from '@angular/core';
+import { Component } from '@angular/core';
+import { Router } from '@angular/router';
+import { epTypeRecherche } from '@shared/utils/cles';
-import { Observable, Subscription } from 'rxjs';
-
-import {MatTableDataSource} from '@angular/material/table';
-import {MatPaginator, PageEvent} from '@angular/material/paginator';
-import {MatSort} from '@angular/material/sort';
-
-import { EpInformationDTO, CollaborateurDTO } from "@shared/api-swagger/model/models";
-import { EpService } from "@shared/api-swagger/api/api";
-import { AuthService } from '@shared/auth/auth.service';
/**
@@ -23,174 +16,28 @@ import { AuthService } from '@shared/auth/auth.service';
templateUrl : 'home-assistante.component.html',
styleUrls : [ "./home-assistante.component.css"]
})
-export class HomeAssistanteComponent implements OnInit, AfterViewInit {
-
-
- /**
- * Ordre de tri à envoyer au serveur (true : croissant, false : décroissantà).
- */
- asc = true;
- /**
- * Numéro de la page à afficher dans le tableau.
- */
- numPage = 1;
- /**
- * Nombre d'élément du tableau à affiche en une page.
- */
- parPage = 15;
- /**
- * Variable qui concerne le choix d'une des BU de l'agence à laquelle appartient l'assistante.
- */
- choixBU = undefined;
- /**
- * Liste des checkboxes à afficher
- * Nous ajouterons les
- */
- checkboxes : string[] = ["Tous"];
- /**
- *
- * En fonction de son utilisation, pourrait remplacer "choixBU".
- */
- idsBU : number[] = [1];
-
- taille = 100;
-
- pageOption = [ 5, 15, 20, 30, 50];
-
- pageEvent: PageEvent;
-
-
- /**
- * Subscription pour récupérer les EP.
- */
- private epDisponiblesSubscription : Subscription;
-
- /**
- * liste des titres des colonnes du tableau.
- */
- displayedColumns: string[] = ["agence", "collaborateur", "anciennete", "referent", "type", "etat", "datemail", "dateentretien" ];
- //displayedColumns: string[] = ["agence", "info", "datemail", "dateentretien", "etat", "type"];
-
- /**
- * source pour l'affichage des EP dans le tableau qui est affichée.
- */
- dataSource : MatTableDataSource;
-
- /**
- * contenu de la recherche.
- */
- search = "";
- tri = "";
-
- /**
- * Pagination du tableau.
- */
- @ViewChild(MatPaginator) paginator: MatPaginator;
-
- /**
- * Tri par les éléments du tableau selon la colonne choisie.
- */
- @ViewChild(MatSort) sort: MatSort;
- /**
- * Spécifie si la liste des EP est en cours de chargement et d'écriture dans le tableau.
- */
- chargement = true;
-
- constructor(private service:EpService) {
- }
-
- /**
- * Récupérer la liste des EP Disponibles dès l'initialisation.
- */
- ngOnInit() {
- //this.updateDataSource();
+export class HomeAssistanteComponent {
+ displayedColumns: string[] = ["agence", "collaborateur", "referent", "datearrivee", "statutep", "typeep", "dateentretien", "datedisponibilite", "consultation"];
+
+ typeRechercheEP : string = epTypeRecherche.EPEnCours;
- }
-
- ngAfterViewInit(){}
+ constructor(private router: Router){}
- updateDataSource() {
- this.epDisponiblesSubscription = this.service.getEPEnCours(this.idsBU, this.asc, this.numPage, this.parPage, this.search, this.tri).
- subscribe(eps => {
-
- this.dataSource = new MatTableDataSource(eps);
- err => console.log(err);
- });
- }
-
- updatePageInfo(event) : PageEvent{
- console.log("update")
- console.log(event);
- this.parPage = event.pageSize;
- this.numPage = event.pageIndex+1;
- this.updateDataSource();
- return event;
- }
-
- /**
- * Récupérer le nombre de temps qu'avait passé le collaborateur au sein d'Apside
- * Cette méthode était utilisé avec l'ancienne version des modèle et des Classe d'Affichage
- * ELle pourra être modifié pour utiliser le module "moment.js" (à chercher)
- */
- getAnciennete(anciennete) {
- let annee = Math.floor(anciennete / 31536000000);
- let mois = Math.floor(anciennete/ 2629800000 % 12);
- return annee + " an(s) et "+ mois+" mois";
- }
-
- /**
- * Permettait de mettre à jour l'ancienneté d'un collaborateur dans une classe qui n'existe plus
- * Elle pourra être modifié pour utiliser le module "moment.js".
- */
- setAnciennete(firstDate, secondDate) {
- return Math.abs(firstDate-secondDate);
- }
- /**
- * Retourne l'état d'un EP
- * A mettre à jour
- */
- getEtat(etat) {
- let res = "";
- switch(etat) {
- case 1:
- res= "Disponible";
+ eventEmitter(event: any) {
+ switch(event.type) {
+ case "collaborateur":
+ if(event.ep.collaborateur != undefined)
+ this.router.navigate(["/collaborateurs", event.ep.collaborateur.id])
break;
- case 2:
- res= "Saisi";
+ case "referent":
+ if(event.ep.referent != undefined)
+ this.router.navigate(["/referents", event.ep.referent.id])
break;
- case 3:
- res= "Attente de l'entretien";
- break;
- case 4:
- res= "Entretien prévu";
- break;
- case 5:
- res= "Attente Signature";
+ case "ep":
+ this.router.navigate(["/ep", event.ep.id]);
break;
}
- return res;
- }
-
- getColor(row) {
- console.log("ui");
- if(row.obligatoire)
- return "red";
- return "white";
}
- getType(type) {
- if(type == 1)
- return "EPA";
- return "EPS";
- }
-
- /**
- * Détruire toutes les Subscriptions utilisées pour libérer de la mémoire après le changement de page.
- */
- ngOnDestroy() {
- if(this.epDisponiblesSubscription != undefined) {
- this.epDisponiblesSubscription.unsubscribe();
- }
- }
}
diff --git a/src/app/shared/mat-tables/ep-table/ep-table.html b/src/app/shared/mat-tables/ep-table/ep-table.html
index cc5be97..88f7112 100644
--- a/src/app/shared/mat-tables/ep-table/ep-table.html
+++ b/src/app/shared/mat-tables/ep-table/ep-table.html
@@ -16,7 +16,7 @@
@@ -54,57 +54,57 @@
-
+
Business Unit
- {{row.collaborateur.businessUnit.nom}}
+ {{row.collaborateur.businessUnit.nom}}
- Collaborateur
- {{row.collaborateur.nom}} {{row.collaborateur.prenom}}
+ Collaborateur
+ {{row.collaborateur.nom}} {{row.collaborateur.prenom}}
- Référent
- {{row.referent.nom}} {{row.referent.prenom}}
+ Référent
+ {{row.referent.nom}} {{row.referent.prenom}}
- Date d'embauche
- {{row.collaborateur.datearrivee | date : 'dd/MM/yyyy'}}
+ Date d'embauche
+ {{row.collaborateur.dateArrivee | date : 'dd/MM/yyyy'}}
- Staut de l'EP
+ Staut de l'EP
{{ afficherStatutEP(row.statut)}}
- Type EP
+ Type EP
{{ afficherTypeEP(row.type) }}
- Date prévisionnelle
- {{ row.dataPrevisionnelle | date : 'dd/MM/yyyy'}}
+ Date prévisionnelle
+ {{ row.datePrevisionnelle | date : 'dd/MM/yyyy'}}
-
+ Date disponibilité
{{ row.dateDisponibilite | date : 'dd/MM/yyyy'}}
-
- Consulter EP
+
+ Consulter EP
diff --git a/src/app/shared/mat-tables/ep-table/ep-table.ts b/src/app/shared/mat-tables/ep-table/ep-table.ts
index ecd2611..bad2405 100644
--- a/src/app/shared/mat-tables/ep-table/ep-table.ts
+++ b/src/app/shared/mat-tables/ep-table/ep-table.ts
@@ -72,7 +72,7 @@ export class EpTableComponent implements OnInit{
@Input() rechercherParDate: boolean = true;
- @Output() eventEmitter: EventEmitter;
+ @Output() eventEmitter: EventEmitter = new EventEmitter();
epSubscription: Subscription;
@@ -85,6 +85,13 @@ export class EpTableComponent implements OnInit{
this.setBUsId();
}
+ emitEvent(type:string, ep: EpInformationDTO) {
+ this.eventEmitter.emit({
+ type: type,
+ ep: ep
+ });
+ }
+
updateDataSource() {
switch(this.typeRechercheEP) {
case epTypeRecherche.EPEnCours:
@@ -102,7 +109,10 @@ export class EpTableComponent implements OnInit{
eps => {
this.dataSource = new MatTableDataSource(eps);
this.epCountSubscription = this.epService.getEPEnCoursCount(this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri, this.dateDebut, this.dateFin).subscribe(
- count => this.taille = count,
+ count => {
+ console.log(count);
+ this.taille = count
+ },
err => console.log(err)
);
},
@@ -113,6 +123,7 @@ export class EpTableComponent implements OnInit{
getEPEnSignes() {
this.epSubscription = this.epService.getEPSignes(this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri, this.dateDebut, this.dateFin).subscribe(
eps => {
+ console.log(eps);
this.dataSource = new MatTableDataSource(eps);
this.epCountSubscription = this.epService.getEPSignesCount(this.busIds, this.asc, this.numPage, this.parPage, this.search, this.tri, this.dateDebut, this.dateFin).subscribe(
count => this.taille = count,
@@ -133,9 +144,9 @@ export class EpTableComponent implements OnInit{
else {
const collaborateurConnecte : CollaborateurDTO = JSON.parse(sessionStorage.getItem(cles.sessionKeyConnectee));
this.bus = collaborateurConnecte.businessUnit.agence.bu;
- for(let bu of this.bus) {
+ /*for(let bu of this.bus) {
this.busIds.push(bu.id);
- }
+ }*/
this.updateDataSource();
this.chargement = false;
}