Skip to content

Commit

Permalink
EMBCESSMOD-5037 - Better Code Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
TimA authored and TimA committed Mar 27, 2024
1 parent abc08f3 commit db5c06a
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 234 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ export class AnimalsComponent implements OnInit, OnDestroy {
showTable = true;
tabUpdateSubscription: Subscription;
tabMetaData: TabModel;
@Output() ValidPetsIndicator : any = new EventEmitter();
@Output() ValidPetsIndicator: any = new EventEmitter();

constructor(
private router: Router,
private dialog: MatDialog,
private stepEssFileService: StepEssFileService,
private customValidation: CustomValidationService,
private formBuilder: UntypedFormBuilder,
private wizardService: WizardService
) {}
) { }

ngOnInit(): void {
// Creates the Animals form
Expand All @@ -53,26 +53,33 @@ export class AnimalsComponent implements OnInit, OnDestroy {
// Adds pets list in case the user has previously inserted data
this.petSource.next(this.animalsForm.get('pets').value);
this.pets = this.animalsForm.get('pets').value;
if(this.animalsForm.get('hasPets').value === 'No' || (this.animalsForm.get('hasPets').value === 'Yes' && this.pets.length > 0)){

if (this.animalsForm.get('hasPets').value === 'No' || (this.animalsForm.get('hasPets').value === 'Yes' && this.pets.length > 0)) {
this.ValidPetsIndicator.emit(true);


}
else
this.ValidPetsIndicator.emit(false);
else
this.ValidPetsIndicator.emit(false);
// Set "update tab status" method, called for any tab navigation
this.tabUpdateSubscription =
this.stepEssFileService.nextTabUpdate.subscribe(() => {
this.updateTabStatus();
});
this.animalsForm.valueChanges.subscribe(() => {
if(this.animalsForm.get('hasPets').value === 'No' || (this.animalsForm.get('hasPets').value === 'Yes' && this.pets.length > 0)){
if (this.animalsForm.get('hasPets').value === 'No' || (this.animalsForm.get('hasPets').value === 'Yes' && this.pets.length > 0)) {
this.ValidPetsIndicator.emit(true);
} else
this.ValidPetsIndicator.emit(false);
})
} else
this.ValidPetsIndicator.emit(false);

})

// Update Value and Validity for pets form if hasPets changes
this.animalsForm.get('hasPets').valueChanges.subscribe(() => {

this.animalsForm.get('pets').updateValueAndValidity();


});

// Updates the validations for the PetFormGroup
Expand Down
Loading

0 comments on commit db5c06a

Please sign in to comment.