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';
@@ -82,7 +84,7 @@ import SelectBoxesComponent from 'formiojs/components/selectboxes/SelectBoxes.js
82
84
  import { __awaiter } from 'tslib';
83
85
  import SelectComponent from 'formiojs/components/select/Select.js';
84
86
  import { BehaviorSubject, Subject } from 'rxjs';
85
- import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
87
+ import { debounceTime, distinctUntilChanged, takeUntil, startWith, map } from 'rxjs/operators';
86
88
  import * as CryptoJS from 'crypto-js';
87
89
  import { isNullOrUndefined } from 'util';
88
90
  import * as i10 from 'ngx-mat-select-search';
@@ -91,14 +93,15 @@ import WellComponent from 'formiojs/components/well/Well.js';
91
93
  import DataGridComponent from 'formiojs/components/datagrid/DataGrid.js';
92
94
  import * as i9 from '@angular/cdk/drag-drop';
93
95
  import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
96
+ import { SelectionModel } from '@angular/cdk/collections';
97
+ import * as i15 from '@angular/material/stepper';
98
+ import { MatStepperModule } from '@angular/material/stepper';
94
99
  import EditGridComponent from 'formiojs/components/editgrid/EditGrid.js';
95
100
  import Components$2 from 'formiojs/components/Components';
96
101
  import isString from 'lodash/isString';
97
102
  import TableComponent from 'formiojs/components/table/Table.js';
98
103
  import Wizard from 'formiojs/Wizard';
99
104
  import Displays from 'formiojs/displays/Displays';
100
- import * as i3$3 from '@angular/material/stepper';
101
- import { MatStepperModule } from '@angular/material/stepper';
102
105
  import * as i1$3 from '@formio/angular';
103
106
  import { FormioBaseComponent } from '@formio/angular';
104
107
  import { FlexLayoutModule } from '@angular/flex-layout';
@@ -984,8 +987,11 @@ var AngularButtonsThemes;
984
987
  })(AngularButtonsThemes || (AngularButtonsThemes = {}));
985
988
 
986
989
  class MaterialButtonComponent extends MaterialComponent {
987
- constructor() {
988
- super(...arguments);
990
+ constructor(element, ref, dialog) {
991
+ super(element, ref);
992
+ this.element = element;
993
+ this.ref = ref;
994
+ this.dialog = dialog;
989
995
  this.loading = false;
990
996
  this.done = false;
991
997
  this.error = false;
@@ -1056,12 +1062,12 @@ class MaterialButtonComponent extends MaterialComponent {
1056
1062
  return retVal;
1057
1063
  }
1058
1064
  }
1059
- MaterialButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
1060
- 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"] }] });
1065
+ 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 });
1066
+ 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"] }] });
1061
1067
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, decorators: [{
1062
1068
  type: Component,
1063
- 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"] }]
1064
- }] });
1069
+ 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"] }]
1070
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }]; } });
1065
1071
  ButtonComponent.MaterialComponent = MaterialButtonComponent;
1066
1072
 
