parent
06d13b43f9
commit
954f1613ef
@ -0,0 +1 @@ |
|||||||
|
<!--ASSIGNATION D'UN OU PLUSIEURS COLLABORATEURS A UN REFERENT--> |
@ -0,0 +1,8 @@ |
|||||||
|
<!--ASSIGNATION D'UN REFERENT A UN COLLABORATEUR--> |
||||||
|
<ng-container *ngIf="referentChoisi != undefined"> |
||||||
|
<p> {{referentChoisi.nom}} {{referentChoisi.prenom}} {{ estReferentActuel() ? "(Référent actuel)" : "" }} </p> |
||||||
|
<button mat-raised-button color="primary" *ngIf="!estReferentActuel()" (click)="mettreAJourReferent()">Valider le changement du référent</button> |
||||||
|
</ng-container> |
||||||
|
<p *ngIf="referentChoisi == undefined"> Veuillez choisir un référent </p> |
||||||
|
<button mat-raised-button color="primary" (click)="annuler()">Annuler</button> |
||||||
|
<collaborateurs-table [rechercherParBU]="rechercherParBU" [roles]="roles" [displayedColumns]="displayedColumns" [typeRecherche]="typeRecherche" (eventEmitter)="selectionnerReferent($event)"></collaborateurs-table> |
@ -0,0 +1,66 @@ |
|||||||
|
import {Component, Inject } from "@angular/core"; |
||||||
|
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; |
||||||
|
import { CollaborateurDTO, ReferentEPDTO, ReferentsEPService } from "@shared/api-swagger"; |
||||||
|
import { collaborateurTypeRecherche, } from "@shared/utils/cles"; |
||||||
|
import { DialogAssignationReferentComponent } from "app/referents/assignation-referent/assignation-referent.component"; |
||||||
|
import { Subscription } from "rxjs"; |
||||||
|
|
||||||
|
@Component({ |
||||||
|
selector: "dialog-assignation-rapide-referent", |
||||||
|
templateUrl: "dialog-assignation-rapide-referent.html" |
||||||
|
}) |
||||||
|
export class DialogAssignationRapideReferentComponent { |
||||||
|
|
||||||
|
rechercherParDate: boolean = false; |
||||||
|
|
||||||
|
rechercherParBU: boolean = true; |
||||||
|
|
||||||
|
referentChoisi : CollaborateurDTO = undefined; |
||||||
|
|
||||||
|
roles : string[] = ["Manager", "RA", "CP", "TL"]; |
||||||
|
|
||||||
|
|
||||||
|
typeRecherche: string = collaborateurTypeRecherche.referents; |
||||||
|
|
||||||
|
displayedColumns : string[] = ["businessunit", "collaborateur"]; |
||||||
|
|
||||||
|
private referentEPSubscription: Subscription; |
||||||
|
|
||||||
|
constructor(private dialogRef: MatDialogRef<DialogAssignationReferentComponent>, private referentsEPService: ReferentsEPService, |
||||||
|
@Inject(MAT_DIALOG_DATA) private data: CollaborateurDTO) { |
||||||
|
this.referentChoisi = data.referent; |
||||||
|
} |
||||||
|
|
||||||
|
selectionnerReferent(event) { |
||||||
|
this.referentChoisi = event.collaborateur; |
||||||
|
} |
||||||
|
|
||||||
|
mettreAJourReferent() { |
||||||
|
const referentEPDTO: ReferentEPDTO = { |
||||||
|
idReferent : this.referentChoisi.id, |
||||||
|
idsCollaborateur : [this.data.id], |
||||||
|
}; |
||||||
|
|
||||||
|
this.referentEPSubscription = this.referentsEPService.updateReferentCollaborateur(referentEPDTO, this.data.id).subscribe( |
||||||
|
() => location.reload(), |
||||||
|
err => console.log(err) |
||||||
|
); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
estReferentActuel() { |
||||||
|
return this.referentChoisi != undefined && this.data.referent != undefined &&this.referentChoisi.id == this.data.referent.id; |
||||||
|
} |
||||||
|
|
||||||
|
annuler() { |
||||||
|
this.dialogRef.close(); |
||||||
|
} |
||||||
|
|
||||||
|
onDestroy() { |
||||||
|
if(this.referentEPSubscription != undefined) { |
||||||
|
this.referentEPSubscription.unsubscribe(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue