@yomotech/view-toolkit 0.0.30 → 0.0.32

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/ng-package.json +7 -0
  2. package/package.json +38 -49
  3. package/src/lib/app-version.ts +2 -0
  4. package/src/lib/components/autocomplete/autocomplete.css +0 -0
  5. package/src/lib/components/autocomplete/autocomplete.html +23 -0
  6. package/src/lib/components/autocomplete/autocomplete.ts +71 -0
  7. package/src/lib/components/button/button.css +0 -0
  8. package/src/lib/components/button/button.html +1 -0
  9. package/src/lib/components/button/button.ts +11 -0
  10. package/src/lib/components/date/date.css +0 -0
  11. package/src/lib/components/date/date.html +1 -0
  12. package/src/lib/components/date/date.ts +11 -0
  13. package/src/lib/components/dropdown/dropdown.css +0 -0
  14. package/src/lib/components/dropdown/dropdown.html +1 -0
  15. package/src/lib/components/dropdown/dropdown.ts +11 -0
  16. package/src/lib/components/error-message/error-message.css +0 -0
  17. package/src/lib/components/error-message/error-message.html +1 -0
  18. package/src/lib/components/error-message/error-message.ts +11 -0
  19. package/src/lib/components/label/label.css +0 -0
  20. package/src/lib/components/label/label.html +7 -0
  21. package/src/lib/components/label/label.ts +33 -0
  22. package/src/lib/components/string/string.css +0 -0
  23. package/src/lib/components/string/string.html +4 -0
  24. package/src/lib/components/string/string.ts +22 -0
  25. package/src/lib/components/textbox/textbox.css +0 -0
  26. package/src/lib/components/textbox/textbox.html +7 -0
  27. package/src/lib/components/textbox/textbox.ts +33 -0
  28. package/src/lib/components/time/time.css +0 -0
  29. package/src/lib/components/time/time.html +1 -0
  30. package/src/lib/components/time/time.ts +11 -0
  31. package/src/lib/containers/card/card.component.css +0 -0
  32. package/src/lib/containers/card/card.component.html +450 -0
  33. package/src/lib/containers/card/card.component.ts +474 -0
  34. package/src/lib/containers/form/form.component.css +101 -0
  35. package/src/lib/containers/form/form.component.html +305 -0
  36. package/src/lib/containers/form/form.component.ts +333 -0
  37. package/src/lib/containers/grid/grid.component.css +0 -0
  38. package/src/lib/containers/grid/grid.component.html +212 -0
  39. package/src/lib/containers/grid/grid.component.ts +228 -0
  40. package/src/lib/containers/header-menu/header-menu.component.css +0 -0
  41. package/src/lib/containers/header-menu/header-menu.component.html +72 -0
  42. package/src/lib/containers/header-menu/header-menu.component.ts +105 -0
  43. package/src/lib/containers/logs/logs.component.css +160 -0
  44. package/src/lib/containers/logs/logs.component.html +89 -0
  45. package/src/lib/containers/logs/logs.component.ts +29 -0
  46. package/src/lib/containers/model/model.component.css +0 -0
  47. package/src/lib/containers/model/model.component.html +351 -0
  48. package/src/lib/containers/model/model.component.ts +436 -0
  49. package/src/lib/containers/pagination/pagination.component.css +0 -0
  50. package/src/lib/containers/pagination/pagination.component.html +41 -0
  51. package/src/lib/containers/pagination/pagination.component.ts +100 -0
  52. package/src/lib/containers/side-menu/side-menu.component.css +173 -0
  53. package/src/lib/containers/side-menu/side-menu.component.html +126 -0
  54. package/src/lib/containers/side-menu/side-menu.component.ts +458 -0
  55. package/src/lib/services/app-version-reset.service.ts +59 -0
  56. package/src/lib/services/config.service.ts +144 -0
  57. package/src/lib/services/couchdb.ts +275 -0
  58. package/src/lib/services/mobile-keycloak.service.ts +116 -0
  59. package/src/lib/services/network-log.service.ts +27 -0
  60. package/src/lib/services/notification.service.ts +26 -0
  61. package/src/lib/services/request.service.ts +125 -0
  62. package/src/lib/services/utility.service.ts +600 -0
  63. package/src/lib/view-toolkit.module.ts +57 -0
  64. package/src/lib/view-toolkit.spec.ts +23 -0
  65. package/src/lib/view-toolkit.ts +15 -0
  66. package/src/public-api.ts +25 -0
  67. package/tsconfig.lib.json +17 -0
  68. package/tsconfig.lib.prod.json +11 -0
  69. package/tsconfig.spec.json +15 -0
  70. package/fesm2022/yomotech-view-toolkit.mjs +0 -3538
  71. package/fesm2022/yomotech-view-toolkit.mjs.map +0 -1
  72. package/types/yomotech-view-toolkit.d.ts +0 -644
