From c5f531a66e5f1f1022e1766c5f84f6019d68f8a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yana=C3=ABl=20GRETTE?= Date: Sat, 8 Aug 2020 21:30:40 +0200 Subject: [PATCH] =?UTF-8?q?Impl=C3=A9mentation=20de=20l'ajout=20d'une=20no?= =?UTF-8?q?uvelle=20formation=20(sans=20la=20gestion=20d'erreur)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 14 +++- package.json | 1 + src/app/app.module.ts | 21 ++---- .../formation.component.html | 9 ++- src/app/formations/formations.module.ts | 5 +- .../new-formation.component.html | 70 +++++++++++++++++++ .../new-formation/new-formation.component.ts | 39 ++++++++++- src/app/home/home-rh/home-rh.component.html | 2 +- src/app/home/home-rh/home-rh.component.ts | 5 +- .../angular-material.module.ts | 19 ++++- .../api-swagger/api/formations.service.ts | 28 ++++---- 11 files changed, 173 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0ccaf2d..eb697d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -200,6 +200,14 @@ } } }, + "@angular-material-components/datetime-picker": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@angular-material-components/datetime-picker/-/datetime-picker-2.0.4.tgz", + "integrity": "sha512-3nXGFz7GXbFYeBI2/72rcmPFTWtcC1ERlgdkaY+65dFHXPIc8hKGv6o+JbtCoYPg7xmVCCy4xhmOgfd/CFGyOw==", + "requires": { + "tslib": "^1.9.0" + } + }, "@angular/animations": { "version": "9.1.9", "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-9.1.9.tgz", @@ -4872,9 +4880,9 @@ "dev": true }, "elliptic": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz", - "integrity": "sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz", + "integrity": "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==", "dev": true, "requires": { "bn.js": "^4.4.0", diff --git a/package.json b/package.json index cdb8ca2..943d64e 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ }, "private": true, "dependencies": { + "@angular-material-components/datetime-picker": "^2.0.4", "@angular/animations": "~9.1.9", "@angular/cdk": "^9.2.4", "@angular/common": "~9.1.9", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 5ee2fd8..01b8275 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,11 +2,11 @@ import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgModule, DoBootstrap } from '@angular/core'; import { HttpClientModule } from '@angular/common/http'; -import { FormsModule } from '@angular/forms'; import { KeycloakAngularModule, KeycloakService } from 'keycloak-angular'; import { RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; + import { AppRoutingModule } from './app-routing.module'; import { ApiModule } from '@shared/api-swagger' @@ -33,20 +33,13 @@ let keycloakService: KeycloakService = new KeycloakService(); AppComponent ], imports: [ - BrowserModule, - BrowserAnimationsModule, - KeycloakAngularModule, - AppRoutingModule, - HttpClientModule, - ApiModule, - HomeModule, - CollaborateursModule, - ReferentsModule, - FormationsModule, - DemandesFormationModule, - DemandesDelegationModule, + BrowserModule, BrowserAnimationsModule, + KeycloakAngularModule, AppRoutingModule, + HttpClientModule, ApiModule, + HomeModule, CollaborateursModule, + ReferentsModule, FormationsModule, + DemandesFormationModule, DemandesDelegationModule, EpSaisieModule - ], providers: [ { diff --git a/src/app/formations/details-formation/formation.component.html b/src/app/formations/details-formation/formation.component.html index 2fe0f24..7363ee2 100644 --- a/src/app/formations/details-formation/formation.component.html +++ b/src/app/formations/details-formation/formation.component.html @@ -6,13 +6,18 @@

Informations générales

Etat : {{getStatut(formation.statut)}}

-

{{dateTexte}} {{formation.dateDebut | date:"dd/MM/yyyy"}}

+

{{dateTexte}} {{formation.dateDebut | date:'dd/MM/yyyy à hh:mm'}}

Origine : {{formation.origine}}

Organisme : {{ formation.organisme}}

Mode formation : {{ formation.mode}}

Type formation : {{ formation.type}}

- + + +

Aucun participant

+
+ +

Liste des participants

diff --git a/src/app/formations/formations.module.ts b/src/app/formations/formations.module.ts index b5a93bb..4df5d4b 100644 --- a/src/app/formations/formations.module.ts +++ b/src/app/formations/formations.module.ts @@ -2,6 +2,8 @@ import { NgModule } from "@angular/core"; import { CommonModule } from "@angular/common"; import { RouterModule } from '@angular/router'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; + import { MaterialModule } from "@shared/angular-material/angular-material.module"; import {NavMenuModule} from '@shared/nav-menu/nav-menu.module'; @@ -25,7 +27,8 @@ import { FormationsRoutingModule } from './formations.routing.module'; MaterialModule, NavMenuModule, RouterModule, - FormationsRoutingModule + FormationsRoutingModule, + ReactiveFormsModule ], }) export class FormationsModule {} diff --git a/src/app/formations/new-formation/new-formation.component.html b/src/app/formations/new-formation/new-formation.component.html index 21a3fde..fc0137d 100644 --- a/src/app/formations/new-formation/new-formation.component.html +++ b/src/app/formations/new-formation/new-formation.component.html @@ -1,2 +1,72 @@

Nouvelle formation

+
+
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + + + + + + + + + +
+ +
+ + Nombre de jours + + + + + Nombre d'heures + + +
+ +
+ + Type formation + + Interne + Externe + + + + + Mode formation + + Présentiel + Conférence + + +
+ +
+ Certifiée +
+
+ +
+
diff --git a/src/app/formations/new-formation/new-formation.component.ts b/src/app/formations/new-formation/new-formation.component.ts index ced0386..13478d9 100644 --- a/src/app/formations/new-formation/new-formation.component.ts +++ b/src/app/formations/new-formation/new-formation.component.ts @@ -1,15 +1,50 @@ 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({ selector: 'app-new-formation', - templateUrl: './new-formation.component.html' + templateUrl: './new-formation.component.html', + styleUrls: ['./new-formation.component.css'] }) 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() { } + + ajouterFormation() { + this.nouvelleformation = this.formationForm.value; + this.formationSubscription = this.service.ajouterFormation(this.nouvelleformation).subscribe( + reponse => { + console.log(reponse); + this.router.navigate(['']); + } + ); + } } diff --git a/src/app/home/home-rh/home-rh.component.html b/src/app/home/home-rh/home-rh.component.html index 701bbdf..c7c2c40 100644 --- a/src/app/home/home-rh/home-rh.component.html +++ b/src/app/home/home-rh/home-rh.component.html @@ -13,7 +13,7 @@ Date prévisionnelle - {{ row.datePrevu }} + {{ row.datePrevu | date:'dd/MM/yyyy à hh:mm' }}