1067
1073
  class MaterialTextareaComponent extends MaterialComponent {
@@ -2551,8 +2557,12 @@ class CommonService {
2551
2557
  this.dropdownItems$ = this.dropdownItemsSubject.asObservable();
2552
2558
  this.setFlag = new BehaviorSubject(false); // Initialize with false
2553
2559
  this.dropdownflag$ = this.setFlag.asObservable(); // Observable that emits the boolean value
2554
- this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2560
+ this.holy = '';
2561
+ this.grail = '';
2555
2562
  this.currentUser = JSON.parse(localStorage.getItem('currentUser'));
2563
+ this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
2564
+ this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
2565
+ this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
2556
2566
  }
2557
2567
  getBaseApiUrl() {
2558
2568
  const baseUrlMapping = {
@@ -2566,6 +2576,28 @@ class CommonService {
2566
2576
  const hostname = window.location.hostname;
2567
2577
  return baseUrlMapping[hostname] || null;
2568
2578
  }
2579
+ scrumble(msg) {
2580
+ if (!isNullOrUndefined(msg)) {
2581
+ var conceal = this.getcampaign(msg, this.holy, this.grail);
2582
+ var sha256 = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(this.grail) + conceal.toString(), CryptoJS.enc.Base64.stringify(this.holy));
2583
+ var hashInBase64 = CryptoJS.enc.Base64.stringify(sha256);
2584
+ let keyValue = {
2585
+ "value": conceal.toString(),
2586
+ "mac": hashInBase64
2587
+ };
2588
+ var result = JSON.stringify(keyValue);
2589
+ var jumbled = CryptoJS.enc.Utf8.parse(result);
2590
+ return CryptoJS.enc.Base64.stringify(jumbled);
2591
+ }
2592
+ }
2593
+ getcampaign(data, holy, grail) {
2594
+ return CryptoJS.AES.encrypt(data.toString(), holy, {
2595
+ blockSize: 128,
2596
+ iv: grail,
2597
+ mode: CryptoJS.mode.CBC,
2598
+ padding: CryptoJS.pad.Pkcs7
2599
+ });
2600
+ }
2569
2601
  /* Intialization of api path and queryparams */
2570
2602
  initializeApiPath(getUrl, queryParams) {
2571
2603
  if (queryParams === null || queryParams === void 0 ? void 0 : queryParams.length) {
@@ -2589,6 +2621,16 @@ class CommonService {
2589
2621
  return obj;
2590
2622
  }
2591
2623
  }
2624
+ loadProducts(pageNumber, pazeSize, search = '', onlyActive = true, description = false, levelOneId, levelTwoId, levelThreeId, levelFourId) {
2625
+ const baseApiUrl = this.getBaseApiUrl();
2626
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2627
+ 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}`);
2628
+ }
2629
+ listSubCategory(category) {
2630
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2631
+ const baseApiUrl = this.getBaseApiUrl();
2632
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsSubCategory?vendorId=${vendorId}&categoryName=${category}`);
2633
+ }
2592
2634
  /* Append key and value to query string */
2593
2635
  convertToQueryString(queryParams) {
2594
2636
  const queryString = Object.keys(queryParams)
@@ -2610,10 +2652,30 @@ class CommonService {
2610
2652
  const baseApiUrl = this.getBaseApiUrl();
2611
2653
  return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsCategory?vendorId=${vendorId}`);
2612
2654
  }
2655
+ productLevelOne() {
2656
+ const baseApiUrl = this.getBaseApiUrl();
2657
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2658
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelOne?vendorId=${vendorId}`);
2659
+ }
2660
+ productLevelTwo(levelOneId) {
2661
+ const baseApiUrl = this.getBaseApiUrl();
2662
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2663
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelTwo?levelOneId=${levelOneId}&vendorId=${vendorId}`);
2664
+ }
2665
+ productLevelThree(levelOneId, levelTwoId) {
2666
+ const baseApiUrl = this.getBaseApiUrl();
2667
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2668
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelThree?levelOneId=${levelOneId}&levelTwoId=${levelTwoId}&vendorId=${vendorId}`);
2669
+ }
2670
+ productLevelFour(levelOneId, levelTwoId, levelThreeId) {
2671
+ const baseApiUrl = this.getBaseApiUrl();
2672
+ const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
2673
+ return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductLevelFour?levelOneId=${levelOneId}&levelTwoId=${levelTwoId}&levelThreeId=${levelThreeId}&vendorId=${vendorId}`);
2674
+ }
2613
2675
  // Function to get value by key from the array
2614
2676
  getValueByKey(data, key) {
2615
2677
  if (!data || data.length === 0) {
2616
- return null; // Return null if data is empty or undefined
2678
+ return null;
2617
2679
  }
2618
2680
  const item = data.find(kv => kv.key.toLowerCase() === key.toLowerCase());
2619
2681
  return item ? item.value : null;
@@ -2637,19 +2699,20 @@ class CommonService {
2637
2699
  getDropDownFlag() {
2638
2700
  return this.setFlag.getValue();
2639
2701
  }
2702
+ /*Funtion to check if property is matched with given attributes in formBuilder or not */
2640
2703
  checkIsAttributeTrue(newProductPickerFlag, attributeName) {
2641
2704
  return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
2642
2705
  newProductPickerFlag[key].toLowerCase() === "true");
2643
2706
  }
2644
2707
  }
2645
- 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 });
2708
+ 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 });
2646
2709
  CommonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, providedIn: 'root' });
2647
2710
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, decorators: [{
2648
2711
  type: Injectable,
2649
2712
  args: [{
2650
2713
  providedIn: 'root'
2651
2714
  }]
2652
- }], ctorParameters: function () { return [{ type: i1$1.HttpClient }]; } });
2715
+ }], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; } });
2653
2716
 
2654
2717
  class MaterialSelectComponent extends MaterialComponent {
2655
2718
  constructor(element, ref, http, commonService) {
@@ -3066,7 +3129,7 @@ class MaterialSelectComponent extends MaterialComponent {
3066
3129
  return _.isEqual(o1, o2);
3067
3130
  }
3068
3131
  }
3069
- 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 });
3132
+ 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 });
3070
3133
  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: `
3071
3134
  <mat-formio-form-field [instance]="instance" [componentTemplate]="componentTemplate"></mat-formio-form-field>
3072
3135
  <ng-template #componentTemplate let-hasLabel>
@@ -3151,7 +3214,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3151
3214
  </mat-form-field>
3152
3215
  </ng-template>
3153
3216
  `, 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"] }]
3154
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.HttpClient }, { type: CommonService }]; }, propDecorators: { multiSelect: [{
3217
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.HttpClient }, { type: CommonService }]; }, propDecorators: { multiSelect: [{
3155
3218
  type: ViewChild,
3156
3219
  args: ['multiSelect', { static: true }]
3157
3220
  }], selectElem: [{
@@ -3210,18 +3273,455 @@ class ConfirmationDialogComponent {
3210
3273
  ngOnInit() {
3211
3274
  }
3212
3275
  }
3213
- 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 });
3214
- 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"] }] });
3276
+ 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 });
3277
+ 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"] }] });
3215
3278
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, decorators: [{
3216
3279
  type: Component,
3217
3280
  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"] }]
3218
3281
  }], ctorParameters: function () {
3219
- return [{ type: i1$2.MatDialogRef }, { type: undefined, decorators: [{
3282
+ return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
3220
3283
  type: Inject,
3221
3284
  args: [MAT_DIALOG_DATA]
3222
3285
  }] }];
3223
3286
  } });
3224
3287
 
3288
+ class AddOnProductsComponent {
3289
+ constructor(matDialogRef, data, fb, dialog, commonSevice) {
3290
+ this.matDialogRef = matDialogRef;
3291
+ this.fb = fb;
3292
+ this.dialog = dialog;
3293
+ this.commonSevice = commonSevice;
3294
+ this.dropdownOne = [];
3295
+ this.dropdownTwo = [];
3296
+ this.dropdownThree = [];
3297
+ this.dropdownFour = [];
3298
+ this.filteredDropdownOne = [];
3299
+ this.filteredDropdownTwo = [];
3300
+ this.filteredDropdownThree = [];
3301
+ this.filteredDropdownFour = [];
3302
+ this.addProductsColumns = ['select', 'productName', 'skuNumber'];
3303
+ this.showAllproductsColumns = ['delete', 'productName', 'categoryName', 'subCategory', 'Quantity', 'price', 'skuNumber'];
3304
+ this.quantityList = [5, 10, 15, 20, 25];
3305
+ this.ELEMENT_DATA = [];
3306
+ this.dataSource = new MatTableDataSource();
3307
+ this.selection = new SelectionModel(true, []);
3308
+ this.selectedDataSource = new MatTableDataSource([]);
3309
+ this.selectedCategory = null;
3310
+ this.selectedSubCategory = null;
3311
+ this.showCategory = false;
3312
+ this.showSubcategory = false;
3313
+ this.showPrice = true;
3314
+ this.showQuantity = true;
3315
+ this.showSkuNumber = false;
3316
+ this.showNewProductPicker = true;
3317
+ this.setCategory = '';
3318
+ this.setSubCategory = '';
3319
+ this.loadingFlag = false;
3320
+ this.pageNumber = 1;
3321
+ this.pageSize = 20;
3322
+ this.totalPages = 0;
3323
+ this.searchQuery = '';
3324
+ this.itemList = [];
3325
+ this.prevScrollPosition = 0; // Track the previous scroll position
3326
+ this.spinnerFlag = false;
3327
+ this.dropdownL1 = false;
3328
+ this.dropdownL2 = false;
3329
+ this.dropdownL3 = false;
3330
+ this.dropdownL4 = false;
3331
+ this.dropdownL1Label = '';
3332
+ this.dropdownL2Label = '';
3333
+ this.dropdownL3Label = '';
3334
+ this.dropdownL4Label = '';
3335
+ this.dropDownCount = 0;
3336
+ this.disablePrice = true;
3337
+ this.showCategory = data.dropdownsFlag.showDialogCategory;
3338
+ this.showSubcategory = data.dropdownsFlag.showDialogSubCategory;
3339
+ this.showPrice = data.dropdownsFlag.showDialogPrice;
3340
+ this.showQuantity = data.dropdownsFlag.showDialogQuantity;
3341
+ this.showSkuNumber = data.dropdownsFlag.showDialogSkuNumber;
3342
+ this.showNewProductPicker = data.dropdownsFlag.showNewProductPicker;
3343
+ this.dropdownL1 = data.dropdownsFlag.dropdownL1;
3344
+ this.dropdownL2 = data.dropdownsFlag.dropdownL2;
3345
+ this.dropdownL3 = data.dropdownsFlag.dropdownL3;
3346
+ this.dropdownL4 = data.dropdownsFlag.dropdownL4;
3347
+ this.dropdownL1Label = data.dropdownsFlag.dropdownL1Label;
3348
+ this.dropdownL2Label = data.dropdownsFlag.dropdownL2Label;
3349
+ this.dropdownL3Label = data.dropdownsFlag.dropdownL3Label;
3350
+ this.dropdownL4Label = data.dropdownsFlag.dropdownL4Label;
3351
+ this.dropDownCount = this.countTrueDropdowns(data.dropdownsFlag);
3352
+ this.selection = new SelectionModel(true, data.selectedProducts || []);
3353
+ this.form = this.fb.group({
3354
+ dropdownLevel1: [''],
3355
+ dropdownLevel2: [''],
3356
+ dropdownLevel3: [''],
3357
+ dropdownLevel4: [''],
3358
+ searchProductName: [''],
3359
+ selectedProducts: this.fb.array([])
3360
+ });
3361
+ this.initializeFormArray();
3362
+ if (!this.showCategory) {
3363
+ this.removeColumn('categoryName');
3364
+ }
3365
+ if (!this.showPrice) {
3366
+ this.removeColumn('price');
3367
+ }
3368
+ if (!this.showSubcategory) {
3369
+ this.removeColumn('subCategory');
3370
+ }
3371
+ if (!this.showQuantity) {
3372
+ this.removeColumn('Quantity');
3373
+ }
3374
+ if (!this.showSkuNumber) {
3375
+ this.removeColumn('skuNumber');
3376
+ }
3377
+ }
3378
+ removeColumn(columnName) {
3379
+ this.showAllproductsColumns = this.showAllproductsColumns.filter(column => column !== columnName);
3380
+ this.addProductsColumns = this.addProductsColumns.filter(column => column !== columnName);
3381
+ }
3382
+ initializeFormArray() {
3383
+ const selectedProductsArray = this.form.get('selectedProducts');
3384
+ this.selection.selected.forEach(product => {
3385
+ selectedProductsArray.push(this.fb.group({
3386
+ price: [product.price || '', Validators.required],
3387
+ text: [product.text || ''],
3388
+ quantity: [product.quantity || '', Validators.required],
3389
+ category: [(product === null || product === void 0 ? void 0 : product.category) || ''],
3390
+ subCategory: [(product === null || product === void 0 ? void 0 : product.subCategory) || ''],
3391
+ value: [(product === null || product === void 0 ? void 0 : product.value) || ''],
3392
+ skuNumber: [(product === null || product === void 0 ? void 0 : product.value) || '']
3393
+ }));
3394
+ });
3395
+ selectedProductsArray.controls.forEach(control => {
3396
+ var _a;
3397
+ (_a = control.get('price')) === null || _a === void 0 ? void 0 : _a.disable();
3398
+ });
3399
+ this.selectedDataSource.data = [...this.selection.selected];
3400
+ }
3401
+ initializeDataSources() {
3402
+ var _a, _b, _c, _d;
3403
+ // Ensure selected items are marked in the main data source
3404
+ if ((_b = (_a = this.selection) === null || _a === void 0 ? void 0 : _a.selected) === null || _b === void 0 ? void 0 : _b.length) {
3405
+ (_d = (_c = this.selection) === null || _c === void 0 ? void 0 : _c.selected) === null || _d === void 0 ? void 0 : _d.forEach(selectedProduct => {
3406
+ const index = this.dataSource.data.findIndex(product => product.value === selectedProduct.value);
3407
+ if (index >= 0) {
3408
+ this.dataSource.data[index] = selectedProduct;
3409
+ }
3410
+ });
3411
+ this.selectedDataSource.data = [...this.selection.selected];
3412
+ }
3413
+ else {
3414
+ console.warn('No selected products found.');
3415
+ }
3416
+ }
3417
+ ngAfterViewInit() {
3418
+ }
3419
+ ngOnInit() {
3420
+ // this.loadProductCategory();
3421
+ this.loadDropdownL1();
3422
+ this.form.get('dropdownLevel1').valueChanges
3423
+ .pipe(startWith(''), map(value => this.filterProducts(value, 'category1'))).subscribe(l1 => {
3424
+ this.filteredDropdownOne = l1;
3425
+ });
3426
+ this.form.get('dropdownLevel2').valueChanges
3427
+ .pipe(startWith(''), map(value => this.filterProducts(value, 'category2'))).subscribe(l2 => {
3428
+ this.filteredDropdownTwo = l2;
3429
+ });
3430
+ this.form.get('dropdownLevel3').valueChanges
3431
+ .pipe(startWith(''), map(value => this.filterProducts(value, 'category3'))).subscribe(l3 => {
3432
+ this.filteredDropdownThree = l3;
3433
+ });
3434
+ this.form.get('dropdownLevel4').valueChanges
3435
+ .pipe(startWith(''), map(value => this.filterProducts(value, 'category4'))).subscribe(l4 => {
3436
+ this.filteredDropdownFour = l4;
3437
+ });
3438
+ }
3439
+ handleDropdownFilter() {
3440
+ var _a, _b, _c, _d, _e;
3441
+ if (this.form.controls.dropdownLevel1.value !== '' || this.form.controls.searchProductName.value !== '') {
3442
+ this.searchQuery = (_a = this.form.controls.searchProductName) === null || _a === void 0 ? void 0 : _a.value;
3443
+ this.levelOneId = (_b = this.form.controls.dropdownLevel1.value) === null || _b === void 0 ? void 0 : _b.id;
3444
+ this.levelTwoId = (_c = this.form.controls.dropdownLevel2.value) === null || _c === void 0 ? void 0 : _c.id;
3445
+ this.levelThreeId = (_d = this.form.controls.dropdownLevel3.value) === null || _d === void 0 ? void 0 : _d.id;
3446
+ this.levelFourId = (_e = this.form.controls.dropdownLevel4.value) === null || _e === void 0 ? void 0 : _e.id;
3447
+ this.getProducts(false);
3448
+ }
3449
+ }
3450
+ loadDropdownL1() {
3451
+ this.spinnerFlag = true;
3452
+ this.commonSevice.productLevelOne().subscribe(response => {
3453
+ this.spinnerFlag = false;
3454
+ if (response && response.code === 200) {
3455
+ this.dropdownOne = response.data;
3456
+ this.filteredDropdownOne = this.filterProducts('', 'category1');
3457
+ }
3458
+ });
3459
+ }
3460
+ loadDropdownL2(levelOneId) {
3461
+ this.spinnerFlag = true;
3462
+ this.commonSevice.productLevelTwo(levelOneId).subscribe(response => {
3463
+ this.spinnerFlag = false;
3464
+ if (response && response.code === 200) {
3465
+ this.dropdownTwo = response.data;
3466
+ this.filteredDropdownTwo = this.filterProducts('', 'category2');
3467
+ }
3468
+ });
3469
+ }
3470
+ loadDropdownL3(levelOneId, levelTwoId) {
3471
+ this.spinnerFlag = true;
3472
+ this.commonSevice.productLevelThree(levelOneId, levelTwoId).subscribe(response => {
3473
+ this.spinnerFlag = false;
3474
+ if (response && response.code === 200) {
3475
+ this.dropdownThree = response.data;
3476
+ this.filteredDropdownThree = this.filterProducts('', 'category3');
3477
+ }
3478
+ });
3479
+ }
3480
+ loadDropdownL4(levelOneId, levelTwoId, levelThreeId) {
3481
+ this.spinnerFlag = true;
3482
+ this.commonSevice.productLevelFour(levelOneId, levelTwoId, levelThreeId).subscribe(response => {
3483
+ this.spinnerFlag = false;
3484
+ if (response && response.code === 200) {
3485
+ this.dropdownFour = response.data;
3486
+ this.filteredDropdownFour = this.filterProducts('', 'category4');
3487
+ }
3488
+ });
3489
+ }
3490
+ filterProducts(value, cat) {
3491
+ const filterValue = typeof value === 'string' ? value === null || value === void 0 ? void 0 : value.toLowerCase() : value;
3492
+ let data;
3493
+ // Dynamically assign the data array based on the category
3494
+ switch (cat) {
3495
+ case 'category1':
3496
+ data = this.dropdownOne;
3497
+ break;
3498
+ case 'category2':
3499
+ data = this.dropdownTwo;
3500
+ break;
3501
+ case 'category3':
3502
+ data = this.dropdownThree;
3503
+ break;
3504
+ case 'category4':
3505
+ data = this.dropdownFour;
3506
+ break;
3507
+ default:
3508
+ data = [];
3509
+ }
3510
+ if (!filterValue) {
3511
+ return data;
3512
+ }
3513
+ else {
3514
+ return data === null || data === void 0 ? void 0 : data.filter(option => { var _a; return (_a = option['name']) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(filterValue); });
3515
+ }
3516
+ }
3517
+ onSubmit() {
3518
+ if (this.form.valid) {
3519
+ this.matDialogRef.close({
3520
+ data: {
3521
+ status: true,
3522
+ items: this.form.getRawValue()
3523
+ }
3524
+ });
3525
+ }
3526
+ }
3527
+ isAllSelected() {
3528
+ const numSelected = this.selection.selected.length;
3529
+ const numRows = this.dataSource.data.length;
3530
+ return numSelected === numRows;
3531
+ }
3532
+ isIndeterminate() {
3533
+ const numSelected = this.selection.selected.length;
3534
+ const numRows = this.dataSource.data.length;
3535
+ return numSelected > 0 && numSelected < numRows;
3536
+ }
3537
+ masterToggle() {
3538
+ this.isAllSelected()
3539
+ ? this.selection.clear()
3540
+ : this.dataSource.data.forEach(row => this.selection.select(row));
3541
+ this.updateSelectedProducts();
3542
+ }
3543
+ toggleSelection(row) {
3544
+ this.selection.toggle(row);
3545
+ this.updateSelectedProducts();
3546
+ }
3547
+ // Getter for the FormArray
3548
+ get selectedProducts() {
3549
+ return this.form.get('selectedProducts');
3550
+ }
3551
+ updateSelectedProducts() {
3552
+ var _a, _b;
3553
+ if (Array.isArray(this.selection.selected)) {
3554
+ this.selectedDataSource.data = [...this.selection.selected];
3555
+ const selectedProductsArray = this.selectedProducts;
3556
+ selectedProductsArray.clear();
3557
+ (_b = (_a = this.selection) === null || _a === void 0 ? void 0 : _a.selected) === null || _b === void 0 ? void 0 : _b.forEach(product => {
3558
+ var _a, _b;
3559
+ selectedProductsArray === null || selectedProductsArray === void 0 ? void 0 : selectedProductsArray.push(this.fb.group({
3560
+ price: [(_a = product === null || product === void 0 ? void 0 : product.price) !== null && _a !== void 0 ? _a : '', this.showPrice ? Validators.required : []],
3561
+ text: [(product === null || product === void 0 ? void 0 : product.text) || ''],
3562
+ quantity: [(_b = product === null || product === void 0 ? void 0 : product.quantity) !== null && _b !== void 0 ? _b : '', this.showQuantity ? Validators.required : []],
3563
+ category: [(product === null || product === void 0 ? void 0 : product.category) || ''],
3564
+ subCategory: [(product === null || product === void 0 ? void 0 : product.subCategory) || ''],
3565
+ value: [(product === null || product === void 0 ? void 0 : product.value) || ''],
3566
+ skuNumber: [(product === null || product === void 0 ? void 0 : product.value) || '']
3567
+ }));
3568
+ });
3569
+ selectedProductsArray.controls.forEach(control => {
3570
+ var _a;
3571
+ (_a = control.get('price')) === null || _a === void 0 ? void 0 : _a.disable();
3572
+ });
3573
+ }
3574
+ else {
3575
+ console.error('Selection.selected is not an array:', this.selection.selected);
3576
+ }
3577
+ }
3578
+ getTotalRows() {
3579
+ return this.dataSource.data.length;
3580
+ }
3581
+ getSelectedRowsCount() {
3582
+ return this.selection.selected.length;
3583
+ }
3584
+ onOptionSelected(event, category) {
3585
+ let selectedValue;
3586
+ if (event && event.option && event.option.value !== undefined) {
3587
+ selectedValue = event.option.value.id;
3588
+ }
3589
+ else {
3590
+ selectedValue = event;
3591
+ }
3592
+ if (category === 'category1') {
3593
+ this.levelOneId = selectedValue;
3594
+ this.form.get('dropdownLevel2').setValue(null);
3595
+ this.form.get('dropdownLevel3').setValue(null);
3596
+ this.form.get('dropdownLevel4').setValue(null);
3597
+ this.filteredDropdownTwo = [];
3598
+ this.filteredDropdownThree = [];
3599
+ this.filteredDropdownFour = [];
3600
+ if (this.dropdownL2) {
3601
+ this.loadDropdownL2(this.levelOneId);
3602
+ }
3603
+ }
3604
+ if (category === 'category2') {
3605
+ this.levelTwoId = selectedValue;
3606
+ this.form.get('dropdownLevel3').setValue(null);
3607
+ this.form.get('dropdownLevel4').setValue(null);
3608
+ this.filteredDropdownThree = [];
3609
+ this.filteredDropdownFour = [];
3610
+ if (this.dropdownL3) {
3611
+ this.loadDropdownL3(this.levelOneId, this.levelTwoId);
3612
+ }
3613
+ }
3614
+ if (category === 'category3') {
3615
+ this.levelThreeId = selectedValue;
3616
+ this.form.get('dropdownLevel4').setValue(null);
3617
+ this.filteredDropdownFour = [];
3618
+ if (this.dropdownL4) {
3619
+ this.loadDropdownL4(this.levelOneId, this.levelTwoId, this.levelThreeId);
3620
+ }
3621
+ }
3622
+ if (category === 'category4') {
3623
+ this.levelFourId = selectedValue;
3624
+ }
3625
+ }
3626
+ getProducts(flag) {
3627
+ this.spinnerFlag = true;
3628
+ const search = this.searchQuery;
3629
+ this.commonSevice.loadProducts(this.pageNumber, this.pageSize, search, true, false, this.levelOneId, this.levelTwoId, this.levelThreeId, this.levelFourId).subscribe(response => {
3630
+ var _a;
3631
+ this.spinnerFlag = false;
3632
+ if (response && response.code === 200) {
3633
+ this.totalPages = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.totalPages;
3634
+ const data = response.data.dataSource;
3635
+ if (this.dataSource.data.length > 0 && flag) {
3636
+ data.forEach(item => this.dataSource.data.push(item));
3637
+ this.dataSource.data = [...this.dataSource.data, ...data];
3638
+ }
3639
+ else {
3640
+ this.dataSource.data = data;
3641
+ }
3642
+ this.loadingFlag = true;
3643
+ setTimeout(() => {
3644
+ const middlePosition = this.trackHeight / 2 - 50;
3645
+ if (this.firstscrollableDiv && this.firstscrollableDiv.nativeElement) {
3646
+ this.firstscrollableDiv.nativeElement.scrollTo({ top: middlePosition, behavior: 'auto' });
3647
+ }
3648
+ }, 250);
3649
+ this.initializeDataSources();
3650
+ }
3651
+ });
3652
+ }
3653
+ removeRow(event, element) {
3654
+ event.stopPropagation();
3655
+ event.preventDefault();
3656
+ let message = 'Are you sure you want to delete this product?';
3657
+ let showButton = true;
3658
+ const index = this.selectedDataSource.data.indexOf(element);
3659
+ if (index >= 0) {
3660
+ if (this.selectedDataSource.data.length === 1) {
3661
+ message = 'Please select at least one product.';
3662
+ showButton = false;
3663
+ }
3664
+ const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
3665
+ disableClose: true,
3666
+ width: '90%',
3667
+ maxWidth: '400px',
3668
+ data: { message: message, buttonStatus: showButton }
3669
+ });
3670
+ dialogRef.afterClosed().subscribe(result => {
3671
+ if (result) {
3672
+ this.selectedDataSource.data.splice(index, 1);
3673
+ this.selectedDataSource._updateChangeSubscription();
3674
+ this.selection.deselect(element);
3675
+ const selectedProductsArray = this.form.get('selectedProducts');
3676
+ const productIndex = selectedProductsArray.controls.findIndex(control => control.value.productName === element.productName);
3677
+ if (productIndex >= 0) {
3678
+ selectedProductsArray.removeAt(productIndex);
3679
+ }
3680
+ }
3681
+ });
3682
+ }
3683
+ }
3684
+ onScroll(event) {
3685
+ this.trackHeight = event.target.scrollHeight - event.target.offsetHeight;
3686
+ if (this.loadingFlag && (Math.floor(event.target.scrollTop / this.trackHeight * 100) > 50)) {
3687
+ this.loadingFlag = false;
3688
+ if (this.pageNumber < this.totalPages) {
3689
+ this.pageNumber = this.pageNumber + 1;
3690
+ this.getProducts(true);
3691
+ }
3692
+ else {
3693
+ this.loadingFlag = true;
3694
+ }
3695
+ }
3696
+ this.prevScrollPosition = event.target.scrollTop;
3697
+ }
3698
+ countTrueDropdowns(obj) {
3699
+ // Dynamically find all keys that start with 'dropdownL' and are boolean (true/false)
3700
+ return Object.keys(obj)
3701
+ .filter(key => key.startsWith('dropdownL') && typeof obj[key] === 'boolean' && obj[key] === true)
3702
+ .length;
3703
+ }
3704
+ /* Use the property that should display in the input field */
3705
+ displayFn(option) {
3706
+ return option ? option.name : '';
3707
+ }
3708
+ }
3709
+ 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 });
3710
+ 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"] }] });
3711
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AddOnProductsComponent, decorators: [{
3712
+ type: Component,
3713
+ 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"] }]
3714
+ }], ctorParameters: function () {
3715
+ return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
3716
+ type: Inject,
3717
+ args: [MAT_DIALOG_DATA]
3718
+ }] }, { type: i2.FormBuilder }, { type: i1$1.MatDialog }, { type: CommonService }];
3719
+ }, propDecorators: { firstscrollableDiv: [{
3720
+ type: ViewChild,
3721
+ args: ['firstscrollableDiv']
3722
+ }] } });
3723
+
3724
+ const ELEMENT_DATA = [];
3225
3725
  class MaterialDataGridComponent extends MaterialNestedComponent {
3226
3726
  constructor(element, ref, dialog, commonService) {
3227
3727
  super(element, ref);
@@ -3230,19 +3730,118 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3230
3730
  this.dialog = dialog;
3231
3731
  this.commonService = commonService;
3232
3732
  this.dataSource = new MatTableDataSource();
3733
+ this.dataSourceNew = ELEMENT_DATA;
3734
+ this.displayedColumnsNew = ['productName', 'category', 'subCategory', 'quantity', 'price', 'skuNumber'];
3735
+ this.showNewProductPicker = false;
3736
+ this.showCategory = false;
3737
+ this.showSubcategory = false;
3738
+ this.showPrice = true;
3739
+ this.showQuantity = true;
3740
+ this.showSkuNumber = false;
3741
+ this.hasInitialized = false;
3233
3742
  this.checkSubmissionStatus = false;
3234
3743
  this.showDataGrid = true;
3235
3744
  this.hasValueAndEditMode = false;
3745
+ this.dropdownL1 = false;
3746
+ this.dropdownL2 = false;
3747
+ this.dropdownL3 = false;
3748
+ this.dropdownL4 = false;
3749
+ this.showDialogQuantity = false;
3750
+ this.showDialogPrice = false;
3751
+ this.showDialogCategory = false;
3752
+ this.showDialogSkuNumber = false;
3753
+ this.showDialogSubCategory = false;
3754
+ this.dropdownL1Label = '';
3755
+ this.dropdownL2Label = '';
3756
+ this.dropdownL3Label = '';
3757
+ this.dropdownL4Label = '';
3236
3758
  }
3237
3759
  getColumnLabel(column) {
3238
3760
  return column.label || column.key;
3239
3761
  }
3762
+ checkIsAttributeTrue(newProductPickerFlag, attributeName) {
3763
+ return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
3764
+ newProductPickerFlag[key].toLowerCase() === "true");
3765
+ }
3766
+ getLabelName(newProductPickerFlag, attributeName) {
3767
+ if (newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase())) {
3768
+ // Find the key that matches attributeName case-insensitively
3769
+ const matchingKey = Object.keys(newProductPickerFlag).find(key => key.toLocaleLowerCase() === attributeName.toLowerCase());
3770
+ // Return the value of the matching key
3771
+ return newProductPickerFlag[matchingKey];
3772
+ }
3773
+ return '';
3774
+ }
3775
+ // ngOnInit(): void {
3776
+ // }
3240
3777
  setInstance(instance) {
3241
- var _a, _b, _c;
3778
+ var _a;
3779
+ //const newProductPickerFlag = instance?.component?.attributes;
3242
3780
  const checkAttribute = (_a = instance === null || instance === void 0 ? void 0 : instance.component) === null || _a === void 0 ? void 0 : _a.attributes;
3781
+ this.showNewProductPicker = this.checkIsAttributeTrue(checkAttribute, "newproductpicker");
3782
+ this.showCategory = this.checkIsAttributeTrue(checkAttribute, "showCategory");
3783
+ this.showSubcategory = this.checkIsAttributeTrue(checkAttribute, "showSubcategory");
3784
+ this.showPrice = this.checkIsAttributeTrue(checkAttribute, "showPrice");
3785
+ this.showQuantity = this.checkIsAttributeTrue(checkAttribute, "showQuantity");
3786
+ this.showSkuNumber = this.checkIsAttributeTrue(checkAttribute, "showSkuNumber");
3787
+ this.showDialogQuantity = this.checkIsAttributeTrue(checkAttribute, "showDialogQuantity");
3788
+ this.showDialogPrice = this.checkIsAttributeTrue(checkAttribute, "showDialogPrice");
3789
+ this.showDialogCategory = this.checkIsAttributeTrue(checkAttribute, "showDialogCategory");
3790
+ this.showDialogSkuNumber = this.checkIsAttributeTrue(checkAttribute, "showDialogSkuNumber");
3791
+ this.showDialogSubCategory = this.checkIsAttributeTrue(checkAttribute, "showDialogSubCategory");
3792
+ const l1 = this.getLabelName(checkAttribute, "dropdownL1");
3793
+ const l2 = this.getLabelName(checkAttribute, "dropdownL2");
3794
+ const l3 = this.getLabelName(checkAttribute, "dropdownL3");
3795
+ const l4 = this.getLabelName(checkAttribute, "dropdownL4");
3796
+ this.dropdownL1 = l1 !== null && l1 !== undefined && (typeof l1 === 'string' ? l1.trim() !== "" : l1 !== "") ? true : false;
3797
+ this.dropdownL2 = l2 !== null && l2 !== undefined && (typeof l2 === 'string' ? l2.trim() !== "" : l2 !== "") ? true : false;
3798
+ this.dropdownL3 = l3 !== null && l3 !== undefined && (typeof l3 === 'string' ? l3.trim() !== "" : l3 !== "") ? true : false;
3799
+ this.dropdownL4 = l4 !== null && l4 !== undefined && (typeof l4 === 'string' ? l4.trim() !== "" : l4 !== "") ? true : false;
3800
+ if (this.dropdownL1) {
3801
+ this.dropdownL1Label = l1;
3802
+ }
3803
+ if (this.dropdownL2) {
3804
+ this.dropdownL2Label = l2;
3805
+ }
3806
+ if (this.dropdownL3) {
3807
+ this.dropdownL3Label = l3;
3808
+ }
3809
+ if (this.dropdownL4) {
3810
+ this.dropdownL4Label = l4;
3811
+ }
3243
3812
  this.checkSubmissionStatus = this.commonService.checkIsAttributeTrue(checkAttribute, 'isProductOptional');
3244
- this.hasValueAndEditMode = (((_b = (checkAttribute === null || checkAttribute === void 0 ? void 0 : checkAttribute.hasValue) === 'yes') !== null && _b !== void 0 ? _b : false) && ((_c = (checkAttribute === null || checkAttribute === void 0 ? void 0 : checkAttribute.editMode) === 'true') !== null && _c !== void 0 ? _c : false));
3813
+ this.hasValueAndEditMode = ((checkAttribute === null || checkAttribute === void 0 ? void 0 : checkAttribute.hasValue) === 'yes') && ((checkAttribute === null || checkAttribute === void 0 ? void 0 : checkAttribute.editMode) === 'true');
3245
3814
  super.setInstance(instance);
3815
+ if (this.showNewProductPicker && !this.hasInitialized) {
3816
+ if (!this.showCategory) {
3817
+ this.removeColumn('category');
3818
+ }
3819
+ if (!this.showQuantity) {
3820
+ this.removeColumn('quantity');
3821
+ }
3822
+ if (!this.showPrice) {
3823
+ this.removeColumn('price');
3824
+ }
3825
+ if (!this.showSubcategory) {
3826
+ this.removeColumn('subCategory');
3827
+ }
3828
+ if (!this.showSkuNumber) {
3829
+ this.removeColumn('skuNumber');
3830
+ }
3831
+ this.dealId = this.getLabelName(checkAttribute, "dealId");
3832
+ const storedData = localStorage.getItem(`showGridPickerProducts-${this.dealId}`);
3833
+ if (storedData === null || storedData === void 0 ? void 0 : storedData.length) {
3834
+ this.dataSourceNew = JSON.parse(storedData);
3835
+ }
3836
+ else {
3837
+ this.dataSourceNew = [];
3838
+ }
3839
+ // Set flag to true to prevent further execution
3840
+ this.hasInitialized = true;
3841
+ }
3842
+ else {
3843
+ this.dataSource.data = instance.dataValue;
3844
+ }
3246
3845
  if (this.checkSubmissionStatus && !this.hasValueAndEditMode) {
3247
3846
  this.showDataGrid = false;
3248
3847
  this.dataSource.data = [];
@@ -3278,7 +3877,10 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3278
3877
  return viewContainer ? viewContainer : null;
3279
3878
  };
3280
3879
  }
3281
- addAnother() {
3880
+ removeColumn(columnName) {
3881
+ this.displayedColumnsNew = this.displayedColumnsNew.filter(column => column !== columnName);
3882
+ }
3883
+ addAnotherOld() {
3282
3884
  this.showDataGrid = true;
3283
3885
  this.checkRowsNumber();
3284
3886
  this.instance.addRow();
@@ -3287,6 +3889,45 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3287
3889
  }
3288
3890
  this.dataSource.data = [...this.dataSource.data];
3289
3891
  }
3892
+ addAnother() {
3893
+ if (this.showNewProductPicker) {
3894
+ const diologeRef = this.dialog.open(AddOnProductsComponent, {
3895
+ disableClose: true,
3896
+ width: '90%',
3897
+ maxWidth: '900px',
3898
+ autoFocus: false,
3899
+ 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 }
3900
+ })
3901
+ .afterClosed().subscribe(response => {
3902
+ var _a;
3903
+ if ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.status) {
3904
+ if (!this.showCategory) {
3905
+ this.removeColumn('category');
3906
+ }
3907
+ if (!this.showQuantity) {
3908
+ this.removeColumn('quantity');
3909
+ }
3910
+ if (!this.showPrice) {
3911
+ this.removeColumn('price');
3912
+ }
3913
+ if (!this.showSubcategory) {
3914
+ this.removeColumn('subCategory');
3915
+ }
3916
+ localStorage.setItem(`selectedProducts-${this.dealId}`, JSON.stringify(response.data.items.selectedProducts));
3917
+ this.dataSourceNew = response.data.items.selectedProducts;
3918
+ this.instance.component.defaultValue = response.data.items.selectedProducts;
3919
+ }
3920
+ });
3921
+ }
3922
+ else {
3923
+ this.checkRowsNumber();
3924
+ this.instance.addRow();
3925
+ if (this.dataSource.data.length < this.instance.rows.length) {
3926
+ this.dataSource.data.push({});
3927
+ }
3928
+ this.dataSource.data = [...this.dataSource.data];
3929
+ }
3930
+ }
3290
3931
  checkRowsNumber() {
3291
3932
  while (this.instance.rows.length < this.dataSource.data.length) {
3292
3933
  this.instance.addRow();
@@ -3341,7 +3982,7 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
3341
3982
  super.setValue(value);
3342
3983
  }
3343
3984
  }
3344
- 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 });
3985
+ 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 });
3345
3986
  MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialDataGridComponent, selector: "mat-formio-datagrid", usesInheritance: true, ngImport: i0, template: `
3346
3987
  <mat-formio-form-field [instance]="instance"
3347
3988
  [componentTemplate]="componentTemplate"
@@ -3360,6 +4001,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3360
4001
  {{instance.component.addAnother || 'Add Another'}}
3361
4002
  </button>
3362
4003
  </mat-card-actions>
4004
+ <ng-container *ngIf="!showNewProductPicker">
4005
+ <div class="mat-elevation-z8">
3363
4006
  <table
3364
4007
  mat-table
3365
4008
  [dataSource]="dataSource"
@@ -3368,7 +4011,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3368
4011
  cdkDropList
3369
4012
  [cdkDropListData]="dataSource"
3370
4013
  (cdkDropListDropped)="dropTable($event)">
3371
- >
4014
+
4015
+
3372
4016
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
3373
4017
  <th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
3374
4018
  <td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
@@ -3398,6 +4042,57 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3398
4042
  <tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
3399
4043
  </div>
3400
4044
  </table>
4045
+ </div>
4046
+ </ng-container>
4047
+
4048
+ <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4049
+ <!-- Product Name Column -->
4050
+ <ng-container matColumnDef="productName">
4051
+ <th mat-header-cell *matHeaderCellDef> Product Name </th>
4052
+ <td mat-cell *matCellDef="let element"> {{element.text}} </td>
4053
+ </ng-container>
4054
+
4055
+ <!-- Quantity Column -->
4056
+ <ng-container matColumnDef="quantity" *ngIf="showQuantity">
4057
+ <th mat-header-cell *matHeaderCellDef> Quantity </th>
4058
+ <td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
4059
+ </ng-container>
4060
+
4061
+ <!-- Price Column -->
4062
+ <ng-container matColumnDef="price" *ngIf="showPrice">
4063
+ <th mat-header-cell *matHeaderCellDef> Price </th>
4064
+ <td mat-cell *matCellDef="let element"> {{element.price}} </td>
4065
+ </ng-container>
4066
+
4067
+ <!-- Category Column -->
4068
+ <ng-container matColumnDef="category" *ngIf="showCategory">
4069
+ <th mat-header-cell *matHeaderCellDef> Category </th>
4070
+ <td mat-cell *matCellDef="let element"> {{element.category}} </td>
4071
+ </ng-container>
4072
+
4073
+ <!-- Category Column -->
4074
+ <ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
4075
+ <th mat-header-cell *matHeaderCellDef> Sub Category </th>
4076
+ <td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
4077
+ </ng-container>
4078
+
4079
+ <!-- SKU Column -->
4080
+ <ng-container matColumnDef="skuNumber" *ngIf="showSkuNumber">
4081
+ <th mat-header-cell *matHeaderCellDef> SKU Number </th>
4082
+ <td mat-cell *matCellDef="let element"> #SkuNumber-{{element.value}} </td>
4083
+ </ng-container>
4084
+
4085
+ <tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
4086
+ <tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
4087
+ </table>
4088
+ <ng-template #noData>
4089
+ <div class="no-data-message" *ngIf="showNewProductPicker">
4090
+ No product found please add some products.
4091
+ </div>
4092
+ </ng-template>
4093
+
4094
+
4095
+
3401
4096
  </mat-card-content>
3402
4097
  <mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
3403
4098
  <button mat-raised-button color="primary" (click)="addAnother()">
@@ -3413,7 +4108,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
3413
4108
  <span [instance]="instance" matFormioLabel></span>
3414
4109
  </mat-card-title>
3415
4110
  </ng-template>
3416
- `, 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"] }] });
4111
+ `, 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"] }] });
3417
4112
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, decorators: [{
3418
4113
  type: Component,
3419
4114
  args: [{ selector: 'mat-formio-datagrid', template: `
@@ -3434,6 +4129,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3434
4129
  {{instance.component.addAnother || 'Add Another'}}
3435
4130
  </button>
3436
4131
  </mat-card-actions>
4132
+ <ng-container *ngIf="!showNewProductPicker">
4133
+ <div class="mat-elevation-z8">
3437
4134
  <table
3438
4135
  mat-table
3439
4136
  [dataSource]="dataSource"
@@ -3442,7 +4139,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3442
4139
  cdkDropList
3443
4140
  [cdkDropListData]="dataSource"
3444
4141
  (cdkDropListDropped)="dropTable($event)">
3445
- >
4142
+
4143
+
3446
4144
  <ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
3447
4145
  <th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
3448
4146
  <td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
@@ -3472,6 +4170,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3472
4170
  <tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
3473
4171
  </div>
3474
4172
  </table>
4173
+ </div>
4174
+ </ng-container>
4175
+
4176
+ <table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
4177
+ <!-- Product Name Column -->
4178
+ <ng-container matColumnDef="productName">
4179
+ <th mat-header-cell *matHeaderCellDef> Product Name </th>
4180
+ <td mat-cell *matCellDef="let element"> {{element.text}} </td>
4181
+ </ng-container>
4182
+
4183
+ <!-- Quantity Column -->
4184
+ <ng-container matColumnDef="quantity" *ngIf="showQuantity">
4185
+ <th mat-header-cell *matHeaderCellDef> Quantity </th>
4186
+ <td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
4187
+ </ng-container>
4188
+
4189
+ <!-- Price Column -->
4190
+ <ng-container matColumnDef="price" *ngIf="showPrice">
4191
+ <th mat-header-cell *matHeaderCellDef> Price </th>
4192
+ <td mat-cell *matCellDef="let element"> {{element.price}} </td>
4193
+ </ng-container>
4194
+
4195
+ <!-- Category Column -->
4196
+ <ng-container matColumnDef="category" *ngIf="showCategory">
4197
+ <th mat-header-cell *matHeaderCellDef> Category </th>
4198
+ <td mat-cell *matCellDef="let element"> {{element.category}} </td>
4199
+ </ng-container>
4200
+
4201
+ <!-- Category Column -->
4202
+ <ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
4203
+ <th mat-header-cell *matHeaderCellDef> Sub Category </th>
4204
+ <td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
4205
+ </ng-container>
4206
+
4207
+ <!-- SKU Column -->
4208
+ <ng-container matColumnDef="skuNumber" *ngIf="showSkuNumber">
4209
+ <th mat-header-cell *matHeaderCellDef> SKU Number </th>
4210
+ <td mat-cell *matCellDef="let element"> #SkuNumber-{{element.value}} </td>
4211
+ </ng-container>
4212
+
4213
+ <tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
4214
+ <tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
4215
+ </table>
4216
+ <ng-template #noData>
4217
+ <div class="no-data-message" *ngIf="showNewProductPicker">
4218
+ No product found please add some products.
4219
+ </div>
4220
+ </ng-template>
4221
+
4222
+
4223
+
3475
4224
  </mat-card-content>
3476
4225
  <mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
3477
4226
  <button mat-raised-button color="primary" (click)="addAnother()">
@@ -3487,8 +4236,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
3487
4236
  <span [instance]="instance" matFormioLabel></span>
3488
4237
  </mat-card-title>
3489
4238
  </ng-template>
3490
- `, styles: [".datagrid-row{height:auto}\n"] }]
3491
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.MatDialog }, { type: CommonService }]; } });
4239
+ `, 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"] }]
4240
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }, { type: CommonService }]; } });
3492
4241
  DataGridComponent.MaterialComponent = MaterialDataGridComponent;
3493
4242
 
3494
4243
  var EditRowState;
@@ -3871,7 +4620,7 @@ MaterialWizardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
3871
4620
  <button *ngIf="instance.hasButton('submit')" mat-raised-button color="primary" (click)="submit()">Submit</button>
3872
4621
  </div>
3873
4622
  </mat-step>
3874
- </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"] }] });
4623
+ </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"] }] });
3875
4624
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialWizardComponent, decorators: [{
3876
4625
  type: Component,
3877
4626
  args: [{ selector: 'mat-formio-wizard', template: `
