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:
2020-06-02 08:35:36 +05:30
parent b7a1c5b816
commit 6ccb3634be
11 changed files with 99 additions and 63 deletions

View File

@ -17,7 +17,7 @@ import {ToasterService} from '../core/toaster.service';
import {debounceTime, distinctUntilChanged, map, startWith, switchMap} from 'rxjs/operators';
import {ReceiptDialogComponent} from './receipt-dialog.component';
import {ImageDialogComponent} from '../shared/image-dialog/image-dialog.component';
import {Hotkey, HotkeysService} from "angular2-hotkeys";
import {Hotkey, HotkeysService} from 'angular2-hotkeys';
@Component({
selector: 'app-receipt',
@ -70,13 +70,15 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
return false; // Prevent bubbling
}, ['INPUT', 'SELECT', 'TEXTAREA']));
this.hotkeys.add(new Hotkey('ctrl+s', (event: KeyboardEvent): boolean => {
if (this.canSave())
if (this.canSave()) {
this.save();
}
return false; // Prevent bubbling
}, ['INPUT', 'SELECT', 'TEXTAREA']));
this.hotkeys.add(new Hotkey('ctrl+p', (event: KeyboardEvent): boolean => {
if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('post-vouchers') !== -1)
if (this.voucher.id && !this.voucher.posted && this.auth.user.perms.indexOf('post-vouchers') !== -1) {
this.post();
}
return false; // Prevent bubbling
}, ['INPUT', 'SELECT', 'TEXTAREA']));
}
@ -228,12 +230,16 @@ export class ReceiptComponent implements OnInit, AfterViewInit, OnDestroy {
}
save() {
this.ser.saveOrUpdate(this.getVoucher())
const voucher: Voucher = this.getVoucher();
this.ser.saveOrUpdate(voucher)
.subscribe(
(result) => {
this.loadVoucher(result);
this.toaster.show('Success', '');
if (voucher.id === result.id) {
this.loadVoucher(result);
} else {
this.router.navigate(['/receipt', result.id]);
}
},
(error) => {
this.toaster.show('Danger', error);