Chore: Upgrade to Angular v14
This commit is contained in:
1 parent
a4c3ae1035
commit
b1c003a935
54 files changed
+355
-325
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { UntypedFormArray, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import * as moment from 'moment';
|
||||
@@ -27,14 +27,14 @@ export class SettingsComponent implements OnInit {
|
||||
accountTypes: AccountType[] = [];
|
||||
voucherTypes: AccountType[] = [];
|
||||
|
||||
lockInfoForm: FormGroup;
|
||||
lockInfoForm: UntypedFormGroup;
|
||||
lockInformation: LockInfo[];
|
||||
lockOlder: boolean = false;
|
||||
olderRolling: boolean = false;
|
||||
lockNewer: boolean = false;
|
||||
newerRolling: boolean = false;
|
||||
|
||||
rebaseDataForm: FormGroup;
|
||||
rebaseDataForm: UntypedFormGroup;
|
||||
|
||||
maintenance: { enabled: boolean; user: string };
|
||||
|
||||
@@ -45,7 +45,7 @@ export class SettingsComponent implements OnInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private dialog: MatDialog,
|
||||
private toaster: ToasterService,
|
||||
public auth: AuthService,
|
||||
@@ -120,16 +120,16 @@ export class SettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
listenToLockForm() {
|
||||
(this.lockInfoForm.get('lockOlder') as FormControl).valueChanges.subscribe((x) => {
|
||||
(this.lockInfoForm.get('lockOlder') as UntypedFormControl).valueChanges.subscribe((x) => {
|
||||
this.lockOlder = x;
|
||||
});
|
||||
(this.lockInfoForm.get('lockNewer') as FormControl).valueChanges.subscribe((x) => {
|
||||
(this.lockInfoForm.get('lockNewer') as UntypedFormControl).valueChanges.subscribe((x) => {
|
||||
this.lockNewer = x;
|
||||
});
|
||||
(this.lockInfoForm.get('olderRolling') as FormControl).valueChanges.subscribe((x) => {
|
||||
(this.lockInfoForm.get('olderRolling') as UntypedFormControl).valueChanges.subscribe((x) => {
|
||||
this.olderRolling = x;
|
||||
});
|
||||
(this.lockInfoForm.get('newerRolling') as FormControl).valueChanges.subscribe((x) => {
|
||||
(this.lockInfoForm.get('newerRolling') as UntypedFormControl).valueChanges.subscribe((x) => {
|
||||
this.newerRolling = x;
|
||||
});
|
||||
}
|
||||
@@ -137,44 +137,44 @@ export class SettingsComponent implements OnInit {
|
||||
saveLock() {
|
||||
const item = new LockInfo();
|
||||
if (this.lockOlder && this.olderRolling) {
|
||||
item.start.days = +(this.lockInfoForm.get('olderDays') as FormControl).value;
|
||||
item.start.days = +(this.lockInfoForm.get('olderDays') as UntypedFormControl).value;
|
||||
} else if (this.lockOlder && !this.olderRolling) {
|
||||
item.start.date = moment((this.lockInfoForm.get('olderDate') as FormControl).value).format(
|
||||
item.start.date = moment((this.lockInfoForm.get('olderDate') as UntypedFormControl).value).format(
|
||||
'DD-MMM-YYYY',
|
||||
);
|
||||
}
|
||||
if (this.lockNewer && this.newerRolling) {
|
||||
item.finish.days = +(this.lockInfoForm.get('newerDays') as FormControl).value;
|
||||
item.finish.days = +(this.lockInfoForm.get('newerDays') as UntypedFormControl).value;
|
||||
}
|
||||
if (this.lockNewer && !this.newerRolling) {
|
||||
item.finish.date = moment((this.lockInfoForm.get('newerDate') as FormControl).value).format(
|
||||
item.finish.date = moment((this.lockInfoForm.get('newerDate') as UntypedFormControl).value).format(
|
||||
'DD-MMM-YYYY',
|
||||
);
|
||||
}
|
||||
const atArray = this.lockInfoForm.get('accountTypes') as FormArray;
|
||||
const atArray = this.lockInfoForm.get('accountTypes') as UntypedFormArray;
|
||||
this.accountTypes.forEach((at, index) => {
|
||||
if (atArray.controls[index].value.accountType) {
|
||||
item.accountTypes.push({ id: at.id, name: at.name });
|
||||
}
|
||||
});
|
||||
|
||||
const vtArray = this.lockInfoForm.get('voucherTypes') as FormArray;
|
||||
const vtArray = this.lockInfoForm.get('voucherTypes') as UntypedFormArray;
|
||||
this.voucherTypes.forEach((vt, index) => {
|
||||
if (vtArray.controls[index].value.voucherType) {
|
||||
item.voucherTypes.push({ id: vt.id, name: vt.name });
|
||||
}
|
||||
});
|
||||
|
||||
const validFrom = (this.lockInfoForm.get('validFrom') as FormControl).value;
|
||||
const validFrom = (this.lockInfoForm.get('validFrom') as UntypedFormControl).value;
|
||||
if (validFrom) {
|
||||
item.validFrom = moment(validFrom).format('DD-MMM-YYYY');
|
||||
}
|
||||
|
||||
const validTill = (this.lockInfoForm.get('validTill') as FormControl).value;
|
||||
const validTill = (this.lockInfoForm.get('validTill') as UntypedFormControl).value;
|
||||
if (validTill) {
|
||||
item.validTill = moment(validTill).format('DD-MMM-YYYY');
|
||||
}
|
||||
item.index = +(this.lockInfoForm.get('index') as FormControl).value;
|
||||
item.index = +(this.lockInfoForm.get('index') as UntypedFormControl).value;
|
||||
|
||||
this.ser.setLockInformation(item).subscribe(
|
||||
(result) => {
|
||||
@@ -194,7 +194,7 @@ export class SettingsComponent implements OnInit {
|
||||
}
|
||||
|
||||
confirmRebase(): void {
|
||||
const rebaseDate = moment((this.rebaseDataForm.get('date') as FormControl).value).format(
|
||||
const rebaseDate = moment((this.rebaseDataForm.get('date') as UntypedFormControl).value).format(
|
||||
'DD-MMM-YYYY',
|
||||
);
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
|
||||
Reference in new issue
Block a user