|
|
|
@ -1,9 +1,9 @@ |
|
|
|
|
import { Component, OnInit } from "@angular/core"; |
|
|
|
|
import { Component, Inject, OnInit } from "@angular/core"; |
|
|
|
|
import { FormBuilder } from "@angular/forms"; |
|
|
|
|
import { MatDialog } from "@angular/material/dialog"; |
|
|
|
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog"; |
|
|
|
|
import { Router } from "@angular/router"; |
|
|
|
|
import { CollaborateurDTO, DetailsNoteDTO, NotesService } from "@shared/api-swagger"; |
|
|
|
|
import { cles } from "@shared/utils/cles"; |
|
|
|
|
import { cles, collaborateurTypeRecherche } from "@shared/utils/cles"; |
|
|
|
|
import { Subscription } from "rxjs"; |
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@ -13,7 +13,9 @@ import { Subscription } from "rxjs"; |
|
|
|
|
export class NouvelleNoteComponent { |
|
|
|
|
|
|
|
|
|
noteSubscription: Subscription; |
|
|
|
|
|
|
|
|
|
dialogSubscription: Subscription; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
collaborateurChoisi: CollaborateurDTO; |
|
|
|
|
|
|
|
|
|
noteForm = this.fb.group( |
|
|
|
@ -29,7 +31,6 @@ export class NouvelleNoteComponent { |
|
|
|
|
private dialog: MatDialog) {} |
|
|
|
|
|
|
|
|
|
ajouterNote() { |
|
|
|
|
console.log("ui"); |
|
|
|
|
if(this.collaborateurChoisi == undefined) |
|
|
|
|
return; |
|
|
|
|
const today : Date = new Date(); |
|
|
|
@ -38,7 +39,6 @@ export class NouvelleNoteComponent { |
|
|
|
|
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); |
|
|
|
@ -49,7 +49,12 @@ export class NouvelleNoteComponent { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
choixCollaborateur() { |
|
|
|
|
console.log("pas ui"); |
|
|
|
|
const datas = { data: this.collaborateurChoisi, width: "80%", height: '80%'}; |
|
|
|
|
const dialogRef = this.dialog.open(DialogChoixCollaborateurNoteComponent, datas); |
|
|
|
|
|
|
|
|
|
this.dialogSubscription = dialogRef.afterClosed().subscribe( |
|
|
|
|
collaborateur => this.collaborateurChoisi = collaborateur |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnDestroy() { |
|
|
|
@ -65,5 +70,33 @@ export class NouvelleNoteComponent { |
|
|
|
|
templateUrl: "./dialog-choix-collaborateur-note.html" |
|
|
|
|
}) |
|
|
|
|
export class DialogChoixCollaborateurNoteComponent { |
|
|
|
|
typeRecherche: string = collaborateurTypeRecherche.collaborateurs; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rechercherParDate: boolean = false; |
|
|
|
|
|
|
|
|
|
roles : string[] = ["Collaborateur"]; |
|
|
|
|
|
|
|
|
|
displayedColumns: string[] = ["businessunit", "collaborateur"]; |
|
|
|
|
|
|
|
|
|
collaborateurChoisi: CollaborateurDTO; |
|
|
|
|
|
|
|
|
|
constructor(private dialogRef: MatDialogRef<DialogChoixCollaborateurNoteComponent>, @Inject(MAT_DIALOG_DATA) private data: CollaborateurDTO) { |
|
|
|
|
this.collaborateurChoisi = this.data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fermer() { |
|
|
|
|
this.dialogRef.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
enregistrerChoix() { |
|
|
|
|
if(this.collaborateurChoisi != undefined) { |
|
|
|
|
this.dialogRef.close(this.collaborateurChoisi); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
choisirCollaborateur(event : any) { |
|
|
|
|
this.collaborateurChoisi = event.collaborateur; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |