Tag: v7.0.2

Fix: Attendance Type and Account Type objects were borking as their convenience methods were not returning anything
Fix: Employee Benefits and Incentive post voucher did not reload the page
Fix: For all vouchers, to prevent double data loading on save / update either reload data or navigate, don't reload data and then navigate so that the data appears once and then disappears
This commit is contained in:
tanshu committed 2020-06-02 08:35:36 +05:30
1 parent b7a1c5b816
commit 6ccb3634be
11 files changed
+99 -63

No files matched your search

@@ -52,17 +52,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
ngOnInit() {
this.route.data
.subscribe((data: { voucher: Voucher }) => {
this.voucher = data.voucher;
this.form.setValue({
date: moment(this.voucher.date, 'DD-MMM-YYYY').toDate(),
addRow: {
employee: '1',
grossSalary: '',
daysWorked: ''
}
});
this.dataSource = new EmployeeBenefitsDataSource(this.benefitsObservable);
this.benefitsObservable.next(this.voucher.employeeBenefits);
this.loadVoucher(data.voucher);
});
}
@@ -72,6 +62,20 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
}, 0);
}
loadVoucher(voucher) {
this.voucher = voucher;
this.form.setValue({
date: moment(this.voucher.date, 'DD-MMM-YYYY').toDate(),
addRow: {
employee: '1',
grossSalary: '',
daysWorked: ''
}
});
this.dataSource = new EmployeeBenefitsDataSource(this.benefitsObservable);
this.benefitsObservable.next(this.voucher.employeeBenefits);
}
createForm() {
this.form = this.fb.group({
date: '',
@@ -181,6 +185,7 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
this.ser.post(this.voucher.id)
.subscribe(
(result) => {
this.loadVoucher(result);
this.toaster.show('Success', 'Voucher Posted');
},
(error) => {
@@ -190,11 +195,16 @@ export class EmployeeBenefitsComponent implements OnInit, AfterViewInit {
}
save() {
this.ser.saveOrUpdate(this.getVoucher())
const voucher: Voucher = this.getVoucher();
this.ser.saveOrUpdate(voucher)
.subscribe(
(result) => {
this.toaster.show('Success', '');
if (voucher.id === result.id) {
this.loadVoucher(result);
} else {
this.router.navigate(['/employee-benefits', result.id]);
}
},
(error) => {
this.toaster.show('Danger', error);