@@ -21,11 +21,12 @@ import { updateOrgLeaderDetails, selectOrgLeaderDetails, selectObjectIdEmployeeI
2121import { selectJobOwnerFilterSuggestions } from '../../store/jobs.slice' ;
2222import { fetchDefaultSqlMembershipSourceAttributes } from '../../store/sqlMembershipSources.api' ;
2323import { fetchAttributeValues } from '../../store/sqlMembershipSources.api' ;
24- import { selectAttributes , selectSource , selectAttributeValues } from '../../store/sqlMembershipSources.slice' ;
24+ import { selectAttributes , selectSource , selectAttributeValues , setAttributeValues } from '../../store/sqlMembershipSources.slice' ;
2525import { SqlMembershipAttribute , SqlMembershipAttributeValue } from '../../models' ;
2626import { IFilterPart } from '../../models/IFilterPart' ;
2727import { Group } from '../../models/Group' ;
2828import { parseGroup , stringifyGroups } from './QuerySerializer' ;
29+ import { GetAttributeValuesResponse } from '../../models/GetAttributeValuesResponse' ;
2930
3031export const getClassNames = classNamesFunction < HRQuerySourceStyleProps , HRQuerySourceStyles > ( ) ;
3132
@@ -189,8 +190,11 @@ const checkType = (value: string, type: string | undefined): string => {
189190 } ;
190191
191192 const getAttributeValues = ( attribute : string , attributeValue : string ) => {
192- const selectedAttribute = attributes ?. find ( att => att . name === attribute ) ;
193- dispatch ( fetchAttributeValues ( { attribute : attribute , type : selectedAttribute ?. type , hasMapping : selectedAttribute ?. hasMapping } ) ) ;
193+ const selectedAttribute = attributes ?. find ( ( { hasMapping, name } ) => ( ( hasMapping && `${ name } _Code` === attribute ) || ( ! hasMapping && name === attribute ) ) ) ;
194+ dispatch ( fetchAttributeValues ( { attribute : attribute , type : selectedAttribute ?. type , hasMapping : selectedAttribute ?. hasMapping } ) ) . then ( results => {
195+ var payload = results . payload as GetAttributeValuesResponse ;
196+ dispatch ( setAttributeValues ( { attribute : attribute , values : payload . values , type : selectedAttribute ?. type } ) ) ;
197+ } ) . catch ( error => { } ) ;
194198 return attributeValue ;
195199 }
196200
@@ -1214,7 +1218,7 @@ const checkType = (value: string, type: string | undefined): string => {
12141218 />
12151219 } else {
12161220 return < TextField
1217- value = { attributeValues && attributeValues [ item . attribute ] === undefined ? getAttributeValues ( item . attribute , items [ index ] . value ) : items [ index ] . value && items [ index ] . value . startsWith ( "'" ) && items [ index ] . value . endsWith ( "'" ) ? items [ index ] . value . slice ( 1 , - 1 ) : items [ index ] . value }
1221+ value = { item . attribute . endsWith ( "_Code" ) && attributeValues && attributeValues [ item . attribute ] === undefined ? getAttributeValues ( item . attribute , items [ index ] . value ) : items [ index ] . value && items [ index ] . value . startsWith ( "'" ) && items [ index ] . value . endsWith ( "'" ) ? items [ index ] . value . slice ( 1 , - 1 ) : items [ index ] . value }
12181222 onChange = { ( event , newValue ) => handleTAttributeValueChange ( item . attribute , event , newValue ! , index ) }
12191223 onBlur = { ( event ) => handleBlur ( item . attribute , event , index ) }
12201224 styles = { { fieldGroup : classNames . textField } }
0 commit comments