ngx-render-material-forms 1.4.2 → 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/components/add-on-products/add-on-products.component.mjs +329 -0
- package/esm2020/lib/components/button/button.component.mjs +15 -11
- package/esm2020/lib/components/common.service.mjs +85 -0
- package/esm2020/lib/components/datagrid/datagrid.component.mjs +198 -7
- package/esm2020/lib/components/select/select.component.mjs +3 -3
- package/esm2020/lib/ngx-render-material-forms.module.mjs +16 -6
- package/fesm2015/ngx-render-material-forms.js +636 -36
- package/fesm2015/ngx-render-material-forms.mjs.map +1 -1
- package/fesm2020/ngx-render-material-forms.js +627 -36
- package/fesm2020/ngx-render-material-forms.mjs.map +1 -1
- package/lib/components/add-on-products/add-on-products.component.d.ts +76 -0
- package/lib/components/button/button.component.d.ts +6 -0
- package/lib/components/common.service.d.ts +23 -0
- package/lib/components/datagrid/datagrid.component.d.ts +18 -0
- package/lib/ngx-render-material-forms.module.d.ts +29 -27
- package/package.json +1 -1
|
@@ -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$
|
|
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
|
|
30
|
+
import * as i10 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
|
|
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$
|
|
40
|
+
import * as i1$1 from '@angular/material/dialog';
|
|
41
41
|
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
42
|
+
import * as i14 from '@angular/material/autocomplete';
|
|
43
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
42
44
|
import Webform from 'formiojs/Webform.js';
|
|
43
45
|
import FormioComponent$2 from 'formiojs/components/_classes/component/Component.js';
|
|
44
46
|
import TextFieldComponent from 'formiojs/components/textfield/TextField.js';
|
|
@@ -81,7 +83,7 @@ import RadioComponent from 'formiojs/components/radio/Radio.js';
|
|
|
81
83
|
import SelectBoxesComponent from 'formiojs/components/selectboxes/SelectBoxes.js';
|
|
82
84
|
import SelectComponent from 'formiojs/components/select/Select.js';
|
|
83
85
|
import { Subject } from 'rxjs';
|
|
84
|
-
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
|
86
|
+
import { debounceTime, distinctUntilChanged, takeUntil, startWith, map } from 'rxjs/operators';
|
|
85
87
|
import * as CryptoJS from 'crypto-js';
|
|
86
88
|
import { isNullOrUndefined } from 'util';
|
|
87
89
|
import * as i9 from 'ngx-mat-select-search';
|
|
@@ -90,14 +92,15 @@ import WellComponent from 'formiojs/components/well/Well.js';
|
|
|
90
92
|
import DataGridComponent from 'formiojs/components/datagrid/DataGrid.js';
|
|
91
93
|
import * as i8 from '@angular/cdk/drag-drop';
|
|
92
94
|
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
95
|
+
import { SelectionModel } from '@angular/cdk/collections';
|
|
96
|
+
import * as i13 from '@angular/material/stepper';
|
|
97
|
+
import { MatStepperModule } from '@angular/material/stepper';
|
|
93
98
|
import EditGridComponent from 'formiojs/components/editgrid/EditGrid.js';
|
|
94
99
|
import Components$2 from 'formiojs/components/Components';
|
|
95
100
|
import isString from 'lodash/isString';
|
|
96
101
|
import TableComponent from 'formiojs/components/table/Table.js';
|
|
97
102
|
import Wizard from 'formiojs/Wizard';
|
|
98
103
|
import Displays from 'formiojs/displays/Displays';
|
|
99
|
-
import * as i3$3 from '@angular/material/stepper';
|
|
100
|
-
import { MatStepperModule } from '@angular/material/stepper';
|
|
101
104
|
import * as i1$3 from '@formio/angular';
|
|
102
105
|
import { FormioBaseComponent } from '@formio/angular';
|
|
103
106
|
import { FlexLayoutModule } from '@angular/flex-layout';
|
|
@@ -976,8 +979,11 @@ var AngularButtonsThemes;
|
|
|
976
979
|
})(AngularButtonsThemes || (AngularButtonsThemes = {}));
|
|
977
980
|
|
|
978
981
|
class MaterialButtonComponent extends MaterialComponent {
|
|
979
|
-
constructor() {
|
|
980
|
-
super(
|
|
982
|
+
constructor(element, ref, dialog) {
|
|
983
|
+
super(element, ref);
|
|
984
|
+
this.element = element;
|
|
985
|
+
this.ref = ref;
|
|
986
|
+
this.dialog = dialog;
|
|
981
987
|
this.loading = false;
|
|
982
988
|
this.done = false;
|
|
983
989
|
this.error = false;
|
|
@@ -1048,12 +1054,12 @@ class MaterialButtonComponent extends MaterialComponent {
|
|
|
1048
1054
|
return retVal;
|
|
1049
1055
|
}
|
|
1050
1056
|
}
|
|
1051
|
-
MaterialButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, deps:
|
|
1052
|
-
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"] }] });
|
|
1057
|
+
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 });
|
|
1058
|
+
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"] }] });
|
|
1053
1059
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialButtonComponent, decorators: [{
|
|
1054
1060
|
type: Component,
|
|
1055
|
-
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"] }]
|
|
1056
|
-
}] });
|
|
1061
|
+
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"] }]
|
|
1062
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }]; } });
|
|
1057
1063
|
ButtonComponent.MaterialComponent = MaterialButtonComponent;
|
|
1058
1064
|
|
|
1059
1065
|
class MaterialTextareaComponent extends MaterialComponent {
|
|
@@ -2631,7 +2637,7 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2631
2637
|
return item ? item.value : null;
|
|
2632
2638
|
}
|
|
2633
2639
|
loadData(pageNumber, pageSize, searchQuery) {
|
|
2634
|
-
const paramsData = JSON.parse(localStorage.getItem('
|
|
2640
|
+
const paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
|
|
2635
2641
|
const includeDescription = this.getValueByKey(paramsData, 'includeDescription');
|
|
2636
2642
|
const vendorId = this.getValueByKey(paramsData, 'vendorId');
|
|
2637
2643
|
const onlyActive = this.getValueByKey(paramsData, 'onlyActive');
|
|
@@ -2750,7 +2756,7 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2750
2756
|
if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
|
|
2751
2757
|
this.selectElem.openedChange.subscribe((isOpen) => {
|
|
2752
2758
|
if (isOpen) {
|
|
2753
|
-
this.pageNumber =
|
|
2759
|
+
this.pageNumber = 2;
|
|
2754
2760
|
this.pageSize = 20;
|
|
2755
2761
|
this.searchQuery = '';
|
|
2756
2762
|
this.searching = false;
|
|
@@ -2808,7 +2814,7 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2808
2814
|
return _.isEqual(o1, o2);
|
|
2809
2815
|
}
|
|
2810
2816
|
}
|
|
2811
|
-
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$
|
|
2817
|
+
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 }], target: i0.ɵɵFactoryTarget.Component });
|
|
2812
2818
|
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: `
|
|
2813
2819
|
<mat-formio-form-field [instance]="instance" [componentTemplate]="componentTemplate"></mat-formio-form-field>
|
|
2814
2820
|
<ng-template #componentTemplate let-hasLabel>
|
|
@@ -2893,7 +2899,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
2893
2899
|
</mat-form-field>
|
|
2894
2900
|
</ng-template>
|
|
2895
2901
|
`, 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"] }]
|
|
2896
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$
|
|
2902
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.HttpClient }]; }, propDecorators: { multiSelect: [{
|
|
2897
2903
|
type: ViewChild,
|
|
2898
2904
|
args: ['multiSelect', { static: true }]
|
|
2899
2905
|
}], selectElem: [{
|
|
@@ -2952,16 +2958,404 @@ class ConfirmationDialogComponent {
|
|
|
2952
2958
|
ngOnInit() {
|
|
2953
2959
|
}
|
|
2954
2960
|
}
|
|
2955
|
-
ConfirmationDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, deps: [{ token: i1$
|
|
2956
|
-
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$
|
|
2961
|
+
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 });
|
|
2962
|
+
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"] }] });
|
|
2957
2963
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, decorators: [{
|
|
2958
2964
|
type: Component,
|
|
2959
2965
|
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"] }]
|
|
2960
|
-
}], ctorParameters: function () { return [{ type: i1$
|
|
2966
|
+
}], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
2961
2967
|
type: Inject,
|
|
2962
2968
|
args: [MAT_DIALOG_DATA]
|
|
2963
2969
|
}] }]; } });
|
|
2964
2970
|
|
|
2971
|
+
class CommonService {
|
|
2972
|
+
constructor(http) {
|
|
2973
|
+
this.http = http;
|
|
2974
|
+
this.holy = '';
|
|
2975
|
+
this.grail = '';
|
|
2976
|
+
this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
|
|
2977
|
+
this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
|
|
2978
|
+
this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
|
|
2979
|
+
this.currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
|
2980
|
+
}
|
|
2981
|
+
scrumble(msg) {
|
|
2982
|
+
if (!isNullOrUndefined(msg)) {
|
|
2983
|
+
var conceal = this.getcampaign(msg, this.holy, this.grail);
|
|
2984
|
+
var sha256 = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(this.grail) + conceal.toString(), CryptoJS.enc.Base64.stringify(this.holy));
|
|
2985
|
+
var hashInBase64 = CryptoJS.enc.Base64.stringify(sha256);
|
|
2986
|
+
let keyValue = {
|
|
2987
|
+
"value": conceal.toString(),
|
|
2988
|
+
"mac": hashInBase64
|
|
2989
|
+
};
|
|
2990
|
+
var result = JSON.stringify(keyValue);
|
|
2991
|
+
var jumbled = CryptoJS.enc.Utf8.parse(result);
|
|
2992
|
+
return CryptoJS.enc.Base64.stringify(jumbled);
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
getcampaign(data, holy, grail) {
|
|
2996
|
+
return CryptoJS.AES.encrypt(data.toString(), holy, {
|
|
2997
|
+
blockSize: 128,
|
|
2998
|
+
iv: grail,
|
|
2999
|
+
mode: CryptoJS.mode.CBC,
|
|
3000
|
+
padding: CryptoJS.pad.Pkcs7
|
|
3001
|
+
});
|
|
3002
|
+
}
|
|
3003
|
+
getBaseApiUrl() {
|
|
3004
|
+
const baseUrlMapping = {
|
|
3005
|
+
'localhost': 'http://localhost:58504',
|
|
3006
|
+
'lincoln.vartopia.com': 'https://lincoln-api.vartopia.com',
|
|
3007
|
+
'stage.vartopia.com': 'https://stage-api.vartopia.com',
|
|
3008
|
+
'my.vartopia.com': 'https://reagan-api.vartopia.com',
|
|
3009
|
+
'jackson.vartopia.com': 'https://jackson-api.vartopia.com'
|
|
3010
|
+
};
|
|
3011
|
+
// Get the current hostname
|
|
3012
|
+
const hostname = window.location.hostname;
|
|
3013
|
+
return baseUrlMapping[hostname] || null;
|
|
3014
|
+
}
|
|
3015
|
+
listProductCategory() {
|
|
3016
|
+
const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
|
|
3017
|
+
const baseApiUrl = this.getBaseApiUrl();
|
|
3018
|
+
return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsCategory?vendorId=${vendorId}`);
|
|
3019
|
+
}
|
|
3020
|
+
listSubCategory(category) {
|
|
3021
|
+
const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
|
|
3022
|
+
const baseApiUrl = this.getBaseApiUrl();
|
|
3023
|
+
return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsSubCategory?vendorId=${vendorId}&categoryName=${category}`);
|
|
3024
|
+
}
|
|
3025
|
+
// Function to get value by key from the array
|
|
3026
|
+
getValueByKey(data, key) {
|
|
3027
|
+
if (!data || data.length === 0) {
|
|
3028
|
+
return null; // Return null if data is empty or undefined
|
|
3029
|
+
}
|
|
3030
|
+
const item = data.find(kv => kv.key.toLowerCase() === key.toLowerCase());
|
|
3031
|
+
return item ? item.value : null;
|
|
3032
|
+
}
|
|
3033
|
+
// this.http.get<VendorProductsResponse>(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${envendorId}&pageNumber=${enpageNumber}&pageSize=${enpageSize}&search=${ensearchQuery}&onlyActive=${enactive}&includeDescription=${endescription}`, { headers }).subscribe(response => {
|
|
3034
|
+
loadProducts(pageNumber, pazeSize, search = '', onlyActive = true, description = false, category, subCategory) {
|
|
3035
|
+
const baseApiUrl = this.getBaseApiUrl();
|
|
3036
|
+
const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
|
|
3037
|
+
const encodeCat = encodeURIComponent(category);
|
|
3038
|
+
const encodeSubCat = encodeURIComponent(subCategory);
|
|
3039
|
+
return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${vendorId}&pageNumber=${pageNumber}&pageSize=${pazeSize}&search=${search}&onlyActive=${onlyActive}&includeDescription=${description}&category=${encodeCat}&subCategory=${encodeSubCat}`);
|
|
3040
|
+
}
|
|
3041
|
+
}
|
|
3042
|
+
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 });
|
|
3043
|
+
CommonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
3044
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, decorators: [{
|
|
3045
|
+
type: Injectable,
|
|
3046
|
+
args: [{
|
|
3047
|
+
providedIn: 'root'
|
|
3048
|
+
}]
|
|
3049
|
+
}], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; } });
|
|
3050
|
+
|
|
3051
|
+
class AddOnProductsComponent {
|
|
3052
|
+
constructor(matDialogRef, data, fb, dialog, commonSevice) {
|
|
3053
|
+
this.matDialogRef = matDialogRef;
|
|
3054
|
+
this.fb = fb;
|
|
3055
|
+
this.dialog = dialog;
|
|
3056
|
+
this.commonSevice = commonSevice;
|
|
3057
|
+
this.category = [];
|
|
3058
|
+
this.subCategory = [];
|
|
3059
|
+
this.filteredCategories = [];
|
|
3060
|
+
this.filteredSubCategories = [];
|
|
3061
|
+
this.addProductsColumns = ['select', 'productName', 'price'];
|
|
3062
|
+
this.showAllproductsColumns = ['delete', 'productName', 'categoryName', 'subCategory', 'Quantity', 'price'];
|
|
3063
|
+
this.quantityList = [5, 10, 15, 20, 25];
|
|
3064
|
+
this.ELEMENT_DATA = [];
|
|
3065
|
+
this.dataSource = new MatTableDataSource();
|
|
3066
|
+
this.selection = new SelectionModel(true, []);
|
|
3067
|
+
this.selectedDataSource = new MatTableDataSource([]);
|
|
3068
|
+
this.selectedCategory = null;
|
|
3069
|
+
this.selectedSubCategory = null;
|
|
3070
|
+
this.showCategory = false;
|
|
3071
|
+
this.showSubcategory = false;
|
|
3072
|
+
this.showPrice = true;
|
|
3073
|
+
this.showQuantity = true;
|
|
3074
|
+
this.showNewProductPicker = true;
|
|
3075
|
+
this.setCategory = '';
|
|
3076
|
+
this.setSubCategory = '';
|
|
3077
|
+
this.loadingFlag = false;
|
|
3078
|
+
this.pageNumber = 1;
|
|
3079
|
+
this.pageSize = 20;
|
|
3080
|
+
this.totalPages = 0;
|
|
3081
|
+
this.searchQuery = '';
|
|
3082
|
+
this.itemList = [];
|
|
3083
|
+
this.prevScrollPosition = 0; // Track the previous scroll position
|
|
3084
|
+
this.spinnerFlag = false;
|
|
3085
|
+
this.showCategory = data.attributesFlag.showCategory;
|
|
3086
|
+
this.showSubcategory = data.attributesFlag.showSubcategory;
|
|
3087
|
+
this.showPrice = data.attributesFlag.showPrice;
|
|
3088
|
+
this.showQuantity = data.attributesFlag.showQuantity;
|
|
3089
|
+
this.showNewProductPicker = data.showNewProductPicker;
|
|
3090
|
+
this.setCategory = data.category || '';
|
|
3091
|
+
this.setSubCategory = data.subCategory || '';
|
|
3092
|
+
this.selection = new SelectionModel(true, data.selectedProducts || []);
|
|
3093
|
+
this.form = this.fb.group({
|
|
3094
|
+
productCategory: [''],
|
|
3095
|
+
productSubcategory: [''],
|
|
3096
|
+
selectedProducts: this.fb.array([])
|
|
3097
|
+
});
|
|
3098
|
+
this.initializeFormArray();
|
|
3099
|
+
if (!this.showCategory) {
|
|
3100
|
+
this.removeColumn('categoryName');
|
|
3101
|
+
}
|
|
3102
|
+
if (!this.showPrice) {
|
|
3103
|
+
this.removeColumn('price');
|
|
3104
|
+
}
|
|
3105
|
+
if (!this.showSubcategory) {
|
|
3106
|
+
this.removeColumn('subCategory');
|
|
3107
|
+
}
|
|
3108
|
+
if (!this.showQuantity) {
|
|
3109
|
+
this.removeColumn('Quantity');
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
removeColumn(columnName) {
|
|
3113
|
+
this.showAllproductsColumns = this.showAllproductsColumns.filter(column => column !== columnName);
|
|
3114
|
+
this.addProductsColumns = this.addProductsColumns.filter(column => column !== columnName);
|
|
3115
|
+
}
|
|
3116
|
+
initializeFormArray() {
|
|
3117
|
+
const selectedProductsArray = this.form.get('selectedProducts');
|
|
3118
|
+
this.selection.selected.forEach(product => {
|
|
3119
|
+
selectedProductsArray.push(this.fb.group({
|
|
3120
|
+
price: [product.price || '', Validators.required],
|
|
3121
|
+
text: [product.text || ''],
|
|
3122
|
+
quantity: [product.quantity || '', Validators.required],
|
|
3123
|
+
category: [product?.category || ''],
|
|
3124
|
+
subCategory: [product?.subCategory || ''],
|
|
3125
|
+
value: [product?.value || '']
|
|
3126
|
+
}));
|
|
3127
|
+
});
|
|
3128
|
+
this.selectedDataSource.data = [...this.selection.selected];
|
|
3129
|
+
}
|
|
3130
|
+
initializeDataSources() {
|
|
3131
|
+
// Ensure selected items are marked in the main data source
|
|
3132
|
+
if (this.selection?.selected?.length) {
|
|
3133
|
+
this.selection?.selected?.forEach(selectedProduct => {
|
|
3134
|
+
const index = this.dataSource.data.findIndex(product => product.value === selectedProduct.value);
|
|
3135
|
+
if (index >= 0) {
|
|
3136
|
+
this.dataSource.data[index] = selectedProduct;
|
|
3137
|
+
}
|
|
3138
|
+
});
|
|
3139
|
+
this.selectedDataSource.data = [...this.selection.selected];
|
|
3140
|
+
}
|
|
3141
|
+
else {
|
|
3142
|
+
console.warn('No selected products found.');
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
ngAfterViewInit() {
|
|
3146
|
+
}
|
|
3147
|
+
ngOnInit() {
|
|
3148
|
+
this.loadProductCategory();
|
|
3149
|
+
this.form.get('productCategory').valueChanges
|
|
3150
|
+
.pipe(startWith(''), map(value => this.filterProducts(value, 'category1'))).subscribe(filterCat => {
|
|
3151
|
+
this.filteredCategories = filterCat;
|
|
3152
|
+
});
|
|
3153
|
+
this.form.get('productSubcategory').valueChanges
|
|
3154
|
+
.pipe(startWith(''), map(value => this.filterProducts(value, 'subCategory'))).subscribe(subCat => {
|
|
3155
|
+
this.filteredSubCategories = subCat;
|
|
3156
|
+
});
|
|
3157
|
+
}
|
|
3158
|
+
loadProductCategory() {
|
|
3159
|
+
this.spinnerFlag = true;
|
|
3160
|
+
this.commonSevice.listProductCategory().subscribe(response => {
|
|
3161
|
+
this.spinnerFlag = false;
|
|
3162
|
+
if (response && response.code === 200) {
|
|
3163
|
+
this.category = response.data;
|
|
3164
|
+
this.filteredCategories = this.filterProducts(this.setCategory, 'category1');
|
|
3165
|
+
this.form.get('productCategory').setValue(this.setCategory);
|
|
3166
|
+
if (this.setCategory !== '') {
|
|
3167
|
+
this.onOptionSelected(this.setCategory, 'category1');
|
|
3168
|
+
this.form.get('productSubcategory').setValue(this.setSubCategory);
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
});
|
|
3172
|
+
}
|
|
3173
|
+
filterProducts(value, cat) {
|
|
3174
|
+
const filterValue = value.toLowerCase();
|
|
3175
|
+
const data = cat === 'category1' ? this.category : this.subCategory;
|
|
3176
|
+
if (!filterValue) {
|
|
3177
|
+
return data;
|
|
3178
|
+
}
|
|
3179
|
+
else {
|
|
3180
|
+
return data.filter(option => option.toLowerCase().includes(filterValue));
|
|
3181
|
+
}
|
|
3182
|
+
}
|
|
3183
|
+
onSubmit() {
|
|
3184
|
+
if (this.form.valid) {
|
|
3185
|
+
this.matDialogRef.close({
|
|
3186
|
+
data: {
|
|
3187
|
+
status: true,
|
|
3188
|
+
items: this.form.value
|
|
3189
|
+
}
|
|
3190
|
+
});
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
isAllSelected() {
|
|
3194
|
+
const numSelected = this.selection.selected.length;
|
|
3195
|
+
const numRows = this.dataSource.data.length;
|
|
3196
|
+
return numSelected === numRows;
|
|
3197
|
+
}
|
|
3198
|
+
isIndeterminate() {
|
|
3199
|
+
const numSelected = this.selection.selected.length;
|
|
3200
|
+
const numRows = this.dataSource.data.length;
|
|
3201
|
+
return numSelected > 0 && numSelected < numRows;
|
|
3202
|
+
}
|
|
3203
|
+
masterToggle() {
|
|
3204
|
+
this.isAllSelected()
|
|
3205
|
+
? this.selection.clear()
|
|
3206
|
+
: this.dataSource.data.forEach(row => this.selection.select(row));
|
|
3207
|
+
this.updateSelectedProducts();
|
|
3208
|
+
}
|
|
3209
|
+
toggleSelection(row) {
|
|
3210
|
+
this.selection.toggle(row);
|
|
3211
|
+
this.updateSelectedProducts();
|
|
3212
|
+
}
|
|
3213
|
+
// Getter for the FormArray
|
|
3214
|
+
get selectedProducts() {
|
|
3215
|
+
return this.form.get('selectedProducts');
|
|
3216
|
+
}
|
|
3217
|
+
updateSelectedProducts() {
|
|
3218
|
+
if (Array.isArray(this.selection.selected)) {
|
|
3219
|
+
this.selectedDataSource.data = [...this.selection.selected];
|
|
3220
|
+
const selectedProductsArray = this.selectedProducts;
|
|
3221
|
+
selectedProductsArray.clear();
|
|
3222
|
+
this.selection?.selected?.forEach(product => {
|
|
3223
|
+
selectedProductsArray?.push(this.fb.group({
|
|
3224
|
+
price: [product?.price ?? '', this.showPrice ? Validators.required : []],
|
|
3225
|
+
text: [product?.text || ''],
|
|
3226
|
+
quantity: [product?.quantity ?? '', this.showQuantity ? Validators.required : []],
|
|
3227
|
+
category: [product?.category || ''],
|
|
3228
|
+
subCategory: [product?.subCategory || ''],
|
|
3229
|
+
value: [product?.value || '']
|
|
3230
|
+
}));
|
|
3231
|
+
});
|
|
3232
|
+
}
|
|
3233
|
+
else {
|
|
3234
|
+
console.error('Selection.selected is not an array:', this.selection.selected);
|
|
3235
|
+
}
|
|
3236
|
+
}
|
|
3237
|
+
getTotalRows() {
|
|
3238
|
+
return this.dataSource.data.length;
|
|
3239
|
+
}
|
|
3240
|
+
getSelectedRowsCount() {
|
|
3241
|
+
return this.selection.selected.length;
|
|
3242
|
+
}
|
|
3243
|
+
onOptionSelected(event, category) {
|
|
3244
|
+
let selectedValue;
|
|
3245
|
+
if (event && event.option && event.option.value !== undefined) {
|
|
3246
|
+
selectedValue = event.option.value;
|
|
3247
|
+
}
|
|
3248
|
+
else {
|
|
3249
|
+
selectedValue = event;
|
|
3250
|
+
}
|
|
3251
|
+
if (category === 'category1') {
|
|
3252
|
+
this.selectedCategory = selectedValue;
|
|
3253
|
+
this.spinnerFlag = true;
|
|
3254
|
+
this.commonSevice.listSubCategory(selectedValue).subscribe(response => {
|
|
3255
|
+
this.spinnerFlag = false;
|
|
3256
|
+
if (response && response.code === 200) {
|
|
3257
|
+
this.subCategory = response.data;
|
|
3258
|
+
this.filteredSubCategories = this.filterProducts(this.setCategory, 'subCategory');
|
|
3259
|
+
if (this.setSubCategory !== '') {
|
|
3260
|
+
this.selectedSubCategory = this.setSubCategory;
|
|
3261
|
+
this.getProducts();
|
|
3262
|
+
}
|
|
3263
|
+
}
|
|
3264
|
+
});
|
|
3265
|
+
}
|
|
3266
|
+
else {
|
|
3267
|
+
if (category === 'subCategory') {
|
|
3268
|
+
this.selectedSubCategory = event.option.value;
|
|
3269
|
+
this.getProducts();
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
getProducts() {
|
|
3274
|
+
this.spinnerFlag = true;
|
|
3275
|
+
this.commonSevice.loadProducts(this.pageNumber, this.pageSize, '', true, false, this.selectedCategory, this.selectedSubCategory).subscribe(response => {
|
|
3276
|
+
this.spinnerFlag = false;
|
|
3277
|
+
if (response && response.code === 200) {
|
|
3278
|
+
//this.dataSource.data = response.data.dataSource;
|
|
3279
|
+
this.totalPages = response?.data?.totalPages;
|
|
3280
|
+
const data = response.data.dataSource;
|
|
3281
|
+
if (this.dataSource.data.length > 0) {
|
|
3282
|
+
data.forEach(item => this.dataSource.data.push(item));
|
|
3283
|
+
this.dataSource.data = [...this.dataSource.data];
|
|
3284
|
+
}
|
|
3285
|
+
else {
|
|
3286
|
+
this.dataSource.data = data;
|
|
3287
|
+
}
|
|
3288
|
+
this.loadingFlag = true;
|
|
3289
|
+
setTimeout(() => {
|
|
3290
|
+
const middlePosition = this.trackHeight / 2 - 50;
|
|
3291
|
+
if (this.firstscrollableDiv && this.firstscrollableDiv.nativeElement) {
|
|
3292
|
+
this.firstscrollableDiv.nativeElement.scrollTo({ top: middlePosition, behavior: 'auto' });
|
|
3293
|
+
}
|
|
3294
|
+
}, 250);
|
|
3295
|
+
this.initializeDataSources();
|
|
3296
|
+
}
|
|
3297
|
+
});
|
|
3298
|
+
}
|
|
3299
|
+
removeRow(event, element) {
|
|
3300
|
+
event.stopPropagation();
|
|
3301
|
+
event.preventDefault();
|
|
3302
|
+
let message = 'Are you sure you want to delete this product?';
|
|
3303
|
+
let showButton = true;
|
|
3304
|
+
const index = this.selectedDataSource.data.indexOf(element);
|
|
3305
|
+
if (index >= 0) {
|
|
3306
|
+
if (this.selectedDataSource.data.length === 1) {
|
|
3307
|
+
message = 'Please select at least one product.';
|
|
3308
|
+
showButton = false;
|
|
3309
|
+
}
|
|
3310
|
+
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
3311
|
+
disableClose: true,
|
|
3312
|
+
width: '90%',
|
|
3313
|
+
maxWidth: '400px',
|
|
3314
|
+
data: { message: message, buttonStatus: showButton }
|
|
3315
|
+
});
|
|
3316
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
3317
|
+
if (result) {
|
|
3318
|
+
this.selectedDataSource.data.splice(index, 1);
|
|
3319
|
+
this.selectedDataSource._updateChangeSubscription();
|
|
3320
|
+
this.selection.deselect(element);
|
|
3321
|
+
const selectedProductsArray = this.form.get('selectedProducts');
|
|
3322
|
+
const productIndex = selectedProductsArray.controls.findIndex(control => control.value.productName === element.productName);
|
|
3323
|
+
if (productIndex >= 0) {
|
|
3324
|
+
selectedProductsArray.removeAt(productIndex);
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3327
|
+
});
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
onScroll(event) {
|
|
3331
|
+
this.trackHeight = event.target.scrollHeight - event.target.offsetHeight;
|
|
3332
|
+
if (this.loadingFlag && (Math.floor(event.target.scrollTop / this.trackHeight * 100) > 50)) {
|
|
3333
|
+
this.loadingFlag = false;
|
|
3334
|
+
if (this.pageNumber < this.totalPages) {
|
|
3335
|
+
this.pageNumber = this.pageNumber + 1;
|
|
3336
|
+
this.getProducts();
|
|
3337
|
+
}
|
|
3338
|
+
else {
|
|
3339
|
+
this.loadingFlag = true;
|
|
3340
|
+
}
|
|
3341
|
+
}
|
|
3342
|
+
this.prevScrollPosition = event.target.scrollTop;
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
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 });
|
|
3346
|
+
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\">\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=\"dropdown-selection\">\r\n <div class=\"row-one\">\r\n <mat-form-field>\r\n <mat-label>Product Category</mat-label>\r\n <input type=\"text\" matInput formControlName=\"productCategory\" [matAutocomplete]=\"auto3\">\r\n <mat-autocomplete #auto3=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category1')\">\r\n <mat-option *ngFor=\"let option of filteredCategories\"\r\n [value]=\"option\">{{option}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field> \r\n\r\n <mat-form-field>\r\n <mat-label>Subcategory</mat-label>\r\n <input type=\"text\" matInput formControlName=\"productSubcategory\" [matAutocomplete]=\"auto4\">\r\n <mat-autocomplete #auto4=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'subCategory')\">\r\n <mat-option *ngFor=\"let option of filteredSubCategories\"\r\n [value]=\"option\">{{option}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div #firstscrollableDiv id=\"firstscrollableDiv\" class=\"new-class mat-elevation-z8 first-div\" (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 <!-- <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"isAllSelected()\"\r\n [indeterminate]=\"isIndeterminate()\"></mat-checkbox> -->\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\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 [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 mat-elevation-z8\">\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 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=\"subCategory\">\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\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.mat-elevation-z8{margin-top:20px;max-height:350px;overflow-y:auto;margin-bottom:20px}.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%)}\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: 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: 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.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i10.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i10.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i10.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i10.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i10.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i10.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i10.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i10.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i10.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: "component", type: i13.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "directive", type: i13.MatStepLabel, selector: "[matStepLabel]" }, { kind: "component", type: i13.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: i13.MatStepperNext, selector: "button[matStepperNext]", inputs: ["type"] }, { kind: "directive", type: i13.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: "component", type: i14.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i14.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }] });
|
|
3347
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AddOnProductsComponent, decorators: [{
|
|
3348
|
+
type: Component,
|
|
3349
|
+
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\">\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=\"dropdown-selection\">\r\n <div class=\"row-one\">\r\n <mat-form-field>\r\n <mat-label>Product Category</mat-label>\r\n <input type=\"text\" matInput formControlName=\"productCategory\" [matAutocomplete]=\"auto3\">\r\n <mat-autocomplete #auto3=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'category1')\">\r\n <mat-option *ngFor=\"let option of filteredCategories\"\r\n [value]=\"option\">{{option}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field> \r\n\r\n <mat-form-field>\r\n <mat-label>Subcategory</mat-label>\r\n <input type=\"text\" matInput formControlName=\"productSubcategory\" [matAutocomplete]=\"auto4\">\r\n <mat-autocomplete #auto4=\"matAutocomplete\"\r\n (optionSelected)=\"onOptionSelected($event, 'subCategory')\">\r\n <mat-option *ngFor=\"let option of filteredSubCategories\"\r\n [value]=\"option\">{{option}}</mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div #firstscrollableDiv id=\"firstscrollableDiv\" class=\"new-class mat-elevation-z8 first-div\" (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 <!-- <mat-checkbox (change)=\"$event ? masterToggle() : null\" [checked]=\"isAllSelected()\"\r\n [indeterminate]=\"isIndeterminate()\"></mat-checkbox> -->\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\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 [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 mat-elevation-z8\">\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 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=\"subCategory\">\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\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.mat-elevation-z8{margin-top:20px;max-height:350px;overflow-y:auto;margin-bottom:20px}.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%)}\n"] }]
|
|
3350
|
+
}], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
3351
|
+
type: Inject,
|
|
3352
|
+
args: [MAT_DIALOG_DATA]
|
|
3353
|
+
}] }, { type: i2.FormBuilder }, { type: i1$1.MatDialog }, { type: CommonService }]; }, propDecorators: { firstscrollableDiv: [{
|
|
3354
|
+
type: ViewChild,
|
|
3355
|
+
args: ['firstscrollableDiv']
|
|
3356
|
+
}] } });
|
|
3357
|
+
|
|
3358
|
+
const ELEMENT_DATA = [];
|
|
2965
3359
|
class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
2966
3360
|
constructor(element, ref, dialog) {
|
|
2967
3361
|
super(element, ref);
|
|
@@ -2969,13 +3363,54 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
2969
3363
|
this.ref = ref;
|
|
2970
3364
|
this.dialog = dialog;
|
|
2971
3365
|
this.dataSource = new MatTableDataSource();
|
|
3366
|
+
this.dataSourceNew = ELEMENT_DATA;
|
|
3367
|
+
this.displayedColumnsNew = ['productName', 'category', 'subCategory', 'quantity', 'price'];
|
|
3368
|
+
this.showNewProductPicker = false;
|
|
3369
|
+
this.showCategory = false;
|
|
3370
|
+
this.showSubcategory = false;
|
|
3371
|
+
this.showPrice = true;
|
|
3372
|
+
this.showQuantity = true;
|
|
3373
|
+
this.category = '';
|
|
3374
|
+
this.subCategory = '';
|
|
3375
|
+
this.hasInitialized = false;
|
|
2972
3376
|
}
|
|
2973
3377
|
getColumnLabel(column) {
|
|
2974
3378
|
return column.label || column.key;
|
|
2975
3379
|
}
|
|
3380
|
+
checkIsAttributeTrue(newProductPickerFlag, attributeName) {
|
|
3381
|
+
return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
|
|
3382
|
+
newProductPickerFlag[key].toLowerCase() === "true");
|
|
3383
|
+
}
|
|
3384
|
+
// ngOnInit(): void {
|
|
3385
|
+
// }
|
|
2976
3386
|
setInstance(instance) {
|
|
3387
|
+
const newProductPickerFlag = instance?.component?.attributes;
|
|
3388
|
+
this.showNewProductPicker = this.checkIsAttributeTrue(newProductPickerFlag, "newproductpicker");
|
|
3389
|
+
this.showCategory = this.checkIsAttributeTrue(newProductPickerFlag, "showCategory");
|
|
3390
|
+
this.showSubcategory = this.checkIsAttributeTrue(newProductPickerFlag, "showSubcategory");
|
|
3391
|
+
this.showPrice = this.checkIsAttributeTrue(newProductPickerFlag, "showPrice");
|
|
3392
|
+
this.showQuantity = this.checkIsAttributeTrue(newProductPickerFlag, "showQuantity");
|
|
2977
3393
|
super.setInstance(instance);
|
|
2978
|
-
this.
|
|
3394
|
+
if (this.showNewProductPicker && !this.hasInitialized) {
|
|
3395
|
+
if (!this.showCategory) {
|
|
3396
|
+
this.removeColumn('category');
|
|
3397
|
+
}
|
|
3398
|
+
if (!this.showQuantity) {
|
|
3399
|
+
this.removeColumn('quantity');
|
|
3400
|
+
}
|
|
3401
|
+
if (!this.showPrice) {
|
|
3402
|
+
this.removeColumn('price');
|
|
3403
|
+
}
|
|
3404
|
+
if (!this.showSubcategory) {
|
|
3405
|
+
this.removeColumn('subCategory');
|
|
3406
|
+
}
|
|
3407
|
+
this.dataSourceNew = JSON.parse(localStorage.getItem('selectedProducts')) || [];
|
|
3408
|
+
// Set flag to true to prevent further execution
|
|
3409
|
+
this.hasInitialized = true;
|
|
3410
|
+
}
|
|
3411
|
+
else {
|
|
3412
|
+
this.dataSource.data = instance.dataValue;
|
|
3413
|
+
}
|
|
2979
3414
|
this.columns = {};
|
|
2980
3415
|
this.displayedColumns = [];
|
|
2981
3416
|
this.formColumns = [];
|
|
@@ -3003,7 +3438,10 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3003
3438
|
return viewContainer ? viewContainer : null;
|
|
3004
3439
|
};
|
|
3005
3440
|
}
|
|
3006
|
-
|
|
3441
|
+
removeColumn(columnName) {
|
|
3442
|
+
this.displayedColumnsNew = this.displayedColumnsNew.filter(column => column !== columnName);
|
|
3443
|
+
}
|
|
3444
|
+
addAnotherOld() {
|
|
3007
3445
|
this.checkRowsNumber();
|
|
3008
3446
|
this.instance.addRow();
|
|
3009
3447
|
if (this.dataSource.data.length < this.instance.rows.length) {
|
|
@@ -3011,6 +3449,55 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3011
3449
|
}
|
|
3012
3450
|
this.dataSource.data = [...this.dataSource.data];
|
|
3013
3451
|
}
|
|
3452
|
+
addAnother() {
|
|
3453
|
+
if (this.showNewProductPicker) {
|
|
3454
|
+
const savedData = JSON.parse(localStorage.getItem('saveCat'));
|
|
3455
|
+
// Use optional chaining and nullish coalescing to set the values
|
|
3456
|
+
this.category = savedData?.category ?? this.category;
|
|
3457
|
+
this.subCategory = savedData?.subCategory ?? this.subCategory;
|
|
3458
|
+
const diologeRef = this.dialog.open(AddOnProductsComponent, {
|
|
3459
|
+
disableClose: true,
|
|
3460
|
+
width: '90%',
|
|
3461
|
+
maxWidth: '900px',
|
|
3462
|
+
autoFocus: false,
|
|
3463
|
+
data: { attributesFlag: { showNewProductPicker: this.showNewProductPicker, showCategory: this.showCategory, showSubcategory: this.showSubcategory, showPrice: this.showPrice, showQuantity: this.showQuantity }, selectedProducts: this.dataSourceNew, category: this.category, subCategory: this.subCategory }
|
|
3464
|
+
})
|
|
3465
|
+
.afterClosed().subscribe(response => {
|
|
3466
|
+
if (response?.data?.status) {
|
|
3467
|
+
if (!this.showCategory) {
|
|
3468
|
+
this.removeColumn('category');
|
|
3469
|
+
}
|
|
3470
|
+
if (!this.showQuantity) {
|
|
3471
|
+
this.removeColumn('quantity');
|
|
3472
|
+
}
|
|
3473
|
+
if (!this.showPrice) {
|
|
3474
|
+
this.removeColumn('price');
|
|
3475
|
+
}
|
|
3476
|
+
if (!this.showSubcategory) {
|
|
3477
|
+
this.removeColumn('subCategory');
|
|
3478
|
+
}
|
|
3479
|
+
localStorage.setItem('selectedProducts', JSON.stringify(response.data.items.selectedProducts));
|
|
3480
|
+
this.dataSourceNew = response.data.items.selectedProducts;
|
|
3481
|
+
this.category = response.data.items.productCategory;
|
|
3482
|
+
this.subCategory = response.data.items.productSubcategory;
|
|
3483
|
+
const catObject = {
|
|
3484
|
+
category: this.category,
|
|
3485
|
+
subCategory: this.subCategory
|
|
3486
|
+
};
|
|
3487
|
+
localStorage.setItem('saveCat', JSON.stringify(catObject));
|
|
3488
|
+
this.instance.component.defaultValue = response.data.items.selectedProducts;
|
|
3489
|
+
}
|
|
3490
|
+
});
|
|
3491
|
+
}
|
|
3492
|
+
else {
|
|
3493
|
+
this.checkRowsNumber();
|
|
3494
|
+
this.instance.addRow();
|
|
3495
|
+
if (this.dataSource.data.length < this.instance.rows.length) {
|
|
3496
|
+
this.dataSource.data.push({});
|
|
3497
|
+
}
|
|
3498
|
+
this.dataSource.data = [...this.dataSource.data];
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3014
3501
|
checkRowsNumber() {
|
|
3015
3502
|
while (this.instance.rows.length < this.dataSource.data.length) {
|
|
3016
3503
|
this.instance.addRow();
|
|
@@ -3060,7 +3547,7 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3060
3547
|
super.setValue(value);
|
|
3061
3548
|
}
|
|
3062
3549
|
}
|
|
3063
|
-
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$
|
|
3550
|
+
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 }], target: i0.ɵɵFactoryTarget.Component });
|
|
3064
3551
|
MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialDataGridComponent, selector: "mat-formio-datagrid", usesInheritance: true, ngImport: i0, template: `
|
|
3065
3552
|
<mat-formio-form-field [instance]="instance"
|
|
3066
3553
|
[componentTemplate]="componentTemplate"
|
|
@@ -3079,6 +3566,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3079
3566
|
{{instance.component.addAnother || 'Add Another'}}
|
|
3080
3567
|
</button>
|
|
3081
3568
|
</mat-card-actions>
|
|
3569
|
+
<ng-container *ngIf="!showNewProductPicker">
|
|
3570
|
+
<div class="mat-elevation-z8">
|
|
3082
3571
|
<table
|
|
3083
3572
|
mat-table
|
|
3084
3573
|
[dataSource]="dataSource"
|
|
@@ -3087,7 +3576,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3087
3576
|
cdkDropList
|
|
3088
3577
|
[cdkDropListData]="dataSource"
|
|
3089
3578
|
(cdkDropListDropped)="dropTable($event)">
|
|
3090
|
-
|
|
3579
|
+
|
|
3580
|
+
|
|
3091
3581
|
<ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
|
|
3092
3582
|
<th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
|
|
3093
3583
|
<td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
|
|
@@ -3117,6 +3607,51 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3117
3607
|
<tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
3118
3608
|
</div>
|
|
3119
3609
|
</table>
|
|
3610
|
+
</div>
|
|
3611
|
+
</ng-container>
|
|
3612
|
+
|
|
3613
|
+
<table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
|
|
3614
|
+
<!-- Product Name Column -->
|
|
3615
|
+
<ng-container matColumnDef="productName">
|
|
3616
|
+
<th mat-header-cell *matHeaderCellDef> Product Name </th>
|
|
3617
|
+
<td mat-cell *matCellDef="let element"> {{element.text}} </td>
|
|
3618
|
+
</ng-container>
|
|
3619
|
+
|
|
3620
|
+
<!-- Quantity Column -->
|
|
3621
|
+
<ng-container matColumnDef="quantity" *ngIf="showQuantity">
|
|
3622
|
+
<th mat-header-cell *matHeaderCellDef> Quantity </th>
|
|
3623
|
+
<td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
|
|
3624
|
+
</ng-container>
|
|
3625
|
+
|
|
3626
|
+
<!-- Price Column -->
|
|
3627
|
+
<ng-container matColumnDef="price" *ngIf="showPrice">
|
|
3628
|
+
<th mat-header-cell *matHeaderCellDef> Price </th>
|
|
3629
|
+
<td mat-cell *matCellDef="let element"> {{element.price}} </td>
|
|
3630
|
+
</ng-container>
|
|
3631
|
+
|
|
3632
|
+
<!-- Category Column -->
|
|
3633
|
+
<ng-container matColumnDef="category" *ngIf="showCategory">
|
|
3634
|
+
<th mat-header-cell *matHeaderCellDef> Category </th>
|
|
3635
|
+
<td mat-cell *matCellDef="let element"> {{element.category}} </td>
|
|
3636
|
+
</ng-container>
|
|
3637
|
+
|
|
3638
|
+
<!-- Category Column -->
|
|
3639
|
+
<ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
|
|
3640
|
+
<th mat-header-cell *matHeaderCellDef> Sub Category </th>
|
|
3641
|
+
<td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
|
|
3642
|
+
</ng-container>
|
|
3643
|
+
|
|
3644
|
+
<tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
|
|
3645
|
+
<tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
|
|
3646
|
+
</table>
|
|
3647
|
+
<ng-template #noData>
|
|
3648
|
+
<div class="no-data-message" *ngIf="showNewProductPicker">
|
|
3649
|
+
No product found please add some products.
|
|
3650
|
+
</div>
|
|
3651
|
+
</ng-template>
|
|
3652
|
+
|
|
3653
|
+
|
|
3654
|
+
|
|
3120
3655
|
</mat-card-content>
|
|
3121
3656
|
<mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
|
|
3122
3657
|
<button mat-raised-button color="primary" (click)="addAnother()">
|
|
@@ -3132,7 +3667,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3132
3667
|
<span [instance]="instance" matFormioLabel></span>
|
|
3133
3668
|
</mat-card-title>
|
|
3134
3669
|
</ng-template>
|
|
3135
|
-
`, 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:
|
|
3670
|
+
`, 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.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i10.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i10.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i10.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i10.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i10.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i10.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i10.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i10.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i10.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: i8.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: i8.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: i8.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"] }] });
|
|
3136
3671
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, decorators: [{
|
|
3137
3672
|
type: Component,
|
|
3138
3673
|
args: [{ selector: 'mat-formio-datagrid', template: `
|
|
@@ -3153,6 +3688,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3153
3688
|
{{instance.component.addAnother || 'Add Another'}}
|
|
3154
3689
|
</button>
|
|
3155
3690
|
</mat-card-actions>
|
|
3691
|
+
<ng-container *ngIf="!showNewProductPicker">
|
|
3692
|
+
<div class="mat-elevation-z8">
|
|
3156
3693
|
<table
|
|
3157
3694
|
mat-table
|
|
3158
3695
|
[dataSource]="dataSource"
|
|
@@ -3161,7 +3698,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3161
3698
|
cdkDropList
|
|
3162
3699
|
[cdkDropListData]="dataSource"
|
|
3163
3700
|
(cdkDropListDropped)="dropTable($event)">
|
|
3164
|
-
|
|
3701
|
+
|
|
3702
|
+
|
|
3165
3703
|
<ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
|
|
3166
3704
|
<th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
|
|
3167
3705
|
<td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
|
|
@@ -3191,6 +3729,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3191
3729
|
<tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
3192
3730
|
</div>
|
|
3193
3731
|
</table>
|
|
3732
|
+
</div>
|
|
3733
|
+
</ng-container>
|
|
3734
|
+
|
|
3735
|
+
<table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
|
|
3736
|
+
<!-- Product Name Column -->
|
|
3737
|
+
<ng-container matColumnDef="productName">
|
|
3738
|
+
<th mat-header-cell *matHeaderCellDef> Product Name </th>
|
|
3739
|
+
<td mat-cell *matCellDef="let element"> {{element.text}} </td>
|
|
3740
|
+
</ng-container>
|
|
3741
|
+
|
|
3742
|
+
<!-- Quantity Column -->
|
|
3743
|
+
<ng-container matColumnDef="quantity" *ngIf="showQuantity">
|
|
3744
|
+
<th mat-header-cell *matHeaderCellDef> Quantity </th>
|
|
3745
|
+
<td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
|
|
3746
|
+
</ng-container>
|
|
3747
|
+
|
|
3748
|
+
<!-- Price Column -->
|
|
3749
|
+
<ng-container matColumnDef="price" *ngIf="showPrice">
|
|
3750
|
+
<th mat-header-cell *matHeaderCellDef> Price </th>
|
|
3751
|
+
<td mat-cell *matCellDef="let element"> {{element.price}} </td>
|
|
3752
|
+
</ng-container>
|
|
3753
|
+
|
|
3754
|
+
<!-- Category Column -->
|
|
3755
|
+
<ng-container matColumnDef="category" *ngIf="showCategory">
|
|
3756
|
+
<th mat-header-cell *matHeaderCellDef> Category </th>
|
|
3757
|
+
<td mat-cell *matCellDef="let element"> {{element.category}} </td>
|
|
3758
|
+
</ng-container>
|
|
3759
|
+
|
|
3760
|
+
<!-- Category Column -->
|
|
3761
|
+
<ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
|
|
3762
|
+
<th mat-header-cell *matHeaderCellDef> Sub Category </th>
|
|
3763
|
+
<td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
|
|
3764
|
+
</ng-container>
|
|
3765
|
+
|
|
3766
|
+
<tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
|
|
3767
|
+
<tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
|
|
3768
|
+
</table>
|
|
3769
|
+
<ng-template #noData>
|
|
3770
|
+
<div class="no-data-message" *ngIf="showNewProductPicker">
|
|
3771
|
+
No product found please add some products.
|
|
3772
|
+
</div>
|
|
3773
|
+
</ng-template>
|
|
3774
|
+
|
|
3775
|
+
|
|
3776
|
+
|
|
3194
3777
|
</mat-card-content>
|
|
3195
3778
|
<mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
|
|
3196
3779
|
<button mat-raised-button color="primary" (click)="addAnother()">
|
|
@@ -3206,8 +3789,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3206
3789
|
<span [instance]="instance" matFormioLabel></span>
|
|
3207
3790
|
</mat-card-title>
|
|
3208
3791
|
</ng-template>
|
|
3209
|
-
`, styles: [".datagrid-row{height:auto}\n"] }]
|
|
3210
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$
|
|
3792
|
+
`, 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"] }]
|
|
3793
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }]; } });
|
|
3211
3794
|
DataGridComponent.MaterialComponent = MaterialDataGridComponent;
|
|
3212
3795
|
|
|
3213
3796
|
var EditRowState;
|
|
@@ -3593,7 +4176,7 @@ MaterialWizardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
|
|
|
3593
4176
|
<button *ngIf="instance.hasButton('submit')" mat-raised-button color="primary" (click)="submit()">Submit</button>
|
|
3594
4177
|
</div>
|
|
3595
4178
|
</mat-step>
|
|
3596
|
-
</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:
|
|
4179
|
+
</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: i13.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "component", type: i13.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }] });
|
|
3597
4180
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialWizardComponent, decorators: [{
|
|
3598
4181
|
type: Component,
|
|
3599
4182
|
args: [{ selector: 'mat-formio-wizard', template: `
|
|
@@ -3763,7 +4346,7 @@ FormioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
|
|
|
3763
4346
|
<div fxLayout="column" fxLayoutGap="1em">
|
|
3764
4347
|
<ng-template #formio></ng-template>
|
|
3765
4348
|
</div>
|
|
3766
|
-
`, 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:
|
|
4349
|
+
`, 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"] }] });
|
|
3767
4350
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormioComponent, decorators: [{
|
|
3768
4351
|
type: Component,
|
|
3769
4352
|
args: [{ selector: 'mat-formio', template: `
|
|
@@ -3833,7 +4416,8 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
|
|
|
3833
4416
|
FormioFormFieldComponent,
|
|
3834
4417
|
LabelComponent,
|
|
3835
4418
|
MaskDirective,
|
|
3836
|
-
ConfirmationDialogComponent
|
|
4419
|
+
ConfirmationDialogComponent,
|
|
4420
|
+
AddOnProductsComponent], imports: [CommonModule,
|
|
3837
4421
|
FormsModule,
|
|
3838
4422
|
ReactiveFormsModule,
|
|
3839
4423
|
MatInputModule,
|
|
@@ -3861,7 +4445,9 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
|
|
|
3861
4445
|
ScrollingModule,
|
|
3862
4446
|
NgxMatSelectSearchModule,
|
|
3863
4447
|
MatDialogModule,
|
|
3864
|
-
HttpClientModule
|
|
4448
|
+
HttpClientModule,
|
|
4449
|
+
MatAutocompleteModule], exports: [MatAutocompleteModule,
|
|
4450
|
+
NgxRenderMaterialFormsComponent,
|
|
3865
4451
|
FormioComponent,
|
|
3866
4452
|
MatInputModule,
|
|
3867
4453
|
MatFormFieldModule,
|
|
@@ -3915,7 +4501,9 @@ NgxRenderMaterialFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.
|
|
|
3915
4501
|
ScrollingModule,
|
|
3916
4502
|
NgxMatSelectSearchModule,
|
|
3917
4503
|
MatDialogModule,
|
|
3918
|
-
HttpClientModule,
|
|
4504
|
+
HttpClientModule,
|
|
4505
|
+
MatAutocompleteModule, MatAutocompleteModule,
|
|
4506
|
+
MatInputModule,
|
|
3919
4507
|
MatFormFieldModule,
|
|
3920
4508
|
MatCheckboxModule,
|
|
3921
4509
|
MatRadioModule,
|
|
@@ -3983,7 +4571,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3983
4571
|
FormioFormFieldComponent,
|
|
3984
4572
|
LabelComponent,
|
|
3985
4573
|
MaskDirective,
|
|
3986
|
-
ConfirmationDialogComponent
|
|
4574
|
+
ConfirmationDialogComponent,
|
|
4575
|
+
AddOnProductsComponent
|
|
3987
4576
|
],
|
|
3988
4577
|
imports: [
|
|
3989
4578
|
CommonModule,
|
|
@@ -4014,9 +4603,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
4014
4603
|
ScrollingModule,
|
|
4015
4604
|
NgxMatSelectSearchModule,
|
|
4016
4605
|
MatDialogModule,
|
|
4017
|
-
HttpClientModule
|
|
4606
|
+
HttpClientModule,
|
|
4607
|
+
MatAutocompleteModule
|
|
4018
4608
|
],
|
|
4019
4609
|
exports: [
|
|
4610
|
+
MatAutocompleteModule,
|
|
4020
4611
|
NgxRenderMaterialFormsComponent,
|
|
4021
4612
|
FormioComponent,
|
|
4022
4613
|
MatInputModule,
|