ngx-render-material-forms 1.8.2 → 1.8.3

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.
@@ -2817,10 +2817,6 @@ class MaterialSelectComponent extends MaterialComponent {
2817
2817
  this.storeDependentItems = [];
2818
2818
  this.executionFlag = false;
2819
2819
  this.apiCounter = 0;
2820
- // this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
2821
- // this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
2822
- //this.holy = CryptoJS.enc.Base64.parse(this.commonService.getcombodeal());
2823
- //this.grail = CryptoJS.enc.Base64.parse(this.commonService.getglobedata());
2824
2820
  }
2825
2821
  onInputChange(event) {
2826
2822
  if (this.instance.component.key.toLowerCase() === 'vendorproductid' && event.target.value === '') {
@@ -2833,29 +2829,6 @@ class MaterialSelectComponent extends MaterialComponent {
2833
2829
  this.searchItem = "";
2834
2830
  }
2835
2831
  }
2836
- // scrumble(msg) {
2837
- // if (!isNullOrUndefined(msg)) {
2838
- // var conceal = this.getcampaign(msg, this.holy, this.grail);
2839
- // var sha256 = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(this.grail) + conceal.toString(), CryptoJS.enc.Base64.stringify(this.holy));
2840
- // var hashInBase64 = CryptoJS.enc.Base64.stringify(sha256);
2841
- // let keyValue = {
2842
- // "value": conceal.toString(),
2843
- // "mac": hashInBase64
2844
- // };
2845
- // var result = JSON.stringify(keyValue);
2846
- // var jumbled = CryptoJS.enc.Utf8.parse(result);
2847
- // return CryptoJS.enc.Base64.stringify(jumbled);
2848
- // }
2849
- // }
2850
- // getcampaign(data: any, holy: any, grail: any) {
2851
- // return CryptoJS.AES.encrypt(data.toString(), holy,
2852
- // {
2853
- // blockSize: 128,
2854
- // iv: grail,
2855
- // mode: CryptoJS.mode.CBC,
2856
- // padding: CryptoJS.pad.Pkcs7
2857
- // });
2858
- // }
2859
2832
  registerPanelScrollEvent(selectElem) {
2860
2833
  if (selectElem && selectElem?.panel) {
2861
2834
  // const panelElement = selectElem.panel.nativeElement;
@@ -2905,7 +2878,7 @@ class MaterialSelectComponent extends MaterialComponent {
2905
2878
  const includeDescription = this.getValueByKey(paramsData, 'includeDescription');
2906
2879
  const vendorId = this.getValueByKey(paramsData, 'vendorId');
2907
2880
  const onlyActive = this.getValueByKey(paramsData, 'onlyActive');
2908
- const includeCountry = this.getValueByKey(paramsData, 'includeCountry');
2881
+ const includeCountry = this.getValueByKey(paramsData, 'filterProductBasedOnCustomerCountry');
2909
2882
  var currentUser = JSON.parse(localStorage.getItem('currentUser'));
2910
2883
  let headers;
2911
2884
  if (currentUser && currentUser.Tokens && currentUser.Tokens.AccessToken) {
@@ -2945,8 +2918,8 @@ class MaterialSelectComponent extends MaterialComponent {
2945
2918
  const baseApiUrl = baseUrlMapping[hostname] || null;
2946
2919
  let url = `${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${envendorId}&pageNumber=${enpageNumber}&pageSize=${enpageSize}&search=${ensearchQuery}&onlyActive=${enactive}&includeDescription=${endescription}`;
2947
2920
  // Only add includeCountryId if it has a valid value
2948
- if (encodeIncludeCountry !== null && encodeIncludeCountry !== undefined) {
2949
- url += `&includeCountry=${encodeIncludeCountry}`;
2921
+ if (encodeIncludeCountry !== null && encodeIncludeCountry !== undefined && this.isFilterProductBasedOnCustomerCountryValid(this.instance.component.data)) {
2922
+ url += `&filterProductBasedOnCustomerCountry=${encodeIncludeCountry}`;
2950
2923
  }
2951
2924
  this.http.get(url, { headers }).subscribe(response => {
2952
2925
  if (response && response.code === 200) {
@@ -3204,6 +3177,19 @@ class MaterialSelectComponent extends MaterialComponent {
3204
3177
  compareObjects(o1, o2) {
3205
3178
  return _.isEqual(o1, o2);
3206
3179
  }
3180
+ isFilterProductBasedOnCustomerCountryValid(data) {
3181
+ if (data && data.headers && Array.isArray(data.headers)) {
3182
+ const header = data.headers.find(h => h.key === 'filterProductBasedOnCustomerCountry');
3183
+ if (header &&
3184
+ header.value !== null &&
3185
+ header.value !== undefined &&
3186
+ header.value.trim() !== "" &&
3187
+ header.value.trim().toLowerCase() === "true") {
3188
+ return true;
3189
+ }
3190
+ }
3191
+ return false;
3192
+ }
3207
3193
  }
3208
3194
  MaterialSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$2.HttpClient }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Component });
3209
3195
  MaterialSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialSelectComponent, selector: "mat-formio-select", viewQueries: [{ propertyName: "multiSelect", first: true, predicate: ["multiSelect"], descendants: true, static: true }, { propertyName: "selectElem", first: true, predicate: ["productSelect"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
@@ -3900,14 +3886,12 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3900
3886
  this.dropdownL2Label = '';
3901
3887
  this.dropdownL3Label = '';
3902
3888
  this.dropdownL4Label = '';
3889
+ this.isCustomerCountryFiltered = false;
3890
+ this.emptyArray = false;
3903
3891
  }
3904
3892
  getColumnLabel(column) {
3905
3893
  return column.label || column.key;
3906
3894
  }
3907
- checkIsAttributeTrue(newProductPickerFlag, attributeName) {
3908
- return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
3909
- newProductPickerFlag[key].toLowerCase() === "true");
3910
- }
3911
3895
  getLabelName(newProductPickerFlag, attributeName) {
3912
3896
  if (newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase())) {
3913
3897
  // Find the key that matches attributeName case-insensitively
@@ -3922,17 +3906,18 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3922
3906
  setInstance(instance) {
3923
3907
  //const newProductPickerFlag = instance?.component?.attributes;
3924
3908
  const checkAttribute = instance?.component?.attributes;
3925
- this.showNewProductPicker = this.checkIsAttributeTrue(checkAttribute, "newproductpicker");
3926
- this.showCategory = this.checkIsAttributeTrue(checkAttribute, "showCategory");
3927
- this.showSubcategory = this.checkIsAttributeTrue(checkAttribute, "showSubcategory");
3928
- this.showPrice = this.checkIsAttributeTrue(checkAttribute, "showPrice");
3929
- this.showQuantity = this.checkIsAttributeTrue(checkAttribute, "showQuantity");
3930
- this.showSkuNumber = this.checkIsAttributeTrue(checkAttribute, "showSkuNumber");
3931
- this.showDialogQuantity = this.checkIsAttributeTrue(checkAttribute, "showDialogQuantity");
3932
- this.showDialogPrice = this.checkIsAttributeTrue(checkAttribute, "showDialogPrice");
3933
- this.showDialogCategory = this.checkIsAttributeTrue(checkAttribute, "showDialogCategory");
3934
- this.showDialogSkuNumber = this.checkIsAttributeTrue(checkAttribute, "showDialogSkuNumber");
3935
- this.showDialogSubCategory = this.checkIsAttributeTrue(checkAttribute, "showDialogSubCategory");
3909
+ this.showNewProductPicker = this.commonService.checkIsAttributeTrue(checkAttribute, "newproductpicker");
3910
+ this.showCategory = this.commonService.checkIsAttributeTrue(checkAttribute, "showCategory");
3911
+ this.showSubcategory = this.commonService.checkIsAttributeTrue(checkAttribute, "showSubcategory");
3912
+ this.showPrice = this.commonService.checkIsAttributeTrue(checkAttribute, "showPrice");
3913
+ this.showQuantity = this.commonService.checkIsAttributeTrue(checkAttribute, "showQuantity");
3914
+ this.showSkuNumber = this.commonService.checkIsAttributeTrue(checkAttribute, "showSkuNumber");
3915
+ this.showDialogQuantity = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogQuantity");
3916
+ this.showDialogPrice = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogPrice");
3917
+ this.showDialogCategory = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogCategory");
3918
+ this.showDialogSkuNumber = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogSkuNumber");
3919
+ this.showDialogSubCategory = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogSubCategory");
3920
+ this.isCustomerCountryFiltered = this.commonService.checkIsAttributeTrue(checkAttribute, "filterProductBasedOnCustomerCountry");
3936
3921
  const l1 = this.getLabelName(checkAttribute, "dropdownL1");
3937
3922
  const l2 = this.getLabelName(checkAttribute, "dropdownL2");
3938
3923
  const l3 = this.getLabelName(checkAttribute, "dropdownL3");
@@ -3955,6 +3940,8 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3955
3940
  }
3956
3941
  this.checkSubmissionStatus = this.commonService.checkIsAttributeTrue(checkAttribute, 'isProductOptional');
3957
3942
  this.hasValueAndEditMode = (checkAttribute?.hasValue === 'yes') && (checkAttribute?.editMode === 'true');
3943
+ const retrievedObject = JSON.parse(localStorage.getItem('storageObject'));
3944
+ this.emptyArray = retrievedObject?.dataSource?.length < 1 ? true : false;
3958
3945
  super.setInstance(instance);
3959
3946
  if (this.showNewProductPicker && !this.hasInitialized) {
3960
3947
  if (!this.showCategory) {
@@ -4149,7 +4136,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
4149
4136
  fxFill
4150
4137
  cdkDropList
4151
4138
  [cdkDropListData]="dataSource"
4152
- (cdkDropListDropped)="dropTable($event)">
4139
+ (cdkDropListDropped)="dropTable($event)" *ngIf="!isCustomerCountryFiltered || !emptyArray; else noDataMessage">
4153
4140
 
4154
4141
 
4155
4142
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
@@ -4184,6 +4171,15 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
4184
4171
  </div>
4185
4172
  </ng-container>
4186
4173
 
4174
+ <!-- Default Message -->
4175
+ <ng-template #noDataMessage>
4176
+ <div class="no-data-message" *ngIf="isCustomerCountryFiltered && emptyArray">
4177
+ <span>
4178
+ No Product found with selected Customer country.
4179
+ </span>
4180
+ </div>
4181
+ </ng-template>
4182
+
4187
4183
  <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4188
4184
  <!-- Product Name Column -->
4189
4185
  <ng-container matColumnDef="productName">
@@ -4226,7 +4222,12 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
4226
4222
  </table>
4227
4223
  <ng-template #noData>
4228
4224
  <div class="no-data-message" *ngIf="showNewProductPicker">
4225
+ <ng-container *ngIf="showNewProductPicker && !isCustomerCountryFiltered">
4229
4226
  No products found. Please add some products.
4227
+ </ng-container>
4228
+ <ng-container *ngIf="showNewProductPicker && isCustomerCountryFiltered">
4229
+ No Product found with selected Customeer country.
4230
+ </ng-container>
4230
4231
  </div>
4231
4232
  </ng-template>
4232
4233
 
@@ -4277,7 +4278,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4277
4278
  fxFill
4278
4279
  cdkDropList
4279
4280
  [cdkDropListData]="dataSource"
4280
- (cdkDropListDropped)="dropTable($event)">
4281
+ (cdkDropListDropped)="dropTable($event)" *ngIf="!isCustomerCountryFiltered || !emptyArray; else noDataMessage">
4281
4282
 
4282
4283
 
4283
4284
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
@@ -4312,6 +4313,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4312
4313
  </div>
4313
4314
  </ng-container>
4314
4315
 
4316
+ <!-- Default Message -->
4317
+ <ng-template #noDataMessage>
4318
+ <div class="no-data-message" *ngIf="isCustomerCountryFiltered && emptyArray">
4319
+ <span>
4320
+ No Product found with selected Customer country.
4321
+ </span>
4322
+ </div>
4323
+ </ng-template>
4324
+
4315
4325
  <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4316
4326
  <!-- Product Name Column -->
4317
4327
  <ng-container matColumnDef="productName">
@@ -4354,7 +4364,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4354
4364
  </table>
4355
4365
  <ng-template #noData>
4356
4366
  <div class="no-data-message" *ngIf="showNewProductPicker">
4367
+ <ng-container *ngIf="showNewProductPicker && !isCustomerCountryFiltered">
4357
4368
  No products found. Please add some products.
4369
+ </ng-container>
4370
+ <ng-container *ngIf="showNewProductPicker && isCustomerCountryFiltered">
4371
+ No Product found with selected Customeer country.
4372
+ </ng-container>
4358
4373
  </div>
4359
4374
  </ng-template>
4360
4375