ngx-render-material-forms 1.6.9 → 1.7.1

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) {
@@ -3059,7 +3122,7 @@ class MaterialSelectComponent extends MaterialComponent {
3059
3122
  return _.isEqual(o1, o2);
3060
3123
  }
3061
3124
  }
3062
- 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 });
3063
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: `
3064
3127
  <mat-formio-form-field [instance]="instance" [componentTemplate]="componentTemplate"></mat-formio-form-field>
3065
3128
  <ng-template #componentTemplate let-hasLabel>
@@ -3144,7 +3207,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3144
3207
  </mat-form-field>
3145
3208
  </ng-template>
3146
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"] }]
3147
- }], 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: [{
3148
3211
  type: ViewChild,
3149
3212
  args: ['multiSelect', { static: true }]
3150
3213
  }], selectElem: [{
@@ -3203,16 +3266,444 @@ class ConfirmationDialogComponent {
3203
3266
  ngOnInit() {
3204
3267
  }
3205
3268
  }
3206
- 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 });
3207
- 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"] }] });
3208
3271
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, decorators: [{
3209
3272
  type: Component,
3210
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"] }]
3211
- }], ctorParameters: function () { return [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
3274
+ }], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
3212
3275
  type: Inject,
3213
3276
  args: [MAT_DIALOG_DATA]
3214
3277
  }] }]; } });
3215
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>\r\n <button mat-button [mat-dialog-close]=\"false\">Close</button>\r\n <button mat-button matStepperNext\r\n [disabled]=\"selection.selected.length ? false : true\">Next</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>\r\n <button mat-button matStepperPrevious>Back</button>\r\n <button mat-button matStepperNext type=\"submit\">Add products</button>\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}::ng-deep .product-selection-container .mat-form-field-infix{padding:5px 4px 12px}::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>\r\n <button mat-button [mat-dialog-close]=\"false\">Close</button>\r\n <button mat-button matStepperNext\r\n [disabled]=\"selection.selected.length ? false : true\">Next</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>\r\n <button mat-button matStepperPrevious>Back</button>\r\n <button mat-button matStepperNext type=\"submit\">Add products</button>\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}::ng-deep .product-selection-container .mat-form-field-infix{padding:5px 4px 12px}::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 = [];
3216
3707
  class MaterialDataGridComponent extends MaterialNestedComponent {
3217
3708
  constructor(element, ref, dialog, commonService) {
3218
3709
  super(element, ref);
@@ -3221,18 +3712,117 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3221
3712
  this.dialog = dialog;
3222
3713
  this.commonService = commonService;
3223
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;
3224
3724
  this.checkSubmissionStatus = false;
3225
3725
  this.showDataGrid = true;
3226
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 = '';
3227
3740
  }
3228
3741
  getColumnLabel(column) {
3229
3742
  return column.label || column.key;
3230
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
+ // }
3231
3759
  setInstance(instance) {
3760
+ //const newProductPickerFlag = instance?.component?.attributes;
3232
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
+ }
3233
3793
  this.checkSubmissionStatus = this.commonService.checkIsAttributeTrue(checkAttribute, 'isProductOptional');
3234
- this.hasValueAndEditMode = ((checkAttribute?.hasValue === 'yes' ?? false) && (checkAttribute?.editMode === 'true' ?? false));
3794
+ this.hasValueAndEditMode = (checkAttribute?.hasValue === 'yes') && (checkAttribute?.editMode === 'true');
3235
3795
  super.setInstance(instance);
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
+ if (storedData?.length) {
3815
+ this.dataSourceNew = JSON.parse(storedData);
3816
+ }
3817
+ else {
3818
+ this.dataSourceNew = [];
3819
+ }
3820
+ // Set flag to true to prevent further execution
3821
+ this.hasInitialized = true;
3822
+ }
3823
+ else {
3824
+ this.dataSource.data = instance.dataValue;
3825
+ }
3236
3826
  if (this.checkSubmissionStatus && !this.hasValueAndEditMode) {
3237
3827
  this.showDataGrid = false;
3238
3828
  this.dataSource.data = [];
@@ -3268,7 +3858,10 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3268
3858
  return viewContainer ? viewContainer : null;
3269
3859
  };
3270
3860
  }
3271
- addAnother() {
3861
+ removeColumn(columnName) {
3862
+ this.displayedColumnsNew = this.displayedColumnsNew.filter(column => column !== columnName);
3863
+ }
3864
+ addAnotherOld() {
3272
3865
  this.showDataGrid = true;
3273
3866
  this.checkRowsNumber();
3274
3867
  this.instance.addRow();
@@ -3277,6 +3870,44 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3277
3870
  }
3278
3871
  this.dataSource.data = [...this.dataSource.data];
3279
3872
  }
3873
+ addAnother() {
3874
+ if (this.showNewProductPicker) {
3875
+ const diologeRef = this.dialog.open(AddOnProductsComponent, {
3876
+ disableClose: true,
3877
+ width: '90%',
3878
+ maxWidth: '900px',
3879
+ autoFocus: false,
3880
+ 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 }
3881
+ })
3882
+ .afterClosed().subscribe(response => {
3883
+ if (response?.data?.status) {
3884
+ if (!this.showCategory) {
3885
+ this.removeColumn('category');
3886
+ }
3887
+ if (!this.showQuantity) {
3888
+ this.removeColumn('quantity');
3889
+ }
3890
+ if (!this.showPrice) {
3891
+ this.removeColumn('price');
3892
+ }
3893
+ if (!this.showSubcategory) {
3894
+ this.removeColumn('subCategory');
3895
+ }
3896
+ localStorage.setItem(`selectedProducts-${this.dealId}`, JSON.stringify(response.data.items.selectedProducts));
3897
+ this.dataSourceNew = response.data.items.selectedProducts;
3898
+ this.instance.component.defaultValue = response.data.items.selectedProducts;
3899
+ }
3900
+ });
3901
+ }
3902
+ else {
3903
+ this.checkRowsNumber();
3904
+ this.instance.addRow();
3905
+ if (this.dataSource.data.length < this.instance.rows.length) {
3906
+ this.dataSource.data.push({});
3907
+ }
3908
+ this.dataSource.data = [...this.dataSource.data];
3909
+ }
3910
+ }
3280
3911
  checkRowsNumber() {
3281
3912
  while (this.instance.rows.length < this.dataSource.data.length) {
3282
3913
  this.instance.addRow();
@@ -3329,7 +3960,7 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3329
3960
  super.setValue(value);
3330
3961
  }
3331
3962
  }
3332
- 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 });
3963
+ 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 });
3333
3964
  MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialDataGridComponent, selector: "mat-formio-datagrid", usesInheritance: true, ngImport: i0, template: `
