ngx-render-material-forms 1.4.1 → 1.4.3
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 +87 -0
- package/esm2020/lib/components/confirmation-dialog/confirmation-dialog.component.mjs +3 -3
- package/esm2020/lib/components/datagrid/datagrid.component.mjs +166 -6
- package/esm2020/lib/components/select/select.component.mjs +2 -2
- package/esm2020/lib/ngx-render-material-forms.module.mjs +16 -6
- package/fesm2015/ngx-render-material-forms.js +605 -35
- package/fesm2015/ngx-render-material-forms.mjs.map +1 -1
- package/fesm2020/ngx-render-material-forms.js +597 -35
- 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 +17 -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');
|
|
@@ -2808,7 +2814,7 @@ class MaterialSelectComponent extends MaterialComponent {
|
|
|
2808
2814
|
return _.isEqual(o1, o2);
|
|
2809
2815
|
}
|
|
2810
2816
|
}
|
|
2811
|
-
MaterialSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$
|
|
2817
|
+
MaterialSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Component });
|
|
2812
2818
|
MaterialSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialSelectComponent, selector: "mat-formio-select", viewQueries: [{ propertyName: "multiSelect", first: true, predicate: ["multiSelect"], descendants: true, static: true }, { propertyName: "selectElem", first: true, predicate: ["productSelect"], descendants: true }], usesInheritance: true, ngImport: i0, template: `
|
|
2813
2819
|
<mat-formio-form-field [instance]="instance" [componentTemplate]="componentTemplate"></mat-formio-form-field>
|
|
2814
2820
|
<ng-template #componentTemplate let-hasLabel>
|
|
@@ -2893,7 +2899,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
2893
2899
|
</mat-form-field>
|
|
2894
2900
|
</ng-template>
|
|
2895
2901
|
`, styles: [".example-viewport{height:200px}.product-picker{overflow-x:hidden}.virtual-full-view{height:auto!important;white-space:normal!important;line-height:1.4!important;text-overflow:initial!important;min-height:48px!important;overflow:visible!important;overflow:initial!important;padding-top:10px!important;padding-bottom:10px!important}::ng-deep .product-picker .cdk-virtual-scroll-content-wrapper{width:100%!important}.virtual-full-view .mat-pseudo-checkbox{align-self:top!important}\n"] }]
|
|
2896
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$
|
|
2902
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$2.HttpClient }]; }, propDecorators: { multiSelect: [{
|
|
2897
2903
|
type: ViewChild,
|
|
2898
2904
|
args: ['multiSelect', { static: true }]
|
|
2899
2905
|
}], selectElem: [{
|
|
@@ -2952,16 +2958,406 @@ class ConfirmationDialogComponent {
|
|
|
2952
2958
|
ngOnInit() {
|
|
2953
2959
|
}
|
|
2954
2960
|
}
|
|
2955
|
-
ConfirmationDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, deps: [{ token: i1$
|
|
2956
|
-
ConfirmationDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ConfirmationDialogComponent, selector: "NgxMat-confirmation-dialog", ngImport: i0, template: "<div class=\"dialog-container\">\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\n<mat-dialog-content class=\"data-grid-popup-body\">\n {{data.message}}\n</mat-dialog-content>\n<mat-dialog-actions class=\"data-grid-popup-footer\">\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\n</mat-dialog-actions>\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i1$
|
|
2961
|
+
ConfirmationDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, deps: [{ token: i1$1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
|
|
2962
|
+
ConfirmationDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: ConfirmationDialogComponent, selector: "NgxMat-confirmation-dialog", ngImport: i0, template: "<div class=\"dialog-container\">\r\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\r\n<mat-dialog-content class=\"data-grid-popup-body\">\r\n {{data.message}}\r\n</mat-dialog-content>\r\n<mat-dialog-actions class=\"data-grid-popup-footer\">\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\r\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\r\n</mat-dialog-actions>\r\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i6.DefaultClassDirective, selector: " [ngClass], [ngClass.xs], [ngClass.sm], [ngClass.md], [ngClass.lg], [ngClass.xl], [ngClass.lt-sm], [ngClass.lt-md], [ngClass.lt-lg], [ngClass.lt-xl], [ngClass.gt-xs], [ngClass.gt-sm], [ngClass.gt-md], [ngClass.gt-lg]", inputs: ["ngClass", "ngClass.xs", "ngClass.sm", "ngClass.md", "ngClass.lg", "ngClass.xl", "ngClass.lt-sm", "ngClass.lt-md", "ngClass.lt-lg", "ngClass.lt-xl", "ngClass.gt-xs", "ngClass.gt-sm", "ngClass.gt-md", "ngClass.gt-lg"] }, { kind: "directive", type: i1$1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1$1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1$1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1$1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }] });
|
|
2957
2963
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: ConfirmationDialogComponent, decorators: [{
|
|
2958
2964
|
type: Component,
|
|
2959
|
-
args: [{ selector: 'NgxMat-confirmation-dialog', template: "<div class=\"dialog-container\">\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\n<mat-dialog-content class=\"data-grid-popup-body\">\n {{data.message}}\n</mat-dialog-content>\n<mat-dialog-actions class=\"data-grid-popup-footer\">\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\n</mat-dialog-actions>\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"] }]
|
|
2960
|
-
}], ctorParameters: function () { return [{ type: i1$
|
|
2965
|
+
args: [{ selector: 'NgxMat-confirmation-dialog', template: "<div class=\"dialog-container\">\r\n<h2 mat-dialog-title class=\"data-grid-alert\">Alert</h2>\r\n<mat-dialog-content class=\"data-grid-popup-body\">\r\n {{data.message}}\r\n</mat-dialog-content>\r\n<mat-dialog-actions class=\"data-grid-popup-footer\">\r\n <button mat-button [mat-dialog-close]=\"true\" color=\"warn\" *ngIf=\"data.buttonStatus\">Delete</button>\r\n <button mat-button [mat-dialog-close]=\"false\" [ngClass]=\"{'data-grid-closed-btn': !data.buttonStatus}\">{{data.buttonStatus ? 'Cancel': 'Close'}}</button>\r\n</mat-dialog-actions>\r\n</div>", styles: ["::ng-deep .data-grid-closed-btn .mat-button-focus-overlay{background-color:transparent}\n"] }]
|
|
2966
|
+
}], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
2961
2967
|
type: Inject,
|
|
2962
2968
|
args: [MAT_DIALOG_DATA]
|
|
2963
2969
|
}] }]; } });
|
|
2964
2970
|
|
|
2971
|
+
class CommonService {
|
|
2972
|
+
constructor(http) {
|
|
2973
|
+
this.http = http;
|
|
2974
|
+
this.holy = '';
|
|
2975
|
+
this.grail = '';
|
|
2976
|
+
this.holy = CryptoJS.enc.Base64.parse('8F/2+T2NXqUBQERR12R4sw==');
|
|
2977
|
+
this.grail = CryptoJS.enc.Base64.parse('yE0CgQbYzK5wqeoKTVzhOQ==');
|
|
2978
|
+
this.paramsData = JSON.parse(localStorage.getItem('productPickerParams'));
|
|
2979
|
+
this.currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
|
2980
|
+
}
|
|
2981
|
+
scrumble(msg) {
|
|
2982
|
+
if (!isNullOrUndefined(msg)) {
|
|
2983
|
+
var conceal = this.getcampaign(msg, this.holy, this.grail);
|
|
2984
|
+
var sha256 = CryptoJS.HmacSHA256(CryptoJS.enc.Base64.stringify(this.grail) + conceal.toString(), CryptoJS.enc.Base64.stringify(this.holy));
|
|
2985
|
+
var hashInBase64 = CryptoJS.enc.Base64.stringify(sha256);
|
|
2986
|
+
let keyValue = {
|
|
2987
|
+
"value": conceal.toString(),
|
|
2988
|
+
"mac": hashInBase64
|
|
2989
|
+
};
|
|
2990
|
+
var result = JSON.stringify(keyValue);
|
|
2991
|
+
var jumbled = CryptoJS.enc.Utf8.parse(result);
|
|
2992
|
+
return CryptoJS.enc.Base64.stringify(jumbled);
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
2995
|
+
getcampaign(data, holy, grail) {
|
|
2996
|
+
return CryptoJS.AES.encrypt(data.toString(), holy, {
|
|
2997
|
+
blockSize: 128,
|
|
2998
|
+
iv: grail,
|
|
2999
|
+
mode: CryptoJS.mode.CBC,
|
|
3000
|
+
padding: CryptoJS.pad.Pkcs7
|
|
3001
|
+
});
|
|
3002
|
+
}
|
|
3003
|
+
getBaseApiUrl() {
|
|
3004
|
+
const baseUrlMapping = {
|
|
3005
|
+
'localhost': 'http://localhost:58504',
|
|
3006
|
+
'lincoln.vartopia.com': 'https://lincoln-api.vartopia.com',
|
|
3007
|
+
'stage.vartopia.com': 'https://stage-api.vartopia.com',
|
|
3008
|
+
'my.vartopia.com': 'https://reagan-api.vartopia.com',
|
|
3009
|
+
'jackson.vartopia.com': 'https://jackson-api.vartopia.com'
|
|
3010
|
+
};
|
|
3011
|
+
// Get the current hostname
|
|
3012
|
+
const hostname = window.location.hostname;
|
|
3013
|
+
return baseUrlMapping[hostname] || null;
|
|
3014
|
+
}
|
|
3015
|
+
listProductCategory() {
|
|
3016
|
+
const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
|
|
3017
|
+
const baseApiUrl = this.getBaseApiUrl();
|
|
3018
|
+
console.log('categoryVid=>', vendorId);
|
|
3019
|
+
return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsCategory?vendorId=${vendorId}`);
|
|
3020
|
+
}
|
|
3021
|
+
listSubCategory(category) {
|
|
3022
|
+
const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
|
|
3023
|
+
const baseApiUrl = this.getBaseApiUrl();
|
|
3024
|
+
console.log('subcategoryVid=>', vendorId);
|
|
3025
|
+
return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetProductsSubCategory?vendorId=${vendorId}&categoryName=${category}`);
|
|
3026
|
+
}
|
|
3027
|
+
// Function to get value by key from the array
|
|
3028
|
+
getValueByKey(data, key) {
|
|
3029
|
+
if (!data || data.length === 0) {
|
|
3030
|
+
return null; // Return null if data is empty or undefined
|
|
3031
|
+
}
|
|
3032
|
+
const item = data.find(kv => kv.key.toLowerCase() === key.toLowerCase());
|
|
3033
|
+
return item ? item.value : null;
|
|
3034
|
+
}
|
|
3035
|
+
// this.http.get<VendorProductsResponse>(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${envendorId}&pageNumber=${enpageNumber}&pageSize=${enpageSize}&search=${ensearchQuery}&onlyActive=${enactive}&includeDescription=${endescription}`, { headers }).subscribe(response => {
|
|
3036
|
+
loadProducts(pageNumber, pazeSize, search = '', onlyActive = true, description = false, category, subCategory) {
|
|
3037
|
+
const baseApiUrl = this.getBaseApiUrl();
|
|
3038
|
+
const vendorId = this.getValueByKey(this.paramsData, 'vendorId');
|
|
3039
|
+
const encodeCat = encodeURIComponent(category);
|
|
3040
|
+
const encodeSubCat = encodeURIComponent(subCategory);
|
|
3041
|
+
return this.http.get(`${baseApiUrl}/api/VendorFormBuilder/GetVendorProducts?vendorId=${vendorId}&pageNumber=${pageNumber}&pageSize=${pazeSize}&search=${search}&onlyActive=${onlyActive}&includeDescription=${description}&category=${encodeCat}&subCategory=${encodeSubCat}`);
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
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 });
|
|
3045
|
+
CommonService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, providedIn: 'root' });
|
|
3046
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: CommonService, decorators: [{
|
|
3047
|
+
type: Injectable,
|
|
3048
|
+
args: [{
|
|
3049
|
+
providedIn: 'root'
|
|
3050
|
+
}]
|
|
3051
|
+
}], ctorParameters: function () { return [{ type: i1$2.HttpClient }]; } });
|
|
3052
|
+
|
|
3053
|
+
class AddOnProductsComponent {
|
|
3054
|
+
constructor(matDialogRef, data, fb, dialog, commonSevice) {
|
|
3055
|
+
this.matDialogRef = matDialogRef;
|
|
3056
|
+
this.fb = fb;
|
|
3057
|
+
this.dialog = dialog;
|
|
3058
|
+
this.commonSevice = commonSevice;
|
|
3059
|
+
this.category = [];
|
|
3060
|
+
this.subCategory = [];
|
|
3061
|
+
this.filteredCategories = [];
|
|
3062
|
+
this.filteredSubCategories = [];
|
|
3063
|
+
this.addProductsColumns = ['select', 'productName', 'price'];
|
|
3064
|
+
this.showAllproductsColumns = ['delete', 'productName', 'categoryName', 'subCategory', 'Quantity', 'price'];
|
|
3065
|
+
this.quantityList = [5, 10, 15, 20, 25];
|
|
3066
|
+
this.ELEMENT_DATA = [];
|
|
3067
|
+
this.dataSource = new MatTableDataSource();
|
|
3068
|
+
this.selection = new SelectionModel(true, []);
|
|
3069
|
+
this.selectedDataSource = new MatTableDataSource([]);
|
|
3070
|
+
this.selectedCategory = null;
|
|
3071
|
+
this.selectedSubCategory = null;
|
|
3072
|
+
this.showCategory = false;
|
|
3073
|
+
this.showSubcategory = false;
|
|
3074
|
+
this.showPrice = true;
|
|
3075
|
+
this.showQuantity = true;
|
|
3076
|
+
this.showNewProductPicker = true;
|
|
3077
|
+
this.setCategory = '';
|
|
3078
|
+
this.setSubCategory = '';
|
|
3079
|
+
this.loadingFlag = false;
|
|
3080
|
+
this.pageNumber = 1;
|
|
3081
|
+
this.pageSize = 20;
|
|
3082
|
+
this.totalPages = 0;
|
|
3083
|
+
this.searchQuery = '';
|
|
3084
|
+
this.itemList = [];
|
|
3085
|
+
this.prevScrollPosition = 0; // Track the previous scroll position
|
|
3086
|
+
this.spinnerFlag = false;
|
|
3087
|
+
this.showCategory = data.attributesFlag.showCategory;
|
|
3088
|
+
this.showSubcategory = data.attributesFlag.showSubcategory;
|
|
3089
|
+
this.showPrice = data.attributesFlag.showPrice;
|
|
3090
|
+
this.showQuantity = data.attributesFlag.showQuantity;
|
|
3091
|
+
this.showNewProductPicker = data.showNewProductPicker;
|
|
3092
|
+
this.setCategory = data.category || '';
|
|
3093
|
+
this.setSubCategory = data.subCategory || '';
|
|
3094
|
+
this.selection = new SelectionModel(true, data.selectedProducts || []);
|
|
3095
|
+
this.form = this.fb.group({
|
|
3096
|
+
productCategory: [''],
|
|
3097
|
+
productSubcategory: [''],
|
|
3098
|
+
selectedProducts: this.fb.array([])
|
|
3099
|
+
});
|
|
3100
|
+
this.initializeFormArray();
|
|
3101
|
+
if (!this.showCategory) {
|
|
3102
|
+
this.removeColumn('categoryName');
|
|
3103
|
+
}
|
|
3104
|
+
if (!this.showPrice) {
|
|
3105
|
+
this.removeColumn('price');
|
|
3106
|
+
}
|
|
3107
|
+
if (!this.showSubcategory) {
|
|
3108
|
+
this.removeColumn('subCategory');
|
|
3109
|
+
}
|
|
3110
|
+
if (!this.showQuantity) {
|
|
3111
|
+
this.removeColumn('Quantity');
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
removeColumn(columnName) {
|
|
3115
|
+
this.showAllproductsColumns = this.showAllproductsColumns.filter(column => column !== columnName);
|
|
3116
|
+
this.addProductsColumns = this.addProductsColumns.filter(column => column !== columnName);
|
|
3117
|
+
}
|
|
3118
|
+
initializeFormArray() {
|
|
3119
|
+
const selectedProductsArray = this.form.get('selectedProducts');
|
|
3120
|
+
this.selection.selected.forEach(product => {
|
|
3121
|
+
selectedProductsArray.push(this.fb.group({
|
|
3122
|
+
price: [product.price || '', Validators.required],
|
|
3123
|
+
text: [product.text || ''],
|
|
3124
|
+
quantity: [product.quantity || '', Validators.required],
|
|
3125
|
+
category: [product?.category || ''],
|
|
3126
|
+
subCategory: [product?.subCategory || ''],
|
|
3127
|
+
value: [product?.value || '']
|
|
3128
|
+
}));
|
|
3129
|
+
});
|
|
3130
|
+
this.selectedDataSource.data = [...this.selection.selected];
|
|
3131
|
+
}
|
|
3132
|
+
initializeDataSources() {
|
|
3133
|
+
// Ensure selected items are marked in the main data source
|
|
3134
|
+
if (this.selection?.selected?.length) {
|
|
3135
|
+
this.selection?.selected?.forEach(selectedProduct => {
|
|
3136
|
+
const index = this.dataSource.data.findIndex(product => product.value === selectedProduct.value);
|
|
3137
|
+
if (index >= 0) {
|
|
3138
|
+
this.dataSource.data[index] = selectedProduct;
|
|
3139
|
+
}
|
|
3140
|
+
});
|
|
3141
|
+
this.selectedDataSource.data = [...this.selection.selected];
|
|
3142
|
+
}
|
|
3143
|
+
else {
|
|
3144
|
+
console.warn('No selected products found.');
|
|
3145
|
+
}
|
|
3146
|
+
}
|
|
3147
|
+
ngAfterViewInit() {
|
|
3148
|
+
}
|
|
3149
|
+
ngOnInit() {
|
|
3150
|
+
this.loadProductCategory();
|
|
3151
|
+
this.form.get('productCategory').valueChanges
|
|
3152
|
+
.pipe(startWith(''), map(value => this.filterProducts(value, 'category1'))).subscribe(filterCat => {
|
|
3153
|
+
this.filteredCategories = filterCat;
|
|
3154
|
+
});
|
|
3155
|
+
this.form.get('productSubcategory').valueChanges
|
|
3156
|
+
.pipe(startWith(''), map(value => this.filterProducts(value, 'subCategory'))).subscribe(subCat => {
|
|
3157
|
+
this.filteredSubCategories = subCat;
|
|
3158
|
+
});
|
|
3159
|
+
}
|
|
3160
|
+
loadProductCategory() {
|
|
3161
|
+
this.spinnerFlag = true;
|
|
3162
|
+
this.commonSevice.listProductCategory().subscribe(response => {
|
|
3163
|
+
this.spinnerFlag = false;
|
|
3164
|
+
if (response && response.code === 200) {
|
|
3165
|
+
this.category = response.data;
|
|
3166
|
+
this.filteredCategories = this.filterProducts(this.setCategory, 'category1');
|
|
3167
|
+
this.form.get('productCategory').setValue(this.setCategory);
|
|
3168
|
+
if (this.setCategory !== '') {
|
|
3169
|
+
this.onOptionSelected(this.setCategory, 'category1');
|
|
3170
|
+
this.form.get('productSubcategory').setValue(this.setSubCategory);
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
});
|
|
3174
|
+
}
|
|
3175
|
+
filterProducts(value, cat) {
|
|
3176
|
+
const filterValue = value.toLowerCase();
|
|
3177
|
+
const data = cat === 'category1' ? this.category : this.subCategory;
|
|
3178
|
+
if (!filterValue) {
|
|
3179
|
+
return data;
|
|
3180
|
+
}
|
|
3181
|
+
else {
|
|
3182
|
+
return data.filter(option => option.toLowerCase().includes(filterValue));
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
onSubmit() {
|
|
3186
|
+
if (this.form.valid) {
|
|
3187
|
+
this.matDialogRef.close({
|
|
3188
|
+
data: {
|
|
3189
|
+
status: true,
|
|
3190
|
+
items: this.form.value
|
|
3191
|
+
}
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
isAllSelected() {
|
|
3196
|
+
const numSelected = this.selection.selected.length;
|
|
3197
|
+
const numRows = this.dataSource.data.length;
|
|
3198
|
+
return numSelected === numRows;
|
|
3199
|
+
}
|
|
3200
|
+
isIndeterminate() {
|
|
3201
|
+
const numSelected = this.selection.selected.length;
|
|
3202
|
+
const numRows = this.dataSource.data.length;
|
|
3203
|
+
return numSelected > 0 && numSelected < numRows;
|
|
3204
|
+
}
|
|
3205
|
+
masterToggle() {
|
|
3206
|
+
this.isAllSelected()
|
|
3207
|
+
? this.selection.clear()
|
|
3208
|
+
: this.dataSource.data.forEach(row => this.selection.select(row));
|
|
3209
|
+
this.updateSelectedProducts();
|
|
3210
|
+
}
|
|
3211
|
+
toggleSelection(row) {
|
|
3212
|
+
this.selection.toggle(row);
|
|
3213
|
+
this.updateSelectedProducts();
|
|
3214
|
+
}
|
|
3215
|
+
// Getter for the FormArray
|
|
3216
|
+
get selectedProducts() {
|
|
3217
|
+
return this.form.get('selectedProducts');
|
|
3218
|
+
}
|
|
3219
|
+
updateSelectedProducts() {
|
|
3220
|
+
if (Array.isArray(this.selection.selected)) {
|
|
3221
|
+
this.selectedDataSource.data = [...this.selection.selected];
|
|
3222
|
+
const selectedProductsArray = this.selectedProducts;
|
|
3223
|
+
selectedProductsArray.clear();
|
|
3224
|
+
this.selection?.selected?.forEach(product => {
|
|
3225
|
+
selectedProductsArray?.push(this.fb.group({
|
|
3226
|
+
price: [product?.price ?? '', this.showPrice ? Validators.required : []],
|
|
3227
|
+
text: [product?.text || ''],
|
|
3228
|
+
quantity: [product?.quantity ?? '', this.showQuantity ? Validators.required : []],
|
|
3229
|
+
category: [product?.category || ''],
|
|
3230
|
+
subCategory: [product?.subCategory || ''],
|
|
3231
|
+
value: [product?.value || '']
|
|
3232
|
+
}));
|
|
3233
|
+
});
|
|
3234
|
+
}
|
|
3235
|
+
else {
|
|
3236
|
+
console.error('Selection.selected is not an array:', this.selection.selected);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
getTotalRows() {
|
|
3240
|
+
return this.dataSource.data.length;
|
|
3241
|
+
}
|
|
3242
|
+
getSelectedRowsCount() {
|
|
3243
|
+
return this.selection.selected.length;
|
|
3244
|
+
}
|
|
3245
|
+
onOptionSelected(event, category) {
|
|
3246
|
+
let selectedValue;
|
|
3247
|
+
if (event && event.option && event.option.value !== undefined) {
|
|
3248
|
+
selectedValue = event.option.value;
|
|
3249
|
+
}
|
|
3250
|
+
else {
|
|
3251
|
+
selectedValue = event;
|
|
3252
|
+
}
|
|
3253
|
+
if (category === 'category1') {
|
|
3254
|
+
this.selectedCategory = selectedValue;
|
|
3255
|
+
this.spinnerFlag = true;
|
|
3256
|
+
this.commonSevice.listSubCategory(selectedValue).subscribe(response => {
|
|
3257
|
+
this.spinnerFlag = false;
|
|
3258
|
+
if (response && response.code === 200) {
|
|
3259
|
+
this.subCategory = response.data;
|
|
3260
|
+
this.filteredSubCategories = this.filterProducts(this.setCategory, 'subCategory');
|
|
3261
|
+
if (this.setSubCategory !== '') {
|
|
3262
|
+
this.selectedSubCategory = this.setSubCategory;
|
|
3263
|
+
this.getProducts();
|
|
3264
|
+
}
|
|
3265
|
+
}
|
|
3266
|
+
});
|
|
3267
|
+
}
|
|
3268
|
+
else {
|
|
3269
|
+
if (category === 'subCategory') {
|
|
3270
|
+
this.selectedSubCategory = event.option.value;
|
|
3271
|
+
this.getProducts();
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
getProducts() {
|
|
3276
|
+
this.spinnerFlag = true;
|
|
3277
|
+
this.commonSevice.loadProducts(this.pageNumber, this.pageSize, '', true, false, this.selectedCategory, this.selectedSubCategory).subscribe(response => {
|
|
3278
|
+
this.spinnerFlag = false;
|
|
3279
|
+
if (response && response.code === 200) {
|
|
3280
|
+
//this.dataSource.data = response.data.dataSource;
|
|
3281
|
+
this.totalPages = response?.data?.totalPages;
|
|
3282
|
+
const data = response.data.dataSource;
|
|
3283
|
+
if (this.dataSource.data.length > 0) {
|
|
3284
|
+
data.forEach(item => this.dataSource.data.push(item));
|
|
3285
|
+
this.dataSource.data = [...this.dataSource.data];
|
|
3286
|
+
}
|
|
3287
|
+
else {
|
|
3288
|
+
this.dataSource.data = data;
|
|
3289
|
+
}
|
|
3290
|
+
this.loadingFlag = true;
|
|
3291
|
+
setTimeout(() => {
|
|
3292
|
+
const middlePosition = this.trackHeight / 2 - 50;
|
|
3293
|
+
if (this.firstscrollableDiv && this.firstscrollableDiv.nativeElement) {
|
|
3294
|
+
this.firstscrollableDiv.nativeElement.scrollTo({ top: middlePosition, behavior: 'auto' });
|
|
3295
|
+
}
|
|
3296
|
+
}, 250);
|
|
3297
|
+
this.initializeDataSources();
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3300
|
+
}
|
|
3301
|
+
removeRow(event, element) {
|
|
3302
|
+
event.stopPropagation();
|
|
3303
|
+
event.preventDefault();
|
|
3304
|
+
let message = 'Are you sure you want to delete this product?';
|
|
3305
|
+
let showButton = true;
|
|
3306
|
+
const index = this.selectedDataSource.data.indexOf(element);
|
|
3307
|
+
if (index >= 0) {
|
|
3308
|
+
if (this.selectedDataSource.data.length === 1) {
|
|
3309
|
+
message = 'Please select at least one product.';
|
|
3310
|
+
showButton = false;
|
|
3311
|
+
}
|
|
3312
|
+
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
3313
|
+
disableClose: true,
|
|
3314
|
+
width: '90%',
|
|
3315
|
+
maxWidth: '400px',
|
|
3316
|
+
data: { message: message, buttonStatus: showButton }
|
|
3317
|
+
});
|
|
3318
|
+
dialogRef.afterClosed().subscribe(result => {
|
|
3319
|
+
if (result) {
|
|
3320
|
+
this.selectedDataSource.data.splice(index, 1);
|
|
3321
|
+
this.selectedDataSource._updateChangeSubscription();
|
|
3322
|
+
this.selection.deselect(element);
|
|
3323
|
+
const selectedProductsArray = this.form.get('selectedProducts');
|
|
3324
|
+
const productIndex = selectedProductsArray.controls.findIndex(control => control.value.productName === element.productName);
|
|
3325
|
+
if (productIndex >= 0) {
|
|
3326
|
+
selectedProductsArray.removeAt(productIndex);
|
|
3327
|
+
}
|
|
3328
|
+
}
|
|
3329
|
+
});
|
|
3330
|
+
}
|
|
3331
|
+
}
|
|
3332
|
+
onScroll(event) {
|
|
3333
|
+
this.trackHeight = event.target.scrollHeight - event.target.offsetHeight;
|
|
3334
|
+
if (this.loadingFlag && (Math.floor(event.target.scrollTop / this.trackHeight * 100) > 50)) {
|
|
3335
|
+
this.loadingFlag = false;
|
|
3336
|
+
if (this.pageNumber < this.totalPages) {
|
|
3337
|
+
this.pageNumber = this.pageNumber + 1;
|
|
3338
|
+
this.getProducts();
|
|
3339
|
+
}
|
|
3340
|
+
else {
|
|
3341
|
+
this.loadingFlag = true;
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
this.prevScrollPosition = event.target.scrollTop;
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
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 });
|
|
3348
|
+
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"] }] });
|
|
3349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: AddOnProductsComponent, decorators: [{
|
|
3350
|
+
type: Component,
|
|
3351
|
+
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"] }]
|
|
3352
|
+
}], ctorParameters: function () { return [{ type: i1$1.MatDialogRef }, { type: undefined, decorators: [{
|
|
3353
|
+
type: Inject,
|
|
3354
|
+
args: [MAT_DIALOG_DATA]
|
|
3355
|
+
}] }, { type: i2.FormBuilder }, { type: i1$1.MatDialog }, { type: CommonService }]; }, propDecorators: { firstscrollableDiv: [{
|
|
3356
|
+
type: ViewChild,
|
|
3357
|
+
args: ['firstscrollableDiv']
|
|
3358
|
+
}] } });
|
|
3359
|
+
|
|
3360
|
+
const ELEMENT_DATA = [];
|
|
2965
3361
|
class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
2966
3362
|
constructor(element, ref, dialog) {
|
|
2967
3363
|
super(element, ref);
|
|
@@ -2969,11 +3365,30 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
2969
3365
|
this.ref = ref;
|
|
2970
3366
|
this.dialog = dialog;
|
|
2971
3367
|
this.dataSource = new MatTableDataSource();
|
|
3368
|
+
this.dataSourceNew = ELEMENT_DATA;
|
|
3369
|
+
this.displayedColumnsNew = ['productName', 'category', 'subCategory', 'quantity', 'price'];
|
|
3370
|
+
this.showNewProductPicker = false;
|
|
3371
|
+
this.showCategory = false;
|
|
3372
|
+
this.showSubcategory = false;
|
|
3373
|
+
this.showPrice = true;
|
|
3374
|
+
this.showQuantity = true;
|
|
3375
|
+
this.category = '';
|
|
3376
|
+
this.subCategory = '';
|
|
2972
3377
|
}
|
|
2973
3378
|
getColumnLabel(column) {
|
|
2974
3379
|
return column.label || column.key;
|
|
2975
3380
|
}
|
|
3381
|
+
checkIsAttributeTrue(newProductPickerFlag, attributeName) {
|
|
3382
|
+
return newProductPickerFlag && Object.keys(newProductPickerFlag).some(key => key.toLocaleLowerCase() === attributeName.toLowerCase() &&
|
|
3383
|
+
newProductPickerFlag[key].toLowerCase() === "true");
|
|
3384
|
+
}
|
|
2976
3385
|
setInstance(instance) {
|
|
3386
|
+
const newProductPickerFlag = instance?.component?.attributes;
|
|
3387
|
+
this.showNewProductPicker = this.checkIsAttributeTrue(newProductPickerFlag, "newproductpicker");
|
|
3388
|
+
this.showCategory = this.checkIsAttributeTrue(newProductPickerFlag, "showCategory");
|
|
3389
|
+
this.showSubcategory = this.checkIsAttributeTrue(newProductPickerFlag, "showSubcategory");
|
|
3390
|
+
this.showPrice = this.checkIsAttributeTrue(newProductPickerFlag, "showPrice");
|
|
3391
|
+
this.showQuantity = this.checkIsAttributeTrue(newProductPickerFlag, "showQuantity");
|
|
2977
3392
|
super.setInstance(instance);
|
|
2978
3393
|
this.dataSource.data = instance.dataValue;
|
|
2979
3394
|
this.columns = {};
|
|
@@ -3003,7 +3418,10 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3003
3418
|
return viewContainer ? viewContainer : null;
|
|
3004
3419
|
};
|
|
3005
3420
|
}
|
|
3006
|
-
|
|
3421
|
+
removeColumn(columnName) {
|
|
3422
|
+
this.displayedColumnsNew = this.displayedColumnsNew.filter(column => column !== columnName);
|
|
3423
|
+
}
|
|
3424
|
+
addAnotherOld() {
|
|
3007
3425
|
this.checkRowsNumber();
|
|
3008
3426
|
this.instance.addRow();
|
|
3009
3427
|
if (this.dataSource.data.length < this.instance.rows.length) {
|
|
@@ -3011,6 +3429,46 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3011
3429
|
}
|
|
3012
3430
|
this.dataSource.data = [...this.dataSource.data];
|
|
3013
3431
|
}
|
|
3432
|
+
addAnother() {
|
|
3433
|
+
if (this.showNewProductPicker) {
|
|
3434
|
+
const diologeRef = this.dialog.open(AddOnProductsComponent, {
|
|
3435
|
+
disableClose: true,
|
|
3436
|
+
width: '90%',
|
|
3437
|
+
maxWidth: '900px',
|
|
3438
|
+
autoFocus: false,
|
|
3439
|
+
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 }
|
|
3440
|
+
})
|
|
3441
|
+
.afterClosed().subscribe(response => {
|
|
3442
|
+
if (response?.data?.status) {
|
|
3443
|
+
if (!this.showCategory) {
|
|
3444
|
+
this.removeColumn('category');
|
|
3445
|
+
}
|
|
3446
|
+
if (!this.showQuantity) {
|
|
3447
|
+
this.removeColumn('quantity');
|
|
3448
|
+
}
|
|
3449
|
+
if (!this.showPrice) {
|
|
3450
|
+
this.removeColumn('price');
|
|
3451
|
+
}
|
|
3452
|
+
if (!this.showSubcategory) {
|
|
3453
|
+
this.removeColumn('subCategory');
|
|
3454
|
+
}
|
|
3455
|
+
localStorage.setItem('selectedProducts', JSON.stringify(response.data.items.selectedProducts));
|
|
3456
|
+
this.dataSourceNew = response.data.items.selectedProducts;
|
|
3457
|
+
this.category = response.data.items.productCategory;
|
|
3458
|
+
this.subCategory = response.data.items.productSubcategory;
|
|
3459
|
+
this.instance.component.defaultValue = response.data.items.selectedProducts;
|
|
3460
|
+
}
|
|
3461
|
+
});
|
|
3462
|
+
}
|
|
3463
|
+
else {
|
|
3464
|
+
this.checkRowsNumber();
|
|
3465
|
+
this.instance.addRow();
|
|
3466
|
+
if (this.dataSource.data.length < this.instance.rows.length) {
|
|
3467
|
+
this.dataSource.data.push({});
|
|
3468
|
+
}
|
|
3469
|
+
this.dataSource.data = [...this.dataSource.data];
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3014
3472
|
checkRowsNumber() {
|
|
3015
3473
|
while (this.instance.rows.length < this.dataSource.data.length) {
|
|
3016
3474
|
this.instance.addRow();
|
|
@@ -3060,7 +3518,7 @@ class MaterialDataGridComponent extends MaterialNestedComponent {
|
|
|
3060
3518
|
super.setValue(value);
|
|
3061
3519
|
}
|
|
3062
3520
|
}
|
|
3063
|
-
MaterialDataGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$
|
|
3521
|
+
MaterialDataGridComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
3064
3522
|
MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.3", type: MaterialDataGridComponent, selector: "mat-formio-datagrid", usesInheritance: true, ngImport: i0, template: `
|
|
3065
3523
|
<mat-formio-form-field [instance]="instance"
|
|
3066
3524
|
[componentTemplate]="componentTemplate"
|
|
@@ -3079,6 +3537,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3079
3537
|
{{instance.component.addAnother || 'Add Another'}}
|
|
3080
3538
|
</button>
|
|
3081
3539
|
</mat-card-actions>
|
|
3540
|
+
<ng-container *ngIf="!showNewProductPicker">
|
|
3541
|
+
<div class="mat-elevation-z8">
|
|
3082
3542
|
<table
|
|
3083
3543
|
mat-table
|
|
3084
3544
|
[dataSource]="dataSource"
|
|
@@ -3087,7 +3547,8 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3087
3547
|
cdkDropList
|
|
3088
3548
|
[cdkDropListData]="dataSource"
|
|
3089
3549
|
(cdkDropListDropped)="dropTable($event)">
|
|
3090
|
-
|
|
3550
|
+
|
|
3551
|
+
|
|
3091
3552
|
<ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
|
|
3092
3553
|
<th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
|
|
3093
3554
|
<td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
|
|
@@ -3117,6 +3578,51 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3117
3578
|
<tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
3118
3579
|
</div>
|
|
3119
3580
|
</table>
|
|
3581
|
+
</div>
|
|
3582
|
+
</ng-container>
|
|
3583
|
+
|
|
3584
|
+
<table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
|
|
3585
|
+
<!-- Product Name Column -->
|
|
3586
|
+
<ng-container matColumnDef="productName">
|
|
3587
|
+
<th mat-header-cell *matHeaderCellDef> Product Name </th>
|
|
3588
|
+
<td mat-cell *matCellDef="let element"> {{element.text}} </td>
|
|
3589
|
+
</ng-container>
|
|
3590
|
+
|
|
3591
|
+
<!-- Quantity Column -->
|
|
3592
|
+
<ng-container matColumnDef="quantity" *ngIf="showQuantity">
|
|
3593
|
+
<th mat-header-cell *matHeaderCellDef> Quantity </th>
|
|
3594
|
+
<td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
|
|
3595
|
+
</ng-container>
|
|
3596
|
+
|
|
3597
|
+
<!-- Price Column -->
|
|
3598
|
+
<ng-container matColumnDef="price" *ngIf="showPrice">
|
|
3599
|
+
<th mat-header-cell *matHeaderCellDef> Price </th>
|
|
3600
|
+
<td mat-cell *matCellDef="let element"> {{element.price}} </td>
|
|
3601
|
+
</ng-container>
|
|
3602
|
+
|
|
3603
|
+
<!-- Category Column -->
|
|
3604
|
+
<ng-container matColumnDef="category" *ngIf="showCategory">
|
|
3605
|
+
<th mat-header-cell *matHeaderCellDef> Category </th>
|
|
3606
|
+
<td mat-cell *matCellDef="let element"> {{element.category}} </td>
|
|
3607
|
+
</ng-container>
|
|
3608
|
+
|
|
3609
|
+
<!-- Category Column -->
|
|
3610
|
+
<ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
|
|
3611
|
+
<th mat-header-cell *matHeaderCellDef> Sub Category </th>
|
|
3612
|
+
<td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
|
|
3613
|
+
</ng-container>
|
|
3614
|
+
|
|
3615
|
+
<tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
|
|
3616
|
+
<tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
|
|
3617
|
+
</table>
|
|
3618
|
+
<ng-template #noData>
|
|
3619
|
+
<div class="no-data-message" *ngIf="showNewProductPicker">
|
|
3620
|
+
No product found please add some products.
|
|
3621
|
+
</div>
|
|
3622
|
+
</ng-template>
|
|
3623
|
+
|
|
3624
|
+
|
|
3625
|
+
|
|
3120
3626
|
</mat-card-content>
|
|
3121
3627
|
<mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
|
|
3122
3628
|
<button mat-raised-button color="primary" (click)="addAnother()">
|
|
@@ -3132,7 +3638,7 @@ MaterialDataGridComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.
|
|
|
3132
3638
|
<span [instance]="instance" matFormioLabel></span>
|
|
3133
3639
|
</mat-card-title>
|
|
3134
3640
|
</ng-template>
|
|
3135
|
-
`, isInline: true, styles: [".datagrid-row{height:auto}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type:
|
|
3641
|
+
`, isInline: true, styles: [".datagrid-row{height:auto}.mat-table{width:100%}.mat-header-cell,.mat-cell{padding:8px}.no-data-message{text-align:center;margin:20px 0;font-size:18px;color:#888}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i10.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i10.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i10.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i10.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i10.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i10.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i10.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i10.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i10.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i10.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "component", type: i4$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i5.FlexFillDirective, selector: "[fxFill], [fxFlexFill]" }, { kind: "component", type: i4.MatCard, selector: "mat-card", exportAs: ["matCard"] }, { kind: "directive", type: i4.MatCardContent, selector: "mat-card-content, [mat-card-content], [matCardContent]" }, { kind: "directive", type: i4.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "directive", type: i4.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i8.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i8.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i8.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "component", type: FormioFormFieldComponent, selector: "mat-formio-form-field", inputs: ["labelTemplate", "renderTopLabel", "showDescription", "renderElementOnly", "instance", "componentTemplate"] }, { kind: "component", type: LabelComponent, selector: "span[matFormioLabel]", inputs: ["instance"] }] });
|
|
3136
3642
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialDataGridComponent, decorators: [{
|
|
3137
3643
|
type: Component,
|
|
3138
3644
|
args: [{ selector: 'mat-formio-datagrid', template: `
|
|
@@ -3153,6 +3659,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3153
3659
|
{{instance.component.addAnother || 'Add Another'}}
|
|
3154
3660
|
</button>
|
|
3155
3661
|
</mat-card-actions>
|
|
3662
|
+
<ng-container *ngIf="!showNewProductPicker">
|
|
3663
|
+
<div class="mat-elevation-z8">
|
|
3156
3664
|
<table
|
|
3157
3665
|
mat-table
|
|
3158
3666
|
[dataSource]="dataSource"
|
|
@@ -3161,7 +3669,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3161
3669
|
cdkDropList
|
|
3162
3670
|
[cdkDropListData]="dataSource"
|
|
3163
3671
|
(cdkDropListDropped)="dropTable($event)">
|
|
3164
|
-
|
|
3672
|
+
|
|
3673
|
+
|
|
3165
3674
|
<ng-container *ngFor="let column of formColumns" [matColumnDef]="column">
|
|
3166
3675
|
<th mat-header-cell *matHeaderCellDef>{{ getColumnLabel(columns[column]) }}</th>
|
|
3167
3676
|
<td mat-cell *matCellDef="let i = index;" [attr.rowIndex]="i" [attr.component]="column">
|
|
@@ -3191,6 +3700,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3191
3700
|
<tr class="datagrid-row" mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
|
3192
3701
|
</div>
|
|
3193
3702
|
</table>
|
|
3703
|
+
</div>
|
|
3704
|
+
</ng-container>
|
|
3705
|
+
|
|
3706
|
+
<table mat-table [dataSource]="dataSourceNew" class="mat-table" *ngIf="dataSourceNew.length > 0 && showNewProductPicker; else noData" >
|
|
3707
|
+
<!-- Product Name Column -->
|
|
3708
|
+
<ng-container matColumnDef="productName">
|
|
3709
|
+
<th mat-header-cell *matHeaderCellDef> Product Name </th>
|
|
3710
|
+
<td mat-cell *matCellDef="let element"> {{element.text}} </td>
|
|
3711
|
+
</ng-container>
|
|
3712
|
+
|
|
3713
|
+
<!-- Quantity Column -->
|
|
3714
|
+
<ng-container matColumnDef="quantity" *ngIf="showQuantity">
|
|
3715
|
+
<th mat-header-cell *matHeaderCellDef> Quantity </th>
|
|
3716
|
+
<td mat-cell *matCellDef="let element"> {{element.quantity}} </td>
|
|
3717
|
+
</ng-container>
|
|
3718
|
+
|
|
3719
|
+
<!-- Price Column -->
|
|
3720
|
+
<ng-container matColumnDef="price" *ngIf="showPrice">
|
|
3721
|
+
<th mat-header-cell *matHeaderCellDef> Price </th>
|
|
3722
|
+
<td mat-cell *matCellDef="let element"> {{element.price}} </td>
|
|
3723
|
+
</ng-container>
|
|
3724
|
+
|
|
3725
|
+
<!-- Category Column -->
|
|
3726
|
+
<ng-container matColumnDef="category" *ngIf="showCategory">
|
|
3727
|
+
<th mat-header-cell *matHeaderCellDef> Category </th>
|
|
3728
|
+
<td mat-cell *matCellDef="let element"> {{element.category}} </td>
|
|
3729
|
+
</ng-container>
|
|
3730
|
+
|
|
3731
|
+
<!-- Category Column -->
|
|
3732
|
+
<ng-container matColumnDef="subCategory" *ngIf="showSubcategory">
|
|
3733
|
+
<th mat-header-cell *matHeaderCellDef> Sub Category </th>
|
|
3734
|
+
<td mat-cell *matCellDef="let element"> {{element.subCategory}} </td>
|
|
3735
|
+
</ng-container>
|
|
3736
|
+
|
|
3737
|
+
<tr mat-header-row *matHeaderRowDef="displayedColumnsNew"></tr>
|
|
3738
|
+
<tr mat-row *matRowDef="let row; columns: displayedColumnsNew;"></tr>
|
|
3739
|
+
</table>
|
|
3740
|
+
<ng-template #noData>
|
|
3741
|
+
<div class="no-data-message" *ngIf="showNewProductPicker">
|
|
3742
|
+
No product found please add some products.
|
|
3743
|
+
</div>
|
|
3744
|
+
</ng-template>
|
|
3745
|
+
|
|
3746
|
+
|
|
3747
|
+
|
|
3194
3748
|
</mat-card-content>
|
|
3195
3749
|
<mat-card-actions *ngIf="instance.hasAddButton() && instance.component.addAnotherPosition !== 'top'">
|
|
3196
3750
|
<button mat-raised-button color="primary" (click)="addAnother()">
|
|
@@ -3206,8 +3760,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3206
3760
|
<span [instance]="instance" matFormioLabel></span>
|
|
3207
3761
|
</mat-card-title>
|
|
3208
3762
|
</ng-template>
|
|
3209
|
-
`, styles: [".datagrid-row{height:auto}\n"] }]
|
|
3210
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$
|
|
3763
|
+
`, 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"] }]
|
|
3764
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1$1.MatDialog }]; } });
|
|
3211
3765
|
DataGridComponent.MaterialComponent = MaterialDataGridComponent;
|
|
3212
3766
|
|
|
3213
3767
|
var EditRowState;
|
|
@@ -3593,7 +4147,7 @@ MaterialWizardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0"
|
|
|
3593
4147
|
<button *ngIf="instance.hasButton('submit')" mat-raised-button color="primary" (click)="submit()">Submit</button>
|
|
3594
4148
|
</div>
|
|
3595
4149
|
</mat-step>
|
|
3596
|
-
</mat-horizontal-stepper>`, isInline: true, styles: [":host .navigation-button-row{margin-top:8px}\n", ":host .navigation-button-row button{margin-right:8px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type:
|
|
4150
|
+
</mat-horizontal-stepper>`, isInline: true, styles: [":host .navigation-button-row{margin-top:8px}\n", ":host .navigation-button-row button{margin-right:8px}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i13.MatStep, selector: "mat-step", inputs: ["color"], exportAs: ["matStep"] }, { kind: "component", type: i13.MatStepper, selector: "mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]", inputs: ["selectedIndex", "disableRipple", "color", "labelPosition", "headerPosition", "animationDuration"], outputs: ["animationDone"], exportAs: ["matStepper", "matVerticalStepper", "matHorizontalStepper"] }] });
|
|
3597
4151
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: MaterialWizardComponent, decorators: [{
|
|
3598
4152
|
type: Component,
|
|
3599
4153
|
args: [{ selector: 'mat-formio-wizard', template: `
|
|
@@ -3763,7 +4317,7 @@ FormioComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", versio
|
|
|
3763
4317
|
<div fxLayout="column" fxLayoutGap="1em">
|
|
3764
4318
|
<ng-template #formio></ng-template>
|
|
3765
4319
|
</div>
|
|
3766
|
-
`, isInline: true, styles: [".alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:.5rem;border:1px solid transparent;border-radius:.25rem}::ng-deep mat-card{box-sizing:border-box;-moz-box-sizing:border-box}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type:
|
|
4320
|
+
`, isInline: true, styles: [".alert-danger{color:#721c24;background-color:#f8d7da;border-color:#f5c6cb}.alert-success{color:#155724;background-color:#d4edda;border-color:#c3e6cb}.alert{position:relative;padding:.75rem 1.25rem;margin-bottom:.5rem;border:1px solid transparent;border-radius:.25rem}::ng-deep mat-card{box-sizing:border-box;-moz-box-sizing:border-box}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i11.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "diameter", "strokeWidth", "mode", "value"], exportAs: ["matProgressSpinner"] }, { kind: "directive", type: i5.DefaultLayoutDirective, selector: " [fxLayout], [fxLayout.xs], [fxLayout.sm], [fxLayout.md], [fxLayout.lg], [fxLayout.xl], [fxLayout.lt-sm], [fxLayout.lt-md], [fxLayout.lt-lg], [fxLayout.lt-xl], [fxLayout.gt-xs], [fxLayout.gt-sm], [fxLayout.gt-md], [fxLayout.gt-lg]", inputs: ["fxLayout", "fxLayout.xs", "fxLayout.sm", "fxLayout.md", "fxLayout.lg", "fxLayout.xl", "fxLayout.lt-sm", "fxLayout.lt-md", "fxLayout.lt-lg", "fxLayout.lt-xl", "fxLayout.gt-xs", "fxLayout.gt-sm", "fxLayout.gt-md", "fxLayout.gt-lg"] }, { kind: "directive", type: i5.DefaultLayoutGapDirective, selector: " [fxLayoutGap], [fxLayoutGap.xs], [fxLayoutGap.sm], [fxLayoutGap.md], [fxLayoutGap.lg], [fxLayoutGap.xl], [fxLayoutGap.lt-sm], [fxLayoutGap.lt-md], [fxLayoutGap.lt-lg], [fxLayoutGap.lt-xl], [fxLayoutGap.gt-xs], [fxLayoutGap.gt-sm], [fxLayoutGap.gt-md], [fxLayoutGap.gt-lg]", inputs: ["fxLayoutGap", "fxLayoutGap.xs", "fxLayoutGap.sm", "fxLayoutGap.md", "fxLayoutGap.lg", "fxLayoutGap.xl", "fxLayoutGap.lt-sm", "fxLayoutGap.lt-md", "fxLayoutGap.lt-lg", "fxLayoutGap.lt-xl", "fxLayoutGap.gt-xs", "fxLayoutGap.gt-sm", "fxLayoutGap.gt-md", "fxLayoutGap.gt-lg"] }] });
|
|
3767
4321
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImport: i0, type: FormioComponent, decorators: [{
|
|
3768
4322
|
type: Component,
|
|
3769
4323
|
args: [{ selector: 'mat-formio', template: `
|
|
@@ -3833,7 +4387,8 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
|
|
|
3833
4387
|
FormioFormFieldComponent,
|
|
3834
4388
|
LabelComponent,
|
|
3835
4389
|
MaskDirective,
|
|
3836
|
-
ConfirmationDialogComponent
|
|
4390
|
+
ConfirmationDialogComponent,
|
|
4391
|
+
AddOnProductsComponent], imports: [CommonModule,
|
|
3837
4392
|
FormsModule,
|
|
3838
4393
|
ReactiveFormsModule,
|
|
3839
4394
|
MatInputModule,
|
|
@@ -3861,7 +4416,9 @@ NgxRenderMaterialFormsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.
|
|
|
3861
4416
|
ScrollingModule,
|
|
3862
4417
|
NgxMatSelectSearchModule,
|
|
3863
4418
|
MatDialogModule,
|
|
3864
|
-
HttpClientModule
|
|
4419
|
+
HttpClientModule,
|
|
4420
|
+
MatAutocompleteModule], exports: [MatAutocompleteModule,
|
|
4421
|
+
NgxRenderMaterialFormsComponent,
|
|
3865
4422
|
FormioComponent,
|
|
3866
4423
|
MatInputModule,
|
|
3867
4424
|
MatFormFieldModule,
|
|
@@ -3915,7 +4472,9 @@ NgxRenderMaterialFormsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.
|
|
|
3915
4472
|
ScrollingModule,
|
|
3916
4473
|
NgxMatSelectSearchModule,
|
|
3917
4474
|
MatDialogModule,
|
|
3918
|
-
HttpClientModule,
|
|
4475
|
+
HttpClientModule,
|
|
4476
|
+
MatAutocompleteModule, MatAutocompleteModule,
|
|
4477
|
+
MatInputModule,
|
|
3919
4478
|
MatFormFieldModule,
|
|
3920
4479
|
MatCheckboxModule,
|
|
3921
4480
|
MatRadioModule,
|
|
@@ -3983,7 +4542,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
3983
4542
|
FormioFormFieldComponent,
|
|
3984
4543
|
LabelComponent,
|
|
3985
4544
|
MaskDirective,
|
|
3986
|
-
ConfirmationDialogComponent
|
|
4545
|
+
ConfirmationDialogComponent,
|
|
4546
|
+
AddOnProductsComponent
|
|
3987
4547
|
],
|
|
3988
4548
|
imports: [
|
|
3989
4549
|
CommonModule,
|
|
@@ -4014,9 +4574,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.3", ngImpor
|
|
|
4014
4574
|
ScrollingModule,
|
|
4015
4575
|
NgxMatSelectSearchModule,
|
|
4016
4576
|
MatDialogModule,
|
|
4017
|
-
HttpClientModule
|
|
4577
|
+
HttpClientModule,
|
|
4578
|
+
MatAutocompleteModule
|
|
4018
4579
|
],
|
|
4019
4580
|
exports: [
|
|
4581
|
+
MatAutocompleteModule,
|
|
4020
4582
|
NgxRenderMaterialFormsComponent,
|
|
4021
4583
|
FormioComponent,
|
|
4022
4584
|
MatInputModule,
|