ngx-render-material-forms 1.7.0 → 1.7.2

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.
@@ -1,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, Component, Input, ViewChild, ViewContainerRef, ViewChildren, EventEmitter, Output, forwardRef, Directive, Inject, Optional, NgModule } from '@angular/core';
3
- import * as i1$1 from '@angular/common/http';
3
+ import * as i1$2 from '@angular/common/http';
4
4
  import { HttpHeaders, HttpClientModule } from '@angular/common/http';
5
5
  import * as i1 from '@angular/common';
6
6
  import { CommonModule } from '@angular/common';
7
7
  import * as i2 from '@angular/forms';
8
- import { FormControl, NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
8
+ import { FormControl, NG_VALUE_ACCESSOR, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
9
9
  import * as i4$2 from '@angular/material/input';
10
10
  import { MAT_INPUT_VALUE_ACCESSOR, MatInputModule } from '@angular/material/input';
11
11
  import * as i3$2 from '@angular/material/button';
@@ -27,18 +27,20 @@ import * as i4 from '@angular/material/card';
27
27
  import { MatCardModule } from '@angular/material/card';
28
28
  import * as i2$2 from '@angular/material/tabs';
29
29
  import { MatTabsModule } from '@angular/material/tabs';
30
- import * as i5$3 from '@angular/material/table';
30
+ import * as i10$1 from '@angular/material/table';
31
31
  import { MatTableDataSource, MatTableModule } from '@angular/material/table';
32
32
  import * as i5$2 from '@angular/material/datepicker';
33
33
  import { MatDatepickerModule } from '@angular/material/datepicker';
34
- import * as i3$4 from '@angular/material/progress-spinner';
34
+ import * as i11 from '@angular/material/progress-spinner';
35
35
  import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
36
36
  import * as i4$1 from '@angular/material/icon';
37
37
  import { MatIconModule } from '@angular/material/icon';
38
38
  import * as i5$1 from '@angular/material/core';
39
39
  import { MatNativeDateModule } from '@angular/material/core';
40
- import * as i1$2 from '@angular/material/dialog';
40
+ import * as i1$1 from '@angular/material/dialog';
41
41
  import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
42
+ import * as i16 from '@angular/material/autocomplete';
43
+ import { MatAutocompleteModule } from '@angular/material/autocomplete';
42
44
  import Webform from 'formiojs/Webform.js';
43
45
  import FormioComponent$2 from 'formiojs/components/_classes/component/Component.js';
44
46
  import TextFieldComponent from 'formiojs/components/textfield/TextField.js';
@@ -81,7 +83,7 @@ import RadioComponent from 'formiojs/components/radio/Radio.js';
81
83
  import SelectBoxesComponent from 'formiojs/components/selectboxes/SelectBoxes.js';
82
84
  import SelectComponent from 'formiojs/components/select/Select.js';
83
85
  import { BehaviorSubject, Subject } from 'rxjs';
84
- import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
86
+ import { debounceTime, distinctUntilChanged, takeUntil, startWith, map } from 'rxjs/operators';
85
87
  import * as CryptoJS from 'crypto-js';
86
88
  import { isNullOrUndefined } from 'util';
87
89
  import * as i10 from 'ngx-mat-select-search';
@@ -90,14 +92,15 @@ import WellComponent from 'formiojs/components/well/Well.js';
90
92
  import DataGridComponent from 'formiojs/components/datagrid/DataGrid.js';
91
93
  import * as i9 from '@angular/cdk/drag-drop';
92
94
  import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
95
+ import { SelectionModel } from '@angular/cdk/collections';
96
+ import * as i15 from '@angular/material/stepper';
97
+ import { MatStepperModule } from '@angular/material/stepper';
93
98
  import EditGridComponent from 'formiojs/components/editgrid/EditGrid.js';
94
99
  import Components$2 from 'formiojs/components/Components';
95
100
  import isString from 'lodash/isString';
96
101
  import TableComponent from 'formiojs/components/table/Table.js';
97
102
  import Wizard from 'formiojs/Wizard';
98
103
  import Displays from 'formiojs/displays/Displays';
99
- import * as i3$3 from '@angular/material/stepper';
100
- import { MatStepperModule } from '@angular/material/stepper';
101
104
  import * as i1$3 from '@formio/angular';
102
105
  import { FormioBaseComponent } from '@formio/angular';
103
106
  import { FlexLayoutModule } from '@angular/flex-layout';
@@ -983,8 +986,11 @@ var AngularButtonsThemes;
983
986
  })(AngularButtonsThemes || (AngularButtonsThemes = {}));
984
987
 
