Upgrade/angular 14 (#1853)
* Fix Loan product Payment Allocation * Upgrade to Angular 14 --------- Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
2dab3b70ca
commit
80936a3ea9
@@ -1,6 +1,6 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormArray } from '@angular/forms';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormArray } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
@@ -28,7 +28,7 @@ export class MigrateOpeningBalancesComponent implements OnInit, AfterViewInit {
|
||||
/** Maximum opening balances date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Opening balances form. */
|
||||
openingBalancesForm: FormGroup;
|
||||
openingBalancesForm: UntypedFormGroup;
|
||||
/** Opening balances data. */
|
||||
openingBalancesData: any;
|
||||
/** Office data. */
|
||||
@@ -55,7 +55,7 @@ export class MigrateOpeningBalancesComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
@@ -97,7 +97,7 @@ export class MigrateOpeningBalancesComponent implements OnInit, AfterViewInit {
|
||||
* @param glAccount GL Account for which form is returned.
|
||||
* @returns {FormGroup} GL Account entry form.
|
||||
*/
|
||||
createGLAccountEntryForm(glAccount: any): FormGroup {
|
||||
createGLAccountEntryForm(glAccount: any): UntypedFormGroup {
|
||||
return this.formBuilder.group({
|
||||
'glAccountId': [glAccount.glAccountId],
|
||||
'debit': [null],
|
||||
@@ -109,8 +109,8 @@ export class MigrateOpeningBalancesComponent implements OnInit, AfterViewInit {
|
||||
* Gets the gl account entries form array.
|
||||
* @returns {FormArray} GL Account entries form array.
|
||||
*/
|
||||
get glAccountEntries(): FormArray {
|
||||
return this.openingBalancesForm.get('glAccountEntries') as FormArray;
|
||||
get glAccountEntries(): UntypedFormArray {
|
||||
return this.openingBalancesForm.get('glAccountEntries') as UntypedFormArray;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,7 @@ export class MigrateOpeningBalancesComponent implements OnInit, AfterViewInit {
|
||||
retrieveOpeningBalances() {
|
||||
this.accountingService.retrieveOpeningBalances(this.openingBalancesForm.value.officeId)
|
||||
.subscribe((openingBalancesData: any) => {
|
||||
const entry = this.openingBalancesForm.get('glAccountEntries') as FormArray;
|
||||
const entry = this.openingBalancesForm.get('glAccountEntries') as UntypedFormArray;
|
||||
|
||||
openingBalancesData.glAccounts = openingBalancesData.assetAccountOpeningBalances
|
||||
.concat(openingBalancesData.liabityAccountOpeningBalances,
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { FormGroup, ValidatorFn, ValidationErrors } from '@angular/forms';
|
||||
import { UntypedFormGroup, ValidatorFn, ValidationErrors } from '@angular/forms';
|
||||
|
||||
/** Validates that atleast one of the fields debit or credit is filled (but not both) for a given gl account. */
|
||||
export const onlyOneOfTheFieldsIsRequiredValidator: ValidatorFn = (glAccountEntriesForm: FormGroup): ValidationErrors | null => {
|
||||
export const onlyOneOfTheFieldsIsRequiredValidator: ValidatorFn = (glAccountEntriesForm: UntypedFormGroup): ValidationErrors | null => {
|
||||
const debit = glAccountEntriesForm.controls.debit.value;
|
||||
const credit = glAccountEntriesForm.controls.credit.value;
|
||||
return ((debit || credit) && !(debit && credit)) ? null : { 'error': true };
|
||||
|
||||
Reference in New Issue
Block a user