|
|
@ -1,5 +1,7 @@ |
|
|
|
import { Component, OnInit } from "@angular/core"; |
|
|
|
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({ |
|
|
|
@Component({ |
|
|
|
selector: "app-notes", |
|
|
|
selector: "app-notes", |
|
|
@ -7,11 +9,44 @@ import { NotesService } from "@shared/api-swagger"; |
|
|
|
}) |
|
|
|
}) |
|
|
|
export class NotesComponent implements OnInit { |
|
|
|
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) { |
|
|
|
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) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |