StateEnum pour le statut modifié pour passer de number à string

master
Yanaël GRETTE 4 years ago
parent 29df52b245
commit 569a820c2c
  1. 4
      src/app/formations/details-formation/formation.component.html
  2. 9
      src/app/formations/details-formation/formation.component.ts
  3. 12
      src/app/formations/formations.component.html
  4. 9
      src/app/formations/formations.component.ts
  5. 3
      src/app/formations/new-formation/new-formation.component.ts
  6. 10
      src/app/shared/api-swagger/model/formationModel.ts

@ -4,8 +4,8 @@
<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!=2">Modifier</button> <button mat-raised-button *ngIf="formation.statut!=statutEnum.Realise">Modifier</button>
<p>Etat : {{getStatut(formation.statut)}}</p> <p>Etat : {{formation.statut}}</p>
<p>{{dateTexte}} {{formation.dateDebut | date:'dd/MM/yyyy à hh:mm'}}</p> <p>{{dateTexte}} {{formation.dateDebut | date:'dd/MM/yyyy à hh:mm'}}</p>
<p>Origine : {{formation.origine}}</p> <p>Origine : {{formation.origine}}</p>
<p>Organisme : {{ formation.organisme}}</p> <p>Organisme : {{ formation.organisme}}</p>

@ -9,7 +9,6 @@ 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 { FormationModel } from "@shared/api-swagger/model/models";
import { DisplayParticipation } from "@shared/displayInfo/displays"; import { DisplayParticipation } from "@shared/displayInfo/displays";
/** /**
@ -19,6 +18,7 @@ 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;
formation:FormationModel; formation:FormationModel;
dateTexte:string = "Prévue le"; dateTexte:string = "Prévue le";
formationSubscription: Subscription; formationSubscription: Subscription;
@ -39,11 +39,11 @@ export class FormationComponent implements OnInit {
initFormation(formation:FormationModel) { initFormation(formation:FormationModel) {
this.formation = formation; this.formation = formation;
if(this.formation.statut == 2) { if(this.formation.statut == FormationModel.StatutEnum.Realise) {
this.dateTexte = "Effecutée le"; this.dateTexte = "Effecutée le";
this.displayedColumns.push("evaluation"); this.displayedColumns.push("evaluation");
} }
if(this.formation.statut == 3) { if(this.formation.statut == FormationModel.StatutEnum.Annule) {
this.dateTexte = "Initialement prévue le"; this.dateTexte = "Initialement prévue le";
} }
if(formation.participantsFormation != undefined && formation.participantsFormation.length != 0 ) { if(formation.participantsFormation != undefined && formation.participantsFormation.length != 0 ) {
@ -72,6 +72,7 @@ export class FormationComponent implements OnInit {
this.dataSource = new MatTableDataSource(this.participationsDisplay); this.dataSource = new MatTableDataSource(this.participationsDisplay);
} }
/*
getStatut(statut:number) { getStatut(statut:number) {
let value =""; let value ="";
switch(statut) { switch(statut) {
@ -90,7 +91,7 @@ export class FormationComponent implements OnInit {
} }
return value; return value;
} }
*/
ngOnDestroy() { ngOnDestroy() {
if(this.formationSubscription != undefined) { if(this.formationSubscription != undefined) {
this.formationSubscription.unsubscribe(); this.formationSubscription.unsubscribe();

@ -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 }}</mat-cell> <mat-cell *matCellDef="let row">{{ row.datePrevu | date:'dd/MM/yy à hh:mm' }}</mat-cell>
</ng-container> </ng-container>
<!--<ng-container matColumnDef="origine"> <ng-container matColumnDef="origine">
<mat-header-cell></mat-header-cell> <mat-header-cell *matHeaderCellDef>Origine</mat-header-cell>
<mat-cell *matCellDef="let row"></mat-cell> <mat-cell *matCellDef="let row"> {{ row.origine}}</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">{{ getStatut(row.statut) }}</mat-cell> <mat-cell *matCellDef="let row">{{row.statut}}</mat-cell>
</ng-container> </ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row> <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>

@ -22,7 +22,7 @@ export class FormationsComponent 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", "participants", "date", "statut"] displayedColumns: string[] = ["intitule", "origine", "participants", "date", "statut"]
/** /**
* 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.
@ -71,6 +71,9 @@ export class FormationsComponent implements OnInit {
} }
formationDisplay.datePrevu = formation.dateDebut; formationDisplay.datePrevu = formation.dateDebut;
formationDisplay.origine = formation.origine; formationDisplay.origine = formation.origine;
console.log(formation.origine);
console.log(formationDisplay.origine);
console.log("");
formationDisplay.statut = formation.statut; formationDisplay.statut = formation.statut;
this.formationsDisponibles.push(formationDisplay); this.formationsDisponibles.push(formationDisplay);
} }
@ -80,7 +83,7 @@ export class FormationsComponent implements OnInit {
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
} }
/*
getStatut(statut:number) { getStatut(statut:number) {
let value =""; let value ="";
@ -100,7 +103,7 @@ export class FormationsComponent implements OnInit {
} }
return value; return value;
} }
*/
ngOnDestroy() { ngOnDestroy() {
if(this.formationsDisponiblesSubscription != undefined) { if(this.formationsDisponiblesSubscription != undefined) {

@ -21,7 +21,7 @@ export class NewFormationComponent implements OnInit {
{ {
intitule: [""], intitule: [""],
origine: [""], origine: [""],
statut : [""], statut : [FormationModel.StatutEnum.Planifie],
dateDebut: [""], dateDebut: [""],
dateFin: [""], dateFin: [""],
heure: [""], heure: [""],
@ -36,6 +36,7 @@ export class NewFormationComponent implements OnInit {
constructor(private fb: FormBuilder, private service:FormationsService, private router: Router) { } constructor(private fb: FormBuilder, private service:FormationsService, private router: Router) { }
ngOnInit() { ngOnInit() {
console.log(FormationModel.StatutEnum);
} }
ajouterFormation() { ajouterFormation() {

@ -27,12 +27,12 @@ export interface FormationModel {
participantsFormation?: Array<ParticipationFormationModel>; participantsFormation?: Array<ParticipationFormationModel>;
} }
export namespace FormationModel { export namespace FormationModel {
export type StatutEnum = 0 | 1 | 2 | 3; export type StatutEnum = 'Planifiée' | 'Replanifiée' | 'Réalisée' | 'Annulée';
export const StatutEnum = { export const StatutEnum = {
NUMBER_0: 0 as StatutEnum, Planifie: 'Planifiée' as StatutEnum,
NUMBER_1: 1 as StatutEnum, Replanifie: 'Replanifiée' as StatutEnum,
NUMBER_2: 2 as StatutEnum, Realise: 'Réalisée' as StatutEnum,
NUMBER_3: 3 as StatutEnum Annule: 'Annulée' as StatutEnum
}; };
export type TypeEnum = 'Externe' | 'Interne'; export type TypeEnum = 'Externe' | 'Interne';
export const TypeEnum = { export const TypeEnum = {

Loading…
Cancel
Save