3334
3965
  <mat-formio-form-field [instance]="instance"
3335
3966
  [componentTemplate]="componentTemplate"
@@ -3348,6 +3979,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3348
3979
  {{instance.component.addAnother || 'Add Another'}}
3349
3980
  </button>
3350
3981
  </mat-card-actions>
3982
+ <ng-container *ngIf="!showNewProductPicker">
3983
+ <div class="mat-elevation-z8">
3351
3984
  <table
3352
3985
  mat-table
3353
3986
  [dataSource]="dataSource"
@@ -3356,7 +3989,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3356
3989
  cdkDropList
3357
3990
  [cdkDropListData]="dataSource"
3358
3991
  (cdkDropListDropped)="dropTable($event)">
3359
- >
3992
+
3993
+
3360
3994
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
3361
3995
  <th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
3362
3996
  <td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
@@ -3386,6 +4020,57 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3386
4020
  <tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
3387
4021
  </div>
3388
4022
  </table>
4023
+ </div>
4024
+ </ng-container>
4025
+
4026
+ <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4027
+ <!-- Product Name Column -->
4028
+ <ng-container matColumnDef="productName">
4029
+ <th mat-header-cell *matHeaderCellDef> Product Name </th>
4030
+ <td mat-cell *matCellDef="let element"> {{element.text}} </td>
4031
+ </ng-container>
4032
+
4033
+ <!-- Quantity Column -->
4034
+ <ng-container matColumnDef="quantity" *ngIf="showQuantity">
4035
+ <th mat-header-cell *matHeaderCellDef> Quantity </th>
4036
+ <td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
4037
+ </ng-container>
4038
+
4039
+ <!-- Price Column -->
4040
+ <ng-container matColumnDef="price" *ngIf="showPrice">
4041
+ <th mat-header-cell *matHeaderCellDef> Price </th>
4042
+ <td mat-cell *matCellDef="let element"> {{element.price}} </td>
4043
+ </ng-container>
4044
+
4045
+ <!-- Category Column -->
4046
+ <ng-container matColumnDef="category" *ngIf="showCategory">
4047
+ <th mat-header-cell *matHeaderCellDef> Category </th>
4048
+ <td mat-cell *matCellDef="let element"> {{element.category}} </td>
4049
+ </ng-container>
4050
+
4051
+ <!-- Category Column -->
4052
+ <ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
4053
+ <th mat-header-cell *matHeaderCellDef> Sub Category </th>
4054
+ <td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
4055
+ </ng-container>
4056
+
4057
+ <!-- SKU Column -->
4058
+ <ng-container matColumnDef="skuNumber" *ngIf="showSkuNumber">
4059
+ <th mat-header-cell *matHeaderCellDef> SKU Number </th>
4060
+ <td mat-cell *matCellDef="let element"> #SkuNumber-{{element.value}} </td>
4061
+ </ng-container>
4062
+
4063
+ <tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
4064
+ <tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
4065
+ </table>
4066
+ <ng-template #noData>
4067
+ <div class="no-data-message" *ngIf="showNewProductPicker">
4068
+ No product found please add some products.
4069
+ </div>
4070
+ </ng-template>
4071
+
4072
+
4073
+
3389
4074
  </mat-card-content>
