ngx-render-material-forms 1.8.2 → 1.8.4

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: `
@@ -3844,13 +3830,9 @@ class AddOnProductsComponent {
3844
3830
  quantityControl.setErrors({ 'min': true });
3845
3831
  }
3846
3832
  // If the value is not an integer, set 'pattern' error
3847
- else if (!Number.isInteger(Number(value))) {
3833
+ else if (!/^\d+$/.test(value)) {
3848
3834
  quantityControl.setErrors({ 'pattern': true });
3849
3835
  }
3850
- // Otherwise, set the valid value
3851
- else {
3852
- quantityControl.setValue(Number(value));
3853
- }
3854
3836
  }
3855
3837
  }
3856
3838
  AddOnProductsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AddOnProductsComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }, { token: i2.FormBuilder }, { token: i1$1.MatDialog }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Component });
@@ -3900,14 +3882,12 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3900
3882
  this.dropdownL2Label = '';
3901
3883
  this.dropdownL3Label = '';
3902
3884
  this.dropdownL4Label = '';
3885
+ this.isCustomerCountryFiltered = false;
3886
+ this.emptyArray = false;
3903
3887
  }
3904
3888
  getColumnLabel(column) {
3905
3889
  return column.label || column.key;
3906
3890
  }
3907
- checkIsAttributeTrue(newProductPickerFlag, attributeName) {
3908
- return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
3909
- newProductPickerFlag[key].toLowerCase() === "true");
3910
- }
3911
3891
  getLabelName(newProductPickerFlag, attributeName) {
3912
3892
  if (newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase())) {
3913
3893
  // Find the key that matches attributeName case-insensitively
@@ -3922,17 +3902,18 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3922
3902
  setInstance(instance) {
3923
3903
  //const newProductPickerFlag = instance?.component?.attributes;
3924
3904
  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");
3905
+ this.showNewProductPicker = this.commonService.checkIsAttributeTrue(checkAttribute, "newproductpicker");
3906
+ this.showCategory = this.commonService.checkIsAttributeTrue(checkAttribute, "showCategory");
3907
+ this.showSubcategory = this.commonService.checkIsAttributeTrue(checkAttribute, "showSubcategory");
3908
+ this.showPrice = this.commonService.checkIsAttributeTrue(checkAttribute, "showPrice");
3909
+ this.showQuantity = this.commonService.checkIsAttributeTrue(checkAttribute, "showQuantity");
3910
+ this.showSkuNumber = this.commonService.checkIsAttributeTrue(checkAttribute, "showSkuNumber");
3911
+ this.showDialogQuantity = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogQuantity");
3912
+ this.showDialogPrice = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogPrice");
3913
+ this.showDialogCategory = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogCategory");
3914
+ this.showDialogSkuNumber = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogSkuNumber");
3915
+ this.showDialogSubCategory = this.commonService.checkIsAttributeTrue(checkAttribute, "showDialogSubCategory");
3916
+ this.isCustomerCountryFiltered = this.commonService.checkIsAttributeTrue(checkAttribute, "filterProductBasedOnCustomerCountry");
3936
3917
  const l1 = this.getLabelName(checkAttribute, "dropdownL1");
3937
3918
  const l2 = this.getLabelName(checkAttribute, "dropdownL2");
3938
3919
  const l3 = this.getLabelName(checkAttribute, "dropdownL3");
@@ -3955,6 +3936,8 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3955
3936
  }
3956
3937
  this.checkSubmissionStatus = this.commonService.checkIsAttributeTrue(checkAttribute, 'isProductOptional');
3957
3938
  this.hasValueAndEditMode = (checkAttribute?.hasValue === 'yes') && (checkAttribute?.editMode === 'true');
3939
+ const retrievedObject = JSON.parse(localStorage.getItem('storageObject'));
3940
+ this.emptyArray = retrievedObject?.dataSource?.length < 1 ? true : false;
3958
3941
  super.setInstance(instance);
3959
3942
  if (this.showNewProductPicker && !this.hasInitialized) {
3960
3943
  if (!this.showCategory) {
@@ -4149,7 +4132,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
4149
4132
  fxFill
4150
4133
  cdkDropList
4151
4134
  [cdkDropListData]="dataSource"
4152
- (cdkDropListDropped)="dropTable($event)">
4135
+ (cdkDropListDropped)="dropTable($event)" *ngIf="!isCustomerCountryFiltered || !emptyArray; else noDataMessage">
4153
4136
 
4154
4137
 
4155
4138
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
@@ -4184,6 +4167,15 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
4184
4167
  </div>
4185
4168
  </ng-container>
4186
4169
 
4170
+ <!-- Default Message -->
4171
+ <ng-template #noDataMessage>
4172
+ <div class="no-data-message" *ngIf="isCustomerCountryFiltered && emptyArray">
4173
+ <span>
4174
+ No Product found with selected Customer country.
4175
+ </span>
4176
+ </div>
4177
+ </ng-template>
4178
+
4187
4179
  <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4188
4180
  <!-- Product Name Column -->
4189
4181
  <ng-container matColumnDef="productName">
@@ -4226,7 +4218,12 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
4226
4218
  </table>
4227
4219
  <ng-template #noData>
4228
4220
  <div class="no-data-message" *ngIf="showNewProductPicker">
4221
+ <ng-container *ngIf="showNewProductPicker && !isCustomerCountryFiltered">
4229
4222
  No products found. Please add some products.
4223
+ </ng-container>
4224
+ <ng-container *ngIf="showNewProductPicker && isCustomerCountryFiltered">
4225
+ No Product found with selected Customeer country.
4226
+ </ng-container>
4230
4227
  </div>
4231
4228
  </ng-template>
4232
4229
 
@@ -4277,7 +4274,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4277
4274
  fxFill
4278
4275
  cdkDropList
4279
4276
  [cdkDropListData]="dataSource"
4280
- (cdkDropListDropped)="dropTable($event)">
4277
+ (cdkDropListDropped)="dropTable($event)" *ngIf="!isCustomerCountryFiltered || !emptyArray; else noDataMessage">
4281
4278
 
4282
4279
 
4283
4280
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
@@ -4312,6 +4309,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4312
4309
  </div>
4313
4310
  </ng-container>
4314
4311
 
4312
+ <!-- Default Message -->
4313
+ <ng-template #noDataMessage>
4314
+ <div class="no-data-message" *ngIf="isCustomerCountryFiltered && emptyArray">
4315
+ <span>
4316
+ No Product found with selected Customer country.
4317
+ </span>
4318
+ </div>
4319
+ </ng-template>
4320
+
4315
4321
  <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4316
4322
  <!-- Product Name Column -->
4317
4323
  <ng-container matColumnDef="productName">
@@ -4354,7 +4360,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4354
4360
  </table>
4355
4361
  <ng-template #noData>
4356
4362
  <div class="no-data-message" *ngIf="showNewProductPicker">
4363
+ <ng-container *ngIf="showNewProductPicker && !isCustomerCountryFiltered">
4357
4364
  No products found. Please add some products.
4365
+ </ng-container>
4366
+ <ng-container *ngIf="showNewProductPicker && isCustomerCountryFiltered">
4367
+ No Product found with selected Customeer country.
4368
+ </ng-container>
4358
4369
  </div>
4359
4370
  </ng-template>
4360
4371