985
988
  class MaterialButtonComponent extends MaterialComponent {
986
- constructor() {
987
- super(...arguments);
989
+ constructor(element, ref, dialog) {
990
+ super(element, ref);
991
+ this.element = element;
992
+ this.ref = ref;
993
+ this.dialog = dialog;
988
994
  this.loading = false;
989
995
  this.done = false;
990
996
  this.error = false;
@@ -1055,12 +1061,12 @@ class MaterialButtonComponent extends MaterialComponent {
1055
1061
  return retVal;
1056
1062
  }
1057
1063
  }
1058
- MaterialButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1059
- MaterialButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialButtonComponent, selector: "mat-formio-button", usesInheritance: true, ngImport: i0, template: "<button *ngIf=\"instance\"\r\n [ngClass]=\"buttonClass\"\r\n type=\"{{ instance.component.action }}\"\r\n mat-raised-button [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n (click)=\"instance.onClick($event)\"\r\n>\r\n <mat-icon *ngIf=\"instance.component.leftIcon\">{{instance.component.leftIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"done\">done</mat-icon>\r\n <mat-icon *ngIf=\"error\">close</mat-icon>\r\n <mat-icon class=\"mat-icon-spin\" *ngIf=\"loading\">autorenew</mat-icon>\r\n {{ instance.component.label }}\r\n <mat-icon *ngIf=\"instance.component.rightIcon\">{{instance.component.rightIcon}}</mat-icon>\r\n</button>\r\n", styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .mat-icon-spin{-webkit-animation-name:spin;animation-name:spin;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.mat-formio-theme-success{background-color:#63d644!important}.mat-formio-theme-info{background-color:#49d9f4!important}.mat-formio-button-sm{font-size:14px;padding:8px 12px}.mat-formio-button-xs{font-size:14px;padding:4px 6px}.mat-formio-button-md{font-size:15px;padding:8px 12px}.mat-formio-button-lg{font-size:19px;padding:16px 20px}.mat-formio-button-block{display:block;width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }] });
1064
+ MaterialButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
1065
+ MaterialButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialButtonComponent, selector: "mat-formio-button", usesInheritance: true, ngImport: i0, template: "<button *ngIf=\"instance && instance.component.label != 'Click to add Products'\"\r\n [ngClass]=\"buttonClass\"\r\n type=\"{{ instance.component.action }}\"\r\n mat-raised-button [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n (click)=\"instance.onClick($event)\"\r\n>\r\n\r\n\r\n <mat-icon *ngIf=\"instance.component.leftIcon\">{{instance.component.leftIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"done\">done</mat-icon>\r\n <mat-icon *ngIf=\"error\">close</mat-icon>\r\n <mat-icon class=\"mat-icon-spin\" *ngIf=\"loading\">autorenew</mat-icon>\r\n {{ instance.component.label }}\r\n <mat-icon *ngIf=\"instance.component.rightIcon\">{{instance.component.rightIcon}}</mat-icon>\r\n</button>\r\n", styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .mat-icon-spin{-webkit-animation-name:spin;animation-name:spin;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.mat-formio-theme-success{background-color:#63d644!important}.mat-formio-theme-info{background-color:#49d9f4!important}.mat-formio-button-sm{font-size:14px;padding:8px 12px}.mat-formio-button-xs{font-size:14px;padding:4px 6px}.mat-formio-button-md{font-size:15px;padding:8px 12px}.mat-formio-button-lg{font-size:19px;padding:16px 20px}.mat-formio-button-block{display:block;width:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }] });
1060
1066
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, decorators: [{
1061
1067
  type: Component,
1062
- args: [{ selector: 'mat-formio-button', template: "<button *ngIf=\"instance\"\r\n [ngClass]=\"buttonClass\"\r\n type=\"{{ instance.component.action }}\"\r\n mat-raised-button [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n (click)=\"instance.onClick($event)\"\r\n>\r\n <mat-icon *ngIf=\"instance.component.leftIcon\">{{instance.component.leftIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"done\">done</mat-icon>\r\n <mat-icon *ngIf=\"error\">close</mat-icon>\r\n <mat-icon class=\"mat-icon-spin\" *ngIf=\"loading\">autorenew</mat-icon>\r\n {{ instance.component.label }}\r\n <mat-icon *ngIf=\"instance.component.rightIcon\">{{instance.component.rightIcon}}</mat-icon>\r\n</button>\r\n", styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .mat-icon-spin{-webkit-animation-name:spin;animation-name:spin;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.mat-formio-theme-success{background-color:#63d644!important}.mat-formio-theme-info{background-color:#49d9f4!important}.mat-formio-button-sm{font-size:14px;padding:8px 12px}.mat-formio-button-xs{font-size:14px;padding:4px 6px}.mat-formio-button-md{font-size:15px;padding:8px 12px}.mat-formio-button-lg{font-size:19px;padding:16px 20px}.mat-formio-button-block{display:block;width:100%}\n"] }]
1063
- }] });
1068
+ args: [{ selector: 'mat-formio-button', template: "<button *ngIf=\"instance && instance.component.label != 'Click to add Products'\"\r\n [ngClass]=\"buttonClass\"\r\n type=\"{{ instance.component.action }}\"\r\n mat-raised-button [color]=\"color\"\r\n [disabled]=\"disabled\"\r\n (click)=\"instance.onClick($event)\"\r\n>\r\n\r\n\r\n <mat-icon *ngIf=\"instance.component.leftIcon\">{{instance.component.leftIcon}}</mat-icon>\r\n <mat-icon *ngIf=\"done\">done</mat-icon>\r\n <mat-icon *ngIf=\"error\">close</mat-icon>\r\n <mat-icon class=\"mat-icon-spin\" *ngIf=\"loading\">autorenew</mat-icon>\r\n {{ instance.component.label }}\r\n <mat-icon *ngIf=\"instance.component.rightIcon\">{{instance.component.rightIcon}}</mat-icon>\r\n</button>\r\n", styles: ["@-webkit-keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}:host .mat-icon-spin{-webkit-animation-name:spin;animation-name:spin;-webkit-animation-duration:1s;animation-duration:1s;-webkit-animation-iteration-count:infinite;animation-iteration-count:infinite;-webkit-animation-timing-function:linear;animation-timing-function:linear}.mat-formio-theme-success{background-color:#63d644!important}.mat-formio-theme-info{background-color:#49d9f4!important}.mat-formio-button-sm{font-size:14px;padding:8px 12px}.mat-formio-button-xs{font-size:14px;padding:4px 6px}.mat-formio-button-md{font-size:15px;padding:8px 12px}.mat-formio-button-lg{font-size:19px;padding:16px 20px}.mat-formio-button-block{display:block;width:100%}\n"] }]
1069
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }]; } });
1064
1070
  ButtonComponent.MaterialComponent = MaterialButtonComponent;
1065
1071
 
1066
1072
  class MaterialTextareaComponent extends MaterialComponent {
@@ -2550,8 +2556,12 @@ class CommonService {
2550
2556
  this.dropdownItems$ = this.dropdownItemsSubject.asObservable();
2551
2557
  this.setFlag = new BehaviorSubject(false); // Initialize with false
2552
2558
  this.dropdownflag$ = this.setFlag.asObservable(); // Observable that emits the boolean value
2553
- this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2559
+ this.holy = '';
2560
+ this.grail = '';
2554
2561
  this.currentUser = JSON.parse(localStorage.getItem('currentUser'));
2562
+ this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
2563
+ this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
2564
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2555
2565
  }
2556
2566
  getBaseApiUrl() {
2557
2567
  const baseUrlMapping = {
@@ -2565,6 +2575,28 @@ class CommonService {
2565
2575
  const hostname = window.location.hostname;
2566
2576
  return baseUrlMapping[hostname] || null;
2567
2577
  }
2578
+ scrumble(msg) {
2579
+ if (!isNullOrUndefined(msg)) {
2580
+ var conceal = this.getcampaign(msg, this.holy, this.grail);
2581
+ var sha256 = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(this.grail) + conceal.toString(), CryptoJS.enc.Base64.stringify(this.holy));
2582
+ var hashInBase64 = CryptoJS.enc.Base64.stringify(sha256);
2583
+ let keyValue = {
2584
+ "value": conceal.toString(),
2585
+ "mac": hashInBase64
2586
+ };
2587
+ var result = JSON.stringify(keyValue);
2588
+ var jumbled = CryptoJS.enc.Utf8.parse(result);
2589
+ return CryptoJS.enc.Base64.stringify(jumbled);
2590
+ }
2591
+ }
2592
+ getcampaign(data, holy, grail) {
2593
+ return CryptoJS.AES.encrypt(data.toString(), holy, {
2594
+ blockSize: 128,
2595
+ iv: grail,
2596
+ mode: CryptoJS.mode.CBC,
2597
+ padding: CryptoJS.pad.Pkcs7
2598
+ });
2599
+ }
2568
2600
  /* Intialization of api path and queryparams */
2569
2601
  initializeApiPath(getUrl, queryParams) {
2570
2602
  if (queryParams?.length) {
@@ -2588,6 +2620,16 @@ class CommonService {
2588
2620
  return obj;
2589
2621
  }
2590
2622
  }
2623
+ loadProducts(pageNumber, pazeSize, search = '', onlyActive = true, description = false, levelOneId, levelTwoId, levelThreeId, levelFourId) {
2624
+ const baseApiUrl = this.getBaseApiUrl();
2625
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2626
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProductsV2?vendorId=${vendorId}&pageNumber=${pageNumber}&pageSize=${pazeSize}&search=${search}&onlyActive=${onlyActive}&includeDescription=${description}&levelOne=${levelOneId}&levelTwo=${levelTwoId}&levelThree=${levelThreeId}&levelFour=${levelFourId}`);
2627
+ }
2628
+ listSubCategory(category) {
2629
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2630
+ const baseApiUrl = this.getBaseApiUrl();
2631
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsSubCategory?vendorId=${vendorId}&categoryName=${category}`);
2632
+ }
2591
2633
  /* Append key and value to query string */
2592
2634
  convertToQueryString(queryParams) {
2593
2635
  const queryString = Object.keys(queryParams)
@@ -2609,10 +2651,30 @@ class CommonService {
2609
2651
  const baseApiUrl = this.getBaseApiUrl();
2610
2652
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsCategory?vendorId=${vendorId}`);
2611
2653
  }
2654
+ productLevelOne() {
2655
+ const baseApiUrl = this.getBaseApiUrl();
2656
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2657
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelOne?vendorId=${vendorId}`);
2658
+ }
2659
+ productLevelTwo(levelOneId) {
2660
+ const baseApiUrl = this.getBaseApiUrl();
2661
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2662
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelTwo?levelOneId=${levelOneId}&vendorId=${vendorId}`);
2663
+ }
2664
+ productLevelThree(levelOneId, levelTwoId) {
2665
+ const baseApiUrl = this.getBaseApiUrl();
2666
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2667
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelThree?levelOneId=${levelOneId}&levelTwoId=${levelTwoId}&vendorId=${vendorId}`);
2668
+ }
2669
+ productLevelFour(levelOneId, levelTwoId, levelThreeId) {
2670
+ const baseApiUrl = this.getBaseApiUrl();
2671
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2672
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelFour?levelOneId=${levelOneId}&levelTwoId=${levelTwoId}&levelThreeId=${levelThreeId}&vendorId=${vendorId}`);
2673
+ }
2612
2674
  // Function to get value by key from the array
2613
2675
  getValueByKey(data, key) {
2614
2676
  if (!data || data.length === 0) {
2615
- return null; // Return null if data is empty or undefined
2677
+ return null;
2616
2678
  }
2617
2679
  const item = data.find(kv => kv.key.toLowerCase() === key.toLowerCase());
2618
2680
  return item ? item.value : null;
@@ -2636,19 +2698,20 @@ class CommonService {
2636
2698
  getDropDownFlag() {
2637
2699
  return this.setFlag.getValue();
2638
2700
  }
2701
+ /*Funtion to check if property is matched with given attributes in formBuilder or not */
2639
2702
  checkIsAttributeTrue(newProductPickerFlag, attributeName) {
2640
2703
  return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
2641
2704
  newProductPickerFlag[key].toLowerCase() === "true");
2642
2705
  }
2643
2706
  }
2644
- CommonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2707
+ CommonService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
2645
2708
  CommonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, providedIn: 'root' });
2646
2709
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, decorators: [{
2647
2710
  type: Injectable,
2648
2711
  args: [{
2649
2712
  providedIn: 'root'
2650
2713
  }]
2651
- }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
2714
+ }], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; } });
2652
2715
 
2653
2716
  class MaterialSelectComponent extends MaterialComponent {
2654
2717
  constructor(element, ref, http, commonService) {
@@ -2887,74 +2950,25 @@ class MaterialSelectComponent extends MaterialComponent {
2887
2950
  }
2888
2951
  }
2889
2952
  updateSecondDropdown(value) {
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
- }
2955
- }
2953
+ const apiEndPoint = 'ManageVendors/GetReferenceDataItemsByVendorIdAndDataValue';
2954
+ let finalParams = JSON.parse(localStorage.getItem('cascadingDropdownsParams'));
2955
+ if (Array.isArray(finalParams)) {
2956
+ const index = finalParams.findIndex(param => param.key === 'dataValue');
2957
+ if (index !== -1) {
2958
+ // If the object exists, update its value
2959
+ finalParams[index].value = value;
2956
2960
  }
2957
- });
2961
+ else {
2962
+ // If the object doesn't exist, add it to the array
2963
+ finalParams.push({ key: 'dataValue', value: value });
2964
+ }
2965
+ this.commonService.initializeApiPath(apiEndPoint, finalParams).subscribe(response => {
2966
+ if (response && response.code === 200) {
2967
+ this.secondDropdownItems = response.data;
2968
+ this.commonService.setDropdownItems(this.secondDropdownItems);
2969
+ }
2970
+ });
2971
+ }
2958
2972
  }
2959
2973
  ngAfterViewInit() {
2960
2974
  this.selectElem.openedChange.subscribe(async (isOpen) => {
@@ -3108,7 +3122,7 @@ class MaterialSelectComponent extends MaterialComponent {
3108
3122
  return _.isEqual(o1, o2);
3109
3123
  }
3110
3124
  }
3111
- 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$1.HttpClient }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Component });
3125
+ 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 });
3112
3126
  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: `
3113
3127
  <mat-formio-form-field [instance]="instance" [componentTemplate]="componentTemplate"></mat-formio-form-field>
3114
3128
  <ng-template #componentTemplate let-hasLabel>
@@ -3193,7 +3207,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3193
3207
  </mat-form-field>
3194
3208
  </ng-template>
3195
3209
  `, styles: [".example-viewport{height:200px}.product-picker{overflow-x:hidden}.virtual-full-view{height:auto!important;white-space:normal!important;line-height:1.4!important;text-overflow:initial!important;min-height:48px!important;overflow:visible!important;overflow:initial!important;padding-top:10px!important;padding-bottom:10px!important}::ng-deep .product-picker .cdk-virtual-scroll-content-wrapper{width:100%!important}.virtual-full-view .mat-pseudo-checkbox{align-self:top!important}\n"] }]
3196
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.HttpClient }, { type: CommonService }]; }, propDecorators: { multiSelect: [{
3210
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.HttpClient }, { type: CommonService }]; }, propDecorators: { multiSelect: [{
3197
3211
  type: ViewChild,
3198
3212
  args: ['multiSelect', { static: true }]
3199
3213
  }], selectElem: [{
@@ -3252,16 +3266,444 @@ class ConfirmationDialogComponent {
3252
3266
  ngOnInit() {
3253
3267
  }
3254
3268
  }
3255
- ConfirmationDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, deps: [{ token: i1$2.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
3256
- ConfirmationDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ConfirmationDialogComponent, selector: "NgxMat-confirmation-dialog", ngImport: i0, template: "<div class=\"dialog-container\">\r\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\r\n<mat-dialog-content class=\"data-grid-popup-body\">\r\n {{data.message}}\r\n</mat-dialog-content>\r\n<mat-dialog-actions class=\"data-grid-popup-footer\">\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\r\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\r\n</mat-dialog-actions>\r\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i1$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$2.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$2.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$2.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }] });
3269
+ ConfirmationDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
3270
+ ConfirmationDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ConfirmationDialogComponent, selector: "NgxMat-confirmation-dialog", ngImport: i0, template: "<div class=\"dialog-container\">\r\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\r\n<mat-dialog-content class=\"data-grid-popup-body\">\r\n {{data.message}}\r\n</mat-dialog-content>\r\n<mat-dialog-actions class=\"data-grid-popup-footer\">\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\r\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\r\n</mat-dialog-actions>\r\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }] });
3257
3271
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, decorators: [{
3258
3272
  type: Component,
3259
3273
  args: [{ selector: 'NgxMat-confirmation-dialog', template: "<div class=\"dialog-container\">\r\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\r\n<mat-dialog-content class=\"data-grid-popup-body\">\r\n {{data.message}}\r\n</mat-dialog-content>\r\n<mat-dialog-actions class=\"data-grid-popup-footer\">\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\r\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\r\n</mat-dialog-actions>\r\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"] }]
3260
- }], ctorParameters: function () { return [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
3274
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
3261
3275
  type: Inject,
3262
3276
  args: [MAT_DIALOG_DATA]
3263
3277
  }] }]; } });
3264
3278
 
3279
+ class AddOnProductsComponent {
3280
+ constructor(matDialogRef, data, fb, dialog, commonSevice) {
3281
+ this.matDialogRef = matDialogRef;
3282
+ this.fb = fb;
3283
+ this.dialog = dialog;
3284
+ this.commonSevice = commonSevice;
3285
+ this.dropdownOne = [];
3286
+ this.dropdownTwo = [];
3287
+ this.dropdownThree = [];
3288
+ this.dropdownFour = [];
3289
+ this.filteredDropdownOne = [];
3290
+ this.filteredDropdownTwo = [];
3291
+ this.filteredDropdownThree = [];
3292
+ this.filteredDropdownFour = [];
3293
+ this.addProductsColumns = ['select', 'productName', 'skuNumber'];
3294
+ this.showAllproductsColumns = ['delete', 'productName', 'categoryName', 'subCategory', 'Quantity', 'price', 'skuNumber'];
3295
+ this.quantityList = [5, 10, 15, 20, 25];
3296
+ this.ELEMENT_DATA = [];
3297
+ this.dataSource = new MatTableDataSource();
3298
+ this.selection = new SelectionModel(true, []);
3299
+ this.selectedDataSource = new MatTableDataSource([]);
3300
+ this.selectedCategory = null;
3301
+ this.selectedSubCategory = null;
3302
+ this.showCategory = false;
3303
+ this.showSubcategory = false;
3304
+ this.showPrice = true;
3305
+ this.showQuantity = true;
3306
+ this.showSkuNumber = false;
3307
+ this.showNewProductPicker = true;
3308
+ this.setCategory = '';
3309
+ this.setSubCategory = '';
3310
+ this.loadingFlag = false;
3311
+ this.pageNumber = 1;
3312
+ this.pageSize = 20;
3313
+ this.totalPages = 0;
3314
+ this.searchQuery = '';
3315
+ this.itemList = [];
3316
+ this.prevScrollPosition = 0; // Track the previous scroll position
3317
+ this.spinnerFlag = false;
3318
+ this.dropdownL1 = false;
3319
+ this.dropdownL2 = false;
3320
+ this.dropdownL3 = false;
3321
+ this.dropdownL4 = false;
3322
+ this.dropdownL1Label = '';
3323
+ this.dropdownL2Label = '';
3324
+ this.dropdownL3Label = '';
3325
+ this.dropdownL4Label = '';
3326
+ this.dropDownCount = 0;
3327
+ this.disablePrice = true;
3328
+ this.showCategory = data.dropdownsFlag.showDialogCategory;
3329
+ this.showSubcategory = data.dropdownsFlag.showDialogSubCategory;
3330
+ this.showPrice = data.dropdownsFlag.showDialogPrice;
3331
+ this.showQuantity = data.dropdownsFlag.showDialogQuantity;
3332
+ this.showSkuNumber = data.dropdownsFlag.showDialogSkuNumber;
3333
+ this.showNewProductPicker = data.dropdownsFlag.showNewProductPicker;
3334
+ this.dropdownL1 = data.dropdownsFlag.dropdownL1;
3335
+ this.dropdownL2 = data.dropdownsFlag.dropdownL2;
3336
+ this.dropdownL3 = data.dropdownsFlag.dropdownL3;
3337
+ this.dropdownL4 = data.dropdownsFlag.dropdownL4;
3338
+ this.dropdownL1Label = data.dropdownsFlag.dropdownL1Label;
3339
+ this.dropdownL2Label = data.dropdownsFlag.dropdownL2Label;
3340
+ this.dropdownL3Label = data.dropdownsFlag.dropdownL3Label;
3341
+ this.dropdownL4Label = data.dropdownsFlag.dropdownL4Label;
3342
+ this.dropDownCount = this.countTrueDropdowns(data.dropdownsFlag);
3343
+ this.selection = new SelectionModel(true, data.selectedProducts || []);
3344
+ this.form = this.fb.group({
3345
+ dropdownLevel1: [''],
3346
+ dropdownLevel2: [''],
3347
+ dropdownLevel3: [''],
3348
+ dropdownLevel4: [''],
3349
+ searchProductName: [''],
3350
+ selectedProducts: this.fb.array([])
3351
+ });
3352
+ this.initializeFormArray();
3353
+ if (!this.showCategory) {
3354
+ this.removeColumn('categoryName');
3355
+ }
3356
+ if (!this.showPrice) {
3357
+ this.removeColumn('price');
3358
+ }
3359
+ if (!this.showSubcategory) {
3360
+ this.removeColumn('subCategory');
3361
+ }
3362
+ if (!this.showQuantity) {
3363
+ this.removeColumn('Quantity');
3364
+ }
3365
+ if (!this.showSkuNumber) {
3366
+ this.removeColumn('skuNumber');
3367
+ }
3368
+ }
3369
+ removeColumn(columnName) {
3370
+ this.showAllproductsColumns = this.showAllproductsColumns.filter(column => column !== columnName);
3371
+ this.addProductsColumns = this.addProductsColumns.filter(column => column !== columnName);
3372
+ }
3373
+ initializeFormArray() {
3374
+ const selectedProductsArray = this.form.get('selectedProducts');
3375
+ this.selection.selected.forEach(product => {
3376
+ selectedProductsArray.push(this.fb.group({
3377
+ price: [product.price || '', Validators.required],
3378
+ text: [product.text || ''],
3379
+ quantity: [product.quantity || '', Validators.required],
3380
+ category: [product?.category || ''],
3381
+ subCategory: [product?.subCategory || ''],
3382
+ value: [product?.value || ''],
3383
+ skuNumber: [product?.value || '']
3384
+ }));
3385
+ });
3386
+ selectedProductsArray.controls.forEach(control => {
3387
+ control.get('price')?.disable();
3388
+ });
3389
+ this.selectedDataSource.data = [...this.selection.selected];
3390
+ }
3391
+ initializeDataSources() {
3392
+ // Ensure selected items are marked in the main data source
3393
+ if (this.selection?.selected?.length) {
3394
+ this.selection?.selected?.forEach(selectedProduct => {
3395
+ const index = this.dataSource.data.findIndex(product => product.value === selectedProduct.value);
3396
+ if (index >= 0) {
3397
+ this.dataSource.data[index] = selectedProduct;
3398
+ }
3399
+ });
3400
+ this.selectedDataSource.data = [...this.selection.selected];
3401
+ }
3402
+ else {
3403
+ console.warn('No selected products found.');
3404
+ }
3405
+ }
3406
+ ngAfterViewInit() {
3407
+ }
3408
+ ngOnInit() {
3409
+ // this.loadProductCategory();
3410
+ this.loadDropdownL1();
3411
+ this.form.get('dropdownLevel1').valueChanges
3412
+ .pipe(startWith(''), map(value => this.filterProducts(value, 'category1'))).subscribe(l1 => {
3413
+ this.filteredDropdownOne = l1;
3414
+ });
3415
+ this.form.get('dropdownLevel2').valueChanges
3416
+ .pipe(startWith(''), map(value => this.filterProducts(value, 'category2'))).subscribe(l2 => {
3417
+ this.filteredDropdownTwo = l2;
3418
+ });
3419
+ this.form.get('dropdownLevel3').valueChanges
3420
+ .pipe(startWith(''), map(value => this.filterProducts(value, 'category3'))).subscribe(l3 => {
3421
+ this.filteredDropdownThree = l3;
3422
+ });
3423
+ this.form.get('dropdownLevel4').valueChanges
3424
+ .pipe(startWith(''), map(value => this.filterProducts(value, 'category4'))).subscribe(l4 => {
3425
+ this.filteredDropdownFour = l4;
3426
+ });
3427
+ }
3428
+ handleDropdownFilter() {
3429
+ if (this.form.controls.dropdownLevel1.value !== '' || this.form.controls.searchProductName.value !== '') {
3430
+ this.searchQuery = this.form.controls.searchProductName?.value;
3431
+ this.levelOneId = this.form.controls.dropdownLevel1.value?.id;
3432
+ this.levelTwoId = this.form.controls.dropdownLevel2.value?.id;
3433
+ this.levelThreeId = this.form.controls.dropdownLevel3.value?.id;
3434
+ this.levelFourId = this.form.controls.dropdownLevel4.value?.id;
3435
+ this.getProducts(false);
3436
+ }
3437
+ }
3438
+ loadDropdownL1() {
3439
+ this.spinnerFlag = true;
3440
+ this.commonSevice.productLevelOne().subscribe(response => {
3441
+ this.spinnerFlag = false;
3442
+ if (response && response.code === 200) {
3443
+ this.dropdownOne = response.data;
3444
+ this.filteredDropdownOne = this.filterProducts('', 'category1');
3445
+ }
3446
+ });
3447
+ }
3448
+ loadDropdownL2(levelOneId) {
3449
+ this.spinnerFlag = true;
3450
+ this.commonSevice.productLevelTwo(levelOneId).subscribe(response => {
3451
+ this.spinnerFlag = false;
3452
+ if (response && response.code === 200) {
3453
+ this.dropdownTwo = response.data;
3454
+ this.filteredDropdownTwo = this.filterProducts('', 'category2');
3455
+ }
3456
+ });
3457
+ }
3458
+ loadDropdownL3(levelOneId, levelTwoId) {
3459
+ this.spinnerFlag = true;
3460
+ this.commonSevice.productLevelThree(levelOneId, levelTwoId).subscribe(response => {
3461
+ this.spinnerFlag = false;
3462
+ if (response && response.code === 200) {
3463
+ this.dropdownThree = response.data;
3464
+ this.filteredDropdownThree = this.filterProducts('', 'category3');
3465
+ }
3466
+ });
3467
+ }
3468
+ loadDropdownL4(levelOneId, levelTwoId, levelThreeId) {
3469
+ this.spinnerFlag = true;
3470
+ this.commonSevice.productLevelFour(levelOneId, levelTwoId, levelThreeId).subscribe(response => {
3471
+ this.spinnerFlag = false;
3472
+ if (response && response.code === 200) {
3473
+ this.dropdownFour = response.data;
3474
+ this.filteredDropdownFour = this.filterProducts('', 'category4');
3475
+ }
3476
+ });
3477
+ }
3478
+ filterProducts(value, cat) {
3479
+ const filterValue = typeof value === 'string' ? value?.toLowerCase() : value;
3480
+ let data;
3481
+ // Dynamically assign the data array based on the category
3482
+ switch (cat) {
3483
+ case 'category1':
3484
+ data = this.dropdownOne;
3485
+ break;
3486
+ case 'category2':
3487
+ data = this.dropdownTwo;
3488
+ break;
3489
+ case 'category3':
3490
+ data = this.dropdownThree;
3491
+ break;
3492
+ case 'category4':
3493
+ data = this.dropdownFour;
3494
+ break;
3495
+ default:
3496
+ data = [];
3497
+ }
3498
+ if (!filterValue) {
3499
+ return data;
3500
+ }
3501
+ else {
3502
+ return data?.filter(option => option['name']?.toLowerCase().includes(filterValue));
3503
+ }
3504
+ }
3505
+ onSubmit() {
3506
+ if (this.form.valid) {
3507
+ this.matDialogRef.close({
3508
+ data: {
3509
+ status: true,
3510
+ items: this.form.getRawValue()
3511
+ }
3512
+ });
3513
+ }
3514
+ }
3515
+ isAllSelected() {
3516
+ const numSelected = this.selection.selected.length;
3517
+ const numRows = this.dataSource.data.length;
3518
+ return numSelected === numRows;
3519
+ }
3520
+ isIndeterminate() {
3521
+ const numSelected = this.selection.selected.length;
3522
+ const numRows = this.dataSource.data.length;
3523
+ return numSelected > 0 && numSelected < numRows;
3524
+ }
3525
+ masterToggle() {
3526
+ this.isAllSelected()
3527
+ ? this.selection.clear()
3528
+ : this.dataSource.data.forEach(row => this.selection.select(row));
3529
+ this.updateSelectedProducts();
3530
+ }
3531
+ toggleSelection(row) {
3532
+ this.selection.toggle(row);
3533
+ this.updateSelectedProducts();
3534
+ }
3535
+ // Getter for the FormArray
3536
+ get selectedProducts() {
3537
+ return this.form.get('selectedProducts');
3538
+ }
3539
+ updateSelectedProducts() {
3540
+ if (Array.isArray(this.selection.selected)) {
3541
+ this.selectedDataSource.data = [...this.selection.selected];
3542
+ const selectedProductsArray = this.selectedProducts;
3543
+ selectedProductsArray.clear();
3544
+ this.selection?.selected?.forEach(product => {
3545
+ selectedProductsArray?.push(this.fb.group({
3546
+ price: [product?.price ?? '', this.showPrice ? Validators.required : []],
3547
+ text: [product?.text || ''],
3548
+ quantity: [product?.quantity ?? '', this.showQuantity ? Validators.required : []],
3549
+ category: [product?.category || ''],
3550
+ subCategory: [product?.subCategory || ''],
3551
+ value: [product?.value || ''],
3552
+ skuNumber: [product?.value || '']
3553
+ }));
3554
+ });
3555
+ selectedProductsArray.controls.forEach(control => {
3556
+ control.get('price')?.disable();
3557
+ });
3558
+ }
3559
+ else {
3560
+ console.error('Selection.selected is not an array:', this.selection.selected);
3561
+ }
3562
+ }
3563
+ getTotalRows() {
3564
+ return this.dataSource.data.length;
3565
+ }
3566
+ getSelectedRowsCount() {
3567
+ return this.selection.selected.length;
3568
+ }
3569
+ onOptionSelected(event, category) {
3570
+ let selectedValue;
3571
+ if (event && event.option && event.option.value !== undefined) {
3572
+ selectedValue = event.option.value.id;
3573
+ }
3574
+ else {
3575
+ selectedValue = event;
3576
+ }
3577
+ if (category === 'category1') {
3578
+ this.levelOneId = selectedValue;
3579
+ this.form.get('dropdownLevel2').setValue(null);
3580
+ this.form.get('dropdownLevel3').setValue(null);
3581
+ this.form.get('dropdownLevel4').setValue(null);
3582
+ this.filteredDropdownTwo = [];
3583
+ this.filteredDropdownThree = [];
3584
+ this.filteredDropdownFour = [];
3585
+ if (this.dropdownL2) {
3586
+ this.loadDropdownL2(this.levelOneId);
3587
+ }
3588
+ }
3589
+ if (category === 'category2') {
3590
+ this.levelTwoId = selectedValue;
3591
+ this.form.get('dropdownLevel3').setValue(null);
3592
+ this.form.get('dropdownLevel4').setValue(null);
3593
+ this.filteredDropdownThree = [];
3594
+ this.filteredDropdownFour = [];
3595
+ if (this.dropdownL3) {
3596
+ this.loadDropdownL3(this.levelOneId, this.levelTwoId);
3597
+ }
3598
+ }
3599
+ if (category === 'category3') {
3600
+ this.levelThreeId = selectedValue;
3601
+ this.form.get('dropdownLevel4').setValue(null);
3602
+ this.filteredDropdownFour = [];
3603
+ if (this.dropdownL4) {
3604
+ this.loadDropdownL4(this.levelOneId, this.levelTwoId, this.levelThreeId);
3605
+ }
3606
+ }
3607
+ if (category === 'category4') {
3608
+ this.levelFourId = selectedValue;
3609
+ }
3610
+ }
3611
+ getProducts(flag) {
3612
+ this.spinnerFlag = true;
3613
+ const search = this.searchQuery;
3614
+ this.commonSevice.loadProducts(this.pageNumber, this.pageSize, search, true, false, this.levelOneId, this.levelTwoId, this.levelThreeId, this.levelFourId).subscribe(response => {
3615
+ this.spinnerFlag = false;
3616
+ if (response && response.code === 200) {
3617
+ this.totalPages = response?.data?.totalPages;
3618
+ const data = response.data.dataSource;
3619
+ if (this.dataSource.data.length > 0 && flag) {
3620
+ data.forEach(item => this.dataSource.data.push(item));
3621
+ this.dataSource.data = [...this.dataSource.data, ...data];
3622
+ }
3623
+ else {
3624
+ this.dataSource.data = data;
3625
+ }
3626
+ this.loadingFlag = true;
3627
+ setTimeout(() => {
3628
+ const middlePosition = this.trackHeight / 2 - 50;
3629
+ if (this.firstscrollableDiv && this.firstscrollableDiv.nativeElement) {
3630
+ this.firstscrollableDiv.nativeElement.scrollTo({ top: middlePosition, behavior: 'auto' });
3631
+ }
3632
+ }, 250);
3633
+ this.initializeDataSources();
3634
+ }
3635
+ });
3636
+ }
3637
+ removeRow(event, element) {
3638
+ event.stopPropagation();
3639
+ event.preventDefault();
3640
+ let message = 'Are you sure you want to delete this product?';
3641
+ let showButton = true;
3642
+ const index = this.selectedDataSource.data.indexOf(element);
3643
+ if (index >= 0) {
3644
+ if (this.selectedDataSource.data.length === 1) {
3645
+ message = 'Please select at least one product.';
3646
+ showButton = false;
3647
+ }
3648
+ const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
3649
+ disableClose: true,
3650
+ width: '90%',
3651
+ maxWidth: '400px',
3652
+ data: { message: message, buttonStatus: showButton }
3653
+ });
3654
+ dialogRef.afterClosed().subscribe(result => {
3655
+ if (result) {
3656
+ this.selectedDataSource.data.splice(index, 1);
3657
+ this.selectedDataSource._updateChangeSubscription();
3658
+ this.selection.deselect(element);
3659
+ const selectedProductsArray = this.form.get('selectedProducts');
3660
+ const productIndex = selectedProductsArray.controls.findIndex(control => control.value.productName === element.productName);
3661
+ if (productIndex >= 0) {
3662
+ selectedProductsArray.removeAt(productIndex);
3663
+ }
3664
+ }
3665
+ });
3666
+ }
3667
+ }
3668
+ onScroll(event) {
3669
+ this.trackHeight = event.target.scrollHeight - event.target.offsetHeight;
3670
+ if (this.loadingFlag && (Math.floor(event.target.scrollTop / this.trackHeight * 100) > 50)) {
3671
+ this.loadingFlag = false;
3672
+ if (this.pageNumber < this.totalPages) {
3673
+ this.pageNumber = this.pageNumber + 1;
3674
+ this.getProducts(true);
3675
+ }
3676
+ else {
3677
+ this.loadingFlag = true;
3678
+ }
3679
+ }
3680
+ this.prevScrollPosition = event.target.scrollTop;
3681
+ }
3682
+ countTrueDropdowns(obj) {
3683
+ // Dynamically find all keys that start with 'dropdownL' and are boolean (true/false)
3684
+ return Object.keys(obj)
3685
+ .filter(key => key.startsWith('dropdownL') && typeof obj[key] === 'boolean' && obj[key] === true)
3686
+ .length;
3687
+ }
3688
+ /* Use the property that should display in the input field */
3689
+ displayFn(option) {
3690
+ return option ? option.name : '';
3691
+ }
3692
+ }
3693
+ 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 });
3694
+ AddOnProductsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: AddOnProductsComponent, selector: "ngx-mat-add-on-products", viewQueries: [{ propertyName: "firstscrollableDiv", first: true, predicate: ["firstscrollableDiv"], descendants: true }], ngImport: i0, template: "<div *ngIf=\"spinnerFlag\" class=\"OverlayDiv\">\r\n <div class=\"OverlayDivContent\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n</div>\r\n<div class=\"product-selector\" mat-dialog-content>\r\n <mat-stepper labelPosition=\"bottom\" #stepper>\r\n <mat-step [stepControl]=\"form\">\r\n <form [formGroup]=\"form\">\r\n <ng-template matStepLabel>Select Products</ng-template>\r\n <div class=\"product-selection-container\">\r\n <!-- <h3>Select Products</h3> -->\r\n <p class=\"product-selection-desc\">Your ideal match is just a few preferences away. Start discovering now!</p>\r\n <mat-form-field class=\"global-search\" appearance=\"outline\">\r\n <mat-icon matPrefix class=\"material-symbols-outlined product-picker-icon\">search</mat-icon>\r\n <input matInput placeholder=\"Search Product Name\" formControlName=\"searchProductName\" />\r\n </mat-form-field>\r\n <div class=\"dropdown-selection\">\r\n <div [ngClass]=\"dropDownCount === 1 ? 'no-child': 'child'\">\r\n <div class=\"row\">\r\n <mat-form-field *ngIf=\"dropdownL1\">\r\n <mat-label>{{dropdownL1Label}}</mat-label>\r\n <input type=\"text\" matInput formControlName=\"dropdownLevel1\"\r\n [matAutocomplete]=\"auto3\">\r\n <mat-autocomplete [displayWith]=\"displayFn\" #auto3=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category1')\">\r\n <mat-option *ngFor=\"let option of filteredDropdownOne\"\r\n [value]=\"option\">{{option.name}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n <mat-form-field *ngIf=\"dropdownL2\">\r\n <mat-label>{{dropdownL2Label}}</mat-label>\r\n <input type=\"text\" matInput formControlName=\"dropdownLevel2\"\r\n [matAutocomplete]=\"auto4\">\r\n <mat-autocomplete [displayWith]=\"displayFn\" #auto4=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category2')\">\r\n <mat-option *ngFor=\"let option of filteredDropdownTwo\"\r\n [value]=\"option\">{{option.name}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n <mat-form-field *ngIf=\"dropdownL3\">\r\n <mat-label>{{dropdownL3Label}}</mat-label>\r\n <input type=\"text\" matInput formControlName=\"dropdownLevel3\"\r\n [matAutocomplete]=\"auto3\">\r\n <mat-autocomplete [displayWith]=\"displayFn\" #auto3=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category3')\">\r\n <mat-option *ngFor=\"let option of filteredDropdownThree\"\r\n [value]=\"option\">{{option.name}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n <mat-form-field *ngIf=\"dropdownL4\">\r\n <mat-label>{{dropdownL4Label}}</mat-label>\r\n <input type=\"text\" matInput formControlName=\"dropdownLevel4\"\r\n [matAutocomplete]=\"auto4\">\r\n <mat-autocomplete [displayWith]=\"displayFn\" #auto4=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category4')\">\r\n <mat-option *ngFor=\"let option of filteredDropdownFour\"\r\n [value]=\"option\">{{option.name}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </div>\r\n <!-- Search Button -->\r\n <div fxLayout=\"row\" fxLayoutAlign=\"left\" class=\"margin-top search-btn-wrp\">\r\n <button mat-button color=\"primary\" mat-raised-button\r\n (click)=\"handleDropdownFilter();$event.stopPropagation();\">Search</button>\r\n </div>\r\n </div>\r\n <div #firstscrollableDiv id=\"firstscrollableDiv\" class=\"new-class first-div\"\r\n (scroll)=\"onScroll($event)\">\r\n <table mat-table [dataSource]=\"dataSource\" class=\"mat-table abc\"\r\n *ngIf=\"dataSource && dataSource.data.length > 0; else noData\">\r\n <ng-container matColumnDef=\"select\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox color=\"primary\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"$event ? toggleSelection(row) : null\"\r\n [checked]=\"selection.isSelected(row)\"></mat-checkbox>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"productName\">\r\n <th mat-header-cell *matHeaderCellDef> Product Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element?.text}} </td>\r\n </ng-container>\r\n <!-- <ng-container matColumnDef=\"price\" *ngIf=\"showPrice\">\r\n <th mat-header-cell *matHeaderCellDef> Price </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element?.price}} </td>\r\n </ng-container> -->\r\n <ng-container matColumnDef=\"skuNumber\" *ngIf=\"showSkuNumber\">\r\n <th mat-header-cell *matHeaderCellDef> SKU Number </th>\r\n <td mat-cell *matCellDef=\"let element\"> #SkuNumber-{{element?.value}} </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"addProductsColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: addProductsColumns;\"></tr>\r\n </table>\r\n <ng-template #noData>\r\n <div class=\"no-data-message\">\r\n No data found.\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div class=\"row-summary\">\r\n <p>Rows: {{ getTotalRows() }} Selected: {{ getSelectedRowsCount() }}</p>\r\n </div>\r\n <div class=\"tabs-action-step-one\">\r\n <button mat-button matStepperNext\r\n [disabled]=\"selection.selected.length ? false : true\" color=\"primary\" mat-raised-button>Next</button>\r\n <button mat-button [mat-dialog-close]=\"false\">Cancel</button>\r\n </div>\r\n </form>\r\n </mat-step>\r\n <mat-step [stepControl]=\"form\">\r\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\r\n <ng-template matStepLabel>Edit/Save</ng-template>\r\n <div class=\"new-class\">\r\n <table mat-table [dataSource]=\"selectedDataSource\"\r\n *ngIf=\"selectedDataSource && selectedDataSource.data.length > 0; else showBlank\">\r\n <ng-container matColumnDef=\"delete\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button class=\"delete-btn-picker\" mat-button (click)=\"$event.stopPropagation();removeRow($event, element)\">\r\n <mat-icon aria-hidden=\"false\" aria-label=\"Remove row\">delete</mat-icon>\r\n </button>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"productName\">\r\n <th mat-header-cell *matHeaderCellDef> Product Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.text}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"categoryName\" *ngIf=\"showCategory\">\r\n <th mat-header-cell *matHeaderCellDef> Category Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.category}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"subCategory\" *ngIf=\"showSubcategory\">\r\n <th mat-header-cell *matHeaderCellDef>Sub Category </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.subCategory}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"price\" *ngIf=\"showPrice\">\r\n <th mat-header-cell *matHeaderCellDef>Price</th>\r\n <td mat-cell *matCellDef=\"let element; let i = index\">\r\n <mat-form-field class=\"example-full-width select-price\">\r\n <mat-label>Price</mat-label>\r\n <input matInput [formControl]=\"selectedProducts.at(i).get('price')\"\r\n placeholder=\"Please enter price\">\r\n <mat-error *ngIf=\"selectedProducts.at(i).get('price').hasError('required')\">\r\n Price is required\r\n </mat-error>\r\n </mat-form-field>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"Quantity\" *ngIf=\"showQuantity\">\r\n <th mat-header-cell *matHeaderCellDef> Quantity </th>\r\n <td mat-cell *matCellDef=\"let element; let i = index\">\r\n <mat-form-field class=\"example-full-width select-qunatity\">\r\n <mat-label>Select quantity</mat-label>\r\n <input matInput [formControl]=\"selectedProducts.at(i).get('quantity')\"\r\n placeholder=\"Please enter quantity\">\r\n <mat-error *ngIf=\"selectedProducts.at(i).get('quantity').hasError('required')\">\r\n Quantity is required\r\n </mat-error>\r\n </mat-form-field>\r\n </td>\r\n </ng-container>\r\n showSkuNumber={{showSkuNumber}}\r\n <ng-container matColumnDef=\"skuNumber\" *ngIf=\"showSkuNumber\">\r\n <th mat-header-cell *matHeaderCellDef> SKU Number </th>\r\n <td mat-cell *matCellDef=\"let element\">#SkuNumber-{{element?.value}} </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"showAllproductsColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: showAllproductsColumns;\"></tr>\r\n </table>\r\n <ng-template #showBlank>\r\n <div class=\"no-data-message\">\r\n No data found.\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div class=\"tabs-action\">\r\n <div class=\"tab-action-wrp\">\r\n <button mat-button matStepperPrevious>Back</button>\r\n </div>\r\n \r\n <div class=\"tab-action-wrp\">\r\n <button mat-button matStepperNext type=\"submit\" color=\"primary\" mat-raised-button>Add products</button>\r\n </div>\r\n </div>\r\n </form>\r\n </mat-step>\r\n </mat-stepper>\r\n</div>", styles: [".dropdown-section{display:flex;flex-direction:column;gap:16px}.form-row{display:flex;gap:16px}mat-form-field{flex:1}.new-class{margin:20px 0;border:1px solid #ddd;border-radius:5px}.mat-column-select{width:50px;text-align:center}.mat-header-cell,.mat-cell{text-align:center}button{align-self:flex-end;margin-top:20px}.row-summary{margin-top:20px;font-weight:700}.new-class td{border:1px solid #ddd;padding:10px}.new-class th{background-color:#f2f2f2;position:-webkit-sticky;position:sticky;top:0;transform:none;z-index:99;padding:10px}table{width:100%;border-collapse:collapse}.select-qunatity,.select-price{width:110px}.no-data-message{text-align:center;margin:20px 0;font-size:18px;color:#888}.mat-step-header.cdk-keyboard-focused,.mat-step-header.cdk-program-focused,.mat-step-header:hover:not([aria-disabled]),.mat-step-header:hover[aria-disabled=false]{background-color:transparent}.OverlayDiv{position:fixed;display:block;width:100%;height:100%;top:0;left:0;right:0;bottom:0;background-color:#00000080;z-index:500;cursor:pointer}.OverlayDivContent{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%)}.product-selection-container{max-width:800px;margin:0 auto;text-align:center}.global-search{width:100%;margin-bottom:20px}.dropdown-selection{display:flex;flex-direction:column;width:100%}.row{display:flex;justify-content:space-between;width:100%;margin-bottom:20px;flex-wrap:wrap}.dropdown-item{flex:1;margin-right:10px}.dropdown-item:last-child{margin-right:0}.scrollable-div{max-height:350px;overflow-y:auto;margin-top:20px;margin-bottom:20px}.mat-table{width:100%;border-collapse:collapse}.dropdown-selection>div{display:flex;justify-content:space-between;border:1px solid #ddd;border-radius:5px;padding:20px;flex-wrap:wrap}.mat-form-field:last-child{margin-right:0}.search-btn-wrp{justify-content:flex-start}.no-child .mat-form-field{width:100%}.child .mat-form-field{flex:0 0 calc(50% - 20px)}.delete-btn-picker .mat-icon{color:#e53935!important;font-size:24px;width:auto;height:auto}.delete-btn-picker{margin:0}.product-selection-desc{text-align:left}.tabs-action{display:flex;justify-content:space-between}.tabs-action-step-one{justify-content:flex-end;display:flex}::ng-deep .product-selection-container .mat-form-field-infix{padding:10px 4px 17px!important}::ng-deep .product-selection-container .mat-form-field-flex{align-items:center}::ng-deep .product-selection-container .product-picker-icon{font-size:18px;width:auto;height:auto;color:#0000004d}::ng-deep .product-selection-container .mat-form-field-appearance-outline .mat-form-field-outline-thick,::ng-deep .product-selection-container .mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick{color:#0000001f}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.MatError, selector: "mat-error", inputs: ["id"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatPrefix, selector: "[matPrefix]" }, { kind: "directive", type: i4$2.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i4$5.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i10$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i10$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i10$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i10$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i10$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i10$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i10$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i10$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i10$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i10$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i11.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i5.DefaultLayoutAlignDirective, selector: " [fxLayoutAlign], [fxLayoutAlign.xs], [fxLayoutAlign.sm], [fxLayoutAlign.md], [fxLayoutAlign.lg], [fxLayoutAlign.xl], [fxLayoutAlign.lt-sm], [fxLayoutAlign.lt-md], [fxLayoutAlign.lt-lg], [fxLayoutAlign.lt-xl], [fxLayoutAlign.gt-xs], [fxLayoutAlign.gt-sm], [fxLayoutAlign.gt-md], [fxLayoutAlign.gt-lg]", inputs: ["fxLayoutAlign", "fxLayoutAlign.xs", "fxLayoutAlign.sm", "fxLayoutAlign.md", "fxLayoutAlign.lg", "fxLayoutAlign.xl", "fxLayoutAlign.lt-sm", "fxLayoutAlign.lt-md", "fxLayoutAlign.lt-lg", "fxLayoutAlign.lt-xl", "fxLayoutAlign.gt-xs", "fxLayoutAlign.gt-sm", "fxLayoutAlign.gt-md", "fxLayoutAlign.gt-lg"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "component", type: i15.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "directive", type: i15.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: i15.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }, { kind: "directive", type: i15.MatStepperNext, selector: "button[matStepperNext]", inputs: ["type"] }, { kind: "directive", type: i15.MatStepperPrevious, selector: "button[matStepperPrevious]", inputs: ["type"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: i16.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i16.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }] });
3695
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AddOnProductsComponent, decorators: [{
3696
+ type: Component,
3697
+ args: [{ selector: 'ngx-mat-add-on-products', template: "<div *ngIf=\"spinnerFlag\" class=\"OverlayDiv\">\r\n <div class=\"OverlayDivContent\">\r\n <mat-spinner></mat-spinner>\r\n </div>\r\n</div>\r\n<div class=\"product-selector\" mat-dialog-content>\r\n <mat-stepper labelPosition=\"bottom\" #stepper>\r\n <mat-step [stepControl]=\"form\">\r\n <form [formGroup]=\"form\">\r\n <ng-template matStepLabel>Select Products</ng-template>\r\n <div class=\"product-selection-container\">\r\n <!-- <h3>Select Products</h3> -->\r\n <p class=\"product-selection-desc\">Your ideal match is just a few preferences away. Start discovering now!</p>\r\n <mat-form-field class=\"global-search\" appearance=\"outline\">\r\n <mat-icon matPrefix class=\"material-symbols-outlined product-picker-icon\">search</mat-icon>\r\n <input matInput placeholder=\"Search Product Name\" formControlName=\"searchProductName\" />\r\n </mat-form-field>\r\n <div class=\"dropdown-selection\">\r\n <div [ngClass]=\"dropDownCount === 1 ? 'no-child': 'child'\">\r\n <div class=\"row\">\r\n <mat-form-field *ngIf=\"dropdownL1\">\r\n <mat-label>{{dropdownL1Label}}</mat-label>\r\n <input type=\"text\" matInput formControlName=\"dropdownLevel1\"\r\n [matAutocomplete]=\"auto3\">\r\n <mat-autocomplete [displayWith]=\"displayFn\" #auto3=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category1')\">\r\n <mat-option *ngFor=\"let option of filteredDropdownOne\"\r\n [value]=\"option\">{{option.name}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n <mat-form-field *ngIf=\"dropdownL2\">\r\n <mat-label>{{dropdownL2Label}}</mat-label>\r\n <input type=\"text\" matInput formControlName=\"dropdownLevel2\"\r\n [matAutocomplete]=\"auto4\">\r\n <mat-autocomplete [displayWith]=\"displayFn\" #auto4=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category2')\">\r\n <mat-option *ngFor=\"let option of filteredDropdownTwo\"\r\n [value]=\"option\">{{option.name}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n <mat-form-field *ngIf=\"dropdownL3\">\r\n <mat-label>{{dropdownL3Label}}</mat-label>\r\n <input type=\"text\" matInput formControlName=\"dropdownLevel3\"\r\n [matAutocomplete]=\"auto3\">\r\n <mat-autocomplete [displayWith]=\"displayFn\" #auto3=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category3')\">\r\n <mat-option *ngFor=\"let option of filteredDropdownThree\"\r\n [value]=\"option\">{{option.name}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n\r\n <mat-form-field *ngIf=\"dropdownL4\">\r\n <mat-label>{{dropdownL4Label}}</mat-label>\r\n <input type=\"text\" matInput formControlName=\"dropdownLevel4\"\r\n [matAutocomplete]=\"auto4\">\r\n <mat-autocomplete [displayWith]=\"displayFn\" #auto4=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category4')\">\r\n <mat-option *ngFor=\"let option of filteredDropdownFour\"\r\n [value]=\"option\">{{option.name}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n </div>\r\n <!-- Search Button -->\r\n <div fxLayout=\"row\" fxLayoutAlign=\"left\" class=\"margin-top search-btn-wrp\">\r\n <button mat-button color=\"primary\" mat-raised-button\r\n (click)=\"handleDropdownFilter();$event.stopPropagation();\">Search</button>\r\n </div>\r\n </div>\r\n <div #firstscrollableDiv id=\"firstscrollableDiv\" class=\"new-class first-div\"\r\n (scroll)=\"onScroll($event)\">\r\n <table mat-table [dataSource]=\"dataSource\" class=\"mat-table abc\"\r\n *ngIf=\"dataSource && dataSource.data.length > 0; else noData\">\r\n <ng-container matColumnDef=\"select\">\r\n <th mat-header-cell *matHeaderCellDef>\r\n </th>\r\n <td mat-cell *matCellDef=\"let row\">\r\n <mat-checkbox color=\"primary\" (click)=\"$event.stopPropagation()\"\r\n (change)=\"$event ? toggleSelection(row) : null\"\r\n [checked]=\"selection.isSelected(row)\"></mat-checkbox>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"productName\">\r\n <th mat-header-cell *matHeaderCellDef> Product Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element?.text}} </td>\r\n </ng-container>\r\n <!-- <ng-container matColumnDef=\"price\" *ngIf=\"showPrice\">\r\n <th mat-header-cell *matHeaderCellDef> Price </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element?.price}} </td>\r\n </ng-container> -->\r\n <ng-container matColumnDef=\"skuNumber\" *ngIf=\"showSkuNumber\">\r\n <th mat-header-cell *matHeaderCellDef> SKU Number </th>\r\n <td mat-cell *matCellDef=\"let element\"> #SkuNumber-{{element?.value}} </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"addProductsColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: addProductsColumns;\"></tr>\r\n </table>\r\n <ng-template #noData>\r\n <div class=\"no-data-message\">\r\n No data found.\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div class=\"row-summary\">\r\n <p>Rows: {{ getTotalRows() }} Selected: {{ getSelectedRowsCount() }}</p>\r\n </div>\r\n <div class=\"tabs-action-step-one\">\r\n <button mat-button matStepperNext\r\n [disabled]=\"selection.selected.length ? false : true\" color=\"primary\" mat-raised-button>Next</button>\r\n <button mat-button [mat-dialog-close]=\"false\">Cancel</button>\r\n </div>\r\n </form>\r\n </mat-step>\r\n <mat-step [stepControl]=\"form\">\r\n <form [formGroup]=\"form\" (ngSubmit)=\"onSubmit()\">\r\n <ng-template matStepLabel>Edit/Save</ng-template>\r\n <div class=\"new-class\">\r\n <table mat-table [dataSource]=\"selectedDataSource\"\r\n *ngIf=\"selectedDataSource && selectedDataSource.data.length > 0; else showBlank\">\r\n <ng-container matColumnDef=\"delete\">\r\n <th mat-header-cell *matHeaderCellDef></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button class=\"delete-btn-picker\" mat-button (click)=\"$event.stopPropagation();removeRow($event, element)\">\r\n <mat-icon aria-hidden=\"false\" aria-label=\"Remove row\">delete</mat-icon>\r\n </button>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"productName\">\r\n <th mat-header-cell *matHeaderCellDef> Product Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.text}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"categoryName\" *ngIf=\"showCategory\">\r\n <th mat-header-cell *matHeaderCellDef> Category Name </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.category}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"subCategory\" *ngIf=\"showSubcategory\">\r\n <th mat-header-cell *matHeaderCellDef>Sub Category </th>\r\n <td mat-cell *matCellDef=\"let element\"> {{element.subCategory}} </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"price\" *ngIf=\"showPrice\">\r\n <th mat-header-cell *matHeaderCellDef>Price</th>\r\n <td mat-cell *matCellDef=\"let element; let i = index\">\r\n <mat-form-field class=\"example-full-width select-price\">\r\n <mat-label>Price</mat-label>\r\n <input matInput [formControl]=\"selectedProducts.at(i).get('price')\"\r\n placeholder=\"Please enter price\">\r\n <mat-error *ngIf=\"selectedProducts.at(i).get('price').hasError('required')\">\r\n Price is required\r\n </mat-error>\r\n </mat-form-field>\r\n </td>\r\n </ng-container>\r\n\r\n <ng-container matColumnDef=\"Quantity\" *ngIf=\"showQuantity\">\r\n <th mat-header-cell *matHeaderCellDef> Quantity </th>\r\n <td mat-cell *matCellDef=\"let element; let i = index\">\r\n <mat-form-field class=\"example-full-width select-qunatity\">\r\n <mat-label>Select quantity</mat-label>\r\n <input matInput [formControl]=\"selectedProducts.at(i).get('quantity')\"\r\n placeholder=\"Please enter quantity\">\r\n <mat-error *ngIf=\"selectedProducts.at(i).get('quantity').hasError('required')\">\r\n Quantity is required\r\n </mat-error>\r\n </mat-form-field>\r\n </td>\r\n </ng-container>\r\n showSkuNumber={{showSkuNumber}}\r\n <ng-container matColumnDef=\"skuNumber\" *ngIf=\"showSkuNumber\">\r\n <th mat-header-cell *matHeaderCellDef> SKU Number </th>\r\n <td mat-cell *matCellDef=\"let element\">#SkuNumber-{{element?.value}} </td>\r\n </ng-container>\r\n\r\n <tr mat-header-row *matHeaderRowDef=\"showAllproductsColumns\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: showAllproductsColumns;\"></tr>\r\n </table>\r\n <ng-template #showBlank>\r\n <div class=\"no-data-message\">\r\n No data found.\r\n </div>\r\n </ng-template>\r\n </div>\r\n <div class=\"tabs-action\">\r\n <div class=\"tab-action-wrp\">\r\n <button mat-button matStepperPrevious>Back</button>\r\n </div>\r\n \r\n <div class=\"tab-action-wrp\">\r\n <button mat-button matStepperNext type=\"submit\" color=\"primary\" mat-raised-button>Add products</button>\r\n </div>\r\n </div>\r\n </form>\r\n </mat-step>\r\n </mat-stepper>\r\n</div>", styles: [".dropdown-section{display:flex;flex-direction:column;gap:16px}.form-row{display:flex;gap:16px}mat-form-field{flex:1}.new-class{margin:20px 0;border:1px solid #ddd;border-radius:5px}.mat-column-select{width:50px;text-align:center}.mat-header-cell,.mat-cell{text-align:center}button{align-self:flex-end;margin-top:20px}.row-summary{margin-top:20px;font-weight:700}.new-class td{border:1px solid #ddd;padding:10px}.new-class th{background-color:#f2f2f2;position:-webkit-sticky;position:sticky;top:0;transform:none;z-index:99;padding:10px}table{width:100%;border-collapse:collapse}.select-qunatity,.select-price{width:110px}.no-data-message{text-align:center;margin:20px 0;font-size:18px;color:#888}.mat-step-header.cdk-keyboard-focused,.mat-step-header.cdk-program-focused,.mat-step-header:hover:not([aria-disabled]),.mat-step-header:hover[aria-disabled=false]{background-color:transparent}.OverlayDiv{position:fixed;display:block;width:100%;height:100%;top:0;left:0;right:0;bottom:0;background-color:#00000080;z-index:500;cursor:pointer}.OverlayDivContent{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%)}.product-selection-container{max-width:800px;margin:0 auto;text-align:center}.global-search{width:100%;margin-bottom:20px}.dropdown-selection{display:flex;flex-direction:column;width:100%}.row{display:flex;justify-content:space-between;width:100%;margin-bottom:20px;flex-wrap:wrap}.dropdown-item{flex:1;margin-right:10px}.dropdown-item:last-child{margin-right:0}.scrollable-div{max-height:350px;overflow-y:auto;margin-top:20px;margin-bottom:20px}.mat-table{width:100%;border-collapse:collapse}.dropdown-selection>div{display:flex;justify-content:space-between;border:1px solid #ddd;border-radius:5px;padding:20px;flex-wrap:wrap}.mat-form-field:last-child{margin-right:0}.search-btn-wrp{justify-content:flex-start}.no-child .mat-form-field{width:100%}.child .mat-form-field{flex:0 0 calc(50% - 20px)}.delete-btn-picker .mat-icon{color:#e53935!important;font-size:24px;width:auto;height:auto}.delete-btn-picker{margin:0}.product-selection-desc{text-align:left}.tabs-action{display:flex;justify-content:space-between}.tabs-action-step-one{justify-content:flex-end;display:flex}::ng-deep .product-selection-container .mat-form-field-infix{padding:10px 4px 17px!important}::ng-deep .product-selection-container .mat-form-field-flex{align-items:center}::ng-deep .product-selection-container .product-picker-icon{font-size:18px;width:auto;height:auto;color:#0000004d}::ng-deep .product-selection-container .mat-form-field-appearance-outline .mat-form-field-outline-thick,::ng-deep .product-selection-container .mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick{color:#0000001f}\n"] }]
3698
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
3699
+ type: Inject,
3700
+ args: [MAT_DIALOG_DATA]
3701
+ }] }, { type: i2.FormBuilder }, { type: i1$1.MatDialog }, { type: CommonService }]; }, propDecorators: { firstscrollableDiv: [{
3702
+ type: ViewChild,
3703
+ args: ['firstscrollableDiv']
3704
+ }] } });
3705
+
3706
+ const ELEMENT_DATA = [];
3265
3707
  class MaterialDataGridComponent extends MaterialNestedComponent {
3266
3708
  constructor(element, ref, dialog, commonService) {
3267
3709
  super(element, ref);
@@ -3270,19 +3712,114 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3270
3712
  this.dialog = dialog;
3271
3713
  this.commonService = commonService;
3272
3714
  this.dataSource = new MatTableDataSource();
3715
+ this.dataSourceNew = ELEMENT_DATA;
3716
+ this.displayedColumnsNew = ['productName', 'category', 'subCategory', 'quantity', 'price', 'skuNumber'];
3717
+ this.showNewProductPicker = false;
3718
+ this.showCategory = false;
3719
+ this.showSubcategory = false;
3720
+ this.showPrice = true;
3721
+ this.showQuantity = true;
3722
+ this.showSkuNumber = false;
3723
+ this.hasInitialized = false;
3273
3724
  this.checkSubmissionStatus = false;
3274
3725
  this.showDataGrid = true;
3275
3726
  this.hasValueAndEditMode = false;
3727
+ this.dropdownL1 = false;
3728
+ this.dropdownL2 = false;
3729
+ this.dropdownL3 = false;
3730
+ this.dropdownL4 = false;
3731
+ this.showDialogQuantity = false;
3732
+ this.showDialogPrice = false;
3733
+ this.showDialogCategory = false;
3734
+ this.showDialogSkuNumber = false;
3735
+ this.showDialogSubCategory = false;
3736
+ this.dropdownL1Label = '';
3737
+ this.dropdownL2Label = '';
3738
+ this.dropdownL3Label = '';
3739
+ this.dropdownL4Label = '';
3276
3740
  }
3277
3741
  getColumnLabel(column) {
3278
3742
  return column.label || column.key;
3279
3743
  }
3744
+ checkIsAttributeTrue(newProductPickerFlag, attributeName) {
3745
+ return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
3746
+ newProductPickerFlag[key].toLowerCase() === "true");
3747
+ }
3748
+ getLabelName(newProductPickerFlag, attributeName) {
3749
+ if (newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase())) {
3750
+ // Find the key that matches attributeName case-insensitively
3751
+ const matchingKey = Object.keys(newProductPickerFlag).find(key => key.toLocaleLowerCase() === attributeName.toLowerCase());
3752
+ // Return the value of the matching key
3753
+ return newProductPickerFlag[matchingKey];
3754
+ }
3755
+ return '';
3756
+ }
3757
+ // ngOnInit(): void {
3758
+ // }
3280
3759
  setInstance(instance) {
3760
+ //const newProductPickerFlag = instance?.component?.attributes;
3281
3761
  const checkAttribute = instance?.component?.attributes;
3762
+ this.showNewProductPicker = this.checkIsAttributeTrue(checkAttribute, "newproductpicker");
3763
+ this.showCategory = this.checkIsAttributeTrue(checkAttribute, "showCategory");
3764
+ this.showSubcategory = this.checkIsAttributeTrue(checkAttribute, "showSubcategory");
3765
+ this.showPrice = this.checkIsAttributeTrue(checkAttribute, "showPrice");
3766
+ this.showQuantity = this.checkIsAttributeTrue(checkAttribute, "showQuantity");
3767
+ this.showSkuNumber = this.checkIsAttributeTrue(checkAttribute, "showSkuNumber");
3768
+ this.showDialogQuantity = this.checkIsAttributeTrue(checkAttribute, "showDialogQuantity");
3769
+ this.showDialogPrice = this.checkIsAttributeTrue(checkAttribute, "showDialogPrice");
3770
+ this.showDialogCategory = this.checkIsAttributeTrue(checkAttribute, "showDialogCategory");
3771
+ this.showDialogSkuNumber = this.checkIsAttributeTrue(checkAttribute, "showDialogSkuNumber");
3772
+ this.showDialogSubCategory = this.checkIsAttributeTrue(checkAttribute, "showDialogSubCategory");
3773
+ const l1 = this.getLabelName(checkAttribute, "dropdownL1");
3774
+ const l2 = this.getLabelName(checkAttribute, "dropdownL2");
3775
+ const l3 = this.getLabelName(checkAttribute, "dropdownL3");
3776
+ const l4 = this.getLabelName(checkAttribute, "dropdownL4");
3777
+ this.dropdownL1 = l1 !== null && l1 !== undefined && (typeof l1 === 'string' ? l1.trim() !== "" : l1 !== "") ? true : false;
3778
+ this.dropdownL2 = l2 !== null && l2 !== undefined && (typeof l2 === 'string' ? l2.trim() !== "" : l2 !== "") ? true : false;
3779
+ this.dropdownL3 = l3 !== null && l3 !== undefined && (typeof l3 === 'string' ? l3.trim() !== "" : l3 !== "") ? true : false;
3780
+ this.dropdownL4 = l4 !== null && l4 !== undefined && (typeof l4 === 'string' ? l4.trim() !== "" : l4 !== "") ? true : false;
3781
+ if (this.dropdownL1) {
3782
+ this.dropdownL1Label = l1;
3783
+ }
3784
+ if (this.dropdownL2) {
3785
+ this.dropdownL2Label = l2;
3786
+ }
3787
+ if (this.dropdownL3) {
3788
+ this.dropdownL3Label = l3;
3789
+ }
3790
+ if (this.dropdownL4) {
3791
+ this.dropdownL4Label = l4;
3792
+ }
3282
3793
  this.checkSubmissionStatus = this.commonService.checkIsAttributeTrue(checkAttribute, 'isProductOptional');
3283
- this.hasValueAndEditMode = ((checkAttribute?.hasValue === 'yes' ?? false) && (checkAttribute?.editMode === 'true' ?? false));
3794
+ this.hasValueAndEditMode = (checkAttribute?.hasValue === 'yes') && (checkAttribute?.editMode === 'true');
3284
3795
  super.setInstance(instance);
3285
- if (this.checkSubmissionStatus && !this.hasValueAndEditMode) {
3796
+ if (this.showNewProductPicker && !this.hasInitialized) {
3797
+ if (!this.showCategory) {
3798
+ this.removeColumn('category');
3799
+ }
3800
+ if (!this.showQuantity) {
3801
+ this.removeColumn('quantity');
3802
+ }
3803
+ if (!this.showPrice) {
3804
+ this.removeColumn('price');
3805
+ }
3806
+ if (!this.showSubcategory) {
3807
+ this.removeColumn('subCategory');
3808
+ }
3809
+ if (!this.showSkuNumber) {
3810
+ this.removeColumn('skuNumber');
3811
+ }
3812
+ this.dealId = this.getLabelName(checkAttribute, "dealId");
3813
+ const storedData = localStorage.getItem(`showGridPickerProducts-${this.dealId}`) || '';
3814
+ const parsedData = JSON.parse(storedData || 'null');
3815
+ this.dataSourceNew = Array.isArray(parsedData) ? parsedData : [];
3816
+ // Set flag to true to prevent further execution
3817
+ this.hasInitialized = true;
3818
+ }
3819
+ else {
3820
+ this.dataSource.data = instance.dataValue;
3821
+ }
3822
+ if (this.checkSubmissionStatus && !this.hasValueAndEditMode && !this.showNewProductPicker) {
3286
3823
  this.showDataGrid = false;
3287
3824
  this.dataSource.data = [];
3288
3825
  }
@@ -3317,7 +3854,10 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3317
3854
  return viewContainer ? viewContainer : null;
3318
3855
  };
3319
3856
  }
3320
- addAnother() {
3857
+ removeColumn(columnName) {
3858
+ this.displayedColumnsNew = this.displayedColumnsNew.filter(column => column !== columnName);
3859
+ }
3860
+ addAnotherOld() {
3321
3861
  this.showDataGrid = true;
3322
3862
  this.checkRowsNumber();
3323
3863
  this.instance.addRow();
@@ -3326,6 +3866,44 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3326
3866
  }
3327
3867
  this.dataSource.data = [...this.dataSource.data];
3328
3868
  }
3869
+ addAnother() {
3870
+ if (this.showNewProductPicker) {
3871
+ const diologeRef = this.dialog.open(AddOnProductsComponent, {
3872
+ disableClose: true,
3873
+ width: '90%',
3874
+ maxWidth: '900px',
3875
+ autoFocus: false,
3876
+ data: { dropdownsFlag: { showNewProductPicker: this.showNewProductPicker, showDialogSubCategory: this.showDialogSubCategory, showDialogSkuNumber: this.showDialogSkuNumber, showDialogCategory: this.showDialogCategory, showDialogPrice: this.showDialogPrice, showDialogQuantity: this.showDialogQuantity, dropdownL1: this.dropdownL1, dropdownL2: this.dropdownL2, dropdownL3: this.dropdownL3, dropdownL4: this.dropdownL4, dropdownL1Label: this.dropdownL1Label, dropdownL2Label: this.dropdownL2Label, dropdownL3Label: this.dropdownL3Label, dropdownL4Label: this.dropdownL4Label }, selectedProducts: this.dataSourceNew }
3877
+ })
3878
+ .afterClosed().subscribe(response => {
3879
+ if (response?.data?.status) {
3880
+ if (!this.showCategory) {
3881
+ this.removeColumn('category');
3882
+ }
3883
+ if (!this.showQuantity) {
3884
+ this.removeColumn('quantity');
3885
+ }
3886
+ if (!this.showPrice) {
3887
+ this.removeColumn('price');
3888
+ }
3889
+ if (!this.showSubcategory) {
3890
+ this.removeColumn('subCategory');
3891
+ }
3892
+ localStorage.setItem(`selectedProducts-${this.dealId}`, JSON.stringify(response.data.items.selectedProducts));
3893
+ this.dataSourceNew = response.data.items.selectedProducts;
3894
+ this.instance.component.defaultValue = response.data.items.selectedProducts;
3895
+ }
3896
+ });
3897
+ }
3898
+ else {
3899
+ this.checkRowsNumber();
3900
+ this.instance.addRow();
3901
+ if (this.dataSource.data.length < this.instance.rows.length) {
3902
+ this.dataSource.data.push({});
3903
+ }
3904
+ this.dataSource.data = [...this.dataSource.data];
3905
+ }
3906
+ }
3329
3907
  checkRowsNumber() {
3330
3908
  while (this.instance.rows.length < this.dataSource.data.length) {
3331
3909
  this.instance.addRow();
@@ -3378,7 +3956,7 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3378
3956
  super.setValue(value);
3379
3957
  }
3380
3958
  }
3381
- MaterialDataGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$2.MatDialog }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Component });
3959
+ MaterialDataGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$1.MatDialog }, { token: CommonService }], target: i0.ɵɵFactoryTarget.Component });
3382
3960
  MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialDataGridComponent, selector: "mat-formio-datagrid", usesInheritance: true, ngImport: i0, template: `
3383
3961
  <mat-formio-form-field [instance]="instance"
3384
3962
  [componentTemplate]="componentTemplate"
@@ -3397,6 +3975,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3397
3975
  {{instance.component.addAnother || 'Add Another'}}
3398
3976
  </button>
3399
3977
  </mat-card-actions>
3978
+ <ng-container *ngIf="!showNewProductPicker">
3979
+ <div class="mat-elevation-z8">
3400
3980
  <table
3401
3981
  mat-table
3402
3982
  [dataSource]="dataSource"
@@ -3405,7 +3985,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3405
3985
  cdkDropList
3406
3986
  [cdkDropListData]="dataSource"
3407
3987
  (cdkDropListDropped)="dropTable($event)">
3408
- >
3988
+
3989
+
3409
3990
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
3410
3991
  <th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
3411
3992
  <td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
@@ -3435,6 +4016,57 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3435
4016
  <tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
3436
4017
  </div>
3437
4018
  </table>
4019
+ </div>
4020
+ </ng-container>
4021
+
4022
+ <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4023
+ <!-- Product Name Column -->
4024
+ <ng-container matColumnDef="productName">
4025
+ <th mat-header-cell *matHeaderCellDef> Product Name </th>
4026
+ <td mat-cell *matCellDef="let element"> {{element.text}} </td>
4027
+ </ng-container>
4028
+
4029
+ <!-- Quantity Column -->
4030
+ <ng-container matColumnDef="quantity" *ngIf="showQuantity">
4031
+ <th mat-header-cell *matHeaderCellDef> Quantity </th>
4032
+ <td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
4033
+ </ng-container>
4034
+
4035
+ <!-- Price Column -->
4036
+ <ng-container matColumnDef="price" *ngIf="showPrice">
4037
+ <th mat-header-cell *matHeaderCellDef> Price </th>
4038
+ <td mat-cell *matCellDef="let element"> {{element.price}} </td>
4039
+ </ng-container>
4040
+
4041
+ <!-- Category Column -->
4042
+ <ng-container matColumnDef="category" *ngIf="showCategory">
4043
+ <th mat-header-cell *matHeaderCellDef> Category </th>
4044
+ <td mat-cell *matCellDef="let element"> {{element.category}} </td>
4045
+ </ng-container>
4046
+
4047
+ <!-- Category Column -->
4048
+ <ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
4049
+ <th mat-header-cell *matHeaderCellDef> Sub Category </th>
4050
+ <td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
4051
+ </ng-container>
4052
+
4053
+ <!-- SKU Column -->
4054
+ <ng-container matColumnDef="skuNumber" *ngIf="showSkuNumber">
4055
+ <th mat-header-cell *matHeaderCellDef> SKU Number </th>
4056
+ <td mat-cell *matCellDef="let element"> #SkuNumber-{{element.value}} </td>
4057
+ </ng-container>
4058
+
4059
+ <tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
4060
+ <tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
4061
+ </table>
4062
+ <ng-template #noData>
4063
+ <div class="no-data-message" *ngIf="showNewProductPicker">
4064
+ No products found. Please add some products.
4065
+ </div>
4066
+ </ng-template>
4067
+
4068
+
4069
+
3438
4070
  </mat-card-content>
3439
4071
  <mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
3440
4072
  <button mat-raised-button color="primary" (click)="addAnother()">
@@ -3450,7 +4082,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3450
4082
  <span [instance]="instance" matFormioLabel></span>
3451
4083
  </mat-card-title>
3452
4084
  </ng-template>
3453
- `, isInline: true, styles: [".datagrid-row{height:auto}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5$3.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5$3.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5$3.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5$3.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i5$3.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5$3.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5$3.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5$3.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5$3.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5$3.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.FlexFillDirective, selector: "[fxFill], [fxFlexFill]" }, { kind: "component", type: i4.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { kind: "directive", type: i4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i4.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i9.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i9.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i9.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: FormioFormFieldComponent, selector: "mat-formio-form-field", inputs: ["labelTemplate", "renderTopLabel", "showDescription", "renderElementOnly", "instance", "componentTemplate"] }, { kind: "component", type: LabelComponent, selector: "span[matFormioLabel]", inputs: ["instance"] }] });
4085
+ `, isInline: true, styles: [".datagrid-row{height:auto}.mat-table{width:100%}.mat-header-cell,.mat-cell{padding:8px}.no-data-message{display:flex;justify-content:center;align-items:center;text-align:center;padding:20px;margin:0 20px;font-size:18px;color:#888;height:100%}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i10$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i10$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i10$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i10$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i10$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i10$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i10$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i10$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i10$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i10$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.FlexFillDirective, selector: "[fxFill], [fxFlexFill]" }, { kind: "component", type: i4.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { kind: "directive", type: i4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i4.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i9.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i9.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i9.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: FormioFormFieldComponent, selector: "mat-formio-form-field", inputs: ["labelTemplate", "renderTopLabel", "showDescription", "renderElementOnly", "instance", "componentTemplate"] }, { kind: "component", type: LabelComponent, selector: "span[matFormioLabel]", inputs: ["instance"] }] });
3454
4086
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, decorators: [{
3455
4087
  type: Component,
3456
4088
  args: [{ selector: 'mat-formio-datagrid', template: `
@@ -3471,6 +4103,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3471
4103
  {{instance.component.addAnother || 'Add Another'}}
3472
4104
  </button>
3473
4105
  </mat-card-actions>
4106
+ <ng-container *ngIf="!showNewProductPicker">
4107
+ <div class="mat-elevation-z8">
3474
4108
  <table
3475
4109
  mat-table
3476
4110
  [dataSource]="dataSource"
@@ -3479,7 +4113,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3479
4113
  cdkDropList
3480
4114
  [cdkDropListData]="dataSource"
3481
4115
  (cdkDropListDropped)="dropTable($event)">
3482
- >
4116
+
4117
+
3483
4118
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
3484
4119
  <th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
3485
4120
  <td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
@@ -3509,6 +4144,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3509
4144
  <tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
3510
4145
  </div>
3511
4146
  </table>
4147
+ </div>
4148
+ </ng-container>
4149
+
4150
+ <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4151
+ <!-- Product Name Column -->
4152
+ <ng-container matColumnDef="productName">
4153
+ <th mat-header-cell *matHeaderCellDef> Product Name </th>
4154
+ <td mat-cell *matCellDef="let element"> {{element.text}} </td>
4155
+ </ng-container>
4156
+
4157
+ <!-- Quantity Column -->
4158
+ <ng-container matColumnDef="quantity" *ngIf="showQuantity">
4159
+ <th mat-header-cell *matHeaderCellDef> Quantity </th>
4160
+ <td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
4161
+ </ng-container>
4162
+
4163
+ <!-- Price Column -->
4164
+ <ng-container matColumnDef="price" *ngIf="showPrice">
4165
+ <th mat-header-cell *matHeaderCellDef> Price </th>
4166
+ <td mat-cell *matCellDef="let element"> {{element.price}} </td>
4167
+ </ng-container>
4168
+
4169
+ <!-- Category Column -->
4170
+ <ng-container matColumnDef="category" *ngIf="showCategory">
4171
+ <th mat-header-cell *matHeaderCellDef> Category </th>
4172
+ <td mat-cell *matCellDef="let element"> {{element.category}} </td>
4173
+ </ng-container>
4174
+
4175
+ <!-- Category Column -->
4176
+ <ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
4177
+ <th mat-header-cell *matHeaderCellDef> Sub Category </th>
4178
+ <td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
4179
+ </ng-container>
4180
+
4181
+ <!-- SKU Column -->
4182
+ <ng-container matColumnDef="skuNumber" *ngIf="showSkuNumber">
4183
+ <th mat-header-cell *matHeaderCellDef> SKU Number </th>
4184
+ <td mat-cell *matCellDef="let element"> #SkuNumber-{{element.value}} </td>
4185
+ </ng-container>
4186
+
4187
+ <tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
4188
+ <tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
4189
+ </table>
4190
+ <ng-template #noData>
4191
+ <div class="no-data-message" *ngIf="showNewProductPicker">
4192
+ No products found. Please add some products.
4193
+ </div>
4194
+ </ng-template>
4195
+
4196
+
4197
+
3512
4198
  </mat-card-content>
3513
4199
  <mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
3514
4200
  <button mat-raised-button color="primary" (click)="addAnother()">
@@ -3524,8 +4210,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3524
4210
  <span [instance]="instance" matFormioLabel></span>
3525
4211
  </mat-card-title>
3526
4212
  </ng-template>
3527
- `, styles: [".datagrid-row{height:auto}\n"] }]
3528
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.MatDialog }, { type: CommonService }]; } });
4213
+ `, styles: [".datagrid-row{height:auto}.mat-table{width:100%}.mat-header-cell,.mat-cell{padding:8px}.no-data-message{display:flex;justify-content:center;align-items:center;text-align:center;padding:20px;margin:0 20px;font-size:18px;color:#888;height:100%}\n"] }]
4214
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }, { type: CommonService }]; } });
3529
4215
  DataGridComponent.MaterialComponent = MaterialDataGridComponent;
3530
4216
 
3531
4217
  var EditRowState;
@@ -3911,7 +4597,7 @@ MaterialWizardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
3911
4597
  <button *ngIf="instance.hasButton('submit')" mat-raised-button color="primary" (click)="submit()">Submit</button>
3912
4598
  </div>
3913
4599
  </mat-step>
3914
- </mat-horizontal-stepper>`, isInline: true, styles: [":host .navigation-button-row{margin-top:8px}\n", ":host .navigation-button-row button{margin-right:8px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3$3.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "component", type: i3$3.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }] });
4600
+ </mat-horizontal-stepper>`, isInline: true, styles: [":host .navigation-button-row{margin-top:8px}\n", ":host .navigation-button-row button{margin-right:8px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i15.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "component", type: i15.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }] });
3915
4601
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialWizardComponent, decorators: [{
3916
4602
  type: Component,
3917
4603
  args: [{ selector: 'mat-formio-wizard', template: `
@@ -4081,7 +4767,7 @@ FormioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
4081
4767
  <div fxLayout="column" fxLayoutGap="1em">
4082
4768
  <ng-template #formio></ng-template>
4083
4769
  </div>
4084
- `, isInline: true, styles: [".alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:.5rem;border:1px solid transparent;border-radius:.25rem}::ng-deep mat-card{box-sizing:border-box;-moz-box-sizing:border-box}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i5.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i5.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }] });
4770
+ `, isInline: true, styles: [".alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:.5rem;border:1px solid transparent;border-radius:.25rem}::ng-deep mat-card{box-sizing:border-box;-moz-box-sizing:border-box}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i11.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i5.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i5.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }] });
4085
4771
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormioComponent, decorators: [{
4086
4772
  type: Component,
4087
4773
  args: [{ selector: 'mat-formio', template: `
@@ -4151,7 +4837,8 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
4151
4837
  FormioFormFieldComponent,
4152
4838
  LabelComponent,
4153
4839
  MaskDirective,
4154
- ConfirmationDialogComponent], imports: [CommonModule,
4840
+ ConfirmationDialogComponent,
4841
+ AddOnProductsComponent], imports: [CommonModule,
4155
4842
  FormsModule,
4156
4843
  ReactiveFormsModule,
4157
4844
  MatInputModule,
@@ -4179,7 +4866,9 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
4179
4866
  ScrollingModule,
4180
4867
  NgxMatSelectSearchModule,
4181
4868
  MatDialogModule,
4182
- HttpClientModule], exports: [NgxRenderMaterialFormsComponent,
4869
+ HttpClientModule,
4870
+ MatAutocompleteModule], exports: [MatAutocompleteModule,
4871
+ NgxRenderMaterialFormsComponent,
4183
4872
  FormioComponent,
4184
4873
  MatInputModule,
4185
4874
  MatFormFieldModule,
@@ -4233,7 +4922,9 @@ NgxRenderMaterialFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.
4233
4922
  ScrollingModule,
4234
4923
  NgxMatSelectSearchModule,
4235
4924
  MatDialogModule,
4236
- HttpClientModule, MatInputModule,
4925
+ HttpClientModule,
4926
+ MatAutocompleteModule, MatAutocompleteModule,
4927
+ MatInputModule,
4237
4928
  MatFormFieldModule,
4238
4929
  MatCheckboxModule,
4239
4930
  MatRadioModule,
@@ -4301,7 +4992,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4301
4992
  FormioFormFieldComponent,
4302
4993
  LabelComponent,
4303
4994
  MaskDirective,
4304
- ConfirmationDialogComponent
4995
+ ConfirmationDialogComponent,
4996
+ AddOnProductsComponent
4305
4997
  ],
4306
4998
  imports: [
4307
4999
  CommonModule,
@@ -4332,9 +5024,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4332
5024
  ScrollingModule,
4333
5025
  NgxMatSelectSearchModule,
4334
5026
  MatDialogModule,
4335
- HttpClientModule
5027
+ HttpClientModule,
5028
+ MatAutocompleteModule
4336
5029
  ],
4337
5030
  exports: [
5031
+ MatAutocompleteModule,
4338
5032
  NgxRenderMaterialFormsComponent,
4339
5033
  FormioComponent,
4340
5034
  MatInputModule,