Mise à jour du module formation (liste, ajout, modification) avec un problème de binding dans la modification

develop
Yanaël GRETTE 4 years ago
parent cad23074d6
commit f6e2c6ab79
  1. 4
      src/app/app-routing.module.ts
  2. 4
      src/app/app.module.ts
  3. 20
      src/app/formations/details-formation/formation.component.html
  4. 45
      src/app/formations/details-formation/formation.component.ts
  5. 23
      src/app/formations/edit-formation/edit-formation.component.html
  6. 137
      src/app/formations/edit-formation/edit-formation.component.ts
  7. 6
      src/app/formations/formations.component.html
  8. 64
      src/app/formations/formations.component.ts
  9. 4
      src/app/formations/formations.module.ts
  10. 2
      src/app/formations/formations.routing.module.ts
  11. 21
      src/app/formations/new-formation/new-formation.component.html
  12. 45
      src/app/formations/new-formation/new-formation.component.ts
  13. 6
      src/app/home/home-rh/home-rh.component.html
  14. 4
      src/app/home/home-rh/home-rh.component.ts
  15. 10
      src/app/shared/api-swagger/model/formationDTO.ts
  16. 22
      src/app/shared/api-swagger/model/formationDTOParticipantsFormation.ts
  17. 1
      src/app/shared/api-swagger/model/models.ts

