Chore:
Upgraded to Angular 14
This commit is contained in:
@ -1,5 +1,10 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
import { AbstractControl, FormArray, FormBuilder, FormGroup } from '@angular/forms';
|
||||
import {
|
||||
AbstractControl,
|
||||
UntypedFormArray,
|
||||
UntypedFormBuilder,
|
||||
UntypedFormGroup,
|
||||
} from '@angular/forms';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { round } from 'mathjs';
|
||||
@ -16,14 +21,14 @@ import { CustomerService } from '../customer.service';
|
||||
})
|
||||
export class CustomerDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
form: FormGroup;
|
||||
form: UntypedFormGroup;
|
||||
item: Customer = new Customer();
|
||||
hide: boolean;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private fb: FormBuilder,
|
||||
private fb: UntypedFormBuilder,
|
||||
private toaster: ToasterService,
|
||||
private dialog: MatDialog,
|
||||
private ser: CustomerService,
|
||||
@ -115,7 +120,7 @@ export class CustomerDetailComponent implements OnInit, AfterViewInit {
|
||||
this.item.phone = formModel.phone;
|
||||
this.item.address = formModel.address;
|
||||
this.item.printInBill = formModel.printInBill;
|
||||
const array = this.form.get('discounts') as FormArray;
|
||||
const array = this.form.get('discounts') as UntypedFormArray;
|
||||
this.item.discounts.forEach((item, index) => {
|
||||
item.discount = Math.max(
|
||||
Math.min(round(array.controls[index].value.discount / 100, 5), 100),
|
||||
|
||||
Reference in New Issue
Block a user