Moving to strict.
Create form has now moved to constructor and route data subscribe is type safe.
This commit is contained in:
@@ -60,13 +60,25 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private accountSer: AccountService,
|
||||
) {
|
||||
this.account = null;
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
paymentAccount: '',
|
||||
paymentAmount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
this.listenToAccountAutocompleteChange();
|
||||
this.listenToPaymentAccountChange();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { voucher: Voucher; paymentAccounts: Account[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher; paymentAccounts: Account[] };
|
||||
|
||||
this.paymentAccounts = data.paymentAccounts;
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
@@ -218,20 +230,6 @@ export class PaymentComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
paymentAccount: '',
|
||||
paymentAmount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
account: '',
|
||||
amount: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.accBal = null;
|
||||
}
|
||||
|
||||
canSave() {
|
||||
if (!this.voucher.id) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user