parent
b5d1170c0f
commit
c5f531a66e
@ -1,2 +1,72 @@ |
|||||||
<app-nav-menu></app-nav-menu> |
<app-nav-menu></app-nav-menu> |
||||||
<h1> Nouvelle formation </h1> |
<h1> Nouvelle formation </h1> |
||||||
|
<form [formGroup]="formationForm" (ngSubmit)="ajouterFormation()"> |
||||||
|
<div> |
||||||
|
<mat-form-field class="input"> |
||||||
|
<input matInput placeholder="Intitulé" formControlName="intitule"> |
||||||
|
</mat-form-field> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
<mat-form-field class="input"> |
||||||
|
<input matInput placeholder="Origine" formControlName="origine"> |
||||||
|
</mat-form-field> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
<mat-form-field class="input"> |
||||||
|
<input matInput placeholder="Organisme" formControlName="organisme"> |
||||||
|
</mat-form-field> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
<mat-form-field > |
||||||
|
<input matInput [ngxMatDatetimePicker]="datedebut" placeholder="Date prévue" formControlName="dateDebut"> |
||||||
|
<mat-datepicker-toggle matSuffix [for]="datedebut"> </mat-datepicker-toggle> |
||||||
|
<ngx-mat-datetime-picker #datedebut></ngx-mat-datetime-picker> |
||||||
|
</mat-form-field> |
||||||
|
|
||||||
|
<mat-form-field class="moveright"> |
||||||
|
<input matInput [matDatepicker]="datefin" placeholder="Date fin" formControlName="dateFin"> |
||||||
|
<mat-datepicker-toggle matSuffix [for]="datefin"> </mat-datepicker-toggle> |
||||||
|
<mat-datepicker #datefin></mat-datepicker> |
||||||
|
</mat-form-field> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
<mat-form-field class="input2"> |
||||||
|
<mat-label>Nombre de jours</mat-label> |
||||||
|
<input matInput type="number" formControlName="jour" min=1 value="1"> |
||||||
|
</mat-form-field> |
||||||
|
|
||||||
|
<mat-form-field class="moveright input2"> |
||||||
|
<mat-label>Nombre d'heures</mat-label> |
||||||
|
<input matInput type="number" formControlName="heure" min="1" value="1"> |
||||||
|
</mat-form-field> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
<mat-form-field class="input2"> |
||||||
|
<mat-label>Type formation</mat-label> |
||||||
|
<mat-select formControlName="type"> |
||||||
|
<mat-option value="Interne">Interne</mat-option> |
||||||
|
<mat-option value="Externe">Externe</mat-option> |
||||||
|
</mat-select> |
||||||
|
</mat-form-field> |
||||||
|
|
||||||
|
<mat-form-field class="moveright input2"> |
||||||
|
<mat-label>Mode formation</mat-label> |
||||||
|
<mat-select formControlName="mode"> |
||||||
|
<mat-option value="Présentiel">Présentiel</mat-option> |
||||||
|
<mat-option value="Conférence">Conférence</mat-option> |
||||||
|
</mat-select> |
||||||
|
</mat-form-field> |
||||||
|
</div> |
||||||
|
|
||||||
|
<div> |
||||||
|
<mat-checkbox matInput formControlName="estCertifie">Certifiée</mat-checkbox> |
||||||
|
</div> |
||||||
|
<div> |
||||||
|
<button mat-raised-button>Ajouter formation</button> |
||||||
|
</div> |
||||||
|
</form> |
||||||
|
@ -1,15 +1,50 @@ |
|||||||
import { Component, OnInit } from '@angular/core'; |
import { Component, OnInit } from '@angular/core'; |
||||||
|
import { Observable, Subscription } from 'rxjs'; |
||||||
|
import { Router } from '@angular/router'; |
||||||
|
import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms'; |
||||||
|
|
||||||
|
import { FormationModel } from "@shared/api-swagger/model/models"; |
||||||
|
|
||||||
|
import { FormationsService } from "@shared/api-swagger/api/api"; |
||||||
|
|
||||||
/** |
/** |
||||||
*/ |
*/ |
||||||
@Component({ |
@Component({ |
||||||
selector: 'app-new-formation', |
selector: 'app-new-formation', |
||||||
templateUrl: './new-formation.component.html' |
templateUrl: './new-formation.component.html', |
||||||
|
styleUrls: ['./new-formation.component.css'] |
||||||
}) |
}) |
||||||
export class NewFormationComponent implements OnInit { |
export class NewFormationComponent implements OnInit { |
||||||
|
formationSubscription: Subscription; |
||||||
|
nouvelleformation: FormationModel; |
||||||
|
formationForm = this.fb.group( |
||||||
|
{ |
||||||
|
intitule: [""], |
||||||
|
origine: [""], |
||||||
|
statut : [""], |
||||||
|
dateDebut: [""], |
||||||
|
dateFin: [""], |
||||||
|
heure: [""], |
||||||
|
jour: [""], |
||||||
|
organisme: [""], |
||||||
|
mode: [""], |
||||||
|
type: [""], |
||||||
|
estCertifie: [""] |
||||||
|
} |
||||||
|
); |
||||||
|
|
||||||
constructor() {} |
constructor(private fb: FormBuilder, private service:FormationsService, private router: Router) { } |
||||||
|
|
||||||
ngOnInit() { |
ngOnInit() { |
||||||
} |
} |
||||||
|
|
||||||
|
ajouterFormation() { |
||||||
|
this.nouvelleformation = this.formationForm.value; |
||||||
|
this.formationSubscription = this.service.ajouterFormation(this.nouvelleformation).subscribe( |
||||||
|
reponse => { |
||||||
|
console.log(reponse); |
||||||
|
this.router.navigate(['']); |
||||||
|
} |
||||||
|
); |
||||||
|
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue