Moving to strict.
Create form has now moved to constructor and route data subscribe is type safe.
This commit is contained in:
@ -60,14 +60,26 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
private batchSer: BatchService,
|
||||
private issueGridSer: IssueGridService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
source: '',
|
||||
destination: '',
|
||||
amount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
this.listenToBatchAutocompleteChange();
|
||||
this.listenToDateChange();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.gridDataSource = new IssueGridDataSource(this.gridObservable);
|
||||
this.route.data.subscribe((data: { voucher: Voucher; costCentres: CostCentre[] }) => {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { voucher: Voucher; costCentres: CostCentre[] };
|
||||
|
||||
this.costCentres = data.costCentres;
|
||||
this.loadVoucher(data.voucher);
|
||||
});
|
||||
@ -219,20 +231,6 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
createForm() {
|
||||
this.form = this.fb.group({
|
||||
date: '',
|
||||
source: '',
|
||||
destination: '',
|
||||
amount: { value: '', disabled: true },
|
||||
addRow: this.fb.group({
|
||||
batch: '',
|
||||
quantity: '',
|
||||
}),
|
||||
narration: '',
|
||||
});
|
||||
}
|
||||
|
||||
canSave() {
|
||||
if (!this.voucher.id) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user