@yomotech/view-toolkit 0.0.32 → 0.0.33

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.
Files changed (72) hide show
  1. package/fesm2022/yomotech-view-toolkit.mjs +3591 -0
  2. package/fesm2022/yomotech-view-toolkit.mjs.map +1 -0
  3. package/package.json +49 -38
  4. package/types/yomotech-view-toolkit.d.ts +648 -0
  5. package/ng-package.json +0 -7
  6. package/src/lib/app-version.ts +0 -2
  7. package/src/lib/components/autocomplete/autocomplete.css +0 -0
  8. package/src/lib/components/autocomplete/autocomplete.html +0 -23
  9. package/src/lib/components/autocomplete/autocomplete.ts +0 -71
  10. package/src/lib/components/button/button.css +0 -0
  11. package/src/lib/components/button/button.html +0 -1
  12. package/src/lib/components/button/button.ts +0 -11
  13. package/src/lib/components/date/date.css +0 -0
  14. package/src/lib/components/date/date.html +0 -1
  15. package/src/lib/components/date/date.ts +0 -11
  16. package/src/lib/components/dropdown/dropdown.css +0 -0
  17. package/src/lib/components/dropdown/dropdown.html +0 -1
  18. package/src/lib/components/dropdown/dropdown.ts +0 -11
  19. package/src/lib/components/error-message/error-message.css +0 -0
  20. package/src/lib/components/error-message/error-message.html +0 -1
  21. package/src/lib/components/error-message/error-message.ts +0 -11
  22. package/src/lib/components/label/label.css +0 -0
  23. package/src/lib/components/label/label.html +0 -7
  24. package/src/lib/components/label/label.ts +0 -33
  25. package/src/lib/components/string/string.css +0 -0
  26. package/src/lib/components/string/string.html +0 -4
  27. package/src/lib/components/string/string.ts +0 -22
  28. package/src/lib/components/textbox/textbox.css +0 -0
  29. package/src/lib/components/textbox/textbox.html +0 -7
  30. package/src/lib/components/textbox/textbox.ts +0 -33
  31. package/src/lib/components/time/time.css +0 -0
  32. package/src/lib/components/time/time.html +0 -1
  33. package/src/lib/components/time/time.ts +0 -11
  34. package/src/lib/containers/card/card.component.css +0 -0
  35. package/src/lib/containers/card/card.component.html +0 -450
  36. package/src/lib/containers/card/card.component.ts +0 -474
  37. package/src/lib/containers/form/form.component.css +0 -101
  38. package/src/lib/containers/form/form.component.html +0 -305
  39. package/src/lib/containers/form/form.component.ts +0 -333
  40. package/src/lib/containers/grid/grid.component.css +0 -0
  41. package/src/lib/containers/grid/grid.component.html +0 -212
  42. package/src/lib/containers/grid/grid.component.ts +0 -228
  43. package/src/lib/containers/header-menu/header-menu.component.css +0 -0
  44. package/src/lib/containers/header-menu/header-menu.component.html +0 -72
  45. package/src/lib/containers/header-menu/header-menu.component.ts +0 -105
  46. package/src/lib/containers/logs/logs.component.css +0 -160
  47. package/src/lib/containers/logs/logs.component.html +0 -89
  48. package/src/lib/containers/logs/logs.component.ts +0 -29
  49. package/src/lib/containers/model/model.component.css +0 -0
  50. package/src/lib/containers/model/model.component.html +0 -351
  51. package/src/lib/containers/model/model.component.ts +0 -436
  52. package/src/lib/containers/pagination/pagination.component.css +0 -0
  53. package/src/lib/containers/pagination/pagination.component.html +0 -41
  54. package/src/lib/containers/pagination/pagination.component.ts +0 -100
  55. package/src/lib/containers/side-menu/side-menu.component.css +0 -173
  56. package/src/lib/containers/side-menu/side-menu.component.html +0 -126
  57. package/src/lib/containers/side-menu/side-menu.component.ts +0 -458
  58. package/src/lib/services/app-version-reset.service.ts +0 -59
  59. package/src/lib/services/config.service.ts +0 -144
  60. package/src/lib/services/couchdb.ts +0 -275
  61. package/src/lib/services/mobile-keycloak.service.ts +0 -116
  62. package/src/lib/services/network-log.service.ts +0 -27
  63. package/src/lib/services/notification.service.ts +0 -26
  64. package/src/lib/services/request.service.ts +0 -125
  65. package/src/lib/services/utility.service.ts +0 -600
  66. package/src/lib/view-toolkit.module.ts +0 -57
  67. package/src/lib/view-toolkit.spec.ts +0 -23
  68. package/src/lib/view-toolkit.ts +0 -15
  69. package/src/public-api.ts +0 -25
  70. package/tsconfig.lib.json +0 -17
  71. package/tsconfig.lib.prod.json +0 -11
  72. package/tsconfig.spec.json +0 -15
