@yomotech/view-toolkit 0.0.3 → 0.0.5

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 (34) hide show
  1. package/fesm2022/yomotech-view-toolkit.mjs +3539 -0
  2. package/fesm2022/yomotech-view-toolkit.mjs.map +1 -0
  3. package/package.json +51 -36
  4. package/types/yomotech-view-toolkit.d.ts +653 -0
  5. package/ng-package.json +0 -7
  6. package/src/lib/app-version.ts +0 -2
  7. package/src/lib/containers/card/card.component.css +0 -0
  8. package/src/lib/containers/card/card.component.html +0 -449
  9. package/src/lib/containers/card/card.component.ts +0 -471
  10. package/src/lib/containers/form/form.component.css +0 -0
  11. package/src/lib/containers/form/form.component.html +0 -1
  12. package/src/lib/containers/form/form.component.ts +0 -12
  13. package/src/lib/containers/grid/grid.component.css +0 -0
  14. package/src/lib/containers/grid/grid.component.html +0 -1
  15. package/src/lib/containers/grid/grid.component.ts +0 -12
  16. package/src/lib/containers/pagination/pagination.component.css +0 -0
  17. package/src/lib/containers/pagination/pagination.component.html +0 -1
  18. package/src/lib/containers/pagination/pagination.component.ts +0 -12
  19. package/src/lib/services/app-version-reset.service.ts +0 -59
  20. package/src/lib/services/config.service.ts +0 -128
  21. package/src/lib/services/couchdb.ts +0 -224
  22. package/src/lib/services/mobile-keycloak.service.ts +0 -116
  23. package/src/lib/services/network-log.service.ts +0 -27
  24. package/src/lib/services/notification.service.ts +0 -26
  25. package/src/lib/services/pouchdb.service.ts +0 -183
  26. package/src/lib/services/request.service.ts +0 -125
  27. package/src/lib/services/utility.service.ts +0 -593
  28. package/src/lib/view-toolkit.module.ts +0 -25
  29. package/src/lib/view-toolkit.spec.ts +0 -23
  30. package/src/lib/view-toolkit.ts +0 -15
  31. package/src/public-api.ts +0 -22
  32. package/tsconfig.lib.json +0 -17
  33. package/tsconfig.lib.prod.json +0 -11
  34. package/tsconfig.spec.json +0 -15
