Correction d'un bug qui empêchait d'afficher la valeur actuelle du statut, de l'origine, du type et du mode d'une formation lors de la modification de cette dernière

develop
Yanaël GRETTE 4 years ago
parent 44072ac899
commit cbd9232269
  1. 8
      src/app/formations/edit-formation/edit-formation.component.html
  2. 5
      src/app/formations/edit-formation/edit-formation.component.ts

@ -17,7 +17,7 @@
<!-- Attribut : statut --> <!-- Attribut : statut -->
<mat-form-field class="input2"> <mat-form-field class="input2">
<mat-label>Statut formation</mat-label> <mat-label>Statut formation</mat-label>
<mat-select formControlName="statut"> <mat-select formControlName="statut" [compareWith]="compare">
<mat-option *ngFor="let s of statuts" [value]="s">{{s.libelle}}</mat-option> <mat-option *ngFor="let s of statuts" [value]="s">{{s.libelle}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -25,7 +25,7 @@
<!-- Attribut : origine --> <!-- Attribut : origine -->
<mat-form-field class="moveright input2"> <mat-form-field class="moveright input2">
<mat-label>Origine formation</mat-label> <mat-label>Origine formation</mat-label>
<mat-select formControlName="origine"> <mat-select formControlName="origine" [compareWith]="compare">
<mat-option *ngFor="let o of origines" [value]="o">{{o.libelle}}</mat-option> <mat-option *ngFor="let o of origines" [value]="o">{{o.libelle}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@ -72,7 +72,7 @@
<!-- Attribut : type --> <!-- Attribut : type -->
<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" [compareWith]="compare">
<mat-option *ngFor="let t of types" [value]="t">{{t.libelle}}</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>
@ -80,7 +80,7 @@
<!-- Attribut : mode --> <!-- Attribut : mode -->
<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" [compareWith]="compare">
<mat-option *ngFor="let m of modes" [value]="m">{{m.libelle}}</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>

@ -122,6 +122,7 @@ export class EditFormationComponent implements OnInit {
* Initialisé les champs du formulation à partir de la formation déjà existante * Initialisé les champs du formulation à partir de la formation déjà existante
*/ */
initFormation(formation:FormationDTO) { initFormation(formation:FormationDTO) {
console.log(formation);
this.formationForm= this.fb.group( this.formationForm= this.fb.group(
{ {
id: [formation.id], id: [formation.id],
@ -141,6 +142,10 @@ export class EditFormationComponent implements OnInit {
); );
} }
compare(s1:any, s2: any) {
console.log("coucou");
return s1 && s2 && s1.id == s2.id && s1.libelle == s2.libelle;
}
updateFormation() { updateFormation() {
//this.formation = this.formationForm.value; //this.formation = this.formationForm.value;

Loading…
Cancel
Save