Chore: Upgrade to Angular v14

This commit is contained in:
2022-07-11 20:12:38 +05:30
parent a4c3ae1035
commit b1c003a935
54 changed files with 355 additions and 325 deletions
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { UntypedFormBuilder, UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { MatDatepicker } from '@angular/material/datepicker';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
@@ -17,15 +17,15 @@ import { EmployeeFunctionsService } from './employee-functions.service';
styleUrls: ['./employee-functions.component.css'],
})
export class EmployeeFunctionsComponent {
creditSalaryForm: FormGroup;
attendanceRecordForm: FormGroup;
fingerprintForm: FormGroup;
creditSalaryForm: UntypedFormGroup;
attendanceRecordForm: UntypedFormGroup;
fingerprintForm: UntypedFormGroup;
fingerprintFile: File | null = null;
constructor(
private route: ActivatedRoute,
private router: Router,
private fb: FormBuilder,
private fb: UntypedFormBuilder,
private dialog: MatDialog,
private toaster: ToasterService,
private auth: AuthService,
@@ -44,7 +44,7 @@ export class EmployeeFunctionsComponent {
}
chosenYearHandler(normalizedYear: Moment) {
const dateControl = this.creditSalaryForm.get('date') as FormControl;
const dateControl = this.creditSalaryForm.get('date') as UntypedFormControl;
const ctrlValue = dateControl.value;
ctrlValue.year(normalizedYear.year());
ctrlValue.date(ctrlValue.daysInMonth());
@@ -52,7 +52,7 @@ export class EmployeeFunctionsComponent {
}
chosenMonthHandler(normlizedMonth: Moment, datepicker: MatDatepicker<Moment>) {
const dateControl = this.creditSalaryForm.get('date') as FormControl;
const dateControl = this.creditSalaryForm.get('date') as UntypedFormControl;
const ctrlValue = dateControl.value;
ctrlValue.month(normlizedMonth.month());
ctrlValue.date(ctrlValue.daysInMonth());
@@ -61,7 +61,7 @@ export class EmployeeFunctionsComponent {
}
creditSalary() {
const date = moment((this.creditSalaryForm.get('date') as FormControl).value).format(
const date = moment((this.creditSalaryForm.get('date') as UntypedFormControl).value).format(
'DD-MMM-YYYY',
);
if (!date) {
@@ -80,10 +80,10 @@ export class EmployeeFunctionsComponent {
attendanceRecordUrl() {
const startDate = moment(
(this.attendanceRecordForm.get('startDate') as FormControl).value,
(this.attendanceRecordForm.get('startDate') as UntypedFormControl).value,
).format('DD-MMM-YYYY');
const finishDate = moment(
(this.attendanceRecordForm.get('finishDate') as FormControl).value,
(this.attendanceRecordForm.get('finishDate') as UntypedFormControl).value,
).format('DD-MMM-YYYY');
if (!startDate || !finishDate) {
// this.toaster.show('Danger', 'Please choose a start and finish date.');
@@ -94,10 +94,10 @@ export class EmployeeFunctionsComponent {
fingerPrintUrl() {
const startDate = moment(
(this.attendanceRecordForm.get('startDate') as FormControl).value,
(this.attendanceRecordForm.get('startDate') as UntypedFormControl).value,
).format('DD-MMM-YYYY');
const finishDate = moment(
(this.attendanceRecordForm.get('finishDate') as FormControl).value,
(this.attendanceRecordForm.get('finishDate') as UntypedFormControl).value,
).format('DD-MMM-YYYY');
if (!startDate || !finishDate) {
// this.toaster.show('Danger', 'Please choose a start and finish date.');