|
|
|
@ -17,6 +17,7 @@ export class CollaborateurComponent implements OnInit { |
|
|
|
|
businessUnits : Businessunit[] = []; |
|
|
|
|
businessUnit = {} as Businessunit ; |
|
|
|
|
|
|
|
|
|
errorValue : number = 0; |
|
|
|
|
rDate : String = ""; |
|
|
|
|
bDate : String = ""; |
|
|
|
|
|
|
|
|
@ -66,13 +67,6 @@ export class CollaborateurComponent implements OnInit { |
|
|
|
|
.subscribe(businessunits => this.businessUnits = businessunits); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
add(collaborateur: Collaborateur): void { |
|
|
|
|
this.collaborateurService.addCollaborateur(collaborateur) |
|
|
|
|
.subscribe(collaborateur => { |
|
|
|
|
this.collaborateurs.push(collaborateur); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onSubmit() { |
|
|
|
|
this.submitted = true; |
|
|
|
|
|
|
|
|
@ -80,7 +74,16 @@ export class CollaborateurComponent implements OnInit { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.collaborateur = this.registerForm.value |
|
|
|
|
this.add(this.collaborateur) |
|
|
|
|
if (this.collaborateur) { |
|
|
|
|
this.collaborateurService.addCollaborateur(this.collaborateur).subscribe({ |
|
|
|
|
next: () => { |
|
|
|
|
}, |
|
|
|
|
error: () => { |
|
|
|
|
this.errorValue = 1; |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
get f() { return this.registerForm.controls; } |
|
|
|
|