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');
|
|
@@ -2751,7 +2757,7 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2751
2757
|
if (this.instance.component.key.toLowerCase() === 'vendorproductid') {
|
|
2752
2758
|
this.selectElem.openedChange.subscribe((isOpen) => {
|
|
2753
2759
|
if (isOpen) {
|
|
2754
|
-
this.pageNumber =
|
|
2760
|
+
this.pageNumber = 2;
|
|
2755
2761
|
this.pageSize = 20;
|
|
2756
2762
|
this.searchQuery = '';
|
|
2757
2763
|
this.searching = false;
|
|
@@ -2809,7 +2815,7 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2809
2815
|
return _.isEqual(o1, o2);
|
|
2810
2816
|
}
|
|
2811
2817
|
}
|
|
2812
|
-
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$
|
|
2818
|
+
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 });
|
|
2813
2819
|
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: `
|
|
2814
2820
|
<mat-formio-form-field [instance]="instance" [componentTemplate]="componentTemplate"></mat-formio-form-field>
|
|
2815
2821
|
<ng-template #componentTemplate let-hasLabel>
|
|
@@ -2894,7 +2900,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
2894
2900
|
</mat-form-field>
|
|
2895
2901
|
</ng-template>
|
|
2896
2902
|
`, 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"] }]
|
|
2897
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$
|
|
2903
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.HttpClient }]; }, propDecorators: { multiSelect: [{
|
|
2898
2904
|
type: ViewChild,
|
|
2899
2905
|
args: ['multiSelect', { static: true }]
|
|
2900
2906
|
}], selectElem: [{
|
|
@@ -2953,18 +2959,412 @@ class ConfirmationDialogComponent {
|
|
|
2953
2959
|
ngOnInit() {
|
|
2954
2960
|
}
|
|
2955
2961
|
}
|
|
2956
|
-
ConfirmationDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, deps: [{ token: i1$
|
|
2957
|
-
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$
|
|
2962
|
+
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 });
|
|
2963
|
+
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"] }] });
|
|
2958
2964
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, decorators: [{
|
|
2959
2965
|
type: Component,
|
|
2960
2966
|
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"] }]
|
|
2961
2967
|
}], ctorParameters: function () {
|
|
2962
|
-
return [{ type: i1$
|
|
2968
|
+
return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
2963
2969
|
type: Inject,
|
|
2964
2970
|
args: [MAT_DIALOG_DATA]
|
|
2965
2971
|
}] }];
|
|
2966
2972
|
} });
|
|
2967
2973
|
|
|
2974
|
+
class CommonService {
|
|
2975
|
+
constructor(http) {
|
|
2976
|
+
this.http = http;
|
|
2977
|
+
this.holy = '';
|
|
2978
|
+
this.grail = '';
|
|
2979
|
+
this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
|
|
2980
|
+
this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
|
|
2981
|
+
this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
|
|
2982
|
+
this.currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
|
2983
|
+
}
|
|
2984
|
+
scrumble(msg) {
|
|
2985
|
+
if (!isNullOrUndefined(msg)) {
|
|
2986
|
+
var conceal = this.getcampaign(msg, this.holy, this.grail);
|
|
2987
|
+
var sha256 = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(this.grail) + conceal.toString(), CryptoJS.enc.Base64.stringify(this.holy));
|
|
2988
|
+
var hashInBase64 = CryptoJS.enc.Base64.stringify(sha256);
|
|
2989
|
+
let keyValue = {
|
|
2990
|
+
"value": conceal.toString(),
|
|
2991
|
+
"mac": hashInBase64
|
|
2992
|
+
};
|
|
2993
|
+
var result = JSON.stringify(keyValue);
|
|
2994
|
+
var jumbled = CryptoJS.enc.Utf8.parse(result);
|
|
2995
|
+
return CryptoJS.enc.Base64.stringify(jumbled);
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
getcampaign(data, holy, grail) {
|
|
2999
|
+
return CryptoJS.AES.encrypt(data.toString(), holy, {
|
|
3000
|
+
blockSize: 128,
|
|
3001
|
+
iv: grail,
|
|
3002
|
+
mode: CryptoJS.mode.CBC,
|
|
3003
|
+
padding: CryptoJS.pad.Pkcs7
|
|
3004
|
+
});
|
|
3005
|
+
}
|
|
3006
|
+
getBaseApiUrl() {
|
|
3007
|
+
const baseUrlMapping = {
|
|
3008
|
+
'localhost': 'http://localhost:58504',
|
|
3009
|
+
'lincoln.vartopia.com': 'https://lincoln-api.vartopia.com',
|
|
3010
|
+
'stage.vartopia.com': 'https://stage-api.vartopia.com',
|
|
3011
|
+
'my.vartopia.com': 'https://reagan-api.vartopia.com',
|
|
3012
|
+
'jackson.vartopia.com': 'https://jackson-api.vartopia.com'
|
|
3013
|
+
};
|
|
3014
|
+
// Get the current hostname
|
|
3015
|
+
const hostname = window.location.hostname;
|
|
3016
|
+
return baseUrlMapping[hostname] || null;
|
|
3017
|
+
}
|
|
3018
|
+
listProductCategory() {
|
|
3019
|
+
const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
|
|
3020
|
+
const baseApiUrl = this.getBaseApiUrl();
|
|
3021
|
+
return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsCategory?vendorId=${vendorId}`);
|
|
3022
|
+
}
|
|
3023
|
+
listSubCategory(category) {
|
|
3024
|
+
const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
|
|
3025
|
+
const baseApiUrl = this.getBaseApiUrl();
|
|
3026
|
+
return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsSubCategory?vendorId=${vendorId}&categoryName=${category}`);
|
|
3027
|
+
}
|
|
3028
|
+
// Function to get value by key from the array
|
|
3029
|
+
getValueByKey(data, key) {
|
|
3030
|
+
if (!data || data.length === 0) {
|
|
3031
|
+
return null; // Return null if data is empty or undefined
|
|
3032
|
+
}
|
|
3033
|
+
const item = data.find(kv => kv.key.toLowerCase() === key.toLowerCase());
|
|
3034
|
+
return item ? item.value : null;
|
|
3035
|
+
}
|
|
3036
|
+
// this.http.get<VendorProductsResponse>(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${envendorId}&pageNumber=${enpageNumber}&pageSize=${enpageSize}&search=${ensearchQuery}&onlyActive=${enactive}&includeDescription=${endescription}`, { headers }).subscribe(response => {
|
|
3037
|
+
loadProducts(pageNumber, pazeSize, search = '', onlyActive = true, description = false, category, subCategory) {
|
|
3038
|
+
const baseApiUrl = this.getBaseApiUrl();
|
|
3039
|
+
const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
|
|
3040
|
+
const encodeCat = encodeURIComponent(category);
|
|
3041
|
+
const encodeSubCat = encodeURIComponent(subCategory);
|
|
3042
|
+
return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${vendorId}&pageNumber=${pageNumber}&pageSize=${pazeSize}&search=${search}&onlyActive=${onlyActive}&includeDescription=${description}&category=${encodeCat}&subCategory=${encodeSubCat}`);
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
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 });
|
|
3046
|
+
CommonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
3047
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, decorators: [{
|
|
3048
|
+
type: Injectable,
|
|
3049
|
+
args: [{
|
|
3050
|
+
providedIn: 'root'
|
|
3051
|
+
}]
|
|
3052
|
+
}], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; } });
|
|
3053
|
+
|
|
3054
|
+
class AddOnProductsComponent {
|
|
3055
|
+
constructor(matDialogRef, data, fb, dialog, commonSevice) {
|
|
3056
|
+
this.matDialogRef = matDialogRef;
|
|
3057
|
+
this.fb = fb;
|
|
3058
|
+
this.dialog = dialog;
|
|
3059
|
+
this.commonSevice = commonSevice;
|
|
3060
|
+
this.category = [];
|
|
3061
|
+
this.subCategory = [];
|
|
3062
|
+
this.filteredCategories = [];
|
|
3063
|
+
this.filteredSubCategories = [];
|
|
3064
|
+
this.addProductsColumns = ['select', 'productName', 'price'];
|
|
3065
|
+
this.showAllproductsColumns = ['delete', 'productName', 'categoryName', 'subCategory', 'Quantity', 'price'];
|
|
3066
|
+
this.quantityList = [5, 10, 15, 20, 25];
|
|
3067
|
+
this.ELEMENT_DATA = [];
|
|
3068
|
+
this.dataSource = new MatTableDataSource();
|
|
3069
|
+
this.selection = new SelectionModel(true, []);
|
|
3070
|
+
this.selectedDataSource = new MatTableDataSource([]);
|
|
3071
|
+
this.selectedCategory = null;
|
|
3072
|
+
this.selectedSubCategory = null;
|
|
3073
|
+
this.showCategory = false;
|
|
3074
|
+
this.showSubcategory = false;
|
|
3075
|
+
this.showPrice = true;
|
|
3076
|
+
this.showQuantity = true;
|
|
3077
|
+
this.showNewProductPicker = true;
|
|
3078
|
+
this.setCategory = '';
|
|
3079
|
+
this.setSubCategory = '';
|
|
3080
|
+
this.loadingFlag = false;
|
|
3081
|
+
this.pageNumber = 1;
|
|
3082
|
+
this.pageSize = 20;
|
|
3083
|
+
this.totalPages = 0;
|
|
3084
|
+
this.searchQuery = '';
|
|
3085
|
+
this.itemList = [];
|
|
3086
|
+
this.prevScrollPosition = 0; // Track the previous scroll position
|
|
3087
|
+
this.spinnerFlag = false;
|
|
3088
|
+
this.showCategory = data.attributesFlag.showCategory;
|
|
3089
|
+
this.showSubcategory = data.attributesFlag.showSubcategory;
|
|
3090
|
+
this.showPrice = data.attributesFlag.showPrice;
|
|
3091
|
+
this.showQuantity = data.attributesFlag.showQuantity;
|
|
3092
|
+
this.showNewProductPicker = data.showNewProductPicker;
|
|
3093
|
+
this.setCategory = data.category || '';
|
|
3094
|
+
this.setSubCategory = data.subCategory || '';
|
|
3095
|
+
this.selection = new SelectionModel(true, data.selectedProducts || []);
|
|
3096
|
+
this.form = this.fb.group({
|
|
3097
|
+
productCategory: [''],
|
|
3098
|
+
productSubcategory: [''],
|
|
3099
|
+
selectedProducts: this.fb.array([])
|
|
3100
|
+
});
|
|
3101
|
+
this.initializeFormArray();
|
|
3102
|
+
if (!this.showCategory) {
|
|
3103
|
+
this.removeColumn('categoryName');
|
|
3104
|
+
}
|
|
3105
|
+
if (!this.showPrice) {
|
|
3106
|
+
this.removeColumn('price');
|
|
3107
|
+
}
|
|
3108
|
+
if (!this.showSubcategory) {
|
|
3109
|
+
this.removeColumn('subCategory');
|
|
3110
|
+
}
|
|
3111
|
+
if (!this.showQuantity) {
|
|
3112
|
+
this.removeColumn('Quantity');
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3115
|
+
removeColumn(columnName) {
|
|
3116
|
+
this.showAllproductsColumns = this.showAllproductsColumns.filter(column => column !== columnName);
|
|
3117
|
+
this.addProductsColumns = this.addProductsColumns.filter(column => column !== columnName);
|
|
3118
|
+
}
|
|
3119
|
+
initializeFormArray() {
|
|
3120
|
+
const selectedProductsArray = this.form.get('selectedProducts');
|
|
3121
|
+
this.selection.selected.forEach(product => {
|
|
3122
|
+
selectedProductsArray.push(this.fb.group({
|
|
3123
|
+
price: [product.price || '', Validators.required],
|
|
3124
|
+
text: [product.text || ''],
|
|
3125
|
+
quantity: [product.quantity || '', Validators.required],
|
|
3126
|
+
category: [(product === null || product === void 0 ? void 0 : product.category) || ''],
|
|
3127
|
+
subCategory: [(product === null || product === void 0 ? void 0 : product.subCategory) || ''],
|
|
3128
|
+
value: [(product === null || product === void 0 ? void 0 : product.value) || '']
|
|
3129
|
+
}));
|
|
3130
|
+
});
|
|
3131
|
+
this.selectedDataSource.data = [...this.selection.selected];
|
|
3132
|
+
}
|
|
3133
|
+
initializeDataSources() {
|
|
3134
|
+
var _a, _b, _c, _d;
|
|
3135
|
+
// Ensure selected items are marked in the main data source
|
|
3136
|
+
if ((_b = (_a = this.selection) === null || _a === void 0 ? void 0 : _a.selected) === null || _b === void 0 ? void 0 : _b.length) {
|
|
3137
|
+
(_d = (_c = this.selection) === null || _c === void 0 ? void 0 : _c.selected) === null || _d === void 0 ? void 0 : _d.forEach(selectedProduct => {
|
|
3138
|
+
const index = this.dataSource.data.findIndex(product => product.value === selectedProduct.value);
|
|
3139
|
+
if (index >= 0) {
|
|
3140
|
+
this.dataSource.data[index] = selectedProduct;
|
|
3141
|
+
}
|
|
3142
|
+
});
|
|
3143
|
+
this.selectedDataSource.data = [...this.selection.selected];
|
|
3144
|
+
}
|
|
3145
|
+
else {
|
|
3146
|
+
console.warn('No selected products found.');
|
|
3147
|
+
}
|
|
3148
|
+
}
|
|
3149
|
+
ngAfterViewInit() {
|
|
3150
|
+
}
|
|
3151
|
+
ngOnInit() {
|
|
3152
|
+
this.loadProductCategory();
|
|
3153
|
+
this.form.get('productCategory').valueChanges
|
|
3154
|
+
.pipe(startWith(''), map(value => this.filterProducts(value, 'category1'))).subscribe(filterCat => {
|
|
3155
|
+
this.filteredCategories = filterCat;
|
|
3156
|
+
});
|
|
3157
|
+
this.form.get('productSubcategory').valueChanges
|
|
3158
|
+
.pipe(startWith(''), map(value => this.filterProducts(value, 'subCategory'))).subscribe(subCat => {
|
|
3159
|
+
this.filteredSubCategories = subCat;
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
loadProductCategory() {
|
|
3163
|
+
this.spinnerFlag = true;
|
|
3164
|
+
this.commonSevice.listProductCategory().subscribe(response => {
|
|
3165
|
+
this.spinnerFlag = false;
|
|
3166
|
+
if (response && response.code === 200) {
|
|
3167
|
+
this.category = response.data;
|
|
3168
|
+
this.filteredCategories = this.filterProducts(this.setCategory, 'category1');
|
|
3169
|
+
this.form.get('productCategory').setValue(this.setCategory);
|
|
3170
|
+
if (this.setCategory !== '') {
|
|
3171
|
+
this.onOptionSelected(this.setCategory, 'category1');
|
|
3172
|
+
this.form.get('productSubcategory').setValue(this.setSubCategory);
|
|
3173
|
+
}
|
|
3174
|
+
}
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
filterProducts(value, cat) {
|
|
3178
|
+
const filterValue = value.toLowerCase();
|
|
3179
|
+
const data = cat === 'category1' ? this.category : this.subCategory;
|
|
3180
|
+
if (!filterValue) {
|
|
3181
|
+
return data;
|
|
3182
|
+
}
|
|
3183
|
+
else {
|
|
3184
|
+
return data.filter(option => option.toLowerCase().includes(filterValue));
|
|
3185
|
+
}
|
|
3186
|
+
}
|
|
3187
|
+
onSubmit() {
|
|
3188
|
+
if (this.form.valid) {
|
|
3189
|
+
this.matDialogRef.close({
|
|
3190
|
+
data: {
|
|
3191
|
+
status: true,
|
|
3192
|
+
items: this.form.value
|
|
3193
|
+
}
|
|
3194
|
+
});
|
|
3195
|
+
}
|
|
3196
|
+
}
|
|
3197
|
+
isAllSelected() {
|
|
3198
|
+
const numSelected = this.selection.selected.length;
|
|
3199
|
+
const numRows = this.dataSource.data.length;
|
|
3200
|
+
return numSelected === numRows;
|
|
3201
|
+
}
|
|
3202
|
+
isIndeterminate() {
|
|
3203
|
+
const numSelected = this.selection.selected.length;
|
|
3204
|
+
const numRows = this.dataSource.data.length;
|
|
3205
|
+
return numSelected > 0 && numSelected < numRows;
|
|
3206
|
+
}
|
|
3207
|
+
masterToggle() {
|
|
3208
|
+
this.isAllSelected()
|
|
3209
|
+
? this.selection.clear()
|
|
3210
|
+
: this.dataSource.data.forEach(row => this.selection.select(row));
|
|
3211
|
+
this.updateSelectedProducts();
|
|
3212
|
+
}
|
|
3213
|
+
toggleSelection(row) {
|
|
3214
|
+
this.selection.toggle(row);
|
|
3215
|
+
this.updateSelectedProducts();
|
|
3216
|
+
}
|
|
3217
|
+
// Getter for the FormArray
|
|
3218
|
+
get selectedProducts() {
|
|
3219
|
+
return this.form.get('selectedProducts');
|
|
3220
|
+
}
|
|
3221
|
+
updateSelectedProducts() {
|
|
3222
|
+
var _a, _b;
|
|
3223
|
+
if (Array.isArray(this.selection.selected)) {
|
|
3224
|
+
this.selectedDataSource.data = [...this.selection.selected];
|
|
3225
|
+
const selectedProductsArray = this.selectedProducts;
|
|
3226
|
+
selectedProductsArray.clear();
|
|
3227
|
+
(_b = (_a = this.selection) === null || _a === void 0 ? void 0 : _a.selected) === null || _b === void 0 ? void 0 : _b.forEach(product => {
|
|
3228
|
+
var _a, _b;
|
|
3229
|
+
selectedProductsArray === null || selectedProductsArray === void 0 ? void 0 : selectedProductsArray.push(this.fb.group({
|
|
3230
|
+
price: [(_a = product === null || product === void 0 ? void 0 : product.price) !== null && _a !== void 0 ? _a : '', this.showPrice ? Validators.required : []],
|
|
3231
|
+
text: [(product === null || product === void 0 ? void 0 : product.text) || ''],
|
|
3232
|
+
quantity: [(_b = product === null || product === void 0 ? void 0 : product.quantity) !== null && _b !== void 0 ? _b : '', this.showQuantity ? Validators.required : []],
|
|
3233
|
+
category: [(product === null || product === void 0 ? void 0 : product.category) || ''],
|
|
3234
|
+
subCategory: [(product === null || product === void 0 ? void 0 : product.subCategory) || ''],
|
|
3235
|
+
value: [(product === null || product === void 0 ? void 0 : product.value) || '']
|
|
3236
|
+
}));
|
|
3237
|
+
});
|
|
3238
|
+
}
|
|
3239
|
+
else {
|
|
3240
|
+
console.error('Selection.selected is not an array:', this.selection.selected);
|
|
3241
|
+
}
|
|
3242
|
+
}
|
|
3243
|
+
getTotalRows() {
|
|
3244
|
+
return this.dataSource.data.length;
|
|
3245
|
+
}
|
|
3246
|
+
getSelectedRowsCount() {
|
|
3247
|
+
return this.selection.selected.length;
|
|
3248
|
+
}
|
|
3249
|
+
onOptionSelected(event, category) {
|
|
3250
|
+
let selectedValue;
|
|
3251
|
+
if (event && event.option && event.option.value !== undefined) {
|
|
3252
|
+
selectedValue = event.option.value;
|
|
3253
|
+
}
|
|
3254
|
+
else {
|
|
3255
|
+
selectedValue = event;
|
|
3256
|
+
}
|
|
3257
|
+
if (category === 'category1') {
|
|
3258
|
+
this.selectedCategory = selectedValue;
|
|
3259
|
+
this.spinnerFlag = true;
|
|
3260
|
+
this.commonSevice.listSubCategory(selectedValue).subscribe(response => {
|
|
3261
|
+
this.spinnerFlag = false;
|
|
3262
|
+
if (response && response.code === 200) {
|
|
3263
|
+
this.subCategory = response.data;
|
|
3264
|
+
this.filteredSubCategories = this.filterProducts(this.setCategory, 'subCategory');
|
|
3265
|
+
if (this.setSubCategory !== '') {
|
|
3266
|
+
this.selectedSubCategory = this.setSubCategory;
|
|
3267
|
+
this.getProducts();
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
else {
|
|
3273
|
+
if (category === 'subCategory') {
|
|
3274
|
+
this.selectedSubCategory = event.option.value;
|
|
3275
|
+
this.getProducts();
|
|
3276
|
+
}
|
|
3277
|
+
}
|
|
3278
|
+
}
|
|
3279
|
+
getProducts() {
|
|
3280
|
+
this.spinnerFlag = true;
|
|
3281
|
+
this.commonSevice.loadProducts(this.pageNumber, this.pageSize, '', true, false, this.selectedCategory, this.selectedSubCategory).subscribe(response => {
|
|
3282
|
+
var _a;
|
|
3283
|
+
this.spinnerFlag = false;
|
|
3284
|
+
if (response && response.code === 200) {
|
|
3285
|
+
//this.dataSource.data = response.data.dataSource;
|
|
3286
|
+
this.totalPages = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.totalPages;
|
|
3287
|
+
const data = response.data.dataSource;
|
|
3288
|
+
if (this.dataSource.data.length > 0) {
|
|
3289
|
+
data.forEach(item => this.dataSource.data.push(item));
|
|
3290
|
+
this.dataSource.data = [...this.dataSource.data];
|
|
3291
|
+
}
|
|
3292
|
+
else {
|
|
3293
|
+
this.dataSource.data = data;
|
|
3294
|
+
}
|
|
3295
|
+
this.loadingFlag = true;
|
|
3296
|
+
setTimeout(() => {
|
|
3297
|
+
const middlePosition = this.trackHeight / 2 - 50;
|
|
3298
|
+
if (this.firstscrollableDiv && this.firstscrollableDiv.nativeElement) {
|
|
3299
|
+
this.firstscrollableDiv.nativeElement.scrollTo({ top: middlePosition, behavior: 'auto' });
|
|
3300
|
+
}
|
|
3301
|
+
}, 250);
|
|
3302
|
+
this.initializeDataSources();
|
|
3303
|
+
}
|
|
3304
|
+
});
|
|
3305
|
+
}
|
|
3306
|
+
removeRow(event, element) {
|
|
3307
|
+
event.stopPropagation();
|
|
3308
|
+
event.preventDefault();
|
|
3309
|
+
let message = 'Are you sure you want to delete this product?';
|
|
3310
|
+
let showButton = true;
|
|
3311
|
+
const index = this.selectedDataSource.data.indexOf(element);
|
|
3312
|
+
if (index >= 0) {
|
|
3313
|
+
if (this.selectedDataSource.data.length === 1) {
|
|
3314
|
+
message = 'Please select at least one product.';
|
|
3315
|
+
showButton = false;
|
|
3316
|
+
}
|
|
3317
|
+
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
3318
|
+
disableClose: true,
|
|
3319
|
+
width: '90%',
|
|
3320
|
+
maxWidth: '400px',
|
|
3321
|
+
data: { message: message, buttonStatus: showButton }
|
|
3322
|
+
});
|
|
3323
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
3324
|
+
if (result) {
|
|
3325
|
+
this.selectedDataSource.data.splice(index, 1);
|
|
3326
|
+
this.selectedDataSource._updateChangeSubscription();
|
|
3327
|
+
this.selection.deselect(element);
|
|
3328
|
+
const selectedProductsArray = this.form.get('selectedProducts');
|
|
3329
|
+
const productIndex = selectedProductsArray.controls.findIndex(control => control.value.productName === element.productName);
|
|
3330
|
+
if (productIndex >= 0) {
|
|
3331
|
+
selectedProductsArray.removeAt(productIndex);
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
onScroll(event) {
|
|
3338
|
+
this.trackHeight = event.target.scrollHeight - event.target.offsetHeight;
|
|
3339
|
+
if (this.loadingFlag && (Math.floor(event.target.scrollTop / this.trackHeight * 100) > 50)) {
|
|
3340
|
+
this.loadingFlag = false;
|
|
3341
|
+
if (this.pageNumber < this.totalPages) {
|
|
3342
|
+
this.pageNumber = this.pageNumber + 1;
|
|
3343
|
+
this.getProducts();
|
|
3344
|
+
}
|
|
3345
|
+
else {
|
|
3346
|
+
this.loadingFlag = true;
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
this.prevScrollPosition = event.target.scrollTop;
|
|
3350
|
+
}
|
|
3351
|
+
}
|
|
3352
|
+
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 });
|
|
3353
|
+
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"] }] });
|
|
3354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AddOnProductsComponent, decorators: [{
|
|
3355
|
+
type: Component,
|
|
3356
|
+
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"] }]
|
|
3357
|
+
}], ctorParameters: function () {
|
|
3358
|
+
return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
3359
|
+
type: Inject,
|
|
3360
|
+
args: [MAT_DIALOG_DATA]
|
|
3361
|
+
}] }, { type: i2.FormBuilder }, { type: i1$1.MatDialog }, { type: CommonService }];
|
|
3362
|
+
}, propDecorators: { firstscrollableDiv: [{
|
|
3363
|
+
type: ViewChild,
|
|
3364
|
+
args: ['firstscrollableDiv']
|
|
3365
|
+
}] } });
|
|
3366
|
+
|
|
3367
|
+
const ELEMENT_DATA = [];
|
|
2968
3368
|
class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
2969
3369
|
constructor(element, ref, dialog) {
|
|
2970
3370
|
super(element, ref);
|
|
@@ -2972,13 +3372,55 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
2972
3372
|
this.ref = ref;
|
|
2973
3373
|
this.dialog = dialog;
|
|
2974
3374
|
this.dataSource = new MatTableDataSource();
|
|
3375
|
+
this.dataSourceNew = ELEMENT_DATA;
|
|
3376
|
+
this.displayedColumnsNew = ['productName', 'category', 'subCategory', 'quantity', 'price'];
|
|
3377
|
+
this.showNewProductPicker = false;
|
|
3378
|
+
this.showCategory = false;
|
|
3379
|
+
this.showSubcategory = false;
|
|
3380
|
+
this.showPrice = true;
|
|
3381
|
+
this.showQuantity = true;
|
|
3382
|
+
this.category = '';
|
|
3383
|
+
this.subCategory = '';
|
|
3384
|
+
this.hasInitialized = false;
|
|
2975
3385
|
}
|
|
2976
3386
|
getColumnLabel(column) {
|
|
2977
3387
|
return column.label || column.key;
|
|
2978
3388
|
}
|
|
3389
|
+
checkIsAttributeTrue(newProductPickerFlag, attributeName) {
|
|
3390
|
+
return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
|
|
3391
|
+
newProductPickerFlag[key].toLowerCase() === "true");
|
|
3392
|
+
}
|
|
3393
|
+
// ngOnInit(): void {
|
|
3394
|
+
// }
|
|
2979
3395
|
setInstance(instance) {
|
|
3396
|
+
var _a;
|
|
3397
|
+
const newProductPickerFlag = (_a = instance === null || instance === void 0 ? void 0 : instance.component) === null || _a === void 0 ? void 0 : _a.attributes;
|
|
3398
|
+
this.showNewProductPicker = this.checkIsAttributeTrue(newProductPickerFlag, "newproductpicker");
|
|
3399
|
+
this.showCategory = this.checkIsAttributeTrue(newProductPickerFlag, "showCategory");
|
|
3400
|
+
this.showSubcategory = this.checkIsAttributeTrue(newProductPickerFlag, "showSubcategory");
|
|
3401
|
+
this.showPrice = this.checkIsAttributeTrue(newProductPickerFlag, "showPrice");
|
|
3402
|
+
this.showQuantity = this.checkIsAttributeTrue(newProductPickerFlag, "showQuantity");
|
|
2980
3403
|
super.setInstance(instance);
|
|
2981
|
-
this.
|
|
3404
|
+
if (this.showNewProductPicker && !this.hasInitialized) {
|
|
3405
|
+
if (!this.showCategory) {
|
|
3406
|
+
this.removeColumn('category');
|
|
3407
|
+
}
|
|
3408
|
+
if (!this.showQuantity) {
|
|
3409
|
+
this.removeColumn('quantity');
|
|
3410
|
+
}
|
|
3411
|
+
if (!this.showPrice) {
|
|
3412
|
+
this.removeColumn('price');
|
|
3413
|
+
}
|
|
3414
|
+
if (!this.showSubcategory) {
|
|
3415
|
+
this.removeColumn('subCategory');
|
|
3416
|
+
}
|
|
3417
|
+
this.dataSourceNew = JSON.parse(localStorage.getItem('selectedProducts')) || [];
|
|
3418
|
+
// Set flag to true to prevent further execution
|
|
3419
|
+
this.hasInitialized = true;
|
|
3420
|
+
}
|
|
3421
|
+
else {
|
|
3422
|
+
this.dataSource.data = instance.dataValue;
|
|
3423
|
+
}
|
|
2982
3424
|
this.columns = {};
|
|
2983
3425
|
this.displayedColumns = [];
|
|
2984
3426
|
this.formColumns = [];
|
|
@@ -3006,7 +3448,10 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3006
3448
|
return viewContainer ? viewContainer : null;
|
|
3007
3449
|
};
|
|
3008
3450
|
}
|
|
3009
|
-
|
|
3451
|
+
removeColumn(columnName) {
|
|
3452
|
+
this.displayedColumnsNew = this.displayedColumnsNew.filter(column => column !== columnName);
|
|
3453
|
+
}
|
|
3454
|
+
addAnotherOld() {
|
|
3010
3455
|
this.checkRowsNumber();
|
|
3011
3456
|
this.instance.addRow();
|
|
3012
3457
|
if (this.dataSource.data.length < this.instance.rows.length) {
|
|
@@ -3014,6 +3459,57 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3014
3459
|
}
|
|
3015
3460
|
this.dataSource.data = [...this.dataSource.data];
|
|
3016
3461
|
}
|
|
3462
|
+
addAnother() {
|
|
3463
|
+
var _a, _b;
|
|
3464
|
+
if (this.showNewProductPicker) {
|
|
3465
|
+
const savedData = JSON.parse(localStorage.getItem('saveCat'));
|
|
3466
|
+
// Use optional chaining and nullish coalescing to set the values
|
|
3467
|
+
this.category = (_a = savedData === null || savedData === void 0 ? void 0 : savedData.category) !== null && _a !== void 0 ? _a : this.category;
|
|
3468
|
+
this.subCategory = (_b = savedData === null || savedData === void 0 ? void 0 : savedData.subCategory) !== null && _b !== void 0 ? _b : this.subCategory;
|
|
3469
|
+
const diologeRef = this.dialog.open(AddOnProductsComponent, {
|
|
3470
|
+
disableClose: true,
|
|
3471
|
+
width: '90%',
|
|
3472
|
+
maxWidth: '900px',
|
|
3473
|
+
autoFocus: false,
|
|
3474
|
+
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 }
|
|
3475
|
+
})
|
|
3476
|
+
.afterClosed().subscribe(response => {
|
|
3477
|
+
var _a;
|
|
3478
|
+
if ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.status) {
|
|
3479
|
+
if (!this.showCategory) {
|
|
3480
|
+
this.removeColumn('category');
|
|
3481
|
+
}
|
|
3482
|
+
if (!this.showQuantity) {
|
|
3483
|
+
this.removeColumn('quantity');
|
|
3484
|
+
}
|
|
3485
|
+
if (!this.showPrice) {
|
|
3486
|
+
this.removeColumn('price');
|
|
3487
|
+
}
|
|
3488
|
+
if (!this.showSubcategory) {
|
|
3489
|
+
this.removeColumn('subCategory');
|
|
3490
|
+
}
|
|
3491
|
+
localStorage.setItem('selectedProducts', JSON.stringify(response.data.items.selectedProducts));
|
|
3492
|
+
this.dataSourceNew = response.data.items.selectedProducts;
|
|
3493
|
+
this.category = response.data.items.productCategory;
|
|
3494
|
+
this.subCategory = response.data.items.productSubcategory;
|
|
3495
|
+
const catObject = {
|
|
3496
|
+
category: this.category,
|
|
3497
|
+
subCategory: this.subCategory
|
|
3498
|
+
};
|
|
3499
|
+
localStorage.setItem('saveCat', JSON.stringify(catObject));
|
|
3500
|
+
this.instance.component.defaultValue = response.data.items.selectedProducts;
|
|
3501
|
+
}
|
|
3502
|
+
});
|
|
3503
|
+
}
|
|
3504
|
+
else {
|
|
3505
|
+
this.checkRowsNumber();
|
|
3506
|
+
this.instance.addRow();
|
|
3507
|
+
if (this.dataSource.data.length < this.instance.rows.length) {
|
|
3508
|
+
this.dataSource.data.push({});
|
|
3509
|
+
}
|
|
3510
|
+
this.dataSource.data = [...this.dataSource.data];
|
|
3511
|
+
}
|
|
3512
|
+
}
|
|
3017
3513
|
checkRowsNumber() {
|
|
3018
3514
|
while (this.instance.rows.length < this.dataSource.data.length) {
|
|
3019
3515
|
this.instance.addRow();
|
|
@@ -3064,7 +3560,7 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3064
3560
|
super.setValue(value);
|
|
3065
3561
|
}
|
|
3066
3562
|
}
|
|
3067
|
-
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$
|
|
3563
|
+
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 });
|
|
3068
3564
|
MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialDataGridComponent, selector: "mat-formio-datagrid", usesInheritance: true, ngImport: i0, template: `
|
|
3069
3565
|
<mat-formio-form-field [instance]="instance"
|
|
3070
3566
|
[componentTemplate]="componentTemplate"
|
|
@@ -3083,6 +3579,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3083
3579
|
{{instance.component.addAnother || 'Add Another'}}
|
|
3084
3580
|
</button>
|
|
3085
3581
|
</mat-card-actions>
|
|
3582
|
+
<ng-container *ngIf="!showNewProductPicker">
|
|
3583
|
+
<div class="mat-elevation-z8">
|
|
3086
3584
|
<table
|
|
3087
3585
|
mat-table
|
|
3088
3586
|
[dataSource]="dataSource"
|
|
@@ -3091,7 +3589,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3091
3589
|
cdkDropList
|
|
3092
3590
|
[cdkDropListData]="dataSource"
|
|
3093
3591
|
(cdkDropListDropped)="dropTable($event)">
|
|
3094
|
-
|
|
3592
|
+
|
|
3593
|
+
|
|
3095
3594
|
<ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
|
|
3096
3595
|
<th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
|
|
3097
3596
|
<td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
|
|
@@ -3121,6 +3620,51 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3121
3620
|
<tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
3122
3621
|
</div>
|
|
3123
3622
|
</table>
|
|
3623
|
+
</div>
|
|
3624
|
+
</ng-container>
|
|
3625
|
+
|
|
3626
|
+
<table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
|
|
3627
|
+
<!-- Product Name Column -->
|
|
3628
|
+
<ng-container matColumnDef="productName">
|
|
3629
|
+
<th mat-header-cell *matHeaderCellDef> Product Name </th>
|
|
3630
|
+
<td mat-cell *matCellDef="let element"> {{element.text}} </td>
|
|
3631
|
+
</ng-container>
|
|
3632
|
+
|
|
3633
|
+
<!-- Quantity Column -->
|
|
3634
|
+
<ng-container matColumnDef="quantity" *ngIf="showQuantity">
|
|
3635
|
+
<th mat-header-cell *matHeaderCellDef> Quantity </th>
|
|
3636
|
+
<td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
|
|
3637
|
+
</ng-container>
|
|
3638
|
+
|
|
3639
|
+
<!-- Price Column -->
|
|
3640
|
+
<ng-container matColumnDef="price" *ngIf="showPrice">
|
|
3641
|
+
<th mat-header-cell *matHeaderCellDef> Price </th>
|
|
3642
|
+
<td mat-cell *matCellDef="let element"> {{element.price}} </td>
|
|
3643
|
+
</ng-container>
|
|
3644
|
+
|
|
3645
|
+
<!-- Category Column -->
|
|
3646
|
+
<ng-container matColumnDef="category" *ngIf="showCategory">
|
|
3647
|
+
<th mat-header-cell *matHeaderCellDef> Category </th>
|
|
3648
|
+
<td mat-cell *matCellDef="let element"> {{element.category}} </td>
|
|
3649
|
+
</ng-container>
|
|
3650
|
+
|
|
3651
|
+
<!-- Category Column -->
|
|
3652
|
+
<ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
|
|
3653
|
+
<th mat-header-cell *matHeaderCellDef> Sub Category </th>
|
|
3654
|
+
<td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
|
|
3655
|
+
</ng-container>
|
|
3656
|
+
|
|
3657
|
+
<tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
|
|
3658
|
+
<tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
|
|
3659
|
+
</table>
|
|
3660
|
+
<ng-template #noData>
|
|
3661
|
+
<div class="no-data-message" *ngIf="showNewProductPicker">
|
|
3662
|
+
No product found please add some products.
|
|
3663
|
+
</div>
|
|
3664
|
+
</ng-template>
|
|
3665
|
+
|
|
3666
|
+
|
|
3667
|
+
|
|
3124
3668
|
</mat-card-content>
|
|
3125
3669
|
<mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
|
|
3126
3670
|
<button mat-raised-button color="primary" (click)="addAnother()">
|
|
@@ -3136,7 +3680,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3136
3680
|
<span [instance]="instance" matFormioLabel></span>
|
|
3137
3681
|
</mat-card-title>
|
|
3138
3682
|
</ng-template>
|
|
3139
|
-
`, 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:
|
|
3683
|
+
`, 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"] }] });
|
|
3140
3684
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, decorators: [{
|
|
3141
3685
|
type: Component,
|
|
3142
3686
|
args: [{ selector: 'mat-formio-datagrid', template: `
|
|
@@ -3157,6 +3701,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3157
3701
|
{{instance.component.addAnother || 'Add Another'}}
|
|
3158
3702
|
</button>
|
|
3159
3703
|
</mat-card-actions>
|
|
3704
|
+
<ng-container *ngIf="!showNewProductPicker">
|
|
3705
|
+
<div class="mat-elevation-z8">
|
|
3160
3706
|
<table
|
|
3161
3707
|
mat-table
|
|
3162
3708
|
[dataSource]="dataSource"
|
|
@@ -3165,7 +3711,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3165
3711
|
cdkDropList
|
|
3166
3712
|
[cdkDropListData]="dataSource"
|
|
3167
3713
|
(cdkDropListDropped)="dropTable($event)">
|
|
3168
|
-
|
|
3714
|
+
|
|
3715
|
+
|
|
3169
3716
|
<ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
|
|
3170
3717
|
<th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
|
|
3171
3718
|
<td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
|
|
@@ -3195,6 +3742,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3195
3742
|
<tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
3196
3743
|
</div>
|
|
3197
3744
|
</table>
|
|
3745
|
+
</div>
|
|
3746
|
+
</ng-container>
|
|
3747
|
+
|
|
3748
|
+
<table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
|
|
3749
|
+
<!-- Product Name Column -->
|
|
3750
|
+
<ng-container matColumnDef="productName">
|
|
3751
|
+
<th mat-header-cell *matHeaderCellDef> Product Name </th>
|
|
3752
|
+
<td mat-cell *matCellDef="let element"> {{element.text}} </td>
|
|
3753
|
+
</ng-container>
|
|
3754
|
+
|
|
3755
|
+
<!-- Quantity Column -->
|
|
3756
|
+
<ng-container matColumnDef="quantity" *ngIf="showQuantity">
|
|
3757
|
+
<th mat-header-cell *matHeaderCellDef> Quantity </th>
|
|
3758
|
+
<td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
|
|
3759
|
+
</ng-container>
|
|
3760
|
+
|
|
3761
|
+
<!-- Price Column -->
|
|
3762
|
+
<ng-container matColumnDef="price" *ngIf="showPrice">
|
|
3763
|
+
<th mat-header-cell *matHeaderCellDef> Price </th>
|
|
3764
|
+
<td mat-cell *matCellDef="let element"> {{element.price}} </td>
|
|
3765
|
+
</ng-container>
|
|
3766
|
+
|
|
3767
|
+
<!-- Category Column -->
|
|
3768
|
+
<ng-container matColumnDef="category" *ngIf="showCategory">
|
|
3769
|
+
<th mat-header-cell *matHeaderCellDef> Category </th>
|
|
3770
|
+
<td mat-cell *matCellDef="let element"> {{element.category}} </td>
|
|
3771
|
+
</ng-container>
|
|
3772
|
+
|
|
3773
|
+
<!-- Category Column -->
|
|
3774
|
+
<ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
|
|
3775
|
+
<th mat-header-cell *matHeaderCellDef> Sub Category </th>
|
|
3776
|
+
<td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
|
|
3777
|
+
</ng-container>
|
|
3778
|
+
|
|
3779
|
+
<tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
|
|
3780
|
+
<tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
|
|
3781
|
+
</table>
|
|
3782
|
+
<ng-template #noData>
|
|
3783
|
+
<div class="no-data-message" *ngIf="showNewProductPicker">
|
|
3784
|
+
No product found please add some products.
|
|
3785
|
+
</div>
|
|
3786
|
+
</ng-template>
|
|
3787
|
+
|
|
3788
|
+
|
|
3789
|
+
|
|
3198
3790
|
</mat-card-content>
|
|
3199
3791
|
<mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
|
|
3200
3792
|
<button mat-raised-button color="primary" (click)="addAnother()">
|
|
@@ -3210,8 +3802,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3210
3802
|
<span [instance]="instance" matFormioLabel></span>
|
|
3211
3803
|
</mat-card-title>
|
|
3212
3804
|
</ng-template>
|
|
3213
|
-
`, styles: [".datagrid-row{height:auto}\n"] }]
|
|
3214
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$
|
|
3805
|
+
`, 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"] }]
|
|
3806
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }]; } });
|
|
3215
3807
|
DataGridComponent.MaterialComponent = MaterialDataGridComponent;
|
|
3216
3808
|
|
|
3217
3809
|
var EditRowState;
|
|
@@ -3594,7 +4186,7 @@ MaterialWizardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
|
|
|
3594
4186
|
<button *ngIf="instance.hasButton('submit')" mat-raised-button color="primary" (click)="submit()">Submit</button>
|
|
3595
4187
|
</div>
|
|
3596
4188
|
</mat-step>
|
|
3597
|
-
</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:
|
|
4189
|
+
</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"] }] });
|
|
3598
4190
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialWizardComponent, decorators: [{
|
|
3599
4191
|
type: Component,
|
|
3600
4192
|
args: [{ selector: 'mat-formio-wizard', template: `
|
|
@@ -3764,7 +4356,7 @@ FormioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
|
|
|
3764
4356
|
<div fxLayout="column" fxLayoutGap="1em">
|
|
3765
4357
|
<ng-template #formio></ng-template>
|
|
3766
4358
|
</div>
|
|
3767
|
-
`, 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:
|
|
4359
|
+
`, 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"] }] });
|
|
3768
4360
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormioComponent, decorators: [{
|
|
3769
4361
|
type: Component,
|
|
3770
4362
|
args: [{ selector: 'mat-formio', template: `
|
|
@@ -3836,7 +4428,8 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
|
|
|
3836
4428
|
FormioFormFieldComponent,
|
|
3837
4429
|
LabelComponent,
|
|
3838
4430
|
MaskDirective,
|
|
3839
|
-
ConfirmationDialogComponent
|
|
4431
|
+
ConfirmationDialogComponent,
|
|
4432
|
+
AddOnProductsComponent], imports: [CommonModule,
|
|
3840
4433
|
FormsModule,
|
|
3841
4434
|
ReactiveFormsModule,
|
|
3842
4435
|
MatInputModule,
|
|
@@ -3864,7 +4457,9 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
|
|
|
3864
4457
|
ScrollingModule,
|
|
3865
4458
|
NgxMatSelectSearchModule,
|
|
3866
4459
|
MatDialogModule,
|
|
3867
|
-
HttpClientModule
|
|
4460
|
+
HttpClientModule,
|
|
4461
|
+
MatAutocompleteModule], exports: [MatAutocompleteModule,
|
|
4462
|
+
NgxRenderMaterialFormsComponent,
|
|
3868
4463
|
FormioComponent,
|
|
3869
4464
|
MatInputModule,
|
|
3870
4465
|
MatFormFieldModule,
|
|
@@ -3918,7 +4513,9 @@ NgxRenderMaterialFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.
|
|
|
3918
4513
|
ScrollingModule,
|
|
3919
4514
|
NgxMatSelectSearchModule,
|
|
3920
4515
|
MatDialogModule,
|
|
3921
|
-
HttpClientModule,
|
|
4516
|
+
HttpClientModule,
|
|
4517
|
+
MatAutocompleteModule, MatAutocompleteModule,
|
|
4518
|
+
MatInputModule,
|
|
3922
4519
|
MatFormFieldModule,
|
|
3923
4520
|
MatCheckboxModule,
|
|
3924
4521
|
MatRadioModule,
|
|
@@ -3986,7 +4583,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3986
4583
|
FormioFormFieldComponent,
|
|
3987
4584
|
LabelComponent,
|
|
3988
4585
|
MaskDirective,
|
|
3989
|
-
ConfirmationDialogComponent
|
|
4586
|
+
ConfirmationDialogComponent,
|
|
4587
|
+
AddOnProductsComponent
|
|
3990
4588
|
],
|
|
3991
4589
|
imports: [
|
|
3992
4590
|
CommonModule,
|
|
@@ -4017,9 +4615,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
4017
4615
|
ScrollingModule,
|
|
4018
4616
|
NgxMatSelectSearchModule,
|
|
4019
4617
|
MatDialogModule,
|
|
4020
|
-
HttpClientModule
|
|
4618
|
+
HttpClientModule,
|
|
4619
|
+
MatAutocompleteModule
|
|
4021
4620
|
],
|
|
4022
4621
|
exports: [
|
|
4622
|
+
MatAutocompleteModule,
|
|
4023
4623
|
NgxRenderMaterialFormsComponent,
|
|
4024
4624
|
FormioComponent,
|
|
4025
4625
|
MatInputModule,
|