From 44a42b3086ace2b30f55d474b8d92eef72dfb7e3 Mon Sep 17 00:00:00 2001 From: JaySoni1 Date: Tue, 10 Feb 2026 23:44:10 +0530 Subject: [PATCH] WEB-699 Fund Mapping: Loan Status and Product fields should be optional for search --- .../fund-mapping/fund-mapping.component.ts | 35 +++---------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/src/app/organization/fund-mapping/fund-mapping.component.ts b/src/app/organization/fund-mapping/fund-mapping.component.ts index cfa86da2e..956620ae8 100644 --- a/src/app/organization/fund-mapping/fund-mapping.component.ts +++ b/src/app/organization/fund-mapping/fund-mapping.component.ts @@ -28,9 +28,7 @@ import { UntypedFormBuilder, UntypedFormControl, Validators, - ReactiveFormsModule, - AbstractControl, - ValidationErrors + ReactiveFormsModule } from '@angular/forms'; import { ActivatedRoute, RouterLink } from '@angular/router'; @@ -122,39 +120,14 @@ export class FundMappingComponent implements OnInit { this.buildDependencies(); } - /** - * Custom validator to ensure array fields are not empty. - * @param {AbstractControl} control - the form control to validate. - * @returns {ValidationErrors | null} - validation errors or null if valid. - */ - private nonEmptyArrayValidator(control: AbstractControl): ValidationErrors | null { - const value = control.value; - if (!value || !Array.isArray(value) || value.length === 0) { - return { required: true }; - } - if (value.every((item: any) => item === '' || item === null || item === undefined)) { - return { required: true }; - } - return null; - } - /** * Creates the Fund Mapping Form */ createFundMappingForm() { this.fundMappingForm = this.formBuilder.group({ - loanStatus: [ - [], - this.nonEmptyArrayValidator.bind(this) - ], - loanProducts: [ - [], - this.nonEmptyArrayValidator.bind(this) - ], - offices: [ - [], - this.nonEmptyArrayValidator.bind(this) - ], + loanStatus: [[]], + loanProducts: [[]], + offices: [[]], loanDateOption: [ '', Validators.required