Chore: Moved from Untyped to Stongly Typed forms.

This commit is contained in:
2022-07-15 13:24:25 +05:30
parent facf2df91e
commit 28f9bf2180
78 changed files with 1091 additions and 1004 deletions
@@ -1,5 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { FormControl, FormGroup } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { ActivatedRoute, Router } from '@angular/router';
@@ -20,7 +20,11 @@ export class RawMaterialCostComponent implements OnInit {
@ViewChild(MatSort, { static: true }) sort?: MatSort;
info: RawMaterialCost = new RawMaterialCost();
dataSource: RawMaterialCostDataSource = new RawMaterialCostDataSource(this.info.body);
form: UntypedFormGroup;
form: FormGroup<{
startDate: FormControl<Date>;
finishDate: FormControl<Date>;
}>;
debitQuantity = 0;
debitAmount = 0;
creditQuantity = 0;
@@ -32,15 +36,10 @@ export class RawMaterialCostComponent implements OnInit {
columnsNoId = ['name', 'issue', 'sale', 'rmc'];
columnsId = ['name', 'group', 'quantity', 'net', 'gross'];
constructor(
private route: ActivatedRoute,
private router: Router,
private fb: UntypedFormBuilder,
private toCsv: ToCsvService,
) {
this.form = this.fb.group({
startDate: '',
finishDate: '',
constructor(private route: ActivatedRoute, private router: Router, private toCsv: ToCsvService) {
this.form = new FormGroup({
startDate: new FormControl(new Date(), { nonNullable: true }),
finishDate: new FormControl(new Date(), { nonNullable: true }),
});
}