ngx-render-material-forms 1.6.8 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2887,25 +2887,74 @@ class MaterialSelectComponent extends MaterialComponent {
2887
2887
  }
2888
2888
  }
2889
2889
  updateSecondDropdown(value) {
2890
- const apiEndPoint = 'ManageVendors/GetReferenceDataItemsByVendorIdAndDataValue';
2891
- let finalParams = JSON.parse(localStorage.getItem('cascadingDropdownsParams'));
2892
- if (Array.isArray(finalParams)) {
2893
- const index = finalParams.findIndex(param => param.key === 'dataValue');
2894
- if (index !== -1) {
2895
- // If the object exists, update its value
2896
- finalParams[index].value = value;
2897
- }
2898
- else {
2899
- // If the object doesn't exist, add it to the array
2900
- finalParams.push({ key: 'dataValue', value: value });
2901
- }
2902
- this.commonService.initializeApiPath(apiEndPoint, finalParams).subscribe(response => {
2903
- if (response && response.code === 200) {
2904
- this.secondDropdownItems = response.data;
2905
- this.commonService.setDropdownItems(this.secondDropdownItems);
2890
+ const paramsData = JSON.parse(localStorage.getItem('cascadingDropdownsParamsone'));
2891
+ const vendorId = this.getValueByKey(paramsData, 'vendorId');
2892
+ const dealId = this.getValueByKey(paramsData, 'dealId');
2893
+ const isEdit = this.getValueByKey(paramsData, 'isEdit');
2894
+ let finalParams;
2895
+ this.instance?.parent?.components?.length && this.instance.parent.components.forEach(items => {
2896
+ if (this.checkVendorRefItems(items)) {
2897
+ const apiEndPoint = items?.component?.selectValues;
2898
+ if (apiEndPoint != '') {
2899
+ var parameters = [
2900
+ {
2901
+ "key": "userId",
2902
+ "value": JSON.parse(localStorage.getItem('currentUser')).UserId
2903
+ },
2904
+ {
2905
+ "key": "vendorId",
2906
+ "value": vendorId
2907
+ },
2908
+ {
2909
+ "key": "loginUserId",
2910
+ "value": JSON.parse(localStorage.getItem('currentUser')).UserId
2911
+ },
2912
+ {
2913
+ "key": "country",
2914
+ "value": typeof value === 'string' ? value.trim() : ''
2915
+ },
2916
+ {
2917
+ "key": "dataValue",
2918
+ "value": typeof value === 'string' ? value.trim() : ''
2919
+ },
2920
+ {
2921
+ "key": "dealId",
2922
+ "value": dealId
2923
+ },
2924
+ {
2925
+ "key": "isEdit",
2926
+ "value": isEdit
2927
+ },
2928
+ {
2929
+ "key": "referenceListName",
2930
+ "value": items?.component?.key
2931
+ },
2932
+ {
2933
+ "key": "referenceListFieldName",
2934
+ "value": this.instance?.component?.key
2935
+ }
2936
+ ];
2937
+ finalParams = parameters?.filter(f1 => items?.component?.data?.headers.some(f2 => f1.key === f2.key));
2938
+ if (Array.isArray(finalParams)) {
2939
+ const index = finalParams.findIndex(param => param.key === 'dataValue');
2940
+ if (index !== -1) {
2941
+ // If the object exists, update its value
2942
+ finalParams[index].value = value;
2943
+ }
2944
+ else {
2945
+ // If the object doesn't exist, add it to the array
2946
+ finalParams.push({ key: 'dataValue', value: value });
2947
+ }
2948
+ this.commonService.initializeApiPath(apiEndPoint, finalParams).subscribe(response => {
2949
+ if (response && response.code === 200) {
2950
+ this.secondDropdownItems = response.data;
2951
+ this.commonService.setDropdownItems(this.secondDropdownItems);
2952
+ }
2953
+ });
2954
+ }
2906
2955
  }
2907
- });
2908
- }
2956
+ }
2957
+ });
2909
2958
  }
2910
2959
  ngAfterViewInit() {
2911
2960
  this.selectElem.openedChange.subscribe(async (isOpen) => {