diff options
Diffstat (limited to 'vid-webpack-master/src/app/shared/components')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts index c41c6c282..97c5516db 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service.ts @@ -48,7 +48,7 @@ export class SharedControllersService { return this.getLineOfBusinessControlInternal(changeLcpRegionOptionsOnChange, instance); }; - private getLineOfBusinessControlInternal = (onChange: Function, instance?: any): DropdownFormControl => { + private getLineOfBusinessControlInternal = (onChange: Function, instance?: any): DropdownFormControl => { return new DropdownFormControl({ type: FormControlType.DROPDOWN, controlName: 'lineOfBusiness', @@ -288,23 +288,51 @@ export class SharedControllersService { } getPlatformMultiselectControl = (instance: any, controls: FormControlModel[], isMultiSelected: boolean) : MultiselectFormControl => { + return this.getMultiSelectFormControl( + 'platformName', + 'Platform', + 'multi-selectPlatform', + 'Select Platform', + "platform", + instance, + instance ? instance.platformName : null, + isMultiSelected, + 'platformList' + ); + }; + + getLobMultiselectControl = (instance: any, controls: FormControlModel[], isMultiSelected: boolean) : MultiselectFormControl => { + return this.getMultiSelectFormControl( + 'lineOfBusiness', + 'Line of business', + 'multi-lineOfBusiness', + 'Select Line Of Business', + "lineOfBusiness", + instance, + instance ? instance.lineOfBusiness : null, + isMultiSelected, + 'lineOfBusinessList'); + }; + + private getMultiSelectFormControl(controlName: string, displayName: string, dataTestId: string, placeholder: string, + name: string, instance: any, defaultValue, isMultiSelected: boolean, catagoryParamResponseFieldName: string) { return new MultiselectFormControl({ type: FormControlType.MULTI_SELECT, - controlName: 'platformName', - displayName: 'Platform', - dataTestId: 'multi-selectPlatform', + controlName, + displayName, + dataTestId, selectedFieldName: 'name', ngValue: 'name', - placeHolder: 'Select Platform', + placeHolder: placeholder, isDisabled: false, - name: "platform", - value: instance ? instance.platformName : '', + name: name, + value: instance ? defaultValue : '', limitSelection: isMultiSelected ? 1000 : 1, validations: [new ValidatorModel(ValidatorOptions.required, 'is required')], - onInitSelectedField: ['platformList'], + onInitSelectedField: [catagoryParamResponseFieldName], onInit: this._basicControlGenerator.getSubscribeInitResult.bind(null, this._aaiService.getCategoryParameters), onChange: (param: MultiSelectItem[], form: FormGroup) => { - form.controls['platformName'].setValue(param.map((multiSelectItem: MultiSelectItem) => { + form.controls[controlName].setValue(param.map((multiSelectItem: MultiSelectItem) => { return multiSelectItem.itemName }).join(',')); }, |