Fix: When adding lock information. After the initial entry, the voucher and account types list were useless.

This commit is contained in:
Amritanshu Agrawal 2023-09-03 10:09:37 +05:30
parent dbc0b85a44
commit 7aeee662c0

View File

@ -104,13 +104,13 @@ export class SettingsComponent implements OnInit {
}; };
this.accountTypes = data.accountTypes; this.accountTypes = data.accountTypes;
this.voucherTypes = data.voucherTypes; this.voucherTypes = data.voucherTypes;
this.initLockAccountVoucherTypes();
this.showLockInformation(data.lockInformation); this.showLockInformation(data.lockInformation);
this.maintenance = data.maintenance; this.maintenance = data.maintenance;
}); });
} }
showLockInformation(info: LockInfo[]) { initLockAccountVoucherTypes() {
this.lockInformation = info;
this.lockInfoForm.controls.accountTypes.clear(); this.lockInfoForm.controls.accountTypes.clear();
this.accountTypes.forEach(() => this.accountTypes.forEach(() =>
this.lockInfoForm.controls.accountTypes.push( this.lockInfoForm.controls.accountTypes.push(
@ -127,6 +127,10 @@ export class SettingsComponent implements OnInit {
}), }),
), ),
); );
}
showLockInformation(info: LockInfo[]) {
this.lockInformation = info;
this.dataSource = new LockDataSource(this.lockObservable); this.dataSource = new LockDataSource(this.lockObservable);
this.lockObservable.next(this.lockInformation); this.lockObservable.next(this.lockInformation);
} }