Client datatables to be shown on the Client creation page based on legal form

This commit is contained in:
Jose Alberto Hernandez
2022-11-14 20:38:31 -06:00
parent 0cdf6bad3c
commit e991c8a881
3 changed files with 29 additions and 4 deletions
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, OnInit, Input } from '@angular/core';
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { Dates } from 'app/core/utils/dates';
@@ -16,6 +16,8 @@ import { SettingsService } from 'app/settings/settings.service';
})
export class ClientGeneralStepComponent implements OnInit {
@Output() legalFormChangeEvent = new EventEmitter<{ legalForm: number }>();
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
@@ -104,7 +106,8 @@ export class ClientGeneralStepComponent implements OnInit {
* Adds controls conditionally.
*/
buildDependencies() {
this.createClientForm.get('legalFormId').valueChanges.subscribe((legalFormId: any) => {
this.createClientForm.get('legalFormId').valueChanges.subscribe((legalFormId: number) => {
this.legalFormChangeEvent.emit({ legalForm: legalFormId });
if (legalFormId === 1) {
this.createClientForm.removeControl('fullname');
this.createClientForm.removeControl('clientNonPersonDetails');