3390
4075
  <mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
3391
4076
  <button mat-raised-button color="primary" (click)="addAnother()">
@@ -3401,7 +4086,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3401
4086
  <span [instance]="instance" matFormioLabel></span>
3402
4087
  </mat-card-title>
3403
4088
  </ng-template>
3404
- `, 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"] }] });
4089
+ `, isInline: true, styles: [".datagrid-row{height:auto}.mat-table{width:100%}.mat-header-cell,.mat-cell{padding:8px}.no-data-message{text-align:center;margin:20px 0;font-size:18px;color:#888}\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"] }] });
3405
4090
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, decorators: [{
3406
4091
  type: Component,
3407
4092
  args: [{ selector: 'mat-formio-datagrid', template: `
@@ -3422,6 +4107,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3422
4107
  {{instance.component.addAnother || 'Add Another'}}
3423
4108
  </button>
3424
4109
  </mat-card-actions>
4110
+ <ng-container *ngIf="!showNewProductPicker">
4111
+ <div class="mat-elevation-z8">
3425
4112
  <table
3426
4113
  mat-table
3427
4114
  [dataSource]="dataSource"
@@ -3430,7 +4117,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3430
4117
  cdkDropList
3431
4118
  [cdkDropListData]="dataSource"
3432
4119
  (cdkDropListDropped)="dropTable($event)">
3433
- >
4120
+
4121
+
3434
4122
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
3435
4123
  <th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
3436
4124
  <td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
@@ -3460,6 +4148,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3460
4148
  <tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
3461
4149
  </div>
3462
4150
  </table>
4151
+ </div>
4152
+ </ng-container>
4153
+
4154
+ <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4155
+ <!-- Product Name Column -->
4156
+ <ng-container matColumnDef="productName">
4157
+ <th mat-header-cell *matHeaderCellDef> Product Name </th>
4158
+ <td mat-cell *matCellDef="let element"> {{element.text}} </td>
4159
+ </ng-container>
4160
+
4161
+ <!-- Quantity Column -->
4162
+ <ng-container matColumnDef="quantity" *ngIf="showQuantity">
4163
+ <th mat-header-cell *matHeaderCellDef> Quantity </th>
4164
+ <td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
4165
+ </ng-container>
4166
+
4167
+ <!-- Price Column -->
4168
+ <ng-container matColumnDef="price" *ngIf="showPrice">
4169
+ <th mat-header-cell *matHeaderCellDef> Price </th>
4170
+ <td mat-cell *matCellDef="let element"> {{element.price}} </td>
4171
+ </ng-container>
4172
+
4173
+ <!-- Category Column -->
4174
+ <ng-container matColumnDef="category" *ngIf="showCategory">
4175
+ <th mat-header-cell *matHeaderCellDef> Category </th>
4176
+ <td mat-cell *matCellDef="let element"> {{element.category}} </td>
4177
+ </ng-container>
4178
+
4179
+ <!-- Category Column -->
4180
+ <ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
4181
+ <th mat-header-cell *matHeaderCellDef> Sub Category </th>
4182
+ <td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
4183
+ </ng-container>
4184
+
4185
+ <!-- SKU Column -->
4186
+ <ng-container matColumnDef="skuNumber" *ngIf="showSkuNumber">
4187
+ <th mat-header-cell *matHeaderCellDef> SKU Number </th>
4188
+ <td mat-cell *matCellDef="let element"> #SkuNumber-{{element.value}} </td>
4189
+ </ng-container>
4190
+
4191
+ <tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
4192
+ <tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
4193
+ </table>
4194
+ <ng-template #noData>
4195
+ <div class="no-data-message" *ngIf="showNewProductPicker">
4196
+ No product found please add some products.
4197
+ </div>
4198
+ </ng-template>
4199
+
4200
+
4201
+
3463
4202
  </mat-card-content>
3464
4203
  <mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
3465
4204
  <button mat-raised-button color="primary" (click)="addAnother()">
@@ -3475,8 +4214,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3475
4214
  <span [instance]="instance" matFormioLabel></span>
3476
4215
  </mat-card-title>
3477
4216
  </ng-template>
3478
- `, styles: [".datagrid-row{height:auto}\n"] }]
3479
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.MatDialog }, { type: CommonService }]; } });
4217
+ `, styles: [".datagrid-row{height:auto}.mat-table{width:100%}.mat-header-cell,.mat-cell{padding:8px}.no-data-message{text-align:center;margin:20px 0;font-size:18px;color:#888}\n"] }]
4218
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }, { type: CommonService }]; } });
3480
4219
  DataGridComponent.MaterialComponent = MaterialDataGridComponent;
3481
4220
 
3482
4221
  var EditRowState;
@@ -3862,7 +4601,7 @@ MaterialWizardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
3862
4601
  <button *ngIf="instance.hasButton('submit')" mat-raised-button color="primary" (click)="submit()">Submit</button>
3863
4602
  </div>
3864
4603
  </mat-step>
3865
- </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"] }] });
4604
+ </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"] }] });
3866
4605
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialWizardComponent, decorators: [{
3867
4606
  type: Component,
3868
4607
  args: [{ selector: 'mat-formio-wizard', template: `