@ -41,11 +41,11 @@ const routes: Routes = [
{ {
path: paths_saisie_ep.path, path: paths_saisie_ep.path,
loadChildren: () => import('./ep-saisie/ep-saisie.module').then(m=> m.EpSaisieModule) loadChildren: () => import('./ep-saisie/ep-saisie.module').then(m=> m.EpSaisieModule)
}/*, },
{ {
path: paths_formation.path, path: paths_formation.path,
loadChildren: () => import('./formations/formations.module').then(m=> m.FormationsModule) loadChildren: () => import('./formations/formations.module').then(m=> m.FormationsModule)
}*/, },
{ {
path: paths_referents.path, path: paths_referents.path,
loadChildren: () => import('./referents/referents.module').then(m=> m.ReferentsModule) loadChildren: () => import('./referents/referents.module').then(m=> m.ReferentsModule)

@ -19,7 +19,7 @@ import { HomeModule } from './home';
import { CollaborateursModule } from './collaborateurs'; import { CollaborateursModule } from './collaborateurs';
import { ReferentsModule } from './referents'; import { ReferentsModule } from './referents';
//import { FormationsModule } from './formations'; import { FormationsModule } from './formations';
import { DemandesFormationModule } from './demandes-formation'; import { DemandesFormationModule } from './demandes-formation';
import { DemandesDelegationModule } from './demandes-delegation'; import { DemandesDelegationModule } from './demandes-delegation';
import { EpSaisieModule } from "./ep-saisie"; import { EpSaisieModule } from "./ep-saisie";
@ -43,7 +43,7 @@ let keycloakService: KeycloakService = new KeycloakService();
KeycloakAngularModule, AppRoutingModule, KeycloakAngularModule, AppRoutingModule,
HttpClientModule, ApiModule, HttpClientModule, ApiModule,
HomeModule, CollaborateursModule, HomeModule, CollaborateursModule,
//ReferentsModule, FormationsModule, ReferentsModule, FormationsModule,
DemandesFormationModule, DemandesDelegationModule, DemandesFormationModule, DemandesDelegationModule,
EpSaisieModule, EpModule EpSaisieModule, EpModule
], ],

@ -4,13 +4,14 @@
<h2> {{formation.intitule}} </h2> <h2> {{formation.intitule}} </h2>
<ng-container> <ng-container>
<h3>Informations générales</h3> <h3>Informations générales</h3>
<button mat-raised-button *ngIf="formation.statut!=statutEnum.Realise" [routerLink]="['edit']">Modifier</button> <!--<button mat-raised-button *ngIf="formation.statut!=statutEnum.Realise" [routerLink]="['edit']">Modifier</button>-->
<p>Etat : {{formation.statut}}</p> <button mat-raised-button [routerLink]="['edit']">Modifier</button>
<p>{{dateTexte}} {{formation.dateDebut | date:'dd/MM/yyyy à hh:mm'}}</p> <p>Etat : {{formation.statut.libelle}}</p>
<p>Origine : {{formation.origine}}</p> <p>Date formation : {{formation.dateDebut | date:'dd/MM/yyyy à hh:mm'}}</p>
<p>Origine : {{formation.origine.libelle}}</p>
<p>Organisme : {{ formation.organisme}}</p> <p>Organisme : {{ formation.organisme}}</p>
<p>Mode formation : {{ formation.mode}}</p> <p>Mode formation : {{ formation.mode.libelle}}</p>
<p>Type formation : {{ formation.type}}</p> <p>Type formation : {{ formation.type.libelle}}</p>
</ng-container> </ng-container>
<ng-container *ngIf="formation.participantsFormation == undefined || formation.participantsFormation.length==0"> <ng-container *ngIf="formation.participantsFormation == undefined || formation.participantsFormation.length==0">
@ -21,10 +22,10 @@
<h3>Liste des participants</h3> <h3>Liste des participants</h3>
<mat-table [dataSource]="dataSource"> <mat-table [dataSource]="dataSource">
<ng-container matColumnDef="agence"> <!--<ng-container matColumnDef="agence">
<mat-header-cell *matHeaderCellDef>Agence</mat-header-cell> <mat-header-cell *matHeaderCellDef>Agence</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.agence}}</mat-cell> <mat-cell *matCellDef="let row">{{row.agence}}</mat-cell>
</ng-container> </ng-container>-->
<ng-container matColumnDef="collaborateur"> <ng-container matColumnDef="collaborateur">
<mat-header-cell *matHeaderCellDef>Collaborateur</mat-header-cell> <mat-header-cell *matHeaderCellDef>Collaborateur</mat-header-cell>
@ -36,6 +37,7 @@
<mat-cell *matCellDef="let row">{{row.dateCreation | date :'dd/MM/yy à HH:mm'}}</mat-cell> <mat-cell *matCellDef="let row">{{row.dateCreation | date :'dd/MM/yy à HH:mm'}}</mat-cell>
</ng-container> </ng-container>
<!--
<ng-container matColumnDef="ep"> <ng-container matColumnDef="ep">
<mat-header-cell *matHeaderCellDef>EP</mat-header-cell> <mat-header-cell *matHeaderCellDef>EP</mat-header-cell>
<mat-cell *matCellDef="let row"> <mat-cell *matCellDef="let row">
@ -44,7 +46,7 @@
<p *ngIf="row.statutEP<=1">Attente prochain EP</p> <p *ngIf="row.statutEP<=1">Attente prochain EP</p>
</mat-cell> </mat-cell>
</ng-container> </ng-container>
-->
<ng-container matColumnDef="evaluation"> <ng-container matColumnDef="evaluation">
<mat-header-cell *matHeaderCellDef>Evaluations</mat-header-cell> <mat-header-cell *matHeaderCellDef>Evaluations</mat-header-cell>
<mat-cell *matCellDef="let row"> <mat-cell *matCellDef="let row">