@@ -0,0 +1,3591 @@
1
+ import * as i5 from '@angular/common';
2
+ import { CommonModule, NgIf } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { EventEmitter, Output, Input, Component, Injectable, NgZone, HostListener, ViewChild, Inject, NgModule } from '@angular/core';
5
+ import * as i2 from '@angular/forms';
6
+ import { FormsModule } from '@angular/forms';
7
+ import * as i1$1 from '@angular/common/http';
8
+ import { HttpHeaders } from '@angular/common/http';
9
+ import { CapacitorHttp, Capacitor } from '@capacitor/core';
10
+ import * as i9 from 'ng-zorro-antd/icon';
11
+ import { NzIconModule } from 'ng-zorro-antd/icon';
12
+ import * as i11 from 'ng-zorro-antd/button';
13
+ import { NzButtonModule } from 'ng-zorro-antd/button';
14
+ import * as i5$2 from 'ng-zorro-antd/date-picker';
15
+ import { NzDatePickerModule } from 'ng-zorro-antd/date-picker';
16
+ import * as i4 from 'ng-zorro-antd/modal';
17
+ import { NzModalModule } from 'ng-zorro-antd/modal';
18
+ import * as i10 from 'primeng/datepicker';
19
+ import { DatePickerModule } from 'primeng/datepicker';
20
+ import * as i1 from '@angular/cdk/platform';
21
+ import { PlatformModule } from '@angular/cdk/platform';
22
+ import { Preferences } from '@capacitor/preferences';
23
+ import { loadStripe } from '@stripe/stripe-js';
24
+ import { lastValueFrom } from 'rxjs';
25
+ import * as i5$1 from 'angular-oauth2-oidc';
26
+ import * as i12 from 'ng-zorro-antd/core/transition-patch';
27
+ import * as i13 from 'ng-zorro-antd/core/wave';
28
+ import * as i3 from 'ng-zorro-antd/select';
29
+ import { NzSelectModule } from 'ng-zorro-antd/select';
30
+ import * as i7 from 'ng-zorro-antd/table';
31
+ import { NzTableModule } from 'ng-zorro-antd/table';
32
+ import * as i9$1 from 'primeng/button';
33
+ import { ButtonModule } from 'primeng/button';
34
+ import * as i1$2 from 'ngx-toastr';
35
+ import * as i4$1 from '@okta/okta-angular';
36
+ import { OKTA_AUTH } from '@okta/okta-angular';
37
+ import * as i2$2 from 'primeng/autocomplete';
38
+ import { AutoCompleteModule } from 'primeng/autocomplete';
39
+ import * as i2$1 from 'primeng/inputtext';
40
+ import { InputTextModule } from 'primeng/inputtext';
41
+ import { SelectModule } from 'primeng/select';
42
+ import OktaAuth from '@okta/okta-auth-js';
43
+ import { jwtDecode } from 'jwt-decode';
44
+ import * as i8 from 'primeng/dynamicdialog';
45
+ import { DynamicDialogModule } from 'primeng/dynamicdialog';
46
+ import { Device } from '@capacitor/device';
47
+ import * as i1$3 from 'ng-zorro-antd/i18n';
48
+ import { de_DE, en_US } from 'ng-zorro-antd/i18n';
49
+ import * as i12$1 from 'ng-zorro-antd/menu';
50
+ import { NzMenuModule } from 'ng-zorro-antd/menu';
51
+ import * as i14 from 'ng-zorro-antd/tooltip';
52
+ import { NzTooltipModule } from 'ng-zorro-antd/tooltip';
53
+ import { App } from '@capacitor/app';
54
+ import { Browser } from '@capacitor/browser';
55
+ import { OAuth2Client } from '@byteowls/capacitor-oauth2';
56
+
57
+ class PaginationComponent {
58
+ platform;
59
+ itemInfo = {
60
+ layoutSchema: {},
61
+ propertySchema: {},
62
+ data: []
63
+ };
64
+ pageSize;
65
+ currentPage = 0;
66
+ pages = [];
67
+ pageSizeChange = new EventEmitter();
68
+ onGoToPage = new EventEmitter();
69
+ isMobile = false;
70
+ constructor(platform) {
71
+ this.platform = platform;
72
+ }
73
+ ngOnInit() {
74
+ if (this.platform.ANDROID || this.platform.IOS) {
75
+ this.isMobile = true;
76
+ }
77
+ }
78
+ get paginationStyle() {
79
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.style);
80
+ }
81
+ get listStyle() {
82
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.listStyle);
83
+ }
84
+ get sizeControlStyle() {
85
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.sizeControlStyle);
86
+ }
87
+ get labelStyle() {
88
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.labelStyle);
89
+ }
90
+ get selectStyle() {
91
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.selectStyle);
92
+ }
93
+ getStyle(styleObject) {
94
+ if (!styleObject || typeof styleObject !== 'object') {
95
+ return {};
96
+ }
97
+ const { classes, ...styleWithoutClasses } = styleObject;
98
+ return styleWithoutClasses;
99
+ }
100
+ getPageItemStyle(page, disabled = false) {
101
+ const pagination = this.itemInfo?.layoutSchema?.pagination || {};
102
+ const baseStyle = this.getStyle(pagination.itemStyle);
103
+ const activeStyle = page !== undefined && this.currentPage === page
104
+ ? this.getStyle(pagination.activeItemStyle)
105
+ : {};
106
+ const disabledStyle = disabled
107
+ ? this.getStyle(pagination.disabledItemStyle)
108
+ : {};
109
+ return {
110
+ ...baseStyle,
111
+ ...activeStyle,
112
+ ...disabledStyle,
113
+ 'pointer-events': disabled ? 'none' : 'auto'
114
+ };
115
+ }
116
+ invokeOnPageSizeChange(pageSize) {
117
+ this.pageSizeChange.emit(Number(pageSize));
118
+ }
119
+ invokeGoToPage(page) {
120
+ if (page < 0 || page > this.pages.length - 1 || page === this.currentPage) {
121
+ return;
122
+ }
123
+ this.onGoToPage.emit(page);
124
+ }
125
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PaginationComponent, deps: [{ token: i1.Platform }], target: i0.ɵɵFactoryTarget.Component });
126
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: PaginationComponent, isStandalone: true, selector: "vl-pagination", inputs: { itemInfo: "itemInfo", pageSize: "pageSize", currentPage: "currentPage", pages: "pages" }, outputs: { pageSizeChange: "pageSizeChange", onGoToPage: "onGoToPage" }, ngImport: i0, template: "<div [ngStyle]=\"paginationStyle\">\r\n <ul [ngStyle]=\"listStyle\" [style.z-index]=\"isMobile ? 99999 : 'auto'\">\r\n\r\n <li (click)=\"invokeGoToPage(0)\" [ngStyle]=\"getPageItemStyle(undefined, currentPage === 0)\">\r\n \u00AB\u00AB\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(currentPage - 1)\" [ngStyle]=\"getPageItemStyle(undefined, currentPage === 0)\">\r\n \u00AB\r\n </li>\r\n\r\n <li *ngFor=\"let page of pages\" (click)=\"invokeGoToPage(page)\" [ngStyle]=\"getPageItemStyle(page)\">\r\n {{ page + 1 }}\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(currentPage + 1)\"\r\n [ngStyle]=\"getPageItemStyle(undefined, currentPage === pages.length - 1)\">\r\n \u00BB\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(pages.length - 1)\"\r\n [ngStyle]=\"getPageItemStyle(undefined, currentPage === pages.length - 1)\">\r\n \u00BB\u00BB\r\n </li>\r\n </ul>\r\n\r\n <div *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" [ngStyle]=\"sizeControlStyle\">\r\n\r\n <label for=\"pageSize\" [ngStyle]=\"labelStyle\">\r\n {{ itemInfo?.layoutSchema?.pagination?.caption }}\r\n </label>\r\n\r\n <select id=\"pageSize\" [(ngModel)]=\"pageSize\" (change)=\"invokeOnPageSizeChange(pageSize)\"\r\n [ngStyle]=\"selectStyle\">\r\n\r\n <option *ngFor=\"let size of [5, 10, 15, 20]\" [value]=\"size\">\r\n {{ size }}\r\n </option>\r\n </select>\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: PlatformModule }] });
127
+ }
128
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PaginationComponent, decorators: [{
129
+ type: Component,
130
+ args: [{ standalone: true, selector: 'vl-pagination', imports: [
131
+ CommonModule,
132
+ FormsModule,
133
+ PlatformModule
134
+ ], template: "<div [ngStyle]=\"paginationStyle\">\r\n <ul [ngStyle]=\"listStyle\" [style.z-index]=\"isMobile ? 99999 : 'auto'\">\r\n\r\n <li (click)=\"invokeGoToPage(0)\" [ngStyle]=\"getPageItemStyle(undefined, currentPage === 0)\">\r\n \u00AB\u00AB\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(currentPage - 1)\" [ngStyle]=\"getPageItemStyle(undefined, currentPage === 0)\">\r\n \u00AB\r\n </li>\r\n\r\n <li *ngFor=\"let page of pages\" (click)=\"invokeGoToPage(page)\" [ngStyle]=\"getPageItemStyle(page)\">\r\n {{ page + 1 }}\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(currentPage + 1)\"\r\n [ngStyle]=\"getPageItemStyle(undefined, currentPage === pages.length - 1)\">\r\n \u00BB\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(pages.length - 1)\"\r\n [ngStyle]=\"getPageItemStyle(undefined, currentPage === pages.length - 1)\">\r\n \u00BB\u00BB\r\n </li>\r\n </ul>\r\n\r\n <div *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" [ngStyle]=\"sizeControlStyle\">\r\n\r\n <label for=\"pageSize\" [ngStyle]=\"labelStyle\">\r\n {{ itemInfo?.layoutSchema?.pagination?.caption }}\r\n </label>\r\n\r\n <select id=\"pageSize\" [(ngModel)]=\"pageSize\" (change)=\"invokeOnPageSizeChange(pageSize)\"\r\n [ngStyle]=\"selectStyle\">\r\n\r\n <option *ngFor=\"let size of [5, 10, 15, 20]\" [value]=\"size\">\r\n {{ size }}\r\n </option>\r\n </select>\r\n </div>\r\n</div>" }]
135
+ }], ctorParameters: () => [{ type: i1.Platform }], propDecorators: { itemInfo: [{
136
+ type: Input
137
+ }], pageSize: [{
138
+ type: Input
139
+ }], currentPage: [{
140
+ type: Input
141
+ }], pages: [{
142
+ type: Input
143
+ }], pageSizeChange: [{
144
+ type: Output
145
+ }], onGoToPage: [{
146
+ type: Output
147
+ }] } });
148
+
149
+ let String$1 = class String {
150
+ formField;
151
+ modalItemInfo;
152
+ getScope(scope) {
153
+ let propertyScope = "";
154
+ let start = scope?.indexOf("#/") + 2;
155
+ let end = scope?.indexOf("/", start);
156
+ if (start && end) {
157
+ propertyScope = scope.substring(start, end);
158
+ }
159
+ return propertyScope;
160
+ }
161
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: String, deps: [], target: i0.ɵɵFactoryTarget.Component });
162
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: String, isStandalone: true, selector: "vl-string", inputs: { formField: "formField", modalItemInfo: "modalItemInfo" }, ngImport: i0, template: "<h5>{{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n</h5>", styles: [""] });
163
+ };
164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: String$1, decorators: [{
165
+ type: Component,
166
+ args: [{ selector: 'vl-string', standalone: true, template: "<h5>{{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n</h5>" }]
167
+ }], propDecorators: { formField: [{
168
+ type: Input
169
+ }], modalItemInfo: [{
170
+ type: Input
171
+ }] } });
172
+
173
+ class RequestService {
174
+ http;
175
+ pageSize = 0;
176
+ constructor(http) {
177
+ this.http = http;
178
+ }
179
+ getAllProject() {
180
+ return this.http.get("../assets/main/layout_schema.json");
181
+ }
182
+ getEnvironmet(selectedProject) {
183
+ return this.http.get(`../../assets/projects/${selectedProject}/environments/environment.json`);
184
+ }
185
+ getSectionInfo(url, envUrl, passToken = false, selectedProject = '', userInfo = null) {
186
+ if (envUrl) {
187
+ if (passToken && selectedProject) {
188
+ return this.http.get(envUrl + url, {
189
+ headers: this.createAuthorizationHeader(userInfo),
190
+ });
191
+ }
192
+ else {
193
+ return this.http.get(envUrl + url);
194
+ }
195
+ }
196
+ else {
197
+ return this.http.get(url);
198
+ }
199
+ ;
200
+ }
201
+ getMainLayout(selectedProject) {
202
+ return this.http.get(`../assets/projects/${selectedProject}/main/layout_schema.json`);
203
+ }
204
+ getInfo(url) {
205
+ return this.http.get(url);
206
+ }
207
+ dynamicCall(method = "get", body = null, url, passToken = false, selectedProject = '', userInfo = null) {
208
+ switch (method.toLowerCase()) {
209
+ case 'get':
210
+ if (passToken && selectedProject) {
211
+ return this.http.get(url, {
212
+ headers: this.createAuthorizationHeader(userInfo),
213
+ });
214
+ }
215
+ else {
216
+ return this.http.get(url);
217
+ }
218
+ case 'post':
219
+ if (passToken && selectedProject) {
220
+ return this.http.post(url, body, {
221
+ headers: this.createAuthorizationHeader(userInfo),
222
+ });
223
+ }
224
+ else {
225
+ return this.http.post(url, body);
226
+ }
227
+ case 'put':
228
+ if (passToken && selectedProject) {
229
+ return this.http.put(url, body, {
230
+ headers: this.createAuthorizationHeader(userInfo),
231
+ });
232
+ }
233
+ else {
234
+ return this.http.put(url, body);
235
+ }
236
+ case 'delete':
237
+ if (passToken && selectedProject) {
238
+ return this.http.delete(url, {
239
+ headers: this.createAuthorizationHeader(userInfo),
240
+ });
241
+ }
242
+ else {
243
+ return this.http.delete(url);
244
+ }
245
+ ;
246
+ case 'patch':
247
+ return this.http.patch(url, body);
248
+ default:
249
+ throw new Error(`Unsupported HTTP method: ${method}`);
250
+ }
251
+ }
252
+ createAuthorizationHeader(userInfo, tokenExist = false) {
253
+ let authHeaders = new HttpHeaders();
254
+ let token = tokenExist ? userInfo : userInfo && userInfo.jwt ? userInfo.jwt : userInfo?.authToken ? userInfo?.authToken : '';
255
+ return authHeaders.set('Authorization', 'Bearer ' + token);
256
+ }
257
+ getLoginUser(token) {
258
+ return this.http.get("https://dev-78992019.okta.com/oauth2/default/v1/userinfo", {
259
+ headers: this.createAuthorizationHeader(token, true),
260
+ });
261
+ }
262
+ saveDb(token, userInfo, order = {}) {
263
+ if (token) {
264
+ const headers = new HttpHeaders({
265
+ 'Authorization': `Bearer ${token}`,
266
+ 'Accept': 'application/json'
267
+ });
268
+ let url2 = `${userInfo.p5_backend_url}/assetsmobileservice/Zeiterfassung/registerTimeRecording?company=${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant ? userInfo.p5_plant : " "}&appVersion=1&resourceNo=${userInfo.p5_resource_no}`;
269
+ console.log('userInfo: ', userInfo);
270
+ this.http.post(url2, order, { headers }).subscribe({
271
+ next: res => {
272
+ console.log('Save-res: ', res);
273
+ }
274
+ });
275
+ }
276
+ }
277
+ getSaveOrder(token, userInfo, fromDate, toDate) {
278
+ // if (token) {
279
+ const headers = new HttpHeaders({
280
+ 'Authorization': `Bearer ${token}`,
281
+ 'Accept': 'application/json'
282
+ });
283
+ let url = `${userInfo.p5_backend_url}/assetsmobileservice/Zeiterfassung/requestBookedTimeRecording?resourceNo=${userInfo.p5_resource_no}&workDayFrom=${fromDate}&workDayTo=${toDate}&company=${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant ? userInfo.p5_plant : " "}&appVersion=1`;
284
+ return this.http.post(url, {}, { headers });
285
+ // }
286
+ }
287
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RequestService, deps: [{ token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
288
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RequestService, providedIn: 'root' });
289
+ }
290
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RequestService, decorators: [{
291
+ type: Injectable,
292
+ args: [{
293
+ providedIn: 'root'
294
+ }]
295
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }] });
296
+
297
+ class UtilityService {
298
+ platform;
299
+ requestService;
300
+ stripe = null;
301
+ constructor(platform, requestService) {
302
+ this.platform = platform;
303
+ this.requestService = requestService;
304
+ }
305
+ getScope(scope) {
306
+ let propertyScope = "";
307
+ let start = scope?.indexOf("#/") + 2;
308
+ let end = scope?.indexOf("/", start);
309
+ if (start && end) {
310
+ propertyScope = scope.substring(start, end);
311
+ }
312
+ return propertyScope;
313
+ }
314
+ getProperty(scope, itemInfo) {
315
+ const property = scope?.reference ? scope?.reference.split('/').pop() : '';
316
+ return { key: property, productSchema: itemInfo.propertySchema[property] };
317
+ }
318
+ async setStorage(key, value) {
319
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
320
+ await Preferences.set({ key, value });
321
+ }
322
+ else {
323
+ sessionStorage.setItem(key, value);
324
+ }
325
+ }
326
+ async getStorage(key) {
327
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
328
+ const { value } = await Preferences.get({ key });
329
+ return value;
330
+ }
331
+ else {
332
+ const storage = sessionStorage.getItem(key);
333
+ return storage;
334
+ }
335
+ }
336
+ async setLocalStorage(key, value) {
337
+ const stringValue = JSON.stringify(value);
338
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
339
+ await Preferences.set({ key, value: stringValue });
340
+ }
341
+ else {
342
+ localStorage.setItem(key, stringValue);
343
+ }
344
+ }
345
+ async removeLocalStorage(keyName) {
346
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
347
+ await Preferences.remove({ key: keyName });
348
+ }
349
+ else {
350
+ localStorage.removeItem(keyName);
351
+ }
352
+ }
353
+ async removeStorage(key) {
354
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
355
+ await Preferences.remove({ key });
356
+ }
357
+ else {
358
+ sessionStorage.removeItem(key);
359
+ }
360
+ }
361
+ async getLocalStorage(key) {
362
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
363
+ const { value } = await Preferences.get({ key });
364
+ return value ? JSON.parse(value) : null;
365
+ }
366
+ else {
367
+ const value = localStorage.getItem(key);
368
+ if (value === null) {
369
+ return null;
370
+ }
371
+ try {
372
+ return JSON.parse(value);
373
+ }
374
+ catch {
375
+ return value;
376
+ }
377
+ }
378
+ }
379
+ async showAllProjects() {
380
+ await this.removeStorage('selectedProject');
381
+ window.location.reload();
382
+ }
383
+ parseBodyObject(obj) {
384
+ const jsonString = JSON.stringify(obj);
385
+ const replacedString = jsonString.replace(/{{(.*?)}}/g, (match, expression) => {
386
+ try {
387
+ return new Function(`return ${expression.trim()};`).call(this);
388
+ }
389
+ catch (error) {
390
+ console.error(`Error evaluating expression: ${expression}`, error);
391
+ return match;
392
+ }
393
+ });
394
+ return JSON.parse(replacedString);
395
+ }
396
+ getTotalPrice(tableitemInfo) {
397
+ const total = tableitemInfo.data.reduce((total, item) => {
398
+ if (item.quantity && !isNaN(item.quantity)) {
399
+ return total + (item.unitPrice * item.quantity);
400
+ }
401
+ return total;
402
+ }, 0);
403
+ return total.toFixed(2);
404
+ }
405
+ getTotalQuantity(tableitemInfo) {
406
+ let quantity = 0;
407
+ tableitemInfo.data.forEach((cartItem) => {
408
+ if (cartItem.quantity) {
409
+ quantity = cartItem.quantity + quantity;
410
+ }
411
+ });
412
+ return quantity;
413
+ }
414
+ replacePaginationParams(url, currentPage, pageSize) {
415
+ if (url && url.includes('{{pageNumber}}')) {
416
+ url = url.replace(/{{pageNumber}}/g, currentPage.toString());
417
+ }
418
+ if (url && url.includes('{{pageSize}}') && pageSize !== undefined) {
419
+ url = url.replace(/{{pageSize}}/g, pageSize.toString());
420
+ }
421
+ return url;
422
+ }
423
+ customButton(option, propertySchema, projectSeleted, environment) {
424
+ if (option.url) {
425
+ let body = {};
426
+ if (option.propertyKey) {
427
+ body = Object.keys(propertySchema[option.propertyKey]).reduce((acc, key) => {
428
+ acc[key] = propertySchema[option.propertyKey][key]?.value;
429
+ return acc;
430
+ }, {});
431
+ }
432
+ let url = environment?.apiUrl + option.url;
433
+ this.requestService.dynamicCall(option.method, body, url, option.passToken, projectSeleted).subscribe((res) => {
434
+ window.location.reload();
435
+ });
436
+ }
437
+ }
438
+ setDefaultUser(item, userInfo, environment) {
439
+ let schema = item;
440
+ let role = "default";
441
+ if (environment?.login?.type === "keycloak") {
442
+ if (userInfo?.name && item.options?.userRoleMapping) {
443
+ schema = item.options[item.options?.userRoleMapping[role]];
444
+ }
445
+ }
446
+ else if (environment?.login?.type === "jwtToken") {
447
+ if (item.options?.loginResponse && item.options?.loginResponse.storageType == "sessionStorage") {
448
+ if (userInfo) {
449
+ role = userInfo[item.options?.loginResponse.role]?.toLowerCase();
450
+ }
451
+ schema = item.options[item.options?.userRoleMapping[role]];
452
+ }
453
+ }
454
+ return schema;
455
+ }
456
+ setTableData(data, options = {}, tableitemInfo, projectSeleted) {
457
+ if (options?.pagination?.pageSize && options?.pagination?.scrollable) {
458
+ tableitemInfo.pageSize = options?.pagination?.pageSize;
459
+ }
460
+ let records;
461
+ if (options.dataKey) {
462
+ records = data[options.dataKey];
463
+ }
464
+ else if (options.key && data?._embedded) {
465
+ records = data?._embedded[options.key];
466
+ }
467
+ else {
468
+ if (!data?._embedded?.products && !Array.isArray(data)) {
469
+ records = [data];
470
+ }
471
+ else {
472
+ records = data?._embedded?.products;
473
+ }
474
+ }
475
+ tableitemInfo.totalRecords = data?.totalPages ? data?.totalPages : data?.page?.totalElements;
476
+ tableitemInfo.data = records.map((record) => ({
477
+ ...record,
478
+ ...(record.hasOwnProperty('imageUrl') && record.imageUrl
479
+ ? { imageUrl: `${projectSeleted}/Media/` + record.imageUrl.split('/').pop() }
480
+ : {})
481
+ }));
482
+ return tableitemInfo;
483
+ }
484
+ setOktaWebCredential(environment, projectName) {
485
+ return {
486
+ logo: `favicon.ico`,
487
+ baseUrl: environment.login.web.issuer.split('/oauth2')[0],
488
+ clientId: environment.login.web.clientId,
489
+ redirectUri: environment.login.web.redirectUri,
490
+ authParams: {
491
+ pkce: true,
492
+ issuer: environment.login.web.issuer,
493
+ scopes: environment.login.web.scopes
494
+ }
495
+ };
496
+ }
497
+ setOktaMobileCredential(environment) {
498
+ return {
499
+ appId: environment.login.mobile.clientId,
500
+ authorizationBaseUrl: environment.login.mobile.authorizationBaseUrl,
501
+ accessTokenEndpoint: environment.login.mobile.accessTokenEndpoint,
502
+ redirectUrl: environment.login.mobile.redirectUrl,
503
+ scope: environment.login.mobile.scope,
504
+ responseType: environment.login.mobile.responseType,
505
+ pkceEnabled: environment.login.mobile.pkceEnabled
506
+ };
507
+ }
508
+ async setupStripePaymentForm(environment, form, onCardChange) {
509
+ let hasCreditCard = false;
510
+ if (form.layoutSchema?.formSections) {
511
+ form.layoutSchema.formSections.forEach((formSection) => {
512
+ if (formSection.formFields?.length > 0) {
513
+ const foundCreditCard = formSection.formFields.some((formField) => {
514
+ const scopeKey = this.getScope(formField.scope?.reference);
515
+ return form.propertySchema[scopeKey] &&
516
+ form.propertySchema[scopeKey][formField.scope?.reference.split('/').pop()]?.type === 'carditCard';
517
+ });
518
+ if (foundCreditCard) {
519
+ hasCreditCard = true;
520
+ return;
521
+ }
522
+ }
523
+ });
524
+ }
525
+ if (hasCreditCard) {
526
+ this.stripe = await loadStripe(environment.stripePublishableKey);
527
+ const elements = this.stripe.elements();
528
+ const cardElement = elements.create('card', { hidePostalCode: true });
529
+ cardElement.mount('#card-element');
530
+ cardElement.on('change', (event) => {
531
+ if (event.complete) {
532
+ onCardChange('');
533
+ }
534
+ else if (event.error) {
535
+ onCardChange(event.error.message);
536
+ }
537
+ });
538
+ }
539
+ }
540
+ async formData(form, environment, cartInfo) {
541
+ if (form.layoutSchema?.formSections) {
542
+ for (const formSection of form.layoutSchema.formSections) {
543
+ if (formSection.formFields?.length > 0) {
544
+ for (const formField of formSection.formFields) {
545
+ const scope = this.getScope(formField.scope?.reference);
546
+ const fieldKey = formField.scope?.reference.split('/').pop();
547
+ const field = form.propertySchema?.[scope]?.[fieldKey];
548
+ if (!field)
549
+ continue;
550
+ // Checkbox logic with copy action
551
+ if (field.type === 'checkbox' && formField.option?.innerAction?.action === 'copy') {
552
+ const fromSchema = form.propertySchema[formField.option.innerAction.from];
553
+ const toSchema = form.propertySchema[formField.option.innerAction.to];
554
+ const keys = Object.keys(fromSchema);
555
+ keys.forEach((key) => {
556
+ if (toSchema[key]) {
557
+ const sourceValue = fromSchema?.[key]?.value;
558
+ toSchema[key].value = sourceValue || '';
559
+ }
560
+ });
561
+ }
562
+ // Dropdown logic (async data fetching)
563
+ if (field.type === 'dropdown' && formField.option?.data_url) {
564
+ try {
565
+ const res = await lastValueFrom(this.requestService.getInfo(environment.apiUrl + formField.option.data_url));
566
+ const key = Object.keys(res._embedded || {})[0];
567
+ if (key) {
568
+ field.data = res._embedded[key];
569
+ }
570
+ }
571
+ catch (err) {
572
+ console.error('Failed to load dropdown data', err);
573
+ }
574
+ }
575
+ // Cart info logic for string fields
576
+ if (field.type === 'string' && formField?.option?.cartInfo) {
577
+ if (field.value?.toString()?.includes('{{quantity}}')) {
578
+ field.value = cartInfo.quantity;
579
+ }
580
+ else if (field.value?.toString()?.includes('{{totalPrice}}')) {
581
+ field.value = cartInfo.totalPrice;
582
+ }
583
+ }
584
+ }
585
+ }
586
+ }
587
+ }
588
+ }
589
+ // async processData(
590
+ // data: any,
591
+ // options: {
592
+ // dataKey?: string;
593
+ // setImageUrl?: boolean;
594
+ // showTable?: boolean;
595
+ // projectSelected: string;
596
+ // },
597
+ // tenantName: any
598
+ // ): Promise<any[]> {
599
+ // if (options.dataKey) {
600
+ // data = data[options.dataKey];
601
+ // } else {
602
+ // if (!data?._embedded?.products && !Array.isArray(data)) {
603
+ // data = [data];
604
+ // } else {
605
+ // data = data?._embedded?.products;
606
+ // }
607
+ // }
608
+ // const transformed = await Promise.all(
609
+ // data.map(async (record: any) => {
610
+ // let imageUrl = record.imageUrl;
611
+ // const imagePath = `Media/` +
612
+ // record?.imageUrl?.split('/').pop();
613
+ // if (
614
+ // tenantName &&
615
+ // record?.imageUrl &&
616
+ // options.setImageUrl
617
+ // ) {
618
+ // try {
619
+ // imageUrl = "";
620
+ // imageUrl = await this.couchdbService.getFileContentFromCouchDb(
621
+ // `${tenantName}_${options.projectSelected}`,
622
+ // imagePath
623
+ // );
624
+ // } catch (err) {
625
+ // console.warn(`Failed to fetch image from CouchDB for ${imagePath}`, err);
626
+ // imageUrl = '';
627
+ // }
628
+ // }
629
+ // return {
630
+ // ...record,
631
+ // ...(imageUrl ? { imageUrl } : {}),
632
+ // ...(imagePath ? { imagePath } : {}),
633
+ // };
634
+ // })
635
+ // );
636
+ // return transformed;
637
+ // }
638
+ // async setTableDataImages(records: any, tenantName: any, projectSelected: any): Promise<any[]> {
639
+ // const transformed = await Promise.all(
640
+ // records.map(async (record: any) => {
641
+ // let imageUrl = record.imageUrl;
642
+ // const imagePath = record?.imagePath ? record?.imagePath : `Media/` +
643
+ // record?.imageUrl?.split('/').pop();
644
+ // if (
645
+ // tenantName &&
646
+ // record?.imageUrl &&
647
+ // record.hasOwnProperty('imageUrl')
648
+ // ) {
649
+ // try {
650
+ // imageUrl = "";
651
+ // imageUrl = await this.couchdbService.getFileContentFromCouchDb(
652
+ // `${tenantName}_${projectSelected}`,
653
+ // imagePath
654
+ // );
655
+ // } catch (err) {
656
+ // console.warn(`Failed to fetch image from CouchDB for ${imagePath}`, err);
657
+ // imageUrl = '';
658
+ // }
659
+ // }
660
+ // return {
661
+ // ...record,
662
+ // ...(imageUrl ? { imageUrl } : {}),
663
+ // };
664
+ // })
665
+ // );
666
+ // return transformed;
667
+ // }
668
+ // set date in localstorage
669
+ normalizeDatesForStorage(obj) {
670
+ const normalized = {};
671
+ Object.entries(obj).forEach(([key, value]) => {
672
+ if (this.isDateLike(value)) {
673
+ const date = value instanceof Date ? value : new Date(value);
674
+ normalized[key] = this.toLocalISOString(date);
675
+ }
676
+ else {
677
+ normalized[key] = value;
678
+ }
679
+ });
680
+ return normalized;
681
+ }
682
+ isDateLike(value) {
683
+ if (!value)
684
+ return false;
685
+ // Actual Date object
686
+ if (value instanceof Date && !isNaN(value.getTime())) {
687
+ return true;
688
+ }
689
+ // ISO string (UTC or local)
690
+ if (typeof value === 'string') {
691
+ return false;
692
+ }
693
+ return false;
694
+ }
695
+ toLocalISOString(date) {
696
+ const tzOffset = date.getTimezoneOffset() * 60000;
697
+ return new Date(date.getTime() - tzOffset)
698
+ .toISOString()
699
+ .slice(0, 19);
700
+ }
701
+ // restore date Field from localstorage
702
+ restoreDatesFromStorage(records, propertySchema) {
703
+ if (!Array.isArray(records))
704
+ return records;
705
+ if (!propertySchema)
706
+ return records;
707
+ return records.map(record => {
708
+ const restored = { ...record };
709
+ Object.keys(propertySchema).forEach(scopeKey => {
710
+ const schemaGroup = propertySchema[scopeKey];
711
+ if (!schemaGroup)
712
+ return;
713
+ Object.keys(schemaGroup).forEach(fieldKey => {
714
+ const fieldSchema = schemaGroup[fieldKey];
715
+ const value = restored[fieldKey];
716
+ if (!value || typeof value !== 'string')
717
+ return;
718
+ // ✅ DATE or TIME fields only
719
+ if (fieldSchema.type === 'date' || fieldSchema.type === 'time') {
720
+ restored[fieldKey] = this.parseLocalISODate(value);
721
+ }
722
+ });
723
+ });
724
+ return restored;
725
+ });
726
+ }
727
+ parseLocalISODate(value) {
728
+ // Remove Z to avoid UTC shift
729
+ const clean = value.replace('Z', '');
730
+ const [datePart, timePart = '00:00:00.000'] = clean.split('T');
731
+ const [y, m, d] = datePart.split('-').map(Number);
732
+ const [hh = 0, mm = 0, ss = 0, ms = 0] = timePart.split(/[:.]/).map(Number);
733
+ return new Date(y, m - 1, d, hh, mm, ss, ms);
734
+ }
735
+ // savecard conversion
736
+ convertToDailyLogs(cardOrCards) {
737
+ // Normalize input to array
738
+ const cards = Array.isArray(cardOrCards) ? cardOrCards : [cardOrCards];
739
+ const results = [];
740
+ for (const card of cards) {
741
+ const fromDate = new Date(card.fromDate);
742
+ const toDate = new Date(card.toDate);
743
+ const fromTime = new Date(card.workDayTimeFrom);
744
+ const toTime = new Date(card.workDayTimeTo);
745
+ // Normalize dates to midnight
746
+ const startDay = new Date(fromDate);
747
+ startDay.setHours(0, 0, 0, 0);
748
+ const endDay = new Date(toDate);
749
+ endDay.setHours(0, 0, 0, 0);
750
+ let currentDay = new Date(startDay);
751
+ while (currentDay <= endDay) {
752
+ const isFirstDay = this.isSameDay(currentDay, fromDate);
753
+ const isLastDay = this.isSameDay(currentDay, toDate);
754
+ const isSameDay = isFirstDay && isLastDay;
755
+ let workFrom;
756
+ let workTo;
757
+ // SAME DAY
758
+ if (isSameDay) {
759
+ workFrom = this.applyTimeToDay(currentDay, fromTime);
760
+ workTo = this.applyTimeToDay(currentDay, toTime);
761
+ }
762
+ // FIRST DAY
763
+ else if (isFirstDay) {
764
+ workFrom = this.applyTimeToDay(currentDay, fromTime);
765
+ workTo = this.endOfDay(currentDay);
766
+ }
767
+ // LAST DAY
768
+ else if (isLastDay) {
769
+ workFrom = this.startOfDay(currentDay);
770
+ workTo = this.applyTimeToDay(currentDay, toTime);
771
+ }
772
+ // MIDDLE DAY
773
+ else {
774
+ workFrom = this.startOfDay(currentDay);
775
+ workTo = this.endOfDay(currentDay);
776
+ }
777
+ results.push({
778
+ comment: card.comments || "",
779
+ onCallDuty: false,
780
+ timeCredit: false,
781
+ workDay: this.toLocalISO(currentDay, 0, 0),
782
+ workDayTimeFrom: this.toLocalISO(workFrom),
783
+ workDayTimeTo: this.toLocalISO(workTo),
784
+ workOrderNo: card.workOrderNo,
785
+ workType: "A"
786
+ });
787
+ currentDay.setDate(currentDay.getDate() + 1);
788
+ }
789
+ }
790
+ return results;
791
+ }
792
+ applyTimeToDay(day, time) {
793
+ const d = new Date(day);
794
+ d.setHours(time.getHours(), time.getMinutes(), 0, 0);
795
+ return d;
796
+ }
797
+ startOfDay(d) {
798
+ const x = new Date(d);
799
+ x.setHours(0, 0, 0, 0);
800
+ return x;
801
+ }
802
+ endOfDay(d) {
803
+ const x = new Date(d);
804
+ x.setHours(23, 59, 0, 0);
805
+ return x;
806
+ }
807
+ isSameDay(a, b) {
808
+ return (a.getFullYear() === b.getFullYear() &&
809
+ a.getMonth() === b.getMonth() &&
810
+ a.getDate() === b.getDate());
811
+ }
812
+ toLocalISO(date, hour, minute) {
813
+ const d = new Date(date);
814
+ if (hour !== undefined && minute !== undefined) {
815
+ d.setHours(hour, minute, 0, 0);
816
+ }
817
+ const pad = (n) => String(n).padStart(2, '0');
818
+ const year = d.getFullYear();
819
+ const month = pad(d.getMonth() + 1);
820
+ const day = pad(d.getDate());
821
+ const hrs = pad(d.getHours());
822
+ const mins = pad(d.getMinutes());
823
+ const offset = -d.getTimezoneOffset();
824
+ const sign = offset >= 0 ? '+' : '-';
825
+ const offH = pad(Math.floor(Math.abs(offset) / 60));
826
+ const offM = pad(Math.abs(offset) % 60);
827
+ return `${year}-${month}-${day}T${hrs}:${mins}:00${sign}${offH}:${offM}`;
828
+ }
829
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UtilityService, deps: [{ token: i1.Platform }, { token: RequestService }], target: i0.ɵɵFactoryTarget.Injectable });
830
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UtilityService, providedIn: 'root' });
831
+ }
832
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UtilityService, decorators: [{
833
+ type: Injectable,
834
+ args: [{
835
+ providedIn: 'root'
836
+ }]
837
+ }], ctorParameters: () => [{ type: i1.Platform }, { type: RequestService }] });
838
+
839
+ class CardComponent {
840
+ utilityService;
841
+ platform;
842
+ http;
843
+ cdr;
844
+ zone;
845
+ modalService;
846
+ oauthService;
847
+ requestService;
848
+ itemInfo = {};
849
+ currentPage = 0;
850
+ pageSize = 5;
851
+ selectedLanguageInfo = {};
852
+ mobileDisplay = false;
853
+ pages = [];
854
+ cardButtonClick = new EventEmitter();
855
+ cardHeaderButtonClick = new EventEmitter();
856
+ linkDetails = new EventEmitter();
857
+ imageDetails = new EventEmitter();
858
+ onPageSizeChange = new EventEmitter();
859
+ onPageChange = new EventEmitter();
860
+ cardPerRow = "md:col-6 lg:col-";
861
+ isLoading = false;
862
+ layoutSchemaCopy = {};
863
+ headerSchemaCopy = {};
864
+ footerSchemaCopy = {};
865
+ constructor(utilityService, platform, http, cdr, zone, modalService, oauthService, requestService) {
866
+ this.utilityService = utilityService;
867
+ this.platform = platform;
868
+ this.http = http;
869
+ this.cdr = cdr;
870
+ this.zone = zone;
871
+ this.modalService = modalService;
872
+ this.oauthService = oauthService;
873
+ this.requestService = requestService;
874
+ }
875
+ ngOnInit() {
876
+ }
877
+ ngOnChanges(changes) {
878
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
879
+ this.mobileDisplay = true;
880
+ }
881
+ if (changes['itemInfo']) {
882
+ if (this.itemInfo.layoutSchema) {
883
+ this.layoutSchemaCopy = JSON.parse(JSON.stringify(this.itemInfo.layoutSchema));
884
+ }
885
+ if (this.itemInfo.header) {
886
+ this.headerSchemaCopy = JSON.parse(JSON.stringify(this.itemInfo.header));
887
+ }
888
+ if (this.itemInfo.footer) {
889
+ this.footerSchemaCopy = JSON.parse(JSON.stringify(this.itemInfo.footer));
890
+ }
891
+ }
892
+ if ((changes['selectedLanguageInfo'] || this.selectedLanguageInfo) && this.selectedLanguageInfo.selectedLanguage) {
893
+ this.itemInfo.footer = this.updatebuttonLanguage(this.footerSchemaCopy, this.selectedLanguageInfo.selectedLanguage);
894
+ this.itemInfo.header = this.updatebuttonLanguage(this.headerSchemaCopy, this.selectedLanguageInfo.selectedLanguage);
895
+ this.itemInfo.layoutSchema = this.updateLayoutLanguage(this.layoutSchemaCopy, this.selectedLanguageInfo.selectedLanguage);
896
+ }
897
+ }
898
+ safeUpdate(fn) {
899
+ if (NgZone.isInAngularZone()) {
900
+ fn();
901
+ this.cdr.markForCheck();
902
+ }
903
+ else {
904
+ this.zone.run(() => {
905
+ fn();
906
+ this.cdr.markForCheck();
907
+ });
908
+ }
909
+ }
910
+ forceNumericKeyboard(event) {
911
+ const input = event?.target;
912
+ if (input && input.tagName === 'INPUT') {
913
+ input.setAttribute('inputmode', 'numeric'); // Android
914
+ input.setAttribute('pattern', '[0-9:]*'); // iOS
915
+ input.setAttribute('type', 'tel'); // strongest signal
916
+ }
917
+ }
918
+ onDateTyping(event) {
919
+ const input = event.target;
920
+ if (!input)
921
+ return;
922
+ let digits = input.value.replace(/\D/g, '');
923
+ digits = digits.substring(0, 8);
924
+ let formatted = '';
925
+ if (digits.length <= 4) {
926
+ formatted = digits;
927
+ }
928
+ else if (digits.length <= 6) {
929
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4)}`;
930
+ }
931
+ else {
932
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4, 6)}-${digits.slice(6)}`;
933
+ }
934
+ input.value = formatted;
935
+ }
936
+ updatebuttonLanguage(schema, translations) {
937
+ const cloned = JSON.parse(JSON.stringify(schema));
938
+ const walk = (obj) => {
939
+ if (!obj || typeof obj !== 'object')
940
+ return;
941
+ // ✅ Replace direct caption (e.g. button.caption)
942
+ if (typeof obj.caption === 'string') {
943
+ const original = obj.caption;
944
+ obj.caption = translations[original] ?? original;
945
+ }
946
+ // ✅ Replace modalTitle if present
947
+ if (typeof obj.modalTitle === 'string') {
948
+ const original = obj.modalTitle;
949
+ obj.modalTitle = translations[original] ?? original;
950
+ }
951
+ // 🔁 Recurse
952
+ Object.keys(obj).forEach((key) => {
953
+ const value = obj[key];
954
+ if (typeof value === 'object') {
955
+ walk(value);
956
+ }
957
+ });
958
+ };
959
+ walk(cloned);
960
+ return cloned;
961
+ }
962
+ updateLayoutLanguage(schema, translations) {
963
+ // Deep clone to avoid mutating original schema
964
+ const cloned = JSON.parse(JSON.stringify(schema));
965
+ const walk = (obj) => {
966
+ if (!obj || typeof obj !== 'object')
967
+ return;
968
+ // ✅ If label.caption exists → translate it
969
+ if (obj.label && typeof obj.label.caption === 'string') {
970
+ const originalCaption = obj.label.caption;
971
+ obj.label.caption =
972
+ translations[originalCaption] ?? originalCaption;
973
+ }
974
+ // 🔁 Recurse into object properties
975
+ Object.keys(obj).forEach((key) => {
976
+ const value = obj[key];
977
+ if (typeof value === 'object') {
978
+ walk(value);
979
+ }
980
+ });
981
+ };
982
+ walk(cloned);
983
+ return cloned;
984
+ }
985
+ dateChangeEvent(filter, value) {
986
+ const scope = this.getScope(filter.scope.reference);
987
+ const field = filter.scope?.reference.split('/').pop();
988
+ this.itemInfo.propertySchema[scope][field].value = value;
989
+ this.applyDateFilter(this.extractFilterValues(this.itemInfo.propertySchema[scope]));
990
+ }
991
+ async applyDateFilter(filters) {
992
+ const from = filters.fromDateFilter ? new Date(filters.fromDateFilter) : null;
993
+ const to = filters.toDateFilter ? new Date(filters.toDateFilter) : null;
994
+ if (to && from) {
995
+ const formattedFrom = this.formatToOffsetISO(from);
996
+ const formattedTo = this.formatToOffsetISO(to);
997
+ const keycloakInfo = await this.utilityService.getLocalStorage('KeycloakInfo');
998
+ const logined = await this.utilityService.getLocalStorage('loginedUser');
999
+ this.safeUpdate(() => this.isLoading = true);
1000
+ if (this.platform.ANDROID || this.platform.IOS) {
1001
+ let saveOrder = await this.getSaveOrder(keycloakInfo?.token, keycloakInfo, formattedFrom, formattedTo);
1002
+ this.itemInfo.data = saveOrder?.length > 0 ? saveOrder : [];
1003
+ this.safeUpdate(() => this.isLoading = false);
1004
+ }
1005
+ else {
1006
+ this.requestService.getSaveOrder(logined?.token, logined, formattedFrom, formattedTo).subscribe((saveOrders) => {
1007
+ const updatedData = this.utilityService.restoreDatesFromStorage(saveOrders, this.itemInfo.propertySchema);
1008
+ this.itemInfo.data = updatedData?.length > 0 ? updatedData : [];
1009
+ this.safeUpdate(() => this.isLoading = false);
1010
+ });
1011
+ }
1012
+ }
1013
+ }
1014
+ async getSaveOrder(token, userInfo, fromDate, toDate) {
1015
+ if (!token) {
1016
+ return;
1017
+ }
1018
+ const company = userInfo.p5_plant
1019
+ ? `${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant}`
1020
+ : `${userInfo.p5_group}/${userInfo.p5_client}/`;
1021
+ const url = `${userInfo.p5_backend_url}/assetsmobileservice/Zeiterfassung/requestBookedTimeRecording`;
1022
+ try {
1023
+ const response = await CapacitorHttp.post({
1024
+ url,
1025
+ params: {
1026
+ resourceNo: userInfo.p5_resource_no,
1027
+ workDayFrom: fromDate,
1028
+ workDayTo: toDate,
1029
+ company,
1030
+ appVersion: '1',
1031
+ },
1032
+ headers: {
1033
+ Authorization: `Bearer ${token}`, // ✅ REQUIRED
1034
+ Accept: 'application/json',
1035
+ },
1036
+ // ❗ NO BODY needed for this endpoint
1037
+ });
1038
+ console.log('getSaveOrder response:', response.data);
1039
+ return response.data;
1040
+ }
1041
+ catch (error) {
1042
+ console.error('Failed to fetch saved orders', error);
1043
+ throw error;
1044
+ }
1045
+ }
1046
+ formatToOffsetISO(date) {
1047
+ if (!date)
1048
+ return "";
1049
+ const pad = (n, len = 2) => String(n).padStart(len, "0");
1050
+ const year = date.getFullYear();
1051
+ const month = pad(date.getMonth() + 1);
1052
+ const day = pad(date.getDate());
1053
+ const hours = pad(date.getHours());
1054
+ const minutes = pad(date.getMinutes());
1055
+ const seconds = pad(date.getSeconds());
1056
+ const ms = pad(date.getMilliseconds(), 4); // 4-digit milliseconds
1057
+ // timezone offset
1058
+ const offset = -date.getTimezoneOffset(); // in minutes
1059
+ const offSign = offset >= 0 ? "+" : "-";
1060
+ const offHours = pad(Math.floor(Math.abs(offset) / 60));
1061
+ const offMinutes = pad(Math.abs(offset) % 60);
1062
+ return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}:${ms}${offSign}${offHours}:${offMinutes}`;
1063
+ }
1064
+ extractFilterValues(schema) {
1065
+ return Object.keys(schema).reduce((acc, key) => {
1066
+ if (key.includes('Filter') && schema[key]?.value !== undefined) {
1067
+ acc[key] = schema[key].value;
1068
+ }
1069
+ return acc;
1070
+ }, {});
1071
+ }
1072
+ invokeOnPageSizeChange(pageSize) {
1073
+ this.onPageSizeChange.emit(pageSize);
1074
+ }
1075
+ invokeGoToPage(page) {
1076
+ this.onPageChange.emit(page);
1077
+ }
1078
+ invokeOnCardHeader(element) {
1079
+ this.cardHeaderButtonClick.emit(element);
1080
+ }
1081
+ invokeOnCardFooter(element) {
1082
+ // this.cardHeaderButtonClick.emit(element);
1083
+ this.d4_SaveAll();
1084
+ }
1085
+ async invokeButtonClick(layout, record, recordIndex) {
1086
+ if (layout?.option?.action === "delete" && layout?.option?.storageType == "localstorage") {
1087
+ if (layout?.option?.deleteMessage) {
1088
+ this.showConfirm(layout?.option, recordIndex);
1089
+ }
1090
+ }
1091
+ else if (layout?.option?.action === "save" && layout?.option?.storageType === "database") {
1092
+ const final_array = this.utilityService.convertToDailyLogs(record);
1093
+ await this.saveToDb(final_array, recordIndex, layout.option.data_url);
1094
+ }
1095
+ else {
1096
+ this.cardButtonClick.emit({ layout: layout, record: record, recordIndex: recordIndex });
1097
+ }
1098
+ }
1099
+ showConfirm(option, recordIndex) {
1100
+ this.modalService.confirm({
1101
+ nzTitle: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage['Confirm'] ? this.selectedLanguageInfo.selectedLanguage['Confirm'] : 'Confirm',
1102
+ nzContent: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage[option.deleteMessage] ? this.selectedLanguageInfo.selectedLanguage[option.deleteMessage] : option.deleteMessage,
1103
+ nzOkText: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage['Delete'] ? this.selectedLanguageInfo.selectedLanguage['Delete'] : 'Delete',
1104
+ nzCancelText: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage['Cancel'] ? this.selectedLanguageInfo.selectedLanguage['Cancel'] : 'Cancel',
1105
+ nzOnOk: () => this.deleteRecord(recordIndex, option.data_url)
1106
+ });
1107
+ }
1108
+ async d4_SaveAll() {
1109
+ let allOrders = [];
1110
+ for (let i = 0; i < this.itemInfo.data.length; i++) {
1111
+ const element = this.itemInfo.data[i];
1112
+ const dailyLogs = this.utilityService.convertToDailyLogs(element);
1113
+ if (Array.isArray(dailyLogs)) {
1114
+ allOrders.push(...dailyLogs);
1115
+ }
1116
+ }
1117
+ await this.saveToDb(allOrders, null, true);
1118
+ }
1119
+ deleteRecord(recordIndex, data_url) {
1120
+ this.itemInfo.data.splice(recordIndex, 1);
1121
+ this.utilityService.setLocalStorage('timeRecords', JSON.stringify(this.itemInfo.data));
1122
+ }
1123
+ deleteAllRecord() {
1124
+ this.itemInfo.data = [];
1125
+ this.utilityService.setLocalStorage('timeRecords', JSON.stringify(this.itemInfo.data));
1126
+ }
1127
+ async saveToDb(orders, orderIndex, data_url, deleteAll = false) {
1128
+ this.safeUpdate(() => this.isLoading = true);
1129
+ const token = this.oauthService.getAccessToken(); // whatever you have
1130
+ const logined = await this.utilityService.getLocalStorage('loginedUser');
1131
+ const keycloakInfo = await this.utilityService.getLocalStorage('KeycloakInfo');
1132
+ let saveobject = {
1133
+ ressourceNo: logined?.p5_resource_no ? logined.p5_resource_no : keycloakInfo?.p5_resource_no,
1134
+ returnTimeRecordingLine: orders
1135
+ };
1136
+ if (this.platform.ANDROID || this.platform.IOS) {
1137
+ const res = await this.mobileSaveDb(keycloakInfo.token, keycloakInfo, saveobject, orderIndex, data_url, deleteAll);
1138
+ }
1139
+ else {
1140
+ this.webSaveDb(token, logined, saveobject, orderIndex, data_url, deleteAll);
1141
+ }
1142
+ }
1143
+ webSaveDb(token, userInfo, order = {}, orderIndex, dataUrl, deleteAll = false) {
1144
+ if (token) {
1145
+ const headers = new HttpHeaders({
1146
+ 'Authorization': `Bearer ${token}`,
1147
+ 'Accept': 'application/json'
1148
+ });
1149
+ let url2 = `${userInfo.p5_backend_url}/assetsmobileservice/Zeiterfassung/registerTimeRecording?company=${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant ? userInfo.p5_plant : " "}&appVersion=1&resourceNo=${userInfo.p5_resource_no}`;
1150
+ this.http.post(url2, order, { headers }).subscribe({
1151
+ next: res => {
1152
+ this.safeUpdate(() => this.isLoading = false);
1153
+ if (orderIndex && orderIndex > -1) {
1154
+ this.deleteRecord(orderIndex, dataUrl);
1155
+ }
1156
+ else {
1157
+ this.deleteAllRecord();
1158
+ }
1159
+ }
1160
+ });
1161
+ }
1162
+ }
1163
+ async mobileSaveDb(token, userInfo, order = {}, orderIndex, dataUrl, deleteAll = false) {
1164
+ if (!token) {
1165
+ console.log("NO-token", token);
1166
+ return;
1167
+ }
1168
+ const company = userInfo.p5_plant
1169
+ ? `${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant}`
1170
+ : `${userInfo.p5_group}/${userInfo.p5_client}/`;
1171
+ const url = `${userInfo.p5_backend_url}/assetsmobileservice/Zeiterfassung/registerTimeRecording`;
1172
+ try {
1173
+ const response = await CapacitorHttp.post({
1174
+ url,
1175
+ params: {
1176
+ company,
1177
+ appVersion: '1',
1178
+ resourceNo: userInfo.p5_resource_no,
1179
+ },
1180
+ headers: {
1181
+ Authorization: `Bearer ${token}`,
1182
+ Accept: 'application/json',
1183
+ 'Content-Type': 'application/json',
1184
+ },
1185
+ data: order,
1186
+ });
1187
+ if (orderIndex != null && orderIndex > -1) {
1188
+ this.deleteRecord(orderIndex, dataUrl);
1189
+ }
1190
+ else {
1191
+ this.deleteAllRecord();
1192
+ }
1193
+ this.safeUpdate(() => this.isLoading = false);
1194
+ return response.data;
1195
+ }
1196
+ catch (error) {
1197
+ this.safeUpdate(() => this.isLoading = false);
1198
+ console.error('Failed to save time recording', error);
1199
+ throw error;
1200
+ }
1201
+ }
1202
+ showLinkDetails(option, record) {
1203
+ this.linkDetails.emit({ option: option, record: record });
1204
+ }
1205
+ showImageDetails(option, record) {
1206
+ this.imageDetails.emit({ option: option, record: record });
1207
+ }
1208
+ getProperty(scope) {
1209
+ const property = scope ? scope.split('/').pop() : '';
1210
+ return { key: property, productSchema: this.itemInfo.propertySchema[this.getScope(scope)][property] };
1211
+ }
1212
+ getStyleWithoutClasses(styleObject) {
1213
+ if (!styleObject) {
1214
+ return { classes: '', style: {} };
1215
+ }
1216
+ const { classes, ...styleWithoutClasses } = styleObject;
1217
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1218
+ }
1219
+ getScope(scope) {
1220
+ let propertyScope = "";
1221
+ let start = scope?.indexOf("#/") + 2;
1222
+ let end = scope?.indexOf("/", start);
1223
+ if (start && end) {
1224
+ propertyScope = scope.substring(start, end);
1225
+ }
1226
+ return propertyScope;
1227
+ }
1228
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CardComponent, deps: [{ token: UtilityService }, { token: i1.Platform }, { token: i1$1.HttpClient }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i4.NzModalService }, { token: i5$1.OAuthService }, { token: RequestService }], target: i0.ɵɵFactoryTarget.Component });
1229
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: CardComponent, isStandalone: true, selector: "vl-card", inputs: { itemInfo: "itemInfo", currentPage: "currentPage", pageSize: "pageSize", selectedLanguageInfo: "selectedLanguageInfo", mobileDisplay: "mobileDisplay", pages: "pages" }, outputs: { cardButtonClick: "cardButtonClick", cardHeaderButtonClick: "cardHeaderButtonClick", linkDetails: "linkDetails", imageDetails: "imageDetails", onPageSizeChange: "onPageSizeChange", onPageChange: "onPageChange" }, usesOnChanges: true, ngImport: i0, template: "<!-- Loader Spinner -->\r\n<div *ngIf=\"isLoading\" class=\"loader-overlay\">\r\n <div class=\"spinner\"></div>\r\n</div>\r\n<span *ngIf=\"this.selectedLanguageInfo?.selectedLanguage\">\r\n <!-- top pagination on card -->\r\n <div *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize && itemInfo?.layoutSchema?.pagination?.top\">\r\n <vl-pagination [itemInfo]=\"itemInfo\" [pageSize]=\"pageSize\" [currentPage]=\"currentPage\" [pages]=\"pages\"\r\n (pageSizeChange)=\"invokeOnPageSizeChange($event)\" (onGoToPage)=\"invokeGoToPage($event)\">\r\n </vl-pagination>\r\n </div>\r\n <div *ngIf=\"itemInfo?.header?.elements\" [style]=\"getStyleWithoutClasses(itemInfo?.header?.style).style\"\r\n [class]=\"getStyleWithoutClasses(itemInfo?.header?.style).classes\">\r\n <span *ngFor=\"let element of itemInfo.header?.elements; let c = index\">\r\n <ng-container\r\n [ngSwitch]=\"element.scope?.reference && itemInfo.propertySchema[getScope(element.scope?.reference)] ? itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n\r\n <!-- String Control -->\r\n <div *ngSwitchCase=\"'string'\" [class]=\"element.option?.visible ? 'card-field-wrapper' : 'hidden'\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"element.label?.caption\" [style]=\"getStyleWithoutClasses(element.label?.style).style\"\r\n [class]=\"element.label?.style?.classes?.[0]\">\r\n {{ element.label.caption }}\r\n </span>\r\n </div>\r\n\r\n <!-- Date control -->\r\n <div *ngSwitchCase=\"'date'\" class=\"mb-3\">\r\n <span *ngIf=\"element.option.protected\" [style]=\"getStyleWithoutClasses(element?.label?.style).style\"\r\n [class]=\"element?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"element\" [modalItemInfo]=\"itemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!element.option.protected\"\r\n [class]=\"element?.layout == 'horizontal' ? 'horizontal-layout' : ''\"\r\n [ngClass]=\"element?.style?.classes[0]\" [style]=\"getStyleWithoutClasses(element?.style).style\">\r\n <label [style]=\"getStyleWithoutClasses(element?.label?.style).style\"\r\n [class]=\"element?.label?.style?.classes[0]\">{{ element.label?.value\r\n ?\r\n element.label?.value : element.label?.caption ?\r\n element.label?.caption :\r\n itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <p-datepicker (ngModelChange)=\"dateChangeEvent(element, $event)\" [showIcon]=\"true\" type=\"number\"\r\n inputmode=\"numeric\"\r\n [dateFormat]=\"itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.format ? itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()].format : 'yy-mm-dd'\"\r\n [(ngModel)]=\"itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()].value\"\r\n (onFocus)=\"forceNumericKeyboard($event)\" (onInput)=\"onDateTyping($event)\"\r\n [class]=\"element?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(element?.scope?.style).style\">\r\n </p-datepicker>\r\n </div>\r\n </div>\r\n\r\n <!-- Button Control -->\r\n <div *ngSwitchCase=\"'default'\" [class]=\"element.option?.visible ? 'row' : 'hidden'\"\r\n (click)=\"invokeOnCardHeader(element)\">\r\n <button nz-button [style]=\"getStyleWithoutClasses(element.style).style\"\r\n [class]=\"element.option.protected ? 'disabled-button' : getStyleWithoutClasses(element.style).classes\">\r\n <ng-container *ngIf=\"!element.caption; else textContent\">\r\n <i nz-icon [nzType]=\"element.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ element.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </span>\r\n </div>\r\n <div [class]=\"itemInfo.class\" [style]=\"itemInfo.style\">\r\n <div *ngFor=\"let record of itemInfo.data; let k = index\"\r\n [ngClass]=\"mobileDisplay ? '' : itemInfo.layoutSchema.pagination ? cardPerRow + itemInfo.layoutSchema?.stylePerCard?.elementPerRow[k % itemInfo.layoutSchema?.stylePerCard?.elementPerRow.length] : ''\">\r\n <div [class]=\"itemInfo.layoutSchema?.stylePerCard?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(itemInfo.layoutSchema?.stylePerCard).style\">\r\n <div *ngFor=\"let layout of itemInfo.layoutSchema.cards\">\r\n <ng-container\r\n [ngSwitch]=\"layout?.scope?.reference && itemInfo.propertySchema[getScope(layout.scope?.reference)] ? itemInfo.propertySchema[getScope(layout.scope?.reference)][layout.scope?.reference.split('/').pop()]?.type : layout?.type == 'HorizontalLayout' ? 'HorizontalLayout' : 'default'\">\r\n <!-- Image Control -->\r\n <div *ngSwitchCase=\"'image'\" [class]=\"layout.option?.visible ? 'row' : 'hidden'\">\r\n <img [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\"\r\n [src]=\"layout?.option?.src ? layout?.option?.src : record[layout.scope?.reference.split('/').pop()]\"\r\n alt=\"{{ layout.label ? layout.label : getProperty(layout.scope?.reference).productSchema.caption }}\"\r\n (click)=\"showImageDetails(layout.option, record)\" />\r\n </div>\r\n\r\n <!-- String Control -->\r\n <div *ngSwitchCase=\"'string'\" [class]=\"layout.option?.visible ? 'card-field-wrapper' : 'hidden'\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"layout?.label?.caption\" [class]=\"layout.label?.style?.classes?.[0]\">\r\n {{ layout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <p *ngIf=\"layout.option?.protected && layout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n (click)=\"showLinkDetails(layout.option, record)\">\r\n {{\r\n record?.[layout.scope?.reference.split('/').pop()]\r\n ?? itemInfo.propertySchema[\r\n getScope(layout.scope?.reference)\r\n ]?.[layout.scope?.reference.split('/').pop()]?.default\r\n ?? '--'\r\n }}\r\n </p>\r\n </div>\r\n\r\n <!-- Date Control -->\r\n <div *ngSwitchCase=\"'date'\" [class]=\"layout.option?.visible ? 'card-field-wrapper' : 'hidden'\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"layout?.label?.caption\" [class]=\"layout.label?.style?.classes?.[0]\">\r\n {{ layout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <p *ngIf=\"layout.option?.protected && layout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n (click)=\"showLinkDetails(layout.option, record)\">\r\n {{\r\n record?.[layout.scope?.reference.split('/').pop()]\r\n ?? itemInfo.propertySchema[\r\n getScope(layout.scope?.reference)\r\n ]?.[layout.scope?.reference.split('/').pop()]?.default\r\n ?? '--'\r\n }}\r\n </p>\r\n </div>\r\n\r\n <!-- Time Control -->\r\n <div *ngSwitchCase=\"'time'\" [class]=\"layout.option?.visible ? 'card-field-wrapper' : 'hidden'\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"layout?.label?.caption\" [class]=\"layout.label?.style?.classes?.[0]\">\r\n {{ layout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <p *ngIf=\"layout.option?.protected && layout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n (click)=\"showLinkDetails(layout.option, record)\">\r\n {{\r\n record?.[layout.scope?.reference.split('/').pop()]\r\n ?? itemInfo.propertySchema[\r\n getScope(layout.scope?.reference)\r\n ]?.[layout.scope?.reference.split('/').pop()]?.default\r\n ?? '--'\r\n }}\r\n </p>\r\n </div>\r\n\r\n <!-- number Control -->\r\n <div *ngSwitchCase=\"'number'\" [class]=\"layout.option?.visible ? 'row' : 'hidden'\">\r\n <h3 *ngIf=\"itemInfo.propertySchema[getScope(layout.scope?.reference)] && itemInfo.propertySchema[getScope(layout.scope?.reference)][layout.scope?.reference.split('/').pop()]?.format.currency\"\r\n [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\">\r\n {{ record[layout.scope?.reference.split('/').pop()] | currency: layout.option?.currency\r\n ?\r\n layout.option.currency\r\n :\r\n 'USD' }}\r\n </h3>\r\n </div>\r\n\r\n <!-- Button Control -->\r\n <div *ngSwitchCase=\"'default'\" [class]=\"layout.option?.visible ? 'row' : 'hidden'\">\r\n <button [style]=\"getStyleWithoutClasses(layout?.style).style\"\r\n [class]=\"layout.option.protected ? 'disabled-button' : getStyleWithoutClasses(layout?.style).classes\"\r\n (click)=\"invokeButtonClick(layout, record, k)\">\r\n <ng-container *ngIf=\"!layout.caption; else textContent\">\r\n <i nz-icon [nzType]=\"layout.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ layout.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n\r\n <!-- HorizontalLayout Control -->\r\n <div *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div [class]=\"getStyleWithoutClasses(layout?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(layout?.style).style\">\r\n <ng-container *ngFor=\"let innerLayout of layout.elements\">\r\n <ng-container\r\n [ngSwitch]=\"innerLayout.scope?.reference && itemInfo.propertySchema[getScope(innerLayout.scope?.reference)] ? itemInfo.propertySchema[getScope(innerLayout.scope?.reference)][innerLayout.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n <!-- Image Control -->\r\n <div *ngSwitchCase=\"'image'\"\r\n [class]=\"innerLayout.option?.visible ? 'row' : 'hidden'\">\r\n <img [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\"\r\n [src]=\"innerLayout?.option?.src ? innerLayout?.option?.src : record[innerLayout.scope?.reference.split('/').pop()]\"\r\n alt=\"{{ innerLayout.label ? innerLayout.label : getProperty(innerLayout.scope?.reference).productSchema.caption }}\"\r\n (click)=\"showImageDetails(innerLayout.option, record)\" />\r\n </div>\r\n\r\n <!-- String Control -->\r\n <div *ngSwitchCase=\"'string'\"\r\n [class]=\"innerLayout.option?.visible ? 'card-field-wrapper' : 'hidden'\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"innerLayout.label?.caption\"\r\n [style]=\"getStyleWithoutClasses(innerLayout.label?.style).style\"\r\n [class]=\"innerLayout.label?.style?.classes?.[0]\">\r\n {{ innerLayout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <h3 *ngIf=\"innerLayout.option?.protected && innerLayout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\"\r\n (click)=\"showLinkDetails(innerLayout.option, record)\">\r\n\r\n <!-- DATE FORMAT -->\r\n <ng-container *ngIf=\"innerLayout.option?.dateFormat; else checkTime\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.dateFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n\r\n <!-- TIME FORMAT -->\r\n <ng-template #checkTime>\r\n <ng-container\r\n *ngIf=\"innerLayout.option?.timeFormat; else normalValue\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.timeFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- NORMAL STRING -->\r\n <ng-template #normalValue>\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ?? '--'\r\n }}\r\n </ng-template>\r\n\r\n </h3>\r\n </div>\r\n\r\n <!-- number Control -->\r\n <div *ngSwitchCase=\"'number'\"\r\n [class]=\"innerLayout.option?.visible ? 'row' : 'hidden'\">\r\n <h3 *ngIf=\"itemInfo.propertySchema[getScope(innerLayout.scope?.reference)] &&itemInfo.propertySchema[getScope(innerLayout.scope?.reference)][innerLayout.scope?.reference.split('/').pop()]?.format.currency\"\r\n [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\">\r\n {{ record[innerLayout.scope?.reference.split('/').pop()] | currency:\r\n innerLayout.option?.currency ?\r\n innerLayout.option.currency\r\n :\r\n 'USD' }}\r\n </h3>\r\n </div>\r\n\r\n <!-- Date Control -->\r\n <div *ngSwitchCase=\"'date'\"\r\n [class]=\"innerLayout.option?.visible ? 'card-field-wrapper' : 'hidden'\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"innerLayout.label?.caption\"\r\n [style]=\"getStyleWithoutClasses(innerLayout.label?.style).style\"\r\n [class]=\"innerLayout.label?.style?.classes?.[0]\">\r\n {{ innerLayout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <h3 *ngIf=\"innerLayout.option?.protected && innerLayout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\"\r\n (click)=\"showLinkDetails(innerLayout.option, record)\">\r\n\r\n <!-- DATE FORMAT -->\r\n <ng-container *ngIf=\"innerLayout.option?.dateFormat; else checkTime\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.dateFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n\r\n <!-- TIME FORMAT -->\r\n <ng-template #checkTime>\r\n <ng-container\r\n *ngIf=\"innerLayout.option?.timeFormat; else normalValue\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.timeFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- NORMAL STRING -->\r\n <ng-template #normalValue>\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ?? '--'\r\n }}\r\n </ng-template>\r\n\r\n </h3>\r\n </div>\r\n\r\n <!-- Time Control -->\r\n <div *ngSwitchCase=\"'time'\"\r\n [class]=\"innerLayout.option?.visible ? 'card-field-wrapper' : 'hidden'\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"innerLayout.label?.caption\"\r\n [style]=\"getStyleWithoutClasses(innerLayout.label?.style).style\"\r\n [class]=\"innerLayout.label?.style?.classes?.[0]\">\r\n {{ innerLayout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <h3 *ngIf=\"innerLayout.option?.protected && innerLayout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\"\r\n (click)=\"showLinkDetails(innerLayout.option, record)\">\r\n\r\n <!-- DATE FORMAT -->\r\n <ng-container *ngIf=\"innerLayout.option?.dateFormat; else checkTime\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.dateFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n\r\n <!-- TIME FORMAT -->\r\n <ng-template #checkTime>\r\n <ng-container\r\n *ngIf=\"innerLayout.option?.timeFormat; else normalValue\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.timeFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- NORMAL STRING -->\r\n <ng-template #normalValue>\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ?? '--'\r\n }}\r\n </ng-template>\r\n\r\n </h3>\r\n </div>\r\n\r\n <!-- Button Control -->\r\n <div *ngSwitchCase=\"'default'\">\r\n <button nz-button [style]=\"getStyleWithoutClasses(innerLayout?.style).style\"\r\n [class]=\"innerLayout.option?.visible ? innerLayout.option.protected ? 'disabled-button' : getStyleWithoutClasses(innerLayout?.style).classes : 'hidden'\"\r\n (click)=\"invokeButtonClick(innerLayout, record, k)\">\r\n <ng-container *ngIf=\"!innerLayout.caption; else textContent\">\r\n <i nz-icon [nzType]=\"innerLayout.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ innerLayout.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"itemInfo?.footer?.elements && itemInfo?.data && itemInfo?.data.length\"\r\n [class]=\"getStyleWithoutClasses(itemInfo?.footer?.style).classes\">\r\n <span *ngFor=\"let element of itemInfo.footer?.elements; let c = index\">\r\n <ng-container\r\n [ngSwitch]=\"element.scope?.reference && itemInfo.propertySchema[getScope(element.scope?.reference)] ? itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n\r\n <!-- Date control -->\r\n <div *ngSwitchCase=\"'date'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"element.option.protected\" [style]=\"getStyleWithoutClasses(element?.label?.style).style\"\r\n [class]=\"element?.label?.style?.classes[0]\">\r\n <h5>{{\r\n itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n </h5>\r\n </span>\r\n <div *ngIf=\"!element.option.protected\">\r\n <div [class]=\"element?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(element?.label?.style).style\"\r\n [class]=\"element?.label?.style?.classes[0]\">{{ element.label?.value\r\n ?\r\n element.label?.value : element.label?.caption ?\r\n element.label?.caption :\r\n itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n\r\n <nz-date-picker [required]=\"element.option.required\" [name]=\"element.scope?.reference\"\r\n [nzDisabled]=\"element?.option?.disabled\"\r\n (ngModelChange)=\"dateChangeEvent(element, $event)\"\r\n [nzFormat]=\"itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.format ? itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.format : 'yyyy-MM-dd'\"\r\n [(ngModel)]=\"itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()].value\"\r\n [style]=\"getStyleWithoutClasses(element?.style).style\"></nz-date-picker>\r\n </div>\r\n\r\n </div>\r\n </div>\r\n\r\n <!-- Button Control -->\r\n <div *ngSwitchCase=\"'default'\" [class]=\"element.option?.visible ? 'row' : 'hidden'\"\r\n (click)=\"invokeOnCardFooter(element)\">\r\n <button nz-button [style]=\"getStyleWithoutClasses(element.style).style\"\r\n [class]=\"element.option.protected ? 'disabled-button' : getStyleWithoutClasses(element.style).classes\">\r\n <ng-container *ngIf=\"!element.caption; else textContent\">\r\n <i nz-icon [nzType]=\"element.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ element.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </span>\r\n </div>\r\n <!-- bottom pagination on card -->\r\n <div *ngIf=\"itemInfo?.layoutSchema?.pagination && itemInfo?.layoutSchema?.pagination?.bottom\">\r\n <vl-pagination [itemInfo]=\"itemInfo\" [pageSize]=\"pageSize\" [currentPage]=\"currentPage\" [pages]=\"pages\"\r\n (pageSizeChange)=\"invokeOnPageSizeChange($event)\" (onGoToPage)=\"invokeGoToPage($event)\">\r\n </vl-pagination>\r\n </div>\r\n</span>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i9.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i10.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "styleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo", "motionOptions"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: NzButtonModule }, { kind: "component", type: i11.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i12.ɵNzTransitionPatchDirective, selector: "[nz-button], [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "directive", type: i13.NzWaveDirective, selector: "[nz-wave],button[nz-button]:not([nzType=\"link\"]):not([nzType=\"text\"])", inputs: ["nzWaveExtraNode"], exportAs: ["nzWave"] }, { kind: "ngmodule", type: NzDatePickerModule }, { kind: "component", type: i5$2.NzDatePickerComponent, selector: "nz-date-picker,nz-week-picker,nz-month-picker,nz-quarter-picker,nz-year-picker,nz-range-picker", inputs: ["nzInline", "nzAllowClear", "nzAutoFocus", "nzDisabled", "nzInputReadOnly", "nzOpen", "nzDisabledDate", "nzLocale", "nzPlaceHolder", "nzPopupStyle", "nzDropdownClassName", "nzSize", "nzStatus", "nzFormat", "nzVariant", "nzDateRender", "nzDisabledTime", "nzRenderExtraFooter", "nzShowToday", "nzMode", "nzShowNow", "nzRanges", "nzDefaultPickerValue", "nzSeparator", "nzSuffixIcon", "nzBackdrop", "nzId", "nzPlacement", "nzShowWeekNumber", "nzShowTime"], outputs: ["nzOnPanelChange", "nzOnCalendarChange", "nzOnOk", "nzOnOpenChange"], exportAs: ["nzDatePicker"] }, { kind: "ngmodule", type: NzModalModule }, { kind: "component", type:
1230
+ // StringComponent,
1231
+ PaginationComponent, selector: "vl-pagination", inputs: ["itemInfo", "pageSize", "currentPage", "pages"], outputs: ["pageSizeChange", "onGoToPage"] }, { kind: "component", type: String$1, selector: "vl-string", inputs: ["formField", "modalItemInfo"] }, { kind: "pipe", type: i5.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i5.DatePipe, name: "date" }] });
1232
+ }
1233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CardComponent, decorators: [{
1234
+ type: Component,
1235
+ args: [{ selector: 'vl-card', imports: [
1236
+ CommonModule,
1237
+ FormsModule,
1238
+ NzIconModule,
1239
+ DatePickerModule,
1240
+ NzButtonModule,
1241
+ NzDatePickerModule,
1242
+ NzModalModule,
1243
+ // StringComponent,
1244
+ PaginationComponent,
1245
+ String$1
1246
+ ], standalone: true, template: "<!-- Loader Spinner -->\r\n<div *ngIf=\"isLoading\" class=\"loader-overlay\">\r\n <div class=\"spinner\"></div>\r\n</div>\r\n<span *ngIf=\"this.selectedLanguageInfo?.selectedLanguage\">\r\n <!-- top pagination on card -->\r\n <div *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize && itemInfo?.layoutSchema?.pagination?.top\">\r\n <vl-pagination [itemInfo]=\"itemInfo\" [pageSize]=\"pageSize\" [currentPage]=\"currentPage\" [pages]=\"pages\"\r\n (pageSizeChange)=\"invokeOnPageSizeChange($event)\" (onGoToPage)=\"invokeGoToPage($event)\">\r\n </vl-pagination>\r\n </div>\r\n <div *ngIf=\"itemInfo?.header?.elements\" [style]=\"getStyleWithoutClasses(itemInfo?.header?.style).style\"\r\n [class]=\"getStyleWithoutClasses(itemInfo?.header?.style).classes\">\r\n <span *ngFor=\"let element of itemInfo.header?.elements; let c = index\">\r\n <ng-container\r\n [ngSwitch]=\"element.scope?.reference && itemInfo.propertySchema[getScope(element.scope?.reference)] ? itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n\r\n <!-- String Control -->\r\n <div *ngSwitchCase=\"'string'\" [class]=\"element.option?.visible ? 'card-field-wrapper' : 'hidden'\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"element.label?.caption\" [style]=\"getStyleWithoutClasses(element.label?.style).style\"\r\n [class]=\"element.label?.style?.classes?.[0]\">\r\n {{ element.label.caption }}\r\n </span>\r\n </div>\r\n\r\n <!-- Date control -->\r\n <div *ngSwitchCase=\"'date'\" class=\"mb-3\">\r\n <span *ngIf=\"element.option.protected\" [style]=\"getStyleWithoutClasses(element?.label?.style).style\"\r\n [class]=\"element?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"element\" [modalItemInfo]=\"itemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!element.option.protected\"\r\n [class]=\"element?.layout == 'horizontal' ? 'horizontal-layout' : ''\"\r\n [ngClass]=\"element?.style?.classes[0]\" [style]=\"getStyleWithoutClasses(element?.style).style\">\r\n <label [style]=\"getStyleWithoutClasses(element?.label?.style).style\"\r\n [class]=\"element?.label?.style?.classes[0]\">{{ element.label?.value\r\n ?\r\n element.label?.value : element.label?.caption ?\r\n element.label?.caption :\r\n itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <p-datepicker (ngModelChange)=\"dateChangeEvent(element, $event)\" [showIcon]=\"true\" type=\"number\"\r\n inputmode=\"numeric\"\r\n [dateFormat]=\"itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.format ? itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()].format : 'yy-mm-dd'\"\r\n [(ngModel)]=\"itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()].value\"\r\n (onFocus)=\"forceNumericKeyboard($event)\" (onInput)=\"onDateTyping($event)\"\r\n [class]=\"element?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(element?.scope?.style).style\">\r\n </p-datepicker>\r\n </div>\r\n </div>\r\n\r\n <!-- Button Control -->\r\n <div *ngSwitchCase=\"'default'\" [class]=\"element.option?.visible ? 'row' : 'hidden'\"\r\n (click)=\"invokeOnCardHeader(element)\">\r\n <button nz-button [style]=\"getStyleWithoutClasses(element.style).style\"\r\n [class]=\"element.option.protected ? 'disabled-button' : getStyleWithoutClasses(element.style).classes\">\r\n <ng-container *ngIf=\"!element.caption; else textContent\">\r\n <i nz-icon [nzType]=\"element.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ element.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </span>\r\n </div>\r\n <div [class]=\"itemInfo.class\" [style]=\"itemInfo.style\">\r\n <div *ngFor=\"let record of itemInfo.data; let k = index\"\r\n [ngClass]=\"mobileDisplay ? '' : itemInfo.layoutSchema.pagination ? cardPerRow + itemInfo.layoutSchema?.stylePerCard?.elementPerRow[k % itemInfo.layoutSchema?.stylePerCard?.elementPerRow.length] : ''\">\r\n <div [class]=\"itemInfo.layoutSchema?.stylePerCard?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(itemInfo.layoutSchema?.stylePerCard).style\">\r\n <div *ngFor=\"let layout of itemInfo.layoutSchema.cards\">\r\n <ng-container\r\n [ngSwitch]=\"layout?.scope?.reference && itemInfo.propertySchema[getScope(layout.scope?.reference)] ? itemInfo.propertySchema[getScope(layout.scope?.reference)][layout.scope?.reference.split('/').pop()]?.type : layout?.type == 'HorizontalLayout' ? 'HorizontalLayout' : 'default'\">\r\n <!-- Image Control -->\r\n <div *ngSwitchCase=\"'image'\" [class]=\"layout.option?.visible ? 'row' : 'hidden'\">\r\n <img [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\"\r\n [src]=\"layout?.option?.src ? layout?.option?.src : record[layout.scope?.reference.split('/').pop()]\"\r\n alt=\"{{ layout.label ? layout.label : getProperty(layout.scope?.reference).productSchema.caption }}\"\r\n (click)=\"showImageDetails(layout.option, record)\" />\r\n </div>\r\n\r\n <!-- String Control -->\r\n <div *ngSwitchCase=\"'string'\" [class]=\"layout.option?.visible ? 'card-field-wrapper' : 'hidden'\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"layout?.label?.caption\" [class]=\"layout.label?.style?.classes?.[0]\">\r\n {{ layout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <p *ngIf=\"layout.option?.protected && layout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n (click)=\"showLinkDetails(layout.option, record)\">\r\n {{\r\n record?.[layout.scope?.reference.split('/').pop()]\r\n ?? itemInfo.propertySchema[\r\n getScope(layout.scope?.reference)\r\n ]?.[layout.scope?.reference.split('/').pop()]?.default\r\n ?? '--'\r\n }}\r\n </p>\r\n </div>\r\n\r\n <!-- Date Control -->\r\n <div *ngSwitchCase=\"'date'\" [class]=\"layout.option?.visible ? 'card-field-wrapper' : 'hidden'\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"layout?.label?.caption\" [class]=\"layout.label?.style?.classes?.[0]\">\r\n {{ layout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <p *ngIf=\"layout.option?.protected && layout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n (click)=\"showLinkDetails(layout.option, record)\">\r\n {{\r\n record?.[layout.scope?.reference.split('/').pop()]\r\n ?? itemInfo.propertySchema[\r\n getScope(layout.scope?.reference)\r\n ]?.[layout.scope?.reference.split('/').pop()]?.default\r\n ?? '--'\r\n }}\r\n </p>\r\n </div>\r\n\r\n <!-- Time Control -->\r\n <div *ngSwitchCase=\"'time'\" [class]=\"layout.option?.visible ? 'card-field-wrapper' : 'hidden'\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"layout?.label?.caption\" [class]=\"layout.label?.style?.classes?.[0]\">\r\n {{ layout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <p *ngIf=\"layout.option?.protected && layout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n (click)=\"showLinkDetails(layout.option, record)\">\r\n {{\r\n record?.[layout.scope?.reference.split('/').pop()]\r\n ?? itemInfo.propertySchema[\r\n getScope(layout.scope?.reference)\r\n ]?.[layout.scope?.reference.split('/').pop()]?.default\r\n ?? '--'\r\n }}\r\n </p>\r\n </div>\r\n\r\n <!-- number Control -->\r\n <div *ngSwitchCase=\"'number'\" [class]=\"layout.option?.visible ? 'row' : 'hidden'\">\r\n <h3 *ngIf=\"itemInfo.propertySchema[getScope(layout.scope?.reference)] && itemInfo.propertySchema[getScope(layout.scope?.reference)][layout.scope?.reference.split('/').pop()]?.format.currency\"\r\n [class]=\"getStyleWithoutClasses(layout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(layout?.scope?.style).style\">\r\n {{ record[layout.scope?.reference.split('/').pop()] | currency: layout.option?.currency\r\n ?\r\n layout.option.currency\r\n :\r\n 'USD' }}\r\n </h3>\r\n </div>\r\n\r\n <!-- Button Control -->\r\n <div *ngSwitchCase=\"'default'\" [class]=\"layout.option?.visible ? 'row' : 'hidden'\">\r\n <button [style]=\"getStyleWithoutClasses(layout?.style).style\"\r\n [class]=\"layout.option.protected ? 'disabled-button' : getStyleWithoutClasses(layout?.style).classes\"\r\n (click)=\"invokeButtonClick(layout, record, k)\">\r\n <ng-container *ngIf=\"!layout.caption; else textContent\">\r\n <i nz-icon [nzType]=\"layout.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ layout.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n\r\n <!-- HorizontalLayout Control -->\r\n <div *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div [class]=\"getStyleWithoutClasses(layout?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(layout?.style).style\">\r\n <ng-container *ngFor=\"let innerLayout of layout.elements\">\r\n <ng-container\r\n [ngSwitch]=\"innerLayout.scope?.reference && itemInfo.propertySchema[getScope(innerLayout.scope?.reference)] ? itemInfo.propertySchema[getScope(innerLayout.scope?.reference)][innerLayout.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n <!-- Image Control -->\r\n <div *ngSwitchCase=\"'image'\"\r\n [class]=\"innerLayout.option?.visible ? 'row' : 'hidden'\">\r\n <img [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\"\r\n [src]=\"innerLayout?.option?.src ? innerLayout?.option?.src : record[innerLayout.scope?.reference.split('/').pop()]\"\r\n alt=\"{{ innerLayout.label ? innerLayout.label : getProperty(innerLayout.scope?.reference).productSchema.caption }}\"\r\n (click)=\"showImageDetails(innerLayout.option, record)\" />\r\n </div>\r\n\r\n <!-- String Control -->\r\n <div *ngSwitchCase=\"'string'\"\r\n [class]=\"innerLayout.option?.visible ? 'card-field-wrapper' : 'hidden'\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"innerLayout.label?.caption\"\r\n [style]=\"getStyleWithoutClasses(innerLayout.label?.style).style\"\r\n [class]=\"innerLayout.label?.style?.classes?.[0]\">\r\n {{ innerLayout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <h3 *ngIf=\"innerLayout.option?.protected && innerLayout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\"\r\n (click)=\"showLinkDetails(innerLayout.option, record)\">\r\n\r\n <!-- DATE FORMAT -->\r\n <ng-container *ngIf=\"innerLayout.option?.dateFormat; else checkTime\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.dateFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n\r\n <!-- TIME FORMAT -->\r\n <ng-template #checkTime>\r\n <ng-container\r\n *ngIf=\"innerLayout.option?.timeFormat; else normalValue\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.timeFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- NORMAL STRING -->\r\n <ng-template #normalValue>\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ?? '--'\r\n }}\r\n </ng-template>\r\n\r\n </h3>\r\n </div>\r\n\r\n <!-- number Control -->\r\n <div *ngSwitchCase=\"'number'\"\r\n [class]=\"innerLayout.option?.visible ? 'row' : 'hidden'\">\r\n <h3 *ngIf=\"itemInfo.propertySchema[getScope(innerLayout.scope?.reference)] &&itemInfo.propertySchema[getScope(innerLayout.scope?.reference)][innerLayout.scope?.reference.split('/').pop()]?.format.currency\"\r\n [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\">\r\n {{ record[innerLayout.scope?.reference.split('/').pop()] | currency:\r\n innerLayout.option?.currency ?\r\n innerLayout.option.currency\r\n :\r\n 'USD' }}\r\n </h3>\r\n </div>\r\n\r\n <!-- Date Control -->\r\n <div *ngSwitchCase=\"'date'\"\r\n [class]=\"innerLayout.option?.visible ? 'card-field-wrapper' : 'hidden'\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"innerLayout.label?.caption\"\r\n [style]=\"getStyleWithoutClasses(innerLayout.label?.style).style\"\r\n [class]=\"innerLayout.label?.style?.classes?.[0]\">\r\n {{ innerLayout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <h3 *ngIf=\"innerLayout.option?.protected && innerLayout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\"\r\n (click)=\"showLinkDetails(innerLayout.option, record)\">\r\n\r\n <!-- DATE FORMAT -->\r\n <ng-container *ngIf=\"innerLayout.option?.dateFormat; else checkTime\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.dateFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n\r\n <!-- TIME FORMAT -->\r\n <ng-template #checkTime>\r\n <ng-container\r\n *ngIf=\"innerLayout.option?.timeFormat; else normalValue\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.timeFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- NORMAL STRING -->\r\n <ng-template #normalValue>\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ?? '--'\r\n }}\r\n </ng-template>\r\n\r\n </h3>\r\n </div>\r\n\r\n <!-- Time Control -->\r\n <div *ngSwitchCase=\"'time'\"\r\n [class]=\"innerLayout.option?.visible ? 'card-field-wrapper' : 'hidden'\">\r\n\r\n <!-- LABEL -->\r\n <span *ngIf=\"innerLayout.label?.caption\"\r\n [style]=\"getStyleWithoutClasses(innerLayout.label?.style).style\"\r\n [class]=\"innerLayout.label?.style?.classes?.[0]\">\r\n {{ innerLayout.label.caption }}\r\n </span>\r\n\r\n <!-- VALUE -->\r\n <h3 *ngIf=\"innerLayout.option?.protected && innerLayout.option?.visible\"\r\n [class]=\"getStyleWithoutClasses(innerLayout?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(innerLayout?.scope?.style).style\"\r\n (click)=\"showLinkDetails(innerLayout.option, record)\">\r\n\r\n <!-- DATE FORMAT -->\r\n <ng-container *ngIf=\"innerLayout.option?.dateFormat; else checkTime\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.dateFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n\r\n <!-- TIME FORMAT -->\r\n <ng-template #checkTime>\r\n <ng-container\r\n *ngIf=\"innerLayout.option?.timeFormat; else normalValue\">\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ? (record[innerLayout.scope?.reference.split('/').pop()] | date:\r\n innerLayout.option.timeFormat)\r\n : '--'\r\n }}\r\n </ng-container>\r\n </ng-template>\r\n\r\n <!-- NORMAL STRING -->\r\n <ng-template #normalValue>\r\n {{\r\n record?.[innerLayout.scope?.reference.split('/').pop()]\r\n ?? '--'\r\n }}\r\n </ng-template>\r\n\r\n </h3>\r\n </div>\r\n\r\n <!-- Button Control -->\r\n <div *ngSwitchCase=\"'default'\">\r\n <button nz-button [style]=\"getStyleWithoutClasses(innerLayout?.style).style\"\r\n [class]=\"innerLayout.option?.visible ? innerLayout.option.protected ? 'disabled-button' : getStyleWithoutClasses(innerLayout?.style).classes : 'hidden'\"\r\n (click)=\"invokeButtonClick(innerLayout, record, k)\">\r\n <ng-container *ngIf=\"!innerLayout.caption; else textContent\">\r\n <i nz-icon [nzType]=\"innerLayout.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ innerLayout.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n <div *ngIf=\"itemInfo?.footer?.elements && itemInfo?.data && itemInfo?.data.length\"\r\n [class]=\"getStyleWithoutClasses(itemInfo?.footer?.style).classes\">\r\n <span *ngFor=\"let element of itemInfo.footer?.elements; let c = index\">\r\n <ng-container\r\n [ngSwitch]=\"element.scope?.reference && itemInfo.propertySchema[getScope(element.scope?.reference)] ? itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n\r\n <!-- Date control -->\r\n <div *ngSwitchCase=\"'date'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"element.option.protected\" [style]=\"getStyleWithoutClasses(element?.label?.style).style\"\r\n [class]=\"element?.label?.style?.classes[0]\">\r\n <h5>{{\r\n itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n </h5>\r\n </span>\r\n <div *ngIf=\"!element.option.protected\">\r\n <div [class]=\"element?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(element?.label?.style).style\"\r\n [class]=\"element?.label?.style?.classes[0]\">{{ element.label?.value\r\n ?\r\n element.label?.value : element.label?.caption ?\r\n element.label?.caption :\r\n itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n\r\n <nz-date-picker [required]=\"element.option.required\" [name]=\"element.scope?.reference\"\r\n [nzDisabled]=\"element?.option?.disabled\"\r\n (ngModelChange)=\"dateChangeEvent(element, $event)\"\r\n [nzFormat]=\"itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.format ? itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()]?.format : 'yyyy-MM-dd'\"\r\n [(ngModel)]=\"itemInfo.propertySchema[getScope(element.scope?.reference)][element.scope?.reference.split('/').pop()].value\"\r\n [style]=\"getStyleWithoutClasses(element?.style).style\"></nz-date-picker>\r\n </div>\r\n\r\n </div>\r\n </div>\r\n\r\n <!-- Button Control -->\r\n <div *ngSwitchCase=\"'default'\" [class]=\"element.option?.visible ? 'row' : 'hidden'\"\r\n (click)=\"invokeOnCardFooter(element)\">\r\n <button nz-button [style]=\"getStyleWithoutClasses(element.style).style\"\r\n [class]=\"element.option.protected ? 'disabled-button' : getStyleWithoutClasses(element.style).classes\">\r\n <ng-container *ngIf=\"!element.caption; else textContent\">\r\n <i nz-icon [nzType]=\"element.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ element.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </span>\r\n </div>\r\n <!-- bottom pagination on card -->\r\n <div *ngIf=\"itemInfo?.layoutSchema?.pagination && itemInfo?.layoutSchema?.pagination?.bottom\">\r\n <vl-pagination [itemInfo]=\"itemInfo\" [pageSize]=\"pageSize\" [currentPage]=\"currentPage\" [pages]=\"pages\"\r\n (pageSizeChange)=\"invokeOnPageSizeChange($event)\" (onGoToPage)=\"invokeGoToPage($event)\">\r\n </vl-pagination>\r\n </div>\r\n</span>" }]
1247
+ }], ctorParameters: () => [{ type: UtilityService }, { type: i1.Platform }, { type: i1$1.HttpClient }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i4.NzModalService }, { type: i5$1.OAuthService }, { type: RequestService }], propDecorators: { itemInfo: [{
1248
+ type: Input
1249
+ }], currentPage: [{
1250
+ type: Input
1251
+ }], pageSize: [{
1252
+ type: Input
1253
+ }], selectedLanguageInfo: [{
1254
+ type: Input
1255
+ }], mobileDisplay: [{
1256
+ type: Input
1257
+ }], pages: [{
1258
+ type: Input
1259
+ }], cardButtonClick: [{
1260
+ type: Output
1261
+ }], cardHeaderButtonClick: [{
1262
+ type: Output
1263
+ }], linkDetails: [{
1264
+ type: Output
1265
+ }], imageDetails: [{
1266
+ type: Output
1267
+ }], onPageSizeChange: [{
1268
+ type: Output
1269
+ }], onPageChange: [{
1270
+ type: Output
1271
+ }] } });
1272
+
1273
+ class FormComponent {
1274
+ customEmailPattern = '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$';
1275
+ showPassword = false;
1276
+ formCopy = {};
1277
+ errorMessages = {};
1278
+ creditCardError = {};
1279
+ form = {};
1280
+ selectedLanguageInfo = {};
1281
+ formButtonClick = new EventEmitter();
1282
+ checkBoxChangeEvent = new EventEmitter();
1283
+ ngOnInit() { }
1284
+ ngOnChanges(changes) {
1285
+ if (changes['form'] && this.form) {
1286
+ this.formCopy = this.safeClone(this.form);
1287
+ this.setValidations();
1288
+ }
1289
+ if ((changes['selectedLanguageInfo'] || this.selectedLanguageInfo) &&
1290
+ this.selectedLanguageInfo?.selectedLanguage) {
1291
+ this.applySelectedLanguage();
1292
+ this.setValidations();
1293
+ }
1294
+ }
1295
+ ngAfterViewInit() {
1296
+ setTimeout(() => {
1297
+ this.setValidations();
1298
+ });
1299
+ }
1300
+ safeClone(value) {
1301
+ try {
1302
+ return JSON.parse(JSON.stringify(value || {}));
1303
+ }
1304
+ catch {
1305
+ return {};
1306
+ }
1307
+ }
1308
+ applySelectedLanguage() {
1309
+ if (this.selectedLanguageInfo?.errorMessages) {
1310
+ this.errorMessages = this.selectedLanguageInfo.errorMessages;
1311
+ }
1312
+ if (!this.formCopy || !this.form) {
1313
+ return;
1314
+ }
1315
+ const selectedLanguage = this.selectedLanguageInfo.selectedLanguage;
1316
+ this.form.propertySchema = this.formCopy.propertySchema
1317
+ ? this.safeClone(this.formCopy.propertySchema)
1318
+ : {};
1319
+ this.form.propertySchema = this.translateSchema(this.form.propertySchema, selectedLanguage);
1320
+ if (this.formCopy?.layoutSchema?.formSections?.length) {
1321
+ this.formCopy.layoutSchema.formSections.forEach((formSection, sectionIndex) => {
1322
+ if (formSection?.label?.caption &&
1323
+ selectedLanguage[formSection.label.caption]) {
1324
+ this.form.layoutSchema.formSections[sectionIndex].label.caption =
1325
+ selectedLanguage[formSection.label.caption];
1326
+ }
1327
+ if (formSection?.formFields?.length) {
1328
+ formSection.formFields.forEach((formField, fieldIndex) => {
1329
+ if (formField?.label?.caption &&
1330
+ selectedLanguage[formField.label.caption]) {
1331
+ this.form.layoutSchema.formSections[sectionIndex].formFields[fieldIndex].label.caption = selectedLanguage[formField.label.caption];
1332
+ }
1333
+ });
1334
+ }
1335
+ });
1336
+ }
1337
+ }
1338
+ translateSchema(schema, selectedLanguage) {
1339
+ if (!schema || typeof schema !== 'object' || !selectedLanguage) {
1340
+ return schema;
1341
+ }
1342
+ Object.keys(schema).forEach((key) => {
1343
+ const value = schema[key];
1344
+ if (value && typeof value === 'object' && !Array.isArray(value)) {
1345
+ this.translateSchema(value, selectedLanguage);
1346
+ }
1347
+ if (Array.isArray(value)) {
1348
+ value.forEach((item) => {
1349
+ if (item && typeof item === 'object') {
1350
+ this.translateSchema(item, selectedLanguage);
1351
+ }
1352
+ });
1353
+ }
1354
+ if (value &&
1355
+ typeof value === 'object' &&
1356
+ typeof value.caption === 'string' &&
1357
+ value.caption.trim()) {
1358
+ const original = value.caption.trim();
1359
+ if (selectedLanguage[original]) {
1360
+ value.caption = selectedLanguage[original];
1361
+ }
1362
+ }
1363
+ if (value &&
1364
+ typeof value === 'object' &&
1365
+ typeof value.placeholder === 'string' &&
1366
+ value.placeholder.trim()) {
1367
+ const original = value.placeholder.trim();
1368
+ if (selectedLanguage[original]) {
1369
+ value.placeholder = selectedLanguage[original];
1370
+ }
1371
+ }
1372
+ });
1373
+ return schema;
1374
+ }
1375
+ getStyleWithoutClasses(styleObject) {
1376
+ if (!styleObject || typeof styleObject !== 'object') {
1377
+ return { classes: '', style: {} };
1378
+ }
1379
+ const { classes, ...styleWithoutClasses } = styleObject;
1380
+ return {
1381
+ classes: Array.isArray(classes) ? classes.join(' ') : classes || '',
1382
+ style: styleWithoutClasses || {},
1383
+ };
1384
+ }
1385
+ getSectionBodyStyle(formSection) {
1386
+ const layout = formSection?.layout || {};
1387
+ const schemaStyle = this.getStyleWithoutClasses(formSection?.style).style;
1388
+ return {
1389
+ display: schemaStyle?.display || 'grid',
1390
+ gridTemplateColumns: schemaStyle?.gridTemplateColumns ||
1391
+ `repeat(${layout?.desktopColumns || 12}, minmax(0, 1fr))`,
1392
+ gap: schemaStyle?.gap || layout?.gap || '10px',
1393
+ alignItems: schemaStyle?.alignItems || 'start',
1394
+ width: '100%',
1395
+ boxSizing: 'border-box',
1396
+ ...schemaStyle,
1397
+ };
1398
+ }
1399
+ getFieldWrapperStyle(formField) {
1400
+ const schemaStyle = this.getStyleWithoutClasses(formField?.style).style;
1401
+ return {
1402
+ minWidth: 0,
1403
+ width: '100%',
1404
+ boxSizing: 'border-box',
1405
+ ...schemaStyle,
1406
+ };
1407
+ }
1408
+ getFieldInnerLayoutStyle(formField) {
1409
+ if (formField?.layout === 'horizontal') {
1410
+ return {
1411
+ display: 'grid',
1412
+ gridTemplateColumns: 'minmax(110px, 30%) 1fr',
1413
+ alignItems: 'center',
1414
+ gap: '10px',
1415
+ };
1416
+ }
1417
+ return {
1418
+ display: 'block',
1419
+ };
1420
+ }
1421
+ getScope(scope) {
1422
+ if (!scope || typeof scope !== 'string') {
1423
+ return '';
1424
+ }
1425
+ const start = scope.indexOf('#/') + 2;
1426
+ const end = scope.indexOf('/', start);
1427
+ if (start >= 2 && end > start) {
1428
+ return scope.substring(start, end);
1429
+ }
1430
+ return '';
1431
+ }
1432
+ togglePasswordVisibility() {
1433
+ this.showPassword = !this.showPassword;
1434
+ }
1435
+ invokeFormBtnClick(option, propertySchema) {
1436
+ this.formButtonClick.emit({
1437
+ option,
1438
+ propertySchema,
1439
+ });
1440
+ }
1441
+ setformData() {
1442
+ this.checkBoxChangeEvent.emit(this.form?.propertySchema);
1443
+ }
1444
+ setErroMessage(formField, errorMessages, field) {
1445
+ let error = '';
1446
+ let fieldName = '';
1447
+ if (field?.errors?.required) {
1448
+ error = errorMessages?.required || '';
1449
+ }
1450
+ else if (field?.errors?.email || field?.errors?.pattern) {
1451
+ error = errorMessages?.pattern || '';
1452
+ }
1453
+ else if (field?.errors?.minlength) {
1454
+ error = errorMessages?.minlength || '';
1455
+ }
1456
+ else if (field?.errors?.maxlength) {
1457
+ error = errorMessages?.maxlength || '';
1458
+ }
1459
+ if (formField?.label?.value) {
1460
+ fieldName = formField.label.value;
1461
+ }
1462
+ else {
1463
+ const scope = this.getScope(formField?.scope?.reference);
1464
+ const key = formField?.scope?.reference?.split('/').pop();
1465
+ const propertySchema = this.form?.propertySchema?.[scope]?.[key];
1466
+ fieldName = propertySchema?.caption || propertySchema?.placeholder || '';
1467
+ }
1468
+ if (error && error.toString().includes('{{requiredLength}}')) {
1469
+ error = error.replace(/{{\s*requiredLength\s*}}/g, formField?.minlength?.toString() || '');
1470
+ }
1471
+ return error.replace(/{{\s*field\s*}}/g, fieldName);
1472
+ }
1473
+ setValidations() {
1474
+ if (!this.form?.layoutSchema?.formSections?.length) {
1475
+ return;
1476
+ }
1477
+ this.form.layoutSchema.formSections.forEach((formSection) => {
1478
+ if (!formSection?.formFields?.length) {
1479
+ return;
1480
+ }
1481
+ formSection.formFields.forEach((formField) => {
1482
+ const reference = formField?.scope?.reference;
1483
+ if (!reference || !this.form?.propertySchema) {
1484
+ return;
1485
+ }
1486
+ const scope = this.getScope(reference);
1487
+ const key = reference.split('/').pop();
1488
+ const property = this.form.propertySchema?.[scope]?.[key];
1489
+ if (!property?.validation?.length) {
1490
+ return;
1491
+ }
1492
+ property.validation.forEach((validation) => {
1493
+ if (validation.required) {
1494
+ formField.required = true;
1495
+ }
1496
+ if (validation.email) {
1497
+ formField.email = true;
1498
+ }
1499
+ if (validation.minlength) {
1500
+ formField.minlength = validation.minlength;
1501
+ }
1502
+ if (validation.maxlength) {
1503
+ formField.maxlength = validation.maxlength;
1504
+ }
1505
+ });
1506
+ });
1507
+ });
1508
+ }
1509
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1510
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: FormComponent, isStandalone: true, selector: "vl-form", inputs: { errorMessages: "errorMessages", creditCardError: "creditCardError", form: "form", selectedLanguageInfo: "selectedLanguageInfo" }, outputs: { formButtonClick: "formButtonClick", checkBoxChangeEvent: "checkBoxChangeEvent" }, usesOnChanges: true, ngImport: i0, template: "<div class=\"form-renderer\" [ngClass]=\"getStyleWithoutClasses(form?.layoutSchema?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(form?.layoutSchema?.style)?.style\">\r\n <form *ngIf=\"form?.layoutSchema?.formSections?.length > 0\">\r\n <div *ngFor=\"let formSection of form?.layoutSchema?.formSections; let i = index\" class=\"section-card\">\r\n <div *ngIf=\"formSection?.label?.caption\" class=\"section-header\">\r\n <div class=\"section-title\" [ngClass]=\"getStyleWithoutClasses(formSection?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formSection?.label?.style)?.style\">\r\n {{ formSection.label.caption }}\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"formSection?.formFields?.length > 0\" class=\"section-body\"\r\n [ngClass]=\"getStyleWithoutClasses(formSection?.style)?.classes\" [ngStyle]=\"getSectionBodyStyle(formSection)\">\r\n <div *ngFor=\"let formField of formSection.formFields\" class=\"field-row\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.style)?.classes\" [ngStyle]=\"getFieldWrapperStyle(formField)\">\r\n <div [ngSwitch]=\"\r\n formField?.scope?.reference &&\r\n form?.propertySchema?.[getScope(formField.scope?.reference)]\r\n ? form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.type\r\n : 'default'\r\n \">\r\n <!-- image control -->\r\n <div *ngSwitchCase=\"'image'\" [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\">\r\n <img [src]=\"formField?.option?.src\" [alt]=\"'img'\" />\r\n </div>\r\n\r\n <!-- credit card control -->\r\n <div *ngSwitchCase=\"'carditCard'\" [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\">\r\n <div id=\"card-element\"></div>\r\n <div id=\"card-errors\" [class]=\"creditCardError?.textContent !== '' ? 'text-red-400 m-0' : ''\"></div>\r\n </div>\r\n\r\n <!-- string control -->\r\n <span *ngSwitchCase=\"'string'\" class=\"form-group\">\r\n <span *ngIf=\"formField?.option?.protected\">\r\n <h5 style=\"display: flex; justify-content: space-between\">\r\n <span [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </span>\r\n\r\n <span>\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.value\r\n }}\r\n </span>\r\n </h5>\r\n </span>\r\n\r\n <span *ngIf=\"!formField?.option?.protected\">\r\n <div [ngStyle]=\"getFieldInnerLayoutStyle(formField)\">\r\n <label [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n formField?.label?.value\r\n ? formField.label.value\r\n : formField?.label?.caption\r\n ? formField.label.caption\r\n : form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n\r\n <div [ngStyle]=\"\r\n formField?.option?.password\r\n ? {\r\n position: 'relative',\r\n display: 'flex',\r\n alignItems: 'center'\r\n }\r\n : {}\r\n \">\r\n <input [type]=\"\r\n formField?.option?.password\r\n ? !showPassword\r\n ? 'password'\r\n : 'text'\r\n : 'text'\r\n \" #inputField=\"ngModel\" [required]=\"formField?.required\" [attr.inputmode]=\"\r\n formField?.option?.email\r\n ? 'email'\r\n : formField?.option?.password\r\n ? 'numeric'\r\n : 'text'\r\n \" [pattern]=\"formField?.email ? customEmailPattern : ''\" [email]=\"formField?.email\"\r\n [minlength]=\"formField?.minlength\" [maxlength]=\"formField?.maxlength\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \" [name]=\"formField.scope?.reference\" [placeholder]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.placeholder\r\n \" />\r\n\r\n <i *ngIf=\"formField?.option?.password\" class=\"fa\"\r\n [ngClass]=\"showPassword ? 'fa-eye' : 'fa-eye-slash'\" (click)=\"togglePasswordVisibility()\"\r\n style=\"position: absolute; right: 10px; cursor: pointer\"></i>\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"inputField?.touched && inputField?.invalid\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.validation?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.validation?.style)?.style\">\r\n <p [class]=\"\r\n formField?.layout === 'horizontal'\r\n ? 'text-red-400 m-0 horizontal-error'\r\n : 'text-red-400 m-0'\r\n \" *ngIf=\"inputField?.errors\">\r\n {{ setErroMessage(formField, errorMessages, inputField) }}\r\n </p>\r\n </div>\r\n </span>\r\n </span>\r\n\r\n <!-- number control -->\r\n <div *ngSwitchCase=\"'number'\" class=\"form-group\">\r\n <span *ngIf=\"formField?.option?.protected\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n <h5>\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.value\r\n | currency\r\n : formField?.option?.currency\r\n : true\r\n : formField?.option?.decimalPoint\r\n }}\r\n </h5>\r\n </span>\r\n\r\n <span *ngIf=\"!formField?.option?.protected\">\r\n <div [ngStyle]=\"getFieldInnerLayoutStyle(formField)\">\r\n <label [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n formField?.label?.value\r\n ? formField.label.value\r\n : form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n\r\n <input type=\"number\" [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \" [name]=\"formField.scope?.reference\" [placeholder]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.placeholder\r\n \" />\r\n </div>\r\n </span>\r\n </div>\r\n\r\n <!-- checkbox control -->\r\n <div *ngSwitchCase=\"'checkbox'\" class=\"form-group\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\">\r\n <span *ngIf=\"formField?.option?.postfixCaption\">\r\n <label class=\"form-check-label\">\r\n <input type=\"checkbox\" class=\"form-check-input mr-2\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \" [name]=\"formField.scope?.reference\" (ngModelChange)=\"setformData()\" />\r\n\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n </span>\r\n\r\n <div *ngIf=\"!formField?.option?.postfixCaption\" [ngStyle]=\"getFieldInnerLayoutStyle(formField)\">\r\n <label class=\"form-check-label\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n\r\n <input type=\"checkbox\" class=\"form-check-input\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \" [name]=\"formField.scope?.reference\" (ngModelChange)=\"setformData()\" />\r\n </label>\r\n </div>\r\n </div>\r\n\r\n <!-- dropdown control -->\r\n <div *ngSwitchCase=\"'dropdown'\" class=\"form-group\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\">\r\n <span *ngIf=\"formField?.option?.postfixCaption\">\r\n <select id=\"dynamic-dropdown\" #dropdownField=\"ngModel\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\" [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \">\r\n <option *ngFor=\"\r\n let item of form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.data\r\n \" [value]=\"item[formField?.option?.optionValue]\">\r\n {{ item[formField?.option?.optionLabel] }}\r\n </option>\r\n </select>\r\n\r\n <label [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n </span>\r\n\r\n <div *ngIf=\"!formField?.option?.postfixCaption\">\r\n <div [ngStyle]=\"getFieldInnerLayoutStyle(formField)\">\r\n <label [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n\r\n <nz-select nzShowSearch nzAllowClear nzPlaceHolder=\"Select\" #dropdownField=\"ngModel\"\r\n [required]=\"formField?.required\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\"\r\n [name]=\"formField.scope?.reference\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \">\r\n <nz-option *ngFor=\"\r\n let item of form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.data\r\n \" [nzLabel]=\"item[formField?.option?.optionLabel]\"\r\n [nzValue]=\"item[formField?.option?.optionValue]\"></nz-option>\r\n </nz-select>\r\n </div>\r\n\r\n <div *ngIf=\"dropdownField?.touched && dropdownField?.invalid\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.validation?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.validation?.style)?.style\">\r\n <p [class]=\"\r\n formField?.layout === 'horizontal'\r\n ? 'text-red-400 m-0 horizontal-error'\r\n : 'text-red-400 m-0'\r\n \" *ngIf=\"dropdownField?.errors\">\r\n {{ setErroMessage(formField, errorMessages, dropdownField) }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- button/default control -->\r\n <div *ngSwitchCase=\"'default'\">\r\n <button type=\"submit\" [ngClass]=\"getStyleWithoutClasses(formField?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.style)?.style\"\r\n (click)=\"invokeFormBtnClick(formField?.option, form.propertySchema)\">\r\n {{ formField?.label?.caption }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </form>\r\n</div>", styles: [":host{display:block;width:100%;height:100%;min-height:0}.form-renderer{width:100%;height:100%;min-height:0;overflow-y:auto;overflow-x:hidden;box-sizing:border-box;padding:12px}.section-card{border:1px solid #e5e7eb;border-radius:var(--radius-sm, 8px);padding:12px;margin-bottom:12px;background:#fff;box-sizing:border-box}.section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;font-weight:600}.section-title{font-size:14px;color:#0f172a}.section-body{position:relative;width:100%;min-height:78px;box-sizing:border-box}.field-row{position:relative;min-width:0;width:100%;box-sizing:border-box}.field-row input,.field-row select,.field-row nz-select,.field-row textarea,.field-row button{max-width:100%;box-sizing:border-box}@media(max-width:768px){.section-body{grid-template-columns:repeat(1,minmax(0,1fr))!important}.field-row{grid-column:span 1!important}}@media(min-width:769px)and (max-width:1024px){.section-body{grid-template-columns:repeat(6,minmax(0,1fr))!important}.field-row{grid-column:span 6!important}}:host-context(.mobile-frame) .section-body,:host-context(.device-mobile) .section-body{grid-template-columns:repeat(1,minmax(0,1fr))!important}:host-context(.mobile-frame) .field-row,:host-context(.device-mobile) .field-row{grid-column:span 1!important}:host-context(.tablet-frame) .section-body,:host-context(.device-tablet) .section-body{grid-template-columns:repeat(6,minmax(0,1fr))!important}:host-context(.tablet-frame) .field-row,:host-context(.device-tablet) .field-row{grid-column:span 6!important}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { 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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.MinLengthValidator, selector: "[minlength][formControlName],[minlength][formControl],[minlength][ngModel]", inputs: ["minlength"] }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i2.EmailValidator, selector: "[email][formControlName],[email][formControl],[email][ngModel]", inputs: ["email"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: NzSelectModule }, { kind: "component", type: i3.NzOptionComponent, selector: "nz-option", inputs: ["nzTitle", "nzLabel", "nzValue", "nzKey", "nzDisabled", "nzHide", "nzCustomContent"], exportAs: ["nzOption"] }, { kind: "component", type: i3.NzSelectComponent, selector: "nz-select", inputs: ["nzId", "nzSize", "nzStatus", "nzVariant", "nzOptionHeightPx", "nzOptionOverflowSize", "nzDropdownClassName", "nzDropdownMatchSelectWidth", "nzDropdownStyle", "nzNotFoundContent", "nzPlaceHolder", "nzPlacement", "nzMaxTagCount", "nzDropdownRender", "nzCustomTemplate", "nzPrefix", "nzSuffixIcon", "nzClearIcon", "nzRemoveIcon", "nzMenuItemSelectedIcon", "nzTokenSeparators", "nzMaxTagPlaceholder", "nzMaxMultipleCount", "nzMode", "nzFilterOption", "compareWith", "nzAllowClear", "nzShowSearch", "nzLoading", "nzAutoFocus", "nzAutoClearSearchValue", "nzServerSearch", "nzDisabled", "nzOpen", "nzSelectOnTab", "nzBackdrop", "nzOptions", "nzShowArrow"], outputs: ["nzOnSearch", "nzScrollToBottom", "nzOpenChange", "nzBlur", "nzFocus", "nzOnClear"], exportAs: ["nzSelect"] }, { kind: "pipe", type: i5.CurrencyPipe, name: "currency" }] });
1511
+ }
1512
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: FormComponent, decorators: [{
1513
+ type: Component,
1514
+ args: [{ standalone: true, imports: [CommonModule, FormsModule, NzSelectModule], selector: 'vl-form', template: "<div class=\"form-renderer\" [ngClass]=\"getStyleWithoutClasses(form?.layoutSchema?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(form?.layoutSchema?.style)?.style\">\r\n <form *ngIf=\"form?.layoutSchema?.formSections?.length > 0\">\r\n <div *ngFor=\"let formSection of form?.layoutSchema?.formSections; let i = index\" class=\"section-card\">\r\n <div *ngIf=\"formSection?.label?.caption\" class=\"section-header\">\r\n <div class=\"section-title\" [ngClass]=\"getStyleWithoutClasses(formSection?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formSection?.label?.style)?.style\">\r\n {{ formSection.label.caption }}\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"formSection?.formFields?.length > 0\" class=\"section-body\"\r\n [ngClass]=\"getStyleWithoutClasses(formSection?.style)?.classes\" [ngStyle]=\"getSectionBodyStyle(formSection)\">\r\n <div *ngFor=\"let formField of formSection.formFields\" class=\"field-row\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.style)?.classes\" [ngStyle]=\"getFieldWrapperStyle(formField)\">\r\n <div [ngSwitch]=\"\r\n formField?.scope?.reference &&\r\n form?.propertySchema?.[getScope(formField.scope?.reference)]\r\n ? form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.type\r\n : 'default'\r\n \">\r\n <!-- image control -->\r\n <div *ngSwitchCase=\"'image'\" [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\">\r\n <img [src]=\"formField?.option?.src\" [alt]=\"'img'\" />\r\n </div>\r\n\r\n <!-- credit card control -->\r\n <div *ngSwitchCase=\"'carditCard'\" [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\">\r\n <div id=\"card-element\"></div>\r\n <div id=\"card-errors\" [class]=\"creditCardError?.textContent !== '' ? 'text-red-400 m-0' : ''\"></div>\r\n </div>\r\n\r\n <!-- string control -->\r\n <span *ngSwitchCase=\"'string'\" class=\"form-group\">\r\n <span *ngIf=\"formField?.option?.protected\">\r\n <h5 style=\"display: flex; justify-content: space-between\">\r\n <span [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </span>\r\n\r\n <span>\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.value\r\n }}\r\n </span>\r\n </h5>\r\n </span>\r\n\r\n <span *ngIf=\"!formField?.option?.protected\">\r\n <div [ngStyle]=\"getFieldInnerLayoutStyle(formField)\">\r\n <label [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n formField?.label?.value\r\n ? formField.label.value\r\n : formField?.label?.caption\r\n ? formField.label.caption\r\n : form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n\r\n <div [ngStyle]=\"\r\n formField?.option?.password\r\n ? {\r\n position: 'relative',\r\n display: 'flex',\r\n alignItems: 'center'\r\n }\r\n : {}\r\n \">\r\n <input [type]=\"\r\n formField?.option?.password\r\n ? !showPassword\r\n ? 'password'\r\n : 'text'\r\n : 'text'\r\n \" #inputField=\"ngModel\" [required]=\"formField?.required\" [attr.inputmode]=\"\r\n formField?.option?.email\r\n ? 'email'\r\n : formField?.option?.password\r\n ? 'numeric'\r\n : 'text'\r\n \" [pattern]=\"formField?.email ? customEmailPattern : ''\" [email]=\"formField?.email\"\r\n [minlength]=\"formField?.minlength\" [maxlength]=\"formField?.maxlength\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \" [name]=\"formField.scope?.reference\" [placeholder]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.placeholder\r\n \" />\r\n\r\n <i *ngIf=\"formField?.option?.password\" class=\"fa\"\r\n [ngClass]=\"showPassword ? 'fa-eye' : 'fa-eye-slash'\" (click)=\"togglePasswordVisibility()\"\r\n style=\"position: absolute; right: 10px; cursor: pointer\"></i>\r\n </div>\r\n </div>\r\n\r\n <div *ngIf=\"inputField?.touched && inputField?.invalid\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.validation?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.validation?.style)?.style\">\r\n <p [class]=\"\r\n formField?.layout === 'horizontal'\r\n ? 'text-red-400 m-0 horizontal-error'\r\n : 'text-red-400 m-0'\r\n \" *ngIf=\"inputField?.errors\">\r\n {{ setErroMessage(formField, errorMessages, inputField) }}\r\n </p>\r\n </div>\r\n </span>\r\n </span>\r\n\r\n <!-- number control -->\r\n <div *ngSwitchCase=\"'number'\" class=\"form-group\">\r\n <span *ngIf=\"formField?.option?.protected\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n <h5>\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.value\r\n | currency\r\n : formField?.option?.currency\r\n : true\r\n : formField?.option?.decimalPoint\r\n }}\r\n </h5>\r\n </span>\r\n\r\n <span *ngIf=\"!formField?.option?.protected\">\r\n <div [ngStyle]=\"getFieldInnerLayoutStyle(formField)\">\r\n <label [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n formField?.label?.value\r\n ? formField.label.value\r\n : form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n\r\n <input type=\"number\" [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \" [name]=\"formField.scope?.reference\" [placeholder]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.placeholder\r\n \" />\r\n </div>\r\n </span>\r\n </div>\r\n\r\n <!-- checkbox control -->\r\n <div *ngSwitchCase=\"'checkbox'\" class=\"form-group\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\">\r\n <span *ngIf=\"formField?.option?.postfixCaption\">\r\n <label class=\"form-check-label\">\r\n <input type=\"checkbox\" class=\"form-check-input mr-2\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \" [name]=\"formField.scope?.reference\" (ngModelChange)=\"setformData()\" />\r\n\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n </span>\r\n\r\n <div *ngIf=\"!formField?.option?.postfixCaption\" [ngStyle]=\"getFieldInnerLayoutStyle(formField)\">\r\n <label class=\"form-check-label\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n\r\n <input type=\"checkbox\" class=\"form-check-input\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \" [name]=\"formField.scope?.reference\" (ngModelChange)=\"setformData()\" />\r\n </label>\r\n </div>\r\n </div>\r\n\r\n <!-- dropdown control -->\r\n <div *ngSwitchCase=\"'dropdown'\" class=\"form-group\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\">\r\n <span *ngIf=\"formField?.option?.postfixCaption\">\r\n <select id=\"dynamic-dropdown\" #dropdownField=\"ngModel\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\" [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \">\r\n <option *ngFor=\"\r\n let item of form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.data\r\n \" [value]=\"item[formField?.option?.optionValue]\">\r\n {{ item[formField?.option?.optionLabel] }}\r\n </option>\r\n </select>\r\n\r\n <label [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n </span>\r\n\r\n <div *ngIf=\"!formField?.option?.postfixCaption\">\r\n <div [ngStyle]=\"getFieldInnerLayoutStyle(formField)\">\r\n <label [ngClass]=\"getStyleWithoutClasses(formField?.label?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.label?.style)?.style\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.caption\r\n }}\r\n </label>\r\n\r\n <nz-select nzShowSearch nzAllowClear nzPlaceHolder=\"Select\" #dropdownField=\"ngModel\"\r\n [required]=\"formField?.required\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.scope?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.scope?.style)?.style\"\r\n [name]=\"formField.scope?.reference\" [(ngModel)]=\"\r\n form.propertySchema[getScope(formField.scope?.reference)][\r\n formField.scope?.reference.split('/').pop()\r\n ].value\r\n \">\r\n <nz-option *ngFor=\"\r\n let item of form.propertySchema[getScope(formField.scope?.reference)]?.[\r\n formField.scope?.reference.split('/').pop()\r\n ]?.data\r\n \" [nzLabel]=\"item[formField?.option?.optionLabel]\"\r\n [nzValue]=\"item[formField?.option?.optionValue]\"></nz-option>\r\n </nz-select>\r\n </div>\r\n\r\n <div *ngIf=\"dropdownField?.touched && dropdownField?.invalid\"\r\n [ngClass]=\"getStyleWithoutClasses(formField?.validation?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.validation?.style)?.style\">\r\n <p [class]=\"\r\n formField?.layout === 'horizontal'\r\n ? 'text-red-400 m-0 horizontal-error'\r\n : 'text-red-400 m-0'\r\n \" *ngIf=\"dropdownField?.errors\">\r\n {{ setErroMessage(formField, errorMessages, dropdownField) }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- button/default control -->\r\n <div *ngSwitchCase=\"'default'\">\r\n <button type=\"submit\" [ngClass]=\"getStyleWithoutClasses(formField?.style)?.classes\"\r\n [ngStyle]=\"getStyleWithoutClasses(formField?.style)?.style\"\r\n (click)=\"invokeFormBtnClick(formField?.option, form.propertySchema)\">\r\n {{ formField?.label?.caption }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </form>\r\n</div>", styles: [":host{display:block;width:100%;height:100%;min-height:0}.form-renderer{width:100%;height:100%;min-height:0;overflow-y:auto;overflow-x:hidden;box-sizing:border-box;padding:12px}.section-card{border:1px solid #e5e7eb;border-radius:var(--radius-sm, 8px);padding:12px;margin-bottom:12px;background:#fff;box-sizing:border-box}.section-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;font-weight:600}.section-title{font-size:14px;color:#0f172a}.section-body{position:relative;width:100%;min-height:78px;box-sizing:border-box}.field-row{position:relative;min-width:0;width:100%;box-sizing:border-box}.field-row input,.field-row select,.field-row nz-select,.field-row textarea,.field-row button{max-width:100%;box-sizing:border-box}@media(max-width:768px){.section-body{grid-template-columns:repeat(1,minmax(0,1fr))!important}.field-row{grid-column:span 1!important}}@media(min-width:769px)and (max-width:1024px){.section-body{grid-template-columns:repeat(6,minmax(0,1fr))!important}.field-row{grid-column:span 6!important}}:host-context(.mobile-frame) .section-body,:host-context(.device-mobile) .section-body{grid-template-columns:repeat(1,minmax(0,1fr))!important}:host-context(.mobile-frame) .field-row,:host-context(.device-mobile) .field-row{grid-column:span 1!important}:host-context(.tablet-frame) .section-body,:host-context(.device-tablet) .section-body{grid-template-columns:repeat(6,minmax(0,1fr))!important}:host-context(.tablet-frame) .field-row,:host-context(.device-tablet) .field-row{grid-column:span 6!important}\n"] }]
1515
+ }], propDecorators: { errorMessages: [{
1516
+ type: Input
1517
+ }], creditCardError: [{
1518
+ type: Input
1519
+ }], form: [{
1520
+ type: Input
1521
+ }], selectedLanguageInfo: [{
1522
+ type: Input
1523
+ }], formButtonClick: [{
1524
+ type: Output
1525
+ }], checkBoxChangeEvent: [{
1526
+ type: Output
1527
+ }] } });
1528
+
1529
+ class NotificationService {
1530
+ toastr;
1531
+ constructor(toastr) {
1532
+ this.toastr = toastr;
1533
+ }
1534
+ success(message, time = 5000) {
1535
+ this.toastr.success(message, "", { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1536
+ }
1537
+ info(message, time = 5000) {
1538
+ this.toastr.info(message, "", { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1539
+ }
1540
+ warning(message, time = 20000) {
1541
+ this.toastr.warning(message, "", { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1542
+ }
1543
+ error(error, time = 20000, message) {
1544
+ this.toastr.error(error, message, { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1545
+ }
1546
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NotificationService, deps: [{ token: i1$2.ToastrService }], target: i0.ɵɵFactoryTarget.Injectable });
1547
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NotificationService, providedIn: 'root' });
1548
+ }
1549
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NotificationService, decorators: [{
1550
+ type: Injectable,
1551
+ args: [{
1552
+ providedIn: 'root'
1553
+ }]
1554
+ }], ctorParameters: () => [{ type: i1$2.ToastrService }] });
1555
+
1556
+ class GridComponent {
1557
+ requestService;
1558
+ utilityService;
1559
+ notificationService;
1560
+ oktaAuthService;
1561
+ isLogined = false;
1562
+ tableitemInfoCopy = {};
1563
+ errorMessages = {};
1564
+ environment;
1565
+ selectedLanguageInfo = {};
1566
+ tableitemInfo = {};
1567
+ form = {};
1568
+ isTableDataLoad = false;
1569
+ currenTableOptions = {};
1570
+ projectSeleted = '';
1571
+ pageSize = 5;
1572
+ currentPage = 0;
1573
+ pages = [];
1574
+ userInfo;
1575
+ onPageChange = new EventEmitter();
1576
+ onPageSizeChange = new EventEmitter();
1577
+ onGridScroll = new EventEmitter();
1578
+ showGridLink = new EventEmitter();
1579
+ gridButtonClick = new EventEmitter();
1580
+ gridIncreamentClick = new EventEmitter();
1581
+ gridDecreamentClick = new EventEmitter();
1582
+ gridImgClick = new EventEmitter();
1583
+ constructor(requestService, utilityService, notificationService, oktaAuthService) {
1584
+ this.requestService = requestService;
1585
+ this.utilityService = utilityService;
1586
+ this.notificationService = notificationService;
1587
+ this.oktaAuthService = oktaAuthService;
1588
+ }
1589
+ ngAfterViewInit() {
1590
+ this.authenticating();
1591
+ setTimeout(() => {
1592
+ if (this.environment && this.environment?.login && this.environment?.login?.type == "oktaAuth") {
1593
+ this.oktaAuthService.authState$.subscribe((result) => {
1594
+ if (result.isAuthenticated) {
1595
+ this.isLogined = true;
1596
+ }
1597
+ });
1598
+ }
1599
+ }, 500);
1600
+ }
1601
+ ngOnChanges(changes) {
1602
+ setTimeout(() => {
1603
+ if (changes['tableitemInfo'] && this.tableitemInfo) {
1604
+ console.log('this.tableitemInfo: ', this.tableitemInfo);
1605
+ console.log('this.selectedLanguageInfo?: ', this.selectedLanguageInfo);
1606
+ this.tableitemInfoCopy = JSON.parse(JSON.stringify(this.tableitemInfo));
1607
+ }
1608
+ if (changes['SelectedLanguage'] || this.selectedLanguageInfo?.selectedLanguage) {
1609
+ if (this.tableitemInfoCopy?.layoutSchema && this.tableitemInfoCopy.layoutSchema?.elements?.length) {
1610
+ this.tableitemInfo.propertySchema = JSON.parse(JSON.stringify(this.tableitemInfoCopy.propertySchema));
1611
+ this.tableitemInfo.propertySchema = this.translateSchema(this.tableitemInfo.propertySchema, this.selectedLanguageInfo.selectedLanguage);
1612
+ if (this.tableitemInfoCopy?.footer) {
1613
+ this.tableitemInfo.footer = JSON.parse(JSON.stringify(this.tableitemInfoCopy.footer));
1614
+ this.tableitemInfo.footer = this.translateSchema(this.tableitemInfo.footer, this.selectedLanguageInfo.selectedLanguage);
1615
+ }
1616
+ this.tableitemInfoCopy.layoutSchema.elements.forEach((column, index) => {
1617
+ if (column.label && column.label.caption && this.selectedLanguageInfo.selectedLanguage[column.label.caption]) {
1618
+ this.tableitemInfo.layoutSchema.elements[index].label.caption = this.selectedLanguageInfo.selectedLanguage[column.label.caption];
1619
+ }
1620
+ });
1621
+ }
1622
+ }
1623
+ }, 500);
1624
+ }
1625
+ translateSchema(schema, SelectedLanguage) {
1626
+ if (schema && typeof schema === 'object') {
1627
+ for (const key of Object.keys(schema)) {
1628
+ const val = schema[key];
1629
+ if (val && typeof val === 'object') {
1630
+ this.translateSchema(val, SelectedLanguage);
1631
+ }
1632
+ if (val && val.caption !== undefined && typeof val.caption === 'string') {
1633
+ const original = val.caption.trim();
1634
+ if (original && SelectedLanguage[original]) {
1635
+ val.caption = SelectedLanguage[original];
1636
+ }
1637
+ }
1638
+ if (val && val.value !== undefined && typeof val.value === 'string' && !val.value.includes("{{")) {
1639
+ const originalVal = val.value.trim();
1640
+ if (originalVal && SelectedLanguage[originalVal]) {
1641
+ val.value = SelectedLanguage[originalVal];
1642
+ }
1643
+ }
1644
+ }
1645
+ }
1646
+ return schema;
1647
+ }
1648
+ getScope(scope) {
1649
+ let propertyScope = "";
1650
+ let start = scope?.indexOf("#/") + 2;
1651
+ let end = scope?.indexOf("/", start);
1652
+ if (start && end) {
1653
+ propertyScope = scope.substring(start, end);
1654
+ }
1655
+ return propertyScope;
1656
+ }
1657
+ getStyleWithoutClasses(styleObject) {
1658
+ if (!styleObject) {
1659
+ return { classes: '', style: {} };
1660
+ }
1661
+ const { classes, ...styleWithoutClasses } = styleObject;
1662
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1663
+ }
1664
+ onScrollEvent(event) {
1665
+ this.onGridScroll.emit(event);
1666
+ }
1667
+ showLinkDetails(option, data) {
1668
+ this.showGridLink.emit({ option: option, data: data });
1669
+ }
1670
+ invokeGridBtnClick(option, propertySchema) {
1671
+ this.gridButtonClick.emit({ option: option, propertySchema: propertySchema });
1672
+ }
1673
+ upsertAction(option, data) {
1674
+ let url = option?.data_url;
1675
+ if (url && url?.includes("{{")) {
1676
+ const regex = /{{(.*?)}}/g;
1677
+ const matches = [...url.matchAll(regex)].map(m => m[1]);
1678
+ if (matches && data && data[matches[0]]) {
1679
+ option.data_url = url.replace(`{{${matches[0]}}}`, data[matches[0]]);
1680
+ }
1681
+ }
1682
+ let baseUrl = this.environment?.apiUrl + option.data_url;
1683
+ this.requestService.dynamicCall(option.method, {}, baseUrl, option?.passToken, this.projectSeleted, this.userInfo).subscribe((res) => {
1684
+ console.log('res: ', res);
1685
+ if (option?.reload) {
1686
+ window.location.reload();
1687
+ }
1688
+ else if (option.notifcation) {
1689
+ if (option.notifcation.success) {
1690
+ this.notificationService.success(option.notifcation.success);
1691
+ let findObj = this.findDynamicKeyAndValue(option);
1692
+ if (findObj.keyName) {
1693
+ data[findObj.keyName] = "APPROVED";
1694
+ }
1695
+ }
1696
+ }
1697
+ });
1698
+ }
1699
+ setActionColumn(option, data) {
1700
+ let showAction = true;
1701
+ let findCondiontionalKey = this.findDynamicKeyAndValue(option);
1702
+ if (findCondiontionalKey.keyName) {
1703
+ showAction = data[findCondiontionalKey.keyName] === findCondiontionalKey.value ? true : false;
1704
+ }
1705
+ return showAction;
1706
+ }
1707
+ findDynamicKeyAndValue(object) {
1708
+ const regex = /^\{\{(.*?)\}\}$/;
1709
+ for (const key of Object.keys(object)) {
1710
+ const match = key.match(regex);
1711
+ if (match) {
1712
+ return {
1713
+ keyName: match[1].trim(),
1714
+ value: object[key]
1715
+ };
1716
+ }
1717
+ }
1718
+ return null;
1719
+ }
1720
+ incrementQuantity(index, field, option) {
1721
+ this.gridIncreamentClick.emit({ index: index, field: field, option: option });
1722
+ }
1723
+ invokeTableImageClick(column, data) {
1724
+ this.gridImgClick.emit({ col: column, data: data });
1725
+ }
1726
+ decrementQuantity(index, field, option) {
1727
+ this.gridDecreamentClick.emit({ index: index, field: field, option: option });
1728
+ }
1729
+ invokeOnPageSizeChange(pageSize) {
1730
+ this.onPageSizeChange.emit(pageSize);
1731
+ }
1732
+ invokeGoToPage(page) {
1733
+ this.onPageChange.emit(page);
1734
+ }
1735
+ authenticating() {
1736
+ this.utilityService.getStorage(`${this.projectSeleted}Logined`).then((logined) => {
1737
+ if (logined == "true") {
1738
+ this.isLogined = true;
1739
+ }
1740
+ });
1741
+ }
1742
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: GridComponent, deps: [{ token: RequestService }, { token: UtilityService }, { token: NotificationService }, { token: i4$1.OktaAuthStateService }], target: i0.ɵɵFactoryTarget.Component });
1743
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: GridComponent, isStandalone: true, selector: "vl-grid", inputs: { errorMessages: "errorMessages", environment: "environment", selectedLanguageInfo: "selectedLanguageInfo", tableitemInfo: "tableitemInfo", form: "form", isTableDataLoad: "isTableDataLoad", currenTableOptions: "currenTableOptions", projectSeleted: "projectSeleted", pageSize: "pageSize", currentPage: "currentPage", pages: "pages", userInfo: "userInfo" }, outputs: { onPageChange: "onPageChange", onPageSizeChange: "onPageSizeChange", onGridScroll: "onGridScroll", showGridLink: "showGridLink", gridButtonClick: "gridButtonClick", gridIncreamentClick: "gridIncreamentClick", gridDecreamentClick: "gridDecreamentClick", gridImgClick: "gridImgClick" }, usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"!tableitemInfo.data?.length\" class=\"alert alert-warning col-md-12\" role=\"alert\">\r\n {{ tableitemInfo.layoutSchema?.noRecordMessage}}\r\n</div>\r\n<div *ngIf=\"tableitemInfo.data?.length\" class=\"reservation-container pt-5 px-3\">\r\n <nz-table #basicTable [nzData]=\"tableitemInfo.data\" [nzBordered]=\"true\"\r\n [nzFrontPagination]=\"currenTableOptions?.pagination?.tabs\"\r\n [style]=\"getStyleWithoutClasses(currenTableOptions?.style).style\" (scroll)=\"onScrollEvent($event)\"\r\n [nzLoading]=\"isTableDataLoad\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let column of tableitemInfo.layoutSchema.elements\">{{ column?.label?.caption }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let data of tableitemInfo.data; let i = index\">\r\n <td *ngFor=\"let col of tableitemInfo.layoutSchema.elements\"\r\n [style]=\"getStyleWithoutClasses(col?.scope?.style).style\">\r\n <ng-container\r\n *ngIf=\"tableitemInfo.propertySchema[getScope(col.scope?.reference)] && tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.type === 'string'\"\r\n [class]=\"getStyleWithoutClasses(col?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(col?.scope?.style).style\">\r\n <span *ngIf=\"col.option.protected\">\r\n <span *ngIf=\"col.option?.link\" (click)=\"showLinkDetails(col.option, data)\">\r\n {{data[col.scope?.reference.split('/').pop()]}}\r\n </span>\r\n <span *ngIf=\"!col.option?.link\">\r\n <ng-container *ngIf=\"col?.option?.dateFormat; else string\">\r\n {{ data[col.scope?.reference.split('/').pop()] | date:'yyyy-MM-dd' }}\r\n </ng-container>\r\n <ng-template #string>\r\n {{ data[col.scope?.reference.split('/').pop()] }}\r\n </ng-template>\r\n </span>\r\n </span>\r\n <span *ngIf=\"!col.option.protected\">\r\n <input [(ngModel)]=\"data[col.scope?.reference.split('/').pop()]\"\r\n class=\"p-inputtext p-component\" />\r\n </span>\r\n </ng-container>\r\n\r\n <ng-container\r\n *ngIf=\"tableitemInfo.propertySchema[getScope(col.scope?.reference)] && tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.type === 'number'\">\r\n <span *ngIf=\"col.option.protected\">\r\n <span *ngIf=\"col.option?.innerAction?.action == 'multiply'\">\r\n {{\r\n (data[col.option?.innerAction?.from] * data[col.option?.innerAction?.to])\r\n | number:'1.2-2'\r\n }}\r\n </span>\r\n <span *ngIf=\"!col.option?.innerAction\">\r\n {{data[col.scope?.reference.split('/').pop()] | currency:\r\n tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.currency\r\n :true }}\r\n </span>\r\n </span>\r\n <span *ngIf=\"!col.option.protected\">\r\n <input [(ngModel)]=\"data[col.scope?.reference.split('/').pop()]\" type=\"number\"\r\n class=\"p-inputtext p-component\" />\r\n </span>\r\n </ng-container>\r\n\r\n <ng-container\r\n *ngIf=\"tableitemInfo.propertySchema[getScope(col.scope?.reference)] && tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.type === 'image'\">\r\n <img *ngIf=\"data[col.scope?.reference.split('/').pop()]\"\r\n [src]=\"data[col.scope?.reference.split('/').pop()]\" alt=\"Image\"\r\n (click)=\"invokeTableImageClick(col, data)\"\r\n [style]=\"getStyleWithoutClasses(col?.scope?.style).style\" />\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"!col?.scope?.reference\">\r\n <span *ngIf=\"col.option?.actionColumn\">\r\n <span nz-icon *ngIf=\"setActionColumn(col.option?.save, data)\" [nzType]=\"col.option?.save?.icon\" [nzTheme]=\"'twotone'\"\r\n [style]=\"col.option?.save?.style\" [nzTwotoneColor]=\"'#52c41a'\"\r\n [class]=\"col.option?.save?.style?.classes[0]\" (click)=\"upsertAction(col.option?.save, data)\">\r\n </span>\r\n <span nz-icon *ngIf=\"setActionColumn(col.option?.delete, data)\" [nzType]=\"col.option?.delete?.icon\" [nzTheme]=\"'twotone'\"\r\n [style]=\"col.option?.delete?.style\" [nzTwotoneColor]=\"'#FF0000'\"\r\n [class]=\"col.option?.delete?.style?.classes[0]\"\r\n (click)=\"upsertAction(col.option?.delete, data)\"></span>\r\n\r\n </span>\r\n <span *ngIf=\"!col.option?.actionColumn\">\r\n <button type=\"submit\" [style]=\"getStyleWithoutClasses(col?.label?.style).style\"\r\n (click)=\"invokeGridBtnClick(col.option, data)\" [class]=\"col?.label?.style?.classes[0]\">\r\n {{ col.label?.caption }}\r\n </button>\r\n </span>\r\n </ng-container>\r\n\r\n <!-- For quantity column, display increment/decrement buttons -->\r\n <ng-container\r\n *ngIf=\"tableitemInfo.propertySchema[getScope(col.scope?.reference)] && tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.type === 'quantity'\">\r\n <div style=\"display: flex; align-items: center;\">\r\n <button pButton icon=\"pi pi-minus\"\r\n (click)=\"decrementQuantity(i,col.scope?.reference.split('/').pop(), col.option)\"\r\n [disabled]=\"data.quantity <= 0\"\r\n style=\"margin-right: 8px; height: 10px; width: 10px;\"></button>\r\n <span>{{ data[col.scope?.reference.split('/').pop()] }}</span>\r\n <button pButton icon=\"pi pi-plus\"\r\n (click)=\"incrementQuantity(i, col.scope?.reference.split('/').pop(), col.option)\"\r\n style=\"margin-left: 8px; height: 10px; width: 10px;\"></button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </nz-table>\r\n</div>\r\n\r\n<!-- table footer -->\r\n<div *ngIf=\"tableitemInfo?.footer?.formFields && tableitemInfo.data?.length\"\r\n class=\"table-footer flex flex-column align-items-end gap-2 pt-2 mx-4 border-top-1 border-cyan-500\">\r\n <div *ngFor=\"let tableField of tableitemInfo?.footer?.formFields\">\r\n <div\r\n [ngSwitch]=\"tableField?.scope?.reference && tableitemInfo.propertySchema[getScope(tableField.scope?.reference)] && tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()] ?\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n\r\n <!-- string control -->\r\n <div *ngSwitchCase=\"'string'\" class=\"form-group\">\r\n <span *ngIf=\"tableField.option.protected\">\r\n <h5 style=\"display: flex; justify-content: space-between;\">\r\n <span [style]=\"getStyleWithoutClasses(tableField?.label?.style).style\"\r\n [class]=\"tableField?.label?.style?.classes[0]\">\r\n {{\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n </span>\r\n <span>\r\n {{\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.value\r\n }}\r\n </span>\r\n </h5>\r\n </span>\r\n <div *ngIf=\"!tableField.option.protected\">\r\n <div [class]=\"tableField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(tableField?.label?.style).style\"\r\n [class]=\"tableField?.label?.style?.classes[0]\">{{ tableField.label?.value ?\r\n tableField.label?.value :\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <input type=\"text\" #inputField=\"ngModel\" [required]=\"tableField.option.required\"\r\n [email]=\"tableField.option.email\" [class]=\"tableField.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(tableField?.scope?.style).style\"\r\n [(ngModel)]=\"tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"tableField.scope?.reference\"\r\n [placeholder]=\"tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.placeholder\" />\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"inputField?.touched && inputField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(tableField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"inputField?.errors?.['required']\">{{tableField.label?.value ?\r\n tableField.label?.value :\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n +\r\n ' ' + errorMessages.required}}</p>\r\n <p class=\"text-danger\" *ngIf=\"inputField?.errors?.['email']\">{{(tableField.label?.value ?\r\n tableField.label?.value :\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- number control -->\r\n <div *ngSwitchCase=\"'number'\" class=\"form-group\">\r\n <span *ngIf=\"tableField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(tableField?.label?.style).style\"\r\n [class]=\"tableField?.label?.style?.classes[0]\">\r\n <h5>{{\r\n form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n }} {{\r\n form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.value\r\n |\r\n currency:tableField.option.currency :true: tableField.option?.decimalPoint}}\r\n </h5>\r\n </span>\r\n <span *ngIf=\"!tableField.option.protected\">\r\n <div [class]=\"tableField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(tableField?.label?.style).style\"\r\n [class]=\"tableField?.label?.style?.classes[0]\">{{ tableField.label?.value ?\r\n tableField.label?.value :\r\n form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <input type=\"number\" [class]=\"tableField.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(tableField?.scope?.style).style\"\r\n [(ngModel)]=\"form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"tableField.scope?.reference\"\r\n [placeholder]=\"form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.placeholder\" />\r\n </div>\r\n </span>\r\n </div>\r\n\r\n <!-- button control -->\r\n <div *ngSwitchCase=\"'default'\">\r\n <button type=\"submit\" [style]=\"getStyleWithoutClasses(tableField.label.style).style\"\r\n (click)=\"invokeGridBtnClick(tableField.option, tableitemInfo.propertySchema)\">\r\n {{ tableField.label?.caption }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- bottom pagination on grid -->\r\n<div\r\n *ngIf=\"tableitemInfo.data?.length && !tableitemInfo?.layoutSchema?.pagination?.top && tableitemInfo?.layoutSchema?.pagination?.bottom\">\r\n <vl-pagination [itemInfo]=\"tableitemInfo\" [pageSize]=\"pageSize\" [currentPage]=\"currentPage\" [pages]=\"pages\"\r\n (pageSizeChange)=\"invokeOnPageSizeChange($event)\" (onGoToPage)=\"invokeGoToPage($event)\">\r\n </vl-pagination>\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "ngmodule", type: FormsModule }, { 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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.EmailValidator, selector: "[email][formControlName],[email][formControl],[email][ngModel]", inputs: ["email"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: NzTableModule }, { kind: "component", type: i7.NzTableComponent, selector: "nz-table", inputs: ["nzTableLayout", "nzShowTotal", "nzItemRender", "nzTitle", "nzFooter", "nzNoResult", "nzPageSizeOptions", "nzVirtualItemSize", "nzVirtualMaxBufferPx", "nzVirtualMinBufferPx", "nzVirtualForTrackBy", "nzLoadingDelay", "nzPageIndex", "nzPageSize", "nzTotal", "nzWidthConfig", "nzData", "nzCustomColumn", "nzPaginationPosition", "nzScroll", "noDataVirtualHeight", "nzPaginationType", "nzFrontPagination", "nzTemplateMode", "nzShowPagination", "nzLoading", "nzOuterBordered", "nzLoadingIndicator", "nzBordered", "nzSize", "nzShowSizeChanger", "nzHideOnSinglePage", "nzShowQuickJumper", "nzSimple"], outputs: ["nzPageSizeChange", "nzPageIndexChange", "nzQueryParams", "nzCurrentPageDataChange", "nzCustomColumnChange"], exportAs: ["nzTable"] }, { kind: "directive", type: i7.NzTableCellDirective, selector: "th:not(.nz-disable-th), td:not(.nz-disable-td)" }, { kind: "directive", type: i7.NzThMeasureDirective, selector: "th", inputs: ["nzWidth", "colspan", "colSpan", "rowspan", "rowSpan"] }, { kind: "component", type: i7.NzTheadComponent, selector: "thead:not(.ant-table-thead)", outputs: ["nzSortOrderChange"] }, { kind: "component", type: i7.NzTbodyComponent, selector: "tbody" }, { kind: "directive", type: i7.NzTrDirective, selector: "tr:not([nz-table-measure-row]):not([nzExpand]):not([nz-table-fixed-row])" }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i9.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i9$1.ButtonDirective, selector: "[pButton]", inputs: ["ptButtonDirective", "pButtonPT", "pButtonUnstyled", "hostName", "text", "plain", "raised", "size", "outlined", "rounded", "iconPos", "loadingIcon", "fluid", "label", "icon", "loading", "buttonProps", "severity"] }, { kind: "component", type: PaginationComponent, selector: "vl-pagination", inputs: ["itemInfo", "pageSize", "currentPage", "pages"], outputs: ["pageSizeChange", "onGoToPage"] }, { kind: "pipe", type: i5.DecimalPipe, name: "number" }, { kind: "pipe", type: i5.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i5.DatePipe, name: "date" }] });
1744
+ }
1745
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: GridComponent, decorators: [{
1746
+ type: Component,
1747
+ args: [{ standalone: true, imports: [
1748
+ CommonModule,
1749
+ FormsModule,
1750
+ NzTableModule,
1751
+ NzIconModule,
1752
+ ButtonModule,
1753
+ PaginationComponent
1754
+ ], selector: 'vl-grid', template: "<div *ngIf=\"!tableitemInfo.data?.length\" class=\"alert alert-warning col-md-12\" role=\"alert\">\r\n {{ tableitemInfo.layoutSchema?.noRecordMessage}}\r\n</div>\r\n<div *ngIf=\"tableitemInfo.data?.length\" class=\"reservation-container pt-5 px-3\">\r\n <nz-table #basicTable [nzData]=\"tableitemInfo.data\" [nzBordered]=\"true\"\r\n [nzFrontPagination]=\"currenTableOptions?.pagination?.tabs\"\r\n [style]=\"getStyleWithoutClasses(currenTableOptions?.style).style\" (scroll)=\"onScrollEvent($event)\"\r\n [nzLoading]=\"isTableDataLoad\">\r\n <thead>\r\n <tr>\r\n <th *ngFor=\"let column of tableitemInfo.layoutSchema.elements\">{{ column?.label?.caption }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr *ngFor=\"let data of tableitemInfo.data; let i = index\">\r\n <td *ngFor=\"let col of tableitemInfo.layoutSchema.elements\"\r\n [style]=\"getStyleWithoutClasses(col?.scope?.style).style\">\r\n <ng-container\r\n *ngIf=\"tableitemInfo.propertySchema[getScope(col.scope?.reference)] && tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.type === 'string'\"\r\n [class]=\"getStyleWithoutClasses(col?.scope?.style).classes\"\r\n [style]=\"getStyleWithoutClasses(col?.scope?.style).style\">\r\n <span *ngIf=\"col.option.protected\">\r\n <span *ngIf=\"col.option?.link\" (click)=\"showLinkDetails(col.option, data)\">\r\n {{data[col.scope?.reference.split('/').pop()]}}\r\n </span>\r\n <span *ngIf=\"!col.option?.link\">\r\n <ng-container *ngIf=\"col?.option?.dateFormat; else string\">\r\n {{ data[col.scope?.reference.split('/').pop()] | date:'yyyy-MM-dd' }}\r\n </ng-container>\r\n <ng-template #string>\r\n {{ data[col.scope?.reference.split('/').pop()] }}\r\n </ng-template>\r\n </span>\r\n </span>\r\n <span *ngIf=\"!col.option.protected\">\r\n <input [(ngModel)]=\"data[col.scope?.reference.split('/').pop()]\"\r\n class=\"p-inputtext p-component\" />\r\n </span>\r\n </ng-container>\r\n\r\n <ng-container\r\n *ngIf=\"tableitemInfo.propertySchema[getScope(col.scope?.reference)] && tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.type === 'number'\">\r\n <span *ngIf=\"col.option.protected\">\r\n <span *ngIf=\"col.option?.innerAction?.action == 'multiply'\">\r\n {{\r\n (data[col.option?.innerAction?.from] * data[col.option?.innerAction?.to])\r\n | number:'1.2-2'\r\n }}\r\n </span>\r\n <span *ngIf=\"!col.option?.innerAction\">\r\n {{data[col.scope?.reference.split('/').pop()] | currency:\r\n tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.currency\r\n :true }}\r\n </span>\r\n </span>\r\n <span *ngIf=\"!col.option.protected\">\r\n <input [(ngModel)]=\"data[col.scope?.reference.split('/').pop()]\" type=\"number\"\r\n class=\"p-inputtext p-component\" />\r\n </span>\r\n </ng-container>\r\n\r\n <ng-container\r\n *ngIf=\"tableitemInfo.propertySchema[getScope(col.scope?.reference)] && tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.type === 'image'\">\r\n <img *ngIf=\"data[col.scope?.reference.split('/').pop()]\"\r\n [src]=\"data[col.scope?.reference.split('/').pop()]\" alt=\"Image\"\r\n (click)=\"invokeTableImageClick(col, data)\"\r\n [style]=\"getStyleWithoutClasses(col?.scope?.style).style\" />\r\n </ng-container>\r\n\r\n <ng-container *ngIf=\"!col?.scope?.reference\">\r\n <span *ngIf=\"col.option?.actionColumn\">\r\n <span nz-icon *ngIf=\"setActionColumn(col.option?.save, data)\" [nzType]=\"col.option?.save?.icon\" [nzTheme]=\"'twotone'\"\r\n [style]=\"col.option?.save?.style\" [nzTwotoneColor]=\"'#52c41a'\"\r\n [class]=\"col.option?.save?.style?.classes[0]\" (click)=\"upsertAction(col.option?.save, data)\">\r\n </span>\r\n <span nz-icon *ngIf=\"setActionColumn(col.option?.delete, data)\" [nzType]=\"col.option?.delete?.icon\" [nzTheme]=\"'twotone'\"\r\n [style]=\"col.option?.delete?.style\" [nzTwotoneColor]=\"'#FF0000'\"\r\n [class]=\"col.option?.delete?.style?.classes[0]\"\r\n (click)=\"upsertAction(col.option?.delete, data)\"></span>\r\n\r\n </span>\r\n <span *ngIf=\"!col.option?.actionColumn\">\r\n <button type=\"submit\" [style]=\"getStyleWithoutClasses(col?.label?.style).style\"\r\n (click)=\"invokeGridBtnClick(col.option, data)\" [class]=\"col?.label?.style?.classes[0]\">\r\n {{ col.label?.caption }}\r\n </button>\r\n </span>\r\n </ng-container>\r\n\r\n <!-- For quantity column, display increment/decrement buttons -->\r\n <ng-container\r\n *ngIf=\"tableitemInfo.propertySchema[getScope(col.scope?.reference)] && tableitemInfo.propertySchema[getScope(col.scope?.reference)][col?.scope?.reference?.split('/').pop()]?.type === 'quantity'\">\r\n <div style=\"display: flex; align-items: center;\">\r\n <button pButton icon=\"pi pi-minus\"\r\n (click)=\"decrementQuantity(i,col.scope?.reference.split('/').pop(), col.option)\"\r\n [disabled]=\"data.quantity <= 0\"\r\n style=\"margin-right: 8px; height: 10px; width: 10px;\"></button>\r\n <span>{{ data[col.scope?.reference.split('/').pop()] }}</span>\r\n <button pButton icon=\"pi pi-plus\"\r\n (click)=\"incrementQuantity(i, col.scope?.reference.split('/').pop(), col.option)\"\r\n style=\"margin-left: 8px; height: 10px; width: 10px;\"></button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </nz-table>\r\n</div>\r\n\r\n<!-- table footer -->\r\n<div *ngIf=\"tableitemInfo?.footer?.formFields && tableitemInfo.data?.length\"\r\n class=\"table-footer flex flex-column align-items-end gap-2 pt-2 mx-4 border-top-1 border-cyan-500\">\r\n <div *ngFor=\"let tableField of tableitemInfo?.footer?.formFields\">\r\n <div\r\n [ngSwitch]=\"tableField?.scope?.reference && tableitemInfo.propertySchema[getScope(tableField.scope?.reference)] && tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()] ?\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n\r\n <!-- string control -->\r\n <div *ngSwitchCase=\"'string'\" class=\"form-group\">\r\n <span *ngIf=\"tableField.option.protected\">\r\n <h5 style=\"display: flex; justify-content: space-between;\">\r\n <span [style]=\"getStyleWithoutClasses(tableField?.label?.style).style\"\r\n [class]=\"tableField?.label?.style?.classes[0]\">\r\n {{\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n </span>\r\n <span>\r\n {{\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.value\r\n }}\r\n </span>\r\n </h5>\r\n </span>\r\n <div *ngIf=\"!tableField.option.protected\">\r\n <div [class]=\"tableField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(tableField?.label?.style).style\"\r\n [class]=\"tableField?.label?.style?.classes[0]\">{{ tableField.label?.value ?\r\n tableField.label?.value :\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <input type=\"text\" #inputField=\"ngModel\" [required]=\"tableField.option.required\"\r\n [email]=\"tableField.option.email\" [class]=\"tableField.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(tableField?.scope?.style).style\"\r\n [(ngModel)]=\"tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"tableField.scope?.reference\"\r\n [placeholder]=\"tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.placeholder\" />\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"inputField?.touched && inputField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(tableField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"inputField?.errors?.['required']\">{{tableField.label?.value ?\r\n tableField.label?.value :\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n +\r\n ' ' + errorMessages.required}}</p>\r\n <p class=\"text-danger\" *ngIf=\"inputField?.errors?.['email']\">{{(tableField.label?.value ?\r\n tableField.label?.value :\r\n tableitemInfo.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- number control -->\r\n <div *ngSwitchCase=\"'number'\" class=\"form-group\">\r\n <span *ngIf=\"tableField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(tableField?.label?.style).style\"\r\n [class]=\"tableField?.label?.style?.classes[0]\">\r\n <h5>{{\r\n form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n }} {{\r\n form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.value\r\n |\r\n currency:tableField.option.currency :true: tableField.option?.decimalPoint}}\r\n </h5>\r\n </span>\r\n <span *ngIf=\"!tableField.option.protected\">\r\n <div [class]=\"tableField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(tableField?.label?.style).style\"\r\n [class]=\"tableField?.label?.style?.classes[0]\">{{ tableField.label?.value ?\r\n tableField.label?.value :\r\n form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <input type=\"number\" [class]=\"tableField.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(tableField?.scope?.style).style\"\r\n [(ngModel)]=\"form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"tableField.scope?.reference\"\r\n [placeholder]=\"form.propertySchema[getScope(tableField.scope?.reference)][tableField.scope?.reference.split('/').pop()]?.placeholder\" />\r\n </div>\r\n </span>\r\n </div>\r\n\r\n <!-- button control -->\r\n <div *ngSwitchCase=\"'default'\">\r\n <button type=\"submit\" [style]=\"getStyleWithoutClasses(tableField.label.style).style\"\r\n (click)=\"invokeGridBtnClick(tableField.option, tableitemInfo.propertySchema)\">\r\n {{ tableField.label?.caption }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- bottom pagination on grid -->\r\n<div\r\n *ngIf=\"tableitemInfo.data?.length && !tableitemInfo?.layoutSchema?.pagination?.top && tableitemInfo?.layoutSchema?.pagination?.bottom\">\r\n <vl-pagination [itemInfo]=\"tableitemInfo\" [pageSize]=\"pageSize\" [currentPage]=\"currentPage\" [pages]=\"pages\"\r\n (pageSizeChange)=\"invokeOnPageSizeChange($event)\" (onGoToPage)=\"invokeGoToPage($event)\">\r\n </vl-pagination>\r\n</div>" }]
1755
+ }], ctorParameters: () => [{ type: RequestService }, { type: UtilityService }, { type: NotificationService }, { type: i4$1.OktaAuthStateService }], propDecorators: { errorMessages: [{
1756
+ type: Input
1757
+ }], environment: [{
1758
+ type: Input
1759
+ }], selectedLanguageInfo: [{
1760
+ type: Input
1761
+ }], tableitemInfo: [{
1762
+ type: Input
1763
+ }], form: [{
1764
+ type: Input
1765
+ }], isTableDataLoad: [{
1766
+ type: Input
1767
+ }], currenTableOptions: [{
1768
+ type: Input
1769
+ }], projectSeleted: [{
1770
+ type: Input
1771
+ }], pageSize: [{
1772
+ type: Input
1773
+ }], currentPage: [{
1774
+ type: Input
1775
+ }], pages: [{
1776
+ type: Input
1777
+ }], userInfo: [{
1778
+ type: Input
1779
+ }], onPageChange: [{
1780
+ type: Output
1781
+ }], onPageSizeChange: [{
1782
+ type: Output
1783
+ }], onGridScroll: [{
1784
+ type: Output
1785
+ }], showGridLink: [{
1786
+ type: Output
1787
+ }], gridButtonClick: [{
1788
+ type: Output
1789
+ }], gridIncreamentClick: [{
1790
+ type: Output
1791
+ }], gridDecreamentClick: [{
1792
+ type: Output
1793
+ }], gridImgClick: [{
1794
+ type: Output
1795
+ }] } });
1796
+
1797
+ class HeaderMenuComponent {
1798
+ oktaAuthService;
1799
+ requestService;
1800
+ utilityService;
1801
+ platform;
1802
+ isLogined = false;
1803
+ headerItems = [];
1804
+ headerLayout = {};
1805
+ environment;
1806
+ projectSeleted;
1807
+ cartInfo = {
1808
+ items: [],
1809
+ totalPrice: 0,
1810
+ quantity: 0
1811
+ };
1812
+ buttonClick = new EventEmitter();
1813
+ showTableContent = new EventEmitter();
1814
+ searchItems = new EventEmitter();
1815
+ constructor(oktaAuthService, requestService, utilityService, platform) {
1816
+ this.oktaAuthService = oktaAuthService;
1817
+ this.requestService = requestService;
1818
+ this.utilityService = utilityService;
1819
+ this.platform = platform;
1820
+ }
1821
+ ngAfterViewInit() {
1822
+ setTimeout(() => {
1823
+ if (this.environment && this.environment?.login && this.environment?.login?.type == "oktaAuth") {
1824
+ if (this.platform.ANDROID || this.platform.IOS) {
1825
+ this.utilityService.getLocalStorage(`loginedUser`).then((logined) => {
1826
+ if (logined && logined.token) {
1827
+ this.requestService.getLoginUser(logined?.token).subscribe(() => {
1828
+ this.isLogined = true;
1829
+ });
1830
+ }
1831
+ });
1832
+ }
1833
+ this.oktaAuthService.authState$.subscribe((result) => {
1834
+ if (result.isAuthenticated) {
1835
+ this.isLogined = true;
1836
+ }
1837
+ });
1838
+ }
1839
+ }, 500);
1840
+ }
1841
+ getStyle(styleObject) {
1842
+ if (!styleObject || typeof styleObject !== 'object') {
1843
+ return {};
1844
+ }
1845
+ const { classes, ...styleWithoutClasses } = styleObject;
1846
+ return styleWithoutClasses;
1847
+ }
1848
+ isVisible(header) {
1849
+ return header?.option?.visible !== false;
1850
+ }
1851
+ shouldShowDefaultButton(header) {
1852
+ if (!this.isVisible(header)) {
1853
+ return false;
1854
+ }
1855
+ if (header?.option?.islogin === true) {
1856
+ return this.isLogined;
1857
+ }
1858
+ if (header?.option?.islogin === false) {
1859
+ return !this.isLogined;
1860
+ }
1861
+ return true;
1862
+ }
1863
+ invokeSearchedItems(option, search) {
1864
+ this.searchItems.emit({ option: option, search: search });
1865
+ }
1866
+ invokeHeaderButtonClick(option) {
1867
+ this.buttonClick.emit(option);
1868
+ }
1869
+ invokeShowtableContent(option) {
1870
+ this.showTableContent.emit(option);
1871
+ }
1872
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HeaderMenuComponent, deps: [{ token: i4$1.OktaAuthStateService }, { token: RequestService }, { token: UtilityService }, { token: i1.Platform }], target: i0.ɵɵFactoryTarget.Component });
1873
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HeaderMenuComponent, isStandalone: true, selector: "vl-header-menu", inputs: { headerItems: "headerItems", headerLayout: "headerLayout", environment: "environment", projectSeleted: "projectSeleted", cartInfo: "cartInfo" }, outputs: { buttonClick: "buttonClick", showTableContent: "showTableContent", searchItems: "searchItems" }, ngImport: i0, template: "<header *ngIf=\"headerItems.length > 0\" [ngStyle]=\"getStyle(headerLayout?.style)\">\r\n\r\n <ng-container *ngFor=\"let header of headerItems\"\r\n [ngSwitch]=\"header.scope?.reference ? header.scope?.reference.split('/').pop() : 'default'\">\r\n\r\n <!-- Logo -->\r\n <ng-container *ngSwitchCase=\"'logo'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <img [src]=\"header.option.src\" [alt]=\"header.alt || 'Logo'\"\r\n [ngStyle]=\"getStyle(header?.scope?.style)\" />\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Search -->\r\n <ng-container *ngSwitchCase=\"'searchInput'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <input #search type=\"text\" [placeholder]=\"header.option.placeholder\"\r\n (keyup.enter)=\"invokeSearchedItems(header.option, search)\"\r\n [ngStyle]=\"getStyle(header?.scope?.style)\" />\r\n\r\n <button *ngIf=\"header.option.button !== false\" type=\"button\"\r\n (click)=\"invokeSearchedItems(header.option, search)\" [ngStyle]=\"getStyle(header?.buttonStyle)\">\r\n <ng-container *ngIf=\"!header.caption; else searchTextContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n\r\n <ng-template #searchTextContent>\r\n {{ header.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Cart -->\r\n <ng-container *ngSwitchCase=\"'cart'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\"\r\n (click)=\"invokeShowtableContent(header.option)\">\r\n\r\n <span [ngStyle]=\"getStyle(header?.priceStyle)\">\r\n {{ cartInfo.totalPrice | currency : header.option?.currency ? header.option.currency : 'USD' }}\r\n </span>\r\n\r\n <span [ngStyle]=\"getStyle(header?.quantityStyle)\">\r\n {{ cartInfo.quantity }}\r\n </span>\r\n\r\n <i [class]=\"header.icon\" [ngStyle]=\"getStyle(header?.iconStyle)\">\r\n </i>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Default Button -->\r\n <ng-container *ngSwitchCase=\"'default'\">\r\n <div *ngIf=\"shouldShowDefaultButton(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <button type=\"button\" (click)=\"invokeHeaderButtonClick(header.option)\"\r\n [ngStyle]=\"getStyle(header?.buttonStyle)\">\r\n <ng-container *ngIf=\"!header.label; else buttonTextContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n\r\n <ng-template #buttonTextContent>\r\n {{ header.label }}\r\n </ng-template>\r\n </button> \r\n </div>\r\n </ng-container>\r\n\r\n </ng-container>\r\n</header>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i9.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "pipe", type: i5.CurrencyPipe, name: "currency" }] });
1874
+ }
1875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HeaderMenuComponent, decorators: [{
1876
+ type: Component,
1877
+ args: [{ standalone: true, imports: [
1878
+ CommonModule,
1879
+ NzIconModule
1880
+ ], selector: 'vl-header-menu', template: "<header *ngIf=\"headerItems.length > 0\" [ngStyle]=\"getStyle(headerLayout?.style)\">\r\n\r\n <ng-container *ngFor=\"let header of headerItems\"\r\n [ngSwitch]=\"header.scope?.reference ? header.scope?.reference.split('/').pop() : 'default'\">\r\n\r\n <!-- Logo -->\r\n <ng-container *ngSwitchCase=\"'logo'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <img [src]=\"header.option.src\" [alt]=\"header.alt || 'Logo'\"\r\n [ngStyle]=\"getStyle(header?.scope?.style)\" />\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Search -->\r\n <ng-container *ngSwitchCase=\"'searchInput'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <input #search type=\"text\" [placeholder]=\"header.option.placeholder\"\r\n (keyup.enter)=\"invokeSearchedItems(header.option, search)\"\r\n [ngStyle]=\"getStyle(header?.scope?.style)\" />\r\n\r\n <button *ngIf=\"header.option.button !== false\" type=\"button\"\r\n (click)=\"invokeSearchedItems(header.option, search)\" [ngStyle]=\"getStyle(header?.buttonStyle)\">\r\n <ng-container *ngIf=\"!header.caption; else searchTextContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n\r\n <ng-template #searchTextContent>\r\n {{ header.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Cart -->\r\n <ng-container *ngSwitchCase=\"'cart'\">\r\n <div *ngIf=\"isVisible(header)\" [ngStyle]=\"getStyle(header?.option?.style)\"\r\n (click)=\"invokeShowtableContent(header.option)\">\r\n\r\n <span [ngStyle]=\"getStyle(header?.priceStyle)\">\r\n {{ cartInfo.totalPrice | currency : header.option?.currency ? header.option.currency : 'USD' }}\r\n </span>\r\n\r\n <span [ngStyle]=\"getStyle(header?.quantityStyle)\">\r\n {{ cartInfo.quantity }}\r\n </span>\r\n\r\n <i [class]=\"header.icon\" [ngStyle]=\"getStyle(header?.iconStyle)\">\r\n </i>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- Default Button -->\r\n <ng-container *ngSwitchCase=\"'default'\">\r\n <div *ngIf=\"shouldShowDefaultButton(header)\" [ngStyle]=\"getStyle(header?.option?.style)\">\r\n\r\n <button type=\"button\" (click)=\"invokeHeaderButtonClick(header.option)\"\r\n [ngStyle]=\"getStyle(header?.buttonStyle)\">\r\n <ng-container *ngIf=\"!header.label; else buttonTextContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n\r\n <ng-template #buttonTextContent>\r\n {{ header.label }}\r\n </ng-template>\r\n </button> \r\n </div>\r\n </ng-container>\r\n\r\n </ng-container>\r\n</header>" }]
1881
+ }], ctorParameters: () => [{ type: i4$1.OktaAuthStateService }, { type: RequestService }, { type: UtilityService }, { type: i1.Platform }], propDecorators: { headerItems: [{
1882
+ type: Input
1883
+ }], headerLayout: [{
1884
+ type: Input
1885
+ }], environment: [{
1886
+ type: Input
1887
+ }], projectSeleted: [{
1888
+ type: Input
1889
+ }], cartInfo: [{
1890
+ type: Input
1891
+ }], buttonClick: [{
1892
+ type: Output
1893
+ }], showTableContent: [{
1894
+ type: Output
1895
+ }], searchItems: [{
1896
+ type: Output
1897
+ }] } });
1898
+
1899
+ class NetworkLogService {
1900
+ logs = [];
1901
+ addLog(log) {
1902
+ this.logs.unshift(log); // latest first
1903
+ localStorage.setItem('networkLogs', JSON.stringify(this.logs));
1904
+ }
1905
+ getLogsByDate(date) {
1906
+ return this.logs.filter(l => l.date === date);
1907
+ }
1908
+ getAll() {
1909
+ return [...this.logs];
1910
+ }
1911
+ clear() {
1912
+ this.logs = [];
1913
+ localStorage.removeItem('networkLogs');
1914
+ }
1915
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NetworkLogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1916
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NetworkLogService, providedIn: 'root' });
1917
+ }
1918
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NetworkLogService, decorators: [{
1919
+ type: Injectable,
1920
+ args: [{
1921
+ providedIn: 'root'
1922
+ }]
1923
+ }] });
1924
+
1925
+ class LogsComponent {
1926
+ logService;
1927
+ logs = [];
1928
+ expandedRow = null;
1929
+ constructor(logService) {
1930
+ this.logService = logService;
1931
+ }
1932
+ ngOnInit() {
1933
+ const today = new Date().toISOString().split('T')[0];
1934
+ this.logs = this.logService.getLogsByDate(today);
1935
+ console.log('this.logs: ', this.logs);
1936
+ }
1937
+ toggleRow(index) {
1938
+ this.expandedRow = this.expandedRow === index ? null : index;
1939
+ }
1940
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: LogsComponent, deps: [{ token: NetworkLogService }], target: i0.ɵɵFactoryTarget.Component });
1941
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: LogsComponent, isStandalone: true, selector: "vl-logs", ngImport: i0, template: "<div class=\"network-log-wrapper\">\r\n\r\n <div class=\"network-log-table\">\r\n <table>\r\n <thead>\r\n <tr>\r\n <th>#</th>\r\n <th>Time</th>\r\n <th>Method</th>\r\n <th>URL</th>\r\n <th>Status</th>\r\n <th>Duration (ms)</th>\r\n <th>Size (KB)</th>\r\n </tr>\r\n </thead>\r\n\r\n <tbody>\r\n <ng-container *ngFor=\"let log of logs; let i = index\">\r\n\r\n <!-- MAIN ROW -->\r\n <tr class=\"log-row\" (click)=\"toggleRow(i)\">\r\n <td>{{ i + 1 }}</td>\r\n <td>{{ log.time }}</td>\r\n\r\n <td>\r\n <span class=\"method\" [class.get]=\"log.method === 'GET'\" [class.post]=\"log.method === 'POST'\"\r\n [class.put]=\"log.method === 'PUT'\" [class.delete]=\"log.method === 'DELETE'\">\r\n {{ log.method }}\r\n </span>\r\n </td>\r\n\r\n <td class=\"ellipsis\" [title]=\"log.url\">\r\n {{ log.url }}\r\n </td>\r\n\r\n <td [class.error]=\"log.status >= 400\">\r\n {{ log.status }}\r\n </td>\r\n\r\n <td>{{ log.duration }}</td>\r\n\r\n <td>{{ log.size | number:'1.0-2' }}</td>\r\n </tr>\r\n\r\n <!-- DETAILS ROW -->\r\n <tr *ngIf=\"expandedRow === i\" class=\"details-row\">\r\n <td colspan=\"7\">\r\n <div class=\"details-container\">\r\n\r\n <!-- META -->\r\n <div class=\"detail-block\">\r\n <h4>Meta</h4>\r\n <p><strong>Date:</strong> {{ log.date }}</p>\r\n <p><strong>Type:</strong> {{ log.type }}</p>\r\n </div>\r\n\r\n <!-- REQUEST -->\r\n <div class=\"detail-block\">\r\n <h4>Request</h4>\r\n <p><strong>Headers</strong></p>\r\n <pre>{{ log.requestHeaders | json }}</pre>\r\n\r\n <p><strong>Body</strong></p>\r\n <pre>{{ log.requestBody | json }}</pre>\r\n </div>\r\n\r\n <!-- RESPONSE -->\r\n <div class=\"detail-block\">\r\n <h4>Response</h4>\r\n <pre>{{ log.responseBody | json }}</pre>\r\n </div>\r\n\r\n <!-- PERFORMANCE -->\r\n <div class=\"detail-block\">\r\n <h4>Performance</h4>\r\n <p><strong>Duration:</strong> {{ log.duration }} ms</p>\r\n <p><strong>Size:</strong> {{ log.size | number:'1.0-2' }} KB</p>\r\n </div>\r\n\r\n </div>\r\n </td>\r\n </tr>\r\n\r\n </ng-container>\r\n </tbody>\r\n </table>\r\n </div>\r\n\r\n</div>", styles: [".network-log-wrapper{padding:12px}.network-log-table{width:100%;overflow-x:auto}table{width:100%;border-collapse:collapse;font-size:13px;min-width:900px}thead th{background:#06b6d4;color:#fff;padding:8px;text-align:left;position:sticky;top:0;z-index:2}tbody td{padding:8px;border-bottom:1px solid #e5e7eb}.log-row{cursor:pointer}.log-row:hover{background:#f1f5f9}.details-row{background:#f8fafc}.method{padding:2px 8px;border-radius:4px;font-weight:600;font-size:11px;color:#fff}.method.get{background:#16a34a}.method.post{background:#2563eb}.method.put{background:#d97706}.method.delete{background:#dc2626}td.error{color:#dc2626;font-weight:700}.ellipsis{max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.details-container{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.detail-block{background:#fff;border:1px solid #e5e7eb;border-radius:6px;padding:10px}.detail-block h4{margin:0 0 6px;font-size:14px;color:#0f172a}pre{background:#020617;color:#e5e7eb;padding:8px;border-radius:6px;max-height:260px;overflow:auto;font-size:12px;white-space:pre-wrap;word-break:break-word}@media(max-width:768px){table{min-width:100%;font-size:12px}.ellipsis{max-width:140px}.details-container{grid-template-columns:1fr}pre{max-height:200px}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i5.JsonPipe, name: "json" }, { kind: "pipe", type: i5.DecimalPipe, name: "number" }] });
1942
+ }
1943
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: LogsComponent, decorators: [{
1944
+ type: Component,
1945
+ args: [{ standalone: true, imports: [
1946
+ CommonModule
1947
+ ], selector: 'vl-logs', template: "<div class=\"network-log-wrapper\">\r\n\r\n <div class=\"network-log-table\">\r\n <table>\r\n <thead>\r\n <tr>\r\n <th>#</th>\r\n <th>Time</th>\r\n <th>Method</th>\r\n <th>URL</th>\r\n <th>Status</th>\r\n <th>Duration (ms)</th>\r\n <th>Size (KB)</th>\r\n </tr>\r\n </thead>\r\n\r\n <tbody>\r\n <ng-container *ngFor=\"let log of logs; let i = index\">\r\n\r\n <!-- MAIN ROW -->\r\n <tr class=\"log-row\" (click)=\"toggleRow(i)\">\r\n <td>{{ i + 1 }}</td>\r\n <td>{{ log.time }}</td>\r\n\r\n <td>\r\n <span class=\"method\" [class.get]=\"log.method === 'GET'\" [class.post]=\"log.method === 'POST'\"\r\n [class.put]=\"log.method === 'PUT'\" [class.delete]=\"log.method === 'DELETE'\">\r\n {{ log.method }}\r\n </span>\r\n </td>\r\n\r\n <td class=\"ellipsis\" [title]=\"log.url\">\r\n {{ log.url }}\r\n </td>\r\n\r\n <td [class.error]=\"log.status >= 400\">\r\n {{ log.status }}\r\n </td>\r\n\r\n <td>{{ log.duration }}</td>\r\n\r\n <td>{{ log.size | number:'1.0-2' }}</td>\r\n </tr>\r\n\r\n <!-- DETAILS ROW -->\r\n <tr *ngIf=\"expandedRow === i\" class=\"details-row\">\r\n <td colspan=\"7\">\r\n <div class=\"details-container\">\r\n\r\n <!-- META -->\r\n <div class=\"detail-block\">\r\n <h4>Meta</h4>\r\n <p><strong>Date:</strong> {{ log.date }}</p>\r\n <p><strong>Type:</strong> {{ log.type }}</p>\r\n </div>\r\n\r\n <!-- REQUEST -->\r\n <div class=\"detail-block\">\r\n <h4>Request</h4>\r\n <p><strong>Headers</strong></p>\r\n <pre>{{ log.requestHeaders | json }}</pre>\r\n\r\n <p><strong>Body</strong></p>\r\n <pre>{{ log.requestBody | json }}</pre>\r\n </div>\r\n\r\n <!-- RESPONSE -->\r\n <div class=\"detail-block\">\r\n <h4>Response</h4>\r\n <pre>{{ log.responseBody | json }}</pre>\r\n </div>\r\n\r\n <!-- PERFORMANCE -->\r\n <div class=\"detail-block\">\r\n <h4>Performance</h4>\r\n <p><strong>Duration:</strong> {{ log.duration }} ms</p>\r\n <p><strong>Size:</strong> {{ log.size | number:'1.0-2' }} KB</p>\r\n </div>\r\n\r\n </div>\r\n </td>\r\n </tr>\r\n\r\n </ng-container>\r\n </tbody>\r\n </table>\r\n </div>\r\n\r\n</div>", styles: [".network-log-wrapper{padding:12px}.network-log-table{width:100%;overflow-x:auto}table{width:100%;border-collapse:collapse;font-size:13px;min-width:900px}thead th{background:#06b6d4;color:#fff;padding:8px;text-align:left;position:sticky;top:0;z-index:2}tbody td{padding:8px;border-bottom:1px solid #e5e7eb}.log-row{cursor:pointer}.log-row:hover{background:#f1f5f9}.details-row{background:#f8fafc}.method{padding:2px 8px;border-radius:4px;font-weight:600;font-size:11px;color:#fff}.method.get{background:#16a34a}.method.post{background:#2563eb}.method.put{background:#d97706}.method.delete{background:#dc2626}td.error{color:#dc2626;font-weight:700}.ellipsis{max-width:320px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.details-container{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.detail-block{background:#fff;border:1px solid #e5e7eb;border-radius:6px;padding:10px}.detail-block h4{margin:0 0 6px;font-size:14px;color:#0f172a}pre{background:#020617;color:#e5e7eb;padding:8px;border-radius:6px;max-height:260px;overflow:auto;font-size:12px;white-space:pre-wrap;word-break:break-word}@media(max-width:768px){table{min-width:100%;font-size:12px}.ellipsis{max-width:140px}.details-container{grid-template-columns:1fr}pre{max-height:200px}}\n"] }]
1948
+ }], ctorParameters: () => [{ type: NetworkLogService }] });
1949
+
1950
+ class Label {
1951
+ formField;
1952
+ modalItemInfo;
1953
+ getScope(scope) {
1954
+ let propertyScope = "";
1955
+ let start = scope?.indexOf("#/") + 2;
1956
+ let end = scope?.indexOf("/", start);
1957
+ if (start && end) {
1958
+ propertyScope = scope.substring(start, end);
1959
+ }
1960
+ return propertyScope;
1961
+ }
1962
+ getStyleWithoutClasses(styleObject) {
1963
+ if (!styleObject) {
1964
+ return { classes: '', style: {} };
1965
+ }
1966
+ const { classes, ...styleWithoutClasses } = styleObject;
1967
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1968
+ }
1969
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Label, deps: [], target: i0.ɵɵFactoryTarget.Component });
1970
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Label, isStandalone: true, selector: "vl-label", inputs: { formField: "formField", modalItemInfo: "modalItemInfo" }, ngImport: i0, template: "<label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\" [class]=\"formField?.label?.style?.classes[0]\">{{\r\n formField.label?.value\r\n ?\r\n formField.label?.value : formField.label?.caption ?\r\n formField.label?.caption :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>", styles: [""] });
1971
+ }
1972
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Label, decorators: [{
1973
+ type: Component,
1974
+ args: [{ selector: 'vl-label', standalone: true, template: "<label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\" [class]=\"formField?.label?.style?.classes[0]\">{{\r\n formField.label?.value\r\n ?\r\n formField.label?.value : formField.label?.caption ?\r\n formField.label?.caption :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>" }]
1975
+ }], propDecorators: { formField: [{
1976
+ type: Input
1977
+ }], modalItemInfo: [{
1978
+ type: Input
1979
+ }] } });
1980
+
1981
+ class Textbox {
1982
+ formField;
1983
+ modalItemInfo;
1984
+ getScope(scope) {
1985
+ let propertyScope = "";
1986
+ let start = scope?.indexOf("#/") + 2;
1987
+ let end = scope?.indexOf("/", start);
1988
+ if (start && end) {
1989
+ propertyScope = scope.substring(start, end);
1990
+ }
1991
+ return propertyScope;
1992
+ }
1993
+ getStyleWithoutClasses(styleObject) {
1994
+ if (!styleObject) {
1995
+ return { classes: '', style: {} };
1996
+ }
1997
+ const { classes, ...styleWithoutClasses } = styleObject;
1998
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1999
+ }
2000
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Textbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
2001
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Textbox, isStandalone: true, selector: "vl-textbox", inputs: { formField: "formField", modalItemInfo: "modalItemInfo" }, ngImport: i0, template: "<input pInputText type=\"text\" #inputField=\"ngModel\" [required]=\"formField.option?.required\"\r\n [email]=\"formField.option?.email\" [disabled]=\"formField?.option?.disabled\"\r\n [readonly]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.readonly\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n [placeholder]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\" />", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { 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.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.EmailValidator, selector: "[email][formControlName],[email][formControl],[email][ngModel]", inputs: ["email"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i2$1.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }] });
2002
+ }
2003
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Textbox, decorators: [{
2004
+ type: Component,
2005
+ args: [{ selector: 'vl-textbox', standalone: true, imports: [FormsModule, InputTextModule], template: "<input pInputText type=\"text\" #inputField=\"ngModel\" [required]=\"formField.option?.required\"\r\n [email]=\"formField.option?.email\" [disabled]=\"formField?.option?.disabled\"\r\n [readonly]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.readonly\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n [placeholder]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\" />" }]
2006
+ }], propDecorators: { formField: [{
2007
+ type: Input
2008
+ }], modalItemInfo: [{
2009
+ type: Input
2010
+ }] } });
2011
+
2012
+ class Autocomplete {
2013
+ formField;
2014
+ modalItemInfo;
2015
+ matchData;
2016
+ selectedLanguageInfo;
2017
+ errorMessages;
2018
+ autocompSelect = new EventEmitter();
2019
+ autocompChange = new EventEmitter();
2020
+ autocompFocusOut = new EventEmitter();
2021
+ autocompSelectEvent(event, formField) {
2022
+ this.autocompSelect.emit({ event: event, formField: formField });
2023
+ }
2024
+ autocompChangeEvent(event, formField) {
2025
+ this.autocompChange.emit({ event: event, formField: formField });
2026
+ }
2027
+ autocompFocusOutEvent(event, formField) {
2028
+ this.autocompFocusOut.emit({ event: event, formField: formField });
2029
+ }
2030
+ getScope(scope) {
2031
+ let propertyScope = "";
2032
+ let start = scope?.indexOf("#/") + 2;
2033
+ let end = scope?.indexOf("/", start);
2034
+ if (start && end) {
2035
+ propertyScope = scope.substring(start, end);
2036
+ }
2037
+ return propertyScope;
2038
+ }
2039
+ getStyleWithoutClasses(styleObject) {
2040
+ if (!styleObject) {
2041
+ return { classes: '', style: {} };
2042
+ }
2043
+ const { classes, ...styleWithoutClasses } = styleObject;
2044
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
2045
+ }
2046
+ setErroMessage(formField, errorMessages, errorType) {
2047
+ let error = "";
2048
+ let fieldName = formField.label?.value ? formField.label?.value : formField.label?.caption ? formField.label?.caption : this.modalItemInfo.propertySchema[this.getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption;
2049
+ if (errorType == "required") {
2050
+ error = this.selectedLanguageInfo?.errorMessages?.required ? this.selectedLanguageInfo?.errorMessages.required : errorMessages.required;
2051
+ }
2052
+ if (error && error.toString().includes("{{requiredLength}}")) {
2053
+ error = error.replace(/{{\s*requiredLength\s*}}/g, formField?.minlength.toString());
2054
+ }
2055
+ return error.replace(/{{\s*field\s*}}/g, fieldName);
2056
+ }
2057
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Autocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
2058
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Autocomplete, isStandalone: true, selector: "vl-autocomplete", inputs: { formField: "formField", modalItemInfo: "modalItemInfo", matchData: "matchData", selectedLanguageInfo: "selectedLanguageInfo", errorMessages: "errorMessages" }, outputs: { autocompSelect: "autocompSelect", autocompChange: "autocompChange", autocompFocusOut: "autocompFocusOut" }, ngImport: i0, template: "<p-autoComplete #autocompleteField=\"ngModel\" [required]=\"formField.option.required\" [name]=\"formField.scope?.reference\"\r\n inputmode\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [suggestions]=\"matchData\" [dropdown]=\"true\"\r\n [placeholder]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\"\r\n (completeMethod)=\"autocompChangeEvent($event, formField)\" (onSelect)=\"autocompSelectEvent($event, formField)\"\r\n (onBlur)=\"autocompFocusOutEvent($event, formField)\"\r\n [attr.inputmode]=\"formField.option.keyboard === 'numeric' ? 'numeric' : null\">\r\n</p-autoComplete>\r\n\r\n<!-- Error Message -->\r\n<div *ngIf=\"autocompleteField?.touched && autocompleteField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"autocompleteField?.errors?.['required']\">\r\n {{setErroMessage(formField, errorMessages, \"required\")}}</p>\r\n <p class=\"text-danger\" *ngIf=\"autocompleteField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: AutoCompleteModule }, { kind: "component", type: i2$2.AutoComplete, selector: "p-autoComplete, p-autocomplete, p-auto-complete", inputs: ["minLength", "minQueryLength", "delay", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "addOnTab", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "typeahead", "addOnBlur", "separator", "appendTo", "motionOptions"], outputs: ["completeMethod", "onSelect", "onUnselect", "onAdd", "onFocus", "onBlur", "onDropdownClick", "onClear", "onInputKeydown", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "ngmodule", type: SelectModule }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
2059
+ }
2060
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Autocomplete, decorators: [{
2061
+ type: Component,
2062
+ args: [{ selector: 'vl-autocomplete', standalone: true, imports: [
2063
+ FormsModule,
2064
+ AutoCompleteModule,
2065
+ SelectModule,
2066
+ NgIf
2067
+ ], template: "<p-autoComplete #autocompleteField=\"ngModel\" [required]=\"formField.option.required\" [name]=\"formField.scope?.reference\"\r\n inputmode\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [suggestions]=\"matchData\" [dropdown]=\"true\"\r\n [placeholder]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\"\r\n (completeMethod)=\"autocompChangeEvent($event, formField)\" (onSelect)=\"autocompSelectEvent($event, formField)\"\r\n (onBlur)=\"autocompFocusOutEvent($event, formField)\"\r\n [attr.inputmode]=\"formField.option.keyboard === 'numeric' ? 'numeric' : null\">\r\n</p-autoComplete>\r\n\r\n<!-- Error Message -->\r\n<div *ngIf=\"autocompleteField?.touched && autocompleteField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"autocompleteField?.errors?.['required']\">\r\n {{setErroMessage(formField, errorMessages, \"required\")}}</p>\r\n <p class=\"text-danger\" *ngIf=\"autocompleteField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n</div>" }]
2068
+ }], propDecorators: { formField: [{
2069
+ type: Input
2070
+ }], modalItemInfo: [{
2071
+ type: Input
2072
+ }], matchData: [{
2073
+ type: Input
2074
+ }], selectedLanguageInfo: [{
2075
+ type: Input
2076
+ }], errorMessages: [{
2077
+ type: Input
2078
+ }], autocompSelect: [{
2079
+ type: Output
2080
+ }], autocompChange: [{
2081
+ type: Output
2082
+ }], autocompFocusOut: [{
2083
+ type: Output
2084
+ }] } });
2085
+
2086
+ class ModelComponent {
2087
+ matchData = [];
2088
+ errorMessages = {};
2089
+ isModalShow = false;
2090
+ modalItemInfo = {};
2091
+ selectedLanguageInfo = {};
2092
+ userInfo = {};
2093
+ invokeButtonClick = new EventEmitter();
2094
+ invokeSetFormData = new EventEmitter();
2095
+ modalClose = new EventEmitter();
2096
+ copyLayoutSchema = {};
2097
+ isLoading = false;
2098
+ constructor() {
2099
+ }
2100
+ ngAfterViewInit() {
2101
+ }
2102
+ async ngOnChanges(changes) {
2103
+ if (this.isModalShow === true) {
2104
+ if (this.modalItemInfo.layoutSchema) {
2105
+ this.copyLayoutSchema = JSON.parse(JSON.stringify(this.modalItemInfo.layoutSchema));
2106
+ }
2107
+ if ((changes['selectedLanguageInfo'] || this.selectedLanguageInfo) && this.selectedLanguageInfo.selectedLanguage) {
2108
+ this.modalItemInfo.layoutSchema = this.updateLayoutLanguage(this.copyLayoutSchema, this.selectedLanguageInfo.selectedLanguage);
2109
+ }
2110
+ if (this.modalItemInfo?.currentRecord) {
2111
+ this.mapDataToPropertySchema(this.modalItemInfo.currentRecord, this.modalItemInfo);
2112
+ }
2113
+ await this.setAutoCompleteData();
2114
+ }
2115
+ }
2116
+ updateLayoutLanguage(schema, translations) {
2117
+ const cloned = JSON.parse(JSON.stringify(schema));
2118
+ const walk = (obj) => {
2119
+ if (!obj || typeof obj !== 'object')
2120
+ return;
2121
+ // 🔹 label.caption (most common in form schemas)
2122
+ if (obj.label && typeof obj.label.caption === 'string') {
2123
+ const original = obj.label.caption;
2124
+ obj.label.caption = translations[original] ?? original;
2125
+ }
2126
+ // 🔹 direct caption (fallback / buttons / future-proof)
2127
+ if (typeof obj.caption === 'string') {
2128
+ const original = obj.caption;
2129
+ obj.caption = translations[original] ?? original;
2130
+ }
2131
+ // 🚫 Skip huge data arrays (autocomplete datasets, etc.)
2132
+ if (Array.isArray(obj.data))
2133
+ return;
2134
+ // 🔁 Recurse
2135
+ Object.keys(obj).forEach((key) => {
2136
+ const value = obj[key];
2137
+ if (typeof value === 'object') {
2138
+ walk(value);
2139
+ }
2140
+ });
2141
+ };
2142
+ walk(cloned);
2143
+ return cloned;
2144
+ }
2145
+ mapDataToPropertySchema(data, modalItemInfo) {
2146
+ if (!data || !modalItemInfo?.propertySchema)
2147
+ return;
2148
+ const [rootScope] = Object.keys(modalItemInfo.propertySchema);
2149
+ if (!rootScope)
2150
+ return;
2151
+ const schemaFields = modalItemInfo.propertySchema[rootScope];
2152
+ Object.keys(schemaFields).forEach((fieldKey) => {
2153
+ if (data.hasOwnProperty(fieldKey)) {
2154
+ if (!schemaFields[fieldKey]) {
2155
+ schemaFields[fieldKey] = {};
2156
+ }
2157
+ schemaFields[fieldKey].value = data[fieldKey];
2158
+ }
2159
+ });
2160
+ }
2161
+ async setAutoCompleteData() {
2162
+ for (const section of this.modalItemInfo.layoutSchema.formSections) {
2163
+ for (const field of section.formFields || []) {
2164
+ const type = this.modalItemInfo.propertySchema[this.getScope(field.scope?.reference)]?.[field.scope.reference.split('/').pop()]?.type;
2165
+ if (type === 'autocomplete' && field.option?.autocomplete) {
2166
+ this.isLoading = true;
2167
+ field['data'] = await this.fetchAutocompleteData(field);
2168
+ this.isLoading = false;
2169
+ }
2170
+ }
2171
+ }
2172
+ }
2173
+ async fetchAutocompleteData(formField) {
2174
+ const config = formField.option?.autocomplete;
2175
+ if (!config)
2176
+ return;
2177
+ const request = this.resolveAutocompleteConfig(config, this.userInfo);
2178
+ const response = await CapacitorHttp.request({
2179
+ url: request.url,
2180
+ method: request.method,
2181
+ params: request.params,
2182
+ headers: request.headers
2183
+ });
2184
+ return response.data?.length > 0 ? response.data : [];
2185
+ }
2186
+ resolveAutocompleteConfig(config, userInfo) {
2187
+ const params = {};
2188
+ Object.entries(config.params || {}).forEach(([key, value]) => {
2189
+ // 🔹 Dynamic token
2190
+ if (typeof value === 'string' && value.includes('{{')) {
2191
+ params[key] = this.resolveToken(value, userInfo);
2192
+ }
2193
+ // 🔹 Computed param
2194
+ else if (value?.type === 'company') {
2195
+ params[key] = this.buildCompany(userInfo);
2196
+ }
2197
+ // 🔹 Static
2198
+ else {
2199
+ params[key] = value;
2200
+ }
2201
+ });
2202
+ return {
2203
+ url: `${userInfo.p5_backend_url}${config.url}`,
2204
+ method: config.method || 'POST',
2205
+ params,
2206
+ headers: config.passToken
2207
+ ? {
2208
+ Authorization: `Bearer ${userInfo.token}`,
2209
+ Accept: 'application/json'
2210
+ }
2211
+ : {}
2212
+ };
2213
+ }
2214
+ buildCompany(userInfo) {
2215
+ return userInfo.p5_plant
2216
+ ? `${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant}`
2217
+ : `${userInfo.p5_group}/${userInfo.p5_client}/`;
2218
+ }
2219
+ resolveToken(template, context) {
2220
+ return template.replace(/{{(.*?)}}/g, (_, path) => {
2221
+ return path.split('.').reduce((acc, key) => acc?.[key], context) ?? '';
2222
+ });
2223
+ }
2224
+ getScope(scope) {
2225
+ let propertyScope = "";
2226
+ let start = scope?.indexOf("#/") + 2;
2227
+ let end = scope?.indexOf("/", start);
2228
+ if (start && end) {
2229
+ propertyScope = scope.substring(start, end);
2230
+ }
2231
+ return propertyScope;
2232
+ }
2233
+ autocompChangeEvent(event) {
2234
+ const q = (event?.event.query || '').toLowerCase();
2235
+ let fieldName = event?.formField.scope?.reference?.split('/')?.pop();
2236
+ if (fieldName) {
2237
+ this.matchData = event?.formField.data?.filter((x) => x[fieldName] && x[fieldName]?.toLowerCase()?.startsWith(q));
2238
+ }
2239
+ }
2240
+ autocompFocusOutEvent(event) {
2241
+ const selected = event?.event.target.value;
2242
+ let fieldName = event?.formField.scope?.reference?.split('/')?.pop();
2243
+ if (fieldName && (selected || typeof selected !== 'object')) {
2244
+ let actualObj = event?.formField.data?.find((x) => x[fieldName] == selected);
2245
+ if (actualObj) {
2246
+ this.autocompSelectEvent(event);
2247
+ }
2248
+ }
2249
+ }
2250
+ autocompSelectEvent(event) {
2251
+ const selected = event?.event.value;
2252
+ const mapping = event.formField.option?.onSelect?.mapFields;
2253
+ if (!selected || !mapping)
2254
+ return;
2255
+ Object.entries(mapping).forEach(([targetProp, sourceKey]) => {
2256
+ const scope = this.getScope(event.formField.scope.reference);
2257
+ if (this.modalItemInfo.propertySchema?.[scope]?.[targetProp]) {
2258
+ this.modalItemInfo.propertySchema[scope][targetProp].value = selected[sourceKey] ?? null;
2259
+ }
2260
+ });
2261
+ }
2262
+ setErroMessage(formField, errorMessages, errorType) {
2263
+ let error = "";
2264
+ let fieldName = formField.label?.value ? formField.label?.value : formField.label?.caption ? formField.label?.caption : this.modalItemInfo.propertySchema[this.getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption;
2265
+ if (errorType == "required") {
2266
+ error = this.selectedLanguageInfo?.errorMessages?.required ? this.selectedLanguageInfo?.errorMessages.required : errorMessages.required;
2267
+ }
2268
+ if (error && error.toString().includes("{{requiredLength}}")) {
2269
+ error = error.replace(/{{\s*requiredLength\s*}}/g, formField?.minlength.toString());
2270
+ }
2271
+ return error.replace(/{{\s*field\s*}}/g, fieldName);
2272
+ }
2273
+ getStyleWithoutClasses(styleObject) {
2274
+ if (!styleObject) {
2275
+ return { classes: '', style: {} };
2276
+ }
2277
+ const { classes, ...styleWithoutClasses } = styleObject;
2278
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
2279
+ }
2280
+ dateChangeEvent(formField, value) {
2281
+ this.handleRules(formField, value);
2282
+ }
2283
+ onDateTyping(event) {
2284
+ const input = event.target;
2285
+ if (!input)
2286
+ return;
2287
+ let digits = input.value.replace(/\D/g, '');
2288
+ digits = digits.substring(0, 8);
2289
+ let formatted = '';
2290
+ if (digits.length <= 4) {
2291
+ formatted = digits;
2292
+ }
2293
+ else if (digits.length <= 6) {
2294
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4)}`;
2295
+ }
2296
+ else {
2297
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4, 6)}-${digits.slice(6)}`;
2298
+ }
2299
+ input.value = formatted;
2300
+ }
2301
+ forceNumericKeyboard(event) {
2302
+ const input = event?.target;
2303
+ if (input && input.tagName === 'INPUT') {
2304
+ input.setAttribute('inputmode', 'numeric'); // Android
2305
+ input.setAttribute('pattern', '[0-9:]*'); // iOS
2306
+ input.setAttribute('type', 'tel'); // strongest signal
2307
+ }
2308
+ }
2309
+ onTimeTyping(event) {
2310
+ const input = event?.target || event?.originalEvent?.target;
2311
+ if (!input)
2312
+ return;
2313
+ let digits = input.value.replace(/\D/g, '');
2314
+ digits = digits.substring(0, 4);
2315
+ let formatted = '';
2316
+ if (digits.length <= 2) {
2317
+ formatted = digits;
2318
+ }
2319
+ else {
2320
+ formatted = `${digits.slice(0, 2)}:${digits.slice(2)}`;
2321
+ }
2322
+ input.value = formatted;
2323
+ }
2324
+ timeChangeEvent(formField, value) {
2325
+ this.handleRules(formField, value);
2326
+ }
2327
+ handleRules(formField, value) {
2328
+ const scope = this.getScope(formField.scope.reference);
2329
+ const field = formField.scope?.reference.split('/').pop();
2330
+ const rules = formField.option?.rules;
2331
+ this.modalItemInfo.propertySchema[scope][field].value = value;
2332
+ if (!rules)
2333
+ return;
2334
+ rules.forEach((rule) => {
2335
+ let exist = this.isRuleTriggered(rule, formField);
2336
+ if (!exist)
2337
+ return;
2338
+ switch (rule.action) {
2339
+ case 'calculateDuration':
2340
+ this.applyDurationRule(rule, formField);
2341
+ break;
2342
+ case 'resetValue':
2343
+ this.resetRule(rule, formField);
2344
+ break;
2345
+ }
2346
+ });
2347
+ }
2348
+ resetRule(rule, formField) {
2349
+ const scope = this.getScope(formField.scope.reference);
2350
+ if (rule?.resetValue?.length > 0) {
2351
+ rule.resetValue.forEach((prop) => {
2352
+ this.modalItemInfo.propertySchema[scope][prop].value = null;
2353
+ });
2354
+ }
2355
+ }
2356
+ isRuleTriggered(rule, formField) {
2357
+ if (rule.when === 'timeRangeComplete') {
2358
+ const scope = this.getScope(formField.scope.reference);
2359
+ return (this.modalItemInfo.propertySchema[scope]?.workDayTimeFrom?.value &&
2360
+ this.modalItemInfo.propertySchema[scope]?.workDayTimeTo?.value);
2361
+ }
2362
+ else if (rule.when === 'change') {
2363
+ return true;
2364
+ }
2365
+ return false;
2366
+ }
2367
+ applyDurationRule(rule, formField) {
2368
+ const scope = this.getScope(formField.scope.reference);
2369
+ const schema = this.modalItemInfo.propertySchema[scope];
2370
+ const fromTimeVal = schema?.workDayTimeFrom?.value;
2371
+ const toTimeVal = schema?.workDayTimeTo?.value;
2372
+ const baseDateVal = schema?.fromDate?.value;
2373
+ // 🔒 Guard
2374
+ if (!fromTimeVal || !toTimeVal || !baseDateVal) {
2375
+ schema[rule.params.durationField].value = '';
2376
+ return;
2377
+ }
2378
+ // 📅 Base date (From Date)
2379
+ const baseDate = new Date(baseDateVal);
2380
+ baseDate.setHours(0, 0, 0, 0);
2381
+ // ⏱ FROM datetime
2382
+ const fromDateTime = new Date(baseDate);
2383
+ fromDateTime.setHours(fromTimeVal.getHours(), fromTimeVal.getMinutes(), 0, 0);
2384
+ // ⏱ TO datetime
2385
+ let toDateTime = new Date(baseDate);
2386
+ toDateTime.setHours(toTimeVal.getHours(), toTimeVal.getMinutes(), 0, 0);
2387
+ // 🌙 Overnight handling
2388
+ if (toDateTime <= fromDateTime) {
2389
+ toDateTime.setDate(toDateTime.getDate() + 1);
2390
+ }
2391
+ // ⏳ Duration calculation
2392
+ const diffMs = toDateTime.getTime() - fromDateTime.getTime();
2393
+ const totalMinutes = Math.floor(diffMs / 60000);
2394
+ const hours = Math.floor(totalMinutes / 60);
2395
+ const minutes = totalMinutes % 60;
2396
+ const duration = `${hours}:${minutes.toString().padStart(2, '0')}`;
2397
+ // ✅ Set duration
2398
+ schema[rule.params.durationField].value = duration;
2399
+ // ✅ Auto set To Date
2400
+ schema.toDate.value = new Date(toDateTime);
2401
+ }
2402
+ invokeSetformData() {
2403
+ this.invokeSetFormData.emit();
2404
+ }
2405
+ invokeFormBtnClick(option, propertySchema, form) {
2406
+ if (option.innerAction === 'submit') {
2407
+ let valid = this.checkValidty(form);
2408
+ if (valid) {
2409
+ this.invokeButtonClick.emit({ option: option, propertySchema: propertySchema, recordIndex: this.modalItemInfo?.recordIndex });
2410
+ }
2411
+ }
2412
+ else {
2413
+ this.invokeButtonClick.emit({ option: option, propertySchema: propertySchema });
2414
+ }
2415
+ }
2416
+ checkValidty(form) {
2417
+ if (!form) {
2418
+ return false;
2419
+ }
2420
+ Object.values(form.controls).forEach(control => {
2421
+ control.markAsTouched();
2422
+ control.updateValueAndValidity();
2423
+ });
2424
+ return !!form.valid;
2425
+ }
2426
+ onCancel() {
2427
+ this.modalClose.emit();
2428
+ }
2429
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ModelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2430
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: ModelComponent, isStandalone: true, selector: "vl-model", inputs: { errorMessages: "errorMessages", isModalShow: "isModalShow", modalItemInfo: "modalItemInfo", selectedLanguageInfo: "selectedLanguageInfo", userInfo: "userInfo" }, outputs: { invokeButtonClick: "invokeButtonClick", invokeSetFormData: "invokeSetFormData", modalClose: "modalClose" }, usesOnChanges: true, ngImport: i0, template: "<nz-modal [nzTitle]=\"modalItemInfo?.modalTitle\" nzCentered [(nzVisible)]=\"isModalShow\" [nzFooter]=\"null\"\r\n (nzOnCancel)=\"onCancel()\">\r\n <!-- Loader Spinner -->\r\n <div *ngIf=\"isLoading\" class=\"loader-overlay\">\r\n <div class=\"spinner\"></div>\r\n </div>\r\n <ng-container *nzModalContent>\r\n <div [style]=\"getStyleWithoutClasses(modalItemInfo?.layoutSchema?.style).style\"\r\n [class]=\"modalItemInfo?.layoutSchema?.style?.classes[0]\">\r\n <form #dynamicForm=\"ngForm\" *ngIf=\"modalItemInfo?.layoutSchema?.formSections?.length > 0\"\r\n (submit)=\"$event.preventDefault()\">\r\n <div *ngFor=\"let formSection of modalItemInfo?.layoutSchema?.formSections\">\r\n <div *ngIf=\"formSection?.label?.caption\" [class]=\"formSection?.label?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formSection?.label?.style).style\">\r\n {{formSection.label.caption}}\r\n </div>\r\n <div [class]=\"formSection?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formSection?.style).style\"\r\n *ngIf=\"formSection.formFields?.length > 0\">\r\n <div *ngFor=\"let formField of formSection.formFields\">\r\n <div\r\n [ngSwitch]=\"formField?.scope?.reference && modalItemInfo.propertySchema[getScope(formField.scope?.reference)] ?\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n\r\n <!-- image control -->\r\n <div *ngSwitchCase=\"'image'\" [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [class]=\"formField.style?.classes[0]\">\r\n <img [src]=\"formField.option.src\" [alt]=\"'img'\" />\r\n </div>\r\n\r\n <!-- credit card control -->\r\n <div *ngSwitchCase=\"'carditCard'\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [class]=\"formField.style?.classes[0]\">\r\n <div id=\"card-element\">\r\n <!-- a Stripe element will be inserted here -->\r\n </div>\r\n <!-- Used to display form errors -->\r\n <div id=\"card-errors\"\r\n class=\"displayError.textContent!=='': 'alert alert-danger mt-1'\"></div>\r\n </div>\r\n\r\n <!-- string control -->\r\n <div *ngSwitchCase=\"'string'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <vl-label [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-label>\r\n <vl-textbox [formField]=\"formField\"\r\n [modalItemInfo]=\"modalItemInfo\"></vl-textbox>\r\n </div>\r\n <!-- Error Message -->\r\n <!-- <div *ngIf=\"inputField?.touched && inputField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"inputField?.errors?.['required']\">\r\n {{setErroMessage(formField, errorMessages, \"required\")}}</p>\r\n <p class=\"text-danger\" *ngIf=\"inputField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div> -->\r\n </div>\r\n </div>\r\n\r\n <!-- number control -->\r\n <div *ngSwitchCase=\"'number'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <h5>{{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }} {{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.value\r\n |\r\n currency:formField.option.currency :true: formField.option?.decimalPoint}}\r\n </h5>\r\n </span>\r\n <span *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">{{ formField.label?.value\r\n ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <input type=\"number\" [class]=\"formField.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n [placeholder]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\" />\r\n </div>\r\n </span>\r\n </div>\r\n\r\n <!-- DateRange control -->\r\n <div *ngSwitchCase=\"'dateRange'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">{{ formField.label?.value\r\n ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <nz-range-picker #dateRangeField=\"ngModel\"\r\n [required]=\"formField.option.required\"\r\n [name]=\"formField.scope?.reference\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"></nz-range-picker>\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"dateRangeField?.touched && dateRangeField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"dateRangeField?.errors?.['required']\">\r\n {{formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n +\r\n ' ' + errorMessages.required}}</p>\r\n <p class=\"text-danger\" *ngIf=\"dateRangeField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Date control -->\r\n <div *ngSwitchCase=\"'date'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">{{ formField.label?.value\r\n ?\r\n formField.label?.value : formField.label?.caption ?\r\n formField.label?.caption :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n\r\n <p-datepicker #dateField=\"ngModel\" [required]=\"formField.option.required\"\r\n [name]=\"formField.scope?.reference\" type=\"number\" inputmode=\"numeric\"\r\n [disabled]=\"formField?.option?.disabled\" [showIcon]=\"true\"\r\n (ngModelChange)=\"dateChangeEvent(formField, $event)\"\r\n (onInput)=\"onDateTyping($event)\"\r\n (onFocus)=\"forceNumericKeyboard($event)\"\r\n [dateFormat]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.format ? modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.format : 'yy-mm-dd'\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n appendTo=\"body\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\">\r\n </p-datepicker>\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"dateField?.touched && dateField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"dateField?.errors?.['required']\">\r\n {{setErroMessage(formField, errorMessages, \"required\")}}</p>\r\n <p class=\"text-danger\" *ngIf=\"dateField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Time control -->\r\n <div *ngSwitchCase=\"'time'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">{{ formField.label?.value\r\n ?\r\n formField.label?.value : formField.label?.caption ?\r\n formField.label?.caption :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <p-datepicker #timeField=\"ngModel\" [required]=\"formField.option.required\"\r\n [name]=\"formField.scope?.reference\" [timeOnly]=\"true\" hourFormat=\"24\"\r\n [disabled]=\"formField?.option?.disabled\"\r\n (onFocus)=\"forceNumericKeyboard($event)\"\r\n (onInput)=\"onTimeTyping($event)\"\r\n (ngModelChange)=\"timeChangeEvent(formField, $event)\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n appendTo=\"body\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\">\r\n </p-datepicker>\r\n\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"timeField?.touched && timeField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"timeField?.errors?.['required']\">\r\n {{setErroMessage(formField, errorMessages, \"required\")}}</p>\r\n <p class=\"text-danger\" *ngIf=\"timeField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Autocomplete control -->\r\n <div *ngSwitchCase=\"'autocomplete'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <vl-label [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-label>\r\n\r\n <vl-autocomplete [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\"\r\n [matchData]=\"matchData\" [selectedLanguageInfo]=\"selectedLanguageInfo\"\r\n [errorMessages]=\"errorMessages\"\r\n (autocompSelectEvent)=\"autocompSelectEvent($event)\"\r\n (autocompChange)=\"autocompChangeEvent($event)\"\r\n (autocompFocusOut)=\"autocompFocusOutEvent($event)\">\r\n </vl-autocomplete>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- checkBox control -->\r\n <div *ngSwitchCase=\"'checkbox'\" class=\"form-group mb-3\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [class]=\"formField.style?.classes[0]\">\r\n <span *ngIf=\"formField.option?.postfixCaption\">\r\n <label class=\"form-check-label\"><input type=\"checkbox\" class=\"form-check-input\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n (ngModelChange)=\"invokeSetformData()\" />{{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n </span>\r\n <div *ngIf=\"!formField.option?.postfixCaption\"\r\n [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label class=\"form-check-label\">{{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n <input type=\"checkbox\" class=\"form-check-input\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\" /></label>\r\n </div>\r\n </div>\r\n\r\n <!-- dropdown control -->\r\n <div *ngSwitchCase=\"'dropdown'\" class=\"form-group mb-3\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [class]=\"formField.style?.classes[0]\">\r\n <span *ngIf=\"formField.option?.postfixCaption\">\r\n <select id=\"dynamic-dropdown\" [class]=\"formField.style?.classes[0]\"\r\n #dropdownField=\"ngModel\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\">\r\n <option\r\n *ngFor=\"let item of modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.data\"\r\n [value]=\"formField.option.optionValue\"> {{\r\n formField.option.optionLabel}}</option>\r\n </select>\r\n <label\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\">{{modalItemInfo.propertySchema[getScope(formField.scope)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n </span>\r\n <div *ngIf=\"!formField.option?.postfixCaption\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\">{{modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n\r\n <nz-select nzShowSearch nzAllowClear nzPlaceHolder=\"Select\"\r\n #dropdownField=\"ngModel\" [required]=\"formField.option.required\"\r\n [class]=\"formField.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\">\r\n <nz-option\r\n *ngFor=\"let item of modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.data\"\r\n [nzLabel]=\"item[formField.option.optionLabel]\"\r\n [nzValue]=\"item[formField.option.optionValue]\"></nz-option>\r\n </nz-select>\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"dropdownField?.touched && dropdownField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"dropdownField?.errors?.['required']\">\r\n {{formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n +\r\n ' ' + errorMessages.required}}</p>\r\n <p class=\"text-danger\" *ngIf=\"dropdownField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- button control -->\r\n <div *ngSwitchCase=\"'default'\">\r\n <button type=\"button\" [style]=\"getStyleWithoutClasses(formField.style).style\"\r\n (click)=\"invokeFormBtnClick(formField.option, modalItemInfo.propertySchema, dynamicForm)\"\r\n class=\"btn btn-primary btn-block\">\r\n {{ formField.label?.caption }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n </ng-container>\r\n</nz-modal>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i5.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { 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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i2.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: NzModalModule }, { kind: "component", type: i4.NzModalComponent, selector: "nz-modal", inputs: ["nzMask", "nzMaskClosable", "nzCloseOnNavigation", "nzVisible", "nzClosable", "nzOkLoading", "nzOkDisabled", "nzCancelDisabled", "nzCancelLoading", "nzKeyboard", "nzNoAnimation", "nzCentered", "nzDraggable", "nzContent", "nzFooter", "nzZIndex", "nzWidth", "nzWrapClassName", "nzClassName", "nzStyle", "nzTitle", "nzCloseIcon", "nzMaskStyle", "nzBodyStyle", "nzOkText", "nzCancelText", "nzOkType", "nzOkDanger", "nzIconType", "nzModalType", "nzAutofocus", "nzOnOk", "nzOnCancel"], outputs: ["nzOnOk", "nzOnCancel", "nzAfterOpen", "nzAfterClose", "nzVisibleChange"], exportAs: ["nzModal"] }, { kind: "directive", type: i4.NzModalContentDirective, selector: "[nzModalContent]", exportAs: ["nzModalContent"] }, { kind: "ngmodule", type: NzSelectModule }, { kind: "component", type: i3.NzOptionComponent, selector: "nz-option", inputs: ["nzTitle", "nzLabel", "nzValue", "nzKey", "nzDisabled", "nzHide", "nzCustomContent"], exportAs: ["nzOption"] }, { kind: "component", type: i3.NzSelectComponent, selector: "nz-select", inputs: ["nzId", "nzSize", "nzStatus", "nzVariant", "nzOptionHeightPx", "nzOptionOverflowSize", "nzDropdownClassName", "nzDropdownMatchSelectWidth", "nzDropdownStyle", "nzNotFoundContent", "nzPlaceHolder", "nzPlacement", "nzMaxTagCount", "nzDropdownRender", "nzCustomTemplate", "nzPrefix", "nzSuffixIcon", "nzClearIcon", "nzRemoveIcon", "nzMenuItemSelectedIcon", "nzTokenSeparators", "nzMaxTagPlaceholder", "nzMaxMultipleCount", "nzMode", "nzFilterOption", "compareWith", "nzAllowClear", "nzShowSearch", "nzLoading", "nzAutoFocus", "nzAutoClearSearchValue", "nzServerSearch", "nzDisabled", "nzOpen", "nzSelectOnTab", "nzBackdrop", "nzOptions", "nzShowArrow"], outputs: ["nzOnSearch", "nzScrollToBottom", "nzOpenChange", "nzBlur", "nzFocus", "nzOnClear"], exportAs: ["nzSelect"] }, { kind: "ngmodule", type: NzDatePickerModule }, { kind: "component", type: i5$2.NzDatePickerComponent, selector: "nz-date-picker,nz-week-picker,nz-month-picker,nz-quarter-picker,nz-year-picker,nz-range-picker", inputs: ["nzInline", "nzAllowClear", "nzAutoFocus", "nzDisabled", "nzInputReadOnly", "nzOpen", "nzDisabledDate", "nzLocale", "nzPlaceHolder", "nzPopupStyle", "nzDropdownClassName", "nzSize", "nzStatus", "nzFormat", "nzVariant", "nzDateRender", "nzDisabledTime", "nzRenderExtraFooter", "nzShowToday", "nzMode", "nzShowNow", "nzRanges", "nzDefaultPickerValue", "nzSeparator", "nzSuffixIcon", "nzBackdrop", "nzId", "nzPlacement", "nzShowWeekNumber", "nzShowTime"], outputs: ["nzOnPanelChange", "nzOnCalendarChange", "nzOnOk", "nzOnOpenChange"], exportAs: ["nzDatePicker"] }, { kind: "directive", type: i5$2.NzRangePickerComponent, selector: "nz-range-picker", exportAs: ["nzRangePicker"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i10.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "styleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "icon", "readonlyInput", "shortYearCutoff", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "minDate", "maxDate", "disabledDates", "disabledDays", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "view", "defaultDate", "appendTo", "motionOptions"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: AutoCompleteModule }, { kind: "ngmodule", type: InputTextModule }, { kind: "component", type: Label, selector: "vl-label", inputs: ["formField", "modalItemInfo"] }, { kind: "component", type: Textbox, selector: "vl-textbox", inputs: ["formField", "modalItemInfo"] }, { kind: "component", type: String$1, selector: "vl-string", inputs: ["formField", "modalItemInfo"] }, { kind: "component", type: Autocomplete, selector: "vl-autocomplete", inputs: ["formField", "modalItemInfo", "matchData", "selectedLanguageInfo", "errorMessages"], outputs: ["autocompSelect", "autocompChange", "autocompFocusOut"] }, { kind: "pipe", type: i5.CurrencyPipe, name: "currency" }] });
2431
+ }
2432
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ModelComponent, decorators: [{
2433
+ type: Component,
2434
+ args: [{ standalone: true, selector: 'vl-model', imports: [
2435
+ CommonModule,
2436
+ FormsModule,
2437
+ NzModalModule,
2438
+ NzSelectModule,
2439
+ NzDatePickerModule,
2440
+ DatePickerModule,
2441
+ AutoCompleteModule,
2442
+ InputTextModule,
2443
+ Label,
2444
+ Textbox,
2445
+ String$1,
2446
+ Autocomplete
2447
+ ], template: "<nz-modal [nzTitle]=\"modalItemInfo?.modalTitle\" nzCentered [(nzVisible)]=\"isModalShow\" [nzFooter]=\"null\"\r\n (nzOnCancel)=\"onCancel()\">\r\n <!-- Loader Spinner -->\r\n <div *ngIf=\"isLoading\" class=\"loader-overlay\">\r\n <div class=\"spinner\"></div>\r\n </div>\r\n <ng-container *nzModalContent>\r\n <div [style]=\"getStyleWithoutClasses(modalItemInfo?.layoutSchema?.style).style\"\r\n [class]=\"modalItemInfo?.layoutSchema?.style?.classes[0]\">\r\n <form #dynamicForm=\"ngForm\" *ngIf=\"modalItemInfo?.layoutSchema?.formSections?.length > 0\"\r\n (submit)=\"$event.preventDefault()\">\r\n <div *ngFor=\"let formSection of modalItemInfo?.layoutSchema?.formSections\">\r\n <div *ngIf=\"formSection?.label?.caption\" [class]=\"formSection?.label?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formSection?.label?.style).style\">\r\n {{formSection.label.caption}}\r\n </div>\r\n <div [class]=\"formSection?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formSection?.style).style\"\r\n *ngIf=\"formSection.formFields?.length > 0\">\r\n <div *ngFor=\"let formField of formSection.formFields\">\r\n <div\r\n [ngSwitch]=\"formField?.scope?.reference && modalItemInfo.propertySchema[getScope(formField.scope?.reference)] ?\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.type : 'default'\">\r\n\r\n <!-- image control -->\r\n <div *ngSwitchCase=\"'image'\" [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [class]=\"formField.style?.classes[0]\">\r\n <img [src]=\"formField.option.src\" [alt]=\"'img'\" />\r\n </div>\r\n\r\n <!-- credit card control -->\r\n <div *ngSwitchCase=\"'carditCard'\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [class]=\"formField.style?.classes[0]\">\r\n <div id=\"card-element\">\r\n <!-- a Stripe element will be inserted here -->\r\n </div>\r\n <!-- Used to display form errors -->\r\n <div id=\"card-errors\"\r\n class=\"displayError.textContent!=='': 'alert alert-danger mt-1'\"></div>\r\n </div>\r\n\r\n <!-- string control -->\r\n <div *ngSwitchCase=\"'string'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <vl-label [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-label>\r\n <vl-textbox [formField]=\"formField\"\r\n [modalItemInfo]=\"modalItemInfo\"></vl-textbox>\r\n </div>\r\n <!-- Error Message -->\r\n <!-- <div *ngIf=\"inputField?.touched && inputField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"inputField?.errors?.['required']\">\r\n {{setErroMessage(formField, errorMessages, \"required\")}}</p>\r\n <p class=\"text-danger\" *ngIf=\"inputField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div> -->\r\n </div>\r\n </div>\r\n\r\n <!-- number control -->\r\n <div *ngSwitchCase=\"'number'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <h5>{{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }} {{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.value\r\n |\r\n currency:formField.option.currency :true: formField.option?.decimalPoint}}\r\n </h5>\r\n </span>\r\n <span *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">{{ formField.label?.value\r\n ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <input type=\"number\" [class]=\"formField.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n [placeholder]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\" />\r\n </div>\r\n </span>\r\n </div>\r\n\r\n <!-- DateRange control -->\r\n <div *ngSwitchCase=\"'dateRange'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">{{ formField.label?.value\r\n ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <nz-range-picker #dateRangeField=\"ngModel\"\r\n [required]=\"formField.option.required\"\r\n [name]=\"formField.scope?.reference\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"></nz-range-picker>\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"dateRangeField?.touched && dateRangeField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"dateRangeField?.errors?.['required']\">\r\n {{formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n +\r\n ' ' + errorMessages.required}}</p>\r\n <p class=\"text-danger\" *ngIf=\"dateRangeField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Date control -->\r\n <div *ngSwitchCase=\"'date'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">{{ formField.label?.value\r\n ?\r\n formField.label?.value : formField.label?.caption ?\r\n formField.label?.caption :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n\r\n <p-datepicker #dateField=\"ngModel\" [required]=\"formField.option.required\"\r\n [name]=\"formField.scope?.reference\" type=\"number\" inputmode=\"numeric\"\r\n [disabled]=\"formField?.option?.disabled\" [showIcon]=\"true\"\r\n (ngModelChange)=\"dateChangeEvent(formField, $event)\"\r\n (onInput)=\"onDateTyping($event)\"\r\n (onFocus)=\"forceNumericKeyboard($event)\"\r\n [dateFormat]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.format ? modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.format : 'yy-mm-dd'\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n appendTo=\"body\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\">\r\n </p-datepicker>\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"dateField?.touched && dateField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"dateField?.errors?.['required']\">\r\n {{setErroMessage(formField, errorMessages, \"required\")}}</p>\r\n <p class=\"text-danger\" *ngIf=\"dateField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Time control -->\r\n <div *ngSwitchCase=\"'time'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">{{ formField.label?.value\r\n ?\r\n formField.label?.value : formField.label?.caption ?\r\n formField.label?.caption :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <p-datepicker #timeField=\"ngModel\" [required]=\"formField.option.required\"\r\n [name]=\"formField.scope?.reference\" [timeOnly]=\"true\" hourFormat=\"24\"\r\n [disabled]=\"formField?.option?.disabled\"\r\n (onFocus)=\"forceNumericKeyboard($event)\"\r\n (onInput)=\"onTimeTyping($event)\"\r\n (ngModelChange)=\"timeChangeEvent(formField, $event)\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n appendTo=\"body\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\">\r\n </p-datepicker>\r\n\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"timeField?.touched && timeField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"timeField?.errors?.['required']\">\r\n {{setErroMessage(formField, errorMessages, \"required\")}}</p>\r\n <p class=\"text-danger\" *ngIf=\"timeField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- Autocomplete control -->\r\n <div *ngSwitchCase=\"'autocomplete'\" class=\"form-group mb-3\">\r\n <span *ngIf=\"formField.option.protected\"\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <vl-string [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-string>\r\n </span>\r\n <div *ngIf=\"!formField.option.protected\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <vl-label [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\">\r\n </vl-label>\r\n\r\n <vl-autocomplete [formField]=\"formField\" [modalItemInfo]=\"modalItemInfo\"\r\n [matchData]=\"matchData\" [selectedLanguageInfo]=\"selectedLanguageInfo\"\r\n [errorMessages]=\"errorMessages\"\r\n (autocompSelectEvent)=\"autocompSelectEvent($event)\"\r\n (autocompChange)=\"autocompChangeEvent($event)\"\r\n (autocompFocusOut)=\"autocompFocusOutEvent($event)\">\r\n </vl-autocomplete>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- checkBox control -->\r\n <div *ngSwitchCase=\"'checkbox'\" class=\"form-group mb-3\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [class]=\"formField.style?.classes[0]\">\r\n <span *ngIf=\"formField.option?.postfixCaption\">\r\n <label class=\"form-check-label\"><input type=\"checkbox\" class=\"form-check-input\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n (ngModelChange)=\"invokeSetformData()\" />{{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n </span>\r\n <div *ngIf=\"!formField.option?.postfixCaption\"\r\n [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label class=\"form-check-label\">{{\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n <input type=\"checkbox\" class=\"form-check-input\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\" /></label>\r\n </div>\r\n </div>\r\n\r\n <!-- dropdown control -->\r\n <div *ngSwitchCase=\"'dropdown'\" class=\"form-group mb-3\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [class]=\"formField.style?.classes[0]\">\r\n <span *ngIf=\"formField.option?.postfixCaption\">\r\n <select id=\"dynamic-dropdown\" [class]=\"formField.style?.classes[0]\"\r\n #dropdownField=\"ngModel\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\">\r\n <option\r\n *ngFor=\"let item of modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.data\"\r\n [value]=\"formField.option.optionValue\"> {{\r\n formField.option.optionLabel}}</option>\r\n </select>\r\n <label\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\">{{modalItemInfo.propertySchema[getScope(formField.scope)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n </span>\r\n <div *ngIf=\"!formField.option?.postfixCaption\">\r\n <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\">{{modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n\r\n <nz-select nzShowSearch nzAllowClear nzPlaceHolder=\"Select\"\r\n #dropdownField=\"ngModel\" [required]=\"formField.option.required\"\r\n [class]=\"formField.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.style).style\"\r\n [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\">\r\n <nz-option\r\n *ngFor=\"let item of modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.data\"\r\n [nzLabel]=\"item[formField.option.optionLabel]\"\r\n [nzValue]=\"item[formField.option.optionValue]\"></nz-option>\r\n </nz-select>\r\n </div>\r\n <!-- Error Message -->\r\n <div *ngIf=\"dropdownField?.touched && dropdownField?.invalid\"\r\n [style]=\"getStyleWithoutClasses(formField?.validation?.style).style\">\r\n <p class=\"text-danger\" *ngIf=\"dropdownField?.errors?.['required']\">\r\n {{formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n +\r\n ' ' + errorMessages.required}}</p>\r\n <p class=\"text-danger\" *ngIf=\"dropdownField?.errors?.['email']\">\r\n {{(formField.label?.value ?\r\n formField.label?.value :\r\n modalItemInfo.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption)\r\n +\r\n ' ' + errorMessages.pattern}}</p>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <!-- button control -->\r\n <div *ngSwitchCase=\"'default'\">\r\n <button type=\"button\" [style]=\"getStyleWithoutClasses(formField.style).style\"\r\n (click)=\"invokeFormBtnClick(formField.option, modalItemInfo.propertySchema, dynamicForm)\"\r\n class=\"btn btn-primary btn-block\">\r\n {{ formField.label?.caption }}\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n </ng-container>\r\n</nz-modal>" }]
2448
+ }], ctorParameters: () => [], propDecorators: { errorMessages: [{
2449
+ type: Input
2450
+ }], isModalShow: [{
2451
+ type: Input
2452
+ }], modalItemInfo: [{
2453
+ type: Input
2454
+ }], selectedLanguageInfo: [{
2455
+ type: Input
2456
+ }], userInfo: [{
2457
+ type: Input
2458
+ }], invokeButtonClick: [{
2459
+ type: Output
2460
+ }], invokeSetFormData: [{
2461
+ type: Output
2462
+ }], modalClose: [{
2463
+ type: Output
2464
+ }] } });
2465
+
2466
+ class Button {
2467
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Button, deps: [], target: i0.ɵɵFactoryTarget.Component });
2468
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Button, isStandalone: true, selector: "vl-button", ngImport: i0, template: "<p>button works!</p>\r\n", styles: [""] });
2469
+ }
2470
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Button, decorators: [{
2471
+ type: Component,
2472
+ args: [{ selector: 'vl-button', standalone: true, template: "<p>button works!</p>\r\n" }]
2473
+ }] });
2474
+
2475
+ let Date$1 = class Date {
2476
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Date, deps: [], target: i0.ɵɵFactoryTarget.Component });
2477
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Date, isStandalone: true, selector: "vl-date", ngImport: i0, template: "<p>date works!</p>\r\n", styles: [""] });
2478
+ };
2479
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Date$1, decorators: [{
2480
+ type: Component,
2481
+ args: [{ selector: 'vl-date', standalone: true, template: "<p>date works!</p>\r\n" }]
2482
+ }] });
2483
+
2484
+ class Dropdown {
2485
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Dropdown, deps: [], target: i0.ɵɵFactoryTarget.Component });
2486
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Dropdown, isStandalone: true, selector: "vl-dropdown", ngImport: i0, template: "<p>dropdown works!</p>\r\n", styles: [""] });
2487
+ }
2488
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Dropdown, decorators: [{
2489
+ type: Component,
2490
+ args: [{ selector: 'vl-dropdown', standalone: true, template: "<p>dropdown works!</p>\r\n" }]
2491
+ }] });
2492
+
2493
+ class ErrorMessage {
2494
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorMessage, deps: [], target: i0.ɵɵFactoryTarget.Component });
2495
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: ErrorMessage, isStandalone: true, selector: "vl-error-message", ngImport: i0, template: "<p>error-message works!</p>\r\n", styles: [""] });
2496
+ }
2497
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorMessage, decorators: [{
2498
+ type: Component,
2499
+ args: [{ selector: 'vl-error-message', standalone: true, template: "<p>error-message works!</p>\r\n" }]
2500
+ }] });
2501
+
2502
+ class Time {
2503
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Time, deps: [], target: i0.ɵɵFactoryTarget.Component });
2504
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: Time, isStandalone: true, selector: "vl-time", ngImport: i0, template: "<p>time works!</p>\r\n", styles: [""] });
2505
+ }
2506
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Time, decorators: [{
2507
+ type: Component,
2508
+ args: [{ selector: 'vl-time', standalone: true, template: "<p>time works!</p>\r\n" }]
2509
+ }] });
2510
+
2511
+ class Couchdb {
2512
+ utilityService;
2513
+ couchDbBaseUrl = 'https://couchdb.yomotech.de';
2514
+ constructor(utilityService) {
2515
+ this.utilityService = utilityService;
2516
+ }
2517
+ async getTenantDatabases(tenantKey) {
2518
+ if (!tenantKey || !tenantKey.trim()) {
2519
+ throw new Error('Missing tenantKey');
2520
+ }
2521
+ const response = await fetch(`https://couchdb.yomotech.de/tenant-dbs`, {
2522
+ method: 'GET',
2523
+ headers: {
2524
+ Accept: 'application/json',
2525
+ 'X-Tenant-Key': tenantKey.trim(),
2526
+ },
2527
+ });
2528
+ const data = await this.parseJsonOrText(response);
2529
+ if (!response.ok) {
2530
+ throw new Error(`GET /tenant-dbs -> ${response.status} ${this.stringifyErrorDetails(data)}`);
2531
+ }
2532
+ return data;
2533
+ }
2534
+ async parseJsonOrText(response) {
2535
+ const rawText = await response.text();
2536
+ if (!rawText)
2537
+ return null;
2538
+ try {
2539
+ return JSON.parse(rawText);
2540
+ }
2541
+ catch {
2542
+ return rawText;
2543
+ }
2544
+ }
2545
+ stringifyErrorDetails(data) {
2546
+ if (typeof data === 'string')
2547
+ return data;
2548
+ try {
2549
+ return JSON.stringify(data);
2550
+ }
2551
+ catch {
2552
+ return 'Unknown error';
2553
+ }
2554
+ }
2555
+ async getFileContentFromCouchDb(couchDbName, filePath) {
2556
+ try {
2557
+ const dbName = couchDbName;
2558
+ const docId = filePath?.trim();
2559
+ if (!docId) {
2560
+ console.error('Missing file path');
2561
+ return null;
2562
+ }
2563
+ const response = await fetch(this.getDocumentUrl(dbName, docId), {
2564
+ method: 'GET',
2565
+ headers: await this.getReadHeaders(),
2566
+ });
2567
+ const doc = await this.parseJsonOrText(response);
2568
+ if (!response.ok) {
2569
+ console.error(`Failed to fetch file "${docId}" from "${dbName}": ${response.status}`, doc);
2570
+ return null;
2571
+ }
2572
+ if (!doc?.data) {
2573
+ console.error(`Document "${docId}" does not contain file data`);
2574
+ return null;
2575
+ }
2576
+ // do not decode images as utf8 text
2577
+ if (doc.type === 'media' ||
2578
+ doc.type === 'base64file' ||
2579
+ this.isBinaryMediaFile(doc.name || doc.path || docId, doc.contentType)) {
2580
+ return {
2581
+ type: doc.type || 'base64file',
2582
+ mimeType: this.getMimeType(doc.name || doc.path || docId, doc.contentType),
2583
+ base64: doc.data,
2584
+ src: `data:${this.getMimeType(doc.name || doc.path || docId, doc.contentType)};base64,${doc.data}`,
2585
+ name: doc.name,
2586
+ path: doc.path,
2587
+ metadata: doc.metadata || {},
2588
+ };
2589
+ }
2590
+ const decodedContent = this.fromBase64(doc.data);
2591
+ if (this.isJsonFile(doc.name || doc.path || docId, doc.contentType)) {
2592
+ try {
2593
+ return JSON.parse(decodedContent);
2594
+ }
2595
+ catch (jsonError) {
2596
+ console.error(`Failed to parse JSON for file "${docId}"`, jsonError);
2597
+ return decodedContent;
2598
+ }
2599
+ }
2600
+ return decodedContent;
2601
+ }
2602
+ catch (error) {
2603
+ console.error(`Unexpected error while fetching file "${filePath}" from "${couchDbName}"`, error);
2604
+ return null;
2605
+ }
2606
+ }
2607
+ isBinaryMediaFile(fileNameOrPath, contentType) {
2608
+ const lower = (fileNameOrPath || '').toLowerCase();
2609
+ const type = contentType || '';
2610
+ return (type.startsWith('image/') ||
2611
+ type.startsWith('video/') ||
2612
+ type.startsWith('audio/') ||
2613
+ type === 'application/pdf' ||
2614
+ lower.endsWith('.png') ||
2615
+ lower.endsWith('.jpg') ||
2616
+ lower.endsWith('.jpeg') ||
2617
+ lower.endsWith('.ico') ||
2618
+ lower.endsWith('.svg') ||
2619
+ lower.endsWith('.webp') ||
2620
+ lower.endsWith('.gif') ||
2621
+ lower.endsWith('.mp4') ||
2622
+ lower.endsWith('.webm') ||
2623
+ lower.endsWith('.mp3') ||
2624
+ lower.endsWith('.wav') ||
2625
+ lower.endsWith('.m4a') ||
2626
+ lower.endsWith('.pdf'));
2627
+ }
2628
+ getMimeType(fileNameOrPath, contentType) {
2629
+ if (contentType)
2630
+ return contentType;
2631
+ const lower = (fileNameOrPath || '').toLowerCase();
2632
+ if (lower.endsWith('.png'))
2633
+ return 'image/png';
2634
+ if (lower.endsWith('.jpg') || lower.endsWith('.jpeg'))
2635
+ return 'image/jpeg';
2636
+ if (lower.endsWith('.ico'))
2637
+ return 'image/x-icon';
2638
+ if (lower.endsWith('.svg'))
2639
+ return 'image/svg+xml';
2640
+ if (lower.endsWith('.webp'))
2641
+ return 'image/webp';
2642
+ if (lower.endsWith('.gif'))
2643
+ return 'image/gif';
2644
+ if (lower.endsWith('.mp4'))
2645
+ return 'video/mp4';
2646
+ if (lower.endsWith('.webm'))
2647
+ return 'video/webm';
2648
+ if (lower.endsWith('.mp3'))
2649
+ return 'audio/mpeg';
2650
+ if (lower.endsWith('.wav'))
2651
+ return 'audio/wav';
2652
+ if (lower.endsWith('.m4a'))
2653
+ return 'audio/mp4';
2654
+ if (lower.endsWith('.pdf'))
2655
+ return 'application/pdf';
2656
+ return 'application/octet-stream';
2657
+ }
2658
+ getImageMimeType(fileNameOrPath) {
2659
+ const lower = (fileNameOrPath || '').toLowerCase();
2660
+ if (lower.endsWith('.png'))
2661
+ return 'image/png';
2662
+ if (lower.endsWith('.jpg') || lower.endsWith('.jpeg'))
2663
+ return 'image/jpeg';
2664
+ if (lower.endsWith('.ico'))
2665
+ return 'image/x-icon';
2666
+ if (lower.endsWith('.svg'))
2667
+ return 'image/svg+xml';
2668
+ return 'image/png';
2669
+ }
2670
+ fromBase64(base64) {
2671
+ try {
2672
+ return decodeURIComponent(escape(atob(base64)));
2673
+ }
2674
+ catch {
2675
+ return atob(base64);
2676
+ }
2677
+ }
2678
+ isJsonFile(fileNameOrPath, contentType) {
2679
+ const lower = (fileNameOrPath || '').toLowerCase();
2680
+ return lower.endsWith('.json') || contentType === 'application/json';
2681
+ }
2682
+ getDocumentUrl(dbName, docId) {
2683
+ return `${this.getDbUrl(dbName)}/${encodeURIComponent(docId)}`;
2684
+ }
2685
+ getDbUrl(dbName) {
2686
+ return `${this.couchDbBaseUrl}/${dbName}`;
2687
+ }
2688
+ async getReadHeaders() {
2689
+ return {
2690
+ Accept: 'application/json',
2691
+ ...(await this.buildTenantHeaders()),
2692
+ };
2693
+ }
2694
+ async buildTenantHeaders() {
2695
+ const tenantKey = await this.utilityService.getStorage('tenantKey');
2696
+ const tenantName = await this.utilityService.getStorage('tenantName');
2697
+ const selectedTenant = await this.utilityService.getLocalStorage('selectedTenant');
2698
+ if (tenantKey) {
2699
+ if (typeof tenantKey !== 'string' || !tenantKey.trim()) {
2700
+ throw new Error('Missing tenantKey');
2701
+ }
2702
+ return {
2703
+ 'X-Tenant-Key': tenantKey.trim(),
2704
+ };
2705
+ }
2706
+ else {
2707
+ if (tenantName || !selectedTenant) {
2708
+ throw new Error('Missing tenantName');
2709
+ }
2710
+ return {
2711
+ 'X-Tenant': tenantName ? tenantName.trim() : selectedTenant.trim(),
2712
+ };
2713
+ }
2714
+ }
2715
+ async getImageSrcFromCouchDb(couchDbName, filePath) {
2716
+ const dbName = couchDbName;
2717
+ const docId = filePath?.trim();
2718
+ if (!docId) {
2719
+ throw new Error('Missing file path');
2720
+ }
2721
+ const response = await fetch(this.getDocumentUrl(dbName, docId), {
2722
+ method: 'GET',
2723
+ headers: await this.getReadHeaders(),
2724
+ });
2725
+ const doc = await this.parseJsonOrText(response);
2726
+ if (!response.ok) {
2727
+ throw new Error(`Failed to fetch image "${docId}" from "${dbName}": ${response.status} ${this.stringifyErrorDetails(doc)}`);
2728
+ }
2729
+ if (!doc?.data) {
2730
+ throw new Error(`Document "${docId}" does not contain image data`);
2731
+ }
2732
+ const mimeType = doc.contentType || 'image/png';
2733
+ return `data:${mimeType};base64,${doc.data}`;
2734
+ }
2735
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Couchdb, deps: [{ token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
2736
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Couchdb, providedIn: 'root' });
2737
+ }
2738
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Couchdb, decorators: [{
2739
+ type: Injectable,
2740
+ args: [{
2741
+ providedIn: 'root',
2742
+ }]
2743
+ }], ctorParameters: () => [{ type: UtilityService }] });
2744
+
2745
+ class ConfigService {
2746
+ couchdbService;
2747
+ utilityService;
2748
+ platform;
2749
+ config;
2750
+ skipOkta = false;
2751
+ keycloakConfig;
2752
+ constructor(couchdbService, utilityService, platform) {
2753
+ this.couchdbService = couchdbService;
2754
+ this.utilityService = utilityService;
2755
+ this.platform = platform;
2756
+ }
2757
+ async loadOktaConfig(projectName) {
2758
+ try {
2759
+ let tenantKey = "";
2760
+ let tenantName = "";
2761
+ if (this.platform.ANDROID || this.platform.IOS) {
2762
+ tenantKey = await this.utilityService.getLocalStorage('tenantKey');
2763
+ tenantName = await this.utilityService.getLocalStorage('tenantName');
2764
+ }
2765
+ else {
2766
+ tenantKey = await this.utilityService.getStorage('tenantKey');
2767
+ tenantName = await this.utilityService.getStorage('tenantName');
2768
+ }
2769
+ if (tenantName) {
2770
+ this.config = await this.couchdbService.getFileContentFromCouchDb(`${tenantName}_${projectName}`, 'environments/environment.json');
2771
+ }
2772
+ else {
2773
+ this.config = await this.couchdbService.getFileContentFromCouchDb(`${projectName}`, 'environments/environment.json');
2774
+ }
2775
+ if (this.platform.ANDROID || this.platform.IOS) {
2776
+ if (this.config.environment.login.mobile) {
2777
+ this.setConfiguration(this.config.environment.login.mobile);
2778
+ }
2779
+ else {
2780
+ this.setConfiguration(null);
2781
+ }
2782
+ }
2783
+ else {
2784
+ if (this.config.environment.login.web) {
2785
+ this.setConfiguration(this.config.environment.login.web);
2786
+ }
2787
+ else {
2788
+ this.setConfiguration(null);
2789
+ }
2790
+ }
2791
+ }
2792
+ catch (err) {
2793
+ console.error('Error loading config:', err);
2794
+ }
2795
+ }
2796
+ setConfiguration(config) {
2797
+ if (config) {
2798
+ this.config = config;
2799
+ }
2800
+ else {
2801
+ this.config = {
2802
+ issuer: 'http://dummy',
2803
+ clientId: 'dummy',
2804
+ redirectUri: 'http://dummy',
2805
+ pkce: true,
2806
+ };
2807
+ }
2808
+ }
2809
+ skipOktaConfig() {
2810
+ this.skipOkta = true;
2811
+ }
2812
+ get oktaConfig() {
2813
+ if (this.skipOkta) {
2814
+ return null;
2815
+ }
2816
+ return this.config;
2817
+ }
2818
+ async loadKeycloakConfig(projectName) {
2819
+ let tenantKey = "";
2820
+ let tenantName = "";
2821
+ if (this.platform.ANDROID || this.platform.IOS) {
2822
+ tenantKey = await this.utilityService.getLocalStorage('tenantKey');
2823
+ tenantName = await this.utilityService.getLocalStorage('tenantName');
2824
+ }
2825
+ else {
2826
+ tenantKey = await this.utilityService.getStorage('tenantKey');
2827
+ tenantName = await this.utilityService.getStorage('tenantName');
2828
+ }
2829
+ let env = {};
2830
+ if (tenantName) {
2831
+ env = await this.couchdbService.getFileContentFromCouchDb(`${tenantName}_${projectName}`, 'environments/environment.json');
2832
+ }
2833
+ else {
2834
+ env = await this.couchdbService.getFileContentFromCouchDb(`${projectName}`, 'environments/environment.json');
2835
+ }
2836
+ if (env?.environment?.login.type === "keycloak") {
2837
+ if (this.platform.ANDROID || this.platform.IOS) {
2838
+ this.keycloakConfig = {
2839
+ issuer: "https://keycloak-poc.wilken.de/realms/p5",
2840
+ clientId: "mobile",
2841
+ redirectUri: "de.yomotech:/login/callback",
2842
+ logoutRedirectUri: "de.yomotech:/login/callback",
2843
+ scope: "openid profile email",
2844
+ responseType: "code"
2845
+ };
2846
+ }
2847
+ else {
2848
+ this.keycloakConfig = {
2849
+ issuer: env?.environment?.login?.web?.issuer ?? 'http://dummy',
2850
+ clientId: env?.environment?.login?.web?.clientId ?? 'dummy',
2851
+ redirectUri: window.location.origin,
2852
+ responseType: 'code',
2853
+ scope: 'openid profile email',
2854
+ showDebugInformation: true
2855
+ };
2856
+ }
2857
+ }
2858
+ else {
2859
+ this.keycloakConfig = {};
2860
+ }
2861
+ }
2862
+ getKeycloakConfig() {
2863
+ return this.keycloakConfig;
2864
+ }
2865
+ getKeycloakMobileConfig() {
2866
+ if (!this.keycloakConfig)
2867
+ return null;
2868
+ return {
2869
+ issuer: this.keycloakConfig?.issuer,
2870
+ clientId: this.keycloakConfig?.clientId,
2871
+ redirectUri: this.keycloakConfig.redirectUri,
2872
+ logoutRedirectUri: this.keycloakConfig.logoutRedirectUri,
2873
+ scope: this.keycloakConfig.scope,
2874
+ responseType: this.keycloakConfig.responseType
2875
+ };
2876
+ }
2877
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfigService, deps: [{ token: Couchdb }, { token: UtilityService }, { token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
2878
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfigService, providedIn: 'root' });
2879
+ }
2880
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfigService, decorators: [{
2881
+ type: Injectable,
2882
+ args: [{
2883
+ providedIn: 'root'
2884
+ }]
2885
+ }], ctorParameters: () => [{ type: Couchdb }, { type: UtilityService }, { type: i1.Platform }] });
2886
+
2887
+ class MobileKeycloakService {
2888
+ config;
2889
+ http;
2890
+ utilityService;
2891
+ platform;
2892
+ tokens = null;
2893
+ constructor(config, http, utilityService, platform) {
2894
+ this.config = config;
2895
+ this.http = http;
2896
+ this.utilityService = utilityService;
2897
+ this.platform = platform;
2898
+ if (Capacitor.isNativePlatform()) {
2899
+ App.addListener('appUrlOpen', async (url) => {
2900
+ // Nothing to do here; capacitor-oauth2 resolves internally.
2901
+ // Keep listener to satisfy deep link expectations.
2902
+ });
2903
+ }
2904
+ }
2905
+ async login() {
2906
+ if (!Capacitor.isNativePlatform())
2907
+ return null;
2908
+ const cfg = this.config.getKeycloakMobileConfig();
2909
+ const discoveryUrl = `${cfg.issuer}/.well-known/openid-configuration`;
2910
+ const discovery = await (await fetch(discoveryUrl)).json();
2911
+ const result = await OAuth2Client.authenticate({
2912
+ appId: cfg.clientId, // <--- Keycloak clientId goes here
2913
+ authorizationBaseUrl: discovery.authorization_endpoint,
2914
+ accessTokenEndpoint: discovery.token_endpoint,
2915
+ responseType: 'code',
2916
+ redirectUrl: cfg.redirectUri,
2917
+ scope: cfg.scope,
2918
+ pkceEnabled: true,
2919
+ logsEnabled: true
2920
+ });
2921
+ console.log('result-KEyClaok: ', result);
2922
+ this.tokens = {
2923
+ access_token: result?.access_token_response?.access_token ? result?.access_token_response?.access_token : result.access_token,
2924
+ refresh_token: result?.access_token_response?.refresh_token,
2925
+ id_token: result?.access_token_response?.id_token,
2926
+ expires_in: result?.access_token_response?.expires_at ? result?.access_token_response?.expires_at : result?.access_token_response?.expires_in,
2927
+ token_type: result?.access_token_response?.token_type
2928
+ };
2929
+ let keycloakLoginUser = "";
2930
+ if (this.tokens.access_token) {
2931
+ keycloakLoginUser = await this.getUserInfo(this.tokens.access_token, cfg.issuer);
2932
+ console.log('keycloakLoginUser: ', keycloakLoginUser);
2933
+ if (keycloakLoginUser) {
2934
+ this.tokens['issuer'] = cfg.issuer;
2935
+ this.utilityService.setLocalStorage("KeycloakInfo", this.tokens);
2936
+ if (this.platform.ANDROID || this.platform.IOS) {
2937
+ window.location.reload();
2938
+ }
2939
+ }
2940
+ }
2941
+ return keycloakLoginUser;
2942
+ }
2943
+ async getUserInfo(accessToken, issuer) {
2944
+ try {
2945
+ const headers = new HttpHeaders({
2946
+ Authorization: `Bearer ${accessToken}`,
2947
+ });
2948
+ const url = `${issuer}/protocol/openid-connect/userinfo`;
2949
+ return await this.http.get(url, { headers }).toPromise();
2950
+ }
2951
+ catch (err) {
2952
+ console.error('Error fetching user info:', err);
2953
+ throw err;
2954
+ }
2955
+ }
2956
+ getAccessToken() {
2957
+ return this.tokens?.access_token ?? null;
2958
+ }
2959
+ getRefreshToken() {
2960
+ return this.tokens?.refresh_token ?? null;
2961
+ }
2962
+ async logout() {
2963
+ const keycloakInfo = await this.utilityService.getLocalStorage('KeycloakInfo');
2964
+ const cfg = this.config.getKeycloakMobileConfig();
2965
+ const idToken = keycloakInfo?.keycloakInfo?.id_token;
2966
+ const accessToken = keycloakInfo?.keycloakInfo?.access_token;
2967
+ if (!idToken || !accessToken) {
2968
+ console.warn('No tokens found for logout');
2969
+ return;
2970
+ }
2971
+ const endSessionUrl = `${cfg.issuer}/protocol/openid-connect/logout` +
2972
+ `?id_token_hint=${encodeURIComponent(idToken)}` +
2973
+ `&client_id=${encodeURIComponent(cfg.clientId)}` +
2974
+ `&post_logout_redirect_uri=${encodeURIComponent(cfg.logoutRedirectUri)}`;
2975
+ console.log('Logout URL:', endSessionUrl);
2976
+ await Browser.open({ url: endSessionUrl });
2977
+ this.tokens = null;
2978
+ await this.utilityService.removeLocalStorage('KeycloakInfo');
2979
+ window.location.reload();
2980
+ }
2981
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: MobileKeycloakService, deps: [{ token: ConfigService }, { token: i1$1.HttpClient }, { token: UtilityService }, { token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
2982
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: MobileKeycloakService, providedIn: 'root' });
2983
+ }
2984
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: MobileKeycloakService, decorators: [{
2985
+ type: Injectable,
2986
+ args: [{
2987
+ providedIn: 'root'
2988
+ }]
2989
+ }], ctorParameters: () => [{ type: ConfigService }, { type: i1$1.HttpClient }, { type: UtilityService }, { type: i1.Platform }] });
2990
+
2991
+ class SideMenuComponent {
2992
+ i18n;
2993
+ mobileKeycloakService;
2994
+ couchdbService;
2995
+ oauthService;
2996
+ platform;
2997
+ requestService;
2998
+ utilityService;
2999
+ dialogService;
3000
+ oktaAuthService;
3001
+ notificationService;
3002
+ oktaAuth;
3003
+ isCollapsed = false;
3004
+ isMobile = false;
3005
+ projectsLayoutSchema;
3006
+ loginUser = {};
3007
+ isLogined = false;
3008
+ loginedUserInfo = {};
3009
+ menuItemsCopy = {};
3010
+ settingMenu = {};
3011
+ setLanguage = false;
3012
+ tenantKey = '';
3013
+ tenantName = '';
3014
+ menuItems = [];
3015
+ userInfo = {};
3016
+ settings = {};
3017
+ projects;
3018
+ environment;
3019
+ projectSeleted;
3020
+ languageChange = new EventEmitter();
3021
+ invokeMenu = new EventEmitter();
3022
+ menuToggle = new EventEmitter();
3023
+ invokeProject = new EventEmitter();
3024
+ errorMessage = new EventEmitter();
3025
+ deleteProject = new EventEmitter();
3026
+ PRIME_DE = {
3027
+ firstDayOfWeek: 1,
3028
+ dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
3029
+ dayNamesShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
3030
+ dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
3031
+ monthNames: [
3032
+ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni',
3033
+ 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
3034
+ ],
3035
+ monthNamesShort: [
3036
+ 'Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun',
3037
+ 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'
3038
+ ],
3039
+ today: 'Heute',
3040
+ clear: 'Löschen',
3041
+ dateFormat: 'yy-mm-dd',
3042
+ weekHeader: 'KW'
3043
+ };
3044
+ PRIME_EN = {
3045
+ firstDayOfWeek: 0,
3046
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
3047
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
3048
+ dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
3049
+ monthNames: [
3050
+ 'January', 'February', 'March', 'April', 'May', 'June',
3051
+ 'July', 'August', 'September', 'October', 'November', 'December'
3052
+ ],
3053
+ monthNamesShort: [
3054
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
3055
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
3056
+ ],
3057
+ today: 'Today',
3058
+ clear: 'Clear',
3059
+ dateFormat: 'yy-mm-dd',
3060
+ weekHeader: 'Wk'
3061
+ };
3062
+ sideMenu;
3063
+ constructor(i18n, mobileKeycloakService, couchdbService, oauthService, platform, requestService, utilityService, dialogService, oktaAuthService, notificationService, oktaAuth) {
3064
+ this.i18n = i18n;
3065
+ this.mobileKeycloakService = mobileKeycloakService;
3066
+ this.couchdbService = couchdbService;
3067
+ this.oauthService = oauthService;
3068
+ this.platform = platform;
3069
+ this.requestService = requestService;
3070
+ this.utilityService = utilityService;
3071
+ this.dialogService = dialogService;
3072
+ this.oktaAuthService = oktaAuthService;
3073
+ this.notificationService = notificationService;
3074
+ this.oktaAuth = oktaAuth;
3075
+ }
3076
+ onDocumentClick(event) {
3077
+ const path = event.composedPath();
3078
+ const clickedInsideMenu = path.some(el => el === this.sideMenu?.nativeElement);
3079
+ const clickedToggle = path.some(el => el instanceof HTMLElement &&
3080
+ el.classList?.contains('side-toggle-handle'));
3081
+ if (!clickedInsideMenu && !clickedToggle && this.isMobile) {
3082
+ console.log('OUTSIDE CLICK');
3083
+ let btn = document.getElementById('toggle-id');
3084
+ if (btn && !this.isCollapsed) {
3085
+ btn.click();
3086
+ }
3087
+ }
3088
+ }
3089
+ toggleCollapsed() {
3090
+ if (this.isMobile) {
3091
+ this.isCollapsed = !this.isCollapsed;
3092
+ const sideMenu = document.querySelector('.side-menu');
3093
+ if (sideMenu) {
3094
+ sideMenu.classList.toggle('open', !this.isCollapsed);
3095
+ }
3096
+ }
3097
+ else {
3098
+ this.isCollapsed = !this.isCollapsed;
3099
+ }
3100
+ }
3101
+ async ngOnInit() {
3102
+ if (this.platform.ANDROID || this.platform.IOS) {
3103
+ this.isCollapsed = true;
3104
+ this.isMobile = true;
3105
+ this.tenantKey = await this.utilityService.getLocalStorage('tenantKey');
3106
+ this.tenantName = await this.utilityService.getLocalStorage('tenantName');
3107
+ }
3108
+ else {
3109
+ this.tenantKey = await this.utilityService.getStorage('tenantKey');
3110
+ this.tenantName = await this.utilityService.getStorage('tenantName');
3111
+ }
3112
+ }
3113
+ ngOnChanges(changes) {
3114
+ this.setLoginUser();
3115
+ if (changes['menuItems'] && this.menuItems?.length) {
3116
+ this.menuItemsCopy = JSON.parse(JSON.stringify(this.menuItems));
3117
+ this.setProjectSetting();
3118
+ this.setSettingImages();
3119
+ }
3120
+ }
3121
+ async setProjectSetting() {
3122
+ const tasks = [];
3123
+ this.menuItems.forEach((menuItem) => {
3124
+ if (menuItem?.label?.caption === "Setting" && menuItem?.submenu?.length) {
3125
+ menuItem?.submenu.forEach((subMenu) => {
3126
+ if (subMenu?.label?.caption === "Languages" && subMenu?.submenu?.length) {
3127
+ subMenu?.submenu.forEach((childMenu) => {
3128
+ tasks.push((async () => {
3129
+ try {
3130
+ let projectName = `${this.tenantName}_${this.projectSeleted}`;
3131
+ const image = await this.couchdbService.getFileContentFromCouchDb(projectName, childMenu.icon);
3132
+ childMenu.icon = this.getMediaSrc(image);
3133
+ }
3134
+ catch (err) {
3135
+ console.error("Failed to fetch icon:", err);
3136
+ }
3137
+ })());
3138
+ });
3139
+ }
3140
+ });
3141
+ }
3142
+ });
3143
+ await Promise.all(tasks);
3144
+ }
3145
+ async ngAfterViewInit() {
3146
+ let mobileLang = await this.getDeviceLanguage();
3147
+ if (mobileLang) {
3148
+ this.changeLanguage(mobileLang + '.json');
3149
+ }
3150
+ setTimeout(async () => {
3151
+ this.initializeProjects();
3152
+ await this.setLoginUser();
3153
+ }, 1000);
3154
+ }
3155
+ async getDeviceLanguage() {
3156
+ const info = await Device.getLanguageCode();
3157
+ return info.value; // e.g. 'en', 'ur', 'de'
3158
+ }
3159
+ async setLoginUser() {
3160
+ try {
3161
+ if (this.environment?.login?.type === 'oktaAuth') {
3162
+ if (this.platform.ANDROID || this.platform.IOS) {
3163
+ const logined = await this.utilityService.getLocalStorage('loginedUser');
3164
+ if (logined?.token) {
3165
+ this.requestService.getLoginUser(logined.token).subscribe({
3166
+ next: (userInfo) => {
3167
+ this.loginUser = { ...this.userInfo, ...logined };
3168
+ this.setLoginedUser(this.loginUser);
3169
+ },
3170
+ error: (err) => {
3171
+ console.error('Failed to fetch login user (mobile):', err);
3172
+ }
3173
+ });
3174
+ }
3175
+ }
3176
+ else {
3177
+ this.oktaAuthService.authState$.subscribe({
3178
+ next: async (result) => {
3179
+ if (result.isAuthenticated) {
3180
+ try {
3181
+ const oktaWebUser = await this.oktaAuth.getUser();
3182
+ const webLoginedUser = { ...this.userInfo, ...oktaWebUser };
3183
+ this.loginUser = webLoginedUser;
3184
+ this.setLoginedUser(this.loginUser);
3185
+ }
3186
+ catch (err) {
3187
+ console.error('Failed to fetch Okta web user:', err);
3188
+ }
3189
+ }
3190
+ },
3191
+ error: (err) => {
3192
+ console.error('Okta auth state subscription error:', err);
3193
+ }
3194
+ });
3195
+ }
3196
+ }
3197
+ else if (this.environment?.login?.type === 'jwtToken' && this.userInfo?.jwt) {
3198
+ const userInfo = this.getUserInfoFromToken(this.userInfo.jwt);
3199
+ this.loginUser = userInfo;
3200
+ this.setLoginedUser(this.loginUser);
3201
+ }
3202
+ else if (this.environment?.login?.type === 'keycloak' && this.userInfo?.name) {
3203
+ this.loginUser = this.userInfo;
3204
+ this.setLoginedUser(this.loginUser);
3205
+ }
3206
+ }
3207
+ catch (error) {
3208
+ console.error('Error in setLoginUser:', error);
3209
+ }
3210
+ }
3211
+ getUserInfoFromToken(token) {
3212
+ try {
3213
+ const decoded = jwtDecode(token);
3214
+ return {
3215
+ sub: decoded.sub,
3216
+ name: decoded.name || 'User is undefined',
3217
+ role: decoded.role || 'Role is undefined',
3218
+ email: decoded.email || decoded.sub,
3219
+ iat: decoded.iat,
3220
+ exp: decoded.exp
3221
+ };
3222
+ }
3223
+ catch (err) {
3224
+ return null;
3225
+ }
3226
+ }
3227
+ async setSettingImages() {
3228
+ if (this.settings && this.settings.length > 0) {
3229
+ const tasks = [];
3230
+ console.log('this.settings: ', this.settings);
3231
+ for (const menu of this.settings?.submenu) {
3232
+ if (menu?.submenu?.length) {
3233
+ for (const childMenu of menu.submenu) {
3234
+ if (childMenu.options && childMenu.options.setImageUrl) {
3235
+ tasks.push((async () => {
3236
+ try {
3237
+ let projectName = `${this.tenantName}_${this.projectSeleted}`;
3238
+ const image = await this.couchdbService.getFileContentFromCouchDb(projectName, childMenu.icon);
3239
+ childMenu.icon = this.getMediaSrc(image);
3240
+ }
3241
+ catch (err) {
3242
+ console.error("Failed to fetch icon:", err);
3243
+ }
3244
+ })());
3245
+ }
3246
+ }
3247
+ }
3248
+ }
3249
+ await Promise.all(tasks);
3250
+ }
3251
+ this.settingMenu = JSON.parse(JSON.stringify(this.settings));
3252
+ }
3253
+ getMediaSrc(file) {
3254
+ if (!file)
3255
+ return '';
3256
+ // Best case: service already returns full data URL
3257
+ if (file.src) {
3258
+ return file.src;
3259
+ }
3260
+ // If service returns raw base64 + mimeType
3261
+ if (file.base64) {
3262
+ const mimeType = file.mimeType || 'image/png';
3263
+ return `data:${mimeType};base64,${file.base64}`;
3264
+ }
3265
+ // If service returns old dataUrl format
3266
+ if (file.dataUrl) {
3267
+ return file.dataUrl;
3268
+ }
3269
+ return '';
3270
+ }
3271
+ isUrl(value) {
3272
+ return /^https?:\/\//.test(value) || value.startsWith('blob:');
3273
+ }
3274
+ async setLoginedUser(user) {
3275
+ if (user?.name) {
3276
+ user['image'] = "assets/user.png";
3277
+ this.loginedUserInfo = user;
3278
+ let matchMenu = this.menuItems.find((menu) => menu?.options?.action && menu?.options?.action === "logout");
3279
+ if (matchMenu) {
3280
+ this.loginedUserInfo.actions = [matchMenu];
3281
+ }
3282
+ this.isLogined = this.loginedUserInfo?.name ? true : false;
3283
+ }
3284
+ }
3285
+ initializeProjects() {
3286
+ this.projectsLayoutSchema = this.projects;
3287
+ }
3288
+ async invokeNavigate(menu, parentMenu) {
3289
+ if (menu.options.showAllProjects) {
3290
+ this.utilityService.showAllProjects();
3291
+ }
3292
+ else if (menu.options.changeLang) {
3293
+ this.changeLanguage(menu.options.data_url);
3294
+ }
3295
+ else if (menu.options.changeProject) {
3296
+ this.navigateToProject(menu);
3297
+ }
3298
+ else if (menu.options.logs) {
3299
+ this.openLogsTable();
3300
+ }
3301
+ else if (menu.options.terms) {
3302
+ this.notificationService.info("Term Not Apply");
3303
+ }
3304
+ else if (menu.options.projectPrivacy) {
3305
+ this.notificationService.warning("Project Privacy Not Apply");
3306
+ }
3307
+ else if (menu.options.projectVersion) {
3308
+ this.notificationService.warning("Project Version Not Apply");
3309
+ }
3310
+ else if (menu.options.action == 'login' && this.environment?.login?.type == "keycloak") {
3311
+ if (this.platform.ANDROID || this.platform.IOS) {
3312
+ let login = await this.mobileKeycloakService.login();
3313
+ }
3314
+ else {
3315
+ this.oauthService.initLoginFlow();
3316
+ }
3317
+ }
3318
+ else {
3319
+ this.toggleCollapsed();
3320
+ this.invokeMenu.emit(menu);
3321
+ }
3322
+ }
3323
+ openLogsTable() {
3324
+ let logsModal = this.dialogService.open(LogsComponent, {
3325
+ width: '700px',
3326
+ data: {}
3327
+ });
3328
+ // logsModal.onClose.subscribe((res: any) => {
3329
+ // if (res) {
3330
+ // console.log('res789: ', res);
3331
+ // }
3332
+ // });
3333
+ }
3334
+ deleteMenuItem(subChild, index, event) {
3335
+ event.stopPropagation();
3336
+ this.settings.submenu[1].submenu.splice(index, 1);
3337
+ this.deleteProject.emit(subChild);
3338
+ }
3339
+ navigateToProject(project) {
3340
+ this.invokeProject.emit(project);
3341
+ }
3342
+ async changeLanguage(lang) {
3343
+ if (lang) {
3344
+ if (lang === 'de.json') {
3345
+ // NG-Zorro
3346
+ this.i18n.setLocale(de_DE);
3347
+ // PrimeNG 🔥
3348
+ // this.primengConfig.setTranslation(this.PRIME_DE);
3349
+ }
3350
+ else {
3351
+ this.i18n.setLocale(en_US);
3352
+ // this.primengConfig.setTranslation(this.PRIME_EN);
3353
+ }
3354
+ const selectedLanguage = await this.couchdbService.getFileContentFromCouchDb(`${this.tenantName}_${this.projectSeleted}`, `languages/${lang}`);
3355
+ const errorMessages = await this.couchdbService.getFileContentFromCouchDb(`${this.tenantName}_${this.projectSeleted}`, `languages/errorMessage_${lang}`);
3356
+ this.languageChange.emit({ selectedLanguage: selectedLanguage, errorMessages: errorMessages });
3357
+ this.setLanguage = true;
3358
+ this.menuItemsCopy.forEach((menu, index) => {
3359
+ if (menu.label && menu.label.caption && selectedLanguage[menu.label.caption]) {
3360
+ this.menuItems[index].label.caption = selectedLanguage[menu.label.caption];
3361
+ }
3362
+ if (menu?.submenu?.length) {
3363
+ menu?.submenu.forEach((subMenuInfo, subIndex) => {
3364
+ if (subMenuInfo.label && subMenuInfo.label.caption && selectedLanguage[subMenuInfo.label.caption]) {
3365
+ this.menuItems[index].submenu[subIndex].label.caption = selectedLanguage[subMenuInfo.label.caption];
3366
+ }
3367
+ if (subMenuInfo?.submenu?.length) {
3368
+ subMenuInfo.submenu.forEach((childMenu, childIndex) => {
3369
+ if (childMenu.label && childMenu.label.caption && selectedLanguage[childMenu.label.caption]) {
3370
+ this.menuItems[index].submenu[subIndex].submenu[childIndex].label.caption = selectedLanguage[childMenu.label.caption];
3371
+ }
3372
+ });
3373
+ }
3374
+ });
3375
+ }
3376
+ });
3377
+ if (this.settingMenu?.label?.caption) {
3378
+ this.settingMenu.label.caption = selectedLanguage[this.settings.label.caption];
3379
+ }
3380
+ this.settings?.submenu?.forEach((menu, index) => {
3381
+ if (menu.label && menu.label.caption && selectedLanguage[menu.label.caption] && this.settingMenu?.submenu[index] && this.settingMenu.submenu[index]?.label) {
3382
+ this.settingMenu.submenu[index].label.caption = selectedLanguage[menu.label.caption];
3383
+ }
3384
+ });
3385
+ }
3386
+ }
3387
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SideMenuComponent, deps: [{ token: i1$3.NzI18nService }, { token: MobileKeycloakService }, { token: Couchdb }, { token: i5$1.OAuthService }, { token: i1.Platform }, { token: RequestService }, { token: UtilityService }, { token: i8.DialogService }, { token: i4$1.OktaAuthStateService }, { token: NotificationService }, { token: OKTA_AUTH }], target: i0.ɵɵFactoryTarget.Component });
3388
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: SideMenuComponent, isStandalone: true, selector: "vl-side-menu", inputs: { menuItems: "menuItems", userInfo: "userInfo", settings: "settings", projects: "projects", environment: "environment", projectSeleted: "projectSeleted" }, outputs: { languageChange: "languageChange", invokeMenu: "invokeMenu", menuToggle: "menuToggle", invokeProject: "invokeProject", errorMessage: "errorMessage", deleteProject: "deleteProject" }, host: { listeners: { "document:click": "onDocumentClick($event)" } }, viewQueries: [{ propertyName: "sideMenu", first: true, predicate: ["sideMenu"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"left-wrap sidemenu\" [class.collapsed]=\"isCollapsed\"\r\n [ngStyle]=\"{ 'z-index': !isCollapsed && isMobile ? 999999 : 'auto' }\" #sideMenu>\r\n <!-- Move toggle button OUTSIDE menu container -->\r\n <div class=\"side-toggle-handle\" id=\"toggle-id\" (click)=\"toggleCollapsed()\" [class.collapsed]=\"isCollapsed\">\r\n <span id=\"toggle-icon\" nz-icon [nzType]=\"isCollapsed ? 'caret-right' : 'caret-left'\"></span>\r\n </div>\r\n <div class=\"side-menu h-screen\" id=\"sidemenuwrap\" *ngIf=\"setLanguage\"\r\n [ngStyle]=\"{ width: (isMobile && isCollapsed) ? '1px' : isCollapsed ? '60px' : '' }\">\r\n <!-- user content -->\r\n <ng-container *ngIf=\"loginedUserInfo && loginedUserInfo?.name\">\r\n <div class=\"user-profile\" [class.collapsed]=\"isCollapsed\">\r\n <img class=\"avatar\" [src]=\"loginedUserInfo?.image\" alt=\"User\" />\r\n <div [class]=\"isMobile ? '' : 'details'\" *ngIf=\"!isCollapsed\">\r\n <div class=\"name\">{{ loginedUserInfo.name }}</div>\r\n <div class=\"email\">{{ loginedUserInfo?.email }}</div>\r\n <div class=\"actions\" *ngIf=\"loginedUserInfo?.actions?.length\">\r\n <button *ngFor=\"let action of loginedUserInfo?.actions\" nz-button nzType=\"link\" nzSize=\"small\"\r\n (click)=\"invokeNavigate(action)\">\r\n <span>{{ action?.label?.caption }}</span>\r\n <span nz-icon [nzType]=\"action.icon\"></span>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <!-- dynamic menu -->\r\n <ul nz-menu nzMode=\"inline\" nzTheme=\"dark\" [nzInlineCollapsed]=\"isCollapsed\">\r\n <ng-container *ngFor=\"let item of menuItems\">\r\n <ng-container *ngIf=\"!item.submenu && item?.options?.action != 'logout'; else submenu\">\r\n <span\r\n [class]=\"environment?.login?.type === 'oktaAuth' || environment?.login?.type === 'keycloak' ? item.options?.login === true ? loginedUserInfo?.name ? '' : 'hidden' : item.options?.login === false ? loginedUserInfo?.name ? 'hidden' : '' : '' : userInfo?.userId ? item.options?.login ? item.options.role ? item.options.role == userInfo.userRole ? '' : 'hidden' : '' : 'hidden' : !item.options?.login ? '' : 'hidden' \">\r\n <li (click)=\"invokeNavigate(item)\" nz-menu-item nz-tooltip nzTooltipPlacement=\"right\"\r\n [nzTooltipTitle]=\"isCollapsed && !isMobile ? item?.label?.caption : ''\">\r\n <span nz-icon [nzType]=\"item.icon\"></span>\r\n <span>{{ item?.label?.caption }}</span>\r\n </li>\r\n </span>\r\n </ng-container>\r\n <ng-template #submenu>\r\n <span\r\n [class]=\"item.options?.login === true && (environment?.login?.type === 'oktaAuth' || environment?.login?.type === 'keycloak') ? loginedUserInfo?.name ? '' : 'hidden' : item.options?.login === false ? loginedUserInfo?.name ? 'hidden' : '' : ''\">\r\n <li nz-submenu *ngIf=\"item?.options?.action != 'logout'\" [nzTitle]=\"item?.label?.caption\"\r\n [nzIcon]=\"item.icon\">\r\n <ul>\r\n <ng-container *ngFor=\"let child of item.submenu\">\r\n <li (click)=\"invokeNavigate(child)\" *ngIf=\"!child.submenu\" nz-menu-item nz-tooltip\r\n nzTooltipPlacement=\"right\" [nzTooltipTitle]=\"isCollapsed && !isMobile ? child?.label?.caption : ''\">\r\n <span nz-icon [nzType]=\"child?.icon\"></span>\r\n <span>{{ child?.label?.caption }}</span>\r\n </li>\r\n <ng-container *ngIf=\"child.submenu\">\r\n <li nz-submenu [nzTitle]=\"child?.label?.caption\" [nzIcon]=\"child?.icon\">\r\n <ul>\r\n <ng-container *ngFor=\"let subChild of child.submenu\">\r\n <li (click)=\"invokeNavigate(subChild)\" nz-menu-item>\r\n <ng-container *ngIf=\"subChild?.options?.setImageUrl; else antIcon\">\r\n <img *ngIf=\"isUrl(subChild?.icon)\" [src]=\"subChild?.icon\" alt=\"icon\"\r\n style=\"width: 16px; height: 16px; margin-right: 8px;\" />\r\n </ng-container>\r\n <ng-template #antIcon>\r\n <span nz-icon [nzType]=\"subChild?.icon\"></span>\r\n </ng-template>\r\n <span>{{ subChild?.label?.caption }}</span>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </li>\r\n </ng-container>\r\n </ng-container>\r\n </ul>\r\n </li>\r\n </span>\r\n </ng-template>\r\n </ng-container>\r\n\r\n <!-- separator -->\r\n <li *ngIf=\"settingMenu.submenu\" class=\"menu-separator\"></li>\r\n\r\n <!-- settings menu -->\r\n <ng-container *ngIf=\"!settingMenu.submenu; else settingSubmenu\" style=\"position: absolute; bottom: 0;\">\r\n <li (click)=\"invokeNavigate(settingMenu)\" nz-menu-item nz-tooltip nzTooltipPlacement=\"right\"\r\n [nzTooltipTitle]=\"isCollapsed && !isMobile ? settingMenu?.label?.caption : ''\">\r\n <span nz-icon [nzType]=\"settingMenu.icon\"></span>\r\n <span>{{ settingMenu?.label?.caption }}</span>\r\n </li>\r\n </ng-container>\r\n <ng-template #settingSubmenu>\r\n <li nz-submenu [nzTitle]=\"settingMenu?.label?.caption\" [nzIcon]=\"settingMenu.icon\">\r\n <ul>\r\n <ng-container *ngFor=\"let child of settingMenu.submenu\">\r\n <li (click)=\"invokeNavigate(child)\" *ngIf=\"!child.submenu\" nz-menu-item nz-tooltip\r\n nzTooltipPlacement=\"right\" [nzTooltipTitle]=\"isCollapsed && !isMobile ? child?.label?.caption : ''\">\r\n <span nz-icon [nzType]=\"child?.icon\"></span>\r\n <span>{{ child?.label?.caption }}</span>\r\n </li>\r\n <ng-container *ngIf=\"child.submenu\">\r\n <li nz-submenu [nzTitle]=\"child?.label?.caption\" [nzIcon]=\"child?.icon\">\r\n <ul style=\"width: 260px;\">\r\n <ng-container *ngFor=\"let subChild of child.submenu; let i = index\">\r\n <li (click)=\"invokeNavigate(subChild, child)\" nz-menu-item>\r\n <span [class]=\"child?.label?.caption === 'Languages' ? '' : 'menu-row'\">\r\n <ng-container *ngIf=\"subChild?.options?.setImageUrl; else antIcon\">\r\n <img *ngIf=\"isUrl(subChild?.icon)\" [src]=\"subChild?.icon\" alt=\"icon\"\r\n style=\"width: 16px; height: 16px; margin-right: 8px;\" />\r\n </ng-container>\r\n <ng-template #antIcon>\r\n <span nz-icon [nzType]=\"subChild?.icon\"></span>\r\n </ng-template>\r\n <span>{{ subChild?.label?.caption }}</span>\r\n <!-- Delete icon (prevent click bubbling) -->\r\n <span *ngIf=\"child?.label?.caption != 'Languages'\" nz-icon nzType=\"delete\" class=\"delete-icon\"\r\n style=\"padding-left: 5%;\" (click)=\"deleteMenuItem(subChild, i, $event)\"></span>\r\n </span>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </li>\r\n </ng-container>\r\n </ng-container>\r\n </ul>\r\n </li>\r\n </ng-template>\r\n\r\n </ul>\r\n </div>\r\n</div>", styles: [".menu-separator{height:1px;margin:15px 0 6px;background-color:#ffffff26;list-style:none}.side-menu{background-color:#0d1b2a;color:#fff;display:flex;flex-direction:column;height:100%;transition:width .3s ease}.side-menu ul[nz-menu]{flex:1;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scroll-behavior:smooth}.user-profile{text-align:center;padding:20px 10px;margin-top:40px;border-bottom:1px solid rgba(255,255,255,.1)}.user-profile.collapsed{padding:10px}.user-profile .avatar{width:64px;height:64px;border-radius:50%;border:2px solid #fff;margin-bottom:8px}.user-profile.collapsed .avatar{width:40px;height:40px;margin-bottom:0}.user-profile .name{font-weight:600;font-size:14px;color:#fff}.user-profile .email{font-size:12px;color:#aaa;margin-bottom:8px;word-break:break-word}.user-profile .actions button{margin:0 4px;color:#fff}.projects{position:absolute;bottom:0;width:100%}@media(max-width:768px){.side-menu{height:calc(100dvh - var(--header-height));top:var(--header-height)}.side-menu.open{width:250px}.user-profile .details{display:none}.user-profile .avatar{width:40px;height:40px}}.collapse-btn{position:absolute;z-index:10001}@media(max-width:768px){.collapse-btn{top:calc(var(--header-height) + 8px);left:10px}}@media(max-width:768px){.left-wrap.sidemenu.collapsed .user-profile{max-height:0;opacity:0;overflow:hidden;padding:0;transition:all .2s ease}}.menu-row{display:flex;align-items:center;justify-content:space-between;width:100%}.menu-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.delete-icon{margin-left:auto;cursor:pointer}.side-toggle-handle{position:absolute;right:-14px;width:28px;height:48px;background:#0d1b2a;border-radius:0 6px 6px 0;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:10000;transition:all .25s ease;box-shadow:2px 0 6px #00000040}.side-toggle-handle span{color:#fff;font-size:14px;transition:transform .25s ease}@media(max-width:768px){.side-toggle-handle{top:calc(var(--header-height) + -56px)!important;padding-left:10px;transform:none!important}}@media(min-width:769px){.left-wrap.sidemenu.collapsed:hover{transform:translate(0)}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: PlatformModule }, { kind: "ngmodule", type:
3389
+ // NG-ZORRO
3390
+ NzMenuModule }, { kind: "directive", type: i12$1.NzMenuDirective, selector: "[nz-menu]", inputs: ["nzInlineIndent", "nzTheme", "nzMode", "nzInlineCollapsed", "nzSelectable"], outputs: ["nzClick"], exportAs: ["nzMenu"] }, { kind: "component", type: i12$1.NzMenuItemComponent, selector: "[nz-menu-item]", inputs: ["nzPaddingLeft", "nzDisabled", "nzSelected", "nzDanger", "nzMatchRouterExact", "nzMatchRouter"], exportAs: ["nzMenuItem"] }, { kind: "component", type: i12$1.NzSubMenuComponent, selector: "[nz-submenu]", inputs: ["nzMenuClassName", "nzPaddingLeft", "nzTitle", "nzIcon", "nzTriggerSubMenuAction", "nzOpen", "nzDisabled", "nzPlacement"], outputs: ["nzOpenChange"], exportAs: ["nzSubmenu"] }, { kind: "ngmodule", type: NzIconModule }, { kind: "directive", type: i9.NzIconDirective, selector: "nz-icon,[nz-icon]", inputs: ["nzSpin", "nzRotate", "nzType", "nzTheme", "nzTwotoneColor", "nzIconfont"], exportAs: ["nzIcon"] }, { kind: "ngmodule", type: NzTooltipModule }, { kind: "directive", type: i14.NzTooltipDirective, selector: "[nz-tooltip]", inputs: ["nzTooltipTitle", "nzTooltipTitleContext", "nz-tooltip", "nzTooltipTrigger", "nzTooltipPlacement", "nzTooltipOrigin", "nzTooltipVisible", "nzTooltipMouseEnterDelay", "nzTooltipMouseLeaveDelay", "nzTooltipOverlayClassName", "nzTooltipOverlayStyle", "nzTooltipArrowPointAtCenter", "cdkConnectedOverlayPush", "nzTooltipColor"], outputs: ["nzTooltipVisibleChange"], exportAs: ["nzTooltip"] }, { kind: "ngmodule", type: NzButtonModule }, { kind: "component", type: i11.NzButtonComponent, selector: "button[nz-button], a[nz-button]", inputs: ["nzBlock", "nzGhost", "nzSearch", "nzLoading", "nzDanger", "disabled", "tabIndex", "nzType", "nzShape", "nzSize"], exportAs: ["nzButton"] }, { kind: "directive", type: i12.ɵNzTransitionPatchDirective, selector: "[nz-button], [nz-icon], nz-icon, [nz-menu-item], [nz-submenu], nz-select-top-control, nz-select-placeholder, nz-input-group", inputs: ["hidden"] }, { kind: "ngmodule", type:
3391
+ // PrimeNG
3392
+ DynamicDialogModule }] });
3393
+ }
3394
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SideMenuComponent, decorators: [{
3395
+ type: Component,
3396
+ args: [{ standalone: true, selector: 'vl-side-menu', imports: [
3397
+ CommonModule,
3398
+ PlatformModule,
3399
+ // NG-ZORRO
3400
+ NzMenuModule,
3401
+ NzIconModule,
3402
+ NzTooltipModule,
3403
+ NzButtonModule,
3404
+ // PrimeNG
3405
+ DynamicDialogModule
3406
+ ], template: "<div class=\"left-wrap sidemenu\" [class.collapsed]=\"isCollapsed\"\r\n [ngStyle]=\"{ 'z-index': !isCollapsed && isMobile ? 999999 : 'auto' }\" #sideMenu>\r\n <!-- Move toggle button OUTSIDE menu container -->\r\n <div class=\"side-toggle-handle\" id=\"toggle-id\" (click)=\"toggleCollapsed()\" [class.collapsed]=\"isCollapsed\">\r\n <span id=\"toggle-icon\" nz-icon [nzType]=\"isCollapsed ? 'caret-right' : 'caret-left'\"></span>\r\n </div>\r\n <div class=\"side-menu h-screen\" id=\"sidemenuwrap\" *ngIf=\"setLanguage\"\r\n [ngStyle]=\"{ width: (isMobile && isCollapsed) ? '1px' : isCollapsed ? '60px' : '' }\">\r\n <!-- user content -->\r\n <ng-container *ngIf=\"loginedUserInfo && loginedUserInfo?.name\">\r\n <div class=\"user-profile\" [class.collapsed]=\"isCollapsed\">\r\n <img class=\"avatar\" [src]=\"loginedUserInfo?.image\" alt=\"User\" />\r\n <div [class]=\"isMobile ? '' : 'details'\" *ngIf=\"!isCollapsed\">\r\n <div class=\"name\">{{ loginedUserInfo.name }}</div>\r\n <div class=\"email\">{{ loginedUserInfo?.email }}</div>\r\n <div class=\"actions\" *ngIf=\"loginedUserInfo?.actions?.length\">\r\n <button *ngFor=\"let action of loginedUserInfo?.actions\" nz-button nzType=\"link\" nzSize=\"small\"\r\n (click)=\"invokeNavigate(action)\">\r\n <span>{{ action?.label?.caption }}</span>\r\n <span nz-icon [nzType]=\"action.icon\"></span>\r\n </button>\r\n </div>\r\n </div>\r\n </div>\r\n </ng-container>\r\n <!-- dynamic menu -->\r\n <ul nz-menu nzMode=\"inline\" nzTheme=\"dark\" [nzInlineCollapsed]=\"isCollapsed\">\r\n <ng-container *ngFor=\"let item of menuItems\">\r\n <ng-container *ngIf=\"!item.submenu && item?.options?.action != 'logout'; else submenu\">\r\n <span\r\n [class]=\"environment?.login?.type === 'oktaAuth' || environment?.login?.type === 'keycloak' ? item.options?.login === true ? loginedUserInfo?.name ? '' : 'hidden' : item.options?.login === false ? loginedUserInfo?.name ? 'hidden' : '' : '' : userInfo?.userId ? item.options?.login ? item.options.role ? item.options.role == userInfo.userRole ? '' : 'hidden' : '' : 'hidden' : !item.options?.login ? '' : 'hidden' \">\r\n <li (click)=\"invokeNavigate(item)\" nz-menu-item nz-tooltip nzTooltipPlacement=\"right\"\r\n [nzTooltipTitle]=\"isCollapsed && !isMobile ? item?.label?.caption : ''\">\r\n <span nz-icon [nzType]=\"item.icon\"></span>\r\n <span>{{ item?.label?.caption }}</span>\r\n </li>\r\n </span>\r\n </ng-container>\r\n <ng-template #submenu>\r\n <span\r\n [class]=\"item.options?.login === true && (environment?.login?.type === 'oktaAuth' || environment?.login?.type === 'keycloak') ? loginedUserInfo?.name ? '' : 'hidden' : item.options?.login === false ? loginedUserInfo?.name ? 'hidden' : '' : ''\">\r\n <li nz-submenu *ngIf=\"item?.options?.action != 'logout'\" [nzTitle]=\"item?.label?.caption\"\r\n [nzIcon]=\"item.icon\">\r\n <ul>\r\n <ng-container *ngFor=\"let child of item.submenu\">\r\n <li (click)=\"invokeNavigate(child)\" *ngIf=\"!child.submenu\" nz-menu-item nz-tooltip\r\n nzTooltipPlacement=\"right\" [nzTooltipTitle]=\"isCollapsed && !isMobile ? child?.label?.caption : ''\">\r\n <span nz-icon [nzType]=\"child?.icon\"></span>\r\n <span>{{ child?.label?.caption }}</span>\r\n </li>\r\n <ng-container *ngIf=\"child.submenu\">\r\n <li nz-submenu [nzTitle]=\"child?.label?.caption\" [nzIcon]=\"child?.icon\">\r\n <ul>\r\n <ng-container *ngFor=\"let subChild of child.submenu\">\r\n <li (click)=\"invokeNavigate(subChild)\" nz-menu-item>\r\n <ng-container *ngIf=\"subChild?.options?.setImageUrl; else antIcon\">\r\n <img *ngIf=\"isUrl(subChild?.icon)\" [src]=\"subChild?.icon\" alt=\"icon\"\r\n style=\"width: 16px; height: 16px; margin-right: 8px;\" />\r\n </ng-container>\r\n <ng-template #antIcon>\r\n <span nz-icon [nzType]=\"subChild?.icon\"></span>\r\n </ng-template>\r\n <span>{{ subChild?.label?.caption }}</span>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </li>\r\n </ng-container>\r\n </ng-container>\r\n </ul>\r\n </li>\r\n </span>\r\n </ng-template>\r\n </ng-container>\r\n\r\n <!-- separator -->\r\n <li *ngIf=\"settingMenu.submenu\" class=\"menu-separator\"></li>\r\n\r\n <!-- settings menu -->\r\n <ng-container *ngIf=\"!settingMenu.submenu; else settingSubmenu\" style=\"position: absolute; bottom: 0;\">\r\n <li (click)=\"invokeNavigate(settingMenu)\" nz-menu-item nz-tooltip nzTooltipPlacement=\"right\"\r\n [nzTooltipTitle]=\"isCollapsed && !isMobile ? settingMenu?.label?.caption : ''\">\r\n <span nz-icon [nzType]=\"settingMenu.icon\"></span>\r\n <span>{{ settingMenu?.label?.caption }}</span>\r\n </li>\r\n </ng-container>\r\n <ng-template #settingSubmenu>\r\n <li nz-submenu [nzTitle]=\"settingMenu?.label?.caption\" [nzIcon]=\"settingMenu.icon\">\r\n <ul>\r\n <ng-container *ngFor=\"let child of settingMenu.submenu\">\r\n <li (click)=\"invokeNavigate(child)\" *ngIf=\"!child.submenu\" nz-menu-item nz-tooltip\r\n nzTooltipPlacement=\"right\" [nzTooltipTitle]=\"isCollapsed && !isMobile ? child?.label?.caption : ''\">\r\n <span nz-icon [nzType]=\"child?.icon\"></span>\r\n <span>{{ child?.label?.caption }}</span>\r\n </li>\r\n <ng-container *ngIf=\"child.submenu\">\r\n <li nz-submenu [nzTitle]=\"child?.label?.caption\" [nzIcon]=\"child?.icon\">\r\n <ul style=\"width: 260px;\">\r\n <ng-container *ngFor=\"let subChild of child.submenu; let i = index\">\r\n <li (click)=\"invokeNavigate(subChild, child)\" nz-menu-item>\r\n <span [class]=\"child?.label?.caption === 'Languages' ? '' : 'menu-row'\">\r\n <ng-container *ngIf=\"subChild?.options?.setImageUrl; else antIcon\">\r\n <img *ngIf=\"isUrl(subChild?.icon)\" [src]=\"subChild?.icon\" alt=\"icon\"\r\n style=\"width: 16px; height: 16px; margin-right: 8px;\" />\r\n </ng-container>\r\n <ng-template #antIcon>\r\n <span nz-icon [nzType]=\"subChild?.icon\"></span>\r\n </ng-template>\r\n <span>{{ subChild?.label?.caption }}</span>\r\n <!-- Delete icon (prevent click bubbling) -->\r\n <span *ngIf=\"child?.label?.caption != 'Languages'\" nz-icon nzType=\"delete\" class=\"delete-icon\"\r\n style=\"padding-left: 5%;\" (click)=\"deleteMenuItem(subChild, i, $event)\"></span>\r\n </span>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </li>\r\n </ng-container>\r\n </ng-container>\r\n </ul>\r\n </li>\r\n </ng-template>\r\n\r\n </ul>\r\n </div>\r\n</div>", styles: [".menu-separator{height:1px;margin:15px 0 6px;background-color:#ffffff26;list-style:none}.side-menu{background-color:#0d1b2a;color:#fff;display:flex;flex-direction:column;height:100%;transition:width .3s ease}.side-menu ul[nz-menu]{flex:1;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scroll-behavior:smooth}.user-profile{text-align:center;padding:20px 10px;margin-top:40px;border-bottom:1px solid rgba(255,255,255,.1)}.user-profile.collapsed{padding:10px}.user-profile .avatar{width:64px;height:64px;border-radius:50%;border:2px solid #fff;margin-bottom:8px}.user-profile.collapsed .avatar{width:40px;height:40px;margin-bottom:0}.user-profile .name{font-weight:600;font-size:14px;color:#fff}.user-profile .email{font-size:12px;color:#aaa;margin-bottom:8px;word-break:break-word}.user-profile .actions button{margin:0 4px;color:#fff}.projects{position:absolute;bottom:0;width:100%}@media(max-width:768px){.side-menu{height:calc(100dvh - var(--header-height));top:var(--header-height)}.side-menu.open{width:250px}.user-profile .details{display:none}.user-profile .avatar{width:40px;height:40px}}.collapse-btn{position:absolute;z-index:10001}@media(max-width:768px){.collapse-btn{top:calc(var(--header-height) + 8px);left:10px}}@media(max-width:768px){.left-wrap.sidemenu.collapsed .user-profile{max-height:0;opacity:0;overflow:hidden;padding:0;transition:all .2s ease}}.menu-row{display:flex;align-items:center;justify-content:space-between;width:100%}.menu-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.delete-icon{margin-left:auto;cursor:pointer}.side-toggle-handle{position:absolute;right:-14px;width:28px;height:48px;background:#0d1b2a;border-radius:0 6px 6px 0;display:flex;align-items:center;justify-content:center;cursor:pointer;z-index:10000;transition:all .25s ease;box-shadow:2px 0 6px #00000040}.side-toggle-handle span{color:#fff;font-size:14px;transition:transform .25s ease}@media(max-width:768px){.side-toggle-handle{top:calc(var(--header-height) + -56px)!important;padding-left:10px;transform:none!important}}@media(min-width:769px){.left-wrap.sidemenu.collapsed:hover{transform:translate(0)}}\n"] }]
3407
+ }], ctorParameters: () => [{ type: i1$3.NzI18nService }, { type: MobileKeycloakService }, { type: Couchdb }, { type: i5$1.OAuthService }, { type: i1.Platform }, { type: RequestService }, { type: UtilityService }, { type: i8.DialogService }, { type: i4$1.OktaAuthStateService }, { type: NotificationService }, { type: OktaAuth, decorators: [{
3408
+ type: Inject,
3409
+ args: [OKTA_AUTH]
3410
+ }] }], propDecorators: { menuItems: [{
3411
+ type: Input
3412
+ }], userInfo: [{
3413
+ type: Input
3414
+ }], settings: [{
3415
+ type: Input
3416
+ }], projects: [{
3417
+ type: Input
3418
+ }], environment: [{
3419
+ type: Input
3420
+ }], projectSeleted: [{
3421
+ type: Input
3422
+ }], languageChange: [{
3423
+ type: Output
3424
+ }], invokeMenu: [{
3425
+ type: Output
3426
+ }], menuToggle: [{
3427
+ type: Output
3428
+ }], invokeProject: [{
3429
+ type: Output
3430
+ }], errorMessage: [{
3431
+ type: Output
3432
+ }], deleteProject: [{
3433
+ type: Output
3434
+ }], sideMenu: [{
3435
+ type: ViewChild,
3436
+ args: ['sideMenu', { static: true }]
3437
+ }], onDocumentClick: [{
3438
+ type: HostListener,
3439
+ args: ['document:click', ['$event']]
3440
+ }] } });
3441
+
3442
+ // lib/view-toolkit.module.ts
3443
+ class ViewToolkitModule {
3444
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3445
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, imports: [CommonModule,
3446
+ CardComponent,
3447
+ FormComponent,
3448
+ GridComponent,
3449
+ HeaderMenuComponent,
3450
+ LogsComponent,
3451
+ ModelComponent,
3452
+ PaginationComponent,
3453
+ SideMenuComponent,
3454
+ Autocomplete,
3455
+ Button,
3456
+ Date$1,
3457
+ Dropdown,
3458
+ ErrorMessage,
3459
+ Label,
3460
+ String$1,
3461
+ Textbox,
3462
+ Time], exports: [CardComponent,
3463
+ FormComponent,
3464
+ GridComponent,
3465
+ HeaderMenuComponent,
3466
+ LogsComponent,
3467
+ ModelComponent,
3468
+ PaginationComponent,
3469
+ SideMenuComponent] });
3470
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, imports: [CommonModule,
3471
+ CardComponent,
3472
+ FormComponent,
3473
+ GridComponent,
3474
+ HeaderMenuComponent,
3475
+ LogsComponent,
3476
+ ModelComponent,
3477
+ PaginationComponent,
3478
+ SideMenuComponent,
3479
+ Autocomplete,
3480
+ Textbox] });
3481
+ }
3482
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, decorators: [{
3483
+ type: NgModule,
3484
+ args: [{
3485
+ imports: [
3486
+ CommonModule,
3487
+ CardComponent,
3488
+ FormComponent,
3489
+ GridComponent,
3490
+ HeaderMenuComponent,
3491
+ LogsComponent,
3492
+ ModelComponent,
3493
+ PaginationComponent,
3494
+ SideMenuComponent,
3495
+ Autocomplete,
3496
+ Button,
3497
+ Date$1,
3498
+ Dropdown,
3499
+ ErrorMessage,
3500
+ Label,
3501
+ String$1,
3502
+ Textbox,
3503
+ Time
3504
+ ],
3505
+ exports: [
3506
+ CardComponent,
3507
+ FormComponent,
3508
+ GridComponent,
3509
+ HeaderMenuComponent,
3510
+ LogsComponent,
3511
+ ModelComponent,
3512
+ PaginationComponent,
3513
+ SideMenuComponent
3514
+ ]
3515
+ }]
3516
+ }] });
3517
+
3518
+ // AUTO-GENERATED. Do not edit.
3519
+ const APP_VERSION = '1.0.204';
3520
+
3521
+ const VERSION_KEY = 'APP_VERSION';
3522
+ class AppVersionResetService {
3523
+ platform;
3524
+ constructor(platform) {
3525
+ this.platform = platform;
3526
+ }
3527
+ async run() {
3528
+ if (this.platform.ANDROID || this.platform.IOS) {
3529
+ await this.clearNativeIfChanged();
3530
+ // this.clearWebIfChanged();
3531
+ // return;
3532
+ }
3533
+ }
3534
+ async clearNativeIfChanged() {
3535
+ const { value: savedVersion } = await Preferences.get({ key: VERSION_KEY });
3536
+ if (savedVersion === APP_VERSION)
3537
+ return;
3538
+ console.log(`🧹 Clearing Capacitor Preferences (new build ${APP_VERSION})`);
3539
+ await Preferences.clear();
3540
+ this.clearWebStores();
3541
+ await Preferences.set({ key: VERSION_KEY, value: APP_VERSION });
3542
+ }
3543
+ // private clearWebIfChanged(): void {
3544
+ // const savedVersion = sessionStorage.getItem(VERSION_KEY) || localStorage.getItem(VERSION_KEY);
3545
+ // if (savedVersion === APP_VERSION) return;
3546
+ // this.clearWebStores();
3547
+ // localStorage.setItem(VERSION_KEY, APP_VERSION);
3548
+ // sessionStorage.setItem(VERSION_KEY, APP_VERSION);
3549
+ // }
3550
+ clearWebStores() {
3551
+ try {
3552
+ localStorage.clear();
3553
+ }
3554
+ catch { }
3555
+ try {
3556
+ sessionStorage.clear();
3557
+ }
3558
+ catch { }
3559
+ try {
3560
+ if (typeof document !== 'undefined' && document.cookie) {
3561
+ document.cookie.split(';').forEach((c) => {
3562
+ const eqPos = c.indexOf('=');
3563
+ const name = eqPos > -1 ? c.substring(0, eqPos).trim() : c.trim();
3564
+ if (name) {
3565
+ document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
3566
+ }
3567
+ });
3568
+ }
3569
+ }
3570
+ catch { }
3571
+ }
3572
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AppVersionResetService, deps: [{ token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
3573
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AppVersionResetService, providedIn: 'root' });
3574
+ }
3575
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AppVersionResetService, decorators: [{
3576
+ type: Injectable,
3577
+ args: [{
3578
+ providedIn: 'root'
3579
+ }]
3580
+ }], ctorParameters: () => [{ type: i1.Platform }] });
3581
+
3582
+ /*
3583
+ * Public API Surface of view-toolkit
3584
+ */
3585
+
3586
+ /**
3587
+ * Generated bundle index. Do not edit.
3588
+ */
3589
+
3590
+ export { AppVersionResetService, CardComponent, ConfigService, Couchdb, FormComponent, GridComponent, HeaderMenuComponent, LogsComponent, MobileKeycloakService, ModelComponent, NetworkLogService, NotificationService, PaginationComponent, RequestService, SideMenuComponent, UtilityService, ViewToolkitModule };
3591
+ //# sourceMappingURL=yomotech-view-toolkit.mjs.map