@@ -4032,7 +4771,7 @@ FormioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
4032
4771
  <div fxLayout="column" fxLayoutGap="1em">
4033
4772
  <ng-template #formio></ng-template>
4034
4773
  </div>
4035
- `, 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"] }] });
4774
+ `, 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"] }] });
4036
4775
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormioComponent, decorators: [{
4037
4776
  type: Component,
4038
4777
  args: [{ selector: 'mat-formio', template: `
@@ -4102,7 +4841,8 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
4102
4841
  FormioFormFieldComponent,
4103
4842
  LabelComponent,
4104
4843
  MaskDirective,
4105
- ConfirmationDialogComponent], imports: [CommonModule,
4844
+ ConfirmationDialogComponent,
4845
+ AddOnProductsComponent], imports: [CommonModule,
4106
4846
  FormsModule,
4107
4847
  ReactiveFormsModule,
4108
4848
  MatInputModule,
@@ -4130,7 +4870,9 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
4130
4870
  ScrollingModule,
4131
4871
  NgxMatSelectSearchModule,
4132
4872
  MatDialogModule,
4133
- HttpClientModule], exports: [NgxRenderMaterialFormsComponent,
4873
+ HttpClientModule,
4874
+ MatAutocompleteModule], exports: [MatAutocompleteModule,
4875
+ NgxRenderMaterialFormsComponent,
4134
4876
  FormioComponent,
4135
4877
  MatInputModule,
4136
4878
  MatFormFieldModule,
@@ -4184,7 +4926,9 @@ NgxRenderMaterialFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.
4184
4926
  ScrollingModule,
4185
4927
  NgxMatSelectSearchModule,
4186
4928
  MatDialogModule,
4187
- HttpClientModule, MatInputModule,
4929
+ HttpClientModule,
4930
+ MatAutocompleteModule, MatAutocompleteModule,
4931
+ MatInputModule,
4188
4932
  MatFormFieldModule,
4189
4933
  MatCheckboxModule,
4190
4934
  MatRadioModule,
@@ -4252,7 +4996,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4252
4996
  FormioFormFieldComponent,
4253
4997
  LabelComponent,
4254
4998
  MaskDirective,
4255
- ConfirmationDialogComponent
4999
+ ConfirmationDialogComponent,
5000
+ AddOnProductsComponent
4256
5001
  ],
4257
5002
  imports: [
4258
5003
  CommonModule,
@@ -4283,9 +5028,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4283
5028
  ScrollingModule,
4284
5029
  NgxMatSelectSearchModule,
4285
5030
  MatDialogModule,
4286
- HttpClientModule
5031
+ HttpClientModule,
5032
+ MatAutocompleteModule
4287
5033
  ],
4288
5034
  exports: [
5035
+ MatAutocompleteModule,
4289
5036
  NgxRenderMaterialFormsComponent,
4290
5037
  FormioComponent,
4291
5038
  MatInputModule,