sf-crud 12.3.3 → 13.0.0

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