Moving to strict.
Create form has now moved to constructor and route data subscribe is type safe.
This commit is contained in:
1 parent
30b1a3ef7d
commit
39e3cc51bb
52 files changed
+348
-448
No files matched your search
@@ -45,38 +45,6 @@ export class SettingsComponent implements OnInit {
|
||||
private ser: SettingsService,
|
||||
private productSer: ProductService,
|
||||
) {
|
||||
this.createForm();
|
||||
this.listenToLockForm();
|
||||
this.lockInformation = {
|
||||
lockOlder: false,
|
||||
olderRolling: false,
|
||||
lockNewer: false,
|
||||
newerRolling: false,
|
||||
};
|
||||
this.listenToProductChanges();
|
||||
|
||||
this.maintenance = { enabled: false, user: '' };
|
||||
this.version = environment.version;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((data: { maintenance: any; lockInformation: any }) => {
|
||||
this.maintenance = data.maintenance;
|
||||
this.lockInformation = data.lockInformation;
|
||||
this.lockDatesForm.patchValue({
|
||||
lockOlder: this.lockInformation.lockOlder,
|
||||
olderRolling: this.lockInformation.olderRolling,
|
||||
olderDate: this.lockInformation.olderDate,
|
||||
olderDays: this.lockInformation.olderDays,
|
||||
lockNewer: this.lockInformation.lockNewer,
|
||||
newerRolling: this.lockInformation.newerRolling,
|
||||
newerDate: this.lockInformation.newerDate,
|
||||
newerDays: this.lockInformation.newerDays,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
createForm() {
|
||||
const startDate = moment().date(1);
|
||||
const finishDate = moment().date(startDate.daysInMonth());
|
||||
this.lockDatesForm = this.fb.group({
|
||||
@@ -100,6 +68,36 @@ export class SettingsComponent implements OnInit {
|
||||
product: null,
|
||||
quantity: 0,
|
||||
});
|
||||
this.listenToLockForm();
|
||||
this.lockInformation = {
|
||||
lockOlder: false,
|
||||
olderRolling: false,
|
||||
lockNewer: false,
|
||||
newerRolling: false,
|
||||
};
|
||||
this.listenToProductChanges();
|
||||
|
||||
this.maintenance = { enabled: false, user: '' };
|
||||
this.version = environment.version;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data.subscribe((value) => {
|
||||
const data = value as { maintenance: any; lockInformation: any };
|
||||
|
||||
this.maintenance = data.maintenance;
|
||||
this.lockInformation = data.lockInformation;
|
||||
this.lockDatesForm.patchValue({
|
||||
lockOlder: this.lockInformation.lockOlder,
|
||||
olderRolling: this.lockInformation.olderRolling,
|
||||
olderDate: this.lockInformation.olderDate,
|
||||
olderDays: this.lockInformation.olderDays,
|
||||
lockNewer: this.lockInformation.lockNewer,
|
||||
newerRolling: this.lockInformation.newerRolling,
|
||||
newerDate: this.lockInformation.newerDate,
|
||||
newerDays: this.lockInformation.newerDays,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
listenToLockForm() {
|
||||
|
||||
Reference in new issue
Block a user