diff --git a/src/app/notes/notes.module.ts b/src/app/notes/notes.module.ts
index fb9c805..90c1095 100644
--- a/src/app/notes/notes.module.ts
+++ b/src/app/notes/notes.module.ts
@@ -6,11 +6,13 @@ import { MaterialModule } from "@shared/angular-material/angular-material.module
import {NavMenuModule} from '@shared/nav-menu/nav-menu.module';
import { NotesComponent } from "./notes.component";
-import { FormsModule } from "@angular/forms";
+import { FormsModule, ReactiveFormsModule } from "@angular/forms";
+import { NouvelleNoteComponent } from "./nouvelle-note/nouvelle-note.component";
+
@NgModule({
declarations: [
- NotesComponent
+ NotesComponent, NouvelleNoteComponent
],
imports: [
CommonModule,
@@ -18,7 +20,7 @@ import { FormsModule } from "@angular/forms";
NavMenuModule,
RouterModule,
NotesRoutingModule,
- FormsModule
+ FormsModule, ReactiveFormsModule
],
})
export class NotesModule {}
\ No newline at end of file
diff --git a/src/app/notes/notes.routing.module.ts b/src/app/notes/notes.routing.module.ts
index 07cfa39..8b88bc7 100644
--- a/src/app/notes/notes.routing.module.ts
+++ b/src/app/notes/notes.routing.module.ts
@@ -7,8 +7,10 @@ import { AuthGuard } from "@shared/auth/auth.guard";
import { paths_notes } from "@shared/utils/paths";
+import { NouvelleNoteComponent } from './nouvelle-note/nouvelle-note.component';
const routes: Routes = [
+ { path: paths_notes.ajoutNote, component: NouvelleNoteComponent, canActivate: [AuthGuard]},
{path: "", component: NotesComponent, canActivate: [AuthGuard]},
]
diff --git a/src/app/notes/nouvelle-note/dialog-choix-collaborateur-note.html b/src/app/notes/nouvelle-note/dialog-choix-collaborateur-note.html
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/notes/nouvelle-note/nouvelle-note.component.html b/src/app/notes/nouvelle-note/nouvelle-note.component.html
new file mode 100644
index 0000000..70e2b5e
--- /dev/null
+++ b/src/app/notes/nouvelle-note/nouvelle-note.component.html
@@ -0,0 +1,27 @@
+
+
Nouvelle note
+
+
+
+
+
\ No newline at end of file
diff --git a/src/app/notes/nouvelle-note/nouvelle-note.component.ts b/src/app/notes/nouvelle-note/nouvelle-note.component.ts
new file mode 100644
index 0000000..dade3ed
--- /dev/null
+++ b/src/app/notes/nouvelle-note/nouvelle-note.component.ts
@@ -0,0 +1,69 @@
+import { Component, OnInit } from "@angular/core";
+import { FormBuilder } from "@angular/forms";
+import { MatDialog } from "@angular/material/dialog";
+import { Router } from "@angular/router";
+import { CollaborateurDTO, DetailsNoteDTO, NotesService } from "@shared/api-swagger";
+import { cles } from "@shared/utils/cles";
+import { Subscription } from "rxjs";
+
+@Component({
+ selector: "nouvelle-note",
+ templateUrl: "./nouvelle-note.component.html"
+})
+export class NouvelleNoteComponent {
+
+ noteSubscription: Subscription;
+
+ collaborateurChoisi: CollaborateurDTO;
+
+ noteForm = this.fb.group(
+ {
+ titre: [""],
+ texte: [""],
+ collaborateur: [""],
+ dateCreation: [""],
+ dateMiseAjour: [""],
+ }
+ )
+ constructor(private noteService: NotesService, private fb: FormBuilder, private router: Router,
+ private dialog: MatDialog) {}
+
+ ajouterNote() {
+ console.log("ui");
+ if(this.collaborateurChoisi == undefined)
+ return;
+ const today : Date = new Date();
+ let nouvelleNote : DetailsNoteDTO = this.noteForm.value;
+ nouvelleNote.collaborateur = this.collaborateurChoisi;
+ nouvelleNote.dateCreation = today;
+ nouvelleNote.dateMiseAjour = today;
+ nouvelleNote.idAuteur = JSON.parse(sessionStorage.getItem(cles.sessionKeyConnectee)).id;
+
+ this.noteSubscription = this.noteService.addNote(nouvelleNote).subscribe(
+ note => {
+ console.log(note);
+ this.router.navigate(["/notes"]);
+ },
+ err => console.log(err)
+ );
+ }
+
+ choixCollaborateur() {
+ console.log("pas ui");
+ }
+
+ ngOnDestroy() {
+ if(this.noteSubscription != undefined) {
+ this.noteSubscription.unsubscribe();
+ }
+ }
+}
+
+
+@Component({
+ selector: "dialog-choix-collaborateur-note",
+ templateUrl: "./dialog-choix-collaborateur-note.html"
+})
+export class DialogChoixCollaborateurNoteComponent {
+
+}
\ No newline at end of file
diff --git a/src/app/shared/nav-menu/nav-menu-commercial/nav-menu-commercial.component.html b/src/app/shared/nav-menu/nav-menu-commercial/nav-menu-commercial.component.html
index 822a3c7..4b76b80 100644
--- a/src/app/shared/nav-menu/nav-menu-commercial/nav-menu-commercial.component.html
+++ b/src/app/shared/nav-menu/nav-menu-commercial/nav-menu-commercial.component.html
@@ -14,4 +14,5 @@
+
\ No newline at end of file