@@ -115,7 +115,7 @@ export class RequestCopyDetailsComponent implements OnInit {
115115 this . actionBtnName = params . name
116116 }
117117 } )
118-
118+ this . valuechangeFuctions ( )
119119 }
120120
121121 getRequestDataById ( ) {
@@ -161,7 +161,7 @@ export class RequestCopyDetailsComponent implements OnInit {
161161 if ( this . filteredRequestType ) {
162162 const abc = this . filteredRequestType . filter ( option =>
163163 this . requestObjData . preferredProvider . some ( ( res : any ) =>
164- res . providerName === option . orgName
164+ res . providerId === option . id
165165 )
166166 )
167167 this . requestForm . controls [ 'providers' ] . setValue ( abc )
@@ -170,7 +170,7 @@ export class RequestCopyDetailsComponent implements OnInit {
170170 if ( this . filteredAssigneeType ) {
171171 if ( this . requestObjData . assignedProvider ) {
172172 const assignData = this . filteredAssigneeType . find ( option =>
173- this . requestObjData . assignedProvider . providerName === option . orgName
173+ this . requestObjData . assignedProvider . providerId === option . id
174174 )
175175 if ( assignData ) {
176176 this . requestForm . controls [ 'assignee' ] . setValue ( assignData )
@@ -184,17 +184,19 @@ export class RequestCopyDetailsComponent implements OnInit {
184184 this . router . navigateByUrl ( '/app/home/all-request' )
185185 }
186186
187- searchValueData ( searchValue : any ) {
188- if ( searchValue === 'providerText' ) {
187+
188+ valuechangeFuctions ( ) {
189+ if ( this . requestForm . controls [ 'providerText' ] ) {
189190 this . requestForm . controls [ 'providerText' ] . valueChanges . pipe (
190191 debounceTime ( 100 ) ,
191192 distinctUntilChanged ( ) ,
192193 startWith ( '' ) ,
193194 ) . subscribe ( ( newValue : any ) => {
194- this . filteredRequestType = this . filterOrgValues ( newValue , this . requestTypeData )
195+ this . filteredRequestType = this . getHiddenOptions ( newValue , this . requestTypeData )
195196 } )
196197 }
197- if ( searchValue === 'assigneeText' ) {
198+
199+ if ( this . requestForm . controls [ 'assigneeText' ] ) {
198200 this . requestForm . controls [ 'assigneeText' ] . valueChanges . pipe (
199201 debounceTime ( 100 ) ,
200202 distinctUntilChanged ( ) ,
@@ -206,6 +208,28 @@ export class RequestCopyDetailsComponent implements OnInit {
206208
207209 }
208210
211+ // searchValueData(searchValue: any) {
212+ // if (searchValue === 'providerText') {
213+ // this.requestForm.controls['providerText'].valueChanges.pipe(
214+ // debounceTime(100),
215+ // distinctUntilChanged(),
216+ // startWith(''),
217+ // ).subscribe((newValue: any) => {
218+ // this.filteredRequestType = this.filterOrgValues(newValue, this.requestTypeData)
219+ // })
220+ // }
221+ // if (searchValue === 'assigneeText') {
222+ // this.requestForm.controls['assigneeText'].valueChanges.pipe(
223+ // debounceTime(100),
224+ // distinctUntilChanged(),
225+ // startWith(''),
226+ // ).subscribe((newValue: any) => {
227+ // this.filteredAssigneeType = this.filterOrgValues(newValue, this.requestTypeData)
228+ // })
229+ // }
230+
231+ // }
232+
209233 filterValues ( searchValue : string , array : any ) {
210234 return array . filter ( ( value : any ) =>
211235 value . name . toLowerCase ( ) . includes ( searchValue . toLowerCase ( ) ) )
@@ -216,6 +240,19 @@ export class RequestCopyDetailsComponent implements OnInit {
216240 value . orgName . toLowerCase ( ) . includes ( searchValue . toLowerCase ( ) ) )
217241 }
218242
243+ getHiddenOptions ( searchValue : string , array : any ) {
244+ const hiddenOptions : any = [ ]
245+ array . forEach ( ( element : any ) => {
246+ if ( element . orgName . toLowerCase ( ) . includes ( searchValue . toLowerCase ( ) ) ) {
247+ element [ 'hideOption' ] = 'show'
248+ } else {
249+ element [ 'hideOption' ] = 'hide'
250+ }
251+ hiddenOptions . push ( element )
252+ } )
253+ return hiddenOptions
254+ }
255+
219256 getFilterEntity ( ) {
220257 const filterObj = {
221258 search : {
0 commit comments