|
|
|
@ -1,6 +1,13 @@ |
|
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
|
|
|
|
|
|
import { KeycloakService } from 'keycloak-angular'; |
|
|
|
|
import { Observable, Subscription } from 'rxjs'; |
|
|
|
|
|
|
|
|
|
import { ServiceCollaborateur, ServiceFormation, ServiceEP } from "../service"; |
|
|
|
|
import { CollaborateurModel } from "../modeles/modele-collaborateur"; |
|
|
|
|
import { FormationModel } from "../modeles/modele-formation"; |
|
|
|
|
import { EpModel } from "../modeles/modele-ep"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
import { HomeAssistanteComponent } from './home-assistante/home-assistante.component'; |
|
|
|
@ -18,12 +25,112 @@ import { Role } from '../utils/roles'; |
|
|
|
|
export class HomeComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
role = Role; |
|
|
|
|
constructor(public keycloakService : KeycloakService) { |
|
|
|
|
/*private collabListSubscription : Subscription; |
|
|
|
|
private collab1Subscription : Subscription; |
|
|
|
|
private collab2Subscription : Subscription; |
|
|
|
|
private listeCollaborateurs : CollaborateurModel[]; |
|
|
|
|
private formationSubscription : Subscription; |
|
|
|
|
private addFormationSubscription : Subscription; |
|
|
|
|
*/ |
|
|
|
|
private epEnvoieSubscription : Subscription; |
|
|
|
|
private epCollaborateurSubscription : Subscription; |
|
|
|
|
private epDisponiblesSubscription : Subscription; |
|
|
|
|
private epCollaborateurProchain : Subscription; |
|
|
|
|
constructor(public keycloakService : KeycloakService, private serviceCollaborateur : ServiceCollaborateur, |
|
|
|
|
private serviceFormation : ServiceFormation, private serviceEP : ServiceEP) { |
|
|
|
|
|
|
|
|
|
//********TEST********//
|
|
|
|
|
let ep = new EpModel(); |
|
|
|
|
ep.id = 10; |
|
|
|
|
ep.type ="EPA"; |
|
|
|
|
//ep.dateDisponibilite = new Date(2020,0,5,25,30);
|
|
|
|
|
ep.dateDisponibilite = new Date(2020,0,0,25,30); |
|
|
|
|
ep.etat = "créer"; |
|
|
|
|
let collaborateur = new CollaborateurModel(); |
|
|
|
|
collaborateur.id = 1; |
|
|
|
|
collaborateur.nom = "GRETTE"; |
|
|
|
|
collaborateur.prenom = "Yanaël"; |
|
|
|
|
collaborateur.mail = "yanael.grette@apside-groupe.com"; |
|
|
|
|
collaborateur.agence = "Orléans"; |
|
|
|
|
collaborateur.fonction = "Stagiaire"; |
|
|
|
|
|
|
|
|
|
ep.collaborateur = collaborateur; |
|
|
|
|
this.epEnvoieSubscription = this.serviceEP.envoieEP(ep, "saisie"). |
|
|
|
|
subscribe(eps => this.display(eps)); |
|
|
|
|
//this.epCollaborateurProchain = this.serviceEP.prochainEPCollaborateur(3).
|
|
|
|
|
//subscribe(eps => this.display(eps));
|
|
|
|
|
//this.epCollaborateurSubscription = this.serviceEP.listeEPCollaborateur(1).
|
|
|
|
|
//subscribe(eps => this.display(eps));
|
|
|
|
|
//this.epDisponiblesSubscription = this.serviceEP.listeEPDisponibles().
|
|
|
|
|
// subscribe(eps => this.display(eps));
|
|
|
|
|
/* |
|
|
|
|
let formation = new FormationModel(); |
|
|
|
|
formation.intitule = "TestJAVA"; |
|
|
|
|
formation.dateDebut = new Date("10-12-2020"); |
|
|
|
|
formation.dateFin = new Date("10-12-2020"); |
|
|
|
|
formation.statut = "Prévue"; |
|
|
|
|
formation.lieu = "Orléans"; |
|
|
|
|
formation.duree = 5; |
|
|
|
|
formation.organisme = "Apside"; |
|
|
|
|
formation.nomFormateur = "Patrick"; |
|
|
|
|
console.log(formation.dateDebut); |
|
|
|
|
this.addFormationSubscription = this.serviceFormation.nouvelleFormation(formation) |
|
|
|
|
.subscribe(); |
|
|
|
|
this.formationSubscription = this.serviceFormation.listeFormations() |
|
|
|
|
.subscribe(formations=> this.display(formations)); |
|
|
|
|
/* |
|
|
|
|
this.collabListSubscription = this.serviceCollaborateur.listeCollaborateurs(token). |
|
|
|
|
subscribe(collaborateurs => this.test(collaborateurs)); |
|
|
|
|
let params = { mail : "angelique@apside.com"}; |
|
|
|
|
this.collab1Subscription = this.serviceCollaborateur.getCollaborateurByParam(token,params). |
|
|
|
|
subscribe(collaborateurs => this.test2(collaborateurs)); |
|
|
|
|
let params2 = { id : 1 }; |
|
|
|
|
this.collab2Subscription = this.serviceCollaborateur.getCollaborateurByParam(token,params2). |
|
|
|
|
subscribe(collaborateurs => this.test2(collaborateurs)); |
|
|
|
|
|
|
|
|
|
console.log(token);* |
|
|
|
|
//*/
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
display(listes) { |
|
|
|
|
for(let l of listes) { |
|
|
|
|
console.log(l); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/* |
|
|
|
|
test2(collaborateur) { |
|
|
|
|
console.log(collaborateur); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
ngOnInit() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnDestroy() { |
|
|
|
|
/*if(this.collabListSubscription != null) { |
|
|
|
|
this.collabListSubscription.unsubscribe(); |
|
|
|
|
}*/ |
|
|
|
|
/* |
|
|
|
|
if(this.formationSubscription != null) { |
|
|
|
|
this.formationSubscription.unsubscribe(); |
|
|
|
|
} |
|
|
|
|
if(this.addFormationSubscription != null) { |
|
|
|
|
this.addFormationSubscription.unsubscribe(); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
if(this.epEnvoieSubscription != null) { |
|
|
|
|
this.epEnvoieSubscription.unsubscribe(); |
|
|
|
|
} |
|
|
|
|
if(this.epCollaborateurSubscription != null) { |
|
|
|
|
this.epCollaborateurSubscription.unsubscribe(); |
|
|
|
|
} |
|
|
|
|
if(this.epDisponiblesSubscription != null) { |
|
|
|
|
this.epDisponiblesSubscription.unsubscribe(); |
|
|
|
|
} |
|
|
|
|
if(this.epCollaborateurProchain != null) { |
|
|
|
|
this.epCollaborateurProchain.unsubscribe(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|