@@ -0,0 +1,3539 @@
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, NgModule, HostListener, ViewChild, Inject } 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
+ import PouchDB from 'pouchdb';
57
+ import JSZip from 'jszip';
58
+
59
+ class PaginationComponent {
60
+ platform;
61
+ itemInfo = {
62
+ layoutSchema: {},
63
+ propertySchema: {},
64
+ data: []
65
+ };
66
+ pageSize;
67
+ currentPage = 0;
68
+ pages = [];
69
+ pageSizeChange = new EventEmitter();
70
+ onGoToPage = new EventEmitter();
71
+ isMobile = false;
72
+ constructor(platform) {
73
+ this.platform = platform;
74
+ }
75
+ ngOnInit() {
76
+ if (this.platform.ANDROID || this.platform.IOS) {
77
+ this.isMobile = true;
78
+ }
79
+ }
80
+ invokeOnPageSizeChange(pageSize) {
81
+ this.pageSizeChange.emit(pageSize);
82
+ }
83
+ invokeGoToPage(page) {
84
+ this.onGoToPage.emit(page);
85
+ }
86
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PaginationComponent, deps: [{ token: i1.Platform }], target: i0.ɵɵFactoryTarget.Component });
87
+ 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 [class]=\"itemInfo?.layoutSchema?.pagination?.style?.classes[0]\">\r\n <ul class=\"pagination\" [ngStyle]=\"{ 'z-index': isMobile ? 99999 : 'auto' }\">\r\n <li (click)=\"invokeGoToPage(0)\" [class.disabled]=\"currentPage === 0\">\u00AB\u00AB</li>\r\n <li (click)=\"invokeGoToPage(currentPage - 1)\" [class.disabled]=\"currentPage === 0\">\u00AB</li>\r\n <li *ngFor=\"let page of pages\" [class.active]=\"currentPage === page\" (click)=\"invokeGoToPage(page)\">\r\n {{ page + 1 }}\r\n </li>\r\n <li (click)=\"invokeGoToPage(currentPage + 1)\" [class.disabled]=\"currentPage === pages.length -1\">\r\n \u00BB\r\n </li>\r\n <li (click)=\"invokeGoToPage(pages.length -1)\" [class.disabled]=\"currentPage === pages.length -1\">\r\n \u00BB\u00BB\r\n </li>\r\n </ul>\r\n\r\n <!-- Page Size Dropdown -->\r\n <label *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" for=\"pageSize\">{{\r\n itemInfo?.layoutSchema?.pagination?.caption }}</label>\r\n <select *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" id=\"pageSize\" [(ngModel)]=\"pageSize\"\r\n (change)=\"invokeOnPageSizeChange(pageSize)\">\r\n <option *ngFor=\"let size of [5, 10, 15, 20]\" [value]=\"size\">{{ size }}</option>\r\n </select>\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 }] });
88
+ }
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PaginationComponent, decorators: [{
90
+ type: Component,
91
+ args: [{ standalone: true, selector: 'vl-pagination', imports: [
92
+ CommonModule,
93
+ FormsModule,
94
+ PlatformModule
95
+ ], template: "<div [class]=\"itemInfo?.layoutSchema?.pagination?.style?.classes[0]\">\r\n <ul class=\"pagination\" [ngStyle]=\"{ 'z-index': isMobile ? 99999 : 'auto' }\">\r\n <li (click)=\"invokeGoToPage(0)\" [class.disabled]=\"currentPage === 0\">\u00AB\u00AB</li>\r\n <li (click)=\"invokeGoToPage(currentPage - 1)\" [class.disabled]=\"currentPage === 0\">\u00AB</li>\r\n <li *ngFor=\"let page of pages\" [class.active]=\"currentPage === page\" (click)=\"invokeGoToPage(page)\">\r\n {{ page + 1 }}\r\n </li>\r\n <li (click)=\"invokeGoToPage(currentPage + 1)\" [class.disabled]=\"currentPage === pages.length -1\">\r\n \u00BB\r\n </li>\r\n <li (click)=\"invokeGoToPage(pages.length -1)\" [class.disabled]=\"currentPage === pages.length -1\">\r\n \u00BB\u00BB\r\n </li>\r\n </ul>\r\n\r\n <!-- Page Size Dropdown -->\r\n <label *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" for=\"pageSize\">{{\r\n itemInfo?.layoutSchema?.pagination?.caption }}</label>\r\n <select *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" id=\"pageSize\" [(ngModel)]=\"pageSize\"\r\n (change)=\"invokeOnPageSizeChange(pageSize)\">\r\n <option *ngFor=\"let size of [5, 10, 15, 20]\" [value]=\"size\">{{ size }}</option>\r\n </select>\r\n</div>" }]
96
+ }], ctorParameters: () => [{ type: i1.Platform }], propDecorators: { itemInfo: [{
97
+ type: Input
98
+ }], pageSize: [{
99
+ type: Input
100
+ }], currentPage: [{
101
+ type: Input
102
+ }], pages: [{
103
+ type: Input
104
+ }], pageSizeChange: [{
105
+ type: Output
106
+ }], onGoToPage: [{
107
+ type: Output
108
+ }] } });
109
+
110
+ let String$1 = class String {
111
+ formField;
112
+ modalItemInfo;
113
+ getScope(scope) {
114
+ let propertyScope = "";
115
+ let start = scope?.indexOf("#/") + 2;
116
+ let end = scope?.indexOf("/", start);
117
+ if (start && end) {
118
+ propertyScope = scope.substring(start, end);
119
+ }
120
+ return propertyScope;
121
+ }
122
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: String, deps: [], target: i0.ɵɵFactoryTarget.Component });
123
+ 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: [""] });
124
+ };
125
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: String$1, decorators: [{
126
+ type: Component,
127
+ 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>" }]
128
+ }], propDecorators: { formField: [{
129
+ type: Input
130
+ }], modalItemInfo: [{
131
+ type: Input
132
+ }] } });
133
+
134
+ class RequestService {
135
+ http;
136
+ pageSize = 0;
137
+ constructor(http) {
138
+ this.http = http;
139
+ }
140
+ getAllProject() {
141
+ return this.http.get("../assets/main/layout_schema.json");
142
+ }
143
+ getEnvironmet(selectedProject) {
144
+ return this.http.get(`../../assets/projects/${selectedProject}/environments/environment.json`);
145
+ }
146
+ getSectionInfo(url, envUrl, passToken = false, selectedProject = '', userInfo = null) {
147
+ if (envUrl) {
148
+ if (passToken && selectedProject) {
149
+ return this.http.get(envUrl + url, {
150
+ headers: this.createAuthorizationHeader(userInfo),
151
+ });
152
+ }
153
+ else {
154
+ return this.http.get(envUrl + url);
155
+ }
156
+ }
157
+ else {
158
+ return this.http.get(url);
159
+ }
160
+ ;
161
+ }
162
+ getMainLayout(selectedProject) {
163
+ return this.http.get(`../assets/projects/${selectedProject}/main/layout_schema.json`);
164
+ }
165
+ getInfo(url) {
166
+ return this.http.get(url);
167
+ }
168
+ dynamicCall(method = "get", body = null, url, passToken = false, selectedProject = '', userInfo = null) {
169
+ switch (method.toLowerCase()) {
170
+ case 'get':
171
+ if (passToken && selectedProject) {
172
+ return this.http.get(url, {
173
+ headers: this.createAuthorizationHeader(userInfo),
174
+ });
175
+ }
176
+ else {
177
+ return this.http.get(url);
178
+ }
179
+ case 'post':
180
+ if (passToken && selectedProject) {
181
+ return this.http.post(url, body, {
182
+ headers: this.createAuthorizationHeader(userInfo),
183
+ });
184
+ }
185
+ else {
186
+ return this.http.post(url, body);
187
+ }
188
+ case 'put':
189
+ if (passToken && selectedProject) {
190
+ return this.http.put(url, body, {
191
+ headers: this.createAuthorizationHeader(userInfo),
192
+ });
193
+ }
194
+ else {
195
+ return this.http.put(url, body);
196
+ }
197
+ case 'delete':
198
+ if (passToken && selectedProject) {
199
+ return this.http.delete(url, {
200
+ headers: this.createAuthorizationHeader(userInfo),
201
+ });
202
+ }
203
+ else {
204
+ return this.http.delete(url);
205
+ }
206
+ ;
207
+ case 'patch':
208
+ return this.http.patch(url, body);
209
+ default:
210
+ throw new Error(`Unsupported HTTP method: ${method}`);
211
+ }
212
+ }
213
+ createAuthorizationHeader(userInfo, tokenExist = false) {
214
+ let authHeaders = new HttpHeaders();
215
+ let token = tokenExist ? userInfo : userInfo && userInfo.jwt ? userInfo.jwt : userInfo?.authToken ? userInfo?.authToken : '';
216
+ return authHeaders.set('Authorization', 'Bearer ' + token);
217
+ }
218
+ getLoginUser(token) {
219
+ return this.http.get("https://dev-78992019.okta.com/oauth2/default/v1/userinfo", {
220
+ headers: this.createAuthorizationHeader(token, true),
221
+ });
222
+ }
223
+ saveDb(token, userInfo, order = {}) {
224
+ if (token) {
225
+ const headers = new HttpHeaders({
226
+ 'Authorization': `Bearer ${token}`,
227
+ 'Accept': 'application/json'
228
+ });
229
+ 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}`;
230
+ console.log('userInfo: ', userInfo);
231
+ this.http.post(url2, order, { headers }).subscribe({
232
+ next: res => {
233
+ console.log('Save-res: ', res);
234
+ }
235
+ });
236
+ }
237
+ }
238
+ getSaveOrder(token, userInfo, fromDate, toDate) {
239
+ // if (token) {
240
+ const headers = new HttpHeaders({
241
+ 'Authorization': `Bearer ${token}`,
242
+ 'Accept': 'application/json'
243
+ });
244
+ 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`;
245
+ return this.http.post(url, {}, { headers });
246
+ // }
247
+ }
248
+ 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 });
249
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RequestService, providedIn: 'root' });
250
+ }
251
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: RequestService, decorators: [{
252
+ type: Injectable,
253
+ args: [{
254
+ providedIn: 'root'
255
+ }]
256
+ }], ctorParameters: () => [{ type: i1$1.HttpClient }] });
257
+
258
+ // import { Couchdb } from './couchdb';
259
+ class UtilityService {
260
+ platform;
261
+ requestService;
262
+ stripe = null;
263
+ constructor(platform,
264
+ // private couchdbService: Couchdb,
265
+ requestService) {
266
+ this.platform = platform;
267
+ this.requestService = requestService;
268
+ }
269
+ getScope(scope) {
270
+ let propertyScope = "";
271
+ let start = scope?.indexOf("#/") + 2;
272
+ let end = scope?.indexOf("/", start);
273
+ if (start && end) {
274
+ propertyScope = scope.substring(start, end);
275
+ }
276
+ return propertyScope;
277
+ }
278
+ getProperty(scope, itemInfo) {
279
+ const property = scope?.reference ? scope?.reference.split('/').pop() : '';
280
+ return { key: property, productSchema: itemInfo.propertySchema[property] };
281
+ }
282
+ async setStorage(key, value) {
283
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
284
+ await Preferences.set({ key, value });
285
+ }
286
+ else {
287
+ sessionStorage.setItem(key, value);
288
+ }
289
+ }
290
+ async getStorage(key) {
291
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
292
+ const { value } = await Preferences.get({ key });
293
+ return value;
294
+ }
295
+ else {
296
+ const storage = sessionStorage.getItem(key);
297
+ return storage;
298
+ }
299
+ }
300
+ async setLocalStorage(key, value) {
301
+ const stringValue = JSON.stringify(value);
302
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
303
+ await Preferences.set({ key, value: stringValue });
304
+ }
305
+ else {
306
+ localStorage.setItem(key, stringValue);
307
+ }
308
+ }
309
+ async removeLocalStorage(keyName) {
310
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
311
+ await Preferences.remove({ key: keyName });
312
+ }
313
+ else {
314
+ localStorage.removeItem(keyName);
315
+ }
316
+ }
317
+ async removeStorage(key) {
318
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
319
+ await Preferences.remove({ key });
320
+ }
321
+ else {
322
+ sessionStorage.removeItem(key);
323
+ }
324
+ }
325
+ async getLocalStorage(key) {
326
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
327
+ const { value } = await Preferences.get({ key });
328
+ return value ? JSON.parse(value) : null;
329
+ }
330
+ else {
331
+ const value = localStorage.getItem(key);
332
+ return value ? JSON.parse(value) : null;
333
+ }
334
+ }
335
+ async showAllProjects() {
336
+ await this.removeStorage('selectedProject');
337
+ window.location.reload();
338
+ }
339
+ parseBodyObject(obj) {
340
+ const jsonString = JSON.stringify(obj);
341
+ const replacedString = jsonString.replace(/{{(.*?)}}/g, (match, expression) => {
342
+ try {
343
+ return new Function(`return ${expression.trim()};`).call(this);
344
+ }
345
+ catch (error) {
346
+ console.error(`Error evaluating expression: ${expression}`, error);
347
+ return match;
348
+ }
349
+ });
350
+ return JSON.parse(replacedString);
351
+ }
352
+ getTotalPrice(tableitemInfo) {
353
+ const total = tableitemInfo.data.reduce((total, item) => {
354
+ if (item.quantity && !isNaN(item.quantity)) {
355
+ return total + (item.unitPrice * item.quantity);
356
+ }
357
+ return total;
358
+ }, 0);
359
+ return total.toFixed(2);
360
+ }
361
+ getTotalQuantity(tableitemInfo) {
362
+ let quantity = 0;
363
+ tableitemInfo.data.forEach((cartItem) => {
364
+ if (cartItem.quantity) {
365
+ quantity = cartItem.quantity + quantity;
366
+ }
367
+ });
368
+ return quantity;
369
+ }
370
+ replacePaginationParams(url, currentPage, pageSize) {
371
+ if (url.includes('{{pageNumber}}')) {
372
+ url = url.replace(/{{pageNumber}}/g, currentPage.toString());
373
+ }
374
+ if (url.includes('{{pageSize}}') && pageSize !== undefined) {
375
+ url = url.replace(/{{pageSize}}/g, pageSize.toString());
376
+ }
377
+ return url;
378
+ }
379
+ customButton(option, propertySchema, projectSeleted, environment) {
380
+ if (option.url) {
381
+ let body = {};
382
+ if (option.propertyKey) {
383
+ body = Object.keys(propertySchema[option.propertyKey]).reduce((acc, key) => {
384
+ acc[key] = propertySchema[option.propertyKey][key]?.value;
385
+ return acc;
386
+ }, {});
387
+ }
388
+ let url = environment?.apiUrl + option.url;
389
+ this.requestService.dynamicCall(option.method, body, url, option.passToken, projectSeleted).subscribe((res) => {
390
+ window.location.reload();
391
+ });
392
+ }
393
+ }
394
+ setDefaultUser(item, userInfo, environment) {
395
+ let schema = item;
396
+ let role = "default";
397
+ if (environment?.login?.type === "keycloak") {
398
+ if (userInfo?.name && item.options?.userRoleMapping) {
399
+ schema = item.options[item.options?.userRoleMapping[role]];
400
+ }
401
+ }
402
+ else if (environment?.login?.type === "jwtToken") {
403
+ if (item.options?.loginResponse && item.options?.loginResponse.storageType == "sessionStorage") {
404
+ if (userInfo) {
405
+ role = userInfo[item.options?.loginResponse.role]?.toLowerCase();
406
+ }
407
+ schema = item.options[item.options?.userRoleMapping[role]];
408
+ }
409
+ }
410
+ return schema;
411
+ }
412
+ setTableData(data, options = {}, tableitemInfo, projectSeleted) {
413
+ if (options?.pagination?.pageSize && options?.pagination?.scrollable) {
414
+ tableitemInfo.pageSize = options?.pagination?.pageSize;
415
+ }
416
+ let records;
417
+ if (options.dataKey) {
418
+ records = data[options.dataKey];
419
+ }
420
+ else if (options.key && data?._embedded) {
421
+ records = data?._embedded[options.key];
422
+ }
423
+ else {
424
+ if (!data?._embedded?.products && !Array.isArray(data)) {
425
+ records = [data];
426
+ }
427
+ else {
428
+ records = data?._embedded?.products;
429
+ }
430
+ }
431
+ tableitemInfo.totalRecords = data?.totalPages ? data?.totalPages : data?.page?.totalElements;
432
+ tableitemInfo.data = records.map((record) => ({
433
+ ...record,
434
+ ...(record.hasOwnProperty('imageUrl') && record.imageUrl
435
+ ? { imageUrl: `${projectSeleted}/pages/images/` + record.imageUrl.split('/').pop() }
436
+ : {})
437
+ }));
438
+ return tableitemInfo;
439
+ }
440
+ setOktaWebCredential(environment, projectName) {
441
+ return {
442
+ logo: `favicon.ico`,
443
+ baseUrl: environment.login.web.issuer.split('/oauth2')[0],
444
+ clientId: environment.login.web.clientId,
445
+ redirectUri: environment.login.web.redirectUri,
446
+ authParams: {
447
+ pkce: true,
448
+ issuer: environment.login.web.issuer,
449
+ scopes: environment.login.web.scopes
450
+ }
451
+ };
452
+ }
453
+ setOktaMobileCredential(environment) {
454
+ return {
455
+ appId: environment.login.mobile.clientId,
456
+ authorizationBaseUrl: environment.login.mobile.authorizationBaseUrl,
457
+ accessTokenEndpoint: environment.login.mobile.accessTokenEndpoint,
458
+ redirectUrl: environment.login.mobile.redirectUrl,
459
+ scope: environment.login.mobile.scope,
460
+ responseType: environment.login.mobile.responseType,
461
+ pkceEnabled: environment.login.mobile.pkceEnabled
462
+ };
463
+ }
464
+ async setupStripePaymentForm(environment, form, onCardChange) {
465
+ let hasCreditCard = false;
466
+ if (form.layoutSchema?.formSections) {
467
+ form.layoutSchema.formSections.forEach((formSection) => {
468
+ if (formSection.formFields?.length > 0) {
469
+ const foundCreditCard = formSection.formFields.some((formField) => {
470
+ const scopeKey = this.getScope(formField.scope?.reference);
471
+ return form.propertySchema[scopeKey] &&
472
+ form.propertySchema[scopeKey][formField.scope?.reference.split('/').pop()]?.type === 'carditCard';
473
+ });
474
+ if (foundCreditCard) {
475
+ hasCreditCard = true;
476
+ return;
477
+ }
478
+ }
479
+ });
480
+ }
481
+ if (hasCreditCard) {
482
+ this.stripe = await loadStripe(environment.stripePublishableKey);
483
+ const elements = this.stripe.elements();
484
+ const cardElement = elements.create('card', { hidePostalCode: true });
485
+ cardElement.mount('#card-element');
486
+ cardElement.on('change', (event) => {
487
+ if (event.complete) {
488
+ onCardChange('');
489
+ }
490
+ else if (event.error) {
491
+ onCardChange(event.error.message);
492
+ }
493
+ });
494
+ }
495
+ }
496
+ async formData(form, environment, cartInfo) {
497
+ if (form.layoutSchema?.formSections) {
498
+ for (const formSection of form.layoutSchema.formSections) {
499
+ if (formSection.formFields?.length > 0) {
500
+ for (const formField of formSection.formFields) {
501
+ const scope = this.getScope(formField.scope?.reference);
502
+ const fieldKey = formField.scope?.reference.split('/').pop();
503
+ const field = form.propertySchema?.[scope]?.[fieldKey];
504
+ if (!field)
505
+ continue;
506
+ // Checkbox logic with copy action
507
+ if (field.type === 'checkbox' && formField.option?.innerAction?.action === 'copy') {
508
+ const fromSchema = form.propertySchema[formField.option.innerAction.from];
509
+ const toSchema = form.propertySchema[formField.option.innerAction.to];
510
+ const keys = Object.keys(fromSchema);
511
+ keys.forEach((key) => {
512
+ if (toSchema[key]) {
513
+ const sourceValue = fromSchema?.[key]?.value;
514
+ toSchema[key].value = sourceValue || '';
515
+ }
516
+ });
517
+ }
518
+ // Dropdown logic (async data fetching)
519
+ if (field.type === 'dropdown' && formField.option?.data_url) {
520
+ try {
521
+ const res = await lastValueFrom(this.requestService.getInfo(environment.apiUrl + formField.option.data_url));
522
+ const key = Object.keys(res._embedded || {})[0];
523
+ if (key) {
524
+ field.data = res._embedded[key];
525
+ }
526
+ }
527
+ catch (err) {
528
+ console.error('Failed to load dropdown data', err);
529
+ }
530
+ }
531
+ // Cart info logic for string fields
532
+ if (field.type === 'string' && formField?.option?.cartInfo) {
533
+ if (field.value?.toString()?.includes('{{quantity}}')) {
534
+ field.value = cartInfo.quantity;
535
+ }
536
+ else if (field.value?.toString()?.includes('{{totalPrice}}')) {
537
+ field.value = cartInfo.totalPrice;
538
+ }
539
+ }
540
+ }
541
+ }
542
+ }
543
+ }
544
+ }
545
+ async processData(data, options, tenantName) {
546
+ if (options.dataKey) {
547
+ data = data[options.dataKey];
548
+ }
549
+ else {
550
+ if (!data?._embedded?.products && !Array.isArray(data)) {
551
+ data = [data];
552
+ }
553
+ else {
554
+ data = data?._embedded?.products;
555
+ }
556
+ }
557
+ const transformed = await Promise.all(data.map(async (record) => {
558
+ let imageUrl = record.imageUrl;
559
+ const imagePath = `pages/images/` +
560
+ record?.imageUrl?.split('/').pop();
561
+ if (tenantName &&
562
+ record?.imageUrl &&
563
+ options.setImageUrl) {
564
+ try {
565
+ imageUrl = "";
566
+ // imageUrl = await this.couchdbService.getFileContentFromCouchDb(
567
+ // `${tenantName}_${options.projectSelected}`,
568
+ // imagePath
569
+ // );
570
+ }
571
+ catch (err) {
572
+ console.warn(`Failed to fetch image from CouchDB for ${imagePath}`, err);
573
+ imageUrl = '';
574
+ }
575
+ }
576
+ return {
577
+ ...record,
578
+ ...(imageUrl ? { imageUrl } : {}),
579
+ ...(imagePath ? { imagePath } : {}),
580
+ };
581
+ }));
582
+ return transformed;
583
+ }
584
+ async setTableDataImages(records, tenantName, projectSelected) {
585
+ const transformed = await Promise.all(records.map(async (record) => {
586
+ let imageUrl = record.imageUrl;
587
+ const imagePath = record?.imagePath ? record?.imagePath : `pages/images/` +
588
+ record?.imageUrl?.split('/').pop();
589
+ if (tenantName &&
590
+ record?.imageUrl &&
591
+ record.hasOwnProperty('imageUrl')) {
592
+ try {
593
+ imageUrl = "";
594
+ // imageUrl = await this.couchdbService.getFileContentFromCouchDb(
595
+ // `${tenantName}_${projectSelected}`,
596
+ // imagePath
597
+ // );
598
+ }
599
+ catch (err) {
600
+ console.warn(`Failed to fetch image from CouchDB for ${imagePath}`, err);
601
+ imageUrl = '';
602
+ }
603
+ }
604
+ return {
605
+ ...record,
606
+ ...(imageUrl ? { imageUrl } : {}),
607
+ };
608
+ }));
609
+ return transformed;
610
+ }
611
+ // set date in localstorage
612
+ normalizeDatesForStorage(obj) {
613
+ const normalized = {};
614
+ Object.entries(obj).forEach(([key, value]) => {
615
+ if (this.isDateLike(value)) {
616
+ const date = value instanceof Date ? value : new Date(value);
617
+ normalized[key] = this.toLocalISOString(date);
618
+ }
619
+ else {
620
+ normalized[key] = value;
621
+ }
622
+ });
623
+ return normalized;
624
+ }
625
+ isDateLike(value) {
626
+ if (!value)
627
+ return false;
628
+ // Actual Date object
629
+ if (value instanceof Date && !isNaN(value.getTime())) {
630
+ return true;
631
+ }
632
+ // ISO string (UTC or local)
633
+ if (typeof value === 'string') {
634
+ return false;
635
+ }
636
+ return false;
637
+ }
638
+ toLocalISOString(date) {
639
+ const tzOffset = date.getTimezoneOffset() * 60000;
640
+ return new Date(date.getTime() - tzOffset)
641
+ .toISOString()
642
+ .slice(0, 19);
643
+ }
644
+ // restore date Field from localstorage
645
+ restoreDatesFromStorage(records, propertySchema) {
646
+ if (!Array.isArray(records))
647
+ return records;
648
+ if (!propertySchema)
649
+ return records;
650
+ return records.map(record => {
651
+ const restored = { ...record };
652
+ Object.keys(propertySchema).forEach(scopeKey => {
653
+ const schemaGroup = propertySchema[scopeKey];
654
+ if (!schemaGroup)
655
+ return;
656
+ Object.keys(schemaGroup).forEach(fieldKey => {
657
+ const fieldSchema = schemaGroup[fieldKey];
658
+ const value = restored[fieldKey];
659
+ if (!value || typeof value !== 'string')
660
+ return;
661
+ // ✅ DATE or TIME fields only
662
+ if (fieldSchema.type === 'date' || fieldSchema.type === 'time') {
663
+ restored[fieldKey] = this.parseLocalISODate(value);
664
+ }
665
+ });
666
+ });
667
+ return restored;
668
+ });
669
+ }
670
+ parseLocalISODate(value) {
671
+ // Remove Z to avoid UTC shift
672
+ const clean = value.replace('Z', '');
673
+ const [datePart, timePart = '00:00:00.000'] = clean.split('T');
674
+ const [y, m, d] = datePart.split('-').map(Number);
675
+ const [hh = 0, mm = 0, ss = 0, ms = 0] = timePart.split(/[:.]/).map(Number);
676
+ return new Date(y, m - 1, d, hh, mm, ss, ms);
677
+ }
678
+ // savecard conversion
679
+ convertToDailyLogs(cardOrCards) {
680
+ // Normalize input to array
681
+ const cards = Array.isArray(cardOrCards) ? cardOrCards : [cardOrCards];
682
+ const results = [];
683
+ for (const card of cards) {
684
+ const fromDate = new Date(card.fromDate);
685
+ const toDate = new Date(card.toDate);
686
+ const fromTime = new Date(card.workDayTimeFrom);
687
+ const toTime = new Date(card.workDayTimeTo);
688
+ // Normalize dates to midnight
689
+ const startDay = new Date(fromDate);
690
+ startDay.setHours(0, 0, 0, 0);
691
+ const endDay = new Date(toDate);
692
+ endDay.setHours(0, 0, 0, 0);
693
+ let currentDay = new Date(startDay);
694
+ while (currentDay <= endDay) {
695
+ const isFirstDay = this.isSameDay(currentDay, fromDate);
696
+ const isLastDay = this.isSameDay(currentDay, toDate);
697
+ const isSameDay = isFirstDay && isLastDay;
698
+ let workFrom;
699
+ let workTo;
700
+ // SAME DAY
701
+ if (isSameDay) {
702
+ workFrom = this.applyTimeToDay(currentDay, fromTime);
703
+ workTo = this.applyTimeToDay(currentDay, toTime);
704
+ }
705
+ // FIRST DAY
706
+ else if (isFirstDay) {
707
+ workFrom = this.applyTimeToDay(currentDay, fromTime);
708
+ workTo = this.endOfDay(currentDay);
709
+ }
710
+ // LAST DAY
711
+ else if (isLastDay) {
712
+ workFrom = this.startOfDay(currentDay);
713
+ workTo = this.applyTimeToDay(currentDay, toTime);
714
+ }
715
+ // MIDDLE DAY
716
+ else {
717
+ workFrom = this.startOfDay(currentDay);
718
+ workTo = this.endOfDay(currentDay);
719
+ }
720
+ results.push({
721
+ comment: card.comments || "",
722
+ onCallDuty: false,
723
+ timeCredit: false,
724
+ workDay: this.toLocalISO(currentDay, 0, 0),
725
+ workDayTimeFrom: this.toLocalISO(workFrom),
726
+ workDayTimeTo: this.toLocalISO(workTo),
727
+ workOrderNo: card.workOrderNo,
728
+ workType: "A"
729
+ });
730
+ currentDay.setDate(currentDay.getDate() + 1);
731
+ }
732
+ }
733
+ return results;
734
+ }
735
+ applyTimeToDay(day, time) {
736
+ const d = new Date(day);
737
+ d.setHours(time.getHours(), time.getMinutes(), 0, 0);
738
+ return d;
739
+ }
740
+ startOfDay(d) {
741
+ const x = new Date(d);
742
+ x.setHours(0, 0, 0, 0);
743
+ return x;
744
+ }
745
+ endOfDay(d) {
746
+ const x = new Date(d);
747
+ x.setHours(23, 59, 0, 0);
748
+ return x;
749
+ }
750
+ isSameDay(a, b) {
751
+ return (a.getFullYear() === b.getFullYear() &&
752
+ a.getMonth() === b.getMonth() &&
753
+ a.getDate() === b.getDate());
754
+ }
755
+ toLocalISO(date, hour, minute) {
756
+ const d = new Date(date);
757
+ if (hour !== undefined && minute !== undefined) {
758
+ d.setHours(hour, minute, 0, 0);
759
+ }
760
+ const pad = (n) => String(n).padStart(2, '0');
761
+ const year = d.getFullYear();
762
+ const month = pad(d.getMonth() + 1);
763
+ const day = pad(d.getDate());
764
+ const hrs = pad(d.getHours());
765
+ const mins = pad(d.getMinutes());
766
+ const offset = -d.getTimezoneOffset();
767
+ const sign = offset >= 0 ? '+' : '-';
768
+ const offH = pad(Math.floor(Math.abs(offset) / 60));
769
+ const offM = pad(Math.abs(offset) % 60);
770
+ return `${year}-${month}-${day}T${hrs}:${mins}:00${sign}${offH}:${offM}`;
771
+ }
772
+ 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 });
773
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UtilityService, providedIn: 'root' });
774
+ }
775
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: UtilityService, decorators: [{
776
+ type: Injectable,
777
+ args: [{
778
+ providedIn: 'root'
779
+ }]
780
+ }], ctorParameters: () => [{ type: i1.Platform }, { type: RequestService }] });
781
+
782
+ class CardComponent {
783
+ utilityService;
784
+ platform;
785
+ http;
786
+ cdr;
787
+ zone;
788
+ modalService;
789
+ oauthService;
790
+ requestService;
791
+ itemInfo = {};
792
+ currentPage = 0;
793
+ pageSize = 5;
794
+ selectedLanguageInfo = {};
795
+ pages = [];
796
+ cardButtonClick = new EventEmitter();
797
+ cardHeaderButtonClick = new EventEmitter();
798
+ linkDetails = new EventEmitter();
799
+ imageDetails = new EventEmitter();
800
+ onPageSizeChange = new EventEmitter();
801
+ onPageChange = new EventEmitter();
802
+ cardPerRow = "col-12 md:col-6 lg:col-";
803
+ isLoading = false;
804
+ layoutSchemaCopy = {};
805
+ headerSchemaCopy = {};
806
+ footerSchemaCopy = {};
807
+ constructor(utilityService, platform, http, cdr, zone, modalService, oauthService, requestService) {
808
+ this.utilityService = utilityService;
809
+ this.platform = platform;
810
+ this.http = http;
811
+ this.cdr = cdr;
812
+ this.zone = zone;
813
+ this.modalService = modalService;
814
+ this.oauthService = oauthService;
815
+ this.requestService = requestService;
816
+ }
817
+ ngOnInit() {
818
+ if ((this.platform.ANDROID || this.platform.IOS) && !this.platform?.isBrowser) {
819
+ this.cardPerRow = "col-";
820
+ }
821
+ else {
822
+ this.cardPerRow = "col-12 md:col-6 lg:col-";
823
+ }
824
+ }
825
+ ngOnChanges(changes) {
826
+ if (changes['itemInfo']) {
827
+ if (this.itemInfo.layoutSchema) {
828
+ this.layoutSchemaCopy = JSON.parse(JSON.stringify(this.itemInfo.layoutSchema));
829
+ }
830
+ if (this.itemInfo.header) {
831
+ this.headerSchemaCopy = JSON.parse(JSON.stringify(this.itemInfo.header));
832
+ }
833
+ if (this.itemInfo.footer) {
834
+ this.footerSchemaCopy = JSON.parse(JSON.stringify(this.itemInfo.footer));
835
+ }
836
+ }
837
+ if ((changes['selectedLanguageInfo'] || this.selectedLanguageInfo) && this.selectedLanguageInfo.selectedLanguage) {
838
+ this.itemInfo.footer = this.updatebuttonLanguage(this.footerSchemaCopy, this.selectedLanguageInfo.selectedLanguage);
839
+ this.itemInfo.header = this.updatebuttonLanguage(this.headerSchemaCopy, this.selectedLanguageInfo.selectedLanguage);
840
+ this.itemInfo.layoutSchema = this.updateLayoutLanguage(this.layoutSchemaCopy, this.selectedLanguageInfo.selectedLanguage);
841
+ }
842
+ }
843
+ safeUpdate(fn) {
844
+ if (NgZone.isInAngularZone()) {
845
+ fn();
846
+ this.cdr.markForCheck();
847
+ }
848
+ else {
849
+ this.zone.run(() => {
850
+ fn();
851
+ this.cdr.markForCheck();
852
+ });
853
+ }
854
+ }
855
+ forceNumericKeyboard(event) {
856
+ const input = event?.target;
857
+ if (input && input.tagName === 'INPUT') {
858
+ input.setAttribute('inputmode', 'numeric'); // Android
859
+ input.setAttribute('pattern', '[0-9:]*'); // iOS
860
+ input.setAttribute('type', 'tel'); // strongest signal
861
+ }
862
+ }
863
+ onDateTyping(event) {
864
+ const input = event.target;
865
+ if (!input)
866
+ return;
867
+ let digits = input.value.replace(/\D/g, '');
868
+ digits = digits.substring(0, 8);
869
+ let formatted = '';
870
+ if (digits.length <= 4) {
871
+ formatted = digits;
872
+ }
873
+ else if (digits.length <= 6) {
874
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4)}`;
875
+ }
876
+ else {
877
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4, 6)}-${digits.slice(6)}`;
878
+ }
879
+ input.value = formatted;
880
+ }
881
+ updatebuttonLanguage(schema, translations) {
882
+ const cloned = JSON.parse(JSON.stringify(schema));
883
+ const walk = (obj) => {
884
+ if (!obj || typeof obj !== 'object')
885
+ return;
886
+ // ✅ Replace direct caption (e.g. button.caption)
887
+ if (typeof obj.caption === 'string') {
888
+ const original = obj.caption;
889
+ obj.caption = translations[original] ?? original;
890
+ }
891
+ // ✅ Replace modalTitle if present
892
+ if (typeof obj.modalTitle === 'string') {
893
+ const original = obj.modalTitle;
894
+ obj.modalTitle = translations[original] ?? original;
895
+ }
896
+ // 🔁 Recurse
897
+ Object.keys(obj).forEach((key) => {
898
+ const value = obj[key];
899
+ if (typeof value === 'object') {
900
+ walk(value);
901
+ }
902
+ });
903
+ };
904
+ walk(cloned);
905
+ return cloned;
906
+ }
907
+ updateLayoutLanguage(schema, translations) {
908
+ // Deep clone to avoid mutating original schema
909
+ const cloned = JSON.parse(JSON.stringify(schema));
910
+ const walk = (obj) => {
911
+ if (!obj || typeof obj !== 'object')
912
+ return;
913
+ // ✅ If label.caption exists → translate it
914
+ if (obj.label && typeof obj.label.caption === 'string') {
915
+ const originalCaption = obj.label.caption;
916
+ obj.label.caption =
917
+ translations[originalCaption] ?? originalCaption;
918
+ }
919
+ // 🔁 Recurse into object properties
920
+ Object.keys(obj).forEach((key) => {
921
+ const value = obj[key];
922
+ if (typeof value === 'object') {
923
+ walk(value);
924
+ }
925
+ });
926
+ };
927
+ walk(cloned);
928
+ return cloned;
929
+ }
930
+ dateChangeEvent(filter, value) {
931
+ const scope = this.getScope(filter.scope.reference);
932
+ const field = filter.scope?.reference.split('/').pop();
933
+ this.itemInfo.propertySchema[scope][field].value = value;
934
+ this.applyDateFilter(this.extractFilterValues(this.itemInfo.propertySchema[scope]));
935
+ }
936
+ async applyDateFilter(filters) {
937
+ const from = filters.fromDateFilter ? new Date(filters.fromDateFilter) : null;
938
+ const to = filters.toDateFilter ? new Date(filters.toDateFilter) : null;
939
+ if (to && from) {
940
+ const formattedFrom = this.formatToOffsetISO(from);
941
+ const formattedTo = this.formatToOffsetISO(to);
942
+ const keycloakInfo = await this.utilityService.getLocalStorage('KeycloakInfo');
943
+ const logined = await this.utilityService.getLocalStorage('loginedUser');
944
+ this.safeUpdate(() => this.isLoading = true);
945
+ if (this.platform.ANDROID || this.platform.IOS) {
946
+ let saveOrder = await this.getSaveOrder(keycloakInfo?.token, keycloakInfo, formattedFrom, formattedTo);
947
+ this.itemInfo.data = saveOrder?.length > 0 ? saveOrder : [];
948
+ this.safeUpdate(() => this.isLoading = false);
949
+ }
950
+ else {
951
+ this.requestService.getSaveOrder(logined?.token, logined, formattedFrom, formattedTo).subscribe((saveOrders) => {
952
+ const updatedData = this.utilityService.restoreDatesFromStorage(saveOrders, this.itemInfo.propertySchema);
953
+ this.itemInfo.data = updatedData?.length > 0 ? updatedData : [];
954
+ this.safeUpdate(() => this.isLoading = false);
955
+ });
956
+ }
957
+ }
958
+ }
959
+ async getSaveOrder(token, userInfo, fromDate, toDate) {
960
+ if (!token) {
961
+ return;
962
+ }
963
+ const company = userInfo.p5_plant
964
+ ? `${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant}`
965
+ : `${userInfo.p5_group}/${userInfo.p5_client}/`;
966
+ const url = `${userInfo.p5_backend_url}/assetsmobileservice/Zeiterfassung/requestBookedTimeRecording`;
967
+ try {
968
+ const response = await CapacitorHttp.post({
969
+ url,
970
+ params: {
971
+ resourceNo: userInfo.p5_resource_no,
972
+ workDayFrom: fromDate,
973
+ workDayTo: toDate,
974
+ company,
975
+ appVersion: '1',
976
+ },
977
+ headers: {
978
+ Authorization: `Bearer ${token}`, // ✅ REQUIRED
979
+ Accept: 'application/json',
980
+ },
981
+ // ❗ NO BODY needed for this endpoint
982
+ });
983
+ console.log('getSaveOrder response:', response.data);
984
+ return response.data;
985
+ }
986
+ catch (error) {
987
+ console.error('Failed to fetch saved orders', error);
988
+ throw error;
989
+ }
990
+ }
991
+ formatToOffsetISO(date) {
992
+ if (!date)
993
+ return "";
994
+ const pad = (n, len = 2) => String(n).padStart(len, "0");
995
+ const year = date.getFullYear();
996
+ const month = pad(date.getMonth() + 1);
997
+ const day = pad(date.getDate());
998
+ const hours = pad(date.getHours());
999
+ const minutes = pad(date.getMinutes());
1000
+ const seconds = pad(date.getSeconds());
1001
+ const ms = pad(date.getMilliseconds(), 4); // 4-digit milliseconds
1002
+ // timezone offset
1003
+ const offset = -date.getTimezoneOffset(); // in minutes
1004
+ const offSign = offset >= 0 ? "+" : "-";
1005
+ const offHours = pad(Math.floor(Math.abs(offset) / 60));
1006
+ const offMinutes = pad(Math.abs(offset) % 60);
1007
+ return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}:${ms}${offSign}${offHours}:${offMinutes}`;
1008
+ }
1009
+ extractFilterValues(schema) {
1010
+ return Object.keys(schema).reduce((acc, key) => {
1011
+ if (key.includes('Filter') && schema[key]?.value !== undefined) {
1012
+ acc[key] = schema[key].value;
1013
+ }
1014
+ return acc;
1015
+ }, {});
1016
+ }
1017
+ invokeOnPageSizeChange(pageSize) {
1018
+ this.onPageSizeChange.emit(pageSize);
1019
+ }
1020
+ invokeGoToPage(page) {
1021
+ this.onPageChange.emit(page);
1022
+ }
1023
+ invokeOnCardHeader(element) {
1024
+ this.cardHeaderButtonClick.emit(element);
1025
+ }
1026
+ invokeOnCardFooter(element) {
1027
+ // this.cardHeaderButtonClick.emit(element);
1028
+ this.d4_SaveAll();
1029
+ }
1030
+ async invokeButtonClick(layout, record, recordIndex) {
1031
+ if (layout?.option?.action === "delete" && layout?.option?.storageType == "localstorage") {
1032
+ if (layout?.option?.deleteMessage) {
1033
+ this.showConfirm(layout?.option, recordIndex);
1034
+ }
1035
+ }
1036
+ else if (layout?.option?.action === "save" && layout?.option?.storageType === "database") {
1037
+ const final_array = this.utilityService.convertToDailyLogs(record);
1038
+ await this.saveToDb(final_array, recordIndex, layout.option.data_url);
1039
+ }
1040
+ else {
1041
+ this.cardButtonClick.emit({ layout: layout, record: record, recordIndex: recordIndex });
1042
+ }
1043
+ }
1044
+ showConfirm(option, recordIndex) {
1045
+ this.modalService.confirm({
1046
+ nzTitle: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage['Confirm'] ? this.selectedLanguageInfo.selectedLanguage['Confirm'] : 'Confirm',
1047
+ nzContent: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage[option.deleteMessage] ? this.selectedLanguageInfo.selectedLanguage[option.deleteMessage] : option.deleteMessage,
1048
+ nzOkText: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage['Delete'] ? this.selectedLanguageInfo.selectedLanguage['Delete'] : 'Delete',
1049
+ nzCancelText: this.selectedLanguageInfo && this.selectedLanguageInfo?.selectedLanguage['Cancel'] ? this.selectedLanguageInfo.selectedLanguage['Cancel'] : 'Cancel',
1050
+ nzOnOk: () => this.deleteRecord(recordIndex, option.data_url)
1051
+ });
1052
+ }
1053
+ async d4_SaveAll() {
1054
+ let allOrders = [];
1055
+ for (let i = 0; i < this.itemInfo.data.length; i++) {
1056
+ const element = this.itemInfo.data[i];
1057
+ const dailyLogs = this.utilityService.convertToDailyLogs(element);
1058
+ if (Array.isArray(dailyLogs)) {
1059
+ allOrders.push(...dailyLogs);
1060
+ }
1061
+ }
1062
+ await this.saveToDb(allOrders, null, true);
1063
+ }
1064
+ deleteRecord(recordIndex, data_url) {
1065
+ this.itemInfo.data.splice(recordIndex, 1);
1066
+ this.utilityService.setLocalStorage('timeRecords', JSON.stringify(this.itemInfo.data));
1067
+ }
1068
+ deleteAllRecord() {
1069
+ this.itemInfo.data = [];
1070
+ this.utilityService.setLocalStorage('timeRecords', JSON.stringify(this.itemInfo.data));
1071
+ }
1072
+ async saveToDb(orders, orderIndex, data_url, deleteAll = false) {
1073
+ this.safeUpdate(() => this.isLoading = true);
1074
+ const token = this.oauthService.getAccessToken(); // whatever you have
1075
+ const logined = await this.utilityService.getLocalStorage('loginedUser');
1076
+ const keycloakInfo = await this.utilityService.getLocalStorage('KeycloakInfo');
1077
+ let saveobject = {
1078
+ ressourceNo: logined?.p5_resource_no ? logined.p5_resource_no : keycloakInfo?.p5_resource_no,
1079
+ returnTimeRecordingLine: orders
1080
+ };
1081
+ if (this.platform.ANDROID || this.platform.IOS) {
1082
+ const res = await this.mobileSaveDb(keycloakInfo.token, keycloakInfo, saveobject, orderIndex, data_url, deleteAll);
1083
+ }
1084
+ else {
1085
+ this.webSaveDb(token, logined, saveobject, orderIndex, data_url, deleteAll);
1086
+ }
1087
+ }
1088
+ webSaveDb(token, userInfo, order = {}, orderIndex, dataUrl, deleteAll = false) {
1089
+ if (token) {
1090
+ const headers = new HttpHeaders({
1091
+ 'Authorization': `Bearer ${token}`,
1092
+ 'Accept': 'application/json'
1093
+ });
1094
+ 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}`;
1095
+ this.http.post(url2, order, { headers }).subscribe({
1096
+ next: res => {
1097
+ this.safeUpdate(() => this.isLoading = false);
1098
+ if (orderIndex && orderIndex > -1) {
1099
+ this.deleteRecord(orderIndex, dataUrl);
1100
+ }
1101
+ else {
1102
+ this.deleteAllRecord();
1103
+ }
1104
+ }
1105
+ });
1106
+ }
1107
+ }
1108
+ async mobileSaveDb(token, userInfo, order = {}, orderIndex, dataUrl, deleteAll = false) {
1109
+ if (!token) {
1110
+ console.log("NO-token", token);
1111
+ return;
1112
+ }
1113
+ const company = userInfo.p5_plant
1114
+ ? `${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant}`
1115
+ : `${userInfo.p5_group}/${userInfo.p5_client}/`;
1116
+ const url = `${userInfo.p5_backend_url}/assetsmobileservice/Zeiterfassung/registerTimeRecording`;
1117
+ try {
1118
+ const response = await CapacitorHttp.post({
1119
+ url,
1120
+ params: {
1121
+ company,
1122
+ appVersion: '1',
1123
+ resourceNo: userInfo.p5_resource_no,
1124
+ },
1125
+ headers: {
1126
+ Authorization: `Bearer ${token}`,
1127
+ Accept: 'application/json',
1128
+ 'Content-Type': 'application/json',
1129
+ },
1130
+ data: order,
1131
+ });
1132
+ if (orderIndex != null && orderIndex > -1) {
1133
+ this.deleteRecord(orderIndex, dataUrl);
1134
+ }
1135
+ else {
1136
+ this.deleteAllRecord();
1137
+ }
1138
+ this.safeUpdate(() => this.isLoading = false);
1139
+ return response.data;
1140
+ }
1141
+ catch (error) {
1142
+ this.safeUpdate(() => this.isLoading = false);
1143
+ console.error('Failed to save time recording', error);
1144
+ throw error;
1145
+ }
1146
+ }
1147
+ showLinkDetails(option, record) {
1148
+ this.linkDetails.emit({ option: option, record: record });
1149
+ }
1150
+ showImageDetails(option, record) {
1151
+ this.imageDetails.emit({ option: option, record: record });
1152
+ }
1153
+ getProperty(scope) {
1154
+ const property = scope ? scope.split('/').pop() : '';
1155
+ return { key: property, productSchema: this.itemInfo.propertySchema[this.getScope(scope)][property] };
1156
+ }
1157
+ getStyleWithoutClasses(styleObject) {
1158
+ if (!styleObject) {
1159
+ return { classes: '', style: {} };
1160
+ }
1161
+ const { classes, ...styleWithoutClasses } = styleObject;
1162
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1163
+ }
1164
+ getScope(scope) {
1165
+ let propertyScope = "";
1166
+ let start = scope?.indexOf("#/") + 2;
1167
+ let end = scope?.indexOf("/", start);
1168
+ if (start && end) {
1169
+ propertyScope = scope.substring(start, end);
1170
+ }
1171
+ return propertyScope;
1172
+ }
1173
+ 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 });
1174
+ 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", 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]=\"itemInfo.layoutSchema.pagination ? 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 <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:
1175
+ // StringComponent,
1176
+ 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" }] });
1177
+ }
1178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: CardComponent, decorators: [{
1179
+ type: Component,
1180
+ args: [{ selector: 'vl-card', imports: [
1181
+ CommonModule,
1182
+ FormsModule,
1183
+ NzIconModule,
1184
+ DatePickerModule,
1185
+ NzButtonModule,
1186
+ NzDatePickerModule,
1187
+ NzModalModule,
1188
+ // StringComponent,
1189
+ PaginationComponent,
1190
+ String$1
1191
+ ], 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]=\"itemInfo.layoutSchema.pagination ? 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 <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>" }]
1192
+ }], 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: [{
1193
+ type: Input
1194
+ }], currentPage: [{
1195
+ type: Input
1196
+ }], pageSize: [{
1197
+ type: Input
1198
+ }], selectedLanguageInfo: [{
1199
+ type: Input
1200
+ }], pages: [{
1201
+ type: Input
1202
+ }], cardButtonClick: [{
1203
+ type: Output
1204
+ }], cardHeaderButtonClick: [{
1205
+ type: Output
1206
+ }], linkDetails: [{
1207
+ type: Output
1208
+ }], imageDetails: [{
1209
+ type: Output
1210
+ }], onPageSizeChange: [{
1211
+ type: Output
1212
+ }], onPageChange: [{
1213
+ type: Output
1214
+ }] } });
1215
+
1216
+ class FormComponent {
1217
+ customEmailPattern = '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$';
1218
+ showPassword = false;
1219
+ formCopy = {};
1220
+ errorMessages = {};
1221
+ creditCardError = {};
1222
+ form = {};
1223
+ selectedLanguageInfo = {};
1224
+ formButtonClick = new EventEmitter();
1225
+ checkBoxChangeEvent = new EventEmitter();
1226
+ constructor() { }
1227
+ ngOnInit() {
1228
+ }
1229
+ ngOnChanges(changes) {
1230
+ setTimeout(() => {
1231
+ if (changes['form'] && this.form) {
1232
+ this.formCopy = JSON.parse(JSON.stringify(this.form));
1233
+ }
1234
+ if ((changes['selectedLanguageInfo'] || this.selectedLanguageInfo) && this.selectedLanguageInfo.selectedLanguage) {
1235
+ if (this.selectedLanguageInfo?.errorMessages) {
1236
+ this.errorMessages = this.selectedLanguageInfo.errorMessages;
1237
+ }
1238
+ this.form.propertySchema = this.formCopy.propertySchema ? JSON.parse(JSON.stringify(this.formCopy.propertySchema)) : {};
1239
+ this.form.propertySchema = this.translateSchema(this.form.propertySchema, this.selectedLanguageInfo.selectedLanguage);
1240
+ if (this.formCopy.layoutSchema && this.formCopy.layoutSchema.formSections) {
1241
+ this.formCopy.layoutSchema.formSections.forEach((formSection, index) => {
1242
+ if (formSection?.label?.caption && this.selectedLanguageInfo.selectedLanguage[formSection.label.caption]) {
1243
+ this.form.layoutSchema.formSections[index].label.caption = this.selectedLanguageInfo.selectedLanguage[formSection.label.caption];
1244
+ }
1245
+ if (formSection.formFields && formSection.formFields.length > 0) {
1246
+ formSection.formFields.forEach((formField, fieldIndex) => {
1247
+ if (formField.label?.caption && this.selectedLanguageInfo.selectedLanguage[formField.label.caption]) {
1248
+ this.form.layoutSchema.formSections[index].formFields[fieldIndex].label.caption = this.selectedLanguageInfo.selectedLanguage[formField.label.caption];
1249
+ }
1250
+ });
1251
+ }
1252
+ });
1253
+ }
1254
+ }
1255
+ }, 1000);
1256
+ }
1257
+ translateSchema(schema, SelectedLanguage) {
1258
+ if (schema && typeof schema === 'object' && SelectedLanguage) {
1259
+ for (const key of Object.keys(schema)) {
1260
+ const val = schema[key];
1261
+ // If nested object → recurse
1262
+ if (val && typeof val === 'object' && !Array.isArray(val)) {
1263
+ this.translateSchema(val, SelectedLanguage);
1264
+ }
1265
+ // If array → loop items and recurse each one
1266
+ if (Array.isArray(val)) {
1267
+ val.forEach((item) => {
1268
+ if (item && typeof item === 'object') {
1269
+ this.translateSchema(item, SelectedLanguage);
1270
+ }
1271
+ });
1272
+ }
1273
+ // Translate caption
1274
+ if (val &&
1275
+ typeof val === 'object' &&
1276
+ typeof val.caption === 'string' &&
1277
+ val.caption.trim()) {
1278
+ const original = val.caption.trim();
1279
+ if (SelectedLanguage[original]) {
1280
+ val.caption = SelectedLanguage[original];
1281
+ }
1282
+ }
1283
+ // Translate placeholder
1284
+ if (val &&
1285
+ typeof val === 'object' &&
1286
+ typeof val.placeholder === 'string' &&
1287
+ val.placeholder.trim()) {
1288
+ const original = val.placeholder.trim();
1289
+ if (SelectedLanguage[original]) {
1290
+ val.placeholder = SelectedLanguage[original];
1291
+ }
1292
+ }
1293
+ }
1294
+ }
1295
+ return schema;
1296
+ }
1297
+ togglePasswordVisibility() {
1298
+ this.showPassword = !this.showPassword;
1299
+ }
1300
+ ngAfterViewInit() {
1301
+ setTimeout(() => {
1302
+ this.setValidations();
1303
+ }, 2000);
1304
+ }
1305
+ getStyleWithoutClasses(styleObject) {
1306
+ if (!styleObject) {
1307
+ return { classes: '', style: {} };
1308
+ }
1309
+ const { classes, ...styleWithoutClasses } = styleObject;
1310
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1311
+ }
1312
+ getScope(scope) {
1313
+ let propertyScope = "";
1314
+ let start = scope?.indexOf("#/") + 2;
1315
+ let end = scope?.indexOf("/", start);
1316
+ if (start && end) {
1317
+ propertyScope = scope.substring(start, end);
1318
+ }
1319
+ return propertyScope;
1320
+ }
1321
+ invokeFormBtnClick(option, propertySchema) {
1322
+ this.formButtonClick.emit({ option: option, propertySchema: propertySchema });
1323
+ }
1324
+ setformData() {
1325
+ this.checkBoxChangeEvent.emit();
1326
+ }
1327
+ setErroMessage(formField, errorMessages, field) {
1328
+ let error = "";
1329
+ let fieldName = "";
1330
+ if (field?.errors?.required) {
1331
+ error = errorMessages.required;
1332
+ }
1333
+ else if (field?.errors?.email || field.errors?.pattern) {
1334
+ error = errorMessages.pattern;
1335
+ }
1336
+ else if (field?.errors?.minlength) {
1337
+ error = errorMessages.minlength;
1338
+ }
1339
+ else if (field?.errors?.maxlength) {
1340
+ error = errorMessages.maxlength;
1341
+ }
1342
+ if (formField.label?.value) {
1343
+ fieldName = formField.label?.value;
1344
+ }
1345
+ else {
1346
+ let propertySchema = this.form.propertySchema[this.getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()];
1347
+ fieldName = propertySchema?.caption ? propertySchema.caption : propertySchema?.placeholder;
1348
+ }
1349
+ if (error && error.toString().includes("{{requiredLength}}")) {
1350
+ error = error.replace(/{{\s*requiredLength\s*}}/g, formField?.minlength.toString());
1351
+ }
1352
+ return error.replace(/{{\s*field\s*}}/g, fieldName);
1353
+ }
1354
+ setValidations() {
1355
+ if (this.form?.layoutSchema?.formSections?.length) {
1356
+ this.form?.layoutSchema?.formSections.forEach((formSection) => {
1357
+ if (formSection?.formFields?.length) {
1358
+ formSection.formFields.forEach((formField) => {
1359
+ if (formField.scope && this.form.propertySchema && Object.keys(this.form.propertySchema)?.length && this.form.propertySchema[this.getScope(formField.scope?.reference)]) {
1360
+ let validations = this.form.propertySchema[this.getScope(formField.scope?.reference)][formField.scope?.reference.split('/').pop()]?.validation;
1361
+ if (validations?.length > 0) {
1362
+ validations.forEach((validation) => {
1363
+ if (validation.required) {
1364
+ formField['required'] = true;
1365
+ }
1366
+ if (validation.email) {
1367
+ formField['email'] = true;
1368
+ }
1369
+ if (validation.minlength) {
1370
+ formField['minlength'] = validation.minlength;
1371
+ }
1372
+ if (validation.maxlength) {
1373
+ formField['maxlength'] = validation.maxlength;
1374
+ }
1375
+ });
1376
+ }
1377
+ }
1378
+ });
1379
+ }
1380
+ });
1381
+ }
1382
+ }
1383
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: FormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1384
+ 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:
1385
+ // Angular
1386
+ 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:
1387
+ // NG-ZORRO
1388
+ 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" }] });
1389
+ }
1390
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: FormComponent, decorators: [{
1391
+ type: Component,
1392
+ args: [{ standalone: true, imports: [
1393
+ // Angular
1394
+ CommonModule,
1395
+ FormsModule,
1396
+ // NG-ZORRO
1397
+ NzSelectModule
1398
+ ], 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>" }]
1399
+ }], ctorParameters: () => [], propDecorators: { errorMessages: [{
1400
+ type: Input
1401
+ }], creditCardError: [{
1402
+ type: Input
1403
+ }], form: [{
1404
+ type: Input
1405
+ }], selectedLanguageInfo: [{
1406
+ type: Input
1407
+ }], formButtonClick: [{
1408
+ type: Output
1409
+ }], checkBoxChangeEvent: [{
1410
+ type: Output
1411
+ }] } });
1412
+
1413
+ class NotificationService {
1414
+ toastr;
1415
+ constructor(toastr) {
1416
+ this.toastr = toastr;
1417
+ }
1418
+ success(message, time = 5000) {
1419
+ this.toastr.success(message, "", { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1420
+ }
1421
+ info(message, time = 5000) {
1422
+ this.toastr.info(message, "", { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1423
+ }
1424
+ warning(message, time = 20000) {
1425
+ this.toastr.warning(message, "", { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1426
+ }
1427
+ error(error, time = 20000, message) {
1428
+ this.toastr.error(error, message, { messageClass: 'toaster-font', titleClass: 'toaster-font', closeButton: true, timeOut: time });
1429
+ }
1430
+ 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 });
1431
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NotificationService, providedIn: 'root' });
1432
+ }
1433
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NotificationService, decorators: [{
1434
+ type: Injectable,
1435
+ args: [{
1436
+ providedIn: 'root'
1437
+ }]
1438
+ }], ctorParameters: () => [{ type: i1$2.ToastrService }] });
1439
+
1440
+ class GridComponent {
1441
+ requestService;
1442
+ utilityService;
1443
+ notificationService;
1444
+ oktaAuthService;
1445
+ isLogined = false;
1446
+ tableitemInfoCopy = {};
1447
+ errorMessages = {};
1448
+ environment;
1449
+ selectedLanguageInfo = {};
1450
+ tableitemInfo = {};
1451
+ form = {};
1452
+ isTableDataLoad = false;
1453
+ currenTableOptions = {};
1454
+ projectSeleted = '';
1455
+ pageSize = 5;
1456
+ currentPage = 0;
1457
+ pages = [];
1458
+ userInfo;
1459
+ onPageChange = new EventEmitter();
1460
+ onPageSizeChange = new EventEmitter();
1461
+ onGridScroll = new EventEmitter();
1462
+ showGridLink = new EventEmitter();
1463
+ gridButtonClick = new EventEmitter();
1464
+ gridIncreamentClick = new EventEmitter();
1465
+ gridDecreamentClick = new EventEmitter();
1466
+ gridImgClick = new EventEmitter();
1467
+ constructor(requestService, utilityService, notificationService, oktaAuthService) {
1468
+ this.requestService = requestService;
1469
+ this.utilityService = utilityService;
1470
+ this.notificationService = notificationService;
1471
+ this.oktaAuthService = oktaAuthService;
1472
+ }
1473
+ ngAfterViewInit() {
1474
+ this.authenticating();
1475
+ setTimeout(() => {
1476
+ if (this.environment && this.environment?.login && this.environment?.login?.type == "oktaAuth") {
1477
+ this.oktaAuthService.authState$.subscribe((result) => {
1478
+ if (result.isAuthenticated) {
1479
+ this.isLogined = true;
1480
+ }
1481
+ });
1482
+ }
1483
+ }, 500);
1484
+ }
1485
+ ngOnChanges(changes) {
1486
+ setTimeout(() => {
1487
+ if (changes['tableitemInfo'] && this.tableitemInfo) {
1488
+ console.log('this.tableitemInfo: ', this.tableitemInfo);
1489
+ console.log('this.selectedLanguageInfo?: ', this.selectedLanguageInfo);
1490
+ this.tableitemInfoCopy = JSON.parse(JSON.stringify(this.tableitemInfo));
1491
+ }
1492
+ if (changes['SelectedLanguage'] || this.selectedLanguageInfo?.selectedLanguage) {
1493
+ if (this.tableitemInfoCopy?.layoutSchema && this.tableitemInfoCopy.layoutSchema?.elements?.length) {
1494
+ this.tableitemInfo.propertySchema = JSON.parse(JSON.stringify(this.tableitemInfoCopy.propertySchema));
1495
+ this.tableitemInfo.propertySchema = this.translateSchema(this.tableitemInfo.propertySchema, this.selectedLanguageInfo.selectedLanguage);
1496
+ if (this.tableitemInfoCopy?.footer) {
1497
+ this.tableitemInfo.footer = JSON.parse(JSON.stringify(this.tableitemInfoCopy.footer));
1498
+ this.tableitemInfo.footer = this.translateSchema(this.tableitemInfo.footer, this.selectedLanguageInfo.selectedLanguage);
1499
+ }
1500
+ this.tableitemInfoCopy.layoutSchema.elements.forEach((column, index) => {
1501
+ if (column.label && column.label.caption && this.selectedLanguageInfo.selectedLanguage[column.label.caption]) {
1502
+ this.tableitemInfo.layoutSchema.elements[index].label.caption = this.selectedLanguageInfo.selectedLanguage[column.label.caption];
1503
+ }
1504
+ });
1505
+ }
1506
+ }
1507
+ }, 500);
1508
+ }
1509
+ translateSchema(schema, SelectedLanguage) {
1510
+ if (schema && typeof schema === 'object') {
1511
+ for (const key of Object.keys(schema)) {
1512
+ const val = schema[key];
1513
+ if (val && typeof val === 'object') {
1514
+ this.translateSchema(val, SelectedLanguage);
1515
+ }
1516
+ if (val && val.caption !== undefined && typeof val.caption === 'string') {
1517
+ const original = val.caption.trim();
1518
+ if (original && SelectedLanguage[original]) {
1519
+ val.caption = SelectedLanguage[original];
1520
+ }
1521
+ }
1522
+ if (val && val.value !== undefined && typeof val.value === 'string' && !val.value.includes("{{")) {
1523
+ const originalVal = val.value.trim();
1524
+ if (originalVal && SelectedLanguage[originalVal]) {
1525
+ val.value = SelectedLanguage[originalVal];
1526
+ }
1527
+ }
1528
+ }
1529
+ }
1530
+ return schema;
1531
+ }
1532
+ getScope(scope) {
1533
+ let propertyScope = "";
1534
+ let start = scope?.indexOf("#/") + 2;
1535
+ let end = scope?.indexOf("/", start);
1536
+ if (start && end) {
1537
+ propertyScope = scope.substring(start, end);
1538
+ }
1539
+ return propertyScope;
1540
+ }
1541
+ getStyleWithoutClasses(styleObject) {
1542
+ if (!styleObject) {
1543
+ return { classes: '', style: {} };
1544
+ }
1545
+ const { classes, ...styleWithoutClasses } = styleObject;
1546
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1547
+ }
1548
+ onScrollEvent(event) {
1549
+ this.onGridScroll.emit(event);
1550
+ }
1551
+ showLinkDetails(option, data) {
1552
+ this.showGridLink.emit({ option: option, data: data });
1553
+ }
1554
+ invokeGridBtnClick(option, propertySchema) {
1555
+ this.gridButtonClick.emit({ option: option, propertySchema: propertySchema });
1556
+ }
1557
+ upsertAction(option, data) {
1558
+ let url = option?.data_url;
1559
+ if (url && url?.includes("{{")) {
1560
+ const regex = /{{(.*?)}}/g;
1561
+ const matches = [...url.matchAll(regex)].map(m => m[1]);
1562
+ if (matches && data && data[matches[0]]) {
1563
+ option.data_url = url.replace(`{{${matches[0]}}}`, data[matches[0]]);
1564
+ }
1565
+ }
1566
+ let baseUrl = this.environment?.apiUrl + option.data_url;
1567
+ this.requestService.dynamicCall(option.method, {}, baseUrl, option?.passToken, this.projectSeleted, this.userInfo).subscribe((res) => {
1568
+ console.log('res: ', res);
1569
+ if (option?.reload) {
1570
+ window.location.reload();
1571
+ }
1572
+ else if (option.notifcation) {
1573
+ if (option.notifcation.success) {
1574
+ this.notificationService.success(option.notifcation.success);
1575
+ let findObj = this.findDynamicKeyAndValue(option);
1576
+ if (findObj.keyName) {
1577
+ data[findObj.keyName] = "APPROVED";
1578
+ }
1579
+ }
1580
+ }
1581
+ });
1582
+ }
1583
+ setActionColumn(option, data) {
1584
+ let showAction = true;
1585
+ let findCondiontionalKey = this.findDynamicKeyAndValue(option);
1586
+ if (findCondiontionalKey.keyName) {
1587
+ showAction = data[findCondiontionalKey.keyName] === findCondiontionalKey.value ? true : false;
1588
+ }
1589
+ return showAction;
1590
+ }
1591
+ findDynamicKeyAndValue(object) {
1592
+ const regex = /^\{\{(.*?)\}\}$/;
1593
+ for (const key of Object.keys(object)) {
1594
+ const match = key.match(regex);
1595
+ if (match) {
1596
+ return {
1597
+ keyName: match[1].trim(),
1598
+ value: object[key]
1599
+ };
1600
+ }
1601
+ }
1602
+ return null;
1603
+ }
1604
+ incrementQuantity(index, field, option) {
1605
+ this.gridIncreamentClick.emit({ index: index, field: field, option: option });
1606
+ }
1607
+ invokeTableImageClick(column, data) {
1608
+ this.gridImgClick.emit({ col: column, data: data });
1609
+ }
1610
+ decrementQuantity(index, field, option) {
1611
+ this.gridDecreamentClick.emit({ index: index, field: field, option: option });
1612
+ }
1613
+ invokeOnPageSizeChange(pageSize) {
1614
+ this.onPageSizeChange.emit(pageSize);
1615
+ }
1616
+ invokeGoToPage(page) {
1617
+ this.onPageChange.emit(page);
1618
+ }
1619
+ authenticating() {
1620
+ this.utilityService.getStorage(`${this.projectSeleted}Logined`).then((logined) => {
1621
+ if (logined == "true") {
1622
+ this.isLogined = true;
1623
+ }
1624
+ });
1625
+ }
1626
+ 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 });
1627
+ 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###\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" }] });
1628
+ }
1629
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: GridComponent, decorators: [{
1630
+ type: Component,
1631
+ args: [{ standalone: true, imports: [
1632
+ CommonModule,
1633
+ FormsModule,
1634
+ NzTableModule,
1635
+ NzIconModule,
1636
+ ButtonModule,
1637
+ PaginationComponent
1638
+ ], 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###\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>" }]
1639
+ }], ctorParameters: () => [{ type: RequestService }, { type: UtilityService }, { type: NotificationService }, { type: i4$1.OktaAuthStateService }], propDecorators: { errorMessages: [{
1640
+ type: Input
1641
+ }], environment: [{
1642
+ type: Input
1643
+ }], selectedLanguageInfo: [{
1644
+ type: Input
1645
+ }], tableitemInfo: [{
1646
+ type: Input
1647
+ }], form: [{
1648
+ type: Input
1649
+ }], isTableDataLoad: [{
1650
+ type: Input
1651
+ }], currenTableOptions: [{
1652
+ type: Input
1653
+ }], projectSeleted: [{
1654
+ type: Input
1655
+ }], pageSize: [{
1656
+ type: Input
1657
+ }], currentPage: [{
1658
+ type: Input
1659
+ }], pages: [{
1660
+ type: Input
1661
+ }], userInfo: [{
1662
+ type: Input
1663
+ }], onPageChange: [{
1664
+ type: Output
1665
+ }], onPageSizeChange: [{
1666
+ type: Output
1667
+ }], onGridScroll: [{
1668
+ type: Output
1669
+ }], showGridLink: [{
1670
+ type: Output
1671
+ }], gridButtonClick: [{
1672
+ type: Output
1673
+ }], gridIncreamentClick: [{
1674
+ type: Output
1675
+ }], gridDecreamentClick: [{
1676
+ type: Output
1677
+ }], gridImgClick: [{
1678
+ type: Output
1679
+ }] } });
1680
+
1681
+ class HeaderMenuComponent {
1682
+ oktaAuthService;
1683
+ requestService;
1684
+ utilityService;
1685
+ platform;
1686
+ isLogined = false;
1687
+ headerItems = [];
1688
+ environment;
1689
+ projectSeleted;
1690
+ cartInfo = {
1691
+ items: [],
1692
+ totalPrice: 0,
1693
+ quantity: 0
1694
+ };
1695
+ buttonClick = new EventEmitter();
1696
+ showTableContent = new EventEmitter();
1697
+ searchItems = new EventEmitter();
1698
+ constructor(oktaAuthService, requestService, utilityService, platform) {
1699
+ this.oktaAuthService = oktaAuthService;
1700
+ this.requestService = requestService;
1701
+ this.utilityService = utilityService;
1702
+ this.platform = platform;
1703
+ }
1704
+ ngAfterViewInit() {
1705
+ setTimeout(() => {
1706
+ if (this.environment && this.environment?.login && this.environment?.login?.type == "oktaAuth") {
1707
+ if (this.platform.ANDROID || this.platform.IOS) {
1708
+ this.utilityService.getLocalStorage(`loginedUser`).then((logined) => {
1709
+ if (logined && logined.token) {
1710
+ this.requestService.getLoginUser(logined?.token).subscribe((userInfo) => {
1711
+ this.isLogined = true;
1712
+ });
1713
+ }
1714
+ });
1715
+ }
1716
+ this.oktaAuthService.authState$.subscribe((result) => {
1717
+ if (result.isAuthenticated) {
1718
+ this.isLogined = true;
1719
+ }
1720
+ });
1721
+ }
1722
+ }, 500);
1723
+ }
1724
+ invokeSearchedItems(option, search) {
1725
+ this.searchItems.emit({ option: option, search: search });
1726
+ }
1727
+ invokeHeaderButtonClick(option) {
1728
+ this.buttonClick.emit(option);
1729
+ }
1730
+ invokeShowtableContent(option) {
1731
+ this.showTableContent.emit(option);
1732
+ }
1733
+ 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 });
1734
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HeaderMenuComponent, isStandalone: true, selector: "vl-header-menu", inputs: { headerItems: "headerItems", environment: "environment", projectSeleted: "projectSeleted", cartInfo: "cartInfo" }, outputs: { buttonClick: "buttonClick", showTableContent: "showTableContent", searchItems: "searchItems" }, ngImport: i0, template: "<header class=\"header\" *ngIf=\"headerItems.length > 0\">\r\n <div *ngFor=\"let header of headerItems\"\r\n [ngSwitch]=\"header.scope?.reference ? header.scope?.reference.split('/').pop() : 'default'\">\r\n <div *ngSwitchCase=\"'logo'\" [class]=\"header?.option?.visible ? 'logo' : 'hidden'\">\r\n <img [src]=\"header.option.src\" [alt]=\"header.alt\" />\r\n </div>\r\n\r\n <div *ngSwitchCase=\"'searchInput'\" [class]=\"header?.option?.visible ? 'search-box' : 'hidden'\">\r\n <input #search (keyup.enter)=\"invokeSearchedItems(header.option, search)\" type=\"text\"\r\n [placeholder]=\"header.option.placeholder\" />\r\n <button *ngIf=\"header.option.button !== false\" (click)=\"invokeSearchedItems(header.option, search)\">\r\n <ng-container *ngIf=\"!header.caption; else textContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ header.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n\r\n <div *ngSwitchCase=\"'cart'\" [class]=\"header?.option?.visible ? 'cart' : 'hidden'\"\r\n (click)=\"invokeShowtableContent(header.option)\">\r\n <span>{{cartInfo.totalPrice | currency : header.option?.currency ? header.option.currency : 'USD'}}</span>\r\n <span>{{cartInfo.quantity}}</span>\r\n <i [class]=\"header.icon\"></i>\r\n </div>\r\n <div *ngSwitchCase=\"'default'\"\r\n [class]=\"header?.option.islogin ? isLogined ? 'header-buttons' : 'hidden' : header?.option.islogin == false ? isLogined ? 'hidden' : 'header-buttons' : 'header-buttons'\">\r\n <button (click)=\"invokeHeaderButtonClick(header.option)\">\r\n <ng-container *ngIf=\"!header.label; else textContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ header.label }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\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.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" }] });
1735
+ }
1736
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HeaderMenuComponent, decorators: [{
1737
+ type: Component,
1738
+ args: [{ standalone: true, imports: [
1739
+ CommonModule,
1740
+ NzIconModule
1741
+ ], selector: 'vl-header-menu', template: "<header class=\"header\" *ngIf=\"headerItems.length > 0\">\r\n <div *ngFor=\"let header of headerItems\"\r\n [ngSwitch]=\"header.scope?.reference ? header.scope?.reference.split('/').pop() : 'default'\">\r\n <div *ngSwitchCase=\"'logo'\" [class]=\"header?.option?.visible ? 'logo' : 'hidden'\">\r\n <img [src]=\"header.option.src\" [alt]=\"header.alt\" />\r\n </div>\r\n\r\n <div *ngSwitchCase=\"'searchInput'\" [class]=\"header?.option?.visible ? 'search-box' : 'hidden'\">\r\n <input #search (keyup.enter)=\"invokeSearchedItems(header.option, search)\" type=\"text\"\r\n [placeholder]=\"header.option.placeholder\" />\r\n <button *ngIf=\"header.option.button !== false\" (click)=\"invokeSearchedItems(header.option, search)\">\r\n <ng-container *ngIf=\"!header.caption; else textContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ header.caption }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n\r\n <div *ngSwitchCase=\"'cart'\" [class]=\"header?.option?.visible ? 'cart' : 'hidden'\"\r\n (click)=\"invokeShowtableContent(header.option)\">\r\n <span>{{cartInfo.totalPrice | currency : header.option?.currency ? header.option.currency : 'USD'}}</span>\r\n <span>{{cartInfo.quantity}}</span>\r\n <i [class]=\"header.icon\"></i>\r\n </div>\r\n <div *ngSwitchCase=\"'default'\"\r\n [class]=\"header?.option.islogin ? isLogined ? 'header-buttons' : 'hidden' : header?.option.islogin == false ? isLogined ? 'hidden' : 'header-buttons' : 'header-buttons'\">\r\n <button (click)=\"invokeHeaderButtonClick(header.option)\">\r\n <ng-container *ngIf=\"!header.label; else textContent\">\r\n <i nz-icon [nzType]=\"header.icon\" nzTheme=\"outline\"></i>\r\n </ng-container>\r\n <ng-template #textContent>\r\n {{ header.label }}\r\n </ng-template>\r\n </button>\r\n </div>\r\n </div>\r\n</header>" }]
1742
+ }], ctorParameters: () => [{ type: i4$1.OktaAuthStateService }, { type: RequestService }, { type: UtilityService }, { type: i1.Platform }], propDecorators: { headerItems: [{
1743
+ type: Input
1744
+ }], environment: [{
1745
+ type: Input
1746
+ }], projectSeleted: [{
1747
+ type: Input
1748
+ }], cartInfo: [{
1749
+ type: Input
1750
+ }], buttonClick: [{
1751
+ type: Output
1752
+ }], showTableContent: [{
1753
+ type: Output
1754
+ }], searchItems: [{
1755
+ type: Output
1756
+ }] } });
1757
+
1758
+ class NetworkLogService {
1759
+ logs = [];
1760
+ addLog(log) {
1761
+ this.logs.unshift(log); // latest first
1762
+ localStorage.setItem('networkLogs', JSON.stringify(this.logs));
1763
+ }
1764
+ getLogsByDate(date) {
1765
+ return this.logs.filter(l => l.date === date);
1766
+ }
1767
+ getAll() {
1768
+ return [...this.logs];
1769
+ }
1770
+ clear() {
1771
+ this.logs = [];
1772
+ localStorage.removeItem('networkLogs');
1773
+ }
1774
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NetworkLogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1775
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NetworkLogService, providedIn: 'root' });
1776
+ }
1777
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: NetworkLogService, decorators: [{
1778
+ type: Injectable,
1779
+ args: [{
1780
+ providedIn: 'root'
1781
+ }]
1782
+ }] });
1783
+
1784
+ class LogsComponent {
1785
+ logService;
1786
+ logs = [];
1787
+ expandedRow = null;
1788
+ constructor(logService) {
1789
+ this.logService = logService;
1790
+ }
1791
+ ngOnInit() {
1792
+ const today = new Date().toISOString().split('T')[0];
1793
+ this.logs = this.logService.getLogsByDate(today);
1794
+ console.log('this.logs: ', this.logs);
1795
+ }
1796
+ toggleRow(index) {
1797
+ this.expandedRow = this.expandedRow === index ? null : index;
1798
+ }
1799
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: LogsComponent, deps: [{ token: NetworkLogService }], target: i0.ɵɵFactoryTarget.Component });
1800
+ 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" }] });
1801
+ }
1802
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: LogsComponent, decorators: [{
1803
+ type: Component,
1804
+ args: [{ standalone: true, imports: [
1805
+ CommonModule
1806
+ ], 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"] }]
1807
+ }], ctorParameters: () => [{ type: NetworkLogService }] });
1808
+
1809
+ class Label {
1810
+ formField;
1811
+ modalItemInfo;
1812
+ getScope(scope) {
1813
+ let propertyScope = "";
1814
+ let start = scope?.indexOf("#/") + 2;
1815
+ let end = scope?.indexOf("/", start);
1816
+ if (start && end) {
1817
+ propertyScope = scope.substring(start, end);
1818
+ }
1819
+ return propertyScope;
1820
+ }
1821
+ getStyleWithoutClasses(styleObject) {
1822
+ if (!styleObject) {
1823
+ return { classes: '', style: {} };
1824
+ }
1825
+ const { classes, ...styleWithoutClasses } = styleObject;
1826
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1827
+ }
1828
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Label, deps: [], target: i0.ɵɵFactoryTarget.Component });
1829
+ 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: [""] });
1830
+ }
1831
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Label, decorators: [{
1832
+ type: Component,
1833
+ 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>" }]
1834
+ }], propDecorators: { formField: [{
1835
+ type: Input
1836
+ }], modalItemInfo: [{
1837
+ type: Input
1838
+ }] } });
1839
+
1840
+ class Textbox {
1841
+ formField;
1842
+ modalItemInfo;
1843
+ getScope(scope) {
1844
+ let propertyScope = "";
1845
+ let start = scope?.indexOf("#/") + 2;
1846
+ let end = scope?.indexOf("/", start);
1847
+ if (start && end) {
1848
+ propertyScope = scope.substring(start, end);
1849
+ }
1850
+ return propertyScope;
1851
+ }
1852
+ getStyleWithoutClasses(styleObject) {
1853
+ if (!styleObject) {
1854
+ return { classes: '', style: {} };
1855
+ }
1856
+ const { classes, ...styleWithoutClasses } = styleObject;
1857
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1858
+ }
1859
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Textbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
1860
+ 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"] }] });
1861
+ }
1862
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Textbox, decorators: [{
1863
+ type: Component,
1864
+ 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\" />" }]
1865
+ }], propDecorators: { formField: [{
1866
+ type: Input
1867
+ }], modalItemInfo: [{
1868
+ type: Input
1869
+ }] } });
1870
+
1871
+ class Autocomplete {
1872
+ formField;
1873
+ modalItemInfo;
1874
+ matchData;
1875
+ selectedLanguageInfo;
1876
+ errorMessages;
1877
+ autocompSelect = new EventEmitter();
1878
+ autocompChange = new EventEmitter();
1879
+ autocompFocusOut = new EventEmitter();
1880
+ autocompSelectEvent(event, formField) {
1881
+ this.autocompSelect.emit({ event: event, formField: formField });
1882
+ }
1883
+ autocompChangeEvent(event, formField) {
1884
+ this.autocompChange.emit({ event: event, formField: formField });
1885
+ }
1886
+ autocompFocusOutEvent(event, formField) {
1887
+ this.autocompFocusOut.emit({ event: event, formField: formField });
1888
+ }
1889
+ getScope(scope) {
1890
+ let propertyScope = "";
1891
+ let start = scope?.indexOf("#/") + 2;
1892
+ let end = scope?.indexOf("/", start);
1893
+ if (start && end) {
1894
+ propertyScope = scope.substring(start, end);
1895
+ }
1896
+ return propertyScope;
1897
+ }
1898
+ getStyleWithoutClasses(styleObject) {
1899
+ if (!styleObject) {
1900
+ return { classes: '', style: {} };
1901
+ }
1902
+ const { classes, ...styleWithoutClasses } = styleObject;
1903
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
1904
+ }
1905
+ setErroMessage(formField, errorMessages, errorType) {
1906
+ let error = "";
1907
+ 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;
1908
+ if (errorType == "required") {
1909
+ error = this.selectedLanguageInfo?.errorMessages?.required ? this.selectedLanguageInfo?.errorMessages.required : errorMessages.required;
1910
+ }
1911
+ if (error && error.toString().includes("{{requiredLength}}")) {
1912
+ error = error.replace(/{{\s*requiredLength\s*}}/g, formField?.minlength.toString());
1913
+ }
1914
+ return error.replace(/{{\s*field\s*}}/g, fieldName);
1915
+ }
1916
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Autocomplete, deps: [], target: i0.ɵɵFactoryTarget.Component });
1917
+ 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"] }] });
1918
+ }
1919
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Autocomplete, decorators: [{
1920
+ type: Component,
1921
+ args: [{ selector: 'vl-autocomplete', standalone: true, imports: [
1922
+ FormsModule,
1923
+ AutoCompleteModule,
1924
+ SelectModule,
1925
+ NgIf
1926
+ ], 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>" }]
1927
+ }], propDecorators: { formField: [{
1928
+ type: Input
1929
+ }], modalItemInfo: [{
1930
+ type: Input
1931
+ }], matchData: [{
1932
+ type: Input
1933
+ }], selectedLanguageInfo: [{
1934
+ type: Input
1935
+ }], errorMessages: [{
1936
+ type: Input
1937
+ }], autocompSelect: [{
1938
+ type: Output
1939
+ }], autocompChange: [{
1940
+ type: Output
1941
+ }], autocompFocusOut: [{
1942
+ type: Output
1943
+ }] } });
1944
+
1945
+ class ModelComponent {
1946
+ matchData = [];
1947
+ errorMessages = {};
1948
+ isModalShow = false;
1949
+ modalItemInfo = {};
1950
+ selectedLanguageInfo = {};
1951
+ userInfo = {};
1952
+ invokeButtonClick = new EventEmitter();
1953
+ invokeSetFormData = new EventEmitter();
1954
+ modalClose = new EventEmitter();
1955
+ copyLayoutSchema = {};
1956
+ isLoading = false;
1957
+ constructor() {
1958
+ }
1959
+ ngAfterViewInit() {
1960
+ }
1961
+ async ngOnChanges(changes) {
1962
+ if (this.isModalShow === true) {
1963
+ if (this.modalItemInfo.layoutSchema) {
1964
+ this.copyLayoutSchema = JSON.parse(JSON.stringify(this.modalItemInfo.layoutSchema));
1965
+ }
1966
+ if ((changes['selectedLanguageInfo'] || this.selectedLanguageInfo) && this.selectedLanguageInfo.selectedLanguage) {
1967
+ this.modalItemInfo.layoutSchema = this.updateLayoutLanguage(this.copyLayoutSchema, this.selectedLanguageInfo.selectedLanguage);
1968
+ }
1969
+ if (this.modalItemInfo?.currentRecord) {
1970
+ this.mapDataToPropertySchema(this.modalItemInfo.currentRecord, this.modalItemInfo);
1971
+ }
1972
+ await this.setAutoCompleteData();
1973
+ }
1974
+ }
1975
+ updateLayoutLanguage(schema, translations) {
1976
+ const cloned = JSON.parse(JSON.stringify(schema));
1977
+ const walk = (obj) => {
1978
+ if (!obj || typeof obj !== 'object')
1979
+ return;
1980
+ // 🔹 label.caption (most common in form schemas)
1981
+ if (obj.label && typeof obj.label.caption === 'string') {
1982
+ const original = obj.label.caption;
1983
+ obj.label.caption = translations[original] ?? original;
1984
+ }
1985
+ // 🔹 direct caption (fallback / buttons / future-proof)
1986
+ if (typeof obj.caption === 'string') {
1987
+ const original = obj.caption;
1988
+ obj.caption = translations[original] ?? original;
1989
+ }
1990
+ // 🚫 Skip huge data arrays (autocomplete datasets, etc.)
1991
+ if (Array.isArray(obj.data))
1992
+ return;
1993
+ // 🔁 Recurse
1994
+ Object.keys(obj).forEach((key) => {
1995
+ const value = obj[key];
1996
+ if (typeof value === 'object') {
1997
+ walk(value);
1998
+ }
1999
+ });
2000
+ };
2001
+ walk(cloned);
2002
+ return cloned;
2003
+ }
2004
+ mapDataToPropertySchema(data, modalItemInfo) {
2005
+ if (!data || !modalItemInfo?.propertySchema)
2006
+ return;
2007
+ const [rootScope] = Object.keys(modalItemInfo.propertySchema);
2008
+ if (!rootScope)
2009
+ return;
2010
+ const schemaFields = modalItemInfo.propertySchema[rootScope];
2011
+ Object.keys(schemaFields).forEach((fieldKey) => {
2012
+ if (data.hasOwnProperty(fieldKey)) {
2013
+ if (!schemaFields[fieldKey]) {
2014
+ schemaFields[fieldKey] = {};
2015
+ }
2016
+ schemaFields[fieldKey].value = data[fieldKey];
2017
+ }
2018
+ });
2019
+ }
2020
+ async setAutoCompleteData() {
2021
+ for (const section of this.modalItemInfo.layoutSchema.formSections) {
2022
+ for (const field of section.formFields || []) {
2023
+ const type = this.modalItemInfo.propertySchema[this.getScope(field.scope?.reference)]?.[field.scope.reference.split('/').pop()]?.type;
2024
+ if (type === 'autocomplete' && field.option?.autocomplete) {
2025
+ this.isLoading = true;
2026
+ field['data'] = await this.fetchAutocompleteData(field);
2027
+ this.isLoading = false;
2028
+ }
2029
+ }
2030
+ }
2031
+ }
2032
+ async fetchAutocompleteData(formField) {
2033
+ const config = formField.option?.autocomplete;
2034
+ if (!config)
2035
+ return;
2036
+ const request = this.resolveAutocompleteConfig(config, this.userInfo);
2037
+ const response = await CapacitorHttp.request({
2038
+ url: request.url,
2039
+ method: request.method,
2040
+ params: request.params,
2041
+ headers: request.headers
2042
+ });
2043
+ return response.data?.length > 0 ? response.data : [];
2044
+ }
2045
+ resolveAutocompleteConfig(config, userInfo) {
2046
+ const params = {};
2047
+ Object.entries(config.params || {}).forEach(([key, value]) => {
2048
+ // 🔹 Dynamic token
2049
+ if (typeof value === 'string' && value.includes('{{')) {
2050
+ params[key] = this.resolveToken(value, userInfo);
2051
+ }
2052
+ // 🔹 Computed param
2053
+ else if (value?.type === 'company') {
2054
+ params[key] = this.buildCompany(userInfo);
2055
+ }
2056
+ // 🔹 Static
2057
+ else {
2058
+ params[key] = value;
2059
+ }
2060
+ });
2061
+ return {
2062
+ url: `${userInfo.p5_backend_url}${config.url}`,
2063
+ method: config.method || 'POST',
2064
+ params,
2065
+ headers: config.passToken
2066
+ ? {
2067
+ Authorization: `Bearer ${userInfo.token}`,
2068
+ Accept: 'application/json'
2069
+ }
2070
+ : {}
2071
+ };
2072
+ }
2073
+ buildCompany(userInfo) {
2074
+ return userInfo.p5_plant
2075
+ ? `${userInfo.p5_group}/${userInfo.p5_client}/${userInfo.p5_plant}`
2076
+ : `${userInfo.p5_group}/${userInfo.p5_client}/`;
2077
+ }
2078
+ resolveToken(template, context) {
2079
+ return template.replace(/{{(.*?)}}/g, (_, path) => {
2080
+ return path.split('.').reduce((acc, key) => acc?.[key], context) ?? '';
2081
+ });
2082
+ }
2083
+ getScope(scope) {
2084
+ let propertyScope = "";
2085
+ let start = scope?.indexOf("#/") + 2;
2086
+ let end = scope?.indexOf("/", start);
2087
+ if (start && end) {
2088
+ propertyScope = scope.substring(start, end);
2089
+ }
2090
+ return propertyScope;
2091
+ }
2092
+ autocompChangeEvent(event) {
2093
+ const q = (event?.event.query || '').toLowerCase();
2094
+ let fieldName = event?.formField.scope?.reference?.split('/')?.pop();
2095
+ if (fieldName) {
2096
+ this.matchData = event?.formField.data?.filter((x) => x[fieldName] && x[fieldName]?.toLowerCase()?.startsWith(q));
2097
+ }
2098
+ }
2099
+ autocompFocusOutEvent(event) {
2100
+ const selected = event?.event.target.value;
2101
+ let fieldName = event?.formField.scope?.reference?.split('/')?.pop();
2102
+ if (fieldName && (selected || typeof selected !== 'object')) {
2103
+ let actualObj = event?.formField.data?.find((x) => x[fieldName] == selected);
2104
+ if (actualObj) {
2105
+ this.autocompSelectEvent(event);
2106
+ }
2107
+ }
2108
+ }
2109
+ autocompSelectEvent(event) {
2110
+ const selected = event?.event.value;
2111
+ const mapping = event.formField.option?.onSelect?.mapFields;
2112
+ if (!selected || !mapping)
2113
+ return;
2114
+ Object.entries(mapping).forEach(([targetProp, sourceKey]) => {
2115
+ const scope = this.getScope(event.formField.scope.reference);
2116
+ if (this.modalItemInfo.propertySchema?.[scope]?.[targetProp]) {
2117
+ this.modalItemInfo.propertySchema[scope][targetProp].value = selected[sourceKey] ?? null;
2118
+ }
2119
+ });
2120
+ }
2121
+ setErroMessage(formField, errorMessages, errorType) {
2122
+ let error = "";
2123
+ 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;
2124
+ if (errorType == "required") {
2125
+ error = this.selectedLanguageInfo?.errorMessages?.required ? this.selectedLanguageInfo?.errorMessages.required : errorMessages.required;
2126
+ }
2127
+ if (error && error.toString().includes("{{requiredLength}}")) {
2128
+ error = error.replace(/{{\s*requiredLength\s*}}/g, formField?.minlength.toString());
2129
+ }
2130
+ return error.replace(/{{\s*field\s*}}/g, fieldName);
2131
+ }
2132
+ getStyleWithoutClasses(styleObject) {
2133
+ if (!styleObject) {
2134
+ return { classes: '', style: {} };
2135
+ }
2136
+ const { classes, ...styleWithoutClasses } = styleObject;
2137
+ return { classes: classes && classes.length > 0 ? classes[0] : '', style: styleWithoutClasses };
2138
+ }
2139
+ dateChangeEvent(formField, value) {
2140
+ this.handleRules(formField, value);
2141
+ }
2142
+ onDateTyping(event) {
2143
+ const input = event.target;
2144
+ if (!input)
2145
+ return;
2146
+ let digits = input.value.replace(/\D/g, '');
2147
+ digits = digits.substring(0, 8);
2148
+ let formatted = '';
2149
+ if (digits.length <= 4) {
2150
+ formatted = digits;
2151
+ }
2152
+ else if (digits.length <= 6) {
2153
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4)}`;
2154
+ }
2155
+ else {
2156
+ formatted = `${digits.slice(0, 4)}-${digits.slice(4, 6)}-${digits.slice(6)}`;
2157
+ }
2158
+ input.value = formatted;
2159
+ }
2160
+ forceNumericKeyboard(event) {
2161
+ const input = event?.target;
2162
+ if (input && input.tagName === 'INPUT') {
2163
+ input.setAttribute('inputmode', 'numeric'); // Android
2164
+ input.setAttribute('pattern', '[0-9:]*'); // iOS
2165
+ input.setAttribute('type', 'tel'); // strongest signal
2166
+ }
2167
+ }
2168
+ onTimeTyping(event) {
2169
+ const input = event?.target || event?.originalEvent?.target;
2170
+ if (!input)
2171
+ return;
2172
+ let digits = input.value.replace(/\D/g, '');
2173
+ digits = digits.substring(0, 4);
2174
+ let formatted = '';
2175
+ if (digits.length <= 2) {
2176
+ formatted = digits;
2177
+ }
2178
+ else {
2179
+ formatted = `${digits.slice(0, 2)}:${digits.slice(2)}`;
2180
+ }
2181
+ input.value = formatted;
2182
+ }
2183
+ timeChangeEvent(formField, value) {
2184
+ this.handleRules(formField, value);
2185
+ }
2186
+ handleRules(formField, value) {
2187
+ const scope = this.getScope(formField.scope.reference);
2188
+ const field = formField.scope?.reference.split('/').pop();
2189
+ const rules = formField.option?.rules;
2190
+ this.modalItemInfo.propertySchema[scope][field].value = value;
2191
+ if (!rules)
2192
+ return;
2193
+ rules.forEach((rule) => {
2194
+ let exist = this.isRuleTriggered(rule, formField);
2195
+ if (!exist)
2196
+ return;
2197
+ switch (rule.action) {
2198
+ case 'calculateDuration':
2199
+ this.applyDurationRule(rule, formField);
2200
+ break;
2201
+ case 'resetValue':
2202
+ this.resetRule(rule, formField);
2203
+ break;
2204
+ }
2205
+ });
2206
+ }
2207
+ resetRule(rule, formField) {
2208
+ const scope = this.getScope(formField.scope.reference);
2209
+ if (rule?.resetValue?.length > 0) {
2210
+ rule.resetValue.forEach((prop) => {
2211
+ this.modalItemInfo.propertySchema[scope][prop].value = null;
2212
+ });
2213
+ }
2214
+ }
2215
+ isRuleTriggered(rule, formField) {
2216
+ if (rule.when === 'timeRangeComplete') {
2217
+ const scope = this.getScope(formField.scope.reference);
2218
+ return (this.modalItemInfo.propertySchema[scope]?.workDayTimeFrom?.value &&
2219
+ this.modalItemInfo.propertySchema[scope]?.workDayTimeTo?.value);
2220
+ }
2221
+ else if (rule.when === 'change') {
2222
+ return true;
2223
+ }
2224
+ return false;
2225
+ }
2226
+ applyDurationRule(rule, formField) {
2227
+ const scope = this.getScope(formField.scope.reference);
2228
+ const schema = this.modalItemInfo.propertySchema[scope];
2229
+ const fromTimeVal = schema?.workDayTimeFrom?.value;
2230
+ const toTimeVal = schema?.workDayTimeTo?.value;
2231
+ const baseDateVal = schema?.fromDate?.value;
2232
+ // 🔒 Guard
2233
+ if (!fromTimeVal || !toTimeVal || !baseDateVal) {
2234
+ schema[rule.params.durationField].value = '';
2235
+ return;
2236
+ }
2237
+ // 📅 Base date (From Date)
2238
+ const baseDate = new Date(baseDateVal);
2239
+ baseDate.setHours(0, 0, 0, 0);
2240
+ // ⏱ FROM datetime
2241
+ const fromDateTime = new Date(baseDate);
2242
+ fromDateTime.setHours(fromTimeVal.getHours(), fromTimeVal.getMinutes(), 0, 0);
2243
+ // ⏱ TO datetime
2244
+ let toDateTime = new Date(baseDate);
2245
+ toDateTime.setHours(toTimeVal.getHours(), toTimeVal.getMinutes(), 0, 0);
2246
+ // 🌙 Overnight handling
2247
+ if (toDateTime <= fromDateTime) {
2248
+ toDateTime.setDate(toDateTime.getDate() + 1);
2249
+ }
2250
+ // ⏳ Duration calculation
2251
+ const diffMs = toDateTime.getTime() - fromDateTime.getTime();
2252
+ const totalMinutes = Math.floor(diffMs / 60000);
2253
+ const hours = Math.floor(totalMinutes / 60);
2254
+ const minutes = totalMinutes % 60;
2255
+ const duration = `${hours}:${minutes.toString().padStart(2, '0')}`;
2256
+ // ✅ Set duration
2257
+ schema[rule.params.durationField].value = duration;
2258
+ // ✅ Auto set To Date
2259
+ schema.toDate.value = new Date(toDateTime);
2260
+ }
2261
+ invokeSetformData() {
2262
+ this.invokeSetFormData.emit();
2263
+ }
2264
+ invokeFormBtnClick(option, propertySchema, form) {
2265
+ if (option.innerAction === 'submit') {
2266
+ let valid = this.checkValidty(form);
2267
+ if (valid) {
2268
+ this.invokeButtonClick.emit({ option: option, propertySchema: propertySchema, recordIndex: this.modalItemInfo?.recordIndex });
2269
+ }
2270
+ }
2271
+ else {
2272
+ this.invokeButtonClick.emit({ option: option, propertySchema: propertySchema });
2273
+ }
2274
+ }
2275
+ checkValidty(form) {
2276
+ if (!form) {
2277
+ return false;
2278
+ }
2279
+ Object.values(form.controls).forEach(control => {
2280
+ control.markAsTouched();
2281
+ control.updateValueAndValidity();
2282
+ });
2283
+ return !!form.valid;
2284
+ }
2285
+ onCancel() {
2286
+ this.modalClose.emit();
2287
+ }
2288
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ModelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2289
+ 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" }] });
2290
+ }
2291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ModelComponent, decorators: [{
2292
+ type: Component,
2293
+ args: [{ standalone: true, selector: 'vl-model', imports: [
2294
+ CommonModule,
2295
+ FormsModule,
2296
+ NzModalModule,
2297
+ NzSelectModule,
2298
+ NzDatePickerModule,
2299
+ DatePickerModule,
2300
+ AutoCompleteModule,
2301
+ InputTextModule,
2302
+ Label,
2303
+ Textbox,
2304
+ String$1,
2305
+ Autocomplete
2306
+ ], 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>" }]
2307
+ }], ctorParameters: () => [], propDecorators: { errorMessages: [{
2308
+ type: Input
2309
+ }], isModalShow: [{
2310
+ type: Input
2311
+ }], modalItemInfo: [{
2312
+ type: Input
2313
+ }], selectedLanguageInfo: [{
2314
+ type: Input
2315
+ }], userInfo: [{
2316
+ type: Input
2317
+ }], invokeButtonClick: [{
2318
+ type: Output
2319
+ }], invokeSetFormData: [{
2320
+ type: Output
2321
+ }], modalClose: [{
2322
+ type: Output
2323
+ }] } });
2324
+
2325
+ class Button {
2326
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Button, deps: [], target: i0.ɵɵFactoryTarget.Component });
2327
+ 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: [""] });
2328
+ }
2329
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Button, decorators: [{
2330
+ type: Component,
2331
+ args: [{ selector: 'vl-button', standalone: true, template: "<p>button works!</p>\r\n" }]
2332
+ }] });
2333
+
2334
+ let Date$1 = class Date {
2335
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Date, deps: [], target: i0.ɵɵFactoryTarget.Component });
2336
+ 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: [""] });
2337
+ };
2338
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Date$1, decorators: [{
2339
+ type: Component,
2340
+ args: [{ selector: 'vl-date', standalone: true, template: "<p>date works!</p>\r\n" }]
2341
+ }] });
2342
+
2343
+ class Dropdown {
2344
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Dropdown, deps: [], target: i0.ɵɵFactoryTarget.Component });
2345
+ 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: [""] });
2346
+ }
2347
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Dropdown, decorators: [{
2348
+ type: Component,
2349
+ args: [{ selector: 'vl-dropdown', standalone: true, template: "<p>dropdown works!</p>\r\n" }]
2350
+ }] });
2351
+
2352
+ class ErrorMessage {
2353
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorMessage, deps: [], target: i0.ɵɵFactoryTarget.Component });
2354
+ 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: [""] });
2355
+ }
2356
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ErrorMessage, decorators: [{
2357
+ type: Component,
2358
+ args: [{ selector: 'vl-error-message', standalone: true, template: "<p>error-message works!</p>\r\n" }]
2359
+ }] });
2360
+
2361
+ class Time {
2362
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Time, deps: [], target: i0.ɵɵFactoryTarget.Component });
2363
+ 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: [""] });
2364
+ }
2365
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Time, decorators: [{
2366
+ type: Component,
2367
+ args: [{ selector: 'vl-time', standalone: true, template: "<p>time works!</p>\r\n" }]
2368
+ }] });
2369
+
2370
+ // lib/view-toolkit.module.ts
2371
+ class ViewToolkitModule {
2372
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2373
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, imports: [CommonModule,
2374
+ CardComponent,
2375
+ FormComponent,
2376
+ GridComponent,
2377
+ HeaderMenuComponent,
2378
+ LogsComponent,
2379
+ ModelComponent,
2380
+ PaginationComponent,
2381
+ SideMenuComponent,
2382
+ Autocomplete,
2383
+ Button,
2384
+ Date$1,
2385
+ Dropdown,
2386
+ ErrorMessage,
2387
+ Label,
2388
+ String$1,
2389
+ Textbox,
2390
+ Time], exports: [CardComponent,
2391
+ FormComponent,
2392
+ GridComponent,
2393
+ HeaderMenuComponent,
2394
+ LogsComponent,
2395
+ ModelComponent,
2396
+ PaginationComponent,
2397
+ SideMenuComponent] });
2398
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, imports: [CommonModule,
2399
+ CardComponent,
2400
+ FormComponent,
2401
+ GridComponent,
2402
+ HeaderMenuComponent,
2403
+ LogsComponent,
2404
+ ModelComponent,
2405
+ PaginationComponent,
2406
+ SideMenuComponent,
2407
+ Autocomplete,
2408
+ Textbox] });
2409
+ }
2410
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ViewToolkitModule, decorators: [{
2411
+ type: NgModule,
2412
+ args: [{
2413
+ imports: [
2414
+ CommonModule,
2415
+ CardComponent,
2416
+ FormComponent,
2417
+ GridComponent,
2418
+ HeaderMenuComponent,
2419
+ LogsComponent,
2420
+ ModelComponent,
2421
+ PaginationComponent,
2422
+ SideMenuComponent,
2423
+ Autocomplete,
2424
+ Button,
2425
+ Date$1,
2426
+ Dropdown,
2427
+ ErrorMessage,
2428
+ Label,
2429
+ String$1,
2430
+ Textbox,
2431
+ Time
2432
+ ],
2433
+ exports: [
2434
+ CardComponent,
2435
+ FormComponent,
2436
+ GridComponent,
2437
+ HeaderMenuComponent,
2438
+ LogsComponent,
2439
+ ModelComponent,
2440
+ PaginationComponent,
2441
+ SideMenuComponent
2442
+ ]
2443
+ }]
2444
+ }] });
2445
+
2446
+ class Couchdb {
2447
+ utilityService;
2448
+ couchDbBaseUrl = 'https://couchdb.yomotech.de';
2449
+ constructor(utilityService) {
2450
+ this.utilityService = utilityService;
2451
+ }
2452
+ async getTenantDatabases(tenantKey) {
2453
+ if (!tenantKey || !tenantKey.trim()) {
2454
+ throw new Error('Missing tenantKey');
2455
+ }
2456
+ const response = await fetch(`https://couchdb.yomotech.de/tenant-dbs`, {
2457
+ method: 'GET',
2458
+ headers: {
2459
+ Accept: 'application/json',
2460
+ 'X-Tenant-Key': tenantKey.trim(),
2461
+ },
2462
+ });
2463
+ const data = await this.parseJsonOrText(response);
2464
+ if (!response.ok) {
2465
+ throw new Error(`GET /tenant-dbs -> ${response.status} ${this.stringifyErrorDetails(data)}`);
2466
+ }
2467
+ return data;
2468
+ }
2469
+ async parseJsonOrText(response) {
2470
+ const rawText = await response.text();
2471
+ if (!rawText)
2472
+ return null;
2473
+ try {
2474
+ return JSON.parse(rawText);
2475
+ }
2476
+ catch {
2477
+ return rawText;
2478
+ }
2479
+ }
2480
+ stringifyErrorDetails(data) {
2481
+ if (typeof data === 'string')
2482
+ return data;
2483
+ try {
2484
+ return JSON.stringify(data);
2485
+ }
2486
+ catch {
2487
+ return 'Unknown error';
2488
+ }
2489
+ }
2490
+ async getFileContentFromCouchDb(couchDbName, filePath) {
2491
+ try {
2492
+ const dbName = couchDbName;
2493
+ console.log('dbName: ', dbName);
2494
+ console.log('filePath: ', filePath);
2495
+ const docId = filePath?.trim();
2496
+ if (!docId) {
2497
+ console.error('Missing file path');
2498
+ return null;
2499
+ }
2500
+ const response = await fetch(this.getDocumentUrl(dbName, docId), {
2501
+ method: 'GET',
2502
+ headers: await this.getReadHeaders(),
2503
+ });
2504
+ const doc = await this.parseJsonOrText(response);
2505
+ if (!response.ok) {
2506
+ console.error(`Failed to fetch file "${docId}" from "${dbName}": ${response.status}`, doc);
2507
+ return null;
2508
+ }
2509
+ if (!doc?.data) {
2510
+ console.error(`Document "${docId}" does not contain file data`);
2511
+ return null;
2512
+ }
2513
+ // do not decode images as utf8 text
2514
+ if (this.isImageFile(doc.name || doc.path || docId, doc.contentType)) {
2515
+ return {
2516
+ type: 'base64file',
2517
+ mimeType: doc.contentType || this.getImageMimeType(docId),
2518
+ base64: doc.data,
2519
+ };
2520
+ }
2521
+ const decodedContent = this.fromBase64(doc.data);
2522
+ if (this.isJsonFile(doc.name || doc.path || docId, doc.contentType)) {
2523
+ try {
2524
+ return JSON.parse(decodedContent);
2525
+ }
2526
+ catch (jsonError) {
2527
+ console.error(`Failed to parse JSON for file "${docId}"`, jsonError);
2528
+ return decodedContent;
2529
+ }
2530
+ }
2531
+ return decodedContent;
2532
+ }
2533
+ catch (error) {
2534
+ console.error(`Unexpected error while fetching file "${filePath}" from "${couchDbName}"`, error);
2535
+ return null;
2536
+ }
2537
+ }
2538
+ isImageFile(fileNameOrPath, contentType) {
2539
+ const lower = (fileNameOrPath || '').toLowerCase();
2540
+ return (lower.endsWith('.png') ||
2541
+ lower.endsWith('.jpg') ||
2542
+ lower.endsWith('.jpeg') ||
2543
+ lower.endsWith('.ico') ||
2544
+ lower.endsWith('.svg') ||
2545
+ (contentType || '').startsWith('image/'));
2546
+ }
2547
+ getImageMimeType(fileNameOrPath) {
2548
+ const lower = (fileNameOrPath || '').toLowerCase();
2549
+ if (lower.endsWith('.png'))
2550
+ return 'image/png';
2551
+ if (lower.endsWith('.jpg') || lower.endsWith('.jpeg'))
2552
+ return 'image/jpeg';
2553
+ if (lower.endsWith('.ico'))
2554
+ return 'image/x-icon';
2555
+ if (lower.endsWith('.svg'))
2556
+ return 'image/svg+xml';
2557
+ return 'image/png';
2558
+ }
2559
+ fromBase64(base64) {
2560
+ try {
2561
+ return decodeURIComponent(escape(atob(base64)));
2562
+ }
2563
+ catch {
2564
+ return atob(base64);
2565
+ }
2566
+ }
2567
+ isJsonFile(fileNameOrPath, contentType) {
2568
+ const lower = (fileNameOrPath || '').toLowerCase();
2569
+ return lower.endsWith('.json') || contentType === 'application/json';
2570
+ }
2571
+ getDocumentUrl(dbName, docId) {
2572
+ return `${this.getDbUrl(dbName)}/${encodeURIComponent(docId)}`;
2573
+ }
2574
+ getDbUrl(dbName) {
2575
+ return `${this.couchDbBaseUrl}/${dbName}`;
2576
+ }
2577
+ async getReadHeaders() {
2578
+ return {
2579
+ Accept: 'application/json',
2580
+ ...(await this.buildTenantHeaders()),
2581
+ };
2582
+ }
2583
+ async buildTenantHeaders() {
2584
+ let tenantKey = await this.utilityService.getStorage('tenantKey');
2585
+ let tenantName = await this.utilityService.getStorage('tenantName');
2586
+ if (typeof tenantKey !== 'string' || !tenantKey.trim()) {
2587
+ return {
2588
+ 'X-Tenant-Key': tenantKey.trim(),
2589
+ };
2590
+ }
2591
+ else if (typeof tenantName !== 'string' || !tenantName.trim()) {
2592
+ return {
2593
+ 'X-Tenant': tenantName.trim(),
2594
+ };
2595
+ }
2596
+ throw new Error('Missing tenantKey');
2597
+ }
2598
+ async getImageSrcFromCouchDb(couchDbName, filePath) {
2599
+ const dbName = couchDbName;
2600
+ const docId = filePath?.trim();
2601
+ if (!docId) {
2602
+ throw new Error('Missing file path');
2603
+ }
2604
+ const response = await fetch(this.getDocumentUrl(dbName, docId), {
2605
+ method: 'GET',
2606
+ headers: await this.getReadHeaders(),
2607
+ });
2608
+ const doc = await this.parseJsonOrText(response);
2609
+ if (!response.ok) {
2610
+ throw new Error(`Failed to fetch image "${docId}" from "${dbName}": ${response.status} ${this.stringifyErrorDetails(doc)}`);
2611
+ }
2612
+ if (!doc?.data) {
2613
+ throw new Error(`Document "${docId}" does not contain image data`);
2614
+ }
2615
+ const mimeType = doc.contentType || 'image/png';
2616
+ return `data:${mimeType};base64,${doc.data}`;
2617
+ }
2618
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Couchdb, deps: [{ token: UtilityService }], target: i0.ɵɵFactoryTarget.Injectable });
2619
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Couchdb, providedIn: 'root' });
2620
+ }
2621
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: Couchdb, decorators: [{
2622
+ type: Injectable,
2623
+ args: [{
2624
+ providedIn: 'root',
2625
+ }]
2626
+ }], ctorParameters: () => [{ type: UtilityService }] });
2627
+
2628
+ class ConfigService {
2629
+ couchdbService;
2630
+ utilityService;
2631
+ platform;
2632
+ config;
2633
+ skipOkta = false;
2634
+ keycloakConfig;
2635
+ constructor(couchdbService, utilityService, platform) {
2636
+ this.couchdbService = couchdbService;
2637
+ this.utilityService = utilityService;
2638
+ this.platform = platform;
2639
+ }
2640
+ async loadOktaConfig(projectName) {
2641
+ try {
2642
+ let tenantKey = "";
2643
+ let tenantName = "";
2644
+ if (this.platform.ANDROID || this.platform.IOS) {
2645
+ tenantKey = await this.utilityService.getLocalStorage('tenantKey');
2646
+ tenantName = await this.utilityService.getLocalStorage('tenantName');
2647
+ }
2648
+ else {
2649
+ tenantKey = await this.utilityService.getStorage('tenantKey');
2650
+ tenantName = await this.utilityService.getStorage('tenantName');
2651
+ }
2652
+ this.config = await this.couchdbService.getFileContentFromCouchDb(`${tenantName}_${projectName}`, 'environments/environment.json');
2653
+ if (this.platform.ANDROID || this.platform.IOS) {
2654
+ if (this.config.environment.login.mobile) {
2655
+ this.setConfiguration(this.config.environment.login.mobile);
2656
+ }
2657
+ else {
2658
+ this.setConfiguration(null);
2659
+ }
2660
+ }
2661
+ else {
2662
+ if (this.config.environment.login.web) {
2663
+ this.setConfiguration(this.config.environment.login.web);
2664
+ }
2665
+ else {
2666
+ this.setConfiguration(null);
2667
+ }
2668
+ }
2669
+ }
2670
+ catch (err) {
2671
+ console.error('Error loading config:', err);
2672
+ }
2673
+ }
2674
+ setConfiguration(config) {
2675
+ if (config) {
2676
+ this.config = config;
2677
+ }
2678
+ else {
2679
+ this.config = {
2680
+ issuer: 'http://dummy',
2681
+ clientId: 'dummy',
2682
+ redirectUri: 'http://dummy',
2683
+ pkce: true,
2684
+ };
2685
+ }
2686
+ }
2687
+ skipOktaConfig() {
2688
+ this.skipOkta = true;
2689
+ }
2690
+ get oktaConfig() {
2691
+ if (this.skipOkta) {
2692
+ return null;
2693
+ }
2694
+ return this.config;
2695
+ }
2696
+ async loadKeycloakConfig(projectName) {
2697
+ let tenantKey = "";
2698
+ let tenantName = "";
2699
+ if (this.platform.ANDROID || this.platform.IOS) {
2700
+ tenantKey = await this.utilityService.getLocalStorage('tenantKey');
2701
+ tenantName = await this.utilityService.getLocalStorage('tenantName');
2702
+ }
2703
+ else {
2704
+ tenantKey = await this.utilityService.getStorage('tenantKey');
2705
+ tenantName = await this.utilityService.getStorage('tenantName');
2706
+ }
2707
+ const env = await this.couchdbService.getFileContentFromCouchDb(`${tenantName}_${projectName}`, 'environments/environment.json');
2708
+ if (env?.environment?.login.type === "keycloak") {
2709
+ if (this.platform.ANDROID || this.platform.IOS) {
2710
+ this.keycloakConfig = {
2711
+ issuer: "https://keycloak-poc.wilken.de/realms/p5",
2712
+ clientId: "mobile",
2713
+ redirectUri: "de.yomotech:/login/callback",
2714
+ logoutRedirectUri: "de.yomotech:/login/callback",
2715
+ scope: "openid profile email",
2716
+ responseType: "code"
2717
+ };
2718
+ }
2719
+ else {
2720
+ this.keycloakConfig = {
2721
+ issuer: env?.environment?.login?.web?.issuer ?? 'http://dummy',
2722
+ clientId: env?.environment?.login?.web?.clientId ?? 'dummy',
2723
+ redirectUri: window.location.origin,
2724
+ responseType: 'code',
2725
+ scope: 'openid profile email',
2726
+ showDebugInformation: true
2727
+ };
2728
+ }
2729
+ }
2730
+ else {
2731
+ this.keycloakConfig = {};
2732
+ }
2733
+ }
2734
+ getKeycloakConfig() {
2735
+ return this.keycloakConfig;
2736
+ }
2737
+ getKeycloakMobileConfig() {
2738
+ if (!this.keycloakConfig)
2739
+ return null;
2740
+ return {
2741
+ issuer: this.keycloakConfig?.issuer,
2742
+ clientId: this.keycloakConfig?.clientId,
2743
+ redirectUri: this.keycloakConfig.redirectUri,
2744
+ logoutRedirectUri: this.keycloakConfig.logoutRedirectUri,
2745
+ scope: this.keycloakConfig.scope,
2746
+ responseType: this.keycloakConfig.responseType
2747
+ };
2748
+ }
2749
+ 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 });
2750
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfigService, providedIn: 'root' });
2751
+ }
2752
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: ConfigService, decorators: [{
2753
+ type: Injectable,
2754
+ args: [{
2755
+ providedIn: 'root'
2756
+ }]
2757
+ }], ctorParameters: () => [{ type: Couchdb }, { type: UtilityService }, { type: i1.Platform }] });
2758
+
2759
+ class MobileKeycloakService {
2760
+ config;
2761
+ http;
2762
+ utilityService;
2763
+ platform;
2764
+ tokens = null;
2765
+ constructor(config, http, utilityService, platform) {
2766
+ this.config = config;
2767
+ this.http = http;
2768
+ this.utilityService = utilityService;
2769
+ this.platform = platform;
2770
+ if (Capacitor.isNativePlatform()) {
2771
+ App.addListener('appUrlOpen', async (url) => {
2772
+ // Nothing to do here; capacitor-oauth2 resolves internally.
2773
+ // Keep listener to satisfy deep link expectations.
2774
+ });
2775
+ }
2776
+ }
2777
+ async login() {
2778
+ if (!Capacitor.isNativePlatform())
2779
+ return null;
2780
+ const cfg = this.config.getKeycloakMobileConfig();
2781
+ const discoveryUrl = `${cfg.issuer}/.well-known/openid-configuration`;
2782
+ const discovery = await (await fetch(discoveryUrl)).json();
2783
+ const result = await OAuth2Client.authenticate({
2784
+ appId: cfg.clientId, // <--- Keycloak clientId goes here
2785
+ authorizationBaseUrl: discovery.authorization_endpoint,
2786
+ accessTokenEndpoint: discovery.token_endpoint,
2787
+ responseType: 'code',
2788
+ redirectUrl: cfg.redirectUri,
2789
+ scope: cfg.scope,
2790
+ pkceEnabled: true,
2791
+ logsEnabled: true
2792
+ });
2793
+ console.log('result-KEyClaok: ', result);
2794
+ this.tokens = {
2795
+ access_token: result?.access_token_response?.access_token ? result?.access_token_response?.access_token : result.access_token,
2796
+ refresh_token: result?.access_token_response?.refresh_token,
2797
+ id_token: result?.access_token_response?.id_token,
2798
+ expires_in: result?.access_token_response?.expires_at ? result?.access_token_response?.expires_at : result?.access_token_response?.expires_in,
2799
+ token_type: result?.access_token_response?.token_type
2800
+ };
2801
+ let keycloakLoginUser = "";
2802
+ if (this.tokens.access_token) {
2803
+ keycloakLoginUser = await this.getUserInfo(this.tokens.access_token, cfg.issuer);
2804
+ console.log('keycloakLoginUser: ', keycloakLoginUser);
2805
+ if (keycloakLoginUser) {
2806
+ this.tokens['issuer'] = cfg.issuer;
2807
+ this.utilityService.setLocalStorage("KeycloakInfo", this.tokens);
2808
+ if (this.platform.ANDROID || this.platform.IOS) {
2809
+ window.location.reload();
2810
+ }
2811
+ }
2812
+ }
2813
+ return keycloakLoginUser;
2814
+ }
2815
+ async getUserInfo(accessToken, issuer) {
2816
+ try {
2817
+ const headers = new HttpHeaders({
2818
+ Authorization: `Bearer ${accessToken}`,
2819
+ });
2820
+ const url = `${issuer}/protocol/openid-connect/userinfo`;
2821
+ return await this.http.get(url, { headers }).toPromise();
2822
+ }
2823
+ catch (err) {
2824
+ console.error('Error fetching user info:', err);
2825
+ throw err;
2826
+ }
2827
+ }
2828
+ getAccessToken() {
2829
+ return this.tokens?.access_token ?? null;
2830
+ }
2831
+ getRefreshToken() {
2832
+ return this.tokens?.refresh_token ?? null;
2833
+ }
2834
+ async logout() {
2835
+ const keycloakInfo = await this.utilityService.getLocalStorage('KeycloakInfo');
2836
+ const cfg = this.config.getKeycloakMobileConfig();
2837
+ const idToken = keycloakInfo?.keycloakInfo?.id_token;
2838
+ const accessToken = keycloakInfo?.keycloakInfo?.access_token;
2839
+ if (!idToken || !accessToken) {
2840
+ console.warn('No tokens found for logout');
2841
+ return;
2842
+ }
2843
+ const endSessionUrl = `${cfg.issuer}/protocol/openid-connect/logout` +
2844
+ `?id_token_hint=${encodeURIComponent(idToken)}` +
2845
+ `&client_id=${encodeURIComponent(cfg.clientId)}` +
2846
+ `&post_logout_redirect_uri=${encodeURIComponent(cfg.logoutRedirectUri)}`;
2847
+ console.log('Logout URL:', endSessionUrl);
2848
+ await Browser.open({ url: endSessionUrl });
2849
+ this.tokens = null;
2850
+ await this.utilityService.removeLocalStorage('KeycloakInfo');
2851
+ window.location.reload();
2852
+ }
2853
+ 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 });
2854
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: MobileKeycloakService, providedIn: 'root' });
2855
+ }
2856
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: MobileKeycloakService, decorators: [{
2857
+ type: Injectable,
2858
+ args: [{
2859
+ providedIn: 'root'
2860
+ }]
2861
+ }], ctorParameters: () => [{ type: ConfigService }, { type: i1$1.HttpClient }, { type: UtilityService }, { type: i1.Platform }] });
2862
+
2863
+ class SideMenuComponent {
2864
+ i18n;
2865
+ mobileKeycloakService;
2866
+ couchdbService;
2867
+ oauthService;
2868
+ platform;
2869
+ requestService;
2870
+ utilityService;
2871
+ dialogService;
2872
+ oktaAuthService;
2873
+ notificationService;
2874
+ oktaAuth;
2875
+ isCollapsed = false;
2876
+ isMobile = false;
2877
+ projectsLayoutSchema;
2878
+ loginUser = {};
2879
+ isLogined = false;
2880
+ loginedUserInfo = {};
2881
+ menuItemsCopy = {};
2882
+ settingMenu = {};
2883
+ setLanguage = false;
2884
+ tenantKey = '';
2885
+ tenantName = '';
2886
+ menuItems = [];
2887
+ userInfo = {};
2888
+ settings = {};
2889
+ projects;
2890
+ environment;
2891
+ projectSeleted;
2892
+ languageChange = new EventEmitter();
2893
+ invokeMenu = new EventEmitter();
2894
+ menuToggle = new EventEmitter();
2895
+ invokeProject = new EventEmitter();
2896
+ errorMessage = new EventEmitter();
2897
+ deleteProject = new EventEmitter();
2898
+ PRIME_DE = {
2899
+ firstDayOfWeek: 1,
2900
+ dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
2901
+ dayNamesShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
2902
+ dayNamesMin: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
2903
+ monthNames: [
2904
+ 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni',
2905
+ 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
2906
+ ],
2907
+ monthNamesShort: [
2908
+ 'Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun',
2909
+ 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'
2910
+ ],
2911
+ today: 'Heute',
2912
+ clear: 'Löschen',
2913
+ dateFormat: 'yy-mm-dd',
2914
+ weekHeader: 'KW'
2915
+ };
2916
+ PRIME_EN = {
2917
+ firstDayOfWeek: 0,
2918
+ dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
2919
+ dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
2920
+ dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
2921
+ monthNames: [
2922
+ 'January', 'February', 'March', 'April', 'May', 'June',
2923
+ 'July', 'August', 'September', 'October', 'November', 'December'
2924
+ ],
2925
+ monthNamesShort: [
2926
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
2927
+ 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
2928
+ ],
2929
+ today: 'Today',
2930
+ clear: 'Clear',
2931
+ dateFormat: 'yy-mm-dd',
2932
+ weekHeader: 'Wk'
2933
+ };
2934
+ sideMenu;
2935
+ constructor(i18n, mobileKeycloakService, couchdbService, oauthService, platform, requestService, utilityService, dialogService, oktaAuthService, notificationService, oktaAuth) {
2936
+ this.i18n = i18n;
2937
+ this.mobileKeycloakService = mobileKeycloakService;
2938
+ this.couchdbService = couchdbService;
2939
+ this.oauthService = oauthService;
2940
+ this.platform = platform;
2941
+ this.requestService = requestService;
2942
+ this.utilityService = utilityService;
2943
+ this.dialogService = dialogService;
2944
+ this.oktaAuthService = oktaAuthService;
2945
+ this.notificationService = notificationService;
2946
+ this.oktaAuth = oktaAuth;
2947
+ }
2948
+ onDocumentClick(event) {
2949
+ const path = event.composedPath();
2950
+ const clickedInsideMenu = path.some(el => el === this.sideMenu?.nativeElement);
2951
+ const clickedToggle = path.some(el => el instanceof HTMLElement &&
2952
+ el.classList?.contains('side-toggle-handle'));
2953
+ if (!clickedInsideMenu && !clickedToggle && this.isMobile) {
2954
+ console.log('OUTSIDE CLICK');
2955
+ let btn = document.getElementById('toggle-id');
2956
+ if (btn && !this.isCollapsed) {
2957
+ btn.click();
2958
+ }
2959
+ }
2960
+ }
2961
+ toggleCollapsed() {
2962
+ if (this.isMobile) {
2963
+ this.isCollapsed = !this.isCollapsed;
2964
+ const sideMenu = document.querySelector('.side-menu');
2965
+ if (sideMenu) {
2966
+ sideMenu.classList.toggle('open', !this.isCollapsed);
2967
+ }
2968
+ }
2969
+ else {
2970
+ this.isCollapsed = !this.isCollapsed;
2971
+ }
2972
+ }
2973
+ async ngOnInit() {
2974
+ if (this.platform.ANDROID || this.platform.IOS) {
2975
+ this.isCollapsed = true;
2976
+ this.isMobile = true;
2977
+ this.tenantKey = await this.utilityService.getLocalStorage('tenantKey');
2978
+ this.tenantName = await this.utilityService.getLocalStorage('tenantName');
2979
+ }
2980
+ else {
2981
+ this.tenantKey = await this.utilityService.getStorage('tenantKey');
2982
+ this.tenantName = await this.utilityService.getStorage('tenantName');
2983
+ }
2984
+ }
2985
+ ngOnChanges(changes) {
2986
+ this.setLoginUser();
2987
+ if (changes['menuItems'] && this.menuItems?.length) {
2988
+ this.menuItemsCopy = JSON.parse(JSON.stringify(this.menuItems));
2989
+ this.setProjectSetting();
2990
+ this.setSettingImages();
2991
+ }
2992
+ }
2993
+ async setProjectSetting() {
2994
+ const tasks = [];
2995
+ this.menuItems.forEach((menuItem) => {
2996
+ if (menuItem?.label?.caption === "Setting" && menuItem?.submenu?.length) {
2997
+ menuItem?.submenu.forEach((subMenu) => {
2998
+ if (subMenu?.label?.caption === "Languages" && subMenu?.submenu?.length) {
2999
+ subMenu?.submenu.forEach((childMenu) => {
3000
+ tasks.push((async () => {
3001
+ try {
3002
+ childMenu.icon = await this.couchdbService.getFileContentFromCouchDb(`${this.tenantName}_${this.projectSeleted}`, `${childMenu.icon}`);
3003
+ }
3004
+ catch (err) {
3005
+ console.error("Failed to fetch icon:", err);
3006
+ }
3007
+ })());
3008
+ });
3009
+ }
3010
+ });
3011
+ }
3012
+ });
3013
+ await Promise.all(tasks);
3014
+ }
3015
+ async ngAfterViewInit() {
3016
+ let mobileLang = await this.getDeviceLanguage();
3017
+ if (mobileLang) {
3018
+ this.changeLanguage(mobileLang + '.json');
3019
+ }
3020
+ setTimeout(async () => {
3021
+ this.initializeProjects();
3022
+ await this.setLoginUser();
3023
+ }, 1000);
3024
+ }
3025
+ async getDeviceLanguage() {
3026
+ const info = await Device.getLanguageCode();
3027
+ return info.value; // e.g. 'en', 'ur', 'de'
3028
+ }
3029
+ async setLoginUser() {
3030
+ try {
3031
+ if (this.environment?.login?.type === 'oktaAuth') {
3032
+ if (this.platform.ANDROID || this.platform.IOS) {
3033
+ const logined = await this.utilityService.getLocalStorage('loginedUser');
3034
+ if (logined?.token) {
3035
+ this.requestService.getLoginUser(logined.token).subscribe({
3036
+ next: (userInfo) => {
3037
+ this.loginUser = { ...this.userInfo, ...logined };
3038
+ this.setLoginedUser(this.loginUser);
3039
+ },
3040
+ error: (err) => {
3041
+ console.error('Failed to fetch login user (mobile):', err);
3042
+ }
3043
+ });
3044
+ }
3045
+ }
3046
+ else {
3047
+ this.oktaAuthService.authState$.subscribe({
3048
+ next: async (result) => {
3049
+ if (result.isAuthenticated) {
3050
+ try {
3051
+ const oktaWebUser = await this.oktaAuth.getUser();
3052
+ const webLoginedUser = { ...this.userInfo, ...oktaWebUser };
3053
+ this.loginUser = webLoginedUser;
3054
+ this.setLoginedUser(this.loginUser);
3055
+ }
3056
+ catch (err) {
3057
+ console.error('Failed to fetch Okta web user:', err);
3058
+ }
3059
+ }
3060
+ },
3061
+ error: (err) => {
3062
+ console.error('Okta auth state subscription error:', err);
3063
+ }
3064
+ });
3065
+ }
3066
+ }
3067
+ else if (this.environment?.login?.type === 'jwtToken' && this.userInfo?.jwt) {
3068
+ const userInfo = this.getUserInfoFromToken(this.userInfo.jwt);
3069
+ this.loginUser = userInfo;
3070
+ this.setLoginedUser(this.loginUser);
3071
+ }
3072
+ else if (this.environment?.login?.type === 'keycloak' && this.userInfo?.name) {
3073
+ this.loginUser = this.userInfo;
3074
+ this.setLoginedUser(this.loginUser);
3075
+ }
3076
+ }
3077
+ catch (error) {
3078
+ console.error('Error in setLoginUser:', error);
3079
+ }
3080
+ }
3081
+ getUserInfoFromToken(token) {
3082
+ try {
3083
+ const decoded = jwtDecode(token);
3084
+ return {
3085
+ sub: decoded.sub,
3086
+ name: decoded.name || 'User is undefined',
3087
+ role: decoded.role || 'Role is undefined',
3088
+ email: decoded.email || decoded.sub,
3089
+ iat: decoded.iat,
3090
+ exp: decoded.exp
3091
+ };
3092
+ }
3093
+ catch (err) {
3094
+ return null;
3095
+ }
3096
+ }
3097
+ async setSettingImages() {
3098
+ const tasks = [];
3099
+ for (const menu of this.settings?.submenu) {
3100
+ if (menu?.submenu?.length) {
3101
+ for (const childMenu of menu.submenu) {
3102
+ if (childMenu.options && childMenu.options.setImageUrl) {
3103
+ tasks.push((async () => {
3104
+ try {
3105
+ childMenu.icon = await this.couchdbService.getFileContentFromCouchDb(`${this.tenantName}_${this.projectSeleted}`, `${childMenu.icon}`);
3106
+ }
3107
+ catch (err) {
3108
+ console.error("Failed to fetch icon:", err);
3109
+ }
3110
+ })());
3111
+ }
3112
+ }
3113
+ }
3114
+ }
3115
+ await Promise.all(tasks);
3116
+ this.settingMenu = JSON.parse(JSON.stringify(this.settings));
3117
+ }
3118
+ isUrl(value) {
3119
+ return /^https?:\/\//.test(value) || value.startsWith('blob:');
3120
+ }
3121
+ async setLoginedUser(user) {
3122
+ if (user?.name) {
3123
+ user['image'] = "assets/user.png";
3124
+ this.loginedUserInfo = user;
3125
+ let matchMenu = this.menuItems.find((menu) => menu?.options?.action && menu?.options?.action === "logout");
3126
+ if (matchMenu) {
3127
+ this.loginedUserInfo.actions = [matchMenu];
3128
+ }
3129
+ this.isLogined = this.loginedUserInfo?.name ? true : false;
3130
+ }
3131
+ }
3132
+ initializeProjects() {
3133
+ this.projectsLayoutSchema = this.projects;
3134
+ }
3135
+ async invokeNavigate(menu, parentMenu) {
3136
+ if (menu.options.showAllProjects) {
3137
+ this.utilityService.showAllProjects();
3138
+ }
3139
+ else if (menu.options.changeLang) {
3140
+ this.changeLanguage(menu.options.data_url);
3141
+ }
3142
+ else if (menu.options.changeProject) {
3143
+ this.navigateToProject(menu);
3144
+ }
3145
+ else if (menu.options.logs) {
3146
+ this.openLogsTable();
3147
+ }
3148
+ else if (menu.options.terms) {
3149
+ this.notificationService.info("Term Not Apply");
3150
+ }
3151
+ else if (menu.options.projectPrivacy) {
3152
+ this.notificationService.warning("Project Privacy Not Apply");
3153
+ }
3154
+ else if (menu.options.projectVersion) {
3155
+ this.notificationService.warning("Project Version Not Apply");
3156
+ }
3157
+ else if (menu.options.action == 'login' && this.environment?.login?.type == "keycloak") {
3158
+ if (this.platform.ANDROID || this.platform.IOS) {
3159
+ let login = await this.mobileKeycloakService.login();
3160
+ }
3161
+ else {
3162
+ this.oauthService.initLoginFlow();
3163
+ }
3164
+ }
3165
+ else {
3166
+ this.toggleCollapsed();
3167
+ this.invokeMenu.emit(menu);
3168
+ }
3169
+ }
3170
+ openLogsTable() {
3171
+ let logsModal = this.dialogService.open(LogsComponent, {
3172
+ width: '700px',
3173
+ data: {}
3174
+ });
3175
+ // logsModal.onClose.subscribe((res: any) => {
3176
+ // if (res) {
3177
+ // console.log('res789: ', res);
3178
+ // }
3179
+ // });
3180
+ }
3181
+ deleteMenuItem(subChild, index, event) {
3182
+ event.stopPropagation();
3183
+ this.settings.submenu[1].submenu.splice(index, 1);
3184
+ this.deleteProject.emit(subChild);
3185
+ }
3186
+ navigateToProject(project) {
3187
+ this.invokeProject.emit(project);
3188
+ }
3189
+ async changeLanguage(lang) {
3190
+ if (lang) {
3191
+ if (lang === 'de.json') {
3192
+ // NG-Zorro
3193
+ this.i18n.setLocale(de_DE);
3194
+ // PrimeNG 🔥
3195
+ // this.primengConfig.setTranslation(this.PRIME_DE);
3196
+ }
3197
+ else {
3198
+ this.i18n.setLocale(en_US);
3199
+ // this.primengConfig.setTranslation(this.PRIME_EN);
3200
+ }
3201
+ const selectedLanguage = await this.couchdbService.getFileContentFromCouchDb(`${this.tenantName}_${this.projectSeleted}`, `languages/${lang}`);
3202
+ const errorMessages = await this.couchdbService.getFileContentFromCouchDb(`${this.tenantName}_${this.projectSeleted}`, `languages/errorMessage_${lang}`);
3203
+ this.languageChange.emit({ selectedLanguage: selectedLanguage, errorMessages: errorMessages });
3204
+ this.setLanguage = true;
3205
+ this.menuItemsCopy.forEach((menu, index) => {
3206
+ if (menu.label && menu.label.caption && selectedLanguage[menu.label.caption]) {
3207
+ this.menuItems[index].label.caption = selectedLanguage[menu.label.caption];
3208
+ }
3209
+ if (menu?.submenu?.length) {
3210
+ menu?.submenu.forEach((subMenuInfo, subIndex) => {
3211
+ if (subMenuInfo.label && subMenuInfo.label.caption && selectedLanguage[subMenuInfo.label.caption]) {
3212
+ this.menuItems[index].submenu[subIndex].label.caption = selectedLanguage[subMenuInfo.label.caption];
3213
+ }
3214
+ if (subMenuInfo?.submenu?.length) {
3215
+ subMenuInfo.submenu.forEach((childMenu, childIndex) => {
3216
+ if (childMenu.label && childMenu.label.caption && selectedLanguage[childMenu.label.caption]) {
3217
+ this.menuItems[index].submenu[subIndex].submenu[childIndex].label.caption = selectedLanguage[childMenu.label.caption];
3218
+ }
3219
+ });
3220
+ }
3221
+ });
3222
+ }
3223
+ });
3224
+ if (this.settingMenu?.label?.caption) {
3225
+ this.settingMenu.label.caption = selectedLanguage[this.settings.label.caption];
3226
+ }
3227
+ this.settings?.submenu?.forEach((menu, index) => {
3228
+ if (menu.label && menu.label.caption && selectedLanguage[menu.label.caption] && this.settingMenu?.submenu[index] && this.settingMenu.submenu[index]?.label) {
3229
+ this.settingMenu.submenu[index].label.caption = selectedLanguage[menu.label.caption];
3230
+ }
3231
+ });
3232
+ }
3233
+ }
3234
+ 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 });
3235
+ 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:
3236
+ // NG-ZORRO
3237
+ 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:
3238
+ // PrimeNG
3239
+ DynamicDialogModule }] });
3240
+ }
3241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: SideMenuComponent, decorators: [{
3242
+ type: Component,
3243
+ args: [{ standalone: true, selector: 'vl-side-menu', imports: [
3244
+ CommonModule,
3245
+ PlatformModule,
3246
+ // NG-ZORRO
3247
+ NzMenuModule,
3248
+ NzIconModule,
3249
+ NzTooltipModule,
3250
+ NzButtonModule,
3251
+ // PrimeNG
3252
+ DynamicDialogModule
3253
+ ], 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"] }]
3254
+ }], 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: [{
3255
+ type: Inject,
3256
+ args: [OKTA_AUTH]
3257
+ }] }], propDecorators: { menuItems: [{
3258
+ type: Input
3259
+ }], userInfo: [{
3260
+ type: Input
3261
+ }], settings: [{
3262
+ type: Input
3263
+ }], projects: [{
3264
+ type: Input
3265
+ }], environment: [{
3266
+ type: Input
3267
+ }], projectSeleted: [{
3268
+ type: Input
3269
+ }], languageChange: [{
3270
+ type: Output
3271
+ }], invokeMenu: [{
3272
+ type: Output
3273
+ }], menuToggle: [{
3274
+ type: Output
3275
+ }], invokeProject: [{
3276
+ type: Output
3277
+ }], errorMessage: [{
3278
+ type: Output
3279
+ }], deleteProject: [{
3280
+ type: Output
3281
+ }], sideMenu: [{
3282
+ type: ViewChild,
3283
+ args: ['sideMenu', { static: true }]
3284
+ }], onDocumentClick: [{
3285
+ type: HostListener,
3286
+ args: ['document:click', ['$event']]
3287
+ }] } });
3288
+
3289
+ // AUTO-GENERATED. Do not edit.
3290
+ const APP_VERSION = '1.0.204';
3291
+
3292
+ const VERSION_KEY = 'APP_VERSION';
3293
+ class AppVersionResetService {
3294
+ platform;
3295
+ constructor(platform) {
3296
+ this.platform = platform;
3297
+ }
3298
+ async run() {
3299
+ if (this.platform.ANDROID || this.platform.IOS) {
3300
+ await this.clearNativeIfChanged();
3301
+ // this.clearWebIfChanged();
3302
+ // return;
3303
+ }
3304
+ }
3305
+ async clearNativeIfChanged() {
3306
+ const { value: savedVersion } = await Preferences.get({ key: VERSION_KEY });
3307
+ if (savedVersion === APP_VERSION)
3308
+ return;
3309
+ console.log(`🧹 Clearing Capacitor Preferences (new build ${APP_VERSION})`);
3310
+ await Preferences.clear();
3311
+ this.clearWebStores();
3312
+ await Preferences.set({ key: VERSION_KEY, value: APP_VERSION });
3313
+ }
3314
+ // private clearWebIfChanged(): void {
3315
+ // const savedVersion = sessionStorage.getItem(VERSION_KEY) || localStorage.getItem(VERSION_KEY);
3316
+ // if (savedVersion === APP_VERSION) return;
3317
+ // this.clearWebStores();
3318
+ // localStorage.setItem(VERSION_KEY, APP_VERSION);
3319
+ // sessionStorage.setItem(VERSION_KEY, APP_VERSION);
3320
+ // }
3321
+ clearWebStores() {
3322
+ try {
3323
+ localStorage.clear();
3324
+ }
3325
+ catch { }
3326
+ try {
3327
+ sessionStorage.clear();
3328
+ }
3329
+ catch { }
3330
+ try {
3331
+ if (typeof document !== 'undefined' && document.cookie) {
3332
+ document.cookie.split(';').forEach((c) => {
3333
+ const eqPos = c.indexOf('=');
3334
+ const name = eqPos > -1 ? c.substring(0, eqPos).trim() : c.trim();
3335
+ if (name) {
3336
+ document.cookie = `${name}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`;
3337
+ }
3338
+ });
3339
+ }
3340
+ }
3341
+ catch { }
3342
+ }
3343
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AppVersionResetService, deps: [{ token: i1.Platform }], target: i0.ɵɵFactoryTarget.Injectable });
3344
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AppVersionResetService, providedIn: 'root' });
3345
+ }
3346
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: AppVersionResetService, decorators: [{
3347
+ type: Injectable,
3348
+ args: [{
3349
+ providedIn: 'root'
3350
+ }]
3351
+ }], ctorParameters: () => [{ type: i1.Platform }] });
3352
+
3353
+ class PouchdbService {
3354
+ db = new PouchDB("");
3355
+ async uploadAndStoreZip(zipFile, couchDbURl) {
3356
+ const zip = await JSZip.loadAsync(zipFile);
3357
+ const fileName = zipFile?.name?.replace('.zip', '');
3358
+ const envFilePath = `${fileName}/environments/environment.json`;
3359
+ const envFile = zip.file(envFilePath);
3360
+ if (envFile && !couchDbURl) {
3361
+ const envFileContent = await envFile.async('string');
3362
+ try {
3363
+ const jsonData = JSON.parse(envFileContent);
3364
+ if (jsonData?.environment?.couchdbUrl) {
3365
+ this.db = new PouchDB(jsonData.environment.couchdbUrl);
3366
+ }
3367
+ }
3368
+ catch (e) {
3369
+ console.error('Invalid JSON in environment.json:', e);
3370
+ }
3371
+ }
3372
+ else {
3373
+ this.db = new PouchDB(couchDbURl);
3374
+ }
3375
+ // Proceed to upload all files
3376
+ const savePromises = [];
3377
+ zip.forEach((relativePath, file) => {
3378
+ if (!file.dir) {
3379
+ savePromises.push(file.async('base64').then((content) => {
3380
+ const docId = relativePath.toString();
3381
+ console.log('docId: ', docId);
3382
+ return this.db.put({
3383
+ _id: docId,
3384
+ data: content,
3385
+ type: 'file',
3386
+ contentType: this.getMimeType(file.name)
3387
+ }).catch((err) => {
3388
+ if (err.status === 409) {
3389
+ return this.db.get(docId).then((existing) => {
3390
+ return this.db.put({
3391
+ ...existing,
3392
+ data: content,
3393
+ contentType: this.getMimeType(file.name)
3394
+ });
3395
+ });
3396
+ }
3397
+ throw err;
3398
+ });
3399
+ }));
3400
+ }
3401
+ });
3402
+ await Promise.all(savePromises);
3403
+ }
3404
+ async getFile(path, remoteDB) {
3405
+ try {
3406
+ if (remoteDB) {
3407
+ this.db = new PouchDB(remoteDB);
3408
+ }
3409
+ const doc = await this.db.get(path);
3410
+ return this.decodeBlob(doc);
3411
+ }
3412
+ catch (err) {
3413
+ if (err.status === 404 && remoteDB) {
3414
+ try {
3415
+ const remoteDoc = await this.db.get(path);
3416
+ return this.decodeBlob(remoteDoc);
3417
+ }
3418
+ catch (remoteErr) {
3419
+ throw remoteErr;
3420
+ }
3421
+ }
3422
+ else {
3423
+ throw err;
3424
+ }
3425
+ }
3426
+ }
3427
+ decodeBlob(doc) {
3428
+ const byteCharacters = atob(doc.data);
3429
+ const byteNumbers = new Array(byteCharacters.length).fill(0).map((_, i) => byteCharacters.charCodeAt(i));
3430
+ const byteArray = new Uint8Array(byteNumbers);
3431
+ return new Blob([byteArray], { type: doc.contentType });
3432
+ }
3433
+ async getTextFile(path, remotedbUrl) {
3434
+ const blob = await this.getFile(path, remotedbUrl);
3435
+ if (blob?.type && blob?.type === 'application/x-x509-ca-cert') {
3436
+ const base64Der = await this.blobToBase64(blob);
3437
+ return base64Der;
3438
+ }
3439
+ if (blob?.type && blob?.type.startsWith('image/')) {
3440
+ return URL.createObjectURL(blob);
3441
+ }
3442
+ else if (blob?.type && blob?.type === 'application/json') {
3443
+ const text = await blob.text();
3444
+ return JSON.parse(text);
3445
+ }
3446
+ else {
3447
+ return await blob.text();
3448
+ }
3449
+ }
3450
+ blobToBase64(blob) {
3451
+ return new Promise((resolve, reject) => {
3452
+ const reader = new FileReader();
3453
+ reader.onloadend = () => {
3454
+ const base64 = reader.result.split(',')[1];
3455
+ resolve(base64);
3456
+ };
3457
+ reader.onerror = reject;
3458
+ reader.readAsDataURL(blob);
3459
+ });
3460
+ }
3461
+ getMimeType(fileName) {
3462
+ const extension = fileName.split('.').pop()?.toLowerCase();
3463
+ const mimeMap = {
3464
+ 'json': 'application/json',
3465
+ 'css': 'text/css',
3466
+ 'scss': 'text/x-scss',
3467
+ 'jpg': 'image/jpeg',
3468
+ 'jpeg': 'image/jpeg',
3469
+ 'png': 'image/png',
3470
+ 'ico': 'image/x-icon',
3471
+ 'svg': 'image/svg+xml',
3472
+ 'html': 'text/html',
3473
+ 'js': 'application/javascript',
3474
+ 'ts': 'application/typescript',
3475
+ 'txt': 'text/plain',
3476
+ 'der': 'application/x-x509-ca-cert'
3477
+ };
3478
+ return mimeMap[extension || ''] || 'application/octet-stream';
3479
+ }
3480
+ async getAllDatabasesWithContent(couchdbBaseUrl) {
3481
+ const connStr = couchdbBaseUrl;
3482
+ const urlObj = new URL(connStr);
3483
+ const credentials = `${urlObj.username}:${urlObj.password}`;
3484
+ const originalPortMatch = connStr.match(/:(\d+)(?=\/|$)/);
3485
+ const port = originalPortMatch ? originalPortMatch[1] : "";
3486
+ const baseUrl = `${urlObj.protocol}//${urlObj.hostname}${port ? `:${port}` : ""}`;
3487
+ const authHeader = {
3488
+ 'Authorization': 'Basic ' + btoa(`${credentials}`)
3489
+ };
3490
+ const response = await fetch(`${baseUrl}/_all_dbs`, {
3491
+ headers: authHeader
3492
+ });
3493
+ if (!response.ok) {
3494
+ throw new Error(`Error fetching databases: ${response.statusText}`);
3495
+ }
3496
+ const dbNames = await response.json();
3497
+ const results = [];
3498
+ for (const dbName of dbNames) {
3499
+ try {
3500
+ const docsResponse = await fetch(`${baseUrl}/${dbName}/_all_docs?limit=1`, {
3501
+ headers: authHeader
3502
+ });
3503
+ if (!docsResponse.ok) {
3504
+ results.push({ databaseName: dbName, content: false });
3505
+ continue;
3506
+ }
3507
+ const docsData = await docsResponse.json();
3508
+ results.push({
3509
+ databaseName: dbName,
3510
+ content: docsData.total_rows > 0
3511
+ });
3512
+ }
3513
+ catch (err) {
3514
+ console.log('err: ', err);
3515
+ results.push({ databaseName: dbName, content: false });
3516
+ }
3517
+ }
3518
+ return results;
3519
+ }
3520
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PouchdbService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
3521
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PouchdbService, providedIn: 'root' });
3522
+ }
3523
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PouchdbService, decorators: [{
3524
+ type: Injectable,
3525
+ args: [{
3526
+ providedIn: 'root'
3527
+ }]
3528
+ }] });
3529
+
3530
+ /*
3531
+ * Public API Surface of view-toolkit
3532
+ */
3533
+
3534
+ /**
3535
+ * Generated bundle index. Do not edit.
3536
+ */
3537
+
3538
+ export { AppVersionResetService, CardComponent, ConfigService, Couchdb, FormComponent, GridComponent, HeaderMenuComponent, LogsComponent, MobileKeycloakService, ModelComponent, NetworkLogService, NotificationService, PaginationComponent, PouchdbService, RequestService, SideMenuComponent, UtilityService, ViewToolkitModule };
3539
+ //# sourceMappingURL=yomotech-view-toolkit.mjs.map