sf-crud 12.3.3 → 13.0.1

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 (49) hide show
  1. package/fesm2022/sf-crud.mjs +3254 -0
  2. package/fesm2022/sf-crud.mjs.map +1 -0
  3. package/{sf-crud.d.ts → index.d.ts} +5 -5
  4. package/lib/components/control/control.component.d.ts +67 -67
  5. package/lib/components/file-upload/file-upload.component.d.ts +34 -34
  6. package/lib/components/form/form.component.d.ts +63 -63
  7. package/lib/components/registro/registro.component.d.ts +109 -109
  8. package/lib/components/step/step.component.d.ts +27 -27
  9. package/lib/components/tablero/tablero.component.d.ts +53 -52
  10. package/lib/directives/format-address.pipe.d.ts +7 -7
  11. package/lib/sf-crud.component.d.ts +8 -8
  12. package/lib/sf-crud.module.d.ts +94 -90
  13. package/lib/sf-crud.routing.module.d.ts +7 -7
  14. package/lib/sf-crud.service.d.ts +135 -135
  15. package/lib/shared/models/Conditions.model.d.ts +32 -32
  16. package/lib/shared/models/Empresa.model.d.ts +11 -11
  17. package/lib/shared/models/Reason.model.d.ts +5 -5
  18. package/lib/shared/models/crud-config.model.d.ts +109 -110
  19. package/lib/shared/models/shema.model.d.ts +37 -37
  20. package/lib/shared/services/general.service.d.ts +20 -20
  21. package/lib/shared/services/notification.service.d.ts +26 -27
  22. package/lib/shared/services/step.service.d.ts +27 -27
  23. package/package.json +20 -15
  24. package/public-api.d.ts +12 -12
  25. package/bundles/sf-crud.umd.js +0 -3795
  26. package/bundles/sf-crud.umd.js.map +0 -1
  27. package/esm2015/lib/components/control/control.component.js +0 -403
  28. package/esm2015/lib/components/file-upload/file-upload.component.js +0 -143
  29. package/esm2015/lib/components/form/form.component.js +0 -289
  30. package/esm2015/lib/components/registro/registro.component.js +0 -757
  31. package/esm2015/lib/components/step/step.component.js +0 -79
  32. package/esm2015/lib/components/tablero/tablero.component.js +0 -220
  33. package/esm2015/lib/directives/format-address.pipe.js +0 -22
  34. package/esm2015/lib/sf-crud.component.js +0 -26
  35. package/esm2015/lib/sf-crud.module.js +0 -359
  36. package/esm2015/lib/sf-crud.routing.module.js +0 -23
  37. package/esm2015/lib/sf-crud.service.js +0 -531
  38. package/esm2015/lib/shared/models/Conditions.model.js +0 -81
  39. package/esm2015/lib/shared/models/Empresa.model.js +0 -2
  40. package/esm2015/lib/shared/models/Reason.model.js +0 -7
  41. package/esm2015/lib/shared/models/crud-config.model.js +0 -76
  42. package/esm2015/lib/shared/models/shema.model.js +0 -11
  43. package/esm2015/lib/shared/services/general.service.js +0 -74
  44. package/esm2015/lib/shared/services/notification.service.js +0 -83
  45. package/esm2015/lib/shared/services/step.service.js +0 -63
  46. package/esm2015/public-api.js +0 -16
  47. package/esm2015/sf-crud.js +0 -5
  48. package/fesm2015/sf-crud.js +0 -3143
  49. package/fesm2015/sf-crud.js.map +0 -1
