|
|
@ -7,12 +7,16 @@ import { KeycloakService } from 'keycloak-angular'; |
|
|
|
import {FormationModel, DemandeFormationModel, EvaluationFormationModel, ThemeModel } from "../modeles/modele-formation"; |
|
|
|
import {FormationModel, DemandeFormationModel, EvaluationFormationModel, ThemeModel } from "../modeles/modele-formation"; |
|
|
|
import { urlsFormation } from "../utils/path-values-formations"; |
|
|
|
import { urlsFormation } from "../utils/path-values-formations"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Injectable({ |
|
|
|
@Injectable({ |
|
|
|
providedIn : 'root' |
|
|
|
providedIn : 'root' |
|
|
|
}) |
|
|
|
}) |
|
|
|
export class ServiceFormation { |
|
|
|
export class ServiceFormation { |
|
|
|
constructor(private http: HttpClient, private keycloakService : KeycloakService) {} |
|
|
|
constructor(private http: HttpClient, private keycloakService : KeycloakService) {} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listeFormations() : Observable<FormationModel[]> { |
|
|
|
listeFormations() : Observable<FormationModel[]> { |
|
|
|
let token = this.keycloakService.getKeycloakInstance().token; |
|
|
|
let token = this.keycloakService.getKeycloakInstance().token; |
|
|
|
const headers = { Authorization: "Bearer "+token }; |
|
|
|
const headers = { Authorization: "Bearer "+token }; |
|
|
@ -20,11 +24,11 @@ export class ServiceFormation { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listeFormationsCollaborateur(id) : Observable<FormationModel[]> { |
|
|
|
listeFormationsCollaborateur(id) : Observable<ParticipationFormationModel[]> { |
|
|
|
let token = this.keycloakService.getKeycloakInstance().token; |
|
|
|
let token = this.keycloakService.getKeycloakInstance().token; |
|
|
|
const headers = { Authorization: "Bearer "+token }; |
|
|
|
const headers = { Authorization: "Bearer "+token }; |
|
|
|
let params = { idCollab : id }; |
|
|
|
let params = { idCollab : id }; |
|
|
|
return this.http.get<FormationModel[]>(urlsFormation.urlFormation, { params, headers }); |
|
|
|
return this.http.get<ParticipationFormationModel[]>(urlsFormation.urlFormation, { params, headers }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
nouvelleFormation(formation) : Observable<FormationModel> { |
|
|
|
nouvelleFormation(formation) : Observable<FormationModel> { |
|
|
@ -36,7 +40,7 @@ export class ServiceFormation { |
|
|
|
return this.http.post<FormationModel>(urlsFormation.newFormation, formation, {headers}); |
|
|
|
return this.http.post<FormationModel>(urlsFormation.newFormation, formation, {headers}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateFormation(formation) : Observable<FormationModel> { |
|
|
|
updateFormation(formation) { |
|
|
|
let token = this.keycloakService.getKeycloakInstance().token; |
|
|
|
let token = this.keycloakService.getKeycloakInstance().token; |
|
|
|
const headers = { |
|
|
|
const headers = { |
|
|
|
Authorization: "Bearer "+token, |
|
|
|
Authorization: "Bearer "+token, |
|
|
@ -86,4 +90,10 @@ export class ServiceFormation { |
|
|
|
return this.http.get<ThemeModel[]>(urlsFormation.urlTheme, {headers}); |
|
|
|
return this.http.get<ThemeModel[]>(urlsFormation.urlTheme, {headers}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listeCritere() : Observable<CritereModel[]> { |
|
|
|
|
|
|
|
let token = this.keycloakService.getKeycloakInstance().token; |
|
|
|
|
|
|
|
const headers = { Authorization: "Bearer "+token }; |
|
|
|
|
|
|
|
return this.http.get<ThemeModel[]>(urlsFormation.urlCritere, {headers}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|