|
|
@ -8,6 +8,7 @@ import {Observable} from "rxjs"; |
|
|
|
import {ActivatedRoute} from "@angular/router"; |
|
|
|
import {ActivatedRoute} from "@angular/router"; |
|
|
|
import {take, tap} from "rxjs/operators"; |
|
|
|
import {take, tap} from "rxjs/operators"; |
|
|
|
import {Location} from "@angular/common"; |
|
|
|
import {Location} from "@angular/common"; |
|
|
|
|
|
|
|
import {ToastrService} from "ngx-toastr"; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-periode-essai-edit', |
|
|
|
selector: 'app-periode-essai-edit', |
|
|
@ -37,7 +38,8 @@ export class PeriodeEssaiEditComponent implements OnInit { |
|
|
|
private location: Location, |
|
|
|
private location: Location, |
|
|
|
private collaborateurService: CollaborateurService, |
|
|
|
private collaborateurService: CollaborateurService, |
|
|
|
private periodeEssaiService: PeriodeEssaiService, |
|
|
|
private periodeEssaiService: PeriodeEssaiService, |
|
|
|
private formBuilder: FormBuilder |
|
|
|
private formBuilder: FormBuilder, |
|
|
|
|
|
|
|
private toastr: ToastrService |
|
|
|
) { |
|
|
|
) { |
|
|
|
this.id = Number(this.route.snapshot.paramMap.get('id')) |
|
|
|
this.id = Number(this.route.snapshot.paramMap.get('id')) |
|
|
|
} |
|
|
|
} |
|
|
@ -96,7 +98,13 @@ export class PeriodeEssaiEditComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
if (this.periodeEssai){ |
|
|
|
if (this.periodeEssai){ |
|
|
|
this.periodeEssaiService.updatePeriodeEssai(this.periodeEssai) |
|
|
|
this.periodeEssaiService.updatePeriodeEssai(this.periodeEssai) |
|
|
|
.subscribe(()=>this.goBack()); |
|
|
|
.subscribe(() => { |
|
|
|
|
|
|
|
this.showSuccess(); |
|
|
|
|
|
|
|
this.goBack(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
this.showError() |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -119,6 +127,14 @@ export class PeriodeEssaiEditComponent implements OnInit { |
|
|
|
this.periodeEssai.realEndingDate = new Date($event.target.value); |
|
|
|
this.periodeEssai.realEndingDate = new Date($event.target.value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showSuccess() { |
|
|
|
|
|
|
|
this.toastr.success('Modification réussie', 'Période d\'essai'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showError() { |
|
|
|
|
|
|
|
this.toastr.error('Modification échouée', 'Collaborateur'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|