diff --git a/src/app/notes/notes.component.html b/src/app/notes/notes.component.html index bc6b716..712194f 100644 --- a/src/app/notes/notes.component.html +++ b/src/app/notes/notes.component.html @@ -1 +1,2 @@ +

Liste de vos notes

\ No newline at end of file diff --git a/src/app/notes/notes.component.ts b/src/app/notes/notes.component.ts index 5bbcd31..3b9a69c 100644 --- a/src/app/notes/notes.component.ts +++ b/src/app/notes/notes.component.ts @@ -1,17 +1,52 @@ import { Component, OnInit } from "@angular/core"; -import { NotesService } from "@shared/api-swagger"; +import { CollaborateurDTO, NotesService } from "@shared/api-swagger"; +import { cles } from "@shared/utils/cles"; +import { Subscription } from "rxjs"; @Component({ selector: "app-notes", templateUrl: "./notes.component.html" }) export class NotesComponent implements OnInit { - - - + + asc: boolean = true; + + numPage: number = 1; + + parPage: number= 15; + + texte: string = ""; + + tri: string = ""; + + + notesSubscriber: Subscription; + + id: string; constructor(private notesService: NotesService) { } - ngOnInit() {} + ngOnInit() { + this.recupererId(); + } + + recupererId() { + if(sessionStorage.getItem(cles.sessionKeyConnectee) == undefined){ + setTimeout( () => this.recupererId(), 1000); + } + else { + const collaborateurConnecte : CollaborateurDTO = JSON.parse(sessionStorage.getItem(cles.sessionKeyConnectee)); + this.id = collaborateurConnecte.id; + this.updateDataSource(); + } + } + + updateDataSource() { + this.notesSubscriber = this.notesService.getNotesAuteur(this.id, this.asc, this.numPage, this.parPage, this.texte, this.tri).subscribe( + notes => { console.log(notes)}, + err => console.log(err) + ); + } + } \ 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 3ce4ddc..07cfa39 100644 --- a/src/app/notes/notes.routing.module.ts +++ b/src/app/notes/notes.routing.module.ts @@ -9,7 +9,7 @@ import { AuthGuard } from "@shared/auth/auth.guard"; import { paths_notes } from "@shared/utils/paths"; const routes: Routes = [ - {path: paths_notes.notesAuteur, component: NotesComponent, canActivate: [AuthGuard]}, + {path: "", component: NotesComponent, canActivate: [AuthGuard]}, ] diff --git a/src/app/shared/api-swagger/api/notes.service.ts b/src/app/shared/api-swagger/api/notes.service.ts index 8ddbaf4..71b798e 100644 --- a/src/app/shared/api-swagger/api/notes.service.ts +++ b/src/app/shared/api-swagger/api/notes.service.ts @@ -272,7 +272,7 @@ export class NotesService { const consumes: string[] = [ ]; - return this.httpClient.request>('get',`${this.basePath}/notes/${encodeURIComponent(String(idAuteur))}`, + return this.httpClient.request>('get',`${this.basePath}/notes/auteur/${encodeURIComponent(String(idAuteur))}`, { params: queryParameters, withCredentials: this.configuration.withCredentials, 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 527ddd8..822a3c7 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 @@ -6,5 +6,12 @@ - + + + + + \ No newline at end of file diff --git a/src/app/shared/utils/paths.ts b/src/app/shared/utils/paths.ts index c8927b2..039c14e 100644 --- a/src/app/shared/utils/paths.ts +++ b/src/app/shared/utils/paths.ts @@ -104,7 +104,6 @@ const paths_engagements = { const paths_notes = { base: "/notes", path: "notes", - notesAuteur: "auteur/:id", ajoutNote: "nouvellenote", get: ":id", edit: ":id/edit"