@ -8,8 +8,7 @@ import {MatPaginator} from '@angular/material/paginator';
import {MatSort} from '@angular/material/sort'; import {MatSort} from '@angular/material/sort';
import { FormationsService } from '@shared/api-swagger/api/api'; import { FormationsService } from '@shared/api-swagger/api/api';
import { FormationModel } from "@shared/api-swagger/model/models"; import { FormationDTO, ParticipationFormationDTO } from "@shared/api-swagger/model/models";
import { DisplayParticipation } from "@shared/displayInfo/displays";
/** /**
*/ */
@ -18,17 +17,15 @@ import { DisplayParticipation } from "@shared/displayInfo/displays";
templateUrl: './formation.component.html' templateUrl: './formation.component.html'
}) })
export class FormationComponent implements OnInit { export class FormationComponent implements OnInit {
statutEnum = FormationModel.StatutEnum; //statutEnum = FormationModel.StatutEnum;
formation:FormationModel; formation:FormationDTO;
dateTexte:string = "Prévue le";
formationSubscription: Subscription; formationSubscription: Subscription;
participationsDisplay: DisplayParticipation[]; dataSource : MatTableDataSource<ParticipationFormationDTO>;
dataSource : MatTableDataSource<DisplayParticipation>;
displayedColumns: string[]= ["agence", "collaborateur", "dateinscription", "ep"]; displayedColumns: string[]= ["agence", "collaborateur", "dateinscription", "ep"];
id:any id:any
constructor(private service:FormationsService,private route:ActivatedRoute) {} constructor(private service:FormationsService,private route:ActivatedRoute) {}
ngOnInit() { ngOnInit() {
@ -38,39 +35,11 @@ export class FormationComponent implements OnInit {
); );
} }
initFormation(formation:FormationModel) { initFormation(formation:FormationDTO) {
this.formation = formation; this.formation = formation;
if(this.formation.statut == FormationModel.StatutEnum.Realise) {
this.dateTexte = "Effecutée le";
this.displayedColumns.push("evaluation");
}
if(this.formation.statut == FormationModel.StatutEnum.Annule) {
this.dateTexte = "Initialement prévue le";
}
if(formation.participantsFormation != undefined && formation.participantsFormation.length != 0 ) { if(formation.participantsFormation != undefined && formation.participantsFormation.length != 0 ) {
this.initParticpationFormation(); this.dataSource = new MatTableDataSource(formation.participantsFormation);
}
}
initParticpationFormation() {
let participationDisplay : DisplayParticipation;
this.participationsDisplay = [];
for(let participation of this.formation.participantsFormation ) {
participationDisplay = new DisplayParticipation();
participationDisplay.id =participation.id;
participationDisplay.dateCreation = participation.dateCreation;
participationDisplay.estEvaluee = participation.estEvaluee;
participationDisplay.idEP = participation.demandeformation.ep.id;
participationDisplay.statutEP = participation.demandeformation.ep.etat;
participationDisplay.idCollaborateur = participation.demandeformation.ep.collaborateur.id;
participationDisplay.collaborateur = participation.demandeformation.ep.collaborateur.prenom + " " + participation.demandeformation.ep.collaborateur.nom;
participationDisplay.agence = participation.demandeformation.ep.collaborateur.businessUnit.nom;
this.participationsDisplay.push(participationDisplay);
} }
this.dataSource = new MatTableDataSource(this.participationsDisplay);
} }
ngOnDestroy() { ngOnDestroy() {

@ -12,16 +12,17 @@
</div> </div>
<div> <div>
<mat-form-field class="input"> <mat-form-field class="input2">
<input matInput placeholder="Origine" formControlName="origine"> <mat-label>Statut formation</mat-label>
<mat-select formControlName="statut">
<mat-option *ngFor="let s of statuts" [value]="s">{{s.libelle}}</mat-option>
</mat-select>
</mat-form-field> </mat-form-field>
</div>
<div> <mat-form-field class="moveright input2">
<mat-form-field class="input2"> <mat-label>Origine formation</mat-label>
<mat-label>Statut</mat-label> <mat-select formControlName="origine">
<mat-select formControlName="statut" > <mat-option *ngFor="let o of origines" [value]="o">{{o.libelle}}</mat-option>
<mat-option *ngFor="let key of keysStatuts" value="{{statuts[key]}}">{{statuts[key]}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
@ -61,15 +62,15 @@
<div> <div>
<mat-form-field class="input2"> <mat-form-field class="input2">
<mat-label>Type formation</mat-label> <mat-label>Type formation</mat-label>
<mat-select formControlName="type" > <mat-select formControlName="type">
<mat-option *ngFor="let key of keysTypes" value="{{types[key]}}">{{types[key]}}</mat-option> <mat-option *ngFor="let t of types" [value]="t">{{t.libelle}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field class="moveright input2"> <mat-form-field class="moveright input2">
<mat-label>Mode formation</mat-label> <mat-label>Mode formation</mat-label>
<mat-select formControlName="mode"> <mat-select formControlName="mode">
<mat-option *ngFor="let key of keysModes" value="{{modes[key]}}">{{modes[key]}}</mat-option> <mat-option *ngFor="let m of modes" [value]="m">{{m.libelle}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>

@ -10,7 +10,7 @@ import {MatPaginator} from '@angular/material/paginator';
import {MatSort} from '@angular/material/sort'; import {MatSort} from '@angular/material/sort';
import { FormationModel } from '@shared/api-swagger/model/models'; import { FormationDTO, ModeFormationDTO, TypeFormationDTO, StatutFormationDTO, OrigineFormationDTO } from '@shared/api-swagger/model/models';
import { FormationsService } from '@shared/api-swagger/api/api'; import { FormationsService } from '@shared/api-swagger/api/api';
/** /**
@ -21,53 +21,94 @@ import { FormationsService } from '@shared/api-swagger/api/api';
styleUrls: ["edit-formation.component.css"] styleUrls: ["edit-formation.component.css"]
}) })
export class EditFormationComponent implements OnInit { export class EditFormationComponent implements OnInit {
formation:FormationModel;
formationSubscription: Subscription; formationSubscription: Subscription;
origineSubscription: Subscription;
typeSubscription: Subscription;
modeSubscription: Subscription;
statutSubscription: Subscription;
modes: ModeFormationDTO[];
types: TypeFormationDTO[];
origines: OrigineFormationDTO[];
statuts: StatutFormationDTO[];
//formation: FormationDTO;
formationForm: FormGroup; formationForm: FormGroup;
id :any; id :any;
statuts = FormationModel.StatutEnum;
modes = FormationModel.ModeEnum;
types = FormationModel.TypeEnum;
keysStatuts: any[];
keysModes: any[];
keysTypes: any[];
constructor(private service: FormationsService, private fb: FormBuilder, constructor(private service: FormationsService, private fb: FormBuilder,
private activatedRoute:ActivatedRoute, private router: Router) {} private activatedRoute:ActivatedRoute, private router: Router) {
this.formationForm= this.fb.group(
{
id: [""],
intitule: [""],
origine: [""],
statut : [""],
dateDebut: [""],
dateFin: [""],
heure: [""],
jour: [""],
organisme: [""],
mode: [""],
type: [""],
estCertifie: [""]
}
);
}
ngOnInit() { ngOnInit() {
this.modeSubscription = this.service.getModesFormation().subscribe(
modes => this.modes = modes,
err => console.log(err)
);
this.origineSubscription = this.service.getOriginesFormation().subscribe(
origines => this.origines = origines,
err => console.log(err)
);
this.statutSubscription = this.service.getStatutsFormation().subscribe(
statuts => this.statuts = statuts,
err => console.log(err)
);
this.typeSubscription = this.service.getTypesFormation().subscribe(
types => this.types = types,
err => console.log(err)
);
this.id = this.activatedRoute.snapshot.paramMap.get('id'); this.id = this.activatedRoute.snapshot.paramMap.get('id');
this.formationSubscription = this.service.getFormationById(this.id).subscribe( this.formationSubscription = this.service.getFormationById(this.id).subscribe(
formation => this.initFormation(formation) formation => this.initFormation(formation)
); );
this.keysStatuts = Object.keys(this.statuts).filter(String);
this.keysModes = Object.keys(this.modes).filter(String);
this.keysTypes = Object.keys(this.types).filter(String);
} }
initFormation(formation:FormationModel) { initFormation(formation:FormationDTO) {
this.formation = formation;
//this.formation = formation;
this.formationForm= this.fb.group( this.formationForm= this.fb.group(
{ {
id: [formation.id],
intitule: [formation.intitule],
origine: [formation.origine],
statut : [formation.statut],
dateDebut: [new Date(formation.dateDebut)],
dateFin: [new Date(formation.dateFin)],
heure: [formation.heure],
jour: [formation.jour],
organisme: [formation.organisme],
mode: [formation.mode],
type: [formation.type],
estCertifie: [formation.estCertifie]
}
);
intitule: [this.formation.intitule],
origine: [this.formation.origine],
statut : [this.formation.statut],
dateDebut: [new Date(this.formation.dateDebut)],
dateFin: [new Date(this.formation.dateFin)],
heure: [this.formation.heure],
jour: [this.formation.jour],
organisme: [this.formation.organisme],
mode: [this.formation.mode],
type: [this.formation.type],
estCertifie: [this.formation.estCertifie]
});
} }
updateFormation() { updateFormation() {
this.formation = this.formationForm.value; //this.formation = this.formationForm.value;
this.formation.id = this.id; this.formationSubscription = this.service.updateFormation(this.formationForm.value, this.formationForm.value.id).subscribe(
this.formationSubscription = this.service.updateFormation(this.formation).subscribe(
response => { response => {
this.router.navigate(['/formations',this.id]); this.router.navigate(['/formations',this.id]);
} }
@ -75,7 +116,7 @@ export class EditFormationComponent implements OnInit {
} }
supprimerFormation() { supprimerFormation() {
this.formationSubscription = this.service.deleteFormation(this.formation.id).subscribe( this.formationSubscription = this.service.deleteFormation(this.id).subscribe(
response => this.router.navigate([""]) response => this.router.navigate([""])
); );
} }
@ -86,3 +127,39 @@ export class EditFormationComponent implements OnInit {
} }
} }
} }
/*
this.formationForm= this.fb.group(
{
id: [formation.id],
intitule: [formation.intitule],
origine: [formation.origine],
statut : [formation.statut],
dateDebut: [new Date(formation.dateDebut)],
dateFin: [new Date(formation.dateFin)],
heure: [formation.heure],
jour: [formation.jour],
organisme: [formation.organisme],
mode: [formation.mode],
type: [formation.type],
estCertifie: [formation.estCertifie]
}
);
*/
/*
this.formationForm.setValue(
{
id: formation.id,
intitule: formation.intitule,
origine: formation.origine,
statut : formation.statut,
dateDebut: new Date(formation.dateDebut),
dateFin: new Date(formation.dateFin),
heure: formation.heure,
jour: formation.jour,
organisme: formation.organisme,
mode: formation.mode,
type: formation.type,
estCertifie: formation.estCertifie
}
);
*/

@ -14,17 +14,17 @@
<ng-container matColumnDef="date"> <ng-container matColumnDef="date">
<mat-header-cell *matHeaderCellDef>Date prévisionnelle</mat-header-cell> <mat-header-cell *matHeaderCellDef>Date prévisionnelle</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.datePrevu | date:'dd/MM/yy à hh:mm' }}</mat-cell> <mat-cell *matCellDef="let row">{{ row.dateDebut | date:'dd/MM/yy à hh:mm' }}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="origine"> <ng-container matColumnDef="origine">
<mat-header-cell *matHeaderCellDef>Origine</mat-header-cell> <mat-header-cell *matHeaderCellDef>Origine</mat-header-cell>
<mat-cell *matCellDef="let row"> {{ row.origine}}</mat-cell> <mat-cell *matCellDef="let row"> {{ row.origine.libelle}}</mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="statut"> <ng-container matColumnDef="statut">
<mat-header-cell *matHeaderCellDef>Statut</mat-header-cell> <mat-header-cell *matHeaderCellDef>Statut</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.statut}}</mat-cell> <mat-cell *matCellDef="let row">{{row.statut.libelle}}</mat-cell>
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>

@ -6,8 +6,7 @@ import {MatTableDataSource} from '@angular/material/table';
import {MatPaginator} from '@angular/material/paginator'; import {MatPaginator} from '@angular/material/paginator';
import {MatSort} from '@angular/material/sort'; import {MatSort} from '@angular/material/sort';
import { FormationModel } from "@shared/api-swagger/model/models"; import { FormationDetailsDTO } from "@shared/api-swagger/model/models";
import { DisplayFormation } from "@shared/displayInfo/displays";
import { FormationsService } from "@shared/api-swagger/api/api"; import { FormationsService } from "@shared/api-swagger/api/api";
/** /**
@ -17,8 +16,12 @@ import { FormationsService } from "@shared/api-swagger/api/api";
templateUrl: './formations.component.html' templateUrl: './formations.component.html'
}) })
export class FormationsComponent implements OnInit { export class FormationsComponent implements OnInit {
formationsDisponibles : DisplayFormation[];
formationsFiltres : DisplayFormation[];
asc = true;
numPage = 1;
parPage = 5;
private formationsDisponiblesSubscription : Subscription; private formationsDisponiblesSubscription : Subscription;
//displayedColumns: string[] = ["intitule", "participants", "date", "origine", "statut"] //displayedColumns: string[] = ["intitule", "participants", "date", "origine", "statut"]
@ -27,13 +30,13 @@ export class FormationsComponent implements OnInit {
/** /**
* source pour l'affichage des formations dans le tableau qui est affichée. * source pour l'affichage des formations dans le tableau qui est affichée.
*/ */
dataSource : MatTableDataSource<DisplayFormation>; dataSource : MatTableDataSource<FormationDetailsDTO>;
/** /**
* contenu de la recherche. * contenu de la recherche.
*/ */
search = ""; search = "";
tri = "";
/** /**
* Pagination du tableau. * Pagination du tableau.
*/ */
@ -52,31 +55,36 @@ export class FormationsComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.formationsDisponiblesSubscription = this.service.getFormations(undefined, 1).subscribe( this.updateDataSource(0);
formations => this.initFormations(formations)
);
} }
initFormations(formations:FormationModel[]) { updateDataSource(val:number) {
this.formationsDisponibles = []; switch ((val)) {
let formationDisplay : DisplayFormation; case 0:
for(let formation of formations) { this.formationsDisponiblesSubscription = this.service.getFormations(this.asc,this.numPage, this.parPage, 1, undefined, this.search, this.tri).subscribe(
formationDisplay = new DisplayFormation(); formations => this.dataSource = new MatTableDataSource(formations),
formationDisplay.id = formation.id; err => console.log(err)
formationDisplay.intitule = formation.intitule; );
formationDisplay.nbParticipants = 0; break;
if(formation.participantsFormation != undefined) {
formationDisplay.nbParticipants = formation.participantsFormation.length; case 1:
} this.formationsDisponiblesSubscription = this.service.getFormationRealisee(this.asc,this.numPage, this.parPage, 1, this.search, this.tri).subscribe(
formationDisplay.datePrevu = formation.dateDebut; formations => this.dataSource = new MatTableDataSource(formations),
formationDisplay.origine = formation.origine; err => console.log(err)
formationDisplay.statut = formation.statut; );
this.formationsDisponibles.push(formationDisplay); break;
case 2:
this.formationsDisponiblesSubscription = this.service.getFormationAnnulees(this.asc,this.numPage, this.parPage, 1, this.search, this.tri).subscribe(
formations => this.dataSource = new MatTableDataSource(formations),
err => console.log(err)
);
break;
default:
break;
} }
this.formationsFiltres = this.formationsDisponibles;
this.dataSource = new MatTableDataSource(this.formationsFiltres); //this.dataSource.paginator = this.paginator;
this.dataSource.paginator = this.paginator; //this.dataSource.sort = this.sort;
this.dataSource.sort = this.sort;
} }
ngOnDestroy() { ngOnDestroy() {

@ -16,8 +16,8 @@ import { EditFormationComponent } from './edit-formation/edit-formation.componen
import { FormationsRoutingModule } from './formations.routing.module'; import { FormationsRoutingModule } from './formations.routing.module';
@NgModule({ @NgModule({
declarations: [ FormationsComponent, NewFormationComponent, declarations: [ FormationsComponent, FormationComponent,
FormationComponent, EditFormationComponent NewFormationComponent, EditFormationComponent
], ],
exports: [ exports: [
FormationsComponent FormationsComponent

@ -4,8 +4,8 @@ import { Routes, RouterModule } from '@angular/router';
import { FormationsComponent } from "./formations.component"; import { FormationsComponent } from "./formations.component";
import { FormationComponent } from "./details-formation/formation.component"; import { FormationComponent } from "./details-formation/formation.component";
import { EditFormationComponent } from "./edit-formation/edit-formation.component";
import { NewFormationComponent } from "./new-formation/new-formation.component"; import { NewFormationComponent } from "./new-formation/new-formation.component";
import { EditFormationComponent } from "./edit-formation/edit-formation.component";
import { KeycloakGuard } from '@shared/guards/keycloakguard'; import { KeycloakGuard } from '@shared/guards/keycloakguard';

@ -7,9 +7,20 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div> <div>
<mat-form-field class="input"> <mat-form-field class="input2">
<input matInput placeholder="Origine" formControlName="origine"> <mat-label>Statut formationn</mat-label>
<mat-select formControlName="statut">
<mat-option *ngFor="let s of statuts" [value]="s">{{s.libelle}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="moveright input2">
<mat-label>Origine formation</mat-label>
<mat-select formControlName="origine">
<mat-option *ngFor="let o of origines" [value]="o">{{o.libelle}}</mat-option>
</mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
@ -48,15 +59,15 @@
<div> <div>
<mat-form-field class="input2"> <mat-form-field class="input2">
<mat-label>Type formation</mat-label> <mat-label>Type formation</mat-label>
<mat-select formControlName="type" > <mat-select formControlName="type">
<mat-option *ngFor="let key of keysTypes" value="{{types[key]}}">{{types[key]}}</mat-option> <mat-option *ngFor="let t of types" [value]="t">{{t.libelle}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<mat-form-field class="moveright input2"> <mat-form-field class="moveright input2">
<mat-label>Mode formation</mat-label> <mat-label>Mode formation</mat-label>
<mat-select formControlName="mode"> <mat-select formControlName="mode">
<mat-option *ngFor="let key of keysModes" value="{{modes[key]}}">{{modes[key]}}</mat-option> <mat-option *ngFor="let m of modes" [value]="m">{{m.libelle}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>

@ -3,7 +3,7 @@ import { Observable, Subscription } from 'rxjs';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms'; import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms';
import { FormationModel } from "@shared/api-swagger/model/models"; import { FormationDTO, ModeFormationDTO, TypeFormationDTO, StatutFormationDTO, OrigineFormationDTO } from "@shared/api-swagger/model/models";
import { FormationsService } from "@shared/api-swagger/api/api"; import { FormationsService } from "@shared/api-swagger/api/api";
@ -16,12 +16,21 @@ import { FormationsService } from "@shared/api-swagger/api/api";
}) })
export class NewFormationComponent implements OnInit { export class NewFormationComponent implements OnInit {
formationSubscription: Subscription; formationSubscription: Subscription;
nouvelleformation: FormationModel; origineSubscription: Subscription;
typeSubscription: Subscription;
modeSubscription: Subscription;
statutSubscription: Subscription;
modes: ModeFormationDTO[];
types: TypeFormationDTO[];
origines: OrigineFormationDTO[];
statuts: StatutFormationDTO[];
//nouvelleformation: FormationDTO;
formationForm = this.fb.group( formationForm = this.fb.group(
{ {
intitule: [""], intitule: [""],
origine: [""], origine: [""],
statut : [FormationModel.StatutEnum.Planifie], statut : [""],
dateDebut: [""], dateDebut: [""],
dateFin: [""], dateFin: [""],
heure: [""], heure: [""],
@ -32,21 +41,35 @@ export class NewFormationComponent implements OnInit {
estCertifie: [""] estCertifie: [""]
} }
); );
modes = FormationModel.ModeEnum;
types = FormationModel.TypeEnum;
keysModes: any[];
keysTypes: any[];
constructor(private fb: FormBuilder, private service:FormationsService, private router: Router) { } constructor(private fb: FormBuilder, private service:FormationsService, private router: Router) { }
ngOnInit() { ngOnInit() {
this.keysModes = Object.keys(this.modes).filter(String); this.modeSubscription = this.service.getModesFormation().subscribe(
this.keysTypes = Object.keys(this.types).filter(String); modes => this.modes = modes,
err => console.log(err)
);
this.origineSubscription = this.service.getOriginesFormation().subscribe(
origines => this.origines = origines,
err => console.log(err)
);
this.statutSubscription = this.service.getStatutsFormation().subscribe(
statuts => this.statuts = statuts,
err => console.log(err)
);
this.typeSubscription = this.service.getTypesFormation().subscribe(
types => this.types = types,
err => console.log(err)
);
} }
ajouterFormation() { ajouterFormation() {
this.nouvelleformation = this.formationForm.value; //this.nouvelleformation = this.formationForm.value;
this.formationSubscription = this.service.ajouterFormation(this.nouvelleformation).subscribe( this.formationSubscription = this.service.ajouterFormation(this.formationForm.value).subscribe(
response => { response => {
this.router.navigate(['/formations',response["id"]]); this.router.navigate(['/formations',response["id"]]);
} }

@ -15,12 +15,12 @@
<mat-header-cell *matHeaderCellDef>Date prévisionnelle</mat-header-cell> <mat-header-cell *matHeaderCellDef>Date prévisionnelle</mat-header-cell>
<mat-cell *matCellDef="let row">{{ row.dateDebut | date:'dd/MM/yyyy à hh:mm' }}</mat-cell> <mat-cell *matCellDef="let row">{{ row.dateDebut | date:'dd/MM/yyyy à hh:mm' }}</mat-cell>
</ng-container> </ng-container>
<!--
<ng-container matColumnDef="origine"> <ng-container matColumnDef="origine">
<mat-header-cell *matHeaderCellDef>Origine</mat-header-cell> <mat-header-cell *matHeaderCellDef>Origine</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.origine}}</mat-cell> <mat-cell *matCellDef="let row">{{row.origine.libelle}}</mat-cell>
</ng-container> </ng-container>
-->
<ng-container matColumnDef="statut"> <ng-container matColumnDef="statut">
<mat-header-cell *matHeaderCellDef>Statut</mat-header-cell> <mat-header-cell *matHeaderCellDef>Statut</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.statut.libelle}}</mat-cell> <mat-cell *matCellDef="let row">{{row.statut.libelle}}</mat-cell>

@ -31,8 +31,8 @@ export class HomeRHComponent implements OnInit {
private formationsDisponiblesSubscription : Subscription; private formationsDisponiblesSubscription : Subscription;
//displayedColumns: string[] = ["intitule", "participants", "date", "origine", "statut"] //displayedColumns: string[] = ["intitule", "participants", "date", "origine", "statut"]
//displayedColumns: string[] = ["intitule", "origine", "participants", "date", "statut","certification"]; displayedColumns: string[] = ["intitule", "origine", "participants", "date", "statut","certification"];
displayedColumns: string[] = ["intitule", "participants", "date", "statut","certification"]; // displayedColumns: string[] = ["intitule", "participants", "date", "statut","certification"];
/** /**
* source pour l'affichage des formations dans le tableau qui est affichée. * source pour l'affichage des formations dans le tableau qui est affichée.

@ -3,13 +3,13 @@
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire. * API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
* *
* OpenAPI spec version: 1.3.5 * OpenAPI spec version: 1.3.5
* *
* *
* NOTE: This class is auto generated by the swagger code generator program. * NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git * https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually. * Do not edit the class manually.
*/ */
import { FormationDTOParticipantsFormation } from './formationDTOParticipantsFormation'; import { ParticipationFormationDTO } from './participationFormationDTO';
import { ModeFormationDTO } from './modeFormationDTO'; import { ModeFormationDTO } from './modeFormationDTO';
import { OrigineFormationDTO } from './origineFormationDTO'; import { OrigineFormationDTO } from './origineFormationDTO';
import { StatutFormationDTO } from './statutFormationDTO'; import { StatutFormationDTO } from './statutFormationDTO';
@ -18,7 +18,7 @@ import { TypeFormationDTO } from './typeFormationDTO';
/** /**
* Toutes les informations d'une formation * Toutes les informations d'une formation
*/ */
export interface FormationDTO { export interface FormationDTO {
id: number; id: number;
intitule: string; intitule: string;
origine: OrigineFormationDTO; origine: OrigineFormationDTO;
@ -32,5 +32,5 @@ export interface FormationDTO {
mode: ModeFormationDTO; mode: ModeFormationDTO;
type: TypeFormationDTO; type: TypeFormationDTO;
estCertifie: boolean; estCertifie: boolean;
participantsFormation?: Array<FormationDTOParticipantsFormation>; participantsFormation?: Array<ParticipationFormationDTO>;
} }

@ -1,22 +0,0 @@
/**
* API du serveur de l'application de digitalisation des EP
* API qui sra utilisée afin de faire communiquer le client et le serveur ainsi que le serveur et la boîte noire.
*
* OpenAPI spec version: 1.3.5
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
export interface FormationDTOParticipantsFormation {
id: number;
dateCreation: Date;
formation: string;
date?: Date;
statut?: string;
idCollaborateur?: string;
collaborateur?: string;
estEvaluee: boolean;
}

@ -18,7 +18,6 @@ export * from './epSaisieDTO';
export * from './erreurDTO'; export * from './erreurDTO';
export * from './evaluationDTO'; export * from './evaluationDTO';
export * from './formationDTO'; export * from './formationDTO';
export * from './formationDTOParticipantsFormation';
export * from './formationDetailsDTO'; export * from './formationDetailsDTO';
export * from './modeFormationDTO'; export * from './modeFormationDTO';
export * from './objectifDTO'; export * from './objectifDTO';

Loading…
Cancel
Save