@@ -1,3538 +0,0 @@
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.includes('{{pageNumber}}')) {
416
- url = url.replace(/{{pageNumber}}/g, currentPage.toString());
417
- }
418
- if (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
- constructor() { }
1284
- ngOnInit() {
1285
- }
1286
- ngOnChanges(changes) {
1287
- setTimeout(() => {
1288
- if (changes['form'] && this.form) {
1289
- this.formCopy = JSON.parse(JSON.stringify(this.form));
1290
- }
1291
- if ((changes['selectedLanguageInfo'] || this.selectedLanguageInfo) && this.selectedLanguageInfo.selectedLanguage) {
1292
- if (this.selectedLanguageInfo?.errorMessages) {
1293
- this.errorMessages = this.selectedLanguageInfo.errorMessages;
1294
- }
1295
- this.form.propertySchema = this.formCopy.propertySchema ? JSON.parse(JSON.stringify(this.formCopy.propertySchema)) : {};
1296
- this.form.propertySchema = this.translateSchema(this.form.propertySchema, this.selectedLanguageInfo.selectedLanguage);
1297
- if (this.formCopy.layoutSchema && this.formCopy.layoutSchema.formSections) {
1298
- this.formCopy.layoutSchema.formSections.forEach((formSection, index) => {
1299
- if (formSection?.label?.caption && this.selectedLanguageInfo.selectedLanguage[formSection.label.caption]) {
1300
- this.form.layoutSchema.formSections[index].label.caption = this.selectedLanguageInfo.selectedLanguage[formSection.label.caption];
1301
- }
1302
- if (formSection.formFields && formSection.formFields.length > 0) {
1303
- formSection.formFields.forEach((formField, fieldIndex) => {
1304
- if (formField.label?.caption && this.selectedLanguageInfo.selectedLanguage[formField.label.caption]) {
1305
- this.form.layoutSchema.formSections[index].formFields[fieldIndex].label.caption = this.selectedLanguageInfo.selectedLanguage[formField.label.caption];
1306
- }
1307
- });
1308
- }
1309
- });
1310
- }
1311
- }
1312
- }, 1000);
1313
- }
1314
- translateSchema(schema, SelectedLanguage) {
1315
- if (schema && typeof schema === 'object' && SelectedLanguage) {
1316
- for (const key of Object.keys(schema)) {
1317
- const val = schema[key];
1318
- // If nested object → recurse
1319
- if (val && typeof val === 'object' && !Array.isArray(val)) {
1320
- this.translateSchema(val, SelectedLanguage);
1321
- }
1322
- // If array → loop items and recurse each one
1323
- if (Array.isArray(val)) {
1324
- val.forEach((item) => {
1325
- if (item && typeof item === 'object') {
1326
- this.translateSchema(item, SelectedLanguage);
1327
- }
1328
- });
1329
- }
1330
- // Translate caption
1331
- if (val &&
1332
- typeof val === 'object' &&
1333
- typeof val.caption === 'string' &&
1334
- val.caption.trim()) {
1335
- const original = val.caption.trim();
1336
- if (SelectedLanguage[original]) {
1337
- val.caption = SelectedLanguage[original];
1338
- }
1339
- }
1340
- // Translate placeholder
1341
- if (val &&
1342
- typeof val === 'object' &&
1343
- typeof val.placeholder === 'string' &&
1344
- val.placeholder.trim()) {
1345
- const original = val.placeholder.trim();
1346
- if (SelectedLanguage[original]) {
1347
- val.placeholder = SelectedLanguage[original];
1348
- }
1349
- }
1350
- }
1351
- }
1352
- return schema;
1353
- }
1354
- togglePasswordVisibility() {
1355
- this.showPassword = !this.showPassword;
1356
- }
1357
- ngAfterViewInit() {
1358
- setTimeout(() => {
1359
- this.setValidations();
1360
- }, 2000);
1361
- }
1362
- getStyleWithoutClasses(styleObject) {
1363
- if (!styleObject) {
1364
- return { classes: '', style: {} };
1365
- }
1366
- const { classes, ...styleWithoutClasses } = styleObject;
1367
- return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1368
- }
1369
- getScope(scope) {
1370
- let propertyScope = "";
1371
- let start = scope?.indexOf("#/") + 2;
1372
- let end = scope?.indexOf("/", start);
1373
- if (start && end) {
1374
- propertyScope = scope.substring(start, end);
1375
- }
1376
- return propertyScope;
1377
- }
1378
- invokeFormBtnClick(option, propertySchema) {
1379
- this.formButtonClick.emit({ option: option, propertySchema: propertySchema });
1380
- }
1381
- setformData() {
1382
- this.checkBoxChangeEvent.emit();
1383
- }
1384
- setErroMessage(formField, errorMessages, field) {
1385
- let error = "";
1386
- let fieldName = "";
1387
- if (field?.errors?.required) {
1388
- error = errorMessages.required;
1389
- }
1390
- else if (field?.errors?.email || field.errors?.pattern) {
1391
- error = errorMessages.pattern;
1392
- }
1393
- else if (field?.errors?.minlength) {
1394
- error = errorMessages.minlength;
1395
- }
1396
- else if (field?.errors?.maxlength) {
1397
- error = errorMessages.maxlength;
1398
- }
1399
- if (formField.label?.value) {
1400
- fieldName = formField.label?.value;
1401
- }
1402
- else {
1403
- let propertySchema = this.form.propertySchema[this.getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()];
1404
- fieldName = propertySchema?.caption ? propertySchema.caption : propertySchema?.placeholder;
1405
- }
1406
- if (error && error.toString().includes("{{requiredLength}}")) {
1407
- error = error.replace(/{{\s*requiredLength\s*}}/g, formField?.minlength.toString());
1408
- }
1409
- return error.replace(/{{\s*field\s*}}/g, fieldName);
1410
- }
1411
- setValidations() {
1412
- if (this.form?.layoutSchema?.formSections?.length) {
1413
- this.form?.layoutSchema?.formSections.forEach((formSection) => {
1414
- if (formSection?.formFields?.length) {
1415
- formSection.formFields.forEach((formField) => {
1416
- if (formField.scope && this.form.propertySchema && Object.keys(this.form.propertySchema)?.length && this.form.propertySchema[this.getScope(formField.scope?.reference)]) {
1417
- let validations = this.form.propertySchema[this.getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.validation;
1418
- if (validations?.length > 0) {
1419
- validations.forEach((validation) => {
1420
- if (validation.required) {
1421
- formField['required'] = true;
1422
- }
1423
- if (validation.email) {
1424
- formField['email'] = true;
1425
- }
1426
- if (validation.minlength) {
1427
- formField['minlength'] = validation.minlength;
1428
- }
1429
- if (validation.maxlength) {
1430
- formField['maxlength'] = validation.maxlength;
1431
- }
1432
- });
1433
- }
1434
- }
1435
- });
1436
- }
1437
- });
1438
- }
1439
- }
1440
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1441
- 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 [style]=\"getStyleWithoutClasses(form?.layoutSchema?.style).style\" [class]=\"form?.layoutSchema?.style?.classes[0]\">\r\n <form *ngIf=\"form?.layoutSchema?.formSections?.length > 0\">\r\n <span *ngFor=\"let formSection of form?.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]\" [style]=\"getStyleWithoutClasses(formSection?.style).style\"\r\n *ngIf=\"formSection.formFields?.length > 0\">\r\n <div *ngFor=\"let formField of formSection.formFields\" [class]=\"formField?.style?.classes[0]\">\r\n <div\r\n [ngSwitch]=\"formField?.scope?.reference && form.propertySchema[getScope(formField.scope?.reference)] ?\r\n form.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?.scope?.style).style\"\r\n [class]=\"formField?.scope?.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'\" [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [class]=\"formField?.scope?.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\" [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 [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n </span>\r\n <span>\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.value\r\n }}\r\n </span>\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 formField.label?.value : formField.label?.caption ? formField.label?.caption :\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <div\r\n [ngStyle]=\"formField?.option.password ? {'position':'relative','display':'flex','align-items':'center'} : {}\">\r\n <input [type]=\"formField?.option.password ? !showPassword ? 'password' : 'text' : 'text'\"\r\n #inputField=\"ngModel\" [required]=\"formField?.required\" [attr.inputmode]=\"\r\n formField?.option?.email ? 'email' :\r\n formField?.option?.password ? 'numeric' :\r\n 'text'\" [pattern]=\"formField?.email ? customEmailPattern : ''\" [email]=\"formField?.email\"\r\n [class]=\"formField?.scope?.style?.classes[0]\" [minlength]=\"formField?.minlength\"\r\n [maxlength]=\"formField?.maxlength\" [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n [placeholder]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\" />\r\n\r\n <!-- Eye Icon -->\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;\">\r\n </i>\r\n </div>\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]=\"formField?.layout == 'horizontal' ? 'text-red-400 m-0 horizontal-error' : 'text-red-400 m-0'\"\r\n *ngIf=\"inputField?.errors\">{{ setErroMessage(formField, errorMessages, inputField) }}</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\" [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <h5>{{\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }} {{\r\n form.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 formField.label?.value :\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <input type=\"number\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n [placeholder]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\" />\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 [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [class]=\"formField?.scope?.style?.classes[0]\">\r\n <span *ngIf=\"formField.option?.postfixCaption\">\r\n <label class=\"form-check-label\"><input type=\"checkbox\" class=\"form-check-input mr-2\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\" (ngModelChange)=\"setformData()\" />{{\r\n form.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 form.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)]=\"form.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\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [class]=\"formField?.scope?.style?.classes[0]\">\r\n <span *ngIf=\"formField.option?.postfixCaption\">\r\n <select id=\"dynamic-dropdown\" [class]=\"formField?.scope?.style?.classes[0]\" #dropdownField=\"ngModel\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\" [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope.split('/').pop()].value\">\r\n <option\r\n *ngFor=\"let item of form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.data\"\r\n [value]=\"formField.option.optionValue\"> {{ formField.option.optionLabel}}</option>\r\n </select>\r\n <label\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\">{{form.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 <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\">{{form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n\r\n <nz-select nzShowSearch nzAllowClear nzPlaceHolder=\"Select\" #dropdownField=\"ngModel\"\r\n [required]=\"formField?.required\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\" [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\">\r\n <nz-option\r\n *ngFor=\"let item of form.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]=\"formField?.layout == 'horizontal' ? 'text-red-400 m-0 horizontal-error' : 'text-red-400 m-0'\"\r\n *ngIf=\"dropdownField?.errors\">{{ setErroMessage(formField, errorMessages, dropdownField) }}\r\n </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=\"submit\" [style]=\"getStyleWithoutClasses(formField.style).style\"\r\n (click)=\"invokeFormBtnClick(formField.option, form.propertySchema)\"\r\n [class]=\"formField?.style?.classes[0]\">\r\n {{ formField.label?.caption }}\r\n </button>\r\n </div>\r\n\r\n </div>\r\n </div>\r\n </div>\r\n </span>\r\n </form>\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type:
1442
- // Angular
1443
- 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:
1444
- // NG-ZORRO
1445
- 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" }] });
1446
- }
1447
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: FormComponent, decorators: [{
1448
- type: Component,
1449
- args: [{ standalone: true, imports: [
1450
- // Angular
1451
- CommonModule,
1452
- FormsModule,
1453
- // NG-ZORRO
1454
- NzSelectModule
1455
- ], selector: 'vl-form', template: "<div [style]=\"getStyleWithoutClasses(form?.layoutSchema?.style).style\" [class]=\"form?.layoutSchema?.style?.classes[0]\">\r\n <form *ngIf=\"form?.layoutSchema?.formSections?.length > 0\">\r\n <span *ngFor=\"let formSection of form?.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]\" [style]=\"getStyleWithoutClasses(formSection?.style).style\"\r\n *ngIf=\"formSection.formFields?.length > 0\">\r\n <div *ngFor=\"let formField of formSection.formFields\" [class]=\"formField?.style?.classes[0]\">\r\n <div\r\n [ngSwitch]=\"formField?.scope?.reference && form.propertySchema[getScope(formField.scope?.reference)] ?\r\n form.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?.scope?.style).style\"\r\n [class]=\"formField?.scope?.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'\" [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [class]=\"formField?.scope?.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\" [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 [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}\r\n </span>\r\n <span>\r\n {{\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.value\r\n }}\r\n </span>\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 formField.label?.value : formField.label?.caption ? formField.label?.caption :\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <div\r\n [ngStyle]=\"formField?.option.password ? {'position':'relative','display':'flex','align-items':'center'} : {}\">\r\n <input [type]=\"formField?.option.password ? !showPassword ? 'password' : 'text' : 'text'\"\r\n #inputField=\"ngModel\" [required]=\"formField?.required\" [attr.inputmode]=\"\r\n formField?.option?.email ? 'email' :\r\n formField?.option?.password ? 'numeric' :\r\n 'text'\" [pattern]=\"formField?.email ? customEmailPattern : ''\" [email]=\"formField?.email\"\r\n [class]=\"formField?.scope?.style?.classes[0]\" [minlength]=\"formField?.minlength\"\r\n [maxlength]=\"formField?.maxlength\" [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n [placeholder]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\" />\r\n\r\n <!-- Eye Icon -->\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;\">\r\n </i>\r\n </div>\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]=\"formField?.layout == 'horizontal' ? 'text-red-400 m-0 horizontal-error' : 'text-red-400 m-0'\"\r\n *ngIf=\"inputField?.errors\">{{ setErroMessage(formField, errorMessages, inputField) }}</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\" [style]=\"getStyleWithoutClasses(formField?.label?.style).style\"\r\n [class]=\"formField?.label?.style?.classes[0]\">\r\n <h5>{{\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }} {{\r\n form.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 formField.label?.value :\r\n form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n <input type=\"number\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\"\r\n [placeholder]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.placeholder\" />\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 [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [class]=\"formField?.scope?.style?.classes[0]\">\r\n <span *ngIf=\"formField.option?.postfixCaption\">\r\n <label class=\"form-check-label\"><input type=\"checkbox\" class=\"form-check-input mr-2\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\"\r\n [name]=\"formField.scope?.reference\" (ngModelChange)=\"setformData()\" />{{\r\n form.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 form.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)]=\"form.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\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\"\r\n [class]=\"formField?.scope?.style?.classes[0]\">\r\n <span *ngIf=\"formField.option?.postfixCaption\">\r\n <select id=\"dynamic-dropdown\" [class]=\"formField?.scope?.style?.classes[0]\" #dropdownField=\"ngModel\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\" [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope.split('/').pop()].value\">\r\n <option\r\n *ngFor=\"let item of form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.data\"\r\n [value]=\"formField.option.optionValue\"> {{ formField.option.optionLabel}}</option>\r\n </select>\r\n <label\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\">{{form.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 <div [class]=\"formField?.layout == 'horizontal' ? 'horizontal-layout' : 'row'\">\r\n <label\r\n [style]=\"getStyleWithoutClasses(formField?.label?.style).style\">{{form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.caption\r\n }}</label>\r\n\r\n <nz-select nzShowSearch nzAllowClear nzPlaceHolder=\"Select\" #dropdownField=\"ngModel\"\r\n [required]=\"formField?.required\" [class]=\"formField?.scope?.style?.classes[0]\"\r\n [style]=\"getStyleWithoutClasses(formField?.scope?.style).style\" [name]=\"formField.scope?.reference\"\r\n [(ngModel)]=\"form.propertySchema[getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()].value\">\r\n <nz-option\r\n *ngFor=\"let item of form.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]=\"formField?.layout == 'horizontal' ? 'text-red-400 m-0 horizontal-error' : 'text-red-400 m-0'\"\r\n *ngIf=\"dropdownField?.errors\">{{ setErroMessage(formField, errorMessages, dropdownField) }}\r\n </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=\"submit\" [style]=\"getStyleWithoutClasses(formField.style).style\"\r\n (click)=\"invokeFormBtnClick(formField.option, form.propertySchema)\"\r\n [class]=\"formField?.style?.classes[0]\">\r\n {{ formField.label?.caption }}\r\n </button>\r\n </div>\r\n\r\n </div>\r\n </div>\r\n </div>\r\n </span>\r\n </form>\r\n</div>" }]
1456
- }], ctorParameters: () => [], propDecorators: { errorMessages: [{
1457
- type: Input
1458
- }], creditCardError: [{
1459
- type: Input
1460
- }], form: [{
1461
- type: Input
1462
- }], selectedLanguageInfo: [{
1463
- type: Input
1464
- }], formButtonClick: [{
1465
- type: Output
1466
- }], checkBoxChangeEvent: [{
1467
- type: Output
1468
- }] } });
1469
-
1470
- class NotificationService {
1471
- toastr;
1472
- constructor(toastr) {
1473
- this.toastr = toastr;
1474
- }
1475
- success(message, time = 5000) {
1476
- this.toastr.success(message, "", { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1477
- }
1478
- info(message, time = 5000) {
1479
- this.toastr.info(message, "", { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1480
- }
1481
- warning(message, time = 20000) {
1482
- this.toastr.warning(message, "", { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1483
- }
1484
- error(error, time = 20000, message) {
1485
- this.toastr.error(error, message, { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1486
- }
1487
- 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 });
1488
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NotificationService, providedIn: 'root' });
1489
- }
1490
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NotificationService, decorators: [{
1491
- type: Injectable,
1492
- args: [{
1493
- providedIn: 'root'
1494
- }]
1495
- }], ctorParameters: () => [{ type: i1$2.ToastrService }] });
1496
-
1497
- class GridComponent {
1498
- requestService;
1499
- utilityService;
1500
- notificationService;
1501
- oktaAuthService;
1502
- isLogined = false;
1503
- tableitemInfoCopy = {};
1504
- errorMessages = {};
1505
- environment;
1506
- selectedLanguageInfo = {};
1507
- tableitemInfo = {};
1508
- form = {};
1509
- isTableDataLoad = false;
1510
- currenTableOptions = {};
1511
- projectSeleted = '';
1512
- pageSize = 5;
1513
- currentPage = 0;
1514
- pages = [];
1515
- userInfo;
1516
- onPageChange = new EventEmitter();
1517
- onPageSizeChange = new EventEmitter();
1518
- onGridScroll = new EventEmitter();
1519
- showGridLink = new EventEmitter();
1520
- gridButtonClick = new EventEmitter();
1521
- gridIncreamentClick = new EventEmitter();
1522
- gridDecreamentClick = new EventEmitter();
1523
- gridImgClick = new EventEmitter();
1524
- constructor(requestService, utilityService, notificationService, oktaAuthService) {
1525
- this.requestService = requestService;
1526
- this.utilityService = utilityService;
1527
- this.notificationService = notificationService;
1528
- this.oktaAuthService = oktaAuthService;
1529
- }
1530
- ngAfterViewInit() {
1531
- this.authenticating();
1532
- setTimeout(() => {
1533
- if (this.environment && this.environment?.login && this.environment?.login?.type == "oktaAuth") {
1534
- this.oktaAuthService.authState$.subscribe((result) => {
1535
- if (result.isAuthenticated) {
1536
- this.isLogined = true;
1537
- }
1538
- });
1539
- }
1540
- }, 500);
1541
- }
1542
- ngOnChanges(changes) {
1543
- setTimeout(() => {
1544
- if (changes['tableitemInfo'] && this.tableitemInfo) {
1545
- console.log('this.tableitemInfo: ', this.tableitemInfo);
1546
- console.log('this.selectedLanguageInfo?: ', this.selectedLanguageInfo);
1547
- this.tableitemInfoCopy = JSON.parse(JSON.stringify(this.tableitemInfo));
1548
- }
1549
- if (changes['SelectedLanguage'] || this.selectedLanguageInfo?.selectedLanguage) {
1550
- if (this.tableitemInfoCopy?.layoutSchema && this.tableitemInfoCopy.layoutSchema?.elements?.length) {
1551
- this.tableitemInfo.propertySchema = JSON.parse(JSON.stringify(this.tableitemInfoCopy.propertySchema));
1552
- this.tableitemInfo.propertySchema = this.translateSchema(this.tableitemInfo.propertySchema, this.selectedLanguageInfo.selectedLanguage);
1553
- if (this.tableitemInfoCopy?.footer) {
1554
- this.tableitemInfo.footer = JSON.parse(JSON.stringify(this.tableitemInfoCopy.footer));
1555
- this.tableitemInfo.footer = this.translateSchema(this.tableitemInfo.footer, this.selectedLanguageInfo.selectedLanguage);
1556
- }
1557
- this.tableitemInfoCopy.layoutSchema.elements.forEach((column, index) => {
1558
- if (column.label && column.label.caption && this.selectedLanguageInfo.selectedLanguage[column.label.caption]) {
1559
- this.tableitemInfo.layoutSchema.elements[index].label.caption = this.selectedLanguageInfo.selectedLanguage[column.label.caption];
1560
- }
1561
- });
1562
- }
1563
- }
1564
- }, 500);
1565
- }
1566
- translateSchema(schema, SelectedLanguage) {
1567
- if (schema && typeof schema === 'object') {
1568
- for (const key of Object.keys(schema)) {
1569
- const val = schema[key];
1570
- if (val && typeof val === 'object') {
1571
- this.translateSchema(val, SelectedLanguage);
1572
- }
1573
- if (val && val.caption !== undefined && typeof val.caption === 'string') {
1574
- const original = val.caption.trim();
1575
- if (original && SelectedLanguage[original]) {
1576
- val.caption = SelectedLanguage[original];
1577
- }
1578
- }
1579
- if (val && val.value !== undefined && typeof val.value === 'string' && !val.value.includes("{{")) {
1580
- const originalVal = val.value.trim();
1581
- if (originalVal && SelectedLanguage[originalVal]) {
1582
- val.value = SelectedLanguage[originalVal];
1583
- }
1584
- }
1585
- }
1586
- }
1587
- return schema;
1588
- }
1589
- getScope(scope) {
1590
- let propertyScope = "";
1591
- let start = scope?.indexOf("#/") + 2;
1592
- let end = scope?.indexOf("/", start);
1593
- if (start && end) {
1594
- propertyScope = scope.substring(start, end);
1595
- }
1596
- return propertyScope;
1597
- }
1598
- getStyleWithoutClasses(styleObject) {
1599
- if (!styleObject) {
1600
- return { classes: '', style: {} };
1601
- }
1602
- const { classes, ...styleWithoutClasses } = styleObject;
1603
- return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1604
- }
1605
- onScrollEvent(event) {
1606
- this.onGridScroll.emit(event);
1607
- }
1608
- showLinkDetails(option, data) {
1609
- this.showGridLink.emit({ option: option, data: data });
1610
- }
1611
- invokeGridBtnClick(option, propertySchema) {
1612
- this.gridButtonClick.emit({ option: option, propertySchema: propertySchema });
1613
- }
1614
- upsertAction(option, data) {
1615
- let url = option?.data_url;
1616
- if (url && url?.includes("{{")) {
1617
- const regex = /{{(.*?)}}/g;
1618
- const matches = [...url.matchAll(regex)].map(m => m[1]);
1619
- if (matches && data && data[matches[0]]) {
1620
- option.data_url = url.replace(`{{${matches[0]}}}`, data[matches[0]]);
1621
- }
1622
- }
1623
- let baseUrl = this.environment?.apiUrl + option.data_url;
1624
- this.requestService.dynamicCall(option.method, {}, baseUrl, option?.passToken, this.projectSeleted, this.userInfo).subscribe((res) => {
1625
- console.log('res: ', res);
1626
- if (option?.reload) {
1627
- window.location.reload();
1628
- }
1629
- else if (option.notifcation) {
1630
- if (option.notifcation.success) {
1631
- this.notificationService.success(option.notifcation.success);
1632
- let findObj = this.findDynamicKeyAndValue(option);
1633
- if (findObj.keyName) {
1634
- data[findObj.keyName] = "APPROVED";
1635
- }
1636
- }
1637
- }
1638
- });
1639
- }
1640
- setActionColumn(option, data) {
1641
- let showAction = true;
1642
- let findCondiontionalKey = this.findDynamicKeyAndValue(option);
1643
- if (findCondiontionalKey.keyName) {
1644
- showAction = data[findCondiontionalKey.keyName] === findCondiontionalKey.value ? true : false;
1645
- }
1646
- return showAction;
1647
- }
1648
- findDynamicKeyAndValue(object) {
1649
- const regex = /^\{\{(.*?)\}\}$/;
1650
- for (const key of Object.keys(object)) {
1651
- const match = key.match(regex);
1652
- if (match) {
1653
- return {
1654
- keyName: match[1].trim(),
1655
- value: object[key]
1656
- };
1657
- }
1658
- }
1659
- return null;
1660
- }
1661
- incrementQuantity(index, field, option) {
1662
- this.gridIncreamentClick.emit({ index: index, field: field, option: option });
1663
- }
1664
- invokeTableImageClick(column, data) {
1665
- this.gridImgClick.emit({ col: column, data: data });
1666
- }
1667
- decrementQuantity(index, field, option) {
1668
- this.gridDecreamentClick.emit({ index: index, field: field, option: option });
1669
- }
1670
- invokeOnPageSizeChange(pageSize) {
1671
- this.onPageSizeChange.emit(pageSize);
1672
- }
1673
- invokeGoToPage(page) {
1674
- this.onPageChange.emit(page);
1675
- }
1676
- authenticating() {
1677
- this.utilityService.getStorage(`${this.projectSeleted}Logined`).then((logined) => {
1678
- if (logined == "true") {
1679
- this.isLogined = true;
1680
- }
1681
- });
1682
- }
1683
- 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 });
1684
- 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" }] });
1685
- }
1686
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: GridComponent, decorators: [{
1687
- type: Component,
1688
- args: [{ standalone: true, imports: [
1689
- CommonModule,
1690
- FormsModule,
1691
- NzTableModule,
1692
- NzIconModule,
1693
- ButtonModule,
1694
- PaginationComponent
1695
- ], 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>" }]
1696
- }], ctorParameters: () => [{ type: RequestService }, { type: UtilityService }, { type: NotificationService }, { type: i4$1.OktaAuthStateService }], propDecorators: { errorMessages: [{
1697
- type: Input
1698
- }], environment: [{
1699
- type: Input
1700
- }], selectedLanguageInfo: [{
1701
- type: Input
1702
- }], tableitemInfo: [{
1703
- type: Input
1704
- }], form: [{
1705
- type: Input
1706
- }], isTableDataLoad: [{
1707
- type: Input
1708
- }], currenTableOptions: [{
1709
- type: Input
1710
- }], projectSeleted: [{
1711
- type: Input
1712
- }], pageSize: [{
1713
- type: Input
1714
- }], currentPage: [{
1715
- type: Input
1716
- }], pages: [{
1717
- type: Input
1718
- }], userInfo: [{
1719
- type: Input
1720
- }], onPageChange: [{
1721
- type: Output
1722
- }], onPageSizeChange: [{
1723
- type: Output
1724
- }], onGridScroll: [{
1725
- type: Output
1726
- }], showGridLink: [{
1727
- type: Output
1728
- }], gridButtonClick: [{
1729
- type: Output
1730
- }], gridIncreamentClick: [{
1731
- type: Output
1732
- }], gridDecreamentClick: [{
1733
- type: Output
1734
- }], gridImgClick: [{
1735
- type: Output
1736
- }] } });
1737
-
1738
- class HeaderMenuComponent {
1739
- oktaAuthService;
1740
- requestService;
1741
- utilityService;
1742
- platform;
1743
- isLogined = false;
1744
- headerItems = [];
1745
- headerLayout = {};
1746
- environment;
1747
- projectSeleted;
1748
- cartInfo = {
1749
- items: [],
1750
- totalPrice: 0,
1751
- quantity: 0
1752
- };
1753
- buttonClick = new EventEmitter();
1754
- showTableContent = new EventEmitter();
1755
- searchItems = new EventEmitter();
1756
- constructor(oktaAuthService, requestService, utilityService, platform) {
1757
- this.oktaAuthService = oktaAuthService;
1758
- this.requestService = requestService;
1759
- this.utilityService = utilityService;
1760
- this.platform = platform;
1761
- }
1762
- ngAfterViewInit() {
1763
- setTimeout(() => {
1764
- if (this.environment && this.environment?.login && this.environment?.login?.type == "oktaAuth") {
1765
- if (this.platform.ANDROID || this.platform.IOS) {
1766
- this.utilityService.getLocalStorage(`loginedUser`).then((logined) => {
1767
- if (logined && logined.token) {
1768
- this.requestService.getLoginUser(logined?.token).subscribe(() => {
1769
- this.isLogined = true;
1770
- });
1771
- }
1772
- });
1773
- }
1774
- this.oktaAuthService.authState$.subscribe((result) => {
1775
- if (result.isAuthenticated) {
1776
- this.isLogined = true;
1777
- }
1778
- });
1779
- }
1780
- }, 500);
1781
- }
1782
- getStyle(styleObject) {
1783
- if (!styleObject || typeof styleObject !== 'object') {
1784
- return {};
1785
- }
1786
- const { classes, ...styleWithoutClasses } = styleObject;
1787
- return styleWithoutClasses;
1788
- }
1789
- isVisible(header) {
1790
- return header?.option?.visible !== false;
1791
- }
1792
- shouldShowDefaultButton(header) {
1793
- if (!this.isVisible(header)) {
1794
- return false;
1795
- }
1796
- if (header?.option?.islogin === true) {
1797
- return this.isLogined;
1798
- }
1799
- if (header?.option?.islogin === false) {
1800
- return !this.isLogined;
1801
- }
1802
- return true;
1803
- }
1804
- invokeSearchedItems(option, search) {
1805
- this.searchItems.emit({ option: option, search: search });
1806
- }
1807
- invokeHeaderButtonClick(option) {
1808
- this.buttonClick.emit(option);
1809
- }
1810
- invokeShowtableContent(option) {
1811
- this.showTableContent.emit(option);
1812
- }
1813
- 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 });
1814
- 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" }] });
1815
- }
1816
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HeaderMenuComponent, decorators: [{
1817
- type: Component,
1818
- args: [{ standalone: true, imports: [
1819
- CommonModule,
1820
- NzIconModule
1821
- ], 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>" }]
1822
- }], ctorParameters: () => [{ type: i4$1.OktaAuthStateService }, { type: RequestService }, { type: UtilityService }, { type: i1.Platform }], propDecorators: { headerItems: [{
1823
- type: Input
1824
- }], headerLayout: [{
1825
- type: Input
1826
- }], environment: [{
1827
- type: Input
1828
- }], projectSeleted: [{
1829
- type: Input
1830
- }], cartInfo: [{
1831
- type: Input
1832
- }], buttonClick: [{
1833
- type: Output
1834
- }], showTableContent: [{
1835
- type: Output
1836
- }], searchItems: [{
1837
- type: Output
1838
- }] } });
1839
-
1840
- class NetworkLogService {
1841
- logs = [];
1842
- addLog(log) {
1843
- this.logs.unshift(log); // latest first
1844
- localStorage.setItem('networkLogs', JSON.stringify(this.logs));
1845
- }
1846
- getLogsByDate(date) {
1847
- return this.logs.filter(l => l.date === date);
1848
- }
1849
- getAll() {
1850
- return [...this.logs];
1851
- }
1852
- clear() {
1853
- this.logs = [];
1854
- localStorage.removeItem('networkLogs');
1855
- }
1856
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NetworkLogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1857
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NetworkLogService, providedIn: 'root' });
1858
- }
1859
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NetworkLogService, decorators: [{
1860
- type: Injectable,
1861
- args: [{
1862
- providedIn: 'root'
1863
- }]
1864
- }] });
1865
-
1866
- class LogsComponent {
1867
- logService;
1868
- logs = [];
1869
- expandedRow = null;
1870
- constructor(logService) {
1871
- this.logService = logService;
1872
- }
1873
- ngOnInit() {
1874
- const today = new Date().toISOString().split('T')[0];
1875
- this.logs = this.logService.getLogsByDate(today);
1876
- console.log('this.logs: ', this.logs);
1877
- }
1878
- toggleRow(index) {
1879
- this.expandedRow = this.expandedRow === index ? null : index;
1880
- }
1881
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: LogsComponent, deps: [{ token: NetworkLogService }], target: i0.ɵɵFactoryTarget.Component });
1882
- 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" }] });
1883
- }
1884
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: LogsComponent, decorators: [{
1885
- type: Component,
1886
- args: [{ standalone: true, imports: [
1887
- CommonModule
1888
- ], 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"] }]
1889
- }], ctorParameters: () => [{ type: NetworkLogService }] });
1890
-
1891
- class Label {
1892
- formField;
1893
- modalItemInfo;
1894
- getScope(scope) {
1895
- let propertyScope = "";
1896
- let start = scope?.indexOf("#/") + 2;
1897
- let end = scope?.indexOf("/", start);
1898
- if (start && end) {
1899
- propertyScope = scope.substring(start, end);
1900
- }
1901
- return propertyScope;
1902
- }
1903
- getStyleWithoutClasses(styleObject) {
1904
- if (!styleObject) {
1905
- return { classes: '', style: {} };
1906
- }
1907
- const { classes, ...styleWithoutClasses } = styleObject;
1908
- return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1909
- }
1910
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Label, deps: [], target: i0.ɵɵFactoryTarget.Component });
1911
- 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: [""] });
1912
- }
1913
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Label, decorators: [{
1914
- type: Component,
1915
- 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>" }]
1916
- }], propDecorators: { formField: [{
1917
- type: Input
1918
- }], modalItemInfo: [{
1919
- type: Input
1920
- }] } });
1921
-
1922
- class Textbox {
1923
- formField;
1924
- modalItemInfo;
1925
- getScope(scope) {
1926
- let propertyScope = "";
1927
- let start = scope?.indexOf("#/") + 2;
1928
- let end = scope?.indexOf("/", start);
1929
- if (start && end) {
1930
- propertyScope = scope.substring(start, end);
1931
- }
1932
- return propertyScope;
1933
- }
1934
- getStyleWithoutClasses(styleObject) {
1935
- if (!styleObject) {
1936
- return { classes: '', style: {} };
1937
- }
1938
- const { classes, ...styleWithoutClasses } = styleObject;
1939
- return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1940
- }
1941
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Textbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
1942
- 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"] }] });
1943
- }
1944
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Textbox, decorators: [{
1945
- type: Component,
1946
- 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\" />" }]
1947
- }], propDecorators: { formField: [{
1948
- type: Input
1949
- }], modalItemInfo: [{
1950
- type: Input
1951
- }] } });
1952
-
1953
- class Autocomplete {
1954
- formField;
1955
- modalItemInfo;
1956
- matchData;
1957
- selectedLanguageInfo;
1958
- errorMessages;
1959
- autocompSelect = new EventEmitter();
1960
- autocompChange = new EventEmitter();
1961
- autocompFocusOut = new EventEmitter();
1962
- autocompSelectEvent(event, formField) {
1963
- this.autocompSelect.emit({ event: event, formField: formField });
1964
- }
1965
- autocompChangeEvent(event, formField) {
1966
- this.autocompChange.emit({ event: event, formField: formField });
1967
- }
1968
- autocompFocusOutEvent(event, formField) {
1969
- this.autocompFocusOut.emit({ event: event, formField: formField });
1970
- }
1971
- getScope(scope) {
1972
- let propertyScope = "";
1973
- let start = scope?.indexOf("#/") + 2;
1974
- let end = scope?.indexOf("/", start);
1975
- if (start && end) {
1976
- propertyScope = scope.substring(start, end);
1977
- }
1978
- return propertyScope;
1979
- }
1980
- getStyleWithoutClasses(styleObject) {
1981
- if (!styleObject) {
1982
- return { classes: '', style: {} };
1983
- }
1984
- const { classes, ...styleWithoutClasses } = styleObject;
1985
- return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1986
- }
1987
- setErroMessage(formField, errorMessages, errorType) {
1988
- let error = "";
1989
- 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;
1990
- if (errorType == "required") {
1991
- error = this.selectedLanguageInfo?.errorMessages?.required ? this.selectedLanguageInfo?.errorMessages.required : errorMessages.required;
1992
- }
1993
- if (error && error.toString().includes("{{requiredLength}}")) {
1994
- error = error.replace(/{{\s*requiredLength\s*}}/g, formField?.minlength.toString());
1995
- }
1996
- return error.replace(/{{\s*field\s*}}/g, fieldName);
1997
- }
1998
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Autocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
1999
- 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"] }] });
2000
- }
2001
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Autocomplete, decorators: [{
2002
- type: Component,
2003
- args: [{ selector: 'vl-autocomplete', standalone: true, imports: [
2004
- FormsModule,
2005
- AutoCompleteModule,
2006
- SelectModule,
2007
- NgIf
2008
- ], 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>" }]
2009
- }], propDecorators: { formField: [{
2010
- type: Input
2011
- }], modalItemInfo: [{
2012
- type: Input
2013
- }], matchData: [{
2014
- type: Input
2015
- }], selectedLanguageInfo: [{
2016
- type: Input
2017
- }], errorMessages: [{
2018
- type: Input
2019
- }], autocompSelect: [{
2020
- type: Output
2021
- }], autocompChange: [{
2022
- type: Output
2023
- }], autocompFocusOut: [{
2024
- type: Output
2025
- }] } });
2026
-
2027
- class ModelComponent {
2028
- matchData = [];
2029
- errorMessages = {};
2030
- isModalShow = false;
2031
- modalItemInfo = {};
2032
- selectedLanguageInfo = {};
2033
- userInfo = {};
2034
- invokeButtonClick = new EventEmitter();
2035
- invokeSetFormData = new EventEmitter();
2036
- modalClose = new EventEmitter();
2037
- copyLayoutSchema = {};
2038
- isLoading = false;
2039
- constructor() {
2040
- }
2041
- ngAfterViewInit() {
2042
- }
2043
- async ngOnChanges(changes) {
2044
- if (this.isModalShow === true) {
2045
- if (this.modalItemInfo.layoutSchema) {
2046
- this.copyLayoutSchema = JSON.parse(JSON.stringify(this.modalItemInfo.layoutSchema));
2047
- }
2048
- if ((changes['selectedLanguageInfo'] || this.selectedLanguageInfo) && this.selectedLanguageInfo.selectedLanguage) {
2049
- this.modalItemInfo.layoutSchema = this.updateLayoutLanguage(this.copyLayoutSchema, this.selectedLanguageInfo.selectedLanguage);
2050
- }
2051
- if (this.modalItemInfo?.currentRecord) {
2052
- this.mapDataToPropertySchema(this.modalItemInfo.currentRecord, this.modalItemInfo);
2053
- }
2054
- await this.setAutoCompleteData();
2055
- }
2056
- }
2057
- updateLayoutLanguage(schema, translations) {
2058
- const cloned = JSON.parse(JSON.stringify(schema));
2059
- const walk = (obj) => {
2060
- if (!obj || typeof obj !== 'object')
2061
- return;
2062
- // 🔹 label.caption (most common in form schemas)
2063
- if (obj.label && typeof obj.label.caption === 'string') {
2064
- const original = obj.label.caption;
2065
- obj.label.caption = translations[original] ?? original;
2066
- }
2067
- // 🔹 direct caption (fallback / buttons / future-proof)
2068
- if (typeof obj.caption === 'string') {
2069
- const original = obj.caption;
2070
- obj.caption = translations[original] ?? original;
2071
- }
2072
- // 🚫 Skip huge data arrays (autocomplete datasets, etc.)
2073
- if (Array.isArray(obj.data))
2074
- return;
2075
- // 🔁 Recurse
2076
- Object.keys(obj).forEach((key) => {
2077
- const value = obj[key];
2078
- if (typeof value === 'object') {
2079
- walk(value);
2080
- }
2081
- });
2082
- };
2083
- walk(cloned);
2084
- return cloned;
2085
- }
2086
- mapDataToPropertySchema(data, modalItemInfo) {
2087
- if (!data || !modalItemInfo?.propertySchema)
2088
- return;
2089
- const [rootScope] = Object.keys(modalItemInfo.propertySchema);
2090
- if (!rootScope)
2091
- return;
2092
- const schemaFields = modalItemInfo.propertySchema[rootScope];
2093
- Object.keys(schemaFields).forEach((fieldKey) => {
2094
- if (data.hasOwnProperty(fieldKey)) {
2095
- if (!schemaFields[fieldKey]) {
2096
- schemaFields[fieldKey] = {};
2097
- }
2098
- schemaFields[fieldKey].value = data[fieldKey];
2099
- }
2100
- });
2101
- }
2102
- async setAutoCompleteData() {
2103
- for (const section of this.modalItemInfo.layoutSchema.formSections) {
2104
- for (const field of section.formFields || []) {
2105
- const type = this.modalItemInfo.propertySchema[this.getScope(field.scope?.reference)]?.[field.scope.reference.split('/').pop()]?.type;
2106
- if (type === 'autocomplete' && field.option?.autocomplete) {
2107
- this.isLoading = true;
2108
- field['data'] = await this.fetchAutocompleteData(field);
2109
- this.isLoading = false;
2110
- }
2111
- }
2112
- }
2113
- }
2114
- async fetchAutocompleteData(formField) {
2115
- const config = formField.option?.autocomplete;
2116
- if (!config)
2117
- return;
2118
- const request = this.resolveAutocompleteConfig(config, this.userInfo);
2119
- const response = await CapacitorHttp.request({
2120
- url: request.url,
2121
- method: request.method,
2122
- params: request.params,
2123
- headers: request.headers
2124
- });
2125
- return response.data?.length > 0 ? response.data : [];
2126
- }
2127
- resolveAutocompleteConfig(config, userInfo) {
2128
- const params = {};
2129
- Object.entries(config.params || {}).forEach(([key, value]) => {
2130
- // 🔹 Dynamic token
2131
- if (typeof value === 'string' && value.includes('{{')) {
2132
- params[key] = this.resolveToken(value, userInfo);
2133
- }
2134
- // 🔹 Computed param
2135
- else if (value?.type === 'company') {
2136
- params[key] = this.buildCompany(userInfo);
2137
- }
2138
- // 🔹 Static
2139
- else {
2140
- params[key] = value;
2141
- }
2142
- });
2143
- return {
2144
- url: `${userInfo.p5_backend_url}${config.url}`,
2145
- method: config.method || 'POST',
2146
- params,
2147
- headers: config.passToken
2148
- ? {
2149
- Authorization: `Bearer ${userInfo.token}`,
2150
- Accept: 'application/json'
2151
- }
2152
- : {}
2153
- };
2154
- }
2155
- buildCompany(userInfo) {
2156
- return userInfo.p5_plant
2157
- ? `${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant}`
2158
- : `${userInfo.p5_group}/${userInfo.p5_client}/`;
2159
- }
2160
- resolveToken(template, context) {
2161
- return template.replace(/{{(.*?)}}/g, (_, path) => {
2162
- return path.split('.').reduce((acc, key) => acc?.[key], context) ?? '';
2163
- });
2164
- }
2165
- getScope(scope) {
2166
- let propertyScope = "";
2167
- let start = scope?.indexOf("#/") + 2;
2168
- let end = scope?.indexOf("/", start);
2169
- if (start && end) {
2170
- propertyScope = scope.substring(start, end);
2171
- }
2172
- return propertyScope;
2173
- }
2174
- autocompChangeEvent(event) {
2175
- const q = (event?.event.query || '').toLowerCase();
2176
- let fieldName = event?.formField.scope?.reference?.split('/')?.pop();
2177
- if (fieldName) {
2178
- this.matchData = event?.formField.data?.filter((x) => x[fieldName] && x[fieldName]?.toLowerCase()?.startsWith(q));
2179
- }
2180
- }
2181
- autocompFocusOutEvent(event) {
2182
- const selected = event?.event.target.value;
2183
- let fieldName = event?.formField.scope?.reference?.split('/')?.pop();
2184
- if (fieldName && (selected || typeof selected !== 'object')) {
2185
- let actualObj = event?.formField.data?.find((x) => x[fieldName] == selected);
2186
- if (actualObj) {
2187
- this.autocompSelectEvent(event);
2188
- }
2189
- }
2190
- }
2191
- autocompSelectEvent(event) {
2192
- const selected = event?.event.value;
2193
- const mapping = event.formField.option?.onSelect?.mapFields;
2194
- if (!selected || !mapping)
2195
- return;
2196
- Object.entries(mapping).forEach(([targetProp, sourceKey]) => {
2197
- const scope = this.getScope(event.formField.scope.reference);
2198
- if (this.modalItemInfo.propertySchema?.[scope]?.[targetProp]) {
2199
- this.modalItemInfo.propertySchema[scope][targetProp].value = selected[sourceKey] ?? null;
2200
- }
2201
- });
2202
- }
2203
- setErroMessage(formField, errorMessages, errorType) {
2204
- let error = "";
2205
- 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;
2206
- if (errorType == "required") {
2207
- error = this.selectedLanguageInfo?.errorMessages?.required ? this.selectedLanguageInfo?.errorMessages.required : errorMessages.required;
2208
- }
2209
- if (error && error.toString().includes("{{requiredLength}}")) {
2210
- error = error.replace(/{{\s*requiredLength\s*}}/g, formField?.minlength.toString());
2211
- }
2212
- return error.replace(/{{\s*field\s*}}/g, fieldName);
2213
- }
2214
- getStyleWithoutClasses(styleObject) {
2215
- if (!styleObject) {
2216
- return { classes: '', style: {} };
2217
- }
2218
- const { classes, ...styleWithoutClasses } = styleObject;
2219
- return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
2220
- }
2221
- dateChangeEvent(formField, value) {
2222
- this.handleRules(formField, value);
2223
- }
2224
- onDateTyping(event) {
2225
- const input = event.target;
2226
- if (!input)
2227
- return;
2228
- let digits = input.value.replace(/\D/g, '');
2229
- digits = digits.substring(0, 8);
2230
- let formatted = '';
2231
- if (digits.length <= 4) {
2232
- formatted = digits;
2233
- }
2234
- else if (digits.length <= 6) {
2235
- formatted = `${digits.slice(0, 4)}-${digits.slice(4)}`;
2236
- }
2237
- else {
2238
- formatted = `${digits.slice(0, 4)}-${digits.slice(4, 6)}-${digits.slice(6)}`;
2239
- }
2240
- input.value = formatted;
2241
- }
2242
- forceNumericKeyboard(event) {
2243
- const input = event?.target;
2244
- if (input && input.tagName === 'INPUT') {
2245
- input.setAttribute('inputmode', 'numeric'); // Android
2246
- input.setAttribute('pattern', '[0-9:]*'); // iOS
2247
- input.setAttribute('type', 'tel'); // strongest signal
2248
- }
2249
- }
2250
- onTimeTyping(event) {
2251
- const input = event?.target || event?.originalEvent?.target;
2252
- if (!input)
2253
- return;
2254
- let digits = input.value.replace(/\D/g, '');
2255
- digits = digits.substring(0, 4);
2256
- let formatted = '';
2257
- if (digits.length <= 2) {
2258
- formatted = digits;
2259
- }
2260
- else {
2261
- formatted = `${digits.slice(0, 2)}:${digits.slice(2)}`;
2262
- }
2263
- input.value = formatted;
2264
- }
2265
- timeChangeEvent(formField, value) {
2266
- this.handleRules(formField, value);
2267
- }
2268
- handleRules(formField, value) {
2269
- const scope = this.getScope(formField.scope.reference);
2270
- const field = formField.scope?.reference.split('/').pop();
2271
- const rules = formField.option?.rules;
2272
- this.modalItemInfo.propertySchema[scope][field].value = value;
2273
- if (!rules)
2274
- return;
2275
- rules.forEach((rule) => {
2276
- let exist = this.isRuleTriggered(rule, formField);
2277
- if (!exist)
2278
- return;
2279
- switch (rule.action) {
2280
- case 'calculateDuration':
2281
- this.applyDurationRule(rule, formField);
2282
- break;
2283
- case 'resetValue':
2284
- this.resetRule(rule, formField);
2285
- break;
2286
- }
2287
- });
2288
- }
2289
- resetRule(rule, formField) {
2290
- const scope = this.getScope(formField.scope.reference);
2291
- if (rule?.resetValue?.length > 0) {
2292
- rule.resetValue.forEach((prop) => {
2293
- this.modalItemInfo.propertySchema[scope][prop].value = null;
2294
- });
2295
- }
2296
- }
2297
- isRuleTriggered(rule, formField) {
2298
- if (rule.when === 'timeRangeComplete') {
2299
- const scope = this.getScope(formField.scope.reference);
2300
- return (this.modalItemInfo.propertySchema[scope]?.workDayTimeFrom?.value &&
2301
- this.modalItemInfo.propertySchema[scope]?.workDayTimeTo?.value);
2302
- }
2303
- else if (rule.when === 'change') {
2304
- return true;
2305
- }
2306
- return false;
2307
- }
2308
- applyDurationRule(rule, formField) {
2309
- const scope = this.getScope(formField.scope.reference);
2310
- const schema = this.modalItemInfo.propertySchema[scope];
2311
- const fromTimeVal = schema?.workDayTimeFrom?.value;
2312
- const toTimeVal = schema?.workDayTimeTo?.value;
2313
- const baseDateVal = schema?.fromDate?.value;
2314
- // 🔒 Guard
2315
- if (!fromTimeVal || !toTimeVal || !baseDateVal) {
2316
- schema[rule.params.durationField].value = '';
2317
- return;
2318
- }
2319
- // 📅 Base date (From Date)
2320
- const baseDate = new Date(baseDateVal);
2321
- baseDate.setHours(0, 0, 0, 0);
2322
- // ⏱ FROM datetime
2323
- const fromDateTime = new Date(baseDate);
2324
- fromDateTime.setHours(fromTimeVal.getHours(), fromTimeVal.getMinutes(), 0, 0);
2325
- // ⏱ TO datetime
2326
- let toDateTime = new Date(baseDate);
2327
- toDateTime.setHours(toTimeVal.getHours(), toTimeVal.getMinutes(), 0, 0);
2328
- // 🌙 Overnight handling
2329
- if (toDateTime <= fromDateTime) {
2330
- toDateTime.setDate(toDateTime.getDate() + 1);
2331
- }
2332
- // ⏳ Duration calculation
2333
- const diffMs = toDateTime.getTime() - fromDateTime.getTime();
2334
- const totalMinutes = Math.floor(diffMs / 60000);
2335
- const hours = Math.floor(totalMinutes / 60);
2336
- const minutes = totalMinutes % 60;
2337
- const duration = `${hours}:${minutes.toString().padStart(2, '0')}`;
2338
- // ✅ Set duration
2339
- schema[rule.params.durationField].value = duration;
2340
- // ✅ Auto set To Date
2341
- schema.toDate.value = new Date(toDateTime);
2342
- }
2343
- invokeSetformData() {
2344
- this.invokeSetFormData.emit();
2345
- }
2346
- invokeFormBtnClick(option, propertySchema, form) {
2347
- if (option.innerAction === 'submit') {
2348
- let valid = this.checkValidty(form);
2349
- if (valid) {
2350
- this.invokeButtonClick.emit({ option: option, propertySchema: propertySchema, recordIndex: this.modalItemInfo?.recordIndex });
2351
- }
2352
- }
2353
- else {
2354
- this.invokeButtonClick.emit({ option: option, propertySchema: propertySchema });
2355
- }
2356
- }
2357
- checkValidty(form) {
2358
- if (!form) {
2359
- return false;
2360
- }
2361
- Object.values(form.controls).forEach(control => {
2362
- control.markAsTouched();
2363
- control.updateValueAndValidity();
2364
- });
2365
- return !!form.valid;
2366
- }
2367
- onCancel() {
2368
- this.modalClose.emit();
2369
- }
2370
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ModelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2371
- 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" }] });
2372
- }
2373
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ModelComponent, decorators: [{
2374
- type: Component,
2375
- args: [{ standalone: true, selector: 'vl-model', imports: [
2376
- CommonModule,
2377
- FormsModule,
2378
- NzModalModule,
2379
- NzSelectModule,
2380
- NzDatePickerModule,
2381
- DatePickerModule,
2382
- AutoCompleteModule,
2383
- InputTextModule,
2384
- Label,
2385
- Textbox,
2386
- String$1,
2387
- Autocomplete
2388
- ], 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>" }]
2389
- }], ctorParameters: () => [], propDecorators: { errorMessages: [{
2390
- type: Input
2391
- }], isModalShow: [{
2392
- type: Input
2393
- }], modalItemInfo: [{
2394
- type: Input
2395
- }], selectedLanguageInfo: [{
2396
- type: Input
2397
- }], userInfo: [{
2398
- type: Input
2399
- }], invokeButtonClick: [{
2400
- type: Output
2401
- }], invokeSetFormData: [{
2402
- type: Output
2403
- }], modalClose: [{
2404
- type: Output
2405
- }] } });
2406
-
2407
- class Button {
2408
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Button, deps: [], target: i0.ɵɵFactoryTarget.Component });
2409
- 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: [""] });
2410
- }
2411
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Button, decorators: [{
2412
- type: Component,
2413
- args: [{ selector: 'vl-button', standalone: true, template: "<p>button works!</p>\r\n" }]
2414
- }] });
2415
-
2416
- let Date$1 = class Date {
2417
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Date, deps: [], target: i0.ɵɵFactoryTarget.Component });
2418
- 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: [""] });
2419
- };
2420
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Date$1, decorators: [{
2421
- type: Component,
2422
- args: [{ selector: 'vl-date', standalone: true, template: "<p>date works!</p>\r\n" }]
2423
- }] });
2424
-
2425
- class Dropdown {
2426
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Dropdown, deps: [], target: i0.ɵɵFactoryTarget.Component });
2427
- 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: [""] });
2428
- }
2429
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Dropdown, decorators: [{
2430
- type: Component,
2431
- args: [{ selector: 'vl-dropdown', standalone: true, template: "<p>dropdown works!</p>\r\n" }]
2432
- }] });
2433
-
2434
- class ErrorMessage {
2435
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorMessage, deps: [], target: i0.ɵɵFactoryTarget.Component });
2436
- 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: [""] });
2437
- }
2438
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorMessage, decorators: [{
2439
- type: Component,
2440
- args: [{ selector: 'vl-error-message', standalone: true, template: "<p>error-message works!</p>\r\n" }]
2441
- }] });
2442
-
2443
- class Time {
2444
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Time, deps: [], target: i0.ɵɵFactoryTarget.Component });
2445
- 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: [""] });
2446
- }
2447
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Time, decorators: [{
2448
- type: Component,
2449
- args: [{ selector: 'vl-time', standalone: true, template: "<p>time works!</p>\r\n" }]
2450
- }] });
2451
-
2452
- class Couchdb {
2453
- utilityService;
2454
- couchDbBaseUrl = 'https://couchdb.yomotech.de';
2455
- constructor(utilityService) {
2456
- this.utilityService = utilityService;
2457
- }
2458
- async getTenantDatabases(tenantKey) {
2459
- if (!tenantKey || !tenantKey.trim()) {
2460
- throw new Error('Missing tenantKey');
2461
- }
2462
- const response = await fetch(`https://couchdb.yomotech.de/tenant-dbs`, {
2463
- method: 'GET',
2464
- headers: {
2465
- Accept: 'application/json',
2466
- 'X-Tenant-Key': tenantKey.trim(),
2467
- },
2468
- });
2469
- const data = await this.parseJsonOrText(response);
2470
- if (!response.ok) {
2471
- throw new Error(`GET /tenant-dbs -> ${response.status} ${this.stringifyErrorDetails(data)}`);
2472
- }
2473
- return data;
2474
- }
2475
- async parseJsonOrText(response) {
2476
- const rawText = await response.text();
2477
- if (!rawText)
2478
- return null;
2479
- try {
2480
- return JSON.parse(rawText);
2481
- }
2482
- catch {
2483
- return rawText;
2484
- }
2485
- }
2486
- stringifyErrorDetails(data) {
2487
- if (typeof data === 'string')
2488
- return data;
2489
- try {
2490
- return JSON.stringify(data);
2491
- }
2492
- catch {
2493
- return 'Unknown error';
2494
- }
2495
- }
2496
- async getFileContentFromCouchDb(couchDbName, filePath) {
2497
- try {
2498
- const dbName = couchDbName;
2499
- const docId = filePath?.trim();
2500
- if (!docId) {
2501
- console.error('Missing file path');
2502
- return null;
2503
- }
2504
- const response = await fetch(this.getDocumentUrl(dbName, docId), {
2505
- method: 'GET',
2506
- headers: await this.getReadHeaders(),
2507
- });
2508
- const doc = await this.parseJsonOrText(response);
2509
- if (!response.ok) {
2510
- console.error(`Failed to fetch file "${docId}" from "${dbName}": ${response.status}`, doc);
2511
- return null;
2512
- }
2513
- if (!doc?.data) {
2514
- console.error(`Document "${docId}" does not contain file data`);
2515
- return null;
2516
- }
2517
- // do not decode images as utf8 text
2518
- if (doc.type === 'media' ||
2519
- doc.type === 'base64file' ||
2520
- this.isBinaryMediaFile(doc.name || doc.path || docId, doc.contentType)) {
2521
- return {
2522
- type: doc.type || 'base64file',
2523
- mimeType: this.getMimeType(doc.name || doc.path || docId, doc.contentType),
2524
- base64: doc.data,
2525
- src: `data:${this.getMimeType(doc.name || doc.path || docId, doc.contentType)};base64,${doc.data}`,
2526
- name: doc.name,
2527
- path: doc.path,
2528
- metadata: doc.metadata || {},
2529
- };
2530
- }
2531
- const decodedContent = this.fromBase64(doc.data);
2532
- if (this.isJsonFile(doc.name || doc.path || docId, doc.contentType)) {
2533
- try {
2534
- return JSON.parse(decodedContent);
2535
- }
2536
- catch (jsonError) {
2537
- console.error(`Failed to parse JSON for file "${docId}"`, jsonError);
2538
- return decodedContent;
2539
- }
2540
- }
2541
- return decodedContent;
2542
- }
2543
- catch (error) {
2544
- console.error(`Unexpected error while fetching file "${filePath}" from "${couchDbName}"`, error);
2545
- return null;
2546
- }
2547
- }
2548
- isBinaryMediaFile(fileNameOrPath, contentType) {
2549
- const lower = (fileNameOrPath || '').toLowerCase();
2550
- const type = contentType || '';
2551
- return (type.startsWith('image/') ||
2552
- type.startsWith('video/') ||
2553
- type.startsWith('audio/') ||
2554
- type === 'application/pdf' ||
2555
- lower.endsWith('.png') ||
2556
- lower.endsWith('.jpg') ||
2557
- lower.endsWith('.jpeg') ||
2558
- lower.endsWith('.ico') ||
2559
- lower.endsWith('.svg') ||
2560
- lower.endsWith('.webp') ||
2561
- lower.endsWith('.gif') ||
2562
- lower.endsWith('.mp4') ||
2563
- lower.endsWith('.webm') ||
2564
- lower.endsWith('.mp3') ||
2565
- lower.endsWith('.wav') ||
2566
- lower.endsWith('.m4a') ||
2567
- lower.endsWith('.pdf'));
2568
- }
2569
- getMimeType(fileNameOrPath, contentType) {
2570
- if (contentType)
2571
- return contentType;
2572
- const lower = (fileNameOrPath || '').toLowerCase();
2573
- if (lower.endsWith('.png'))
2574
- return 'image/png';
2575
- if (lower.endsWith('.jpg') || lower.endsWith('.jpeg'))
2576
- return 'image/jpeg';
2577
- if (lower.endsWith('.ico'))
2578
- return 'image/x-icon';
2579
- if (lower.endsWith('.svg'))
2580
- return 'image/svg+xml';
2581
- if (lower.endsWith('.webp'))
2582
- return 'image/webp';
2583
- if (lower.endsWith('.gif'))
2584
- return 'image/gif';
2585
- if (lower.endsWith('.mp4'))
2586
- return 'video/mp4';
2587
- if (lower.endsWith('.webm'))
2588
- return 'video/webm';
2589
- if (lower.endsWith('.mp3'))
2590
- return 'audio/mpeg';
2591
- if (lower.endsWith('.wav'))
2592
- return 'audio/wav';
2593
- if (lower.endsWith('.m4a'))
2594
- return 'audio/mp4';
2595
- if (lower.endsWith('.pdf'))
2596
- return 'application/pdf';
2597
- return 'application/octet-stream';
2598
- }
2599
- getImageMimeType(fileNameOrPath) {
2600
- const lower = (fileNameOrPath || '').toLowerCase();
2601
- if (lower.endsWith('.png'))
2602
- return 'image/png';
2603
- if (lower.endsWith('.jpg') || lower.endsWith('.jpeg'))
2604
- return 'image/jpeg';
2605
- if (lower.endsWith('.ico'))
2606
- return 'image/x-icon';
2607
- if (lower.endsWith('.svg'))
2608
- return 'image/svg+xml';
2609
- return 'image/png';
2610
- }
2611
- fromBase64(base64) {
2612
- try {
2613
- return decodeURIComponent(escape(atob(base64)));
2614
- }
2615
- catch {
2616
- return atob(base64);
2617
- }
2618
- }
2619
- isJsonFile(fileNameOrPath, contentType) {
2620
- const lower = (fileNameOrPath || '').toLowerCase();
2621
- return lower.endsWith('.json') || contentType === 'application/json';
2622
- }
2623
- getDocumentUrl(dbName, docId) {
2624
- return `${this.getDbUrl(dbName)}/${encodeURIComponent(docId)}`;
2625
- }
2626
- getDbUrl(dbName) {
2627
- return `${this.couchDbBaseUrl}/${dbName}`;
2628
- }
2629
- async getReadHeaders() {
2630
- return {
2631
- Accept: 'application/json',
2632
- ...(await this.buildTenantHeaders()),
2633
- };
2634
- }
2635
- async buildTenantHeaders() {
2636
- const tenantKey = await this.utilityService.getStorage('tenantKey');
2637
- const tenantName = await this.utilityService.getStorage('tenantName');
2638
- const selectedTenant = await this.utilityService.getLocalStorage('selectedTenant');
2639
- if (tenantKey) {
2640
- if (typeof tenantKey !== 'string' || !tenantKey.trim()) {
2641
- throw new Error('Missing tenantKey');
2642
- }
2643
- return {
2644
- 'X-Tenant-Key': tenantKey.trim(),
2645
- };
2646
- }
2647
- else {
2648
- if (typeof tenantName !== 'string' || !tenantName.trim() || !tenantName.trim()) {
2649
- throw new Error('Missing tenantName');
2650
- }
2651
- return {
2652
- 'X-Tenant': tenantName ? tenantName.trim() : selectedTenant.trim(),
2653
- };
2654
- }
2655
- }
2656
- async getImageSrcFromCouchDb(couchDbName, filePath) {
2657
- const dbName = couchDbName;
2658
- const docId = filePath?.trim();
2659
- if (!docId) {
2660
- throw new Error('Missing file path');
2661
- }
2662
- const response = await fetch(this.getDocumentUrl(dbName, docId), {
2663
- method: 'GET',
2664
- headers: await this.getReadHeaders(),
2665
- });
2666
- const doc = await this.parseJsonOrText(response);
2667
- if (!response.ok) {
2668
- throw new Error(`Failed to fetch image "${docId}" from "${dbName}": ${response.status} ${this.stringifyErrorDetails(doc)}`);
2669
- }
2670
- if (!doc?.data) {
2671
- throw new Error(`Document "${docId}" does not contain image data`);
2672
- }
2673
- const mimeType = doc.contentType || 'image/png';
2674
- return `data:${mimeType};base64,${doc.data}`;
2675
- }
2676
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Couchdb, deps: [{ token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
2677
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Couchdb, providedIn: 'root' });
2678
- }
2679
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Couchdb, decorators: [{
2680
- type: Injectable,
2681
- args: [{
2682
- providedIn: 'root',
2683
- }]
2684
- }], ctorParameters: () => [{ type: UtilityService }] });
2685
-
2686
- class ConfigService {
2687
- couchdbService;
2688
- utilityService;
2689
- platform;
2690
- config;
2691
- skipOkta = false;
2692
- keycloakConfig;
2693
- constructor(couchdbService, utilityService, platform) {
2694
- this.couchdbService = couchdbService;
2695
- this.utilityService = utilityService;
2696
- this.platform = platform;
2697
- }
2698
- async loadOktaConfig(projectName) {
2699
- try {
2700
- let tenantKey = "";
2701
- let tenantName = "";
2702
- if (this.platform.ANDROID || this.platform.IOS) {
2703
- tenantKey = await this.utilityService.getLocalStorage('tenantKey');
2704
- tenantName = await this.utilityService.getLocalStorage('tenantName');
2705
- }
2706
- else {
2707
- tenantKey = await this.utilityService.getStorage('tenantKey');
2708
- tenantName = await this.utilityService.getStorage('tenantName');
2709
- }
2710
- if (tenantName) {
2711
- console.log('tenantName-44: ', tenantName);
2712
- console.log('projectName-55: ', projectName);
2713
- this.config = await this.couchdbService.getFileContentFromCouchDb(`${tenantName}_${projectName}`, 'environments/environment.json');
2714
- }
2715
- else {
2716
- console.log('projectName--66: ', projectName);
2717
- this.config = await this.couchdbService.getFileContentFromCouchDb(`${projectName}`, 'environments/environment.json');
2718
- }
2719
- if (this.platform.ANDROID || this.platform.IOS) {
2720
- if (this.config.environment.login.mobile) {
2721
- this.setConfiguration(this.config.environment.login.mobile);
2722
- }
2723
- else {
2724
- this.setConfiguration(null);
2725
- }
2726
- }
2727
- else {
2728
- if (this.config.environment.login.web) {
2729
- this.setConfiguration(this.config.environment.login.web);
2730
- }
2731
- else {
2732
- this.setConfiguration(null);
2733
- }
2734
- }
2735
- }
2736
- catch (err) {
2737
- console.error('Error loading config:', err);
2738
- }
2739
- }
2740
- setConfiguration(config) {
2741
- if (config) {
2742
- this.config = config;
2743
- }
2744
- else {
2745
- this.config = {
2746
- issuer: 'http://dummy',
2747
- clientId: 'dummy',
2748
- redirectUri: 'http://dummy',
2749
- pkce: true,
2750
- };
2751
- }
2752
- }
2753
- skipOktaConfig() {
2754
- this.skipOkta = true;
2755
- }
2756
- get oktaConfig() {
2757
- if (this.skipOkta) {
2758
- return null;
2759
- }
2760
- return this.config;
2761
- }
2762
- async loadKeycloakConfig(projectName) {
2763
- let tenantKey = "";
2764
- let tenantName = "";
2765
- if (this.platform.ANDROID || this.platform.IOS) {
2766
- tenantKey = await this.utilityService.getLocalStorage('tenantKey');
2767
- tenantName = await this.utilityService.getLocalStorage('tenantName');
2768
- }
2769
- else {
2770
- tenantKey = await this.utilityService.getStorage('tenantKey');
2771
- tenantName = await this.utilityService.getStorage('tenantName');
2772
- }
2773
- let env = {};
2774
- if (tenantName) {
2775
- console.log('tenantName-11: ', tenantName);
2776
- console.log('projectName-22: ', projectName);
2777
- env = await this.couchdbService.getFileContentFromCouchDb(`${tenantName}_${projectName}`, 'environments/environment.json');
2778
- }
2779
- else {
2780
- console.log('projectName--33: ', projectName);
2781
- env = await this.couchdbService.getFileContentFromCouchDb(`${projectName}`, 'environments/environment.json');
2782
- }
2783
- if (env?.environment?.login.type === "keycloak") {
2784
- if (this.platform.ANDROID || this.platform.IOS) {
2785
- this.keycloakConfig = {
2786
- issuer: "https://keycloak-poc.wilken.de/realms/p5",
2787
- clientId: "mobile",
2788
- redirectUri: "de.yomotech:/login/callback",
2789
- logoutRedirectUri: "de.yomotech:/login/callback",
2790
- scope: "openid profile email",
2791
- responseType: "code"
2792
- };
2793
- }
2794
- else {
2795
- this.keycloakConfig = {
2796
- issuer: env?.environment?.login?.web?.issuer ?? 'http://dummy',
2797
- clientId: env?.environment?.login?.web?.clientId ?? 'dummy',
2798
- redirectUri: window.location.origin,
2799
- responseType: 'code',
2800
- scope: 'openid profile email',
2801
- showDebugInformation: true
2802
- };
2803
- }
2804
- }
2805
- else {
2806
- this.keycloakConfig = {};
2807
- }
2808
- }
2809
- getKeycloakConfig() {
2810
- return this.keycloakConfig;
2811
- }
2812
- getKeycloakMobileConfig() {
2813
- if (!this.keycloakConfig)
2814
- return null;
2815
- return {
2816
- issuer: this.keycloakConfig?.issuer,
2817
- clientId: this.keycloakConfig?.clientId,
2818
- redirectUri: this.keycloakConfig.redirectUri,
2819
- logoutRedirectUri: this.keycloakConfig.logoutRedirectUri,
2820
- scope: this.keycloakConfig.scope,
2821
- responseType: this.keycloakConfig.responseType
2822
- };
2823
- }
2824
- 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 });
2825
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfigService, providedIn: 'root' });
2826
- }
2827
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfigService, decorators: [{
2828
- type: Injectable,
2829
- args: [{
2830
- providedIn: 'root'
2831
- }]
2832
- }], ctorParameters: () => [{ type: Couchdb }, { type: UtilityService }, { type: i1.Platform }] });
2833
-
2834
- class MobileKeycloakService {
2835
- config;
2836
- http;
2837
- utilityService;
2838
- platform;
2839
- tokens = null;
2840
- constructor(config, http, utilityService, platform) {
2841
- this.config = config;
2842
- this.http = http;
2843
- this.utilityService = utilityService;
2844
- this.platform = platform;
2845
- if (Capacitor.isNativePlatform()) {
2846
- App.addListener('appUrlOpen', async (url) => {
2847
- // Nothing to do here; capacitor-oauth2 resolves internally.
2848
- // Keep listener to satisfy deep link expectations.
2849
- });
2850
- }
2851
- }
2852
- async login() {
2853
- if (!Capacitor.isNativePlatform())
2854
- return null;
2855
- const cfg = this.config.getKeycloakMobileConfig();
2856
- const discoveryUrl = `${cfg.issuer}/.well-known/openid-configuration`;
2857
- const discovery = await (await fetch(discoveryUrl)).json();
2858
- const result = await OAuth2Client.authenticate({
2859
- appId: cfg.clientId, // <--- Keycloak clientId goes here
2860
- authorizationBaseUrl: discovery.authorization_endpoint,
2861
- accessTokenEndpoint: discovery.token_endpoint,
2862
- responseType: 'code',
2863
- redirectUrl: cfg.redirectUri,
2864
- scope: cfg.scope,
2865
- pkceEnabled: true,
2866
- logsEnabled: true
2867
- });
2868
- console.log('result-KEyClaok: ', result);
2869
- this.tokens = {
2870
- access_token: result?.access_token_response?.access_token ? result?.access_token_response?.access_token : result.access_token,
2871
- refresh_token: result?.access_token_response?.refresh_token,
2872
- id_token: result?.access_token_response?.id_token,
2873
- expires_in: result?.access_token_response?.expires_at ? result?.access_token_response?.expires_at : result?.access_token_response?.expires_in,
2874
- token_type: result?.access_token_response?.token_type
2875
- };
2876
- let keycloakLoginUser = "";
2877
- if (this.tokens.access_token) {
2878
- keycloakLoginUser = await this.getUserInfo(this.tokens.access_token, cfg.issuer);
2879
- console.log('keycloakLoginUser: ', keycloakLoginUser);
2880
- if (keycloakLoginUser) {
2881
- this.tokens['issuer'] = cfg.issuer;
2882
- this.utilityService.setLocalStorage("KeycloakInfo", this.tokens);
2883
- if (this.platform.ANDROID || this.platform.IOS) {
2884
- window.location.reload();
2885
- }
2886
- }
2887
- }
2888
- return keycloakLoginUser;
2889
- }
2890
- async getUserInfo(accessToken, issuer) {
2891
- try {
2892
- const headers = new HttpHeaders({
2893
- Authorization: `Bearer ${accessToken}`,
2894
- });
2895
- const url = `${issuer}/protocol/openid-connect/userinfo`;
2896
- return await this.http.get(url, { headers }).toPromise();
2897
- }
2898
- catch (err) {
2899
- console.error('Error fetching user info:', err);
2900
- throw err;
2901
- }
2902
- }
2903
- getAccessToken() {
2904
- return this.tokens?.access_token ?? null;
2905
- }
2906
- getRefreshToken() {
2907
- return this.tokens?.refresh_token ?? null;
2908
- }
2909
- async logout() {
2910
- const keycloakInfo = await this.utilityService.getLocalStorage('KeycloakInfo');
2911
- const cfg = this.config.getKeycloakMobileConfig();
2912
- const idToken = keycloakInfo?.keycloakInfo?.id_token;
2913
- const accessToken = keycloakInfo?.keycloakInfo?.access_token;
2914
- if (!idToken || !accessToken) {
2915
- console.warn('No tokens found for logout');
2916
- return;
2917
- }
2918
- const endSessionUrl = `${cfg.issuer}/protocol/openid-connect/logout` +
2919
- `?id_token_hint=${encodeURIComponent(idToken)}` +
2920
- `&client_id=${encodeURIComponent(cfg.clientId)}` +
2921
- `&post_logout_redirect_uri=${encodeURIComponent(cfg.logoutRedirectUri)}`;
2922
- console.log('Logout URL:', endSessionUrl);
2923
- await Browser.open({ url: endSessionUrl });
2924
- this.tokens = null;
2925
- await this.utilityService.removeLocalStorage('KeycloakInfo');
2926
- window.location.reload();
2927
- }
2928
- 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 });
2929
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: MobileKeycloakService, providedIn: 'root' });
2930
- }
2931
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: MobileKeycloakService, decorators: [{
2932
- type: Injectable,
2933
- args: [{
2934
- providedIn: 'root'
2935
- }]
2936
- }], ctorParameters: () => [{ type: ConfigService }, { type: i1$1.HttpClient }, { type: UtilityService }, { type: i1.Platform }] });
2937
-
2938
- class SideMenuComponent {
2939
- i18n;
2940
- mobileKeycloakService;
2941
- couchdbService;
2942
- oauthService;
2943
- platform;
2944
- requestService;
2945
- utilityService;
2946
- dialogService;
2947
- oktaAuthService;
2948
- notificationService;
2949
- oktaAuth;
2950
- isCollapsed = false;
2951
- isMobile = false;
2952
- projectsLayoutSchema;
2953
- loginUser = {};
2954
- isLogined = false;
2955
- loginedUserInfo = {};
2956
- menuItemsCopy = {};
2957
- settingMenu = {};
2958
- setLanguage = false;
2959
- tenantKey = '';
2960
- tenantName = '';
2961
- menuItems = [];
2962
- userInfo = {};
2963
- settings = {};
2964
- projects;
2965
- environment;
2966
- projectSeleted;
2967
- languageChange = new EventEmitter();
2968
- invokeMenu = new EventEmitter();
2969
- menuToggle = new EventEmitter();
2970
- invokeProject = new EventEmitter();
2971
- errorMessage = new EventEmitter();
2972
- deleteProject = new EventEmitter();
2973
- PRIME_DE = {
2974
- firstDayOfWeek: 1,
2975
- dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
2976
- dayNamesShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
2977
- dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
2978
- monthNames: [
2979
- 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni',
2980
- 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
2981
- ],
2982
- monthNamesShort: [
2983
- 'Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun',
2984
- 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'
2985
- ],
2986
- today: 'Heute',
2987
- clear: 'Löschen',
2988
- dateFormat: 'yy-mm-dd',
2989
- weekHeader: 'KW'
2990
- };
2991
- PRIME_EN = {
2992
- firstDayOfWeek: 0,
2993
- dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
2994
- dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
2995
- dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
2996
- monthNames: [
2997
- 'January', 'February', 'March', 'April', 'May', 'June',
2998
- 'July', 'August', 'September', 'October', 'November', 'December'
2999
- ],
3000
- monthNamesShort: [
3001
- 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
3002
- 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
3003
- ],
3004
- today: 'Today',
3005
- clear: 'Clear',
3006
- dateFormat: 'yy-mm-dd',
3007
- weekHeader: 'Wk'
3008
- };
3009
- sideMenu;
3010
- constructor(i18n, mobileKeycloakService, couchdbService, oauthService, platform, requestService, utilityService, dialogService, oktaAuthService, notificationService, oktaAuth) {
3011
- this.i18n = i18n;
3012
- this.mobileKeycloakService = mobileKeycloakService;
3013
- this.couchdbService = couchdbService;
3014
- this.oauthService = oauthService;
3015
- this.platform = platform;
3016
- this.requestService = requestService;
3017
- this.utilityService = utilityService;
3018
- this.dialogService = dialogService;
3019
- this.oktaAuthService = oktaAuthService;
3020
- this.notificationService = notificationService;
3021
- this.oktaAuth = oktaAuth;
3022
- }
3023
- onDocumentClick(event) {
3024
- const path = event.composedPath();
3025
- const clickedInsideMenu = path.some(el => el === this.sideMenu?.nativeElement);
3026
- const clickedToggle = path.some(el => el instanceof HTMLElement &&
3027
- el.classList?.contains('side-toggle-handle'));
3028
- if (!clickedInsideMenu && !clickedToggle && this.isMobile) {
3029
- console.log('OUTSIDE CLICK');
3030
- let btn = document.getElementById('toggle-id');
3031
- if (btn && !this.isCollapsed) {
3032
- btn.click();
3033
- }
3034
- }
3035
- }
3036
- toggleCollapsed() {
3037
- if (this.isMobile) {
3038
- this.isCollapsed = !this.isCollapsed;
3039
- const sideMenu = document.querySelector('.side-menu');
3040
- if (sideMenu) {
3041
- sideMenu.classList.toggle('open', !this.isCollapsed);
3042
- }
3043
- }
3044
- else {
3045
- this.isCollapsed = !this.isCollapsed;
3046
- }
3047
- }
3048
- async ngOnInit() {
3049
- if (this.platform.ANDROID || this.platform.IOS) {
3050
- this.isCollapsed = true;
3051
- this.isMobile = true;
3052
- this.tenantKey = await this.utilityService.getLocalStorage('tenantKey');
3053
- this.tenantName = await this.utilityService.getLocalStorage('tenantName');
3054
- }
3055
- else {
3056
- this.tenantKey = await this.utilityService.getStorage('tenantKey');
3057
- this.tenantName = await this.utilityService.getStorage('tenantName');
3058
- }
3059
- }
3060
- ngOnChanges(changes) {
3061
- this.setLoginUser();
3062
- if (changes['menuItems'] && this.menuItems?.length) {
3063
- this.menuItemsCopy = JSON.parse(JSON.stringify(this.menuItems));
3064
- this.setProjectSetting();
3065
- this.setSettingImages();
3066
- }
3067
- }
3068
- async setProjectSetting() {
3069
- const tasks = [];
3070
- this.menuItems.forEach((menuItem) => {
3071
- if (menuItem?.label?.caption === "Setting" && menuItem?.submenu?.length) {
3072
- menuItem?.submenu.forEach((subMenu) => {
3073
- if (subMenu?.label?.caption === "Languages" && subMenu?.submenu?.length) {
3074
- subMenu?.submenu.forEach((childMenu) => {
3075
- tasks.push((async () => {
3076
- try {
3077
- let projectName = `${this.tenantName}_${this.projectSeleted}`;
3078
- const image = await this.couchdbService.getFileContentFromCouchDb(projectName, childMenu.icon);
3079
- childMenu.icon = this.getMediaSrc(image);
3080
- }
3081
- catch (err) {
3082
- console.error("Failed to fetch icon:", err);
3083
- }
3084
- })());
3085
- });
3086
- }
3087
- });
3088
- }
3089
- });
3090
- await Promise.all(tasks);
3091
- }
3092
- async ngAfterViewInit() {
3093
- let mobileLang = await this.getDeviceLanguage();
3094
- if (mobileLang) {
3095
- this.changeLanguage(mobileLang + '.json');
3096
- }
3097
- setTimeout(async () => {
3098
- this.initializeProjects();
3099
- await this.setLoginUser();
3100
- }, 1000);
3101
- }
3102
- async getDeviceLanguage() {
3103
- const info = await Device.getLanguageCode();
3104
- return info.value; // e.g. 'en', 'ur', 'de'
3105
- }
3106
- async setLoginUser() {
3107
- try {
3108
- if (this.environment?.login?.type === 'oktaAuth') {
3109
- if (this.platform.ANDROID || this.platform.IOS) {
3110
- const logined = await this.utilityService.getLocalStorage('loginedUser');
3111
- if (logined?.token) {
3112
- this.requestService.getLoginUser(logined.token).subscribe({
3113
- next: (userInfo) => {
3114
- this.loginUser = { ...this.userInfo, ...logined };
3115
- this.setLoginedUser(this.loginUser);
3116
- },
3117
- error: (err) => {
3118
- console.error('Failed to fetch login user (mobile):', err);
3119
- }
3120
- });
3121
- }
3122
- }
3123
- else {
3124
- this.oktaAuthService.authState$.subscribe({
3125
- next: async (result) => {
3126
- if (result.isAuthenticated) {
3127
- try {
3128
- const oktaWebUser = await this.oktaAuth.getUser();
3129
- const webLoginedUser = { ...this.userInfo, ...oktaWebUser };
3130
- this.loginUser = webLoginedUser;
3131
- this.setLoginedUser(this.loginUser);
3132
- }
3133
- catch (err) {
3134
- console.error('Failed to fetch Okta web user:', err);
3135
- }
3136
- }
3137
- },
3138
- error: (err) => {
3139
- console.error('Okta auth state subscription error:', err);
3140
- }
3141
- });
3142
- }
3143
- }
3144
- else if (this.environment?.login?.type === 'jwtToken' && this.userInfo?.jwt) {
3145
- const userInfo = this.getUserInfoFromToken(this.userInfo.jwt);
3146
- this.loginUser = userInfo;
3147
- this.setLoginedUser(this.loginUser);
3148
- }
3149
- else if (this.environment?.login?.type === 'keycloak' && this.userInfo?.name) {
3150
- this.loginUser = this.userInfo;
3151
- this.setLoginedUser(this.loginUser);
3152
- }
3153
- }
3154
- catch (error) {
3155
- console.error('Error in setLoginUser:', error);
3156
- }
3157
- }
3158
- getUserInfoFromToken(token) {
3159
- try {
3160
- const decoded = jwtDecode(token);
3161
- return {
3162
- sub: decoded.sub,
3163
- name: decoded.name || 'User is undefined',
3164
- role: decoded.role || 'Role is undefined',
3165
- email: decoded.email || decoded.sub,
3166
- iat: decoded.iat,
3167
- exp: decoded.exp
3168
- };
3169
- }
3170
- catch (err) {
3171
- return null;
3172
- }
3173
- }
3174
- async setSettingImages() {
3175
- if (this.settings && this.settings.length > 0) {
3176
- const tasks = [];
3177
- console.log('this.settings: ', this.settings);
3178
- for (const menu of this.settings?.submenu) {
3179
- if (menu?.submenu?.length) {
3180
- for (const childMenu of menu.submenu) {
3181
- if (childMenu.options && childMenu.options.setImageUrl) {
3182
- tasks.push((async () => {
3183
- try {
3184
- let projectName = `${this.tenantName}_${this.projectSeleted}`;
3185
- const image = await this.couchdbService.getFileContentFromCouchDb(projectName, childMenu.icon);
3186
- childMenu.icon = this.getMediaSrc(image);
3187
- }
3188
- catch (err) {
3189
- console.error("Failed to fetch icon:", err);
3190
- }
3191
- })());
3192
- }
3193
- }
3194
- }
3195
- }
3196
- await Promise.all(tasks);
3197
- }
3198
- this.settingMenu = JSON.parse(JSON.stringify(this.settings));
3199
- }
3200
- getMediaSrc(file) {
3201
- if (!file)
3202
- return '';
3203
- // Best case: service already returns full data URL
3204
- if (file.src) {
3205
- return file.src;
3206
- }
3207
- // If service returns raw base64 + mimeType
3208
- if (file.base64) {
3209
- const mimeType = file.mimeType || 'image/png';
3210
- return `data:${mimeType};base64,${file.base64}`;
3211
- }
3212
- // If service returns old dataUrl format
3213
- if (file.dataUrl) {
3214
- return file.dataUrl;
3215
- }
3216
- return '';
3217
- }
3218
- isUrl(value) {
3219
- return /^https?:\/\//.test(value) || value.startsWith('blob:');
3220
- }
3221
- async setLoginedUser(user) {
3222
- if (user?.name) {
3223
- user['image'] = "assets/user.png";
3224
- this.loginedUserInfo = user;
3225
- let matchMenu = this.menuItems.find((menu) => menu?.options?.action && menu?.options?.action === "logout");
3226
- if (matchMenu) {
3227
- this.loginedUserInfo.actions = [matchMenu];
3228
- }
3229
- this.isLogined = this.loginedUserInfo?.name ? true : false;
3230
- }
3231
- }
3232
- initializeProjects() {
3233
- this.projectsLayoutSchema = this.projects;
3234
- }
3235
- async invokeNavigate(menu, parentMenu) {
3236
- if (menu.options.showAllProjects) {
3237
- this.utilityService.showAllProjects();
3238
- }
3239
- else if (menu.options.changeLang) {
3240
- this.changeLanguage(menu.options.data_url);
3241
- }
3242
- else if (menu.options.changeProject) {
3243
- this.navigateToProject(menu);
3244
- }
3245
- else if (menu.options.logs) {
3246
- this.openLogsTable();
3247
- }
3248
- else if (menu.options.terms) {
3249
- this.notificationService.info("Term Not Apply");
3250
- }
3251
- else if (menu.options.projectPrivacy) {
3252
- this.notificationService.warning("Project Privacy Not Apply");
3253
- }
3254
- else if (menu.options.projectVersion) {
3255
- this.notificationService.warning("Project Version Not Apply");
3256
- }
3257
- else if (menu.options.action == 'login' && this.environment?.login?.type == "keycloak") {
3258
- if (this.platform.ANDROID || this.platform.IOS) {
3259
- let login = await this.mobileKeycloakService.login();
3260
- }
3261
- else {
3262
- this.oauthService.initLoginFlow();
3263
- }
3264
- }
3265
- else {
3266
- this.toggleCollapsed();
3267
- this.invokeMenu.emit(menu);
3268
- }
3269
- }
3270
- openLogsTable() {
3271
- let logsModal = this.dialogService.open(LogsComponent, {
3272
- width: '700px',
3273
- data: {}
3274
- });
3275
- // logsModal.onClose.subscribe((res: any) => {
3276
- // if (res) {
3277
- // console.log('res789: ', res);
3278
- // }
3279
- // });
3280
- }
3281
- deleteMenuItem(subChild, index, event) {
3282
- event.stopPropagation();
3283
- this.settings.submenu[1].submenu.splice(index, 1);
3284
- this.deleteProject.emit(subChild);
3285
- }
3286
- navigateToProject(project) {
3287
- this.invokeProject.emit(project);
3288
- }
3289
- async changeLanguage(lang) {
3290
- if (lang) {
3291
- if (lang === 'de.json') {
3292
- // NG-Zorro
3293
- this.i18n.setLocale(de_DE);
3294
- // PrimeNG 🔥
3295
- // this.primengConfig.setTranslation(this.PRIME_DE);
3296
- }
3297
- else {
3298
- this.i18n.setLocale(en_US);
3299
- // this.primengConfig.setTranslation(this.PRIME_EN);
3300
- }
3301
- const selectedLanguage = await this.couchdbService.getFileContentFromCouchDb(`${this.tenantName}_${this.projectSeleted}`, `languages/${lang}`);
3302
- const errorMessages = await this.couchdbService.getFileContentFromCouchDb(`${this.tenantName}_${this.projectSeleted}`, `languages/errorMessage_${lang}`);
3303
- this.languageChange.emit({ selectedLanguage: selectedLanguage, errorMessages: errorMessages });
3304
- this.setLanguage = true;
3305
- this.menuItemsCopy.forEach((menu, index) => {
3306
- if (menu.label && menu.label.caption && selectedLanguage[menu.label.caption]) {
3307
- this.menuItems[index].label.caption = selectedLanguage[menu.label.caption];
3308
- }
3309
- if (menu?.submenu?.length) {
3310
- menu?.submenu.forEach((subMenuInfo, subIndex) => {
3311
- if (subMenuInfo.label && subMenuInfo.label.caption && selectedLanguage[subMenuInfo.label.caption]) {
3312
- this.menuItems[index].submenu[subIndex].label.caption = selectedLanguage[subMenuInfo.label.caption];
3313
- }
3314
- if (subMenuInfo?.submenu?.length) {
3315
- subMenuInfo.submenu.forEach((childMenu, childIndex) => {
3316
- if (childMenu.label && childMenu.label.caption && selectedLanguage[childMenu.label.caption]) {
3317
- this.menuItems[index].submenu[subIndex].submenu[childIndex].label.caption = selectedLanguage[childMenu.label.caption];
3318
- }
3319
- });
3320
- }
3321
- });
3322
- }
3323
- });
3324
- if (this.settingMenu?.label?.caption) {
3325
- this.settingMenu.label.caption = selectedLanguage[this.settings.label.caption];
3326
- }
3327
- this.settings?.submenu?.forEach((menu, index) => {
3328
- if (menu.label && menu.label.caption && selectedLanguage[menu.label.caption] && this.settingMenu?.submenu[index] && this.settingMenu.submenu[index]?.label) {
3329
- this.settingMenu.submenu[index].label.caption = selectedLanguage[menu.label.caption];
3330
- }
3331
- });
3332
- }
3333
- }
3334
- 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 });
3335
- 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:
3336
- // NG-ZORRO
3337
- 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:
3338
- // PrimeNG
3339
- DynamicDialogModule }] });
3340
- }
3341
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SideMenuComponent, decorators: [{
3342
- type: Component,
3343
- args: [{ standalone: true, selector: 'vl-side-menu', imports: [
3344
- CommonModule,
3345
- PlatformModule,
3346
- // NG-ZORRO
3347
- NzMenuModule,
3348
- NzIconModule,
3349
- NzTooltipModule,
3350
- NzButtonModule,
3351
- // PrimeNG
3352
- DynamicDialogModule
3353
- ], 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"] }]
3354
- }], 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: [{
3355
- type: Inject,
3356
- args: [OKTA_AUTH]
3357
- }] }], propDecorators: { menuItems: [{
3358
- type: Input
3359
- }], userInfo: [{
3360
- type: Input
3361
- }], settings: [{
3362
- type: Input
3363
- }], projects: [{
3364
- type: Input
3365
- }], environment: [{
3366
- type: Input
3367
- }], projectSeleted: [{
3368
- type: Input
3369
- }], languageChange: [{
3370
- type: Output
3371
- }], invokeMenu: [{
3372
- type: Output
3373
- }], menuToggle: [{
3374
- type: Output
3375
- }], invokeProject: [{
3376
- type: Output
3377
- }], errorMessage: [{
3378
- type: Output
3379
- }], deleteProject: [{
3380
- type: Output
3381
- }], sideMenu: [{
3382
- type: ViewChild,
3383
- args: ['sideMenu', { static: true }]
3384
- }], onDocumentClick: [{
3385
- type: HostListener,
3386
- args: ['document:click', ['$event']]
3387
- }] } });
3388
-
3389
- // lib/view-toolkit.module.ts
3390
- class ViewToolkitModule {
3391
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3392
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, imports: [CommonModule,
3393
- CardComponent,
3394
- FormComponent,
3395
- GridComponent,
3396
- HeaderMenuComponent,
3397
- LogsComponent,
3398
- ModelComponent,
3399
- PaginationComponent,
3400
- SideMenuComponent,
3401
- Autocomplete,
3402
- Button,
3403
- Date$1,
3404
- Dropdown,
3405
- ErrorMessage,
3406
- Label,
3407
- String$1,
3408
- Textbox,
3409
- Time], exports: [CardComponent,
3410
- FormComponent,
3411
- GridComponent,
3412
- HeaderMenuComponent,
3413
- LogsComponent,
3414
- ModelComponent,
3415
- PaginationComponent,
3416
- SideMenuComponent] });
3417
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, imports: [CommonModule,
3418
- CardComponent,
3419
- FormComponent,
3420
- GridComponent,
3421
- HeaderMenuComponent,
3422
- LogsComponent,
3423
- ModelComponent,
3424
- PaginationComponent,
3425
- SideMenuComponent,
3426
- Autocomplete,
3427
- Textbox] });
3428
- }
3429
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, decorators: [{
3430
- type: NgModule,
3431
- args: [{
3432
- imports: [
3433
- CommonModule,
3434
- CardComponent,
3435
- FormComponent,
3436
- GridComponent,
3437
- HeaderMenuComponent,
3438
- LogsComponent,
3439
- ModelComponent,
3440
- PaginationComponent,
3441
- SideMenuComponent,
3442
- Autocomplete,
3443
- Button,
3444
- Date$1,
3445
- Dropdown,
3446
- ErrorMessage,
3447
- Label,
3448
- String$1,
3449
- Textbox,
3450
- Time
3451
- ],
3452
- exports: [
3453
- CardComponent,
3454
- FormComponent,
3455
- GridComponent,
3456
- HeaderMenuComponent,
3457
- LogsComponent,
3458
- ModelComponent,
3459
- PaginationComponent,
3460
- SideMenuComponent
3461
- ]
3462
- }]
3463
- }] });
3464
-
3465
- // AUTO-GENERATED. Do not edit.
3466
- const APP_VERSION = '1.0.204';
3467
-
3468
- const VERSION_KEY = 'APP_VERSION';
3469
- class AppVersionResetService {
3470
- platform;
3471
- constructor(platform) {
3472
- this.platform = platform;
3473
- }
3474
- async run() {
3475
- if (this.platform.ANDROID || this.platform.IOS) {
3476
- await this.clearNativeIfChanged();
3477
- // this.clearWebIfChanged();
3478
- // return;
3479
- }
3480
- }
3481
- async clearNativeIfChanged() {
3482
- const { value: savedVersion } = await Preferences.get({ key: VERSION_KEY });
3483
- if (savedVersion === APP_VERSION)
3484
- return;
3485
- console.log(`🧹 Clearing Capacitor Preferences (new build ${APP_VERSION})`);
3486
- await Preferences.clear();
3487
- this.clearWebStores();
3488
- await Preferences.set({ key: VERSION_KEY, value: APP_VERSION });
3489
- }
3490
- // private clearWebIfChanged(): void {
3491
- // const savedVersion = sessionStorage.getItem(VERSION_KEY) || localStorage.getItem(VERSION_KEY);
3492
- // if (savedVersion === APP_VERSION) return;
3493
- // this.clearWebStores();
3494
- // localStorage.setItem(VERSION_KEY, APP_VERSION);
3495
- // sessionStorage.setItem(VERSION_KEY, APP_VERSION);
3496
- // }
3497
- clearWebStores() {
3498
- try {
3499
- localStorage.clear();
3500
- }
3501
- catch { }
3502
- try {
3503
- sessionStorage.clear();
3504
- }
3505
- catch { }
3506
- try {
3507
- if (typeof document !== 'undefined' && document.cookie) {
3508
- document.cookie.split(';').forEach((c) => {
3509
- const eqPos = c.indexOf('=');
3510
- const name = eqPos > -1 ? c.substring(0, eqPos).trim() : c.trim();
3511
- if (name) {
3512
- document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
3513
- }
3514
- });
3515
- }
3516
- }
3517
- catch { }
3518
- }
3519
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AppVersionResetService, deps: [{ token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
3520
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AppVersionResetService, providedIn: 'root' });
3521
- }
3522
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AppVersionResetService, decorators: [{
3523
- type: Injectable,
3524
- args: [{
3525
- providedIn: 'root'
3526
- }]
3527
- }], ctorParameters: () => [{ type: i1.Platform }] });
3528
-
3529
- /*
3530
- * Public API Surface of view-toolkit
3531
- */
3532
-
3533
- /**
3534
- * Generated bundle index. Do not edit.
3535
- */
3536
-
3537
- export { AppVersionResetService, CardComponent, ConfigService, Couchdb, FormComponent, GridComponent, HeaderMenuComponent, LogsComponent, MobileKeycloakService, ModelComponent, NetworkLogService, NotificationService, PaginationComponent, RequestService, SideMenuComponent, UtilityService, ViewToolkitModule };
3538
- //# sourceMappingURL=yomotech-view-toolkit.mjs.map