@@ -4041,7 +4790,7 @@ FormioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
4041
4790
  <div fxLayout="column" fxLayoutGap="1em">
4042
4791
  <ng-template #formio></ng-template>
4043
4792
  </div>
4044
- `, 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"] }] });
4793
+ `, 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"] }] });
4045
4794
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormioComponent, decorators: [{
4046
4795
  type: Component,
4047
4796
  args: [{ selector: 'mat-formio', template: `
@@ -4113,7 +4862,8 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
4113
4862
  FormioFormFieldComponent,
4114
4863
  LabelComponent,
4115
4864
  MaskDirective,
4116
- ConfirmationDialogComponent], imports: [CommonModule,
4865
+ ConfirmationDialogComponent,
4866
+ AddOnProductsComponent], imports: [CommonModule,
4117
4867
  FormsModule,
4118
4868
  ReactiveFormsModule,
4119
4869
  MatInputModule,
@@ -4141,7 +4891,9 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
4141
4891
  ScrollingModule,
4142
4892
  NgxMatSelectSearchModule,
4143
4893
  MatDialogModule,
4144
- HttpClientModule], exports: [NgxRenderMaterialFormsComponent,
4894
+ HttpClientModule,
4895
+ MatAutocompleteModule], exports: [MatAutocompleteModule,
4896
+ NgxRenderMaterialFormsComponent,
4145
4897
  FormioComponent,
4146
4898
  MatInputModule,
4147
4899
  MatFormFieldModule,
@@ -4195,7 +4947,9 @@ NgxRenderMaterialFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.
4195
4947
  ScrollingModule,
4196
4948
  NgxMatSelectSearchModule,
4197
4949
  MatDialogModule,
4198
- HttpClientModule, MatInputModule,
4950
+ HttpClientModule,
4951
+ MatAutocompleteModule, MatAutocompleteModule,
4952
+ MatInputModule,
4199
4953
  MatFormFieldModule,
4200
4954
  MatCheckboxModule,
4201
4955
  MatRadioModule,
@@ -4263,7 +5017,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4263
5017
  FormioFormFieldComponent,
4264
5018
  LabelComponent,
4265
5019
  MaskDirective,
4266
- ConfirmationDialogComponent
5020
+ ConfirmationDialogComponent,
5021
+ AddOnProductsComponent
4267
5022
  ],
4268
5023
  imports: [
4269
5024
  CommonModule,
@@ -4294,9 +5049,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
4294
5049
  ScrollingModule,
4295
5050
  NgxMatSelectSearchModule,
4296
5051
  MatDialogModule,
4297
- HttpClientModule
5052
+ HttpClientModule,
5053
+ MatAutocompleteModule
4298
5054
  ],
4299
5055
  exports: [
5056
+ MatAutocompleteModule,
4300
5057
  NgxRenderMaterialFormsComponent,
4301
5058
  FormioComponent,
4302
5059
  MatInputModule,