@@ -0,0 +1,3254 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, HostBinding, Output, Input, Component, ViewChild, Pipe, ViewChildren, ChangeDetectionStrategy, NgModule } from '@angular/core';
3
+ import * as _ from 'lodash';
4
+ import * as jsonpath from 'jsonpath';
5
+ import * as i1 from '@angular/common/http';
6
+ import { HttpClientModule } from '@angular/common/http';
7
+ import * as i2 from '@angular/router';
8
+ import { RouterModule } from '@angular/router';
9
+ import { BehaviorSubject, Subject } from 'rxjs';
10
+ import moment from 'moment';
11
+ import * as i1$1 from 'primeng/api';
12
+ import { MessageService } from 'primeng/api';
13
+ import * as i8 from 'primeng/button';
14
+ import { ButtonModule } from 'primeng/button';
15
+ import * as i7 from 'primeng/card';
16
+ import { CardModule } from 'primeng/card';
17
+ import * as i8$1 from '@angular/common';
18
+ import * as i9 from 'primeng/iconfield';
19
+ import { IconFieldModule } from 'primeng/iconfield';
20
+ import * as i10 from 'primeng/inputicon';
21
+ import { InputIconModule } from 'primeng/inputicon';
22
+ import * as i11 from 'primeng/inputtext';
23
+ import { InputTextModule } from 'primeng/inputtext';
24
+ import * as i12 from 'primeng/ripple';
25
+ import { RippleModule } from 'primeng/ripple';
26
+ import * as i13 from 'primeng/splitbutton';
27
+ import { SplitButtonModule } from 'primeng/splitbutton';
28
+ import * as i14 from 'primeng/table';
29
+ import { TableModule } from 'primeng/table';
30
+ import * as i15 from 'primeng/toolbar';
31
+ import { ToolbarModule } from 'primeng/toolbar';
32
+ import Swal from 'sweetalert2';
33
+ import * as i6$1 from 'sf-pdfsign';
34
+ import { SfPdfsignModule } from 'sf-pdfsign';
35
+ import * as i7$2 from 'sf-simulador';
36
+ import { SfSimuladorModule } from 'sf-simulador';
37
+ import * as i10$2 from 'primeng/dialog';
38
+ import { DialogModule } from 'primeng/dialog';
39
+ import * as i12$1 from 'primeng/toast';
40
+ import { ToastModule } from 'primeng/toast';
41
+ import * as i5 from 'primeng/steps';
42
+ import { StepsModule } from 'primeng/steps';
43
+ import * as i15$1 from 'primeng/tooltip';
44
+ import { Tooltip, TooltipModule } from 'primeng/tooltip';
45
+ import * as i3 from '@angular/platform-browser';
46
+ import * as i5$1 from 'sf-ado';
47
+ import { SfAdoModule } from 'sf-ado';
48
+ import * as i4 from 'primeng/autocomplete';
49
+ import { AutoCompleteModule } from 'primeng/autocomplete';
50
+ import * as i6 from 'primeng/datepicker';
51
+ import { DatePickerModule } from 'primeng/datepicker';
52
+ import * as i7$1 from '@angular/forms';
53
+ import { FormsModule } from '@angular/forms';
54
+ import * as i9$1 from 'primeng/inputmask';
55
+ import { InputMaskModule } from 'primeng/inputmask';
56
+ import * as i10$1 from 'primeng/inputnumber';
57
+ import { InputNumberModule } from 'primeng/inputnumber';
58
+ import * as i11$1 from 'primeng/inputswitch';
59
+ import { InputSwitchModule } from 'primeng/inputswitch';
60
+ import * as i13$1 from 'primeng/multiselect';
61
+ import { MultiSelectModule } from 'primeng/multiselect';
62
+ import * as i14$1 from 'primeng/select';
63
+ import { SelectModule } from 'primeng/select';
64
+ import { AccordionModule } from 'primeng/accordion';
65
+ import { AvatarGroupModule } from 'primeng/avatargroup';
66
+ import { AvatarModule } from 'primeng/avatar';
67
+ import { BadgeModule } from 'primeng/badge';
68
+ import { BlockUIModule } from 'primeng/blockui';
69
+ import { BreadcrumbModule } from 'primeng/breadcrumb';
70
+ import { CalendarModule } from 'primeng/calendar';
71
+ import { CarouselModule } from 'primeng/carousel';
72
+ import { CascadeSelectModule } from 'primeng/cascadeselect';
73
+ import { CheckboxModule } from 'primeng/checkbox';
74
+ import { ChipModule } from 'primeng/chip';
75
+ import { ColorPickerModule } from 'primeng/colorpicker';
76
+ import { ConfirmDialogModule } from 'primeng/confirmdialog';
77
+ import { ConfirmPopupModule } from 'primeng/confirmpopup';
78
+ import { ContextMenuModule } from 'primeng/contextmenu';
79
+ import { DividerModule } from 'primeng/divider';
80
+ import { DropdownModule } from 'primeng/dropdown';
81
+ import { FieldsetModule } from 'primeng/fieldset';
82
+ import { FileUploadModule } from 'primeng/fileupload';
83
+ import { GalleriaModule } from 'primeng/galleria';
84
+ import { InplaceModule } from 'primeng/inplace';
85
+ import { TextareaModule } from 'primeng/textarea';
86
+ import { KnobModule } from 'primeng/knob';
87
+ import { ListboxModule } from 'primeng/listbox';
88
+ import { MegaMenuModule } from 'primeng/megamenu';
89
+ import { MenubarModule } from 'primeng/menubar';
90
+ import { MenuModule } from 'primeng/menu';
91
+ import { MessageModule } from 'primeng/message';
92
+ import { OrganizationChartModule } from 'primeng/organizationchart';
93
+ import { OverlayPanelModule } from 'primeng/overlaypanel';
94
+ import { PanelMenuModule } from 'primeng/panelmenu';
95
+ import { PanelModule } from 'primeng/panel';
96
+ import { PasswordModule } from 'primeng/password';
97
+ import { ProgressBarModule } from 'primeng/progressbar';
98
+ import { RadioButtonModule } from 'primeng/radiobutton';
99
+ import { RatingModule } from 'primeng/rating';
100
+ import { ScrollPanelModule } from 'primeng/scrollpanel';
101
+ import { ScrollTopModule } from 'primeng/scrolltop';
102
+ import { SelectButtonModule } from 'primeng/selectbutton';
103
+ import { SidebarModule } from 'primeng/sidebar';
104
+ import { SkeletonModule } from 'primeng/skeleton';
105
+ import { SliderModule } from 'primeng/slider';
106
+ import { SplitterModule } from 'primeng/splitter';
107
+ import { TabMenuModule } from 'primeng/tabmenu';
108
+ import { TabViewModule } from 'primeng/tabview';
109
+ import { TagModule } from 'primeng/tag';
110
+ import { TerminalModule } from 'primeng/terminal';
111
+ import { TieredMenuModule } from 'primeng/tieredmenu';
112
+ import { TimelineModule } from 'primeng/timeline';
113
+ import { ToggleButtonModule } from 'primeng/togglebutton';
114
+ import { TreeModule } from 'primeng/tree';
115
+ import { InputGroupModule } from 'primeng/inputgroup';
116
+ import { InputGroupAddonModule } from 'primeng/inputgroupaddon';
117
+
118
+ class CrudConfig {
119
+ idEntidad = '';
120
+ uiEsquemas = [];
121
+ esquemas = [];
122
+ registros = [];
123
+ tablero;
124
+ }
125
+ class ConfigTablero {
126
+ columns = [];
127
+ endpoint = '';
128
+ method = '';
129
+ server = '';
130
+ filters = [];
131
+ keys = [];
132
+ }
133
+ class ConfigRegistro {
134
+ operations = [];
135
+ btnBack = '';
136
+ label;
137
+ canBack = false;
138
+ constructionId;
139
+ keys;
140
+ conditions = [];
141
+ }
142
+ class Operation {
143
+ type;
144
+ server;
145
+ endpoint;
146
+ method = '';
147
+ validations;
148
+ url;
149
+ changeTrx = [];
150
+ errorChecking;
151
+ answerChecking;
152
+ keysEsquema;
153
+ keys;
154
+ }
155
+ class ConstructionId {
156
+ indexStep;
157
+ path;
158
+ keys;
159
+ }
160
+ class Validations {
161
+ type = '';
162
+ required = [];
163
+ equals = [];
164
+ different = [];
165
+ server = '';
166
+ endpoint = '';
167
+ operations;
168
+ }
169
+ class ValidationRequired {
170
+ field;
171
+ message;
172
+ conditions;
173
+ }
174
+ class ValidationEqual extends ValidationRequired {
175
+ value;
176
+ constructor(value) {
177
+ super();
178
+ this.value = value;
179
+ }
180
+ }
181
+ class ValidationDifferent extends ValidationRequired {
182
+ value;
183
+ constructor(value) {
184
+ super();
185
+ this.value = value;
186
+ }
187
+ }
188
+ class RequestChecking {
189
+ dynamics;
190
+ statics;
191
+ useSwal;
192
+ redirect;
193
+ cancelRedirect;
194
+ allowContinue;
195
+ parse;
196
+ constructor(dynamics, statics, useSwal, redirect, cancelRedirect, allowContinue, parse) {
197
+ this.dynamics = dynamics;
198
+ this.statics = statics;
199
+ this.useSwal = useSwal;
200
+ this.redirect = redirect;
201
+ this.cancelRedirect = cancelRedirect;
202
+ this.allowContinue = allowContinue;
203
+ this.parse = parse;
204
+ }
205
+ }
206
+ class Key {
207
+ key;
208
+ scope;
209
+ indexAnswer;
210
+ indexData;
211
+ indexId;
212
+ data;
213
+ overrideControl;
214
+ }
215
+ class OverrideConfig {
216
+ property;
217
+ value;
218
+ elseValue;
219
+ conditions;
220
+ newPropertyValue;
221
+ elseNewPropertyValue;
222
+ }
223
+ class keyEsquema {
224
+ key;
225
+ scope;
226
+ indexData;
227
+ indexId;
228
+ isArray;
229
+ indexKey;
230
+ canBeValueUndefined;
231
+ }
232
+
233
+ class GeneralService {
234
+ http;
235
+ generales = '';
236
+ jsonConfig;
237
+ _idKatios;
238
+ constructor(http) {
239
+ this.http = http;
240
+ }
241
+ set environment(val) {
242
+ this.jsonConfig = val;
243
+ this.generales = this.jsonConfig?.ServidorGenerales;
244
+ }
245
+ get environment() {
246
+ if (!this.jsonConfig)
247
+ this.environment = JSON.parse(sessionStorage.getItem('ConfigJSON') || '{}');
248
+ return this.jsonConfig;
249
+ }
250
+ get idKatios() {
251
+ return this._idKatios;
252
+ }
253
+ set idKatios(value) {
254
+ this._idKatios = value;
255
+ }
256
+ async getCrudByEntidad(idKatios, idEntidad) {
257
+ return this.http.get(`${this.generales}crud/forms/${idKatios}/${idEntidad}`).toPromise();
258
+ }
259
+ async getFiles(urls, names) {
260
+ return Promise.all(urls.map(async (url, i) => {
261
+ const response = await this.http.get(url, { responseType: 'blob' }).toPromise();
262
+ const arrayBuffer = await response.arrayBuffer();
263
+ const tipo = names[i].includes(".pdf") ? 'application/pdf' : "image/" + this.getExt(names[i]);
264
+ return new File([new Uint8Array(arrayBuffer)], names[i], { type: tipo });
265
+ }));
266
+ }
267
+ getExt(name) {
268
+ let ext = undefined;
269
+ let aux = name.split('.');
270
+ if (aux.length > 0)
271
+ ext = aux[aux.length - 1];
272
+ return ext;
273
+ }
274
+ async genericRequest(method, url, data) {
275
+ switch (method) {
276
+ case 'GET':
277
+ return this.http.get(url).toPromise();
278
+ case 'POST':
279
+ return this.http.post(url, data).toPromise();
280
+ case 'PUT':
281
+ return this.http.put(url, data).toPromise();
282
+ case 'DELETE':
283
+ return this.http.delete(url, data).toPromise();
284
+ default:
285
+ throw new Error("Invalid method");
286
+ }
287
+ }
288
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: GeneralService, deps: [{ token: i1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
289
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: GeneralService, providedIn: 'root' });
290
+ }
291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: GeneralService, decorators: [{
292
+ type: Injectable,
293
+ args: [{
294
+ providedIn: 'root'
295
+ }]
296
+ }], ctorParameters: () => [{ type: i1.HttpClient }] });
297
+
298
+ class Condition {
299
+ type;
300
+ attrs;
301
+ indexData;
302
+ constructor(type, attrs, indexData) {
303
+ this.type = type;
304
+ this.attrs = attrs;
305
+ this.indexData = indexData;
306
+ }
307
+ static instanceContidion(index, allConditions) {
308
+ let c;
309
+ switch (allConditions[index].type) {
310
+ case "different":
311
+ c = new ConditionDifferent(allConditions[index].attrs.field, allConditions[index].attrs.value, allConditions[index].attrs.grado || 2, allConditions[index].indexData);
312
+ break;
313
+ case "or":
314
+ const subconditions = allConditions[index].attrs.conditions.map(i => this.instanceContidion(i, allConditions));
315
+ c = new ConditionOr(subconditions, allConditions[index].indexData);
316
+ break;
317
+ case "and":
318
+ const subconditions2 = allConditions[index].attrs.conditions.map(i => this.instanceContidion(i, allConditions));
319
+ c = new ConditionAnd(subconditions2, allConditions[index].indexData);
320
+ break;
321
+ case "equal":
322
+ c = new ConditionEqual(allConditions[index].attrs.field, allConditions[index].attrs.value, allConditions[index].attrs.grado || 2, allConditions[index].indexData);
323
+ break;
324
+ }
325
+ return c;
326
+ }
327
+ }
328
+ class ConditionEqual extends Condition {
329
+ field;
330
+ value;
331
+ grado;
332
+ constructor(field, value, grado, indexData) {
333
+ super("equal", {}, indexData);
334
+ this.field = field;
335
+ this.value = value;
336
+ this.grado = grado;
337
+ }
338
+ isValid(data) {
339
+ let cumple = true;
340
+ const res = jsonpath.query(data, this.field);
341
+ if (res.length > 0 && this.grado == 2)
342
+ cumple = this.value == res[0];
343
+ else if (res.length > 0 && this.grado == 3)
344
+ cumple = this.value === res[0];
345
+ return cumple;
346
+ }
347
+ }
348
+ class ConditionDifferent extends Condition {
349
+ field;
350
+ value;
351
+ grado;
352
+ constructor(field, value, grado, indexData) {
353
+ super("different", {}, indexData);
354
+ this.field = field;
355
+ this.value = value;
356
+ this.grado = grado;
357
+ }
358
+ isValid(data) {
359
+ let cumple = true;
360
+ const res = jsonpath.query(data, this.field);
361
+ if (res.length > 0 && this.grado == 2)
362
+ cumple = this.value != res[0];
363
+ else if (res.length > 0 && this.grado == 3)
364
+ cumple = this.value !== res[0];
365
+ return cumple;
366
+ }
367
+ }
368
+ class ConditionOr extends Condition {
369
+ conditions;
370
+ constructor(conditions, indexData) {
371
+ super("or", {}, indexData);
372
+ this.conditions = conditions;
373
+ }
374
+ isValid(data) {
375
+ return this.conditions.some(c => c.isValid(data));
376
+ }
377
+ }
378
+ class ConditionAnd extends Condition {
379
+ conditions;
380
+ constructor(conditions, indexData) {
381
+ super("and", {}, indexData);
382
+ this.conditions = conditions;
383
+ }
384
+ isValid(data) {
385
+ return this.conditions.every(c => c.isValid(data));
386
+ }
387
+ }
388
+
389
+ class SfCrudService {
390
+ _esquemas = [];
391
+ _uiEsquemas = [];
392
+ _registros = [];
393
+ _answers = [];
394
+ _dataSet = [];
395
+ _ids = [];
396
+ __index = 0;
397
+ _idKatios;
398
+ _configEmpresa = undefined;
399
+ _trx = [];
400
+ jsonConfig;
401
+ _changeData = new BehaviorSubject(undefined);
402
+ __formLoading = new BehaviorSubject({ inProgress: false, target: undefined });
403
+ _dataExt;
404
+ _tfmUser;
405
+ _crudLoaded = new BehaviorSubject(false);
406
+ _mascaras = [];
407
+ get user() {
408
+ if (!this._tfmUser)
409
+ this._tfmUser = JSON.parse(localStorage.getItem("oSessionTFM"));
410
+ return this._tfmUser;
411
+ }
412
+ get currentOperation() {
413
+ return this.registros[this.index].operations.find(x => x.type.startsWith(this._trx[this.index]));
414
+ }
415
+ set environment(val) {
416
+ this.jsonConfig = val;
417
+ }
418
+ get environment() {
419
+ return this.jsonConfig;
420
+ }
421
+ get onCrudLoaded$() {
422
+ return this._crudLoaded.asObservable();
423
+ }
424
+ set crudLoaded(value) {
425
+ this._crudLoaded.next(value);
426
+ }
427
+ get dataExt() {
428
+ return this._dataExt;
429
+ }
430
+ set dataExt(val) {
431
+ this._dataExt = val;
432
+ }
433
+ get index() {
434
+ return this.__index;
435
+ }
436
+ set index(value) {
437
+ this.__index = value;
438
+ }
439
+ get idKatios() {
440
+ return this._idKatios;
441
+ }
442
+ set idKatios(value) {
443
+ this._idKatios = value?.trim()?.toUpperCase();
444
+ }
445
+ get configEmpresa() {
446
+ return this._configEmpresa;
447
+ }
448
+ set configEmpresa(value) {
449
+ this._configEmpresa = value;
450
+ }
451
+ get mascaras() {
452
+ return this._mascaras;
453
+ }
454
+ set mascaras(mascaras) {
455
+ this._mascaras = mascaras;
456
+ }
457
+ getURL(operation, index = undefined, id = undefined) {
458
+ let url = operation.url || `${this.jsonConfig[operation.server]}${operation.endpoint}`;
459
+ url = url.replace('@idKatios', this.idKatios);
460
+ if (id)
461
+ url = url.replace('@id', id);
462
+ url = this.applyStringKeys(url, index);
463
+ return url;
464
+ }
465
+ getRegistro(index) {
466
+ return this._registros[index];
467
+ }
468
+ getId(index) {
469
+ return this._ids.length == 1 ? this._ids[0] : this._ids[index];
470
+ }
471
+ get dataset() {
472
+ return this._dataSet;
473
+ }
474
+ getData(index) {
475
+ return this._dataSet.length == 1 ? this._dataSet[0] : this._dataSet[index];
476
+ }
477
+ getTrx(index) {
478
+ return this._trx[index];
479
+ }
480
+ get totalData() {
481
+ return this._dataSet.length;
482
+ }
483
+ get totalRegistros() {
484
+ return this._registros.length;
485
+ }
486
+ get uiEsquemas() {
487
+ return this._uiEsquemas;
488
+ }
489
+ getEsquema(index) {
490
+ return this._esquemas.length == 1 ? this._esquemas[0] : this._esquemas[index];
491
+ }
492
+ reset() {
493
+ this._ids = [];
494
+ this._dataSet = [];
495
+ }
496
+ getURLRedirect(initialURL) {
497
+ let finalUrl = this.applyStringKeys(initialURL, undefined);
498
+ finalUrl = finalUrl.replace("@URLBASE", window.location.href.split('?')[0]);
499
+ return finalUrl;
500
+ }
501
+ getUIEsquema(index) {
502
+ return this._uiEsquemas[index];
503
+ }
504
+ /**
505
+ * using data, apply each keyEsquema over each dataset indicated on indexData of each key
506
+ * @param data
507
+ * @param content
508
+ * @returns
509
+ */
510
+ applyObjectKeys(data, keysEsquema, registro) {
511
+ for (let i = 0; i < keysEsquema.length; i++) {
512
+ const opt = keysEsquema[i];
513
+ let value = undefined;
514
+ if (opt.indexKey) {
515
+ let keyFound = (registro.keys ?? [undefined])[opt.indexKey];
516
+ this.applyKey(keyFound, registro, data);
517
+ }
518
+ else if (opt.indexData !== undefined) {
519
+ if (opt.isArray) {
520
+ value = jsonpath.query(data, opt.scope);
521
+ }
522
+ else {
523
+ value = jsonpath.query(data, opt.scope)[0];
524
+ }
525
+ }
526
+ if (opt.key == "$")
527
+ Object.assign(this._dataSet[opt.indexData], value);
528
+ else if (opt.key && ((value !== undefined && value !== null) || (opt.canBeValueUndefined === undefined || opt.canBeValueUndefined === true)))
529
+ jsonpath.value(this._dataSet[opt.indexData], opt.key, value);
530
+ }
531
+ return data;
532
+ }
533
+ applyKey(key, registro, data) {
534
+ if (key?.overrideControl) {
535
+ let newVal = undefined;
536
+ let esquemaToSet = this.getControl(key.scope, this.esquemas[key.indexData ?? this.index]);
537
+ if (!esquemaToSet) {
538
+ console.error({ message: "la key esta mal configurada", data: key });
539
+ return;
540
+ }
541
+ let completed = this.isConditionsCompleted(key.overrideControl.conditions ?? [], registro.conditions || [], data);
542
+ if (key.overrideControl?.property)
543
+ jsonpath.value(esquemaToSet, key.overrideControl.property, completed ? key.overrideControl.value : key.overrideControl.elseValue);
544
+ if (completed && key.overrideControl.newPropertyValue !== undefined) {
545
+ if (key.overrideControl.newPropertyValue == 'RESETOBJECT')
546
+ newVal = this.createObject(esquemaToSet, this.currentOperation);
547
+ else
548
+ newVal = key.overrideControl.newPropertyValue;
549
+ }
550
+ else if (!completed && key.overrideControl.elseNewPropertyValue !== undefined) {
551
+ if (key.overrideControl.elseNewPropertyValue == 'RESETOBJECT')
552
+ newVal = this.createObject(esquemaToSet, this.currentOperation);
553
+ else
554
+ newVal = key.overrideControl.elseNewPropertyValue;
555
+ }
556
+ if (newVal !== undefined)
557
+ jsonpath.value(this._dataSet[key.indexData ?? this.index], key.scope.replaceAll('..properties', ''), newVal);
558
+ }
559
+ }
560
+ /**
561
+ * Validate conditions on datas
562
+ * @param conditions
563
+ * @param index
564
+ */
565
+ isConditionsCompleted(iConditions, conditions, data) {
566
+ let cumple = true;
567
+ iConditions.forEach(iCond => {
568
+ const c = Condition.instanceContidion(iCond, conditions);
569
+ let dataToEvaluate = c.indexData !== undefined ? this._dataSet[c.indexData] : data;
570
+ if (!c.isValid(dataToEvaluate))
571
+ cumple = false;
572
+ });
573
+ return cumple;
574
+ }
575
+ /**
576
+ * Apply each key from register over string content
577
+ * @param indexRegistro
578
+ * @param content
579
+ * @returns
580
+ */
581
+ applyStringKeys(content, index = undefined) {
582
+ let indexRegistro = index || this.__index;
583
+ this._registros[indexRegistro].keys?.forEach((opt) => {
584
+ let value;
585
+ if (opt.indexId !== undefined && opt.indexId < this._ids.length)
586
+ value = this._ids[opt.indexId];
587
+ else if (opt.indexAnswer !== undefined && opt.indexAnswer < this._answers.length)
588
+ value = jsonpath.query(this._answers[opt.indexAnswer], opt.scope)[0];
589
+ else if (opt.indexData !== undefined)
590
+ value = jsonpath.query(this._dataSet[opt.indexData], opt.scope)[0];
591
+ if (value === null)
592
+ value = '';
593
+ content = content.replace(opt.key, value);
594
+ });
595
+ return content;
596
+ }
597
+ validateDataLocal(operation, data, conditions) {
598
+ const err = [];
599
+ //Solo si se cumple la condicion, se valida
600
+ operation.validations?.required?.forEach(x => {
601
+ const cumpleCond = x.conditions ? this.isConditionsCompleted(x.conditions, conditions, data) : true;
602
+ if (cumpleCond && (!jsonpath.query(data, x.field)[0] ||
603
+ (Array.isArray(jsonpath.query(data, x.field)[0]) && jsonpath.query(data, x.field)[0].length == 0)))
604
+ err.push(x.message);
605
+ });
606
+ operation.validations?.different?.forEach(x => {
607
+ const cumpleCond = x.conditions ? this.isConditionsCompleted(x.conditions, conditions, data) : true;
608
+ if (cumpleCond && jsonpath.query(data, x.field)[0] === x.value)
609
+ err.push(x.message);
610
+ });
611
+ operation.validations?.equals?.forEach(x => {
612
+ const cumpleCond = x.conditions ? this.isConditionsCompleted(x.conditions, conditions, data) : true;
613
+ if (cumpleCond && jsonpath.query(data, x.field)[0] != x.value)
614
+ err.push(x.message);
615
+ });
616
+ operation.validations?.operations?.forEach((op) => {
617
+ switch (op.action) {
618
+ case 'sumArray':
619
+ const var1 = jsonpath.query(data, op.scope[0]).reduce((acc, cur) => acc += cur[op.key], 0);
620
+ const var2 = jsonpath.query(data, op.scope[1]).reduce((acc, cur) => acc += cur[op.key], 0);
621
+ if (var1 != var2)
622
+ err.push(op.message);
623
+ break;
624
+ default:
625
+ break;
626
+ }
627
+ });
628
+ return err;
629
+ }
630
+ set esquemas(esquemas) {
631
+ this._esquemas = esquemas;
632
+ }
633
+ get esquemas() {
634
+ return this._esquemas;
635
+ }
636
+ set ids(ids) {
637
+ this._ids = ids;
638
+ }
639
+ set uiEsquemas(uiEsquemas) {
640
+ this._uiEsquemas = uiEsquemas;
641
+ }
642
+ get registros() {
643
+ return this._registros;
644
+ }
645
+ set registros(registros) {
646
+ this._registros = registros;
647
+ }
648
+ setDataSet(data, index = undefined) {
649
+ index = index ? index : this.__index;
650
+ if (index >= this.totalData) {
651
+ this._dataSet.push(data);
652
+ }
653
+ }
654
+ setTrx(trx, index) {
655
+ if (Array.isArray(trx))
656
+ this._trx = trx;
657
+ else if (index >= this._trx.length)
658
+ this._trx.push(trx);
659
+ else
660
+ this._trx[index] = trx;
661
+ }
662
+ setAnswers(answer, index) {
663
+ if (Array.isArray(answer))
664
+ this._answers = answer;
665
+ else {
666
+ if (index >= this._answers.length)
667
+ this._answers.push(answer);
668
+ else
669
+ this._answers[index] = answer;
670
+ }
671
+ }
672
+ getControl(scope, esquema) {
673
+ return jsonpath.query(esquema, scope)[0];
674
+ }
675
+ getValue(scope, data) {
676
+ return jsonpath.query(data, scope.replaceAll('.properties', ''))[0];
677
+ }
678
+ createObject(esquema, operation) {
679
+ const object = {};
680
+ switch (esquema.type) {
681
+ case 'numeric':
682
+ case 'string':
683
+ case 'date':
684
+ if (esquema.default && operation) {
685
+ return this.setDefaultValue(esquema.default, operation);
686
+ }
687
+ else
688
+ return esquema.default ?? null;
689
+ case 'boolean':
690
+ return esquema?.default || false;
691
+ case 'array':
692
+ return [];
693
+ case 'file':
694
+ return null;
695
+ case 'object':
696
+ Object.getOwnPropertyNames(esquema?.properties).forEach(key => {
697
+ let aux = esquema?.properties[key];
698
+ if (aux)
699
+ object[key] = this.createObject(aux, operation);
700
+ });
701
+ return object;
702
+ default:
703
+ return null;
704
+ }
705
+ }
706
+ getValueKey(key) {
707
+ let data;
708
+ switch (key?.data || 'externa') {
709
+ case "user":
710
+ data = this.user;
711
+ break;
712
+ default:
713
+ data = this.dataExt;
714
+ break;
715
+ }
716
+ if (data && key) {
717
+ const aux = jsonpath.query(data, key.scope);
718
+ if (aux.length == 0)
719
+ return undefined;
720
+ if (aux.length == 1)
721
+ return aux[0];
722
+ else
723
+ return aux;
724
+ }
725
+ return undefined;
726
+ }
727
+ setDefaultValue(value, operation) {
728
+ let data = null;
729
+ if (value.key && operation.keys) {
730
+ data = this.getValueKey(operation.keys.find(k => k.key == value.key));
731
+ value = data;
732
+ }
733
+ switch (value) {
734
+ case '@uactivo':
735
+ data = `${this.user.UsuarioSistema.TDOC}-${this.user.UsuarioSistema.NDOC}`;
736
+ break;
737
+ case '@tdocactivo':
738
+ data = this.user.UsuarioSistema.TDOC;
739
+ break;
740
+ case '@ndocactivo':
741
+ data = this.user.UsuarioSistema.NDOC;
742
+ break;
743
+ case '@hoy':
744
+ data = new Date();
745
+ break;
746
+ default:
747
+ data = value;
748
+ break;
749
+ }
750
+ return data;
751
+ }
752
+ /**
753
+ * Validate if schema has pdfsign and it's signed, else return false
754
+ * @param index
755
+ * @returns
756
+ */
757
+ isSignedPDF(index) {
758
+ return this._dataSet[index].signed;
759
+ }
760
+ get changeData$() {
761
+ return this._changeData.asObservable();
762
+ }
763
+ set changeData(value) {
764
+ this._changeData.next(value);
765
+ }
766
+ get formLoading$() {
767
+ return this.__formLoading.asObservable();
768
+ }
769
+ set formLoading(value) {
770
+ this.__formLoading.next(value);
771
+ }
772
+ loadSession() {
773
+ const existSession = localStorage.getItem("esquemas") !== null;
774
+ if (existSession) {
775
+ this._esquemas = JSON.parse(localStorage.getItem("esquemas"));
776
+ this._uiEsquemas = JSON.parse(localStorage.getItem("uiEsquemas"));
777
+ this._registros = JSON.parse(localStorage.getItem("registros"));
778
+ this._dataSet = JSON.parse(localStorage.getItem("dataSet"));
779
+ this._answers = JSON.parse(localStorage.getItem("answers"));
780
+ this._trx = JSON.parse(localStorage.getItem("trx"));
781
+ this.__index = +localStorage.getItem("index");
782
+ localStorage.clear();
783
+ }
784
+ return existSession;
785
+ }
786
+ get reasons() {
787
+ const reasonsStorage = localStorage.getItem("reasons");
788
+ if (reasonsStorage)
789
+ return JSON.parse(reasonsStorage);
790
+ return [];
791
+ }
792
+ saveProgress(reasons) {
793
+ localStorage.setItem("reasons", JSON.stringify(reasons));
794
+ localStorage.setItem("esquemas", JSON.stringify(this._esquemas));
795
+ localStorage.setItem("trx", JSON.stringify(this._trx));
796
+ localStorage.setItem("uiEsquemas", JSON.stringify(this._uiEsquemas));
797
+ localStorage.setItem("registros", JSON.stringify(this._registros));
798
+ localStorage.setItem("dataSet", JSON.stringify(this._dataSet));
799
+ localStorage.setItem("answers", JSON.stringify(this._answers));
800
+ localStorage.setItem("index", this.__index.toString());
801
+ }
802
+ redirectToInicio() {
803
+ window.location.href = window.location.href.split('?')[0];
804
+ window.location.reload();
805
+ }
806
+ applyValuesOnEvent(event, esquema, key, data) {
807
+ if (key) {
808
+ if (esquema.properties[key][event]) {
809
+ esquema.properties[key][event].forEach((value) => {
810
+ this.setValueEvent(data, value, esquema);
811
+ });
812
+ }
813
+ }
814
+ else {
815
+ for (const key in esquema.properties) {
816
+ if (esquema.properties[key][event]) {
817
+ esquema.properties[key][event].forEach((value) => {
818
+ this.setValueEvent(data, value, esquema);
819
+ });
820
+ }
821
+ }
822
+ }
823
+ }
824
+ setValueEvent(data, params, esquema) {
825
+ let date = moment(new Date());
826
+ switch (params.op) {
827
+ case 'sum':
828
+ jsonpath.value(data, params.scope[1], jsonpath.query(data, params.scope[0]).reduce((acc, cur) => acc += params?.key ? cur[params.key] : cur, 0));
829
+ break;
830
+ case 'concat':
831
+ let array = [];
832
+ params?.key?.reduce((acc, cur) => {
833
+ array.push(jsonpath.query(data, cur)[0]);
834
+ }, []);
835
+ if (params?.separator)
836
+ jsonpath.value(data, params.scope[0], array.join(params?.separator || ' '));
837
+ break;
838
+ case 'enable':
839
+ jsonpath.value(esquema, params.scope[0], false);
840
+ break;
841
+ case 'disabled':
842
+ jsonpath.value(esquema, params.scope[0], true);
843
+ break;
844
+ case 'replace:endpoint':
845
+ jsonpath.value(esquema, params.scope[0], esquema.config.endpointtemp.replace(params.scope[1], jsonpath.query(data, `$..${params.key}`)));
846
+ break;
847
+ case 'setNull':
848
+ jsonpath.value(data, `$.${params.key}`, null);
849
+ break;
850
+ case 'datediff:years':
851
+ jsonpath.value(data, params.scope[0], date.diff(moment(jsonpath.query(data, params.scope[1])[0]), 'years'));
852
+ break;
853
+ case 'datediff:months':
854
+ jsonpath.value(data, params.scope[0], date.diff(moment(jsonpath.query(data, params.scope[1])[0]), 'months'));
855
+ break;
856
+ case 'datediff:weeks':
857
+ jsonpath.value(data, params.scope[0], date.diff(moment(jsonpath.query(data, params.scope[1])[0]), 'weeks'));
858
+ break;
859
+ case 'datediff:days':
860
+ jsonpath.value(data, params.scope[0], date.diff(moment(jsonpath.query(data, params.scope[1])[0]), 'days'));
861
+ break;
862
+ default:
863
+ break;
864
+ }
865
+ console.log('setValueEvent sale:');
866
+ console.log(data);
867
+ console.log(esquema);
868
+ console.log(params);
869
+ }
870
+ armarNuevaDireccion(tipo, dataDireccion, separador) {
871
+ let resultado;
872
+ if (tipo == "string") {
873
+ resultado = "";
874
+ this.mascaras.forEach(mascara => {
875
+ mascara.Campo.forEach((campo, i) => {
876
+ let valor = jsonpath.query(dataDireccion, `$.${campo.Id}`)[0];
877
+ if (valor && i - 1 >= 0 && mascara.Campo[i - 1].Tipo.toLocaleLowerCase() == "label") {
878
+ valor = mascara.Campo[i - 1].Valor + valor;
879
+ }
880
+ if (valor && !separador)
881
+ resultado += valor + " ";
882
+ else if (separador)
883
+ resultado += (valor ?? "") + separador;
884
+ });
885
+ });
886
+ }
887
+ else {
888
+ throw new Error("flujo sin realizar");
889
+ }
890
+ return resultado;
891
+ }
892
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
893
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudService, providedIn: 'root' });
894
+ }
895
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudService, decorators: [{
896
+ type: Injectable,
897
+ args: [{
898
+ providedIn: 'root'
899
+ }]
900
+ }] });
901
+ class ChangeData {
902
+ value;
903
+ scope;
904
+ index;
905
+ constructor(value, scope, index) {
906
+ this.value = value;
907
+ this.scope = scope;
908
+ this.index = index;
909
+ }
910
+ }
911
+
912
+ class StepService {
913
+ _requestApproval = new Subject();
914
+ _desiredIndex;
915
+ _customChildrenEvents = new Subject();
916
+ _currentPosition = new BehaviorSubject(0);
917
+ _requestApproved = new BehaviorSubject(true);
918
+ get currentIndex() {
919
+ return this._currentPosition.getValue();
920
+ }
921
+ set currentIndex(value) {
922
+ this._currentPosition.next(value);
923
+ }
924
+ get currentIndex$() {
925
+ return this._currentPosition.asObservable();
926
+ }
927
+ /*
928
+ Envia una peticion para que se envie el formulario
929
+ */
930
+ set requestApproval(newPos) {
931
+ this._desiredIndex = newPos;
932
+ this._requestApproval.next({ current: this.currentIndex, desired: newPos });
933
+ }
934
+ get requestApproval$() {
935
+ return this._requestApproval.asObservable();
936
+ }
937
+ get requestApproved$() {
938
+ return this._requestApproved.asObservable();
939
+ }
940
+ /**
941
+ * Useful to deny or approve request made by requestAprroval
942
+ */
943
+ set requestApproved(approved) {
944
+ if (approved && this._desiredIndex !== undefined)
945
+ this._currentPosition.next(this._desiredIndex);
946
+ this._requestApproved.next(approved);
947
+ }
948
+ set desiredIndex(index) {
949
+ this._desiredIndex = index;
950
+ }
951
+ addCustomChildrenEvent(name, data) {
952
+ this._customChildrenEvents.next({ name, data });
953
+ }
954
+ reset() {
955
+ //this._requestApproval = new BehaviorSubject({current:0, desired: undefined});
956
+ //this._customChildrenEvents = new BehaviorSubject(undefined);
957
+ }
958
+ get customChildrenEvents$() {
959
+ return this._customChildrenEvents.asObservable();
960
+ }
961
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: StepService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
962
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: StepService, providedIn: 'root' });
963
+ }
964
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: StepService, decorators: [{
965
+ type: Injectable,
966
+ args: [{
967
+ providedIn: 'root'
968
+ }]
969
+ }] });
970
+
971
+ class TableroComponent {
972
+ generalService;
973
+ router;
974
+ sfCrudService;
975
+ stepService;
976
+ opciones = [];
977
+ idEntidad = '';
978
+ idKatios = '';
979
+ environment; // Hacer opcional el environment
980
+ user;
981
+ dataExt;
982
+ onSelectAction = new EventEmitter();
983
+ color2;
984
+ colorButtons;
985
+ items = [];
986
+ crudConfig = new CrudConfig();
987
+ data = [];
988
+ initialData = [];
989
+ btn = { create: undefined, read: undefined, update: undefined, delete: undefined };
990
+ itemSelected;
991
+ loading;
992
+ constructor(generalService, router, sfCrudService, stepService) {
993
+ this.generalService = generalService;
994
+ this.router = router;
995
+ this.sfCrudService = sfCrudService;
996
+ this.stepService = stepService;
997
+ this.loading = { inProgress: false, target: undefined };
998
+ }
999
+ ngOnInit() {
1000
+ if (!this.environment) {
1001
+ this.environment = JSON.parse(sessionStorage.getItem('ConfigJSON') || '{}');
1002
+ }
1003
+ this.generalService.environment = this.environment;
1004
+ this.loadConfigCrud();
1005
+ }
1006
+ loadConfigCrud() {
1007
+ this.loading.inProgress = true;
1008
+ this.sfCrudService.formLoading = this.loading;
1009
+ this.generalService.getCrudByEntidad(this.idKatios, this.idEntidad)
1010
+ .then((res) => {
1011
+ if (res) {
1012
+ this.crudConfig = res;
1013
+ this.getInfoTablero();
1014
+ }
1015
+ })
1016
+ .catch(err => {
1017
+ console.error(err);
1018
+ this.loading.inProgress = false;
1019
+ this.sfCrudService.formLoading = this.loading;
1020
+ });
1021
+ }
1022
+ customizeCompany(uiEsquemas) {
1023
+ this.sfCrudService.configEmpresa = uiEsquemas.find(ui => ui.general)?.general;
1024
+ if (this.sfCrudService.configEmpresa) {
1025
+ if (this.sfCrudService.configEmpresa.colors?.secondary)
1026
+ this.color2 = this.sfCrudService.configEmpresa.colors.secondary;
1027
+ if (this.sfCrudService.configEmpresa.colors?.button)
1028
+ this.colorButtons = this.sfCrudService.configEmpresa.colors.secondary;
1029
+ }
1030
+ if (!this.color2)
1031
+ this.color2 = this.colorButtons = "blue";
1032
+ }
1033
+ // submit(index: number) {
1034
+ // let registro = this.sfCrudService.getRegistro(index)
1035
+ // let operation = registro.operations.find(op => op.type.startsWith(this.sfCrudService.getTrx(0)))!
1036
+ // console.log(operation)
1037
+ // let url = this.sfCrudService.getURL(operation, index)
1038
+ // return this.generalService.genericRequest(operation.method, url, this.sfCrudService.getData(index))
1039
+ // .then((res) => {
1040
+ // if (res === null) res = {}
1041
+ // res = this.sfCrudService.applyObjectKeys(res, operation.keysEsquema || [], registro)
1042
+ // console.log(res)
1043
+ // this.sfCrudService.setAnswers(res, 0)
1044
+ // if (operation.changeTrx) operation.changeTrx.forEach(x => this.sfCrudService.setTrx(x.trx, x.index))
1045
+ // // this.notificationService.generateMessage(this.notificationService.genDefaultMessage("success", undefined, "Información subida correctamente", operation.answerChecking), res, operation.answerChecking)
1046
+ // // return res;
1047
+ // })
1048
+ // .catch(err => {
1049
+ // // const operation = this.sfCrudService.getRegistro(this.indexCrud).operations.find(op => op.type.startsWith(this.sfCrudService.getTrx(index)))!
1050
+ // // this.notificationService.generateMessage(this.notificationService.genDefaultMessage("error", "Error no controlado", "Por favor comunicarse con el admin",operation.errorChecking), err.error, operation.errorChecking)
1051
+ // // throw new Error(err)
1052
+ // })
1053
+ // }
1054
+ getInfoTablero() {
1055
+ //this.submit(0)
1056
+ this.data = [];
1057
+ this.initialData = [];
1058
+ this.loading.inProgress = true;
1059
+ this.sfCrudService.formLoading = this.loading;
1060
+ let url = this.aplyKeys(this.crudConfig.tablero.keys, `${this.generalService.jsonConfig[this.crudConfig.tablero.server]}${this.crudConfig.tablero.endpoint}`, this.dataExt);
1061
+ this.generalService.genericRequest(this.crudConfig.tablero.method, url, this.dataExt)
1062
+ .then((res) => {
1063
+ let aux;
1064
+ if (!Array.isArray(res))
1065
+ aux = res.data;
1066
+ else
1067
+ aux = res;
1068
+ this.initialData = _.cloneDeep(aux);
1069
+ this.generateData(aux);
1070
+ this.loadOptions();
1071
+ })
1072
+ .finally(() => {
1073
+ this.loading.inProgress = false;
1074
+ this.sfCrudService.formLoading = this.loading;
1075
+ });
1076
+ }
1077
+ generateData(data) {
1078
+ data.forEach((item) => {
1079
+ let newItem = {};
1080
+ this.crudConfig.tablero.columns.forEach(col => {
1081
+ newItem[col.col] = this.getValue(col.col, item);
1082
+ });
1083
+ this.data.push(newItem);
1084
+ });
1085
+ }
1086
+ getValue(path, item) {
1087
+ if (path.includes("."))
1088
+ return jsonpath.query(item, path)[0];
1089
+ return item[path];
1090
+ }
1091
+ externalLinkAction() {
1092
+ this.opciones.filter((opc) => opc.valor.action).forEach(opc => this.execAction(opc.valor));
1093
+ }
1094
+ loadOptions() {
1095
+ this.items = [];
1096
+ this.btn.create = this.opciones.find(x => x.label == 'Crear');
1097
+ this.opciones.filter((opc) => opc.valor.action).forEach(opc => {
1098
+ this.items.push({ label: opc.label, icon: opc.icon, command: () => this.execAction(opc.valor) });
1099
+ });
1100
+ }
1101
+ redirect(accion, data) {
1102
+ this.stepService.reset();
1103
+ this.sfCrudService.reset();
1104
+ switch (accion) {
1105
+ case 'create':
1106
+ this.router.navigateByUrl(this.btn.create?.valor?.redirect || '');
1107
+ break;
1108
+ case 'read':
1109
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.read.valor.redirect, data));
1110
+ break;
1111
+ case 'update':
1112
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.update.valor.redirect, data));
1113
+ break;
1114
+ case 'delete':
1115
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, this.btn.delete.valor.redirect, data));
1116
+ break;
1117
+ default:
1118
+ break;
1119
+ }
1120
+ }
1121
+ aplyKeys(keys, endpoint, data) {
1122
+ keys.forEach(key => {
1123
+ switch (key.key) {
1124
+ case '@ndoc':
1125
+ endpoint = endpoint.replace(key.key, this.user?.UsuarioSistema?.NDOC || '');
1126
+ break;
1127
+ case '@tdoc':
1128
+ endpoint = endpoint.replace(key.key, this.user?.UsuarioSistema?.TDOC || '');
1129
+ break;
1130
+ case '@idKatios':
1131
+ endpoint = endpoint.replace(key.key, this.idKatios);
1132
+ break;
1133
+ default:
1134
+ if (endpoint.includes(key.key) && data)
1135
+ endpoint = endpoint.replace(key.key, jsonpath.query(data, key?.scope || '')[0]);
1136
+ break;
1137
+ }
1138
+ });
1139
+ return endpoint;
1140
+ }
1141
+ execAction(params) {
1142
+ switch (params.action) {
1143
+ case 'redirect':
1144
+ this.router.navigateByUrl(this.aplyKeys(this.crudConfig.tablero.keys, params.link, this.itemSelected)).then(() => {
1145
+ if (params.reload)
1146
+ window.location.reload();
1147
+ });
1148
+ break;
1149
+ default:
1150
+ this.onSelectAction.emit({ data: _.cloneDeep(this.itemSelected), params });
1151
+ break;
1152
+ }
1153
+ }
1154
+ onGlobalFilter(event, dt) {
1155
+ const target = event.target;
1156
+ dt.filterGlobal(target.value, 'contains');
1157
+ }
1158
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TableroComponent, deps: [{ token: GeneralService }, { token: i2.Router }, { token: SfCrudService }, { token: StepService }], target: i0.ɵɵFactoryTarget.Component });
1159
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: TableroComponent, isStandalone: false, selector: "sf-crudtablero", inputs: { opciones: "opciones", idEntidad: "idEntidad", idKatios: "idKatios", environment: "environment", user: "user", dataExt: "dataExt" }, outputs: { onSelectAction: "onSelectAction" }, host: { properties: { "style.--secondary-color": "this.color2", "style.--button-color": "this.colorButtons" } }, ngImport: i0, template: "<p-card>\r\n <p-toolbar styleClass=\"mb-4 gap-2\" *ngIf=\"btn.create\">\r\n <ng-template #start>\r\n <button pButton pRipple [label]=\"btn.create.label\" [icon]=\"btn.create.icon\"\r\n class=\"p-button-success mr-2\" (click)=\"redirect('create')\"></button>\r\n </ng-template>\r\n </p-toolbar>\r\n <p-table *ngIf=\"crudConfig?.tablero?.columns\" #dt [columns]=\"crudConfig.tablero.columns\" [value]=\"data\" [rowHover]=\"true\" [rows]=\"10\" [paginator]=\"true\"\r\n [totalRecords]=\"data.length\" [globalFilterFields]=\"crudConfig.tablero?.filters || []\" [tableStyle]=\"{'min-width': '75rem'}\"\r\n currentPageReportTemplate=\"Registro {first} al {last} de {totalRecords}\" [showCurrentPageReport]=\"true\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"flex align-items-center justify-content-between\">\r\n <h5 class=\"m-0\">{{crudConfig.tablero?.label || idEntidad}}</h5>\r\n <p-iconfield>\r\n <p-inputicon class=\"pi pi-search\" />\r\n <input pInputText type=\"text\" (input)=\"dt.filterGlobal($event.target.value, 'contains')\"\r\n placeholder=\"Buscar...\" />\r\n </p-iconfield>\r\n <!-- <span class=\"p-input-icon-left\">\r\n <i class=\"pi pi-search\"></i>\r\n <input pInputText type=\"text\" (input)=\"dt.filterGlobal($event.target.value, 'contains')\"\r\n placeholder=\"Buscar...\" />\r\n </span> -->\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n {{col.label}}\r\n </th>\r\n <th>Acci\u00F3n</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-index=\"rowIndex\">\r\n <tr>\r\n <ng-container *ngFor=\"let col of columns\" [ngSwitch]=\"col.type\">\r\n <td *ngSwitchCase=\"'text'\">{{rowData[col.col]}}</td>\r\n <td *ngSwitchCase=\"'date:yyyy-mm-dd'\">{{rowData[col.col] | date: 'yyyy-MM-dd'}}</td>\r\n <td *ngSwitchCase=\"'currency:USD'\">{{rowData[col.col] | currency: 'USD'}}</td>\r\n </ng-container>\r\n <td>\r\n <p-splitButton *ngIf=\"items.length > 1\" icon=\"pi pi-align-justify\" [model]=\"items\" appendTo=\"body\"\r\n (onDropdownClick)=\"itemSelected = rowData\"></p-splitButton>\r\n <div *ngIf=\"items.length <= 1\">\r\n <button *ngFor=\"let item of items\" pButton pRipple [icon]=\"item.icon\" class=\"mr-2\"\r\n (click)=\"itemSelected = initialData[index]; item.command()\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n</p-card>\r\n", styles: ["::ng-deep .p-datatable table{min-width:100%}button:not(.p-button-success){background:var(--secondary-color)!important;border:var(--secondary-color)!important;color:#fff}\n"], dependencies: [{ kind: "directive", type: i1$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i8.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i7.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "directive", type: i8$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i8$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i8$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i8$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i9.IconField, selector: "p-iconfield, p-iconField, p-icon-field", inputs: ["iconPosition", "styleClass"] }, { kind: "component", type: i10.InputIcon, selector: "p-inputicon, p-inputIcon", inputs: ["styleClass"] }, { kind: "directive", type: i11.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "directive", type: i12.Ripple, selector: "[pRipple]" }, { kind: "component", type: i13.SplitButton, selector: "p-splitbutton, p-splitButton, p-split-button", inputs: ["model", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "icon", "iconPos", "label", "tooltip", "tooltipOptions", "style", "styleClass", "menuStyle", "menuStyleClass", "dropdownIcon", "appendTo", "dir", "expandAriaLabel", "showTransitionOptions", "hideTransitionOptions", "buttonProps", "menuButtonProps", "autofocus", "disabled", "tabindex", "menuButtonDisabled", "buttonDisabled"], outputs: ["onClick", "onMenuHide", "onMenuShow", "onDropdownClick"] }, { kind: "component", type: i14.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "component", type: i15.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass", "ariaLabelledBy"] }, { kind: "pipe", type: i8$1.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i8$1.DatePipe, name: "date" }] });
1160
+ }
1161
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: TableroComponent, decorators: [{
1162
+ type: Component,
1163
+ args: [{ selector: 'sf-crudtablero', standalone: false, template: "<p-card>\r\n <p-toolbar styleClass=\"mb-4 gap-2\" *ngIf=\"btn.create\">\r\n <ng-template #start>\r\n <button pButton pRipple [label]=\"btn.create.label\" [icon]=\"btn.create.icon\"\r\n class=\"p-button-success mr-2\" (click)=\"redirect('create')\"></button>\r\n </ng-template>\r\n </p-toolbar>\r\n <p-table *ngIf=\"crudConfig?.tablero?.columns\" #dt [columns]=\"crudConfig.tablero.columns\" [value]=\"data\" [rowHover]=\"true\" [rows]=\"10\" [paginator]=\"true\"\r\n [totalRecords]=\"data.length\" [globalFilterFields]=\"crudConfig.tablero?.filters || []\" [tableStyle]=\"{'min-width': '75rem'}\"\r\n currentPageReportTemplate=\"Registro {first} al {last} de {totalRecords}\" [showCurrentPageReport]=\"true\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"flex align-items-center justify-content-between\">\r\n <h5 class=\"m-0\">{{crudConfig.tablero?.label || idEntidad}}</h5>\r\n <p-iconfield>\r\n <p-inputicon class=\"pi pi-search\" />\r\n <input pInputText type=\"text\" (input)=\"dt.filterGlobal($event.target.value, 'contains')\"\r\n placeholder=\"Buscar...\" />\r\n </p-iconfield>\r\n <!-- <span class=\"p-input-icon-left\">\r\n <i class=\"pi pi-search\"></i>\r\n <input pInputText type=\"text\" (input)=\"dt.filterGlobal($event.target.value, 'contains')\"\r\n placeholder=\"Buscar...\" />\r\n </span> -->\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n {{col.label}}\r\n </th>\r\n <th>Acci\u00F3n</th>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-index=\"rowIndex\">\r\n <tr>\r\n <ng-container *ngFor=\"let col of columns\" [ngSwitch]=\"col.type\">\r\n <td *ngSwitchCase=\"'text'\">{{rowData[col.col]}}</td>\r\n <td *ngSwitchCase=\"'date:yyyy-mm-dd'\">{{rowData[col.col] | date: 'yyyy-MM-dd'}}</td>\r\n <td *ngSwitchCase=\"'currency:USD'\">{{rowData[col.col] | currency: 'USD'}}</td>\r\n </ng-container>\r\n <td>\r\n <p-splitButton *ngIf=\"items.length > 1\" icon=\"pi pi-align-justify\" [model]=\"items\" appendTo=\"body\"\r\n (onDropdownClick)=\"itemSelected = rowData\"></p-splitButton>\r\n <div *ngIf=\"items.length <= 1\">\r\n <button *ngFor=\"let item of items\" pButton pRipple [icon]=\"item.icon\" class=\"mr-2\"\r\n (click)=\"itemSelected = initialData[index]; item.command()\"></button>\r\n </div>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n</p-card>\r\n", styles: ["::ng-deep .p-datatable table{min-width:100%}button:not(.p-button-success){background:var(--secondary-color)!important;border:var(--secondary-color)!important;color:#fff}\n"] }]
1164
+ }], ctorParameters: () => [{ type: GeneralService }, { type: i2.Router }, { type: SfCrudService }, { type: StepService }], propDecorators: { opciones: [{
1165
+ type: Input
1166
+ }], idEntidad: [{
1167
+ type: Input
1168
+ }], idKatios: [{
1169
+ type: Input
1170
+ }], environment: [{
1171
+ type: Input
1172
+ }], user: [{
1173
+ type: Input
1174
+ }], dataExt: [{
1175
+ type: Input
1176
+ }], onSelectAction: [{
1177
+ type: Output
1178
+ }], color2: [{
1179
+ type: HostBinding,
1180
+ args: ["style.--secondary-color"]
1181
+ }], colorButtons: [{
1182
+ type: HostBinding,
1183
+ args: ["style.--button-color"]
1184
+ }] } });
1185
+
1186
+ class NotificationService {
1187
+ sfCrudService;
1188
+ _notificationAdded = new BehaviorSubject(undefined);
1189
+ constructor(sfCrudService) {
1190
+ this.sfCrudService = sfCrudService;
1191
+ }
1192
+ addNotification(msg, requestChecking) {
1193
+ this._notificationAdded.next({ msg, requestChecking });
1194
+ }
1195
+ notificationAdded$() {
1196
+ return this._notificationAdded.asObservable();
1197
+ }
1198
+ /**
1199
+ * Generates message using answerchecking
1200
+ * @param currentMsg Default message: Message | SweetAlertOptions
1201
+ * @param rta Resquest's response
1202
+ * @param answerChecking
1203
+ */
1204
+ generateMessage(currentMsg, rta, requestChecking) {
1205
+ if (requestChecking) {
1206
+ if (requestChecking.statics)
1207
+ Object.assign(currentMsg, requestChecking.statics);
1208
+ //mapear los dinamicos
1209
+ if (requestChecking.dynamics) {
1210
+ const dynamics = requestChecking.dynamics;
1211
+ try {
1212
+ if (dynamics && typeof (rta) == "string")
1213
+ rta = JSON.parse(rta);
1214
+ if (requestChecking.parse) {
1215
+ let valueParsed = JSON.parse(jsonpath.query(rta, requestChecking.parse)[0]);
1216
+ jsonpath.value(rta, requestChecking.parse, valueParsed);
1217
+ }
1218
+ if (dynamics) {
1219
+ for (const property in dynamics) {
1220
+ currentMsg[property] = jsonpath.query(rta, dynamics[property])[0];
1221
+ }
1222
+ }
1223
+ }
1224
+ catch (error) { //es una respuesta sin JSON
1225
+ if (dynamics)
1226
+ currentMsg.detail = rta;
1227
+ }
1228
+ }
1229
+ }
1230
+ return currentMsg;
1231
+ }
1232
+ genDefaultMessage(severity, title, detail, requestChecking) {
1233
+ let obj = { title, text: detail, icon: severity,
1234
+ confirmButtonColor: this.sfCrudService.configEmpresa?.colors ? this.sfCrudService.configEmpresa?.colors?.button : "#3085d6",
1235
+ cancelButtonColor: this.sfCrudService.configEmpresa?.colors ? this.sfCrudService.configEmpresa?.colors?.button : "#d33" };
1236
+ if (requestChecking && requestChecking.useSwal && severity == "error") {
1237
+ obj.showCancelButton = true;
1238
+ obj.confirmButtonText = '<i class="pi pi-check"></i> Continuar';
1239
+ obj.cancelButtonText = '<i class="pi pi-times"></i> Terminar';
1240
+ }
1241
+ if (!requestChecking || !requestChecking.useSwal) {
1242
+ obj.severity = severity;
1243
+ obj.summary = title;
1244
+ obj.detail = detail;
1245
+ }
1246
+ return obj;
1247
+ }
1248
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NotificationService, deps: [{ token: SfCrudService }], target: i0.ɵɵFactoryTarget.Injectable });
1249
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NotificationService, providedIn: 'root' });
1250
+ }
1251
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: NotificationService, decorators: [{
1252
+ type: Injectable,
1253
+ args: [{
1254
+ providedIn: 'root'
1255
+ }]
1256
+ }], ctorParameters: () => [{ type: SfCrudService }] });
1257
+ class Notification {
1258
+ msg;
1259
+ requestChecking;
1260
+ constructor(msg, requestChecking) {
1261
+ this.msg = msg;
1262
+ this.requestChecking = requestChecking;
1263
+ }
1264
+ }
1265
+
1266
+ class StepComponent {
1267
+ router;
1268
+ stepService;
1269
+ activatedRoute;
1270
+ items;
1271
+ activeIndex = 0;
1272
+ loading = false;
1273
+ nextMovement = 0;
1274
+ constructor(router, stepService, activatedRoute) {
1275
+ this.router = router;
1276
+ this.stepService = stepService;
1277
+ this.activatedRoute = activatedRoute;
1278
+ }
1279
+ ngOnInit() {
1280
+ this.stepService.currentIndex$.subscribe((result) => {
1281
+ this.nextMovement = result;
1282
+ this.router.navigate([this.items[result].routerLink], { relativeTo: this.activatedRoute, queryParamsHandling: "preserve" });
1283
+ this.moveScroll(this.nextMovement);
1284
+ this.activeIndex = result;
1285
+ });
1286
+ }
1287
+ ngAfterViewInit() {
1288
+ this.stepService.requestApproved$.subscribe((result) => {
1289
+ if (result) {
1290
+ this.navigate();
1291
+ }
1292
+ this.loading = false;
1293
+ });
1294
+ this.moveScroll(this.nextMovement);
1295
+ }
1296
+ onactiveIndexChange($event) {
1297
+ this.requestNaviagtion($event - this.activeIndex);
1298
+ }
1299
+ /**
1300
+ * Button solicitates permissions to change tab.
1301
+ * @param add steps to advance. If negative will go back
1302
+ */
1303
+ requestNaviagtion(add) {
1304
+ this.loading = true;
1305
+ this.nextMovement = this.activeIndex + add;
1306
+ this.stepService.requestApproval = this.nextMovement;
1307
+ }
1308
+ navigate() {
1309
+ if (this.nextMovement < this.items.length) {
1310
+ this.activeIndex = this.nextMovement;
1311
+ this.router.navigate([this.items[this.nextMovement].routerLink], { relativeTo: this.activatedRoute, queryParamsHandling: "preserve" });
1312
+ }
1313
+ }
1314
+ moveScroll(nextIndex) {
1315
+ let miDiv = document.getElementById("step-container");
1316
+ const steps = document.querySelector(".p-steps ul[role='tablist']");
1317
+ if (steps !== null) {
1318
+ let i = 0;
1319
+ let value = 0;
1320
+ while (i < nextIndex) {
1321
+ const child = steps.children[i];
1322
+ value += child.clientWidth;
1323
+ i++;
1324
+ }
1325
+ miDiv.scrollLeft = value;
1326
+ }
1327
+ }
1328
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: StepComponent, deps: [{ token: i2.Router }, { token: StepService }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
1329
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: StepComponent, isStandalone: false, selector: "app-step", inputs: { items: "items" }, ngImport: i0, template: "<div>\r\n <div id=\"step-container\">\r\n <p-steps #stepsComponent [model]=\"items\" [readonly]=\"false\" [activeIndex]=\"activeIndex\" (activeIndexChange)=\"onactiveIndexChange($event)\"></p-steps>\r\n </div>\r\n\r\n <div class=\"content\">\r\n <router-outlet></router-outlet>\r\n </div>\r\n <div class=\"buttons-step\">\r\n <div >\r\n <button pButton *ngIf=\"activeIndex != 0\" icon=\"pi pi-arrow-left\" [disabled]=\"loading\"\r\n (click)=\"requestNaviagtion(-1)\"></button>\r\n </div>\r\n <span >\r\n <button pButton *ngIf=\"!(activeIndex + 1 >= items.length)\" icon=\"pi pi-arrow-right\" [disabled]=\"loading\"\r\n (click)=\"requestNaviagtion(1)\"></button>\r\n </span>\r\n <button pButton *ngIf=\"activeIndex >= items.length - 1\" label=\"Finalizar\" [disabled]=\"loading\" (click)=\"requestNaviagtion(0)\"\r\n [style]=\"{'margin-left': '10px'}\"></button>\r\n </div>\r\n</div>\r\n", styles: ["::ng-deep .p-steps-number{background-color:var(--secondary-color)!important}::ng-deep .p-button{border-radius:6px}::ng-deep .p-steps-item .p-menuitem-link{margin-inline:15vw}::ng-deep .p-steps .p-steps-item.p-highlight .p-steps-number{color:#fff;font-family:sans-serif}::ng-deep .p-steps .p-steps-item.p-highlight .p-steps-title{color:#4b5563;font-family:inherit}:is() ul[role=tablist]{padding-bottom:10px}:is() .p-steps-number{color:#fff!important}.buttons-step{margin-bottom:1.5rem}.buttons-step button{height:3.5rem}.buttons-step ::ng-deep .p-button{background-color:var(--button-color);border-color:var(--button-color)}.buttons-step .p-button-icon-only{width:3.5rem}#step-container{overflow-x:scroll;scrollbar-width:20px;padding-bottom:5px}.buttons-step{display:flex;justify-content:space-evenly}.content{margin-block:30px}@media screen and (max-width: 765px){:is() .p-steps-title{font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block;width:inherit;text-align:center}::ng-deep .p-steps-item a.p-menuitem-link{margin-inline:0!important;width:90vw}}\n"], dependencies: [{ kind: "directive", type: i2.RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: i8.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "directive", type: i8$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.Steps, selector: "p-steps", inputs: ["activeIndex", "model", "readonly", "style", "styleClass", "exact"], outputs: ["activeIndexChange"] }] });
1330
+ }
1331
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: StepComponent, decorators: [{
1332
+ type: Component,
1333
+ args: [{ selector: 'app-step', standalone: false, template: "<div>\r\n <div id=\"step-container\">\r\n <p-steps #stepsComponent [model]=\"items\" [readonly]=\"false\" [activeIndex]=\"activeIndex\" (activeIndexChange)=\"onactiveIndexChange($event)\"></p-steps>\r\n </div>\r\n\r\n <div class=\"content\">\r\n <router-outlet></router-outlet>\r\n </div>\r\n <div class=\"buttons-step\">\r\n <div >\r\n <button pButton *ngIf=\"activeIndex != 0\" icon=\"pi pi-arrow-left\" [disabled]=\"loading\"\r\n (click)=\"requestNaviagtion(-1)\"></button>\r\n </div>\r\n <span >\r\n <button pButton *ngIf=\"!(activeIndex + 1 >= items.length)\" icon=\"pi pi-arrow-right\" [disabled]=\"loading\"\r\n (click)=\"requestNaviagtion(1)\"></button>\r\n </span>\r\n <button pButton *ngIf=\"activeIndex >= items.length - 1\" label=\"Finalizar\" [disabled]=\"loading\" (click)=\"requestNaviagtion(0)\"\r\n [style]=\"{'margin-left': '10px'}\"></button>\r\n </div>\r\n</div>\r\n", styles: ["::ng-deep .p-steps-number{background-color:var(--secondary-color)!important}::ng-deep .p-button{border-radius:6px}::ng-deep .p-steps-item .p-menuitem-link{margin-inline:15vw}::ng-deep .p-steps .p-steps-item.p-highlight .p-steps-number{color:#fff;font-family:sans-serif}::ng-deep .p-steps .p-steps-item.p-highlight .p-steps-title{color:#4b5563;font-family:inherit}:is() ul[role=tablist]{padding-bottom:10px}:is() .p-steps-number{color:#fff!important}.buttons-step{margin-bottom:1.5rem}.buttons-step button{height:3.5rem}.buttons-step ::ng-deep .p-button{background-color:var(--button-color);border-color:var(--button-color)}.buttons-step .p-button-icon-only{width:3.5rem}#step-container{overflow-x:scroll;scrollbar-width:20px;padding-bottom:5px}.buttons-step{display:flex;justify-content:space-evenly}.content{margin-block:30px}@media screen and (max-width: 765px){:is() .p-steps-title{font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block;width:inherit;text-align:center}::ng-deep .p-steps-item a.p-menuitem-link{margin-inline:0!important;width:90vw}}\n"] }]
1334
+ }], ctorParameters: () => [{ type: i2.Router }, { type: StepService }, { type: i2.ActivatedRoute }], propDecorators: { items: [{
1335
+ type: Input
1336
+ }] } });
1337
+
1338
+ class Shema {
1339
+ type = '';
1340
+ subtype = '';
1341
+ config;
1342
+ tooltip;
1343
+ tooltipPosition;
1344
+ properties;
1345
+ enum;
1346
+ default;
1347
+ validations;
1348
+ disabled;
1349
+ field;
1350
+ placeholder;
1351
+ unmask;
1352
+ autocomplete;
1353
+ showIcon;
1354
+ hide;
1355
+ locale;
1356
+ configuration = new ShemaConfig();
1357
+ touchUI;
1358
+ format;
1359
+ formatMoment;
1360
+ useGrouping;
1361
+ max;
1362
+ min;
1363
+ currency;
1364
+ minFractionDigits;
1365
+ trueValue;
1366
+ falseValue;
1367
+ allowCustomOption = false;
1368
+ separador;
1369
+ }
1370
+ class ShemaConfig {
1371
+ calendar;
1372
+ }
1373
+
1374
+ class FileUploadComponent {
1375
+ messageSerice;
1376
+ limit;
1377
+ files = [];
1378
+ loading = false;
1379
+ configName;
1380
+ accept = "image/*,application/pdf";
1381
+ onUpload = new EventEmitter();
1382
+ onDeleteFile = new EventEmitter();
1383
+ fileUploader;
1384
+ newFiles = [];
1385
+ animationInterval;
1386
+ constructor(messageSerice) {
1387
+ this.messageSerice = messageSerice;
1388
+ window.addEventListener("paste", (e) => {
1389
+ if (e.clipboardData?.files && e.clipboardData.files.length > 0) {
1390
+ this.appendFile(e.clipboardData.files[0]);
1391
+ }
1392
+ });
1393
+ }
1394
+ ngOnChanges(changes) {
1395
+ }
1396
+ ngOnInit() {
1397
+ }
1398
+ appendFile(file) {
1399
+ const allowedTypes = this.accept.split(",");
1400
+ const allowedFile = allowedTypes.some(pattern => {
1401
+ const regexObj = new RegExp(pattern);
1402
+ const match = regexObj.exec(file.type);
1403
+ return match ? match?.length > 0 : false;
1404
+ });
1405
+ if (allowedFile) {
1406
+ const newFile = new File([file], this.getName(file), { type: file.type });
1407
+ if (this.limit == 1) {
1408
+ this.newFiles = [newFile];
1409
+ }
1410
+ else
1411
+ this.newFiles.push(newFile);
1412
+ this.files.push({ name: newFile.name, url: window.URL.createObjectURL(newFile) });
1413
+ }
1414
+ else {
1415
+ this.messageSerice.add({ severity: "warn", detail: "Tipo de archivo no válido" });
1416
+ }
1417
+ }
1418
+ emitFiles() {
1419
+ this.loading = true;
1420
+ this.onUpload.emit(this.newFiles);
1421
+ }
1422
+ getName(file) {
1423
+ let sName = "";
1424
+ let date = new Date();
1425
+ if (this.configName !== undefined) {
1426
+ let name = this.configName.split('|');
1427
+ name.forEach(item => {
1428
+ if (item.indexOf("DATE@") != -1)
1429
+ sName += (moment(date)).format(item.split('@')[1]);
1430
+ else if (item.indexOf("@") == -1)
1431
+ sName += item;
1432
+ });
1433
+ let ext = this.getExt(file);
1434
+ sName += ext ? "." + ext : "";
1435
+ }
1436
+ else
1437
+ sName = file.name;
1438
+ return sName;
1439
+ }
1440
+ getExt(file) {
1441
+ let ext = undefined;
1442
+ let aux = file.name.split('.');
1443
+ if (aux.length > 0)
1444
+ ext = aux[aux.length - 1];
1445
+ return ext;
1446
+ }
1447
+ appendFiles($event) {
1448
+ if ($event.target.files.length > 0) {
1449
+ this.appendFile($event.target.files[0]);
1450
+ }
1451
+ if (this.limit == this.files.length) {
1452
+ this.stopAnimation();
1453
+ this.emitFiles();
1454
+ }
1455
+ else
1456
+ this.startAnimation();
1457
+ this.fileUploader.nativeElement.value = "";
1458
+ }
1459
+ dropFile(archivo) {
1460
+ this.files.forEach((f, index) => {
1461
+ if (f == archivo) {
1462
+ this.files.splice(index, 1);
1463
+ this.onDeleteFile.emit(index);
1464
+ }
1465
+ });
1466
+ }
1467
+ openFile(archivo) {
1468
+ window.open(archivo.url, '_blank');
1469
+ window.addEventListener('focus', () => URL.revokeObjectURL(archivo.url));
1470
+ }
1471
+ startAnimation() {
1472
+ const button = document.querySelector('.button-upload');
1473
+ if (button) {
1474
+ button.classList.add('animate-pulse');
1475
+ }
1476
+ }
1477
+ stopAnimation() {
1478
+ const button = document.querySelector('.button-upload');
1479
+ if (button) {
1480
+ button.classList.remove('animate-pulse');
1481
+ }
1482
+ }
1483
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FileUploadComponent, deps: [{ token: i1$1.MessageService }], target: i0.ɵɵFactoryTarget.Component });
1484
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: FileUploadComponent, isStandalone: false, selector: "sf-file-upload", inputs: { limit: "limit", files: "files", loading: "loading", configName: "configName", accept: "accept" }, outputs: { onUpload: "onUpload", onDeleteFile: "onDeleteFile" }, viewQueries: [{ propertyName: "fileUploader", first: true, predicate: ["fileUpload"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div id=\"screen\" #screen>\r\n <div class=\"fileUp\">\r\n <div class=\"botones\">\r\n <input type=\"file\" (change)=\"appendFiles($event)\" class=\"file-input\" #fileUpload multiple>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-plus\" class=\"p-button-info\" (click)=\"fileUpload.click()\"\r\n [disabled]=\"limit == files.length || loading\"></button>\r\n <button *ngIf=\"limit != 1\" pButton pRipple type=\"button\" icon=\"pi pi-upload\" class=\"button-upload p-button-info\"\r\n (click)=\"emitFiles()\" [disabled]=\"files.length == 0 || loading\"></button>\r\n </div>\r\n\r\n <hr>\r\n <div class=\"imgs\">\r\n <ul>\r\n <li *ngFor=\"let file of files; let i = index\" [ngSwitch]=\"file.type\">\r\n <p>{{i+1}}. {{files[i].name}}</p>\r\n <div>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-external-link\" class=\"p-button-rounded\"\r\n (click)=\"openFile(file)\"></button>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-times\" class=\"p-button-rounded p-button-danger\"\r\n (click)=\"dropFile(file)\"></button>\r\n </div>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["#screen{container-type:inline-size}iframe{width:100%;padding:10px;text-align:center}.fileUp{border:1.5px solid gray;border-radius:5px;text-align:center}.fileUp .imgs{min-height:40px;margin-block:7px;max-height:135px;overflow-y:scroll}.fileUp hr{color:gray;margin:0}.fileUp .imgs ul li{text-decoration:none;display:flex;margin-block:5px;padding-inline:5px}.fileUp .imgs ul{padding-inline-start:30px}.fileUp .imgs ul li div{text-decoration:none;display:grid;grid-template-columns:50% 50%;margin-block:5px;margin-right:5px}.fileUp .botones *{margin-block:7px;margin-inline:10px}.fileUp .imgs ul li p{text-align:left;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis}.fileUp .imgs ul li p,.fileUp .imgs ul li button{margin-block:auto;margin-inline:5px;text-align:left}.fileUp .imgs ul li img,.fileUp .imgs ul li iframe{text-align:center;width:80%;padding-inline:10%}.file-input{display:none}::ng-deep .p-button.p-button-info,.p-buttonset.p-button-info>.p-button,.p-splitbutton.p-button-info>.p-button{background:var(--secondary-color)!important;border:var(--secondary-color)!important;color:#fff}@keyframes pulse{0%{transform:scale(1)}50%{transform:scale(1.1)}to{transform:scale(1)}}.animate-pulse{animation:pulse 1.5s infinite}@container (width < 768px){.fileUp .imgs ul li{display:grid;grid-template-columns:60% 40%}.fileUp .imgs ul li img,.fileUp .imgs ul li iframe{display:none}}\n"], dependencies: [{ kind: "directive", type: i8.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "directive", type: i8$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i8$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i8$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i12.Ripple, selector: "[pRipple]" }] });
1485
+ }
1486
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FileUploadComponent, decorators: [{
1487
+ type: Component,
1488
+ args: [{ selector: 'sf-file-upload', standalone: false, template: "<div id=\"screen\" #screen>\r\n <div class=\"fileUp\">\r\n <div class=\"botones\">\r\n <input type=\"file\" (change)=\"appendFiles($event)\" class=\"file-input\" #fileUpload multiple>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-plus\" class=\"p-button-info\" (click)=\"fileUpload.click()\"\r\n [disabled]=\"limit == files.length || loading\"></button>\r\n <button *ngIf=\"limit != 1\" pButton pRipple type=\"button\" icon=\"pi pi-upload\" class=\"button-upload p-button-info\"\r\n (click)=\"emitFiles()\" [disabled]=\"files.length == 0 || loading\"></button>\r\n </div>\r\n\r\n <hr>\r\n <div class=\"imgs\">\r\n <ul>\r\n <li *ngFor=\"let file of files; let i = index\" [ngSwitch]=\"file.type\">\r\n <p>{{i+1}}. {{files[i].name}}</p>\r\n <div>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-external-link\" class=\"p-button-rounded\"\r\n (click)=\"openFile(file)\"></button>\r\n <button pButton pRipple type=\"button\" icon=\"pi pi-times\" class=\"p-button-rounded p-button-danger\"\r\n (click)=\"dropFile(file)\"></button>\r\n </div>\r\n </li>\r\n </ul>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["#screen{container-type:inline-size}iframe{width:100%;padding:10px;text-align:center}.fileUp{border:1.5px solid gray;border-radius:5px;text-align:center}.fileUp .imgs{min-height:40px;margin-block:7px;max-height:135px;overflow-y:scroll}.fileUp hr{color:gray;margin:0}.fileUp .imgs ul li{text-decoration:none;display:flex;margin-block:5px;padding-inline:5px}.fileUp .imgs ul{padding-inline-start:30px}.fileUp .imgs ul li div{text-decoration:none;display:grid;grid-template-columns:50% 50%;margin-block:5px;margin-right:5px}.fileUp .botones *{margin-block:7px;margin-inline:10px}.fileUp .imgs ul li p{text-align:left;white-space:nowrap;width:100%;overflow:hidden;text-overflow:ellipsis}.fileUp .imgs ul li p,.fileUp .imgs ul li button{margin-block:auto;margin-inline:5px;text-align:left}.fileUp .imgs ul li img,.fileUp .imgs ul li iframe{text-align:center;width:80%;padding-inline:10%}.file-input{display:none}::ng-deep .p-button.p-button-info,.p-buttonset.p-button-info>.p-button,.p-splitbutton.p-button-info>.p-button{background:var(--secondary-color)!important;border:var(--secondary-color)!important;color:#fff}@keyframes pulse{0%{transform:scale(1)}50%{transform:scale(1.1)}to{transform:scale(1)}}.animate-pulse{animation:pulse 1.5s infinite}@container (width < 768px){.fileUp .imgs ul li{display:grid;grid-template-columns:60% 40%}.fileUp .imgs ul li img,.fileUp .imgs ul li iframe{display:none}}\n"] }]
1489
+ }], ctorParameters: () => [{ type: i1$1.MessageService }], propDecorators: { limit: [{
1490
+ type: Input
1491
+ }], files: [{
1492
+ type: Input
1493
+ }], loading: [{
1494
+ type: Input
1495
+ }], configName: [{
1496
+ type: Input
1497
+ }], accept: [{
1498
+ type: Input
1499
+ }], onUpload: [{
1500
+ type: Output
1501
+ }], onDeleteFile: [{
1502
+ type: Output
1503
+ }], fileUploader: [{
1504
+ type: ViewChild,
1505
+ args: ['fileUpload']
1506
+ }] } });
1507
+ class Archivo {
1508
+ url;
1509
+ name;
1510
+ }
1511
+
1512
+ class FormatAddressPipe {
1513
+ transform(address, separator) {
1514
+ if (!address) {
1515
+ return address;
1516
+ }
1517
+ if (separator) {
1518
+ return address.replaceAll(separator, ' ').replaceAll(' ', ' ');
1519
+ }
1520
+ return address;
1521
+ }
1522
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FormatAddressPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1523
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: FormatAddressPipe, isStandalone: false, name: "formatAddress" });
1524
+ }
1525
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FormatAddressPipe, decorators: [{
1526
+ type: Pipe,
1527
+ args: [{
1528
+ name: 'formatAddress',
1529
+ standalone: false
1530
+ }]
1531
+ }] });
1532
+
1533
+ class ControlComponent {
1534
+ generalService;
1535
+ crudService;
1536
+ cdr;
1537
+ notificationService;
1538
+ showTempValue = false;
1539
+ control = new Shema();
1540
+ label = '';
1541
+ value;
1542
+ appendTo;
1543
+ setValue = new EventEmitter();
1544
+ sendObject = new EventEmitter();
1545
+ addressClicked = new EventEmitter();
1546
+ tooltips;
1547
+ lenghtWord;
1548
+ isLoading = false;
1549
+ dataFromService = [];
1550
+ uploadedFiles = [];
1551
+ displayAdd = false;
1552
+ tempValue;
1553
+ clicked = false;
1554
+ maskDate = "99/99/9999";
1555
+ uploadingFiles = false;
1556
+ constructor(generalService, crudService, cdr, notificationService) {
1557
+ this.generalService = generalService;
1558
+ this.crudService = crudService;
1559
+ this.cdr = cdr;
1560
+ this.notificationService = notificationService;
1561
+ }
1562
+ ngOnChanges(changes) {
1563
+ }
1564
+ ngOnInit() {
1565
+ this.loadDefaultValues();
1566
+ if (this.control?.config?.depends) {
1567
+ this.crudService.changeData$.subscribe(res => {
1568
+ if (res) {
1569
+ let registro = this.crudService.getRegistro(this.crudService.index);
1570
+ let keyFound = registro.keys?.find(k => k.scope === res.scope
1571
+ && this.control.config.depends.includes(k.key) &&
1572
+ (res.index === k.indexData || res.index === k.indexAnswer));
1573
+ if (keyFound?.overrideControl) {
1574
+ let override = keyFound.overrideControl;
1575
+ let completed = this.crudService.isConditionsCompleted(override.conditions ?? [], registro.conditions || [], this.crudService.getData(this.crudService.index));
1576
+ jsonpath.value(this.control, override.property, completed ? override.value : override.elseValue);
1577
+ this.value = this.getNewValue(override, completed);
1578
+ this.tempValue = null;
1579
+ this.sendValue();
1580
+ if (this.control.subtype == 'dropdown' || this.control.subtype == 'multiselect')
1581
+ this.loadDataFromService();
1582
+ //this.cdr.detectChanges()
1583
+ }
1584
+ else if (keyFound) {
1585
+ this.value = null;
1586
+ this.sendValue();
1587
+ this.loadDefaultValues();
1588
+ //this.cdr.detectChanges()
1589
+ }
1590
+ }
1591
+ });
1592
+ }
1593
+ }
1594
+ getNewValue(override, completed) {
1595
+ const newValue = completed ? override.newPropertyValue : override.elseNewPropertyValue;
1596
+ if (newValue && typeof (newValue) == "string") {
1597
+ if (!newValue.startsWith('$') && !newValue.startsWith('@')) {
1598
+ return newValue;
1599
+ }
1600
+ }
1601
+ return null;
1602
+ }
1603
+ loadDefaultValues() {
1604
+ if (this.control?.config && this.control.subtype == 'dropdown' || this.control.subtype == 'multiselect')
1605
+ this.loadDataFromService();
1606
+ if (this.control?.subtype == 'autocomplete')
1607
+ this.extracValueFromControlBusqueda();
1608
+ if (this.value && this.control.type == 'date') {
1609
+ this.instanceDate();
1610
+ }
1611
+ if (this.control?.subtype == "file") {
1612
+ this.loadFiles();
1613
+ }
1614
+ if (this.control?.type == 'string')
1615
+ this.lenghtWord = this.value ? this.value.length : 0;
1616
+ if (this.control?.subtype == 'switch')
1617
+ this.instanceBoolField();
1618
+ }
1619
+ instanceBoolField() {
1620
+ this.tempValue = this.value;
1621
+ if (this.value == true && this.control.trueValue !== undefined) {
1622
+ this.value = this.control.trueValue;
1623
+ this.sendValue();
1624
+ }
1625
+ else if (this.value == false && this.control.falseValue !== undefined) {
1626
+ this.value = this.control.falseValue;
1627
+ this.sendValue();
1628
+ }
1629
+ }
1630
+ onChangeSwitch() {
1631
+ this.value = this.tempValue;
1632
+ this.sendValue();
1633
+ }
1634
+ loadFiles() {
1635
+ this.isLoading = true;
1636
+ this.uploadedFiles = [];
1637
+ if (!this.value) {
1638
+ this.isLoading = false;
1639
+ this.cdr.detectChanges();
1640
+ }
1641
+ else if (this.control.config.namePattern && this.control.type == "string") {
1642
+ let urls = this.control.config.separator ? this.value.split(",") : [this.value];
1643
+ urls.forEach(url => this.uploadedFiles.push({ url: url, name: this.getNameFile(this.control.config.namePattern, url) }));
1644
+ this.isLoading = false;
1645
+ this.cdr.detectChanges();
1646
+ }
1647
+ else if (this.control.config.namePattern && this.control.type == "array") {
1648
+ this.value.forEach((url) => this.uploadedFiles.push({ url: url, name: this.getNameFile(this.control.config.namePattern, url) }));
1649
+ this.isLoading = false;
1650
+ this.cdr.detectChanges();
1651
+ }
1652
+ }
1653
+ onDeleteFile(index) {
1654
+ if ((!this.control.config?.limit || this.control.config?.limit == 1) && this.control.type == "string")
1655
+ this.value = null;
1656
+ else if (this.control.type == "array")
1657
+ this.value.splice(index, 1);
1658
+ }
1659
+ getNameFile(namePattern, url) {
1660
+ const regexObj = new RegExp(namePattern);
1661
+ const match = regexObj.exec(url);
1662
+ if (!match)
1663
+ throw new Error("El pattern no coincide con la url. " + url);
1664
+ return match[0];
1665
+ }
1666
+ sendValue() {
1667
+ if (this.control.type == "string" && this.value == "" && this.control.config?.allowEmpty == false)
1668
+ this.value = null;
1669
+ this.setValue.emit(this.value);
1670
+ }
1671
+ sendNumberValue($event) {
1672
+ this.value = $event.value;
1673
+ this.sendValue();
1674
+ }
1675
+ onInputEmail(force) {
1676
+ const aux = Math.abs(this.lenghtWord - this.value.length);
1677
+ this.lenghtWord = this.value.length;
1678
+ if (aux > 1 || force) {
1679
+ const regex = new RegExp(/([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/igm);
1680
+ if (regex.test(this.value))
1681
+ this.sendValue();
1682
+ else {
1683
+ this.value = null;
1684
+ this.sendValue();
1685
+ this.notificationService.addNotification({ severity: 'warn', detail: 'El correo no es válido' }, this.primeChecking());
1686
+ }
1687
+ }
1688
+ }
1689
+ sendValueFromObject(event) {
1690
+ switch (typeof (this.control.config.optionValue)) {
1691
+ case 'object':
1692
+ this.control.config.optionValue.forEach((op) => op['value'] = event[op.key]);
1693
+ this.setValue.emit(this.control.config.optionValue);
1694
+ break;
1695
+ default:
1696
+ this.setValue.emit(event[this.control.config.optionValue]);
1697
+ break;
1698
+ }
1699
+ }
1700
+ loadDataFromService() {
1701
+ this.isLoading = true;
1702
+ this.dataFromService = [];
1703
+ const op = this.control.config;
1704
+ const url = this.crudService.getURL(op, undefined, undefined);
1705
+ if (this.control.config?.customOptions) {
1706
+ this.dataFromService = this.control.config.customOptions;
1707
+ }
1708
+ else {
1709
+ this.generalService.genericRequest(this.control.config.method, url)
1710
+ .then((res) => {
1711
+ this.dataFromService = res.data;
1712
+ }).finally(() => {
1713
+ this.isLoading = false;
1714
+ this.cdr.detectChanges();
1715
+ });
1716
+ }
1717
+ }
1718
+ loadDataFromControlBusquedaService(event) {
1719
+ this.isLoading = true;
1720
+ const op = this.control.config;
1721
+ let url = this.crudService.getURL(op);
1722
+ url = url.replace('@query', event?.query || '');
1723
+ this.generalService.genericRequest(this.control.config.method, url)
1724
+ .then((res) => {
1725
+ this.dataFromService = res.data;
1726
+ if (this.dataFromService?.length == 0 && this.control.allowCustomOption) {
1727
+ //agregar un campo que el usuario haya digitado
1728
+ let newItem = {};
1729
+ newItem[this.control.field] = this.tempValue;
1730
+ newItem[this.control.config.optionValue] = this.tempValue;
1731
+ this.dataFromService.push(newItem);
1732
+ }
1733
+ }).finally(() => {
1734
+ this.isLoading = false;
1735
+ this.cdr.detectChanges();
1736
+ });
1737
+ }
1738
+ extracValueFromControlBusqueda() {
1739
+ const op = this.control.config;
1740
+ let url = this.crudService.getURL(op);
1741
+ url = url.replace('@query', this.value);
1742
+ this.generalService.genericRequest(this.control.config.method, url)
1743
+ .then((res) => {
1744
+ if (res.data?.length == 1 && res.data[0][this.control.field]) {
1745
+ this.tempValue = res.data[0];
1746
+ this.value = res.data[0][this.control.field];
1747
+ }
1748
+ else
1749
+ this.setDefaultValue();
1750
+ }).finally(() => {
1751
+ this.cdr.detectChanges();
1752
+ }).catch(() => {
1753
+ this.setDefaultValue();
1754
+ });
1755
+ }
1756
+ onUpload(event) {
1757
+ this.uploadingFiles = true;
1758
+ const formData = new FormData();
1759
+ const path = this.control.config.path || 'Imagenes/CRUD/temp';
1760
+ formData.append('Ruta', `/${path}`);
1761
+ for (let i = 0; i < event.length; i++)
1762
+ formData.append(`uploadFile_${i}`, event[i]);
1763
+ const op = this.control.config;
1764
+ const url = this.crudService.getURL(op);
1765
+ this.generalService.genericRequest(this.control.config.method, url, formData)
1766
+ .then(() => {
1767
+ let separator = this.control.config?.separator || ",";
1768
+ //se asume que viene namePattern
1769
+ if (this.control.type == "string")
1770
+ this.value = event.map(f => `${this.generalService.jsonConfig.Server}${path}/${f.name}`).join(separator);
1771
+ else if (this.control.type == "array")
1772
+ this.value = event.map(f => `${this.generalService.jsonConfig.Server}${path}/${f.name}`);
1773
+ // SI NO TRAE namePattern, debe retornar un objeto con el nombre y href
1774
+ //else if (this.control.config.namePattern && this.control.type == "array") this.value = event.map(x => x.name)
1775
+ //else if (!this.control.config.namePattern && this.control.type == "array") this.value = event.map(f => `${this.generalService.jsonConfig.Server}${path}/${f.name}`)
1776
+ this.sendValue();
1777
+ let msg = !this.control.config.limit || this.control.config.limit == 1 ? "Archivo cargado correctamente!" : "Archivos cargados correctamente!";
1778
+ this.notificationService.addNotification({ severity: 'info', detail: msg }, this.primeChecking());
1779
+ })
1780
+ .catch(() => this.notificationService.addNotification({ severity: 'error', detail: `Error al cargar el archivo!` }, this.primeChecking()))
1781
+ .finally(() => this.uploadingFiles = false);
1782
+ }
1783
+ refresData() {
1784
+ if (this.control?.config?.endpointtemp)
1785
+ this.loadDataFromService();
1786
+ }
1787
+ setDefaultValue() {
1788
+ this.tempValue = {};
1789
+ if (!this.control.config.optionLabel)
1790
+ console.error("No esta bien configurado el control ", this.control);
1791
+ else
1792
+ this.tempValue[this.control.config.optionLabel] = this.value ? this.value : "";
1793
+ }
1794
+ searchValue(value) {
1795
+ const op = this.control.config;
1796
+ let url = this.crudService.getURL(op, undefined, undefined);
1797
+ url = url.replace('@id', value);
1798
+ this.generalService.genericRequest(this.control.config.method, url)
1799
+ .then((res) => {
1800
+ if (res?.data?.length > 0) {
1801
+ this.sendObject.emit({ data: res.data[0], optionValue: this.control.config.optionValue });
1802
+ }
1803
+ else {
1804
+ this.notificationService.addNotification({ severity: 'warn', detail: `Valor no encontrado.` }, this.primeChecking());
1805
+ this.sendObject.emit({ data: null, optionValue: this.control.config.optionValue });
1806
+ }
1807
+ })
1808
+ .catch(err => {
1809
+ this.notificationService.addNotification({ severity: 'error', detail: `Error al consumir el servicio.` }, this.primeChecking());
1810
+ });
1811
+ }
1812
+ primeChecking() {
1813
+ return new RequestChecking(undefined, undefined, false, undefined, undefined, false, undefined);
1814
+ }
1815
+ instanceDate() {
1816
+ const format = this.control.formatMoment;
1817
+ if (this.value) {
1818
+ if (typeof (this.value) == "string" && this.value.includes("T"))
1819
+ this.value = new Date(this.value);
1820
+ else if (typeof (this.value) == "string")
1821
+ this.value = moment(this.value, format).toDate();
1822
+ this.tempValue = moment(this.value).format("DD/MM/YYYY");
1823
+ }
1824
+ else {
1825
+ this.tempValue = null;
1826
+ this.value = null;
1827
+ }
1828
+ }
1829
+ /**
1830
+ * Cast tempValue to date
1831
+ */
1832
+ onChangeSDate($event) {
1833
+ // console.log($event)
1834
+ // console.log(this.tempValue)
1835
+ // console.log(this.value)
1836
+ const aux = moment(this.tempValue, "DD/MM/YYYY");
1837
+ if (this.tempValue == this.maskDate.replaceAll("9", "_")) {
1838
+ this.value = null;
1839
+ this.sendValue();
1840
+ }
1841
+ else if (aux.isValid()) {
1842
+ this.value = aux.toDate();
1843
+ this.sendValue();
1844
+ }
1845
+ else {
1846
+ this.tempValue = null;
1847
+ this.notificationService.addNotification({ severity: 'warn', detail: 'La fecha no es válida' }, this.primeChecking());
1848
+ }
1849
+ this.cdr.detectChanges();
1850
+ }
1851
+ onChangeDate() {
1852
+ this.tempValue = moment(this.value).format("DD/MM/YYYY");
1853
+ this.sendValue();
1854
+ }
1855
+ onTouchDescription() {
1856
+ try {
1857
+ this.tooltips.get(0)?.activate();
1858
+ }
1859
+ catch (ex) { }
1860
+ }
1861
+ onUnTouchDescription() {
1862
+ try {
1863
+ this.tooltips.get(0)?.deactivate();
1864
+ }
1865
+ catch (ex) { }
1866
+ }
1867
+ doFocusOut() {
1868
+ if (document.activeElement) {
1869
+ document.activeElement.blur();
1870
+ }
1871
+ this.cdr.detectChanges();
1872
+ }
1873
+ onClickedAddres() {
1874
+ this.addressClicked.emit();
1875
+ }
1876
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ControlComponent, deps: [{ token: GeneralService }, { token: SfCrudService }, { token: i0.ChangeDetectorRef }, { token: NotificationService }], target: i0.ɵɵFactoryTarget.Component });
1877
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: ControlComponent, isStandalone: false, selector: "sf-control", inputs: { showTempValue: "showTempValue", control: "control", label: "label", value: "value", appendTo: "appendTo" }, outputs: { setValue: "setValue", sendObject: "sendObject", addressClicked: "addressClicked" }, viewQueries: [{ propertyName: "tooltips", predicate: Tooltip, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"showTempValue\"><p *ngIf=\"tempValue\">{{tempValue[control.field]}}</p></ng-container>\r\n\r\n<div *ngIf=\"!showTempValue\" [ngSwitch]=\"control.type\" #cc class=\"control-container\">\r\n <div class=\"label-container\">\r\n <label [for]=\"label\">{{label}}</label>\r\n <i #tooltip *ngIf=\"control.tooltip\" class=\"pi pi-question-circle\"\r\n [tooltipPosition]=\"control.tooltipPosition || 'top'\" [pTooltip]=\"control.tooltip\"\r\n (touchstart)=\"onTouchDescription()\" (touchend)=\"onUnTouchDescription()\"></i>\r\n </div>\r\n\r\n <ng-container *ngSwitchCase=\"'string'\" >\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'input'\">\r\n <input pInputText [name]=\"label\" type=\"text\" [(ngModel)]=\"value\" (input)=\"sendValue()\"\r\n [disabled]=\"control.disabled || false\" [autocomplete]=\"control.autocomplete || 'off'\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <textarea [rows]=\"control.config?.rows ? control.config.rows : 4\" [(ngModel)]=\"value\"\r\n (input)=\"sendValue()\" pInputTextarea [disabled]=\"control.config?.disabled || false\"\r\n [autoResize]=\"control.config?.autoresize || false\"></textarea>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'password'\">\r\n <input pInputText type=\"password\" [(ngModel)]=\"value\" (input)=\"sendValue()\"\r\n [disabled]=\"control.disabled || false\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'email'\">\r\n <input pInputText type=\"text\" [(ngModel)]=\"value\" placeholder=\"email@example.com\"\r\n [disabled]=\"control.disabled || false\" autocomplete=\"email\" (input)=\"onInputEmail(false)\"\r\n (focusout)=\"onInputEmail(true)\" (keyup.enter)=\"doFocusOut()\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'phone'\">\r\n <p-inputMask mask=\"(999) 999-9999\" [(ngModel)]=\"value\" placeholder=\"(999) 999-9999\"\r\n [disabled]=\"control.disabled || false\" autocomplete=\"tel-national\"\r\n [unmask]=\"control.unmask || false\" (onComplete)=\"sendValue()\"></p-inputMask>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'address'\">\r\n <input pInputText type=\"text\" [value]=\"value | formatAddress: control.separador\" autocomplete=\"off\" [disabled]=\"clicked\" (keydown)=\"onClickedAddres()\" (focus)=\"onClickedAddres()\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'enum'\">\r\n <p-select [options]=\"control.enum\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\" appendTo=\"body\"\r\n placeholder=\"Seleccione una opci\u00F3n\" [disabled]=\"control.disabled || false\"></p-select>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'dropdown'\">\r\n <p-select [lazy]=\"isLoading\" [options]=\"dataFromService\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\"\r\n [optionLabel]=\"control.config.optionLabel\" [showClear]=\"control.config.showClear\"\r\n [optionValue]=\"control.field || control.config.optionValue\" appendTo=\"body\"\r\n placeholder=\"Seleccione una opci\u00F3n\" [disabled]=\"control.disabled || false\"></p-select>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'dropdown:replace'\">\r\n <p-select [lazy]=\"isLoading\" [options]=\"dataFromService\"\r\n (onChange)=\"sendValueFromObject($event)\" [optionLabel]=\"control.config.optionLabel\"\r\n appendTo=\"body\" placeholder=\"Seleccione una opci\u00F3n\"\r\n [disabled]=\"control.disabled || false\"></p-select>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'autocomplete'\">\r\n <p-autoComplete [showEmptyMessage]=\"true\" [suggestions]=\"dataFromService\" appendTo=\"body\"\r\n (completeMethod)=\"loadDataFromControlBusquedaService($event)\" [field]=\"control.field\"\r\n [minLength]=\"1\" (onSelect)=\"sendValueFromObject($event)\" [(ngModel)]=\"tempValue\"\r\n [disabled]=\"control.disabled || false\"></p-autoComplete>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'input:search'\">\r\n <div class=\"p-inputgroup\">\r\n <input type=\"text\" pInputText [(ngModel)]=\"value\" (focusout)=\"sendValue()\"\r\n (keyup.enter)=\"doFocusOut()\" />\r\n <button type=\"button\" pButton icon=\"pi pi-search\" (click)=\"searchValue(value)\"></button>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'file'\">\r\n <sf-file-upload *ngIf=\"!isLoading\" [accept]=\"control.config?.accept || 'image/*,application/pdf'\"\r\n [loading]=\"uploadingFiles\" [files]=\"uploadedFiles\" [configName]=\"control.config?.configName\"\r\n [limit]=\"control.config?.limit || 1\" (onUpload)=\"onUpload($event)\"\r\n (onDeleteFile)=\"onDeleteFile($event)\"></sf-file-upload>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'calendar'\">\r\n <!-- <div class=\"p-col-12\">\r\n <p-inputgroup>\r\n <p-inputMask [(ngModel)]=\"tempValue\" [mask]=\"maskDate\" [placeholder]=\"control.placeholder\"\r\n (onBlur)=\"onChangeSDate($event)\" [disabled]=\"control.disabled || false\"></p-inputMask>\r\n <p-calendar\r\n [(ngModel)]=\"value\" class=\"only-icon\" [monthNavigator]=\"true\" [yearNavigator]=\"true\" yearRange=\"1900:2035\"\r\n [dateFormat]=\"control.format || 'yy-mm-dd'\" appendTo=\"body\" [disabled]=\"control.disabled || false\"\r\n [showOnFocus]=\"!control.hide\" [placeholder]=\"control.placeholder || 'aaaa-mm-dd'\"\r\n [touchUI]=\"control.touchUI || false\" [showIcon]=\"control.showIcon || false\" (onSelect)=\"onChangeDate()\"\r\n (onBlur)=\"onChangeDate()\"\r\n ></p-calendar>\r\n </p-inputgroup>\r\n \r\n </div> -->\r\n <p-datepicker\r\n [(ngModel)]=\"value\" inputId=\"icondisplay\" [monthNavigator]=\"true\" [yearNavigator]=\"true\" yearRange=\"1900:2035\"\r\n [dateFormat]=\"control.format || 'yy-mm-dd'\" appendTo=\"body\" [disabled]=\"control.disabled || false\"\r\n [showOnFocus]=\"control.hide\" [placeholder]=\"control.placeholder || 'aaaa-mm-dd'\"\r\n [showIcon]=\"control.showIcon || false\" (onSelect)=\"onChangeDate()\"\r\n (onBlur)=\"onChangeDate()\" [iconDisplay]=\"'input'\" class=\"p-0\"\r\n ></p-datepicker>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'numeric'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'currency'\">\r\n <p-inputNumber [ngModel]=\"value\" (ngModelChange)=\"value = $event; sendValue()\" mode=\"decimal\" [minFractionDigits]=\"control.minFractionDigits || 0\"\r\n [min]=\"control.min || null\" [max]=\"control.max || null\" (onInput)=\"sendNumberValue($event)\"\r\n [prefix]=\"control.currency || '$ '\" [disabled]=\"control.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal'\">\r\n <p-inputNumber [ngModel]=\"value\" mode=\"decimal\" (ngModelChange)=\"value = $event; sendValue()\" [min]=\"control.min || null\"\r\n [max]=\"control.max || null\" [minFractionDigits]=\"control.minFractionDigits || 0\"\r\n [locale]=\"control.locale || undefined\" [useGrouping]=\"control.useGrouping || false\"\r\n [disabled]=\"control.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'percentage'\">\r\n <p-inputNumber [ngModel]=\"value\" suffix=\" %\" (ngModelChange)=\"value = $event; sendValue()\" (onInput)=\"sendValue()\" [min]=\"control.min || null\"\r\n [max]=\"control.max || null\" [minFractionDigits]=\"control.minFractionDigits || 2\"\r\n [locale]=\"control.locale || undefined\" [disabled]=\"control.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal:search'\">\r\n <div class=\"p-inputgroup\">\r\n <input type=\"number\" pInputText [(ngModel)]=\"value\" (focusout)=\"sendValue()\"\r\n (keyup.enter)=\"doFocusOut()\" />\r\n <button type=\"button\" pButton icon=\"pi pi-search\" (click)=\"searchValue(value)\"></button>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'array'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'file'\">\r\n <sf-file-upload *ngIf=\"!isLoading\" [loading]=\"uploadingFiles\" [files]=\"uploadedFiles\"\r\n [configName]=\"control.config?.configName\" [limit]=\"control.config?.limit || 1\"\r\n [accept]=\"control.config?.accept || 'image/*,application/pdf'\" (onUpload)=\"onUpload($event)\"\r\n (onDeleteFile)=\"onDeleteFile($event)\"></sf-file-upload>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'multiselect'\">\r\n <p-multiSelect [options]=\"dataFromService\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\"\r\n [optionLabel]=\"control.config?.optionLabel\" [optionValue]=\"control.config?.optionValue\"\r\n [placeholder]=\"control.config?.placeholder\"\r\n [display]=\"control.config?.display || 'chip'\"></p-multiSelect>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'switch'\">\r\n <p-inputSwitch [(ngModel)]=\"tempValue\" (onChange)=\"onChangeSwitch()\" [id]=\"label\"\r\n [trueValue]=\"control?.trueValue !== undefined ? control?.trueValue: null\"\r\n [falseValue]=\"control?.falseValue !== undefined ? control?.falseValue: null\"></p-inputSwitch>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n", styles: [":is() label{margin-right:10px;color:#55585b;font-size:17px}:is() i{font-size:1.1rem}::ng-deep .p-tooltip{max-width:15rem;font-size:.85rem;text-align:center}.control-container ::ng-deep .p-inputtext,.control-container ::ng-deep .p-inputwrapper,.control-container ::ng-deep .p-select,.control-container ::ng-deep .p-datepicker{width:100%}.control-container ::ng-deep .p-button:hover{background:var(--secondary-color)!important;border-color:var(--secondary-color)!important;filter:brightness(85%)}.control-container ::ng-deep .p-component,.control-container ::ng-deep .p-component *{border-radius:6px}.control-container ::ng-deep .p-inputtext{font-size:17px;border:1px solid #d1d5db;border-radius:6px}.control-container ::ng-deep .p-inputtext:focus,.control-container ::ng-deep .p-inputtext:active,.control-container ::ng-deep .p-inputwrapper:focus,.control-container ::ng-deep .p-inputwrapper:active{border-color:var(--button-color)}.control-container ::ng-deep .p-inputtext:enabled:focus{border-color:var(--secondary-color)!important;box-shadow:inset 0 0 0 1px #fff}.control-container ::ng-deep input.p-inputtext::placeholder{color:#6b7280;font-family:sans-serif;font-size:18px}.control-container ::ng-deep .p-dropdown{background:#fff;border:1px solid #d1d5db;transition:background-color .2s,color .2s,border-color .2s,box-shadow .2s;border-radius:6px}.control-container ::ng-deep .p-dropdown:not(.p-disabled):hover{border-color:var(--secondary-color)!important}.control-container ::ng-deep .p-dropdown:not(.p-disabled).p-focus{border-color:var(--secondary-color)!important;box-shadow:inset 0 0 0 1px #fff}.control-container ::ng-deep .p-dropdown .p-inputtext{border:none}.control-container ::ng-deep .p-dropdown .p-dropdown-label.p-placeholder{font-family:sans-serif;color:#6b7280}.control-container ::ng-deep .p-button.p-button-danger,.control-container ::ng-deep .p-buttonset.p-button-danger>.p-button,.control-container ::ng-deep .p-splitbutton.p-button-danger>.p-button{border-color:var(--secondary-color)!important;background:var(--secondary-color)!important}.control-container ::ng-deep .p-inputgroup button:last-child{border-top-right-radius:6px;border-bottom-right-radius:6px}.control-container ::ng-deep .p-inputgroup input:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.control-container ::ng-deep .p-inputgroup input:first-child{border-top-left-radius:6px;border-bottom-left-radius:6px}.control-container ::ng-deep .p-datepicker{padding:0}.control-container ::ng-deep .p-datepicker-touch-ui .p-datepicker-title{padding:0}.control-container ::ng-deep .p-datepicker-month,.control-container ::ng-deep .p-datepicker-month:focus,.control-container ::ng-deep .p-datepicker-year:focus,.control-container ::ng-deep .p-datepicker-year{border:none}::ng-deep .d-none{display:none!important}.p-inputgroup p-calendar{display:contents}.p-inputgroup p-calendar ::ng-deep input{display:none!important}.p-inputgroup p-calendar ::ng-deep .p-button-icon-only{border-top-left-radius:0;border-bottom-left-radius:0;width:100%;height:100%}.p-inputgroup p-inputMask{display:contents}.p-inputgroup p-inputMask ::ng-deep input{border-top-right-radius:0;border-bottom-right-radius:0}@media (max-width <=768px){:host{font-size:14px}}\n"], dependencies: [{ kind: "component", type: i4.AutoComplete, selector: "p-autoComplete, p-autocomplete, p-auto-complete", inputs: ["minLength", "delay", "style", "panelStyle", "styleClass", "panelStyleClass", "inputStyle", "inputId", "inputStyleClass", "placeholder", "readonly", "disabled", "scrollHeight", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "maxlength", "name", "required", "size", "appendTo", "autoHighlight", "forceSelection", "type", "autoZIndex", "baseZIndex", "ariaLabel", "dropdownAriaLabel", "ariaLabelledBy", "dropdownIcon", "unique", "group", "completeOnFocus", "showClear", "field", "dropdown", "showEmptyMessage", "dropdownMode", "multiple", "tabindex", "dataKey", "emptyMessage", "showTransitionOptions", "hideTransitionOptions", "autofocus", "autocomplete", "optionGroupChildren", "optionGroupLabel", "overlayOptions", "suggestions", "itemSize", "optionLabel", "optionValue", "id", "searchMessage", "emptySelectionMessage", "selectionMessage", "autoOptionFocus", "selectOnFocus", "searchLocale", "optionDisabled", "focusOnHover", "typeahead", "variant", "fluid"], outputs: ["completeMethod", "onSelect", "onUnselect", "onFocus", "onBlur", "onDropdownClick", "onClear", "onKeyUp", "onShow", "onHide", "onLazyLoad"] }, { kind: "directive", type: i8.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i6.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "size", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "directive", type: i7$1.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: i7$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i7$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i7$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i8$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i8$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i8$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i9$1.InputMask, selector: "p-inputmask, p-inputMask, p-input-mask", inputs: ["type", "slotChar", "autoClear", "showClear", "style", "inputId", "styleClass", "placeholder", "size", "maxlength", "tabindex", "title", "variant", "ariaLabel", "ariaLabelledBy", "ariaRequired", "disabled", "readonly", "unmask", "name", "required", "characterPattern", "autofocus", "autoFocus", "autocomplete", "keepBuffer", "mask"], outputs: ["onComplete", "onFocus", "onBlur", "onInput", "onKeydown", "onClear"] }, { kind: "component", type: i10$1.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "component", type: i11$1.InputSwitch, selector: "p-inputSwitch, p-inputswitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "trueValue", "falseValue", "ariaLabel", "ariaLabelledBy", "autofocus"], outputs: ["onChange"] }, { kind: "directive", type: i11.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "component", type: i13$1.MultiSelect, selector: "p-multiSelect, p-multiselect, p-multi-select", inputs: ["id", "ariaLabel", "style", "styleClass", "panelStyle", "panelStyleClass", "inputId", "disabled", "fluid", "readonly", "group", "filter", "filterPlaceHolder", "filterLocale", "overlayVisible", "tabindex", "variant", "appendTo", "dataKey", "name", "ariaLabelledBy", "displaySelectedLabel", "maxSelectedLabels", "selectionLimit", "selectedItemsLabel", "showToggleAll", "emptyFilterMessage", "emptyMessage", "resetFilterOnHide", "dropdownIcon", "chipIcon", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "showHeader", "filterBy", "scrollHeight", "lazy", "virtualScroll", "loading", "virtualScrollItemSize", "loadingIcon", "virtualScrollOptions", "overlayOptions", "ariaFilterLabel", "filterMatchMode", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "autofocusFilter", "display", "autocomplete", "size", "showClear", "autofocus", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "defaultLabel", "placeholder", "options", "filterValue", "itemSize", "selectAll", "focusOnHover", "filterFields", "selectOnFocus", "autoOptionFocus"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onClear", "onPanelShow", "onPanelHide", "onLazyLoad", "onRemove", "onSelectAllChange"] }, { kind: "component", type: i14$1.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "directive", type: i15$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: FileUploadComponent, selector: "sf-file-upload", inputs: ["limit", "files", "loading", "configName", "accept"], outputs: ["onUpload", "onDeleteFile"] }, { kind: "pipe", type: FormatAddressPipe, name: "formatAddress" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1878
+ }
1879
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: ControlComponent, decorators: [{
1880
+ type: Component,
1881
+ args: [{ selector: 'sf-control', changeDetection: ChangeDetectionStrategy.OnPush, standalone: false, template: "<ng-container *ngIf=\"showTempValue\"><p *ngIf=\"tempValue\">{{tempValue[control.field]}}</p></ng-container>\r\n\r\n<div *ngIf=\"!showTempValue\" [ngSwitch]=\"control.type\" #cc class=\"control-container\">\r\n <div class=\"label-container\">\r\n <label [for]=\"label\">{{label}}</label>\r\n <i #tooltip *ngIf=\"control.tooltip\" class=\"pi pi-question-circle\"\r\n [tooltipPosition]=\"control.tooltipPosition || 'top'\" [pTooltip]=\"control.tooltip\"\r\n (touchstart)=\"onTouchDescription()\" (touchend)=\"onUnTouchDescription()\"></i>\r\n </div>\r\n\r\n <ng-container *ngSwitchCase=\"'string'\" >\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'input'\">\r\n <input pInputText [name]=\"label\" type=\"text\" [(ngModel)]=\"value\" (input)=\"sendValue()\"\r\n [disabled]=\"control.disabled || false\" [autocomplete]=\"control.autocomplete || 'off'\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <textarea [rows]=\"control.config?.rows ? control.config.rows : 4\" [(ngModel)]=\"value\"\r\n (input)=\"sendValue()\" pInputTextarea [disabled]=\"control.config?.disabled || false\"\r\n [autoResize]=\"control.config?.autoresize || false\"></textarea>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'password'\">\r\n <input pInputText type=\"password\" [(ngModel)]=\"value\" (input)=\"sendValue()\"\r\n [disabled]=\"control.disabled || false\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'email'\">\r\n <input pInputText type=\"text\" [(ngModel)]=\"value\" placeholder=\"email@example.com\"\r\n [disabled]=\"control.disabled || false\" autocomplete=\"email\" (input)=\"onInputEmail(false)\"\r\n (focusout)=\"onInputEmail(true)\" (keyup.enter)=\"doFocusOut()\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'phone'\">\r\n <p-inputMask mask=\"(999) 999-9999\" [(ngModel)]=\"value\" placeholder=\"(999) 999-9999\"\r\n [disabled]=\"control.disabled || false\" autocomplete=\"tel-national\"\r\n [unmask]=\"control.unmask || false\" (onComplete)=\"sendValue()\"></p-inputMask>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'address'\">\r\n <input pInputText type=\"text\" [value]=\"value | formatAddress: control.separador\" autocomplete=\"off\" [disabled]=\"clicked\" (keydown)=\"onClickedAddres()\" (focus)=\"onClickedAddres()\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'enum'\">\r\n <p-select [options]=\"control.enum\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\" appendTo=\"body\"\r\n placeholder=\"Seleccione una opci\u00F3n\" [disabled]=\"control.disabled || false\"></p-select>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'dropdown'\">\r\n <p-select [lazy]=\"isLoading\" [options]=\"dataFromService\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\"\r\n [optionLabel]=\"control.config.optionLabel\" [showClear]=\"control.config.showClear\"\r\n [optionValue]=\"control.field || control.config.optionValue\" appendTo=\"body\"\r\n placeholder=\"Seleccione una opci\u00F3n\" [disabled]=\"control.disabled || false\"></p-select>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'dropdown:replace'\">\r\n <p-select [lazy]=\"isLoading\" [options]=\"dataFromService\"\r\n (onChange)=\"sendValueFromObject($event)\" [optionLabel]=\"control.config.optionLabel\"\r\n appendTo=\"body\" placeholder=\"Seleccione una opci\u00F3n\"\r\n [disabled]=\"control.disabled || false\"></p-select>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'autocomplete'\">\r\n <p-autoComplete [showEmptyMessage]=\"true\" [suggestions]=\"dataFromService\" appendTo=\"body\"\r\n (completeMethod)=\"loadDataFromControlBusquedaService($event)\" [field]=\"control.field\"\r\n [minLength]=\"1\" (onSelect)=\"sendValueFromObject($event)\" [(ngModel)]=\"tempValue\"\r\n [disabled]=\"control.disabled || false\"></p-autoComplete>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'input:search'\">\r\n <div class=\"p-inputgroup\">\r\n <input type=\"text\" pInputText [(ngModel)]=\"value\" (focusout)=\"sendValue()\"\r\n (keyup.enter)=\"doFocusOut()\" />\r\n <button type=\"button\" pButton icon=\"pi pi-search\" (click)=\"searchValue(value)\"></button>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'file'\">\r\n <sf-file-upload *ngIf=\"!isLoading\" [accept]=\"control.config?.accept || 'image/*,application/pdf'\"\r\n [loading]=\"uploadingFiles\" [files]=\"uploadedFiles\" [configName]=\"control.config?.configName\"\r\n [limit]=\"control.config?.limit || 1\" (onUpload)=\"onUpload($event)\"\r\n (onDeleteFile)=\"onDeleteFile($event)\"></sf-file-upload>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'calendar'\">\r\n <!-- <div class=\"p-col-12\">\r\n <p-inputgroup>\r\n <p-inputMask [(ngModel)]=\"tempValue\" [mask]=\"maskDate\" [placeholder]=\"control.placeholder\"\r\n (onBlur)=\"onChangeSDate($event)\" [disabled]=\"control.disabled || false\"></p-inputMask>\r\n <p-calendar\r\n [(ngModel)]=\"value\" class=\"only-icon\" [monthNavigator]=\"true\" [yearNavigator]=\"true\" yearRange=\"1900:2035\"\r\n [dateFormat]=\"control.format || 'yy-mm-dd'\" appendTo=\"body\" [disabled]=\"control.disabled || false\"\r\n [showOnFocus]=\"!control.hide\" [placeholder]=\"control.placeholder || 'aaaa-mm-dd'\"\r\n [touchUI]=\"control.touchUI || false\" [showIcon]=\"control.showIcon || false\" (onSelect)=\"onChangeDate()\"\r\n (onBlur)=\"onChangeDate()\"\r\n ></p-calendar>\r\n </p-inputgroup>\r\n \r\n </div> -->\r\n <p-datepicker\r\n [(ngModel)]=\"value\" inputId=\"icondisplay\" [monthNavigator]=\"true\" [yearNavigator]=\"true\" yearRange=\"1900:2035\"\r\n [dateFormat]=\"control.format || 'yy-mm-dd'\" appendTo=\"body\" [disabled]=\"control.disabled || false\"\r\n [showOnFocus]=\"control.hide\" [placeholder]=\"control.placeholder || 'aaaa-mm-dd'\"\r\n [showIcon]=\"control.showIcon || false\" (onSelect)=\"onChangeDate()\"\r\n (onBlur)=\"onChangeDate()\" [iconDisplay]=\"'input'\" class=\"p-0\"\r\n ></p-datepicker>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'numeric'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'currency'\">\r\n <p-inputNumber [ngModel]=\"value\" (ngModelChange)=\"value = $event; sendValue()\" mode=\"decimal\" [minFractionDigits]=\"control.minFractionDigits || 0\"\r\n [min]=\"control.min || null\" [max]=\"control.max || null\" (onInput)=\"sendNumberValue($event)\"\r\n [prefix]=\"control.currency || '$ '\" [disabled]=\"control.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal'\">\r\n <p-inputNumber [ngModel]=\"value\" mode=\"decimal\" (ngModelChange)=\"value = $event; sendValue()\" [min]=\"control.min || null\"\r\n [max]=\"control.max || null\" [minFractionDigits]=\"control.minFractionDigits || 0\"\r\n [locale]=\"control.locale || undefined\" [useGrouping]=\"control.useGrouping || false\"\r\n [disabled]=\"control.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'percentage'\">\r\n <p-inputNumber [ngModel]=\"value\" suffix=\" %\" (ngModelChange)=\"value = $event; sendValue()\" (onInput)=\"sendValue()\" [min]=\"control.min || null\"\r\n [max]=\"control.max || null\" [minFractionDigits]=\"control.minFractionDigits || 2\"\r\n [locale]=\"control.locale || undefined\" [disabled]=\"control.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal:search'\">\r\n <div class=\"p-inputgroup\">\r\n <input type=\"number\" pInputText [(ngModel)]=\"value\" (focusout)=\"sendValue()\"\r\n (keyup.enter)=\"doFocusOut()\" />\r\n <button type=\"button\" pButton icon=\"pi pi-search\" (click)=\"searchValue(value)\"></button>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'array'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'file'\">\r\n <sf-file-upload *ngIf=\"!isLoading\" [loading]=\"uploadingFiles\" [files]=\"uploadedFiles\"\r\n [configName]=\"control.config?.configName\" [limit]=\"control.config?.limit || 1\"\r\n [accept]=\"control.config?.accept || 'image/*,application/pdf'\" (onUpload)=\"onUpload($event)\"\r\n (onDeleteFile)=\"onDeleteFile($event)\"></sf-file-upload>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'multiselect'\">\r\n <p-multiSelect [options]=\"dataFromService\" [(ngModel)]=\"value\" (onChange)=\"sendValue()\"\r\n [optionLabel]=\"control.config?.optionLabel\" [optionValue]=\"control.config?.optionValue\"\r\n [placeholder]=\"control.config?.placeholder\"\r\n [display]=\"control.config?.display || 'chip'\"></p-multiSelect>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'switch'\">\r\n <p-inputSwitch [(ngModel)]=\"tempValue\" (onChange)=\"onChangeSwitch()\" [id]=\"label\"\r\n [trueValue]=\"control?.trueValue !== undefined ? control?.trueValue: null\"\r\n [falseValue]=\"control?.falseValue !== undefined ? control?.falseValue: null\"></p-inputSwitch>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n", styles: [":is() label{margin-right:10px;color:#55585b;font-size:17px}:is() i{font-size:1.1rem}::ng-deep .p-tooltip{max-width:15rem;font-size:.85rem;text-align:center}.control-container ::ng-deep .p-inputtext,.control-container ::ng-deep .p-inputwrapper,.control-container ::ng-deep .p-select,.control-container ::ng-deep .p-datepicker{width:100%}.control-container ::ng-deep .p-button:hover{background:var(--secondary-color)!important;border-color:var(--secondary-color)!important;filter:brightness(85%)}.control-container ::ng-deep .p-component,.control-container ::ng-deep .p-component *{border-radius:6px}.control-container ::ng-deep .p-inputtext{font-size:17px;border:1px solid #d1d5db;border-radius:6px}.control-container ::ng-deep .p-inputtext:focus,.control-container ::ng-deep .p-inputtext:active,.control-container ::ng-deep .p-inputwrapper:focus,.control-container ::ng-deep .p-inputwrapper:active{border-color:var(--button-color)}.control-container ::ng-deep .p-inputtext:enabled:focus{border-color:var(--secondary-color)!important;box-shadow:inset 0 0 0 1px #fff}.control-container ::ng-deep input.p-inputtext::placeholder{color:#6b7280;font-family:sans-serif;font-size:18px}.control-container ::ng-deep .p-dropdown{background:#fff;border:1px solid #d1d5db;transition:background-color .2s,color .2s,border-color .2s,box-shadow .2s;border-radius:6px}.control-container ::ng-deep .p-dropdown:not(.p-disabled):hover{border-color:var(--secondary-color)!important}.control-container ::ng-deep .p-dropdown:not(.p-disabled).p-focus{border-color:var(--secondary-color)!important;box-shadow:inset 0 0 0 1px #fff}.control-container ::ng-deep .p-dropdown .p-inputtext{border:none}.control-container ::ng-deep .p-dropdown .p-dropdown-label.p-placeholder{font-family:sans-serif;color:#6b7280}.control-container ::ng-deep .p-button.p-button-danger,.control-container ::ng-deep .p-buttonset.p-button-danger>.p-button,.control-container ::ng-deep .p-splitbutton.p-button-danger>.p-button{border-color:var(--secondary-color)!important;background:var(--secondary-color)!important}.control-container ::ng-deep .p-inputgroup button:last-child{border-top-right-radius:6px;border-bottom-right-radius:6px}.control-container ::ng-deep .p-inputgroup input:last-child{border-top-right-radius:0;border-bottom-right-radius:0}.control-container ::ng-deep .p-inputgroup input:first-child{border-top-left-radius:6px;border-bottom-left-radius:6px}.control-container ::ng-deep .p-datepicker{padding:0}.control-container ::ng-deep .p-datepicker-touch-ui .p-datepicker-title{padding:0}.control-container ::ng-deep .p-datepicker-month,.control-container ::ng-deep .p-datepicker-month:focus,.control-container ::ng-deep .p-datepicker-year:focus,.control-container ::ng-deep .p-datepicker-year{border:none}::ng-deep .d-none{display:none!important}.p-inputgroup p-calendar{display:contents}.p-inputgroup p-calendar ::ng-deep input{display:none!important}.p-inputgroup p-calendar ::ng-deep .p-button-icon-only{border-top-left-radius:0;border-bottom-left-radius:0;width:100%;height:100%}.p-inputgroup p-inputMask{display:contents}.p-inputgroup p-inputMask ::ng-deep input{border-top-right-radius:0;border-bottom-right-radius:0}@media (max-width <=768px){:host{font-size:14px}}\n"] }]
1882
+ }], ctorParameters: () => [{ type: GeneralService }, { type: SfCrudService }, { type: i0.ChangeDetectorRef }, { type: NotificationService }], propDecorators: { showTempValue: [{
1883
+ type: Input
1884
+ }], control: [{
1885
+ type: Input
1886
+ }], label: [{
1887
+ type: Input
1888
+ }], value: [{
1889
+ type: Input
1890
+ }], appendTo: [{
1891
+ type: Input
1892
+ }], setValue: [{
1893
+ type: Output
1894
+ }], sendObject: [{
1895
+ type: Output
1896
+ }], addressClicked: [{
1897
+ type: Output
1898
+ }], tooltips: [{
1899
+ type: ViewChildren,
1900
+ args: [Tooltip]
1901
+ }] } });
1902
+
1903
+ class FormComponent {
1904
+ messageService;
1905
+ crudService;
1906
+ domSanitizer;
1907
+ stepService;
1908
+ adoService;
1909
+ jwtService;
1910
+ uiEsquema;
1911
+ esquema;
1912
+ data;
1913
+ isDialog = false;
1914
+ isAddressDialog = false;
1915
+ separador;
1916
+ newAddress;
1917
+ currentAddress;
1918
+ registro;
1919
+ values;
1920
+ controls;
1921
+ controlsLoaded = false;
1922
+ idKatios;
1923
+ visible;
1924
+ isMobile = false;
1925
+ urlADO;
1926
+ proceso;
1927
+ loading;
1928
+ tooltips;
1929
+ constructor(messageService, crudService, domSanitizer, stepService, adoService, jwtService) {
1930
+ this.messageService = messageService;
1931
+ this.crudService = crudService;
1932
+ this.domSanitizer = domSanitizer;
1933
+ this.stepService = stepService;
1934
+ this.adoService = adoService;
1935
+ this.jwtService = jwtService;
1936
+ this.loading = { inProgress: true, target: undefined };
1937
+ if (window.innerWidth <= 768)
1938
+ this.isMobile = true;
1939
+ window.addEventListener('resize', () => {
1940
+ if (window.innerWidth <= 768)
1941
+ this.isMobile = true;
1942
+ });
1943
+ }
1944
+ ngOnChanges(changes) {
1945
+ this.buildControls();
1946
+ }
1947
+ ngOnInit() {
1948
+ try {
1949
+ if (this.isAddressDialog)
1950
+ this.currentAddress = this.data.currentValue;
1951
+ this.jwtService.idKatios = this.crudService.idKatios;
1952
+ this.jwtService.servidorIntegraciones = this.crudService.environment.ServidorIntegraciones;
1953
+ this.adoService.servidorIntegraciones = this.crudService.environment.ServidorIntegraciones;
1954
+ this.idKatios = this.crudService.idKatios;
1955
+ this.stepService.requestApproved$.subscribe((approved) => {
1956
+ if (!this.isDialog && approved) {
1957
+ this.uiEsquema = this.crudService.getUIEsquema(this.stepService.currentIndex);
1958
+ this.esquema = this.crudService.getEsquema(this.stepService.currentIndex);
1959
+ this.data = this.crudService.getData(this.stepService.currentIndex);
1960
+ this.registro = this.crudService.getRegistro(this.stepService.currentIndex);
1961
+ this.buildControls();
1962
+ }
1963
+ });
1964
+ }
1965
+ catch (error) {
1966
+ console.error(error);
1967
+ }
1968
+ }
1969
+ emitLoadingForm($event) {
1970
+ this.loading.inProgress = $event;
1971
+ Promise.resolve().then(() => this.crudService.formLoading = this.loading); //si no se usa asi el enproceso totea con el simulador
1972
+ }
1973
+ buildControls() {
1974
+ this.visible = [];
1975
+ this.controlsLoaded = false;
1976
+ this.controls = [];
1977
+ this.values = [];
1978
+ //address
1979
+ if (this.isAddressDialog)
1980
+ this.newAddress = this.crudService.armarNuevaDireccion("string", this.data, this.crudService.getValue("$..separador", this.data));
1981
+ this.uiEsquema.elements.forEach((layout, i) => {
1982
+ let isVisible = layout.conditions ? this.crudService.isConditionsCompleted(layout.conditions, this.registro.conditions || [], this.data) : true;
1983
+ this.visible.push(layout.elements ? layout.elements.map(() => isVisible) : [isVisible]);
1984
+ this.controls.push([]);
1985
+ this.values.push([]);
1986
+ layout.elements?.forEach((element, j) => {
1987
+ if (element.conditions)
1988
+ this.visible[i][j] = this.crudService.isConditionsCompleted(element.conditions, this.registro.conditions || [], this.data);
1989
+ if (element.ngStyle && typeof (element.ngStyle) == "string")
1990
+ element.ngStyle = JSON.parse(element.ngStyle);
1991
+ if (element.url) {
1992
+ this.controls[i].push(undefined);
1993
+ let url = this.crudService.applyStringKeys(element.url);
1994
+ this.values[i].push(this.domSanitizer.bypassSecurityTrustResourceUrl(url));
1995
+ }
1996
+ else if (!element.scope) {
1997
+ this.controls[i].push(undefined);
1998
+ this.values[i].push(undefined);
1999
+ }
2000
+ else {
2001
+ try {
2002
+ this.controls[i].push(this.crudService.getControl(element.scope, this.esquema));
2003
+ this.controls[i][j].scope = element.scope;
2004
+ this.values[i].push(this.crudService.getValue(element.scope, this.data));
2005
+ }
2006
+ catch (e) {
2007
+ console.log(element);
2008
+ console.error(e);
2009
+ console.log(this.controls[i]);
2010
+ console.log(this.values[i]);
2011
+ }
2012
+ }
2013
+ });
2014
+ });
2015
+ this.controlsLoaded = true;
2016
+ let idProceso = this.data.ADO?.dataProceso?.idProceso;
2017
+ if (idProceso && this.proceso?.id != idProceso)
2018
+ this.refreshIntegracion(idProceso);
2019
+ }
2020
+ refreshIntegracion(idProceso) {
2021
+ this.emitLoadingForm(true);
2022
+ return Promise.all([
2023
+ this.adoService.getProceso(idProceso).then((proceso) => {
2024
+ this.proceso = proceso;
2025
+ this.data.ADO.proceso = this.proceso;
2026
+ })
2027
+ ])
2028
+ .finally(() => this.emitLoadingForm(false));
2029
+ }
2030
+ extracControlFromTableElements(i, j, col) {
2031
+ const property = this.controls[i][j].properties[col.col];
2032
+ return property;
2033
+ }
2034
+ extracValueFromTableElements(i, j, k, col) {
2035
+ const value = this.values[i][j][k][col.col];
2036
+ return value;
2037
+ }
2038
+ setValue(value, scope, i, j) {
2039
+ scope = scope.replaceAll('..properties', '');
2040
+ if (scope) {
2041
+ let control = this.controls[i][j];
2042
+ this.values[i][j] = value;
2043
+ jsonpath.value(this.data, scope, value);
2044
+ this.crudService.changeData = new ChangeData(value, scope, this.crudService.index);
2045
+ this.uiEsquema.elements.forEach((layout, iLayout) => {
2046
+ if (layout.conditions) {
2047
+ let isVisible = this.crudService.isConditionsCompleted(layout.conditions, this.crudService.getRegistro(this.crudService.index).conditions || [], this.data);
2048
+ if (layout.elements)
2049
+ this.visible[iLayout] = layout.elements.map(() => isVisible);
2050
+ else
2051
+ this.visible[iLayout][0] = isVisible;
2052
+ }
2053
+ layout.elements?.forEach((element, indexEl) => {
2054
+ if (element.conditions) {
2055
+ this.visible[iLayout][indexEl] = this.crudService.isConditionsCompleted(element.conditions, this.registro.conditions || [], this.data);
2056
+ }
2057
+ });
2058
+ });
2059
+ control.applyKeys?.forEach((i) => {
2060
+ let key = this.registro.keys ? this.registro.keys[i] : undefined;
2061
+ if (key)
2062
+ this.crudService.applyKey(key, this.registro, key.indexData ? this.crudService.getData(key.indexData) : this.data);
2063
+ });
2064
+ this.buildControls();
2065
+ }
2066
+ this.crudService.applyValuesOnEvent('onChange', this.esquema, undefined, this.data);
2067
+ }
2068
+ sendNotification(message) {
2069
+ this.messageService.add(message);
2070
+ }
2071
+ applyValuesFromObject(event) {
2072
+ if (event.optionValue) {
2073
+ for (let i = 0; i < event.optionValue.length; i++) {
2074
+ const optionVal = event.optionValue[i];
2075
+ const newVal = event.data ? this.aplyFormatValue(optionVal.scope, event.data[optionVal.key]) : null;
2076
+ jsonpath.value(this.data, optionVal.scope.replace('.properties', ''), this.aplyFormatValue(optionVal.scope, event.data[optionVal.key]));
2077
+ this.setValueByScope(optionVal.scope, newVal);
2078
+ }
2079
+ }
2080
+ }
2081
+ setValueByScope(scope, newVal) {
2082
+ for (let i = 0; i < this.controls.length; i++) {
2083
+ const row = this.controls[i];
2084
+ row.forEach((el, j) => {
2085
+ if (el.scope && el.scope.replace('.properties', '') == scope.replace('.properties', '')) {
2086
+ this.values[i][j] = newVal;
2087
+ }
2088
+ });
2089
+ }
2090
+ }
2091
+ aplyFormatValue(scope, value) {
2092
+ const control = jsonpath.query(this.esquema, scope)[0];
2093
+ let resp;
2094
+ switch (control.type) {
2095
+ case 'date':
2096
+ resp = new Date(`${value}`);
2097
+ break;
2098
+ case 'numeric':
2099
+ resp = +value;
2100
+ break;
2101
+ default:
2102
+ resp = value;
2103
+ break;
2104
+ }
2105
+ return resp;
2106
+ }
2107
+ editRow(element, data, index) {
2108
+ this.stepService.addCustomChildrenEvent("onClickedEditButton", { element, data, index });
2109
+ }
2110
+ deleteRow(element, index) {
2111
+ this.stepService.addCustomChildrenEvent("onClickedDeleteButton", { element, index });
2112
+ }
2113
+ addObjectArray(element) {
2114
+ this.stepService.addCustomChildrenEvent("onClickedAddButton", { element });
2115
+ }
2116
+ openPopUpDireccion(scope) {
2117
+ this.stepService.addCustomChildrenEvent("onClickedAddress", { scope });
2118
+ }
2119
+ onStateDocument(state) {
2120
+ this.data.pdf.signed = state.toUpperCase() == "FIRMADO";
2121
+ }
2122
+ onSimuladorChange($event) {
2123
+ Promise.resolve().then(() => Object.assign(this.data, $event));
2124
+ }
2125
+ goToADO() {
2126
+ let url = window.location.href;
2127
+ let callback = url.split('?')[0] + `?id=${this.data.idForm}`;
2128
+ let idProceso = this.data.ADO.dataProceso?.idProceso;
2129
+ let dataProceso = this.data.ADO.dataProceso;
2130
+ dataProceso.ctivo = this.data.idForm;
2131
+ //this.data.ADO.idTransaction = null
2132
+ //this.data.ADO.idProceso = null
2133
+ if (idProceso) {
2134
+ window.location.href = `${this.crudService.environment.WebUtilities}GWV/ADO/${this.crudService.idKatios}?id=${idProceso}`;
2135
+ window.location.reload();
2136
+ }
2137
+ else if (dataProceso) {
2138
+ window.location.href = `${this.crudService.environment.WebUtilities}GWV/ADO/${this.crudService.idKatios}?dataProceso=${btoa(JSON.stringify(dataProceso))}&callback=${encodeURIComponent(callback)}`;
2139
+ window.location.reload();
2140
+ }
2141
+ }
2142
+ onTouchDescription(id, alignRight = true) {
2143
+ const foundTooltip = this.tooltips.find(tooltip => tooltip.el.nativeElement.id === id);
2144
+ try {
2145
+ foundTooltip.activate();
2146
+ alignRight ? foundTooltip.alignRight() : foundTooltip.alignTop();
2147
+ }
2148
+ catch (ex) { }
2149
+ }
2150
+ onUnTouchDescription(descripcion) {
2151
+ const foundTooltip = this.tooltips.find(tooltip => tooltip.el.nativeElement.id === descripcion);
2152
+ try {
2153
+ foundTooltip.deactivate();
2154
+ }
2155
+ catch (ex) { }
2156
+ }
2157
+ copyToClipboard(idProceso) {
2158
+ let url = `${this.crudService.environment.WebUtilities}GWV/ADO/${this.crudService.idKatios}?id=${idProceso}`;
2159
+ navigator.clipboard.writeText(url);
2160
+ }
2161
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FormComponent, deps: [{ token: i1$1.MessageService }, { token: SfCrudService }, { token: i3.DomSanitizer }, { token: StepService }, { token: i5$1.AdoService }, { token: i5$1.JWTService }], target: i0.ɵɵFactoryTarget.Component });
2162
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: FormComponent, isStandalone: false, selector: "app-form", inputs: { uiEsquema: "uiEsquema", esquema: "esquema", data: "data", isDialog: "isDialog", isAddressDialog: "isAddressDialog", separador: "separador" }, viewQueries: [{ propertyName: "tooltips", predicate: Tooltip, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"controlsLoaded\" class=\"frm-container\">\r\n <ng-container *ngIf=\"isAddressDialog && currentAddress\">\r\n Direcci\u00F3n actual: {{currentAddress | formatAddress: separador}}\r\n <br>\r\n </ng-container>\r\n <br>\r\n <ng-container *ngIf=\"isAddressDialog\">\r\n Direcci\u00F3n nueva: {{newAddress | formatAddress: separador}}\r\n </ng-container>\r\n <div *ngFor=\"let element of uiEsquema.elements; let i = index\" [class]=\"element?.class\" #a>\r\n <ng-container [ngSwitch]=\"element.type\" *ngIf=\"visible[i][0]\">\r\n <div class=\"label\" *ngSwitchCase=\"'Label'\" [style]=\"element?.style\">\r\n {{element?.label}}\r\n </div>\r\n <ng-container *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div *ngFor=\"let el of element.elements; let j =index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\" *ngIf=\"visible[i][j]\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\"\r\n [value]=\"values[i][j]\" (setValue)=\"setValue($event, el.scope, i, j)\"\r\n (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"\r\n (addressClicked)=\"openPopUpDireccion(el.scope)\"></sf-control>\r\n <div *ngSwitchCase=\"'Texto'\" [ngStyle]=\"{'height': '100%', 'margin-block': 'auto'}\">\r\n <p>{{el.label}}</p>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'VerticalLayout'\">\r\n <div *ngFor=\"let el of element.elements; let j =index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\" *ngIf=\"visible[i][j]\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\"\r\n [value]=\"values[i][j]\" (setValue)=\"setValue($event, el.scope, i, j)\"\r\n (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"\r\n (addressClicked)=\"openPopUpDireccion(el.scope)\"></sf-control>\r\n <div *ngSwitchCase=\"'PDF'\" class=\"pdf\">\r\n <iframe [src]=\"values[i][j]\" frameborder=\"0\" allow=\"geolocation *; camera *;\"></iframe>\r\n </div>\r\n <div *ngSwitchCase=\"'PDF-SIGN'\">\r\n <sf-sign [allowDownload]=\"true\" [idkatios]=\"idKatios\" [tdoc]=\"data.pdf.tdoc\" [ndoc]=\"data.pdf.ndoc\"\r\n [idDocument]=\"data.pdf.id\" [typeDocument]=\"data.pdf.idDoc\"\r\n (stateDocument)=\"onStateDocument($event)\"></sf-sign>\r\n </div>\r\n <ng-container *ngSwitchCase=\"'SIMULADOR'\">\r\n <sf-simulador [simulador]=\"data\" [otherToolTips]=\"data.otherTooltips\"\r\n (simuladorChange)=\"onSimuladorChange($event)\" (enProceso)=\"emitLoadingForm($event)\"></sf-simulador>\r\n </ng-container>\r\n <div *ngSwitchCase=\"'ADO'\" class=\"buttons\">\r\n <p-button *ngIf=\"!data?.ADO?.dataProceso?.idProceso\" [ngStyle]=\"el?.ngStyle\" (click)=\"goToADO()\" label=\"Validar identidad\"></p-button>\r\n </div>\r\n <div *ngSwitchCase=\"'ADO'\">\r\n <div *ngIf=\"data?.ADO?.dataProceso?.idProceso\">\r\n <div class=\"data-ado-container\">\r\n <ng-container *ngIf=\"proceso\">\r\n <i *ngIf=\"proceso?.respuestaProceso?.EsExitoso === true\" pTooltip=\"Validado\" tooltipPosition=\"top\" id=\"Validado\" class=\"pi pi-user\" style=\"color: green\"\r\n (touchstart)=\"onTouchDescription('Validado', false)\" (touchend)=\"onUnTouchDescription('Validado')\"></i>\r\n <i *ngIf=\"proceso?.respuestaProceso?.EsExitoso === false\" pTooltip=\"No validado\" tooltipPosition=\"top\" id=\"No-Validado\" class=\"pi pi-user\" style=\"color: red\"\r\n (touchstart)=\"onTouchDescription('No-Validado', false)\" (touchend)=\"onUnTouchDescription('No-Validado')\"></i>\r\n <i *ngIf=\"!proceso?.respuestaProceso\" pTooltip=\"Sin validar\" tooltipPosition=\"top\" class=\"pi pi-user\" id=\"Sin-Validar\" style=\"color: gray\"\r\n (touchstart)=\"onTouchDescription('Sin-Validar', false)\" (touchend)=\"onUnTouchDescription('Sin-Validar')\"></i>\r\n </ng-container>\r\n <div class=\"buttons\">\r\n <button pButton icon=\"pi pi-external-link\" (click)=\"goToADO()\" pTooltip=\"Abrir\" [disabled]=\"!proceso\"></button>\r\n <button pButton icon=\"pi pi-copy\" (click)=\"copyToClipboard(proceso.id)\" pTooltip=\"Copiar\" [disabled]=\"!proceso\"></button>\r\n <button pButton icon=\"pi pi-refresh\" (click)=\"refreshIntegracion(proceso.id)\" pTooltip=\"Refrescar\" [disabled]=\"!proceso\"></button>\r\n </div>\r\n </div>\r\n <p class=\"result-ado\" *ngIf=\"proceso && !proceso.respuestaProceso && proceso.estado == 'PROCESANDO'\">Procesando</p>\r\n <p class=\"result-ado\" *ngIf=\"proceso && proceso.respuestaProceso && proceso.estado == 'TERMINADO'\">{{proceso.respuestaProceso.Detalle ?? proceso.respuestaProceso.Mensaje}}</p>\r\n </div>\r\n </div>\r\n <ng-container *ngSwitchCase=\"'Table'\">\r\n <p-table [value]=\"values[i][j]\" [columns]=\"controls[i][j].config.columns\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"flex align-items-center justify-content-between\">\r\n <button pButton pRipple icon=\"pi pi-plus\" (click)=\"addObjectArray(el)\"\r\n class=\"p-button-success\" [disabled]=\"controls[i][j].disabled === true\"></button>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n {{col.label}}\r\n </th>\r\n <ng-container>\r\n <th></th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <ng-container *ngFor=\"let col of columns\" [ngSwitch]=\"col.type\">\r\n <ng-container *ngSwitchCase=\"'control'\">\r\n <sf-control [control]=\"extracControlFromTableElements(i, j, col)\" [label]=\"\"\r\n [value]=\"extracValueFromTableElements(i, j, rowIndex, col)\"\r\n (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"\r\n (setValue)=\"setValue($event, extracValueFromTableElements(i, j, rowIndex, col).scope, i, j)\"\r\n [showTempValue]=\"true\"\r\n >\r\n </sf-control>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <td>{{rowData[col.col]}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'address'\">\r\n <td>{{rowData[col.col] | formatAddress: extracControlFromTableElements(i, j, col).separador }}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'currency:USD'\">\r\n <td>{{rowData[col.col] | currency: 'USD'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:yyyy-mm-dd'\">\r\n <td>{{rowData[col.col] | date: 'yyyy-mm-dd'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:dd/mm/yyyy'\">\r\n <td>{{rowData[col.col] | date: 'dd/MM/yyyy'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <td>\r\n <i *ngIf=\"rowData[col.col]\" class=\"pi pi-check\"></i>\r\n <i *ngIf=\"!rowData[col.col]\" class=\"pi pi-times\"></i>\r\n </td>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container>\r\n <td>\r\n <button pButton pRipple type=\"button\"\r\n (click)=\"editRow(el, rowData, rowIndex)\" icon=\"pi pi-pencil\"\r\n class=\"p-button-rounded p-button-info mr-1\"></button>\r\n <button pButton pRipple type=\"button\" (click)=\"deleteRow(el, rowIndex)\" [disabled]=\"controls[i][j].disabled === true\"\r\n icon=\"pi pi-trash\" class=\"p-button-rounded p-button-danger\"></button>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n\r\n<p-toast *ngIf=\"isDialog\"></p-toast>\r\n", styles: [":not(.col-12) .label{display:flex;justify-content:center;align-items:center;padding-inline:.5rem;margin-bottom:15px;margin-top:20px;border-radius:13px;font-size:18px;font-size:inherit;background-color:var(--primary-color);text-align:center;color:var(--normal-text-color)}.pdf{display:flex;width:100%;height:80vh}.pdf iframe{width:80%;margin-inline:10%}.data-ado-container{display:flex;margin-inline:auto;align-items:center;width:fit-content}.data-ado-container>*{margin-inline:4px}.data-ado-container>div{display:flex;align-items:center}.data-ado-container>div>*{margin-inline:4px}i.pi-user{font-size:2rem}.result-ado{min-height:1rem;text-align:center}sf-simulador{display:flow-root;width:80%;margin-inline:auto;margin-bottom:35px}sf-sign{display:block;margin-inline:auto;width:80%}sf-sign pdf-viewer{min-height:130vh!important;max-height:130vh!important}.buttons{display:flex;justify-content:space-evenly}.buttons ::ng-deep .p-button.p-component{border-radius:35px}::ng-deep *{box-shadow:none}.frm-container ::ng-deep .p-inputtext:focus,.frm-container ::ng-deep .p-inputtext:active,.frm-container ::ng-deep .p-inputwrapper:focus,.frm-container ::ng-deep .p-inputwrapper:active{border-color:var(--button-color)}.frm-container ::ng-deep .p-button{background-color:var(--button-color);border-color:var(--button-color)}.frm-container ::ng-deep .p-button:hover{background-color:var(--button-color);filter:brightness(85%)}.frm-container ::ng-deep :not(:disabled):active,.frm-container ::ng-deep :not(.p-disabled) .p-inputtext:hover,.frm-container ::ng-deep :not(.p-disabled) .p-inputwrapper:hover,.frm-container ::ng-deep :not(.p-disabled) .p-inputwrapper-focus,.frm-container ::ng-deep .p-radiobutton-box .p-highlight,.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box:not(.p-disabled):hover{border-color:var(--button-color)}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box.p-highlight{background:var(--button-color);border-color:var(--button-color)!important}.frm-container ::ng-deep .p-button.p-button-success,.p-buttonset.p-button-success>.p-button,.p-splitbutton.p-button-success>.p-button{background:var(--button-color);border-color:var(--button-color)!important}@media screen and (max-width:765px){:not(.col-12) .label{height:fit-content}.field{margin-bottom:.5rem}.pdf>iframe{width:100%;margin-inline:0}sf-sign{width:100%}sf-sign pdf-viewer{min-height:60vh!important;max-height:120vh!important}sf-simulador{display:block;width:100%;margin-inline:auto}.data-ado-container{text-align:center}.data-ado-container .buttons{max-width:80vw;flex-direction:row}.buttons{flex-direction:column;align-items:center}}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box:not(.p-disabled):not(.p-highlight):hover{border-color:var(--secondary-color)!important}.frm-container ::ng-deep .p-button.p-button-success:enabled:focus,.p-buttonset.p-button-success>.p-button:enabled:focus,.p-splitbutton.p-button-success>.p-button:enabled:focus{box-shadow:inset 0 0 #fff}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box.p-highlight:not(.p-disabled):hover{color:var(--secondary-color)!important}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box:not(.p-disabled).p-focus{box-shadow:inset 0 0 0 1px var(--secondary-color)!important}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box .p-radiobutton-icon{background-color:#fff}.frm-container ::ng-deep .p-slider:not(.p-disabled):hover{background-color:#e5e7eb}.frm-container ::ng-deep .p-slider{background-color:#e5e7eb}.frm-container ::ng-deep .p-slider:not(.p-disabled):hover .p-slider-range{background-color:var(--primary-color)!important}.frm-container ::ng-deep .p-button:enabled:active{background:var(--secondary-color)!important;border-color:var(--secondary-color)!important}.frm-container ::ng-deep .p-slider:not(.p-disabled):hover .p-slider-handle{border-color:var(--primary-color)!important}.frm-container ::ng-deep .p-button:focus{box-shadow:inset 0 0 0 1px var(--secondary-color)!important}.frm-container ::ng-deep .p-button:enabled:hover{background:var(--secondary-color)!important;border-color:var(--secondary-color)!important}.frm-container ::ng-deep .p-button.p-button-info,.p-buttonset.p-button-info>.p-button,.p-splitbutton.p-button-info>.p-button{background:var(--secondary-color)!important;border:1px solid var(--secondary-color)!important}\n"], dependencies: [{ kind: "component", type: i6$1.SignComponent, selector: "sf-sign", inputs: ["idkatios", "tdoc", "ndoc", "idDocument", "typeDocument", "allowDownload"], outputs: ["stateDocument", "loading"] }, { kind: "component", type: i7$2.SfSimuladorComponent, selector: "sf-simulador", inputs: ["simulador", "otherToolTips", "labels"], outputs: ["simuladorChange", "enProceso"] }, { kind: "directive", type: i1$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i8.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i8.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "directive", type: i8$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i8$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i8$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i8$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i8$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i12.Ripple, selector: "[pRipple]" }, { kind: "component", type: i14.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "component", type: i12$1.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "life", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { kind: "directive", type: i15$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: ControlComponent, selector: "sf-control", inputs: ["showTempValue", "control", "label", "value", "appendTo"], outputs: ["setValue", "sendObject", "addressClicked"] }, { kind: "pipe", type: i8$1.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i8$1.DatePipe, name: "date" }, { kind: "pipe", type: FormatAddressPipe, name: "formatAddress" }] });
2163
+ }
2164
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FormComponent, decorators: [{
2165
+ type: Component,
2166
+ args: [{ selector: 'app-form', standalone: false, template: "<div *ngIf=\"controlsLoaded\" class=\"frm-container\">\r\n <ng-container *ngIf=\"isAddressDialog && currentAddress\">\r\n Direcci\u00F3n actual: {{currentAddress | formatAddress: separador}}\r\n <br>\r\n </ng-container>\r\n <br>\r\n <ng-container *ngIf=\"isAddressDialog\">\r\n Direcci\u00F3n nueva: {{newAddress | formatAddress: separador}}\r\n </ng-container>\r\n <div *ngFor=\"let element of uiEsquema.elements; let i = index\" [class]=\"element?.class\" #a>\r\n <ng-container [ngSwitch]=\"element.type\" *ngIf=\"visible[i][0]\">\r\n <div class=\"label\" *ngSwitchCase=\"'Label'\" [style]=\"element?.style\">\r\n {{element?.label}}\r\n </div>\r\n <ng-container *ngSwitchCase=\"'HorizontalLayout'\">\r\n <div *ngFor=\"let el of element.elements; let j =index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\" *ngIf=\"visible[i][j]\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\"\r\n [value]=\"values[i][j]\" (setValue)=\"setValue($event, el.scope, i, j)\"\r\n (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"\r\n (addressClicked)=\"openPopUpDireccion(el.scope)\"></sf-control>\r\n <div *ngSwitchCase=\"'Texto'\" [ngStyle]=\"{'height': '100%', 'margin-block': 'auto'}\">\r\n <p>{{el.label}}</p>\r\n </div>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'VerticalLayout'\">\r\n <div *ngFor=\"let el of element.elements; let j =index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\" *ngIf=\"visible[i][j]\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\"\r\n [value]=\"values[i][j]\" (setValue)=\"setValue($event, el.scope, i, j)\"\r\n (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"\r\n (addressClicked)=\"openPopUpDireccion(el.scope)\"></sf-control>\r\n <div *ngSwitchCase=\"'PDF'\" class=\"pdf\">\r\n <iframe [src]=\"values[i][j]\" frameborder=\"0\" allow=\"geolocation *; camera *;\"></iframe>\r\n </div>\r\n <div *ngSwitchCase=\"'PDF-SIGN'\">\r\n <sf-sign [allowDownload]=\"true\" [idkatios]=\"idKatios\" [tdoc]=\"data.pdf.tdoc\" [ndoc]=\"data.pdf.ndoc\"\r\n [idDocument]=\"data.pdf.id\" [typeDocument]=\"data.pdf.idDoc\"\r\n (stateDocument)=\"onStateDocument($event)\"></sf-sign>\r\n </div>\r\n <ng-container *ngSwitchCase=\"'SIMULADOR'\">\r\n <sf-simulador [simulador]=\"data\" [otherToolTips]=\"data.otherTooltips\"\r\n (simuladorChange)=\"onSimuladorChange($event)\" (enProceso)=\"emitLoadingForm($event)\"></sf-simulador>\r\n </ng-container>\r\n <div *ngSwitchCase=\"'ADO'\" class=\"buttons\">\r\n <p-button *ngIf=\"!data?.ADO?.dataProceso?.idProceso\" [ngStyle]=\"el?.ngStyle\" (click)=\"goToADO()\" label=\"Validar identidad\"></p-button>\r\n </div>\r\n <div *ngSwitchCase=\"'ADO'\">\r\n <div *ngIf=\"data?.ADO?.dataProceso?.idProceso\">\r\n <div class=\"data-ado-container\">\r\n <ng-container *ngIf=\"proceso\">\r\n <i *ngIf=\"proceso?.respuestaProceso?.EsExitoso === true\" pTooltip=\"Validado\" tooltipPosition=\"top\" id=\"Validado\" class=\"pi pi-user\" style=\"color: green\"\r\n (touchstart)=\"onTouchDescription('Validado', false)\" (touchend)=\"onUnTouchDescription('Validado')\"></i>\r\n <i *ngIf=\"proceso?.respuestaProceso?.EsExitoso === false\" pTooltip=\"No validado\" tooltipPosition=\"top\" id=\"No-Validado\" class=\"pi pi-user\" style=\"color: red\"\r\n (touchstart)=\"onTouchDescription('No-Validado', false)\" (touchend)=\"onUnTouchDescription('No-Validado')\"></i>\r\n <i *ngIf=\"!proceso?.respuestaProceso\" pTooltip=\"Sin validar\" tooltipPosition=\"top\" class=\"pi pi-user\" id=\"Sin-Validar\" style=\"color: gray\"\r\n (touchstart)=\"onTouchDescription('Sin-Validar', false)\" (touchend)=\"onUnTouchDescription('Sin-Validar')\"></i>\r\n </ng-container>\r\n <div class=\"buttons\">\r\n <button pButton icon=\"pi pi-external-link\" (click)=\"goToADO()\" pTooltip=\"Abrir\" [disabled]=\"!proceso\"></button>\r\n <button pButton icon=\"pi pi-copy\" (click)=\"copyToClipboard(proceso.id)\" pTooltip=\"Copiar\" [disabled]=\"!proceso\"></button>\r\n <button pButton icon=\"pi pi-refresh\" (click)=\"refreshIntegracion(proceso.id)\" pTooltip=\"Refrescar\" [disabled]=\"!proceso\"></button>\r\n </div>\r\n </div>\r\n <p class=\"result-ado\" *ngIf=\"proceso && !proceso.respuestaProceso && proceso.estado == 'PROCESANDO'\">Procesando</p>\r\n <p class=\"result-ado\" *ngIf=\"proceso && proceso.respuestaProceso && proceso.estado == 'TERMINADO'\">{{proceso.respuestaProceso.Detalle ?? proceso.respuestaProceso.Mensaje}}</p>\r\n </div>\r\n </div>\r\n <ng-container *ngSwitchCase=\"'Table'\">\r\n <p-table [value]=\"values[i][j]\" [columns]=\"controls[i][j].config.columns\">\r\n <ng-template pTemplate=\"caption\">\r\n <div class=\"flex align-items-center justify-content-between\">\r\n <button pButton pRipple icon=\"pi pi-plus\" (click)=\"addObjectArray(el)\"\r\n class=\"p-button-success\" [disabled]=\"controls[i][j].disabled === true\"></button>\r\n </div>\r\n </ng-template>\r\n <ng-template pTemplate=\"header\" let-columns>\r\n <tr>\r\n <th *ngFor=\"let col of columns\">\r\n {{col.label}}\r\n </th>\r\n <ng-container>\r\n <th></th>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n <ng-template pTemplate=\"body\" let-rowData let-columns=\"columns\" let-rowIndex=\"rowIndex\">\r\n <tr>\r\n <ng-container *ngFor=\"let col of columns\" [ngSwitch]=\"col.type\">\r\n <ng-container *ngSwitchCase=\"'control'\">\r\n <sf-control [control]=\"extracControlFromTableElements(i, j, col)\" [label]=\"\"\r\n [value]=\"extracValueFromTableElements(i, j, rowIndex, col)\"\r\n (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"\r\n (setValue)=\"setValue($event, extracValueFromTableElements(i, j, rowIndex, col).scope, i, j)\"\r\n [showTempValue]=\"true\"\r\n >\r\n </sf-control>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'text'\">\r\n <td>{{rowData[col.col]}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'address'\">\r\n <td>{{rowData[col.col] | formatAddress: extracControlFromTableElements(i, j, col).separador }}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'currency:USD'\">\r\n <td>{{rowData[col.col] | currency: 'USD'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:yyyy-mm-dd'\">\r\n <td>{{rowData[col.col] | date: 'yyyy-mm-dd'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'date:dd/mm/yyyy'\">\r\n <td>{{rowData[col.col] | date: 'dd/MM/yyyy'}}</td>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'boolean'\">\r\n <td>\r\n <i *ngIf=\"rowData[col.col]\" class=\"pi pi-check\"></i>\r\n <i *ngIf=\"!rowData[col.col]\" class=\"pi pi-times\"></i>\r\n </td>\r\n </ng-container>\r\n </ng-container>\r\n <ng-container>\r\n <td>\r\n <button pButton pRipple type=\"button\"\r\n (click)=\"editRow(el, rowData, rowIndex)\" icon=\"pi pi-pencil\"\r\n class=\"p-button-rounded p-button-info mr-1\"></button>\r\n <button pButton pRipple type=\"button\" (click)=\"deleteRow(el, rowIndex)\" [disabled]=\"controls[i][j].disabled === true\"\r\n icon=\"pi pi-trash\" class=\"p-button-rounded p-button-danger\"></button>\r\n </td>\r\n </ng-container>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n\r\n<p-toast *ngIf=\"isDialog\"></p-toast>\r\n", styles: [":not(.col-12) .label{display:flex;justify-content:center;align-items:center;padding-inline:.5rem;margin-bottom:15px;margin-top:20px;border-radius:13px;font-size:18px;font-size:inherit;background-color:var(--primary-color);text-align:center;color:var(--normal-text-color)}.pdf{display:flex;width:100%;height:80vh}.pdf iframe{width:80%;margin-inline:10%}.data-ado-container{display:flex;margin-inline:auto;align-items:center;width:fit-content}.data-ado-container>*{margin-inline:4px}.data-ado-container>div{display:flex;align-items:center}.data-ado-container>div>*{margin-inline:4px}i.pi-user{font-size:2rem}.result-ado{min-height:1rem;text-align:center}sf-simulador{display:flow-root;width:80%;margin-inline:auto;margin-bottom:35px}sf-sign{display:block;margin-inline:auto;width:80%}sf-sign pdf-viewer{min-height:130vh!important;max-height:130vh!important}.buttons{display:flex;justify-content:space-evenly}.buttons ::ng-deep .p-button.p-component{border-radius:35px}::ng-deep *{box-shadow:none}.frm-container ::ng-deep .p-inputtext:focus,.frm-container ::ng-deep .p-inputtext:active,.frm-container ::ng-deep .p-inputwrapper:focus,.frm-container ::ng-deep .p-inputwrapper:active{border-color:var(--button-color)}.frm-container ::ng-deep .p-button{background-color:var(--button-color);border-color:var(--button-color)}.frm-container ::ng-deep .p-button:hover{background-color:var(--button-color);filter:brightness(85%)}.frm-container ::ng-deep :not(:disabled):active,.frm-container ::ng-deep :not(.p-disabled) .p-inputtext:hover,.frm-container ::ng-deep :not(.p-disabled) .p-inputwrapper:hover,.frm-container ::ng-deep :not(.p-disabled) .p-inputwrapper-focus,.frm-container ::ng-deep .p-radiobutton-box .p-highlight,.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box:not(.p-disabled):hover{border-color:var(--button-color)}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box.p-highlight{background:var(--button-color);border-color:var(--button-color)!important}.frm-container ::ng-deep .p-button.p-button-success,.p-buttonset.p-button-success>.p-button,.p-splitbutton.p-button-success>.p-button{background:var(--button-color);border-color:var(--button-color)!important}@media screen and (max-width:765px){:not(.col-12) .label{height:fit-content}.field{margin-bottom:.5rem}.pdf>iframe{width:100%;margin-inline:0}sf-sign{width:100%}sf-sign pdf-viewer{min-height:60vh!important;max-height:120vh!important}sf-simulador{display:block;width:100%;margin-inline:auto}.data-ado-container{text-align:center}.data-ado-container .buttons{max-width:80vw;flex-direction:row}.buttons{flex-direction:column;align-items:center}}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box:not(.p-disabled):not(.p-highlight):hover{border-color:var(--secondary-color)!important}.frm-container ::ng-deep .p-button.p-button-success:enabled:focus,.p-buttonset.p-button-success>.p-button:enabled:focus,.p-splitbutton.p-button-success>.p-button:enabled:focus{box-shadow:inset 0 0 #fff}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box.p-highlight:not(.p-disabled):hover{color:var(--secondary-color)!important}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box:not(.p-disabled).p-focus{box-shadow:inset 0 0 0 1px var(--secondary-color)!important}.frm-container ::ng-deep .p-radiobutton .p-radiobutton-box .p-radiobutton-icon{background-color:#fff}.frm-container ::ng-deep .p-slider:not(.p-disabled):hover{background-color:#e5e7eb}.frm-container ::ng-deep .p-slider{background-color:#e5e7eb}.frm-container ::ng-deep .p-slider:not(.p-disabled):hover .p-slider-range{background-color:var(--primary-color)!important}.frm-container ::ng-deep .p-button:enabled:active{background:var(--secondary-color)!important;border-color:var(--secondary-color)!important}.frm-container ::ng-deep .p-slider:not(.p-disabled):hover .p-slider-handle{border-color:var(--primary-color)!important}.frm-container ::ng-deep .p-button:focus{box-shadow:inset 0 0 0 1px var(--secondary-color)!important}.frm-container ::ng-deep .p-button:enabled:hover{background:var(--secondary-color)!important;border-color:var(--secondary-color)!important}.frm-container ::ng-deep .p-button.p-button-info,.p-buttonset.p-button-info>.p-button,.p-splitbutton.p-button-info>.p-button{background:var(--secondary-color)!important;border:1px solid var(--secondary-color)!important}\n"] }]
2167
+ }], ctorParameters: () => [{ type: i1$1.MessageService }, { type: SfCrudService }, { type: i3.DomSanitizer }, { type: StepService }, { type: i5$1.AdoService }, { type: i5$1.JWTService }], propDecorators: { uiEsquema: [{
2168
+ type: Input
2169
+ }], esquema: [{
2170
+ type: Input
2171
+ }], data: [{
2172
+ type: Input
2173
+ }], isDialog: [{
2174
+ type: Input
2175
+ }], isAddressDialog: [{
2176
+ type: Input
2177
+ }], separador: [{
2178
+ type: Input
2179
+ }], tooltips: [{
2180
+ type: ViewChildren,
2181
+ args: [Tooltip]
2182
+ }] } });
2183
+
2184
+ class RegistroComponent {
2185
+ generalService;
2186
+ activeRoute;
2187
+ messageService;
2188
+ sfCrudService;
2189
+ stepService;
2190
+ sfPdfSignService;
2191
+ sfSimuladorService;
2192
+ notificationService;
2193
+ router;
2194
+ color;
2195
+ color2;
2196
+ colorButton;
2197
+ idKatios = '';
2198
+ trx = '';
2199
+ id = '';
2200
+ user;
2201
+ dataExt;
2202
+ ids = [];
2203
+ environment;
2204
+ buttonsFooterTemplate;
2205
+ sendData = new EventEmitter();
2206
+ onSubmit = new EventEmitter();
2207
+ btnSubmit;
2208
+ notificationSubscription;
2209
+ subsToKillOnDestroy = [];
2210
+ set idEntidad(value) {
2211
+ this.idForm = value;
2212
+ }
2213
+ idForm;
2214
+ isLocal = false;
2215
+ displays = [];
2216
+ firstLoad = true;
2217
+ logo;
2218
+ dialogElements = [];
2219
+ loading;
2220
+ items = [];
2221
+ constructor(generalService, activeRoute, messageService, sfCrudService, stepService, sfPdfSignService, sfSimuladorService, notificationService, router) {
2222
+ this.generalService = generalService;
2223
+ this.activeRoute = activeRoute;
2224
+ this.messageService = messageService;
2225
+ this.sfCrudService = sfCrudService;
2226
+ this.stepService = stepService;
2227
+ this.sfPdfSignService = sfPdfSignService;
2228
+ this.sfSimuladorService = sfSimuladorService;
2229
+ this.notificationService = notificationService;
2230
+ this.router = router;
2231
+ this.loading = { inProgress: true, target: undefined };
2232
+ }
2233
+ ngOnChanges(changes) {
2234
+ if (!this.environment) {
2235
+ this.environment = JSON.parse(sessionStorage.getItem('ConfigJSON') || '{}');
2236
+ }
2237
+ if (this.idKatios && this.idForm && this.environment && (changes["idKatios"] || changes["idEntidad"])) {
2238
+ this.sfCrudService.ids = this.ids;
2239
+ this.sfCrudService.idKatios = this.idKatios;
2240
+ this.sfCrudService.environment = this.environment;
2241
+ this.generalService.idKatios = this.idKatios;
2242
+ this.generalService.environment = this.environment;
2243
+ this.sfPdfSignService.setEnviroments(this.environment);
2244
+ this.sfSimuladorService.environments = this.environment;
2245
+ this.sfSimuladorService.idKatios = this.idKatios;
2246
+ this.loadConfigCrud();
2247
+ }
2248
+ }
2249
+ ngOnInit() {
2250
+ this.cargarMascarasDirecciones();
2251
+ this.instanceSubsStepService();
2252
+ this.notificationSubscription = this.notificationService.notificationAdded$().subscribe(notification => {
2253
+ if (notification?.requestChecking?.useSwal) {
2254
+ Swal.fire(notification.msg).then((res) => {
2255
+ if (notification.msg.showCancelButton && res.isDismissed && notification.requestChecking?.cancelRedirect) {
2256
+ if (notification.requestChecking.cancelRedirect.toUpperCase() == "INICIO")
2257
+ this.sfCrudService.redirectToInicio();
2258
+ else
2259
+ window.location.href = notification.requestChecking.cancelRedirect;
2260
+ }
2261
+ else if (res.isConfirmed && notification.requestChecking?.redirect) {
2262
+ if (notification.requestChecking.redirect.toUpperCase() == "INICIO")
2263
+ this.sfCrudService.redirectToInicio();
2264
+ else
2265
+ window.location.href = notification.requestChecking.redirect;
2266
+ }
2267
+ });
2268
+ }
2269
+ else if (notification?.msg && notification.requestChecking?.redirect) {
2270
+ this.messageService.add(notification.msg);
2271
+ if (notification.requestChecking.redirect.toUpperCase() == "INICIO")
2272
+ this.sfCrudService.redirectToInicio();
2273
+ else {
2274
+ let newURL = this.sfCrudService.getURLRedirect(notification.requestChecking.redirect);
2275
+ window.location.href = newURL;
2276
+ window.location.reload();
2277
+ }
2278
+ }
2279
+ else if (notification?.msg) {
2280
+ this.messageService.add(notification.msg);
2281
+ }
2282
+ });
2283
+ }
2284
+ ngOnDestroy() {
2285
+ if (this.notificationSubscription) {
2286
+ this.notificationSubscription.unsubscribe();
2287
+ }
2288
+ this.subsToKillOnDestroy.forEach(sub => sub.unsubscribe());
2289
+ this.stepService.reset();
2290
+ this.sfCrudService.reset();
2291
+ console.log("destroy");
2292
+ }
2293
+ instanceSubsStepService() {
2294
+ this.subsToKillOnDestroy.push(this.stepService.customChildrenEvents$.subscribe((event) => {
2295
+ if (!event)
2296
+ return;
2297
+ switch (event.name.toUpperCase()) {
2298
+ case "ONCLICKEDEDITBUTTON":
2299
+ this.onClickedEditButton(event.data.element, event.data.data, event.data.index);
2300
+ break;
2301
+ case "ONCLICKEDDELETEBUTTON":
2302
+ this.deleteRow(event.data.element, event.data.index);
2303
+ break;
2304
+ case "ONCLICKEDADDBUTTON":
2305
+ this.onClickedAddButton(event.data.element);
2306
+ break;
2307
+ case "ONCLICKEDADDRESS":
2308
+ this.onClickedAddress(event.data.scope);
2309
+ break;
2310
+ }
2311
+ }));
2312
+ this.subsToKillOnDestroy.push(this.stepService.requestApproval$.subscribe((value) => {
2313
+ console.log(value);
2314
+ if (value?.desired != undefined) {
2315
+ if (value.desired < value.current) {
2316
+ this.stepService.requestApproved = true;
2317
+ this.sfCrudService.index = this.stepService.currentIndex;
2318
+ this.scrollTop();
2319
+ }
2320
+ else {
2321
+ const operation = this.sfCrudService.getRegistro(this.indexCrud).operations.find(op => op.type.startsWith(this.sfCrudService.getTrx(this.indexCrud)));
2322
+ if (!this.validateData(operation, this.sfCrudService.getData(this.indexCrud), this.sfCrudService.getRegistro(this.indexCrud).conditions || []))
2323
+ this.stepService.requestApproved = false;
2324
+ else if (operation?.method != null)
2325
+ this.uploadInfoStep(value);
2326
+ else if (operation?.answerChecking) { //no tiene request, solo un mensaje
2327
+ this.stepService.requestApproved = true;
2328
+ this.loading.inProgress = false;
2329
+ this.sfCrudService.formLoading = this.loading;
2330
+ this.notificationService.addNotification(this.notificationService.generateMessage(this.notificationService.genDefaultMessage("success", undefined, "Información subida correctamente", operation.answerChecking), {}, operation.answerChecking), operation.answerChecking);
2331
+ this.sfCrudService.index = this.stepService.currentIndex;
2332
+ this.scrollTop();
2333
+ }
2334
+ else { //no tiene nada configurado
2335
+ this.stepService.requestApproved = true;
2336
+ this.sfCrudService.index = this.stepService.currentIndex;
2337
+ this.scrollTop();
2338
+ }
2339
+ }
2340
+ }
2341
+ }));
2342
+ console.log("subs step service terminadas");
2343
+ }
2344
+ uploadInfoStep(position) {
2345
+ this.loading.inProgress = true;
2346
+ this.sfCrudService.formLoading = this.loading;
2347
+ this.submit(position.current).then(() => {
2348
+ let tieneRedirect = this.sfCrudService.currentOperation?.answerChecking !== undefined && this.sfCrudService.currentOperation?.answerChecking?.redirect !== undefined;
2349
+ console.log(this.items.length);
2350
+ if (this.items.length == 1) {
2351
+ this.stepService.requestApproved = false;
2352
+ //this.stepService.desiredIndex = undefined
2353
+ this.sfCrudService.index = this.stepService.currentIndex;
2354
+ }
2355
+ else if (!tieneRedirect) {
2356
+ this.advance(position.current, position.desired, false);
2357
+ }
2358
+ this.scrollTop();
2359
+ })
2360
+ .catch(() => {
2361
+ this.stepService.requestApproved = false;
2362
+ }).finally(() => {
2363
+ this.loading.inProgress = false;
2364
+ this.sfCrudService.formLoading = this.loading;
2365
+ });
2366
+ }
2367
+ onClickBtnSubmit() {
2368
+ this.stepService.requestApproval = this.indexCrud;
2369
+ }
2370
+ loadConfigCrud() {
2371
+ this.loading.inProgress = true;
2372
+ this.sfCrudService.formLoading = this.loading;
2373
+ this.sfCrudService.dataExt = this.dataExt;
2374
+ this.sfCrudService.crudLoaded = false;
2375
+ if (this.loadSession()) {
2376
+ this.sfCrudService.crudLoaded = true;
2377
+ return;
2378
+ }
2379
+ this.generalService.getCrudByEntidad(this.idKatios, this.idForm)
2380
+ .then((res) => {
2381
+ console.log("crud cargado");
2382
+ this.sfCrudService.uiEsquemas = res.uiEsquemas;
2383
+ this.sfCrudService.esquemas = res.esquemas;
2384
+ this.sfCrudService.registros = res.registros;
2385
+ this.customizeCompany(res.uiEsquemas);
2386
+ this.sfCrudService.registros.forEach((_, i) => this.sfCrudService.setTrx("c", i));
2387
+ this.loadData()
2388
+ .then(() => {
2389
+ this.setLabelSumbit();
2390
+ this.sfCrudService.dataset.forEach((data, i) => {
2391
+ if (this.activeRoute.snapshot.queryParams["_idGWVADO"] && data.ADO?.dataProceso) {
2392
+ data.ADO.dataProceso.idProceso = this.activeRoute.snapshot.queryParams["_idGWVADO"];
2393
+ }
2394
+ if (this.activeRoute.snapshot.queryParams["_idADO"] && data.ADO) {
2395
+ data.ADO.idTransaction = this.activeRoute.snapshot.queryParams["_idADO"];
2396
+ }
2397
+ this.sfCrudService.setDataSet(data, i);
2398
+ });
2399
+ })
2400
+ .finally(() => {
2401
+ let willExecuteRequest = this.advance(0, this.sfCrudService.uiEsquemas.length - 1, true);
2402
+ this.createSteps(res.uiEsquemas);
2403
+ this.sfCrudService.crudLoaded = true;
2404
+ if (!willExecuteRequest) {
2405
+ this.loading.inProgress = false;
2406
+ this.sfCrudService.formLoading = this.loading;
2407
+ }
2408
+ });
2409
+ }).catch((ex) => {
2410
+ console.error(ex);
2411
+ this.loading.inProgress = false;
2412
+ this.sfCrudService.formLoading = this.loading;
2413
+ });
2414
+ }
2415
+ /**
2416
+ * Step will advance until esquema is not completed
2417
+ */
2418
+ advance(start, limit, executeRequest) {
2419
+ console.log("advance desde ", start, " hasta ", limit);
2420
+ let i = start;
2421
+ let op;
2422
+ let willExecuteRequest = false;
2423
+ let registro;
2424
+ while (i < limit) {
2425
+ registro = this.sfCrudService.getRegistro(i);
2426
+ op = registro.operations.find(op => op.type.startsWith(this.sfCrudService.getTrx(i)));
2427
+ if (!this.validateData(op, this.sfCrudService.getData(i), registro.conditions || [], false))
2428
+ break;
2429
+ i++;
2430
+ }
2431
+ this.sfCrudService.index = i;
2432
+ this.stepService.currentIndex = i;
2433
+ this.stepService.desiredIndex = i;
2434
+ console.log("advance", i);
2435
+ this.stepService.requestApproved = true;
2436
+ registro = this.sfCrudService.getRegistro(i);
2437
+ let dataCurrentStep = this.sfCrudService.getData(i);
2438
+ op = this.sfCrudService.getRegistro(i).operations.find(op => op.type.startsWith(this.sfCrudService.getTrx(i)));
2439
+ if (executeRequest && (this.activeRoute.snapshot.queryParams["_idGWVADO"] || this.activeRoute.snapshot.queryParams["_idADO"]) //Viene de ADO
2440
+ && dataCurrentStep.ADO && this.validateData(op, dataCurrentStep, registro.conditions ?? [], false) //El step esta completo
2441
+ ) {
2442
+ console.log("advance with approval", i);
2443
+ this.stepService.requestApproval = i;
2444
+ willExecuteRequest = true;
2445
+ }
2446
+ return willExecuteRequest;
2447
+ }
2448
+ loadSession() {
2449
+ const wasLoaded = this.sfCrudService.loadSession();
2450
+ if (wasLoaded) {
2451
+ this.customizeCompany(this.sfCrudService.uiEsquemas);
2452
+ this.stepService.currentIndex = this.sfCrudService.index;
2453
+ this.createSteps(this.sfCrudService.uiEsquemas);
2454
+ this.loading.inProgress = false;
2455
+ this.sfCrudService.formLoading = this.loading;
2456
+ }
2457
+ return wasLoaded;
2458
+ }
2459
+ customizeCompany(uiEsquemas) {
2460
+ this.sfCrudService.configEmpresa = uiEsquemas.find(ui => ui.general)?.general;
2461
+ this.logo = this.sfCrudService.configEmpresa?.icons?.carga;
2462
+ if (this.sfCrudService.configEmpresa) {
2463
+ if (this.sfCrudService.configEmpresa.colors?.main)
2464
+ this.color = this.sfCrudService.configEmpresa.colors.main;
2465
+ if (this.sfCrudService.configEmpresa.colors?.secondary)
2466
+ this.color2 = this.sfCrudService.configEmpresa.colors.secondary;
2467
+ if (this.sfCrudService.configEmpresa.colors?.button)
2468
+ this.colorButton = this.sfCrudService.configEmpresa.colors.button;
2469
+ }
2470
+ if (!this.colorButton)
2471
+ this.colorButton = "blue";
2472
+ if (!this.color2)
2473
+ this.color2 = "blue";
2474
+ if (!this.color)
2475
+ this.color = "blue";
2476
+ }
2477
+ scrollTop() {
2478
+ window.scroll({
2479
+ top: 0,
2480
+ left: 0,
2481
+ behavior: 'smooth'
2482
+ });
2483
+ }
2484
+ createSteps(uiEsquemas) {
2485
+ this.items = [];
2486
+ uiEsquemas.forEach((uiEsq, index) => {
2487
+ if (uiEsq.step)
2488
+ this.items.push({ label: uiEsq.step, routerLink: index, queryParamsHandling: "preserve" });
2489
+ else
2490
+ this.items.push({ label: `paso ${index}`, routerLink: index });
2491
+ this.sfCrudService.getRegistro(index); //ver si tiene un change
2492
+ });
2493
+ }
2494
+ /**
2495
+ * Instancia todos los esquemas, y realiza los requests para traer la data de todos los step.
2496
+ * @param esquema
2497
+ * @param registro
2498
+ * @returns
2499
+ */
2500
+ loadData() {
2501
+ this.sfCrudService.esquemas.forEach((esquema, i) => {
2502
+ const op = this.sfCrudService.registros[i].operations.find(x => x.type.startsWith(this.sfCrudService.getTrx(i)));
2503
+ this.sfCrudService.setDataSet(this.sfCrudService.createObject(esquema, op), i);
2504
+ });
2505
+ console.log("loadData");
2506
+ return Promise.all(this.sfCrudService.registros.map((registro, i) => this.ids.length > 0 ? this.getInfoRegistro(registro, i, this.ids[i]) : Promise.resolve()));
2507
+ }
2508
+ getInfoRegistro(configRegistro, index, id) {
2509
+ const op = configRegistro.operations.find(x => x.type == 'read');
2510
+ if (!op)
2511
+ return;
2512
+ const url = this.sfCrudService.getURL(op, index, id);
2513
+ return this.generalService.genericRequest(op.method, url)
2514
+ .then((res) => {
2515
+ let value = undefined;
2516
+ if (res?.data) {
2517
+ value = Array.isArray(res.data) ? res.data[0] : res.data;
2518
+ }
2519
+ else
2520
+ value = Array.isArray(res) ? res[0] : res;
2521
+ this.sfCrudService.applyObjectKeys(value, op.keysEsquema || [], configRegistro);
2522
+ if (op.changeTrx)
2523
+ op.changeTrx.forEach(x => this.sfCrudService.setTrx(x.trx, x.index));
2524
+ console.log("getInfoRegistro", op.changeTrx);
2525
+ })
2526
+ .catch((error) => {
2527
+ console.log(error);
2528
+ let errorChecking;
2529
+ if (Array.isArray(op.errorChecking))
2530
+ errorChecking = op.errorChecking[0];
2531
+ else
2532
+ errorChecking = op.errorChecking;
2533
+ this.notificationService.addNotification(this.notificationService.generateMessage(this.notificationService.genDefaultMessage("error", "Formulario no cargado correctamente", "", errorChecking), error.error, errorChecking), errorChecking);
2534
+ throw error;
2535
+ });
2536
+ }
2537
+ setDefaultValue(value) {
2538
+ let data = null;
2539
+ if (value.key && this.sfCrudService.currentOperation?.keys) {
2540
+ data = this.sfCrudService.getValueKey(this.sfCrudService.currentOperation.keys.find(k => k.key == value.key));
2541
+ value = data;
2542
+ }
2543
+ else {
2544
+ switch (value) {
2545
+ case '@uactivo':
2546
+ data = `${this.user.UsuarioSistema.TDOC}-${this.user.UsuarioSistema.NDOC}`;
2547
+ break;
2548
+ case '@tdocactivo':
2549
+ data = this.user.UsuarioSistema.TDOC;
2550
+ break;
2551
+ case '@ndocactivo':
2552
+ data = this.user.UsuarioSistema.NDOC;
2553
+ break;
2554
+ case '@hoy':
2555
+ data = new Date();
2556
+ break;
2557
+ default:
2558
+ data = value;
2559
+ break;
2560
+ }
2561
+ return data;
2562
+ }
2563
+ }
2564
+ get indexCrud() {
2565
+ return this.stepService.currentIndex;
2566
+ }
2567
+ primeChecking() {
2568
+ return new RequestChecking(undefined, undefined, false, undefined, undefined, false, undefined);
2569
+ }
2570
+ submit(index) {
2571
+ if (!index)
2572
+ index = this.indexCrud;
2573
+ this.sfCrudService.applyValuesOnEvent('onSubmit', this.sfCrudService.getEsquema(index), undefined, this.sfCrudService.getData(index));
2574
+ let registro = this.sfCrudService.getRegistro(index);
2575
+ console.log("trx actual: ", this.sfCrudService.getTrx(this.indexCrud));
2576
+ const operation = registro.operations.find(op => op.type.startsWith(this.sfCrudService.getTrx(this.indexCrud)));
2577
+ let url = this.sfCrudService.getURL(operation, index);
2578
+ return this.generalService.genericRequest(operation.method, url, this.sfCrudService.getData(index))
2579
+ .then((res) => {
2580
+ if (res === null)
2581
+ res = {};
2582
+ res = this.sfCrudService.applyObjectKeys(res, operation.keysEsquema || [], registro);
2583
+ this.sfCrudService.setAnswers(res, this.indexCrud);
2584
+ if (operation.changeTrx && Array.isArray(operation.changeTrx))
2585
+ operation.changeTrx.forEach(x => this.sfCrudService.setTrx(x.trx, x.index));
2586
+ this.notificationService.addNotification(this.notificationService.generateMessage(this.notificationService.genDefaultMessage("success", undefined, "Información subida correctamente", operation.answerChecking), res, operation.answerChecking), operation.answerChecking);
2587
+ return res;
2588
+ })
2589
+ .catch(err => {
2590
+ console.error(err);
2591
+ this.notificationService.addNotification(this.notificationService.generateMessage(this.notificationService.genDefaultMessage("error", "Error no controlado", "Por favor comunicarse con el admin", operation.errorChecking), err.error, operation.errorChecking), operation.errorChecking);
2592
+ throw new Error(err);
2593
+ });
2594
+ // return Promise.resolve({})
2595
+ }
2596
+ onCloseAddItem(index) {
2597
+ const scope = this.dialogElements[index].scope.replaceAll('.properties', '');
2598
+ const item = _.cloneDeep(this.dialogElements[index].data);
2599
+ if (index == 0) {
2600
+ jsonpath.query(this.sfCrudService.getData(this.indexCrud), scope)[0].push(item);
2601
+ }
2602
+ else
2603
+ jsonpath.query(this.dialogElements[index - 1].data, scope)[0].push(item);
2604
+ }
2605
+ deleteRow(element, indexElement) {
2606
+ const scope = element.scope.replaceAll('.properties', '');
2607
+ let indexDialog = this.dialogElements.length - 1;
2608
+ if (indexDialog == -1)
2609
+ jsonpath.query(this.sfCrudService.getData(this.indexCrud), scope)[0].splice(indexElement, 1);
2610
+ else {
2611
+ indexDialog = indexDialog == 0 ? 1 : indexDialog;
2612
+ jsonpath.query(this.dialogElements[indexDialog - 1].data, scope)[0].splice(indexElement, 1);
2613
+ }
2614
+ this.sfCrudService.applyValuesOnEvent('onChange', this.sfCrudService.getEsquema(this.indexCrud), element.scope.replace('$..properties.', ''), this.sfCrudService.getData(this.indexCrud));
2615
+ }
2616
+ onCloseEditRow(index) {
2617
+ let scope = undefined;
2618
+ try {
2619
+ const iArray = this.dialogElements[index].index;
2620
+ scope = this.dialogElements[index].scope.replaceAll('.properties', '');
2621
+ const item = _.cloneDeep(this.dialogElements[index].data);
2622
+ if (index == 0) {
2623
+ jsonpath.query(this.sfCrudService.getData(this.indexCrud), scope)[0][iArray] = item;
2624
+ }
2625
+ else {
2626
+ jsonpath.query(this.dialogElements[index - 1].data, scope)[0][iArray] = item;
2627
+ }
2628
+ }
2629
+ catch (error) {
2630
+ console.error(error);
2631
+ console.log(this.dialogElements);
2632
+ console.log(index);
2633
+ console.log(scope);
2634
+ console.log(this.indexCrud);
2635
+ console.log(this.sfCrudService.getData(this.indexCrud));
2636
+ throw error;
2637
+ }
2638
+ }
2639
+ validateData(operation, data, conditions, printErrors = true) {
2640
+ if (operation?.validations?.type == 'local') {
2641
+ let err = this.sfCrudService.validateDataLocal(operation, data, conditions);
2642
+ if (err.length != 0 && printErrors)
2643
+ this.notificationService.addNotification({ severity: 'warn', detail: err.slice(0, 5).join('. ') }, this.primeChecking());
2644
+ return err.length == 0;
2645
+ }
2646
+ return true;
2647
+ }
2648
+ onConfirm() {
2649
+ this.messageService.clear('c');
2650
+ }
2651
+ onReject() {
2652
+ this.messageService.clear('c');
2653
+ }
2654
+ onClickedAddress(scope) {
2655
+ let j = 1, k = 0;
2656
+ let separador = jsonpath.query(this.sfCrudService.esquemas[this.indexCrud], scope)[0]?.separador;
2657
+ let dataPadre = this.dialogElements.length > 0 ? this.dialogElements[this.dialogElements.length - 1].data : this.sfCrudService.dataset[this.indexCrud];
2658
+ let currentValue = jsonpath.query(dataPadre, scope.replaceAll('.properties', ''))[0];
2659
+ let currentValues = currentValue?.split(separador);
2660
+ let esquema = {
2661
+ type: "object",
2662
+ validations: {
2663
+ type: "local",
2664
+ required: []
2665
+ },
2666
+ properties: {
2667
+ currentValue: {
2668
+ type: "string",
2669
+ default: currentValue
2670
+ },
2671
+ separador: {
2672
+ type: "string",
2673
+ default: separador
2674
+ }
2675
+ }
2676
+ };
2677
+ let uiesquema = { elements: [] };
2678
+ let traductorTamaniosMascaras = {
2679
+ "grande": "field col-12 md:col-4",
2680
+ "pequeño": "field col-12 md:col-2",
2681
+ "mediano": "field col-12 md:col-3",
2682
+ };
2683
+ this.cargarMascarasDirecciones().then(() => {
2684
+ const op = this.sfCrudService.registros[this.indexCrud].operations.find(x => x.type.startsWith(this.sfCrudService.getTrx(this.indexCrud)));
2685
+ this.sfCrudService.mascaras.forEach(mascara => {
2686
+ //generar el uiesquema de las direcciones
2687
+ uiesquema.elements.push({
2688
+ "type": "Label",
2689
+ "class": "col-12 md:col-12",
2690
+ "style": `font-size: medium; color:white; background: var(--primary-color) !important; border-radius: 10px; text-align: center;`,
2691
+ "label": `Línea ${mascara.linea}`
2692
+ });
2693
+ uiesquema.elements.push({
2694
+ "type": "HorizontalLayout",
2695
+ "class": "p-fluid p-formgrid grid",
2696
+ "elements": []
2697
+ });
2698
+ mascara.Campo.forEach(campo => {
2699
+ if (campo.Tipo.toLocaleLowerCase() == "label") {
2700
+ uiesquema.elements[j].elements.push({
2701
+ "type": "Texto",
2702
+ "class": "my-auto",
2703
+ "label": campo.Valor,
2704
+ "scope": `$..properties.${campo.Id}`,
2705
+ "ngStyle": {
2706
+ "font-size": "1.5rem"
2707
+ }
2708
+ });
2709
+ }
2710
+ else {
2711
+ uiesquema.elements[j].elements.push({
2712
+ "type": "Control",
2713
+ "class": campo.Tamaño ? traductorTamaniosMascaras[campo.Tamaño.toLocaleLowerCase()] : traductorTamaniosMascaras.mediano,
2714
+ "scope": `$..properties.${campo.Id}`
2715
+ });
2716
+ }
2717
+ //generar el esquema de las direcciones
2718
+ if (campo.Tipo.toLocaleLowerCase() == "combo") {
2719
+ let customOptions = [];
2720
+ let valores = campo.Valores.split(",");
2721
+ valores.forEach(valor => customOptions.push({ label: valor.split("-")[0], value: valor.split("-")[1] }));
2722
+ esquema.properties[campo.Id] = {
2723
+ type: "string",
2724
+ subtype: "dropdown",
2725
+ default: this.getDefaultValueDireccion(k, currentValues),
2726
+ config: {
2727
+ optionLabel: "label",
2728
+ optionValue: "value",
2729
+ customOptions: customOptions,
2730
+ showClear: k >= 2
2731
+ }
2732
+ };
2733
+ }
2734
+ else if (campo.Tipo.toLocaleLowerCase() == "text" || campo.Tipo.toLocaleLowerCase() == "label") {
2735
+ esquema.properties[campo.Id] = {
2736
+ type: "string",
2737
+ subtype: "input",
2738
+ default: this.getDefaultValueDireccion(k, currentValues)
2739
+ };
2740
+ }
2741
+ else if (campo.Tipo.toLocaleLowerCase() == "numeric") {
2742
+ esquema.properties[campo.Id] = {
2743
+ type: "numeric",
2744
+ subtype: "decimal",
2745
+ default: this.getDefaultValueDireccion(k, currentValues)
2746
+ };
2747
+ }
2748
+ if (esquema.validations.required.length < 2) { //validar los primeros 2 campos
2749
+ esquema.validations.required.push({
2750
+ "field": `$..${campo.Id}`,
2751
+ "message": `Por favor digite el campo N° ${esquema.validations.required.length + 1}`
2752
+ });
2753
+ }
2754
+ k += 1;
2755
+ });
2756
+ j += 2;
2757
+ });
2758
+ const currentElement = {
2759
+ data: this.sfCrudService.createObject(esquema, op),
2760
+ uiEsquema: uiesquema,
2761
+ esquema: esquema,
2762
+ scope: scope,
2763
+ index: 0,
2764
+ isAddressDialog: true,
2765
+ separador: separador,
2766
+ operation: "address"
2767
+ };
2768
+ console.log(currentElement);
2769
+ this.displays.push(true);
2770
+ this.dialogElements.push(currentElement);
2771
+ });
2772
+ }
2773
+ getDefaultValueDireccion(index, currentValues) {
2774
+ let valoresLiterales = [];
2775
+ this.sfCrudService.mascaras.forEach(mascara => {
2776
+ mascara.Campo.forEach(campo => {
2777
+ if (campo.Valor && campo.Tipo.toLocaleLowerCase() == "label")
2778
+ valoresLiterales.push(campo.Valor);
2779
+ });
2780
+ });
2781
+ let invalidCurrentValues = ["", null, undefined];
2782
+ let temporalValue = currentValues && index < currentValues.length && currentValues.length > 1 && !invalidCurrentValues.includes(currentValues[index]) ? currentValues[index] : null;
2783
+ valoresLiterales.forEach(valor => {
2784
+ if (temporalValue?.startsWith(valor))
2785
+ temporalValue = temporalValue.replace(valor, "");
2786
+ });
2787
+ return temporalValue;
2788
+ }
2789
+ onClickedEditButton(element, data, index) {
2790
+ const esquema = _.cloneDeep(this.sfCrudService.getControl(element.scope, this.sfCrudService.getEsquema(this.indexCrud)));
2791
+ esquema.type = "object";
2792
+ const currentElement = {
2793
+ data: _.cloneDeep(data),
2794
+ uiEsquema: _.cloneDeep(element.elements[0]),
2795
+ esquema: esquema,
2796
+ scope: element.scope,
2797
+ index: index,
2798
+ operation: "u"
2799
+ };
2800
+ this.displays.push(true);
2801
+ this.dialogElements.push(currentElement);
2802
+ }
2803
+ onClickedAddButton(element) {
2804
+ const esquema = _.cloneDeep(this.sfCrudService.getControl(element.scope, this.sfCrudService.getEsquema(this.indexCrud)));
2805
+ const op = this.sfCrudService.registros[this.indexCrud].operations.find(x => x.type.startsWith(this.sfCrudService.getTrx(this.indexCrud)));
2806
+ esquema.type = "object";
2807
+ const currentElement = {
2808
+ data: this.sfCrudService.createObject(esquema, op),
2809
+ uiEsquema: _.cloneDeep(element.elements[0]),
2810
+ esquema: esquema,
2811
+ scope: element.scope,
2812
+ index: 0,
2813
+ operation: "c"
2814
+ };
2815
+ try {
2816
+ currentElement.data.id = this.sfCrudService.getValue(element.scope, this.sfCrudService.getData(this.indexCrud)).length + 1;
2817
+ }
2818
+ catch (error) {
2819
+ console.log("error agregando un id");
2820
+ console.error(error);
2821
+ }
2822
+ this.displays.push(true);
2823
+ this.dialogElements.push(currentElement);
2824
+ }
2825
+ onCloseAddress(index) {
2826
+ let separador = jsonpath.query(this.sfCrudService.esquemas[this.indexCrud], this.dialogElements[index].scope)[0]?.separador;
2827
+ //leer los campos de las mascaras, setear el string
2828
+ let newValue = this.sfCrudService.armarNuevaDireccion("string", this.dialogElements[index].data, separador);
2829
+ console.log(newValue);
2830
+ let scope = this.dialogElements[index].scope.replaceAll('.properties', '');
2831
+ console.log(scope);
2832
+ if (index == 0) {
2833
+ jsonpath.value(this.sfCrudService.getData(this.indexCrud), scope, newValue);
2834
+ }
2835
+ else {
2836
+ //Actualizarlo en un dialog anterior. Se crea una nueva referencia para que el compilador detecte cambios en el objeto data y lo recargue
2837
+ let newDataPreviousDialog = _.cloneDeep(this.dialogElements[index - 1].data);
2838
+ jsonpath.value(newDataPreviousDialog, scope, newValue);
2839
+ this.dialogElements[index - 1].data = newDataPreviousDialog;
2840
+ }
2841
+ this.stepService.desiredIndex = undefined;
2842
+ this.stepService.requestApproved = true;
2843
+ }
2844
+ onCloseDialog(index) {
2845
+ let validated = true;
2846
+ if (this.dialogElements[index].esquema.validations) {
2847
+ const op = new Operation();
2848
+ op.validations = this.dialogElements[index].esquema.validations;
2849
+ validated = this.validateData(op, this.dialogElements[index].data, this.sfCrudService.getRegistro(this.indexCrud).conditions || []);
2850
+ }
2851
+ if (validated) {
2852
+ switch (this.dialogElements[index].operation) {
2853
+ case "c":
2854
+ this.onCloseAddItem(index);
2855
+ break;
2856
+ case "u":
2857
+ this.onCloseEditRow(index);
2858
+ break;
2859
+ case "address":
2860
+ this.onCloseAddress(index);
2861
+ break;
2862
+ }
2863
+ this.removeDialogItem();
2864
+ }
2865
+ }
2866
+ removeDialogItem() {
2867
+ this.dialogElements.pop();
2868
+ this.displays.pop();
2869
+ }
2870
+ setLabelSumbit() {
2871
+ let x = { "c": { label: 'Guardar', icon: 'pi pi-save' },
2872
+ "u": { label: 'Actualizar', icon: 'pi pi-sync' },
2873
+ "d": { label: 'Eliminar', icon: 'pi pi-trash' }
2874
+ };
2875
+ this.btnSubmit = x[this.sfCrudService.getTrx(0)];
2876
+ }
2877
+ back() {
2878
+ this.router.navigateByUrl(this.sfCrudService.registros[0].btnBack);
2879
+ }
2880
+ cargarMascarasDirecciones() {
2881
+ if (this.sfCrudService.mascaras.length == 0) {
2882
+ return this.generalService.genericRequest("GET", `${this.generalService.generales}/General/getConfiguracionKatios/${this.idKatios}`).then((res) => {
2883
+ this.sfCrudService.mascaras = JSON.parse(res).RESPUESTA.MascarasDirecciones.Mascaras.Mascara;
2884
+ });
2885
+ }
2886
+ return Promise.resolve(this.sfCrudService.mascaras);
2887
+ }
2888
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RegistroComponent, deps: [{ token: GeneralService }, { token: i2.ActivatedRoute }, { token: i1$1.MessageService }, { token: SfCrudService }, { token: StepService }, { token: i6$1.SfPdfsignService }, { token: i7$2.SfSimuladorService }, { token: NotificationService }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Component });
2889
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: RegistroComponent, isStandalone: false, selector: "sf-registro", inputs: { idKatios: "idKatios", trx: "trx", id: "id", user: "user", dataExt: "dataExt", ids: "ids", environment: "environment", buttonsFooterTemplate: "buttonsFooterTemplate", idEntidad: "idEntidad" }, outputs: { sendData: "sendData", onSubmit: "onSubmit" }, host: { properties: { "style.--primary-color": "this.color", "style.--secondary-color": "this.color2", "style.--button-color": "this.colorButton" } }, providers: [MessageService], usesOnChanges: true, ngImport: i0, template: "<div class=\"card\">\r\n <!--TODO convertir en template y editarla en -->\r\n <h5 *ngIf=\"sfCrudService.registros.length == 1\" class=\"card-header mb-2\" style=\"display: flex; justify-content: space-between;align-items: center;\">\r\n <span>{{sfCrudService.registros[0]?.label || idForm.replaceAll('_', ' ')}} {{ids.length > 0 ? '-' + ids[0] : ''}}</span>\r\n <button *ngIf=\"sfCrudService.registros[0]?.canBack\" pButton pRipple type=\"button\" icon=\"pi pi-arrow-left\" (click)=\"back()\"></button>\r\n </h5>\r\n <div *ngIf=\"items.length > 1\">\r\n <app-step [items]=\"items\"></app-step>\r\n </div>\r\n <div *ngIf=\"items.length == 1\">\r\n <app-form [data]=\"sfCrudService.dataset[0]\" [esquema]=\"sfCrudService.esquemas[0]\"\r\n [uiEsquema]=\"sfCrudService.uiEsquemas[0]\" [isDialog]=\"false\"></app-form>\r\n\r\n <!--renderizar un codigo personalizado desde el componente padre o renderizar el que se tiene por defecto-->\r\n <ng-container *ngTemplateOutlet=\"buttonsFooterTemplate || defaultButtonsFooterTemplate\"></ng-container>\r\n <ng-template #defaultButtonsFooterTemplate>\r\n <div class=\"card-footer mt-2\" *ngIf=\"btnSubmit\">\r\n <button pButton pRipple type=\"button\" [icon]=\"btnSubmit.icon\" [label]=\"btnSubmit.label\" (click)=\"onClickBtnSubmit()\"></button>\r\n </div>\r\n </ng-template>\r\n </div>\r\n</div>\r\n\r\n<span *ngFor=\"let item of dialogElements; let $index=index\">\r\n <p-dialog [(visible)]=\"displays[$index]\" [modal]=\"true\" [header]=\"'Detalle'\" [closable]=\"false\">\r\n <!-- TODO header = currentElement.element.label ? currentElement.element.label: -->\r\n <app-form [data]=\"item.data\" [esquema]=\"item.esquema\" [uiEsquema]=\"item.uiEsquema\" [isDialog]=\"true\"\r\n [id]=\"ids[indexCrud]\" [isAddressDialog]=\"item.isAddressDialog === true\" [separador]=\"item.separador\"></app-form>\r\n <ng-template pTemplate=\"footer\">\r\n <p-button icon=\"pi pi-times\" (onClick)=\"removeDialogItem()\" label=\"Cancelar\" ></p-button>\r\n <p-button icon=\"pi pi-check\" [disabled]=\"item.esquema.disabled === true\" (onClick)=\"onCloseDialog($index)\" label=\"Ok\" pAutoFocus\r\n [autofocus]=\"true\"></p-button>\r\n </ng-template>\r\n </p-dialog>\r\n</span>\r\n\r\n<p-toast *ngIf=\"dialogElements.length == 0\">\r\n <ng-template let-message pTemplate=\"message\">\r\n <div class=\"custom-toast\">\r\n <i class=\"pi\" [ngClass]=\"{\r\n 'pi-check-circle': message.severity === 'success',\r\n 'pi-info-circle': message.severity === 'info',\r\n 'pi-exclamation-triangle': message.severity === 'warn',\r\n 'pi-times-circle': message.severity === 'error'\r\n }\"></i>\r\n <div class=\"custom-toast-content\">\r\n <span class=\"custom-toast-detail\">{{message.detail}}</span>\r\n </div>\r\n </div>\r\n </ng-template>\r\n</p-toast>\r\n\r\n\r\n", styles: ["@media screen and (max-width: 600px){::ng-deep .p-toast{width:90vw!important;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);opacity:1}::ng-deep .p-dialog-mask .p-dialog{width:95vw}}@media screen and (min-width: 601px){::ng-deep .p-toast{width:25rem!important;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);opacity:1}}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.custom-toast{padding:8px;display:-webkit-box;z-index:inherit;justify-content:center;width:100%}.custom-toast-detail{display:flex;font-family:sans-serif;font-size:1.05rem;font-weight:400;margin:.5rem 0 0 .5rem;width:80%}.custom-toast i{margin-right:.5rem;font-size:2rem;width:100%;height:100%}::ng-deep .p-toast-message{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}::ng-deep .p-toast .p-toast-message.p-toast-message-info{background:#b3e5fc;border:solid #0891cf;color:#0891cf;border-width:0 0 0 6px}::ng-deep .p-toast .p-toast-message{border-radius:6px}::ng-deep .p-toast .p-toast-message.p-toast-message-warn{background:#fff2e2b3;border:solid #cc8925;color:#cc8925;border-width:0 0 0 6px}::ng-deep .p-toast .p-toast-message.p-toast-message-error{background:#ffcdd2;border:solid #e60017;color:#e60017;border-width:0 0 0 6px}::ng-deep .p-toast .p-toast-message.p-toast-message-success{background:#c8e6c9;border:solid #439446;color:#439446;border-width:0 0 0 6px}::ng-deep .p-toast .p-toast-message .p-toast-icon-close{margin-top:1rem;margin-right:1.5rem}::ng-deep .p-toast .p-toast-message.p-toast-message-warn .p-toast-icon-close{color:#cc8925}::ng-deep .p-toast .p-toast-message.p-toast-message-info .p-toast-icon-close{color:#0891cf}::ng-deep .p-toast .p-toast-message.p-toast-message-error .p-toast-icon-close{color:#e60017}::ng-deep .p-toast .p-toast-message.p-toast-message-succes .p-toast-icon-close{color:#439446}\n"], dependencies: [{ kind: "directive", type: i1$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "directive", type: i8.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i8.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "component", type: i10$2.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "directive", type: i8$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i8$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i8$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i8$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i12.Ripple, selector: "[pRipple]" }, { kind: "component", type: i12$1.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "life", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { kind: "component", type: StepComponent, selector: "app-step", inputs: ["items"] }, { kind: "component", type: FormComponent, selector: "app-form", inputs: ["uiEsquema", "esquema", "data", "isDialog", "isAddressDialog", "separador"] }] });
2890
+ }
2891
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: RegistroComponent, decorators: [{
2892
+ type: Component,
2893
+ args: [{ selector: 'sf-registro', providers: [MessageService], standalone: false, template: "<div class=\"card\">\r\n <!--TODO convertir en template y editarla en -->\r\n <h5 *ngIf=\"sfCrudService.registros.length == 1\" class=\"card-header mb-2\" style=\"display: flex; justify-content: space-between;align-items: center;\">\r\n <span>{{sfCrudService.registros[0]?.label || idForm.replaceAll('_', ' ')}} {{ids.length > 0 ? '-' + ids[0] : ''}}</span>\r\n <button *ngIf=\"sfCrudService.registros[0]?.canBack\" pButton pRipple type=\"button\" icon=\"pi pi-arrow-left\" (click)=\"back()\"></button>\r\n </h5>\r\n <div *ngIf=\"items.length > 1\">\r\n <app-step [items]=\"items\"></app-step>\r\n </div>\r\n <div *ngIf=\"items.length == 1\">\r\n <app-form [data]=\"sfCrudService.dataset[0]\" [esquema]=\"sfCrudService.esquemas[0]\"\r\n [uiEsquema]=\"sfCrudService.uiEsquemas[0]\" [isDialog]=\"false\"></app-form>\r\n\r\n <!--renderizar un codigo personalizado desde el componente padre o renderizar el que se tiene por defecto-->\r\n <ng-container *ngTemplateOutlet=\"buttonsFooterTemplate || defaultButtonsFooterTemplate\"></ng-container>\r\n <ng-template #defaultButtonsFooterTemplate>\r\n <div class=\"card-footer mt-2\" *ngIf=\"btnSubmit\">\r\n <button pButton pRipple type=\"button\" [icon]=\"btnSubmit.icon\" [label]=\"btnSubmit.label\" (click)=\"onClickBtnSubmit()\"></button>\r\n </div>\r\n </ng-template>\r\n </div>\r\n</div>\r\n\r\n<span *ngFor=\"let item of dialogElements; let $index=index\">\r\n <p-dialog [(visible)]=\"displays[$index]\" [modal]=\"true\" [header]=\"'Detalle'\" [closable]=\"false\">\r\n <!-- TODO header = currentElement.element.label ? currentElement.element.label: -->\r\n <app-form [data]=\"item.data\" [esquema]=\"item.esquema\" [uiEsquema]=\"item.uiEsquema\" [isDialog]=\"true\"\r\n [id]=\"ids[indexCrud]\" [isAddressDialog]=\"item.isAddressDialog === true\" [separador]=\"item.separador\"></app-form>\r\n <ng-template pTemplate=\"footer\">\r\n <p-button icon=\"pi pi-times\" (onClick)=\"removeDialogItem()\" label=\"Cancelar\" ></p-button>\r\n <p-button icon=\"pi pi-check\" [disabled]=\"item.esquema.disabled === true\" (onClick)=\"onCloseDialog($index)\" label=\"Ok\" pAutoFocus\r\n [autofocus]=\"true\"></p-button>\r\n </ng-template>\r\n </p-dialog>\r\n</span>\r\n\r\n<p-toast *ngIf=\"dialogElements.length == 0\">\r\n <ng-template let-message pTemplate=\"message\">\r\n <div class=\"custom-toast\">\r\n <i class=\"pi\" [ngClass]=\"{\r\n 'pi-check-circle': message.severity === 'success',\r\n 'pi-info-circle': message.severity === 'info',\r\n 'pi-exclamation-triangle': message.severity === 'warn',\r\n 'pi-times-circle': message.severity === 'error'\r\n }\"></i>\r\n <div class=\"custom-toast-content\">\r\n <span class=\"custom-toast-detail\">{{message.detail}}</span>\r\n </div>\r\n </div>\r\n </ng-template>\r\n</p-toast>\r\n\r\n\r\n", styles: ["@media screen and (max-width: 600px){::ng-deep .p-toast{width:90vw!important;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);opacity:1}::ng-deep .p-dialog-mask .p-dialog{width:95vw}}@media screen and (min-width: 601px){::ng-deep .p-toast{width:25rem!important;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);opacity:1}}@keyframes rotation{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.custom-toast{padding:8px;display:-webkit-box;z-index:inherit;justify-content:center;width:100%}.custom-toast-detail{display:flex;font-family:sans-serif;font-size:1.05rem;font-weight:400;margin:.5rem 0 0 .5rem;width:80%}.custom-toast i{margin-right:.5rem;font-size:2rem;width:100%;height:100%}::ng-deep .p-toast-message{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}::ng-deep .p-toast .p-toast-message.p-toast-message-info{background:#b3e5fc;border:solid #0891cf;color:#0891cf;border-width:0 0 0 6px}::ng-deep .p-toast .p-toast-message{border-radius:6px}::ng-deep .p-toast .p-toast-message.p-toast-message-warn{background:#fff2e2b3;border:solid #cc8925;color:#cc8925;border-width:0 0 0 6px}::ng-deep .p-toast .p-toast-message.p-toast-message-error{background:#ffcdd2;border:solid #e60017;color:#e60017;border-width:0 0 0 6px}::ng-deep .p-toast .p-toast-message.p-toast-message-success{background:#c8e6c9;border:solid #439446;color:#439446;border-width:0 0 0 6px}::ng-deep .p-toast .p-toast-message .p-toast-icon-close{margin-top:1rem;margin-right:1.5rem}::ng-deep .p-toast .p-toast-message.p-toast-message-warn .p-toast-icon-close{color:#cc8925}::ng-deep .p-toast .p-toast-message.p-toast-message-info .p-toast-icon-close{color:#0891cf}::ng-deep .p-toast .p-toast-message.p-toast-message-error .p-toast-icon-close{color:#e60017}::ng-deep .p-toast .p-toast-message.p-toast-message-succes .p-toast-icon-close{color:#439446}\n"] }]
2894
+ }], ctorParameters: () => [{ type: GeneralService }, { type: i2.ActivatedRoute }, { type: i1$1.MessageService }, { type: SfCrudService }, { type: StepService }, { type: i6$1.SfPdfsignService }, { type: i7$2.SfSimuladorService }, { type: NotificationService }, { type: i2.Router }], propDecorators: { color: [{
2895
+ type: HostBinding,
2896
+ args: ["style.--primary-color"]
2897
+ }], color2: [{
2898
+ type: HostBinding,
2899
+ args: ["style.--secondary-color"]
2900
+ }], colorButton: [{
2901
+ type: HostBinding,
2902
+ args: ["style.--button-color"]
2903
+ }], idKatios: [{
2904
+ type: Input
2905
+ }], trx: [{
2906
+ type: Input
2907
+ }], id: [{
2908
+ type: Input
2909
+ }], user: [{
2910
+ type: Input
2911
+ }], dataExt: [{
2912
+ type: Input
2913
+ }], ids: [{
2914
+ type: Input
2915
+ }], environment: [{
2916
+ type: Input
2917
+ }], buttonsFooterTemplate: [{
2918
+ type: Input
2919
+ }], sendData: [{
2920
+ type: Output
2921
+ }], onSubmit: [{
2922
+ type: Output
2923
+ }], idEntidad: [{
2924
+ type: Input
2925
+ }] } });
2926
+
2927
+ class SfCrudComponent {
2928
+ constructor() { }
2929
+ ngOnInit() {
2930
+ }
2931
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2932
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.14", type: SfCrudComponent, isStandalone: false, selector: "lib-sf-crud", ngImport: i0, template: `
2933
+ <p>
2934
+ sf-crud works!
2935
+ </p>
2936
+ `, isInline: true });
2937
+ }
2938
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudComponent, decorators: [{
2939
+ type: Component,
2940
+ args: [{ selector: 'lib-sf-crud', template: `
2941
+ <p>
2942
+ sf-crud works!
2943
+ </p>
2944
+ `, standalone: false }]
2945
+ }], ctorParameters: () => [] });
2946
+
2947
+ const routes = [
2948
+ { path: ':idStep',
2949
+ component: FormComponent
2950
+ }
2951
+ ];
2952
+ class SfCrudRoutingModule {
2953
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2954
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: SfCrudRoutingModule, imports: [i2.RouterModule], exports: [RouterModule] });
2955
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] });
2956
+ }
2957
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudRoutingModule, decorators: [{
2958
+ type: NgModule,
2959
+ args: [{
2960
+ imports: [RouterModule.forChild(routes)],
2961
+ exports: [RouterModule]
2962
+ }]
2963
+ }] });
2964
+
2965
+ class SfCrudModule {
2966
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2967
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: SfCrudModule, declarations: [SfCrudComponent,
2968
+ TableroComponent,
2969
+ RegistroComponent,
2970
+ ControlComponent,
2971
+ StepComponent,
2972
+ FormComponent,
2973
+ FileUploadComponent,
2974
+ FormatAddressPipe], imports: [SfCrudRoutingModule,
2975
+ SfPdfsignModule,
2976
+ SfSimuladorModule,
2977
+ AccordionModule,
2978
+ AutoCompleteModule,
2979
+ AvatarGroupModule,
2980
+ AvatarModule,
2981
+ BadgeModule,
2982
+ BlockUIModule,
2983
+ BreadcrumbModule,
2984
+ ButtonModule,
2985
+ CalendarModule,
2986
+ CardModule,
2987
+ CarouselModule,
2988
+ CascadeSelectModule,
2989
+ CheckboxModule,
2990
+ ChipModule,
2991
+ ChipModule,
2992
+ ColorPickerModule,
2993
+ ConfirmDialogModule,
2994
+ ConfirmPopupModule,
2995
+ ContextMenuModule,
2996
+ DialogModule,
2997
+ DividerModule,
2998
+ DropdownModule,
2999
+ DatePickerModule,
3000
+ FieldsetModule,
3001
+ FileUploadModule,
3002
+ FormsModule,
3003
+ GalleriaModule,
3004
+ HttpClientModule,
3005
+ RouterModule,
3006
+ InplaceModule,
3007
+ InputMaskModule,
3008
+ InputNumberModule,
3009
+ InputSwitchModule,
3010
+ InputGroupModule,
3011
+ InputGroupAddonModule,
3012
+ IconFieldModule,
3013
+ InputIconModule,
3014
+ TextareaModule,
3015
+ InputTextModule,
3016
+ KnobModule,
3017
+ ListboxModule,
3018
+ MegaMenuModule,
3019
+ MenubarModule,
3020
+ MenuModule,
3021
+ MessageModule,
3022
+ MultiSelectModule,
3023
+ OrganizationChartModule,
3024
+ OverlayPanelModule,
3025
+ PanelMenuModule,
3026
+ PanelModule,
3027
+ PasswordModule,
3028
+ ProgressBarModule,
3029
+ RadioButtonModule,
3030
+ RatingModule,
3031
+ RippleModule,
3032
+ ScrollPanelModule,
3033
+ ScrollTopModule,
3034
+ SelectButtonModule,
3035
+ SidebarModule,
3036
+ SkeletonModule,
3037
+ SliderModule,
3038
+ SplitButtonModule,
3039
+ SplitterModule,
3040
+ StepsModule,
3041
+ SelectModule,
3042
+ TableModule,
3043
+ TabMenuModule,
3044
+ TabViewModule,
3045
+ TagModule,
3046
+ TerminalModule,
3047
+ TieredMenuModule,
3048
+ TimelineModule,
3049
+ ToastModule,
3050
+ ToggleButtonModule,
3051
+ ToolbarModule,
3052
+ TooltipModule,
3053
+ TreeModule,
3054
+ SfAdoModule], exports: [SfCrudComponent,
3055
+ TableroComponent,
3056
+ RegistroComponent,
3057
+ ControlComponent] });
3058
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudModule, imports: [SfCrudRoutingModule,
3059
+ SfPdfsignModule,
3060
+ SfSimuladorModule,
3061
+ AccordionModule,
3062
+ AutoCompleteModule,
3063
+ AvatarGroupModule,
3064
+ AvatarModule,
3065
+ BadgeModule,
3066
+ BlockUIModule,
3067
+ BreadcrumbModule,
3068
+ ButtonModule,
3069
+ CalendarModule,
3070
+ CardModule,
3071
+ CarouselModule,
3072
+ CascadeSelectModule,
3073
+ CheckboxModule,
3074
+ ChipModule,
3075
+ ChipModule,
3076
+ ColorPickerModule,
3077
+ ConfirmDialogModule,
3078
+ ConfirmPopupModule,
3079
+ ContextMenuModule,
3080
+ DialogModule,
3081
+ DividerModule,
3082
+ DropdownModule,
3083
+ DatePickerModule,
3084
+ FieldsetModule,
3085
+ FileUploadModule,
3086
+ FormsModule,
3087
+ GalleriaModule,
3088
+ HttpClientModule,
3089
+ RouterModule,
3090
+ InplaceModule,
3091
+ InputMaskModule,
3092
+ InputNumberModule,
3093
+ InputSwitchModule,
3094
+ InputGroupModule,
3095
+ InputGroupAddonModule,
3096
+ IconFieldModule,
3097
+ InputIconModule,
3098
+ TextareaModule,
3099
+ InputTextModule,
3100
+ KnobModule,
3101
+ ListboxModule,
3102
+ MegaMenuModule,
3103
+ MenubarModule,
3104
+ MenuModule,
3105
+ MessageModule,
3106
+ MultiSelectModule,
3107
+ OrganizationChartModule,
3108
+ OverlayPanelModule,
3109
+ PanelMenuModule,
3110
+ PanelModule,
3111
+ PasswordModule,
3112
+ ProgressBarModule,
3113
+ RadioButtonModule,
3114
+ RatingModule,
3115
+ RippleModule,
3116
+ ScrollPanelModule,
3117
+ ScrollTopModule,
3118
+ SelectButtonModule,
3119
+ SidebarModule,
3120
+ SkeletonModule,
3121
+ SliderModule,
3122
+ SplitButtonModule,
3123
+ SplitterModule,
3124
+ StepsModule,
3125
+ SelectModule,
3126
+ TableModule,
3127
+ TabMenuModule,
3128
+ TabViewModule,
3129
+ TagModule,
3130
+ TerminalModule,
3131
+ TieredMenuModule,
3132
+ TimelineModule,
3133
+ ToastModule,
3134
+ ToggleButtonModule,
3135
+ ToolbarModule,
3136
+ TooltipModule,
3137
+ TreeModule,
3138
+ SfAdoModule] });
3139
+ }
3140
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SfCrudModule, decorators: [{
3141
+ type: NgModule,
3142
+ args: [{
3143
+ declarations: [
3144
+ SfCrudComponent,
3145
+ TableroComponent,
3146
+ RegistroComponent,
3147
+ ControlComponent,
3148
+ StepComponent,
3149
+ FormComponent,
3150
+ FileUploadComponent,
3151
+ FormatAddressPipe
3152
+ ],
3153
+ imports: [
3154
+ SfCrudRoutingModule,
3155
+ SfPdfsignModule,
3156
+ SfSimuladorModule,
3157
+ AccordionModule,
3158
+ AutoCompleteModule,
3159
+ AvatarGroupModule,
3160
+ AvatarModule,
3161
+ BadgeModule,
3162
+ BlockUIModule,
3163
+ BreadcrumbModule,
3164
+ ButtonModule,
3165
+ CalendarModule,
3166
+ CardModule,
3167
+ CarouselModule,
3168
+ CascadeSelectModule,
3169
+ CheckboxModule,
3170
+ ChipModule,
3171
+ ChipModule,
3172
+ ColorPickerModule,
3173
+ ConfirmDialogModule,
3174
+ ConfirmPopupModule,
3175
+ ContextMenuModule,
3176
+ DialogModule,
3177
+ DividerModule,
3178
+ DropdownModule,
3179
+ DatePickerModule,
3180
+ FieldsetModule,
3181
+ FileUploadModule,
3182
+ FormsModule,
3183
+ GalleriaModule,
3184
+ HttpClientModule,
3185
+ RouterModule,
3186
+ InplaceModule,
3187
+ InputMaskModule,
3188
+ InputNumberModule,
3189
+ InputSwitchModule,
3190
+ InputGroupModule,
3191
+ InputGroupAddonModule,
3192
+ IconFieldModule,
3193
+ InputIconModule,
3194
+ TextareaModule,
3195
+ InputTextModule,
3196
+ KnobModule,
3197
+ ListboxModule,
3198
+ MegaMenuModule,
3199
+ MenubarModule,
3200
+ MenuModule,
3201
+ MessageModule,
3202
+ MultiSelectModule,
3203
+ OrganizationChartModule,
3204
+ OverlayPanelModule,
3205
+ PanelMenuModule,
3206
+ PanelModule,
3207
+ PasswordModule,
3208
+ ProgressBarModule,
3209
+ RadioButtonModule,
3210
+ RatingModule,
3211
+ RippleModule,
3212
+ ScrollPanelModule,
3213
+ ScrollTopModule,
3214
+ SelectButtonModule,
3215
+ SidebarModule,
3216
+ SkeletonModule,
3217
+ SliderModule,
3218
+ SplitButtonModule,
3219
+ SplitterModule,
3220
+ StepsModule,
3221
+ SelectModule,
3222
+ TableModule,
3223
+ TabMenuModule,
3224
+ TabViewModule,
3225
+ TagModule,
3226
+ TerminalModule,
3227
+ TieredMenuModule,
3228
+ TimelineModule,
3229
+ ToastModule,
3230
+ ToggleButtonModule,
3231
+ ToolbarModule,
3232
+ TooltipModule,
3233
+ TreeModule,
3234
+ SfAdoModule
3235
+ ],
3236
+ exports: [
3237
+ SfCrudComponent,
3238
+ TableroComponent,
3239
+ RegistroComponent,
3240
+ ControlComponent
3241
+ ]
3242
+ }]
3243
+ }] });
3244
+
3245
+ /*
3246
+ * Public API Surface of sf-crud
3247
+ */
3248
+
3249
+ /**
3250
+ * Generated bundle index. Do not edit.
3251
+ */
3252
+
3253
+ export { ChangeData, ConfigRegistro, ConfigTablero, ConstructionId, ControlComponent, CrudConfig, FormComponent, Key, Notification, NotificationService, Operation, OverrideConfig, RegistroComponent, RequestChecking, SfCrudComponent, SfCrudModule, SfCrudService, Shema, StepService, TableroComponent, Validations, keyEsquema };
3254
+ //# sourceMappingURL=sf-crud.mjs.map