sf-crud 12.0.5 → 12.1.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 (47) hide show
  1. package/bundles/sf-crud.umd.js +2563 -1306
  2. package/bundles/sf-crud.umd.js.map +1 -1
  3. package/esm2015/lib/components/control/control.component.js +285 -73
  4. package/esm2015/lib/components/file-upload/file-upload.component.js +143 -0
  5. package/esm2015/lib/components/form/form.component.js +267 -0
  6. package/esm2015/lib/components/registro/registro.component.js +507 -407
  7. package/esm2015/lib/components/step/step.component.js +79 -0
  8. package/esm2015/lib/components/tablero/tablero.component.js +87 -27
  9. package/esm2015/lib/sf-crud.module.js +27 -15
  10. package/esm2015/lib/sf-crud.routing.module.js +23 -0
  11. package/esm2015/lib/sf-crud.service.js +486 -12
  12. package/esm2015/lib/shared/models/Conditions.model.js +81 -0
  13. package/esm2015/lib/shared/models/Empresa.model.js +2 -0
  14. package/esm2015/lib/shared/models/Reason.model.js +7 -0
  15. package/esm2015/lib/shared/models/crud-config.model.js +36 -13
  16. package/esm2015/lib/shared/models/shema.model.js +5 -1
  17. package/esm2015/lib/shared/services/general.service.js +41 -17
  18. package/esm2015/lib/shared/services/notification.service.js +83 -0
  19. package/esm2015/lib/shared/services/step.service.js +65 -0
  20. package/esm2015/public-api.js +7 -1
  21. package/fesm2015/sf-crud.js +2194 -1151
  22. package/fesm2015/sf-crud.js.map +1 -1
  23. package/lib/components/control/control.component.d.ts +39 -10
  24. package/lib/components/file-upload/file-upload.component.d.ts +34 -0
  25. package/lib/components/form/form.component.d.ts +58 -0
  26. package/lib/components/registro/registro.component.d.ts +81 -54
  27. package/lib/components/step/step.component.d.ts +27 -0
  28. package/lib/components/tablero/tablero.component.d.ts +15 -5
  29. package/lib/sf-crud.module.d.ts +80 -76
  30. package/lib/sf-crud.routing.module.d.ts +7 -0
  31. package/lib/sf-crud.service.d.ts +115 -5
  32. package/lib/shared/models/Conditions.model.d.ts +32 -0
  33. package/lib/shared/models/Empresa.model.d.ts +11 -0
  34. package/lib/shared/models/Reason.model.d.ts +5 -0
  35. package/lib/shared/models/crud-config.model.d.ts +76 -24
  36. package/lib/shared/models/shema.model.d.ts +27 -0
  37. package/lib/shared/services/general.service.d.ts +8 -1
  38. package/lib/shared/services/notification.service.d.ts +27 -0
  39. package/lib/shared/services/step.service.d.ts +27 -0
  40. package/package.json +9 -2
  41. package/public-api.d.ts +6 -0
  42. package/esm2015/lib/components/registro-child/registro-child.component.js +0 -348
  43. package/esm2015/lib/components/registro-detalle/registro-detalle.component.js +0 -232
  44. package/esm2015/lib/shared/models/data-temp-crud.model.js +0 -6
  45. package/lib/components/registro-child/registro-child.component.d.ts +0 -48
  46. package/lib/components/registro-detalle/registro-detalle.component.d.ts +0 -36
  47. package/lib/shared/models/data-temp-crud.model.d.ts +0 -4
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('lodash'), require('jsonpath'), require('@angular/common/http'), require('@angular/router'), require('primeng/blockui'), require('primeng/toolbar'), require('primeng/table'), require('primeng/splitbutton'), require('@angular/common'), require('primeng/api'), require('primeng/button'), require('primeng/ripple'), require('primeng/inputtext'), require('primeng/dynamicdialog'), require('moment'), require('primeng/toast'), require('primeng/inputmask'), require('primeng/dropdown'), require('primeng/autocomplete'), require('primeng/calendar'), require('primeng/inputnumber'), require('primeng/fileupload'), require('primeng/inputswitch'), require('@angular/forms'), require('primeng/inputtextarea'), require('sweetalert2'), require('primeng/accordion'), require('primeng/avatargroup'), require('primeng/avatar'), require('primeng/badge'), require('primeng/breadcrumb'), require('primeng/card'), require('primeng/carousel'), require('primeng/cascadeselect'), require('primeng/checkbox'), require('primeng/chip'), require('primeng/chips'), require('primeng/colorpicker'), require('primeng/confirmdialog'), require('primeng/confirmpopup'), require('primeng/contextmenu'), require('primeng/dialog'), require('primeng/divider'), require('primeng/fieldset'), require('primeng/galleria'), require('primeng/inplace'), require('primeng/knob'), require('primeng/listbox'), require('primeng/megamenu'), require('primeng/menubar'), require('primeng/menu'), require('primeng/message'), require('primeng/messages'), require('primeng/multiselect'), require('primeng/organizationchart'), require('primeng/overlaypanel'), require('primeng/panelmenu'), require('primeng/panel'), require('primeng/password'), require('primeng/progressbar'), require('primeng/radiobutton'), require('primeng/rating'), require('primeng/scrollpanel'), require('primeng/scrolltop'), require('primeng/selectbutton'), require('primeng/sidebar'), require('primeng/skeleton'), require('primeng/slidemenu'), require('primeng/slider'), require('primeng/splitter'), require('primeng/steps'), require('primeng/tabmenu'), require('primeng/tabview'), require('primeng/tag'), require('primeng/terminal'), require('primeng/tieredmenu'), require('primeng/timeline'), require('primeng/togglebutton'), require('primeng/tooltip'), require('primeng/tree')) :
3
- typeof define === 'function' && define.amd ? define('sf-crud', ['exports', '@angular/core', 'lodash', 'jsonpath', '@angular/common/http', '@angular/router', 'primeng/blockui', 'primeng/toolbar', 'primeng/table', 'primeng/splitbutton', '@angular/common', 'primeng/api', 'primeng/button', 'primeng/ripple', 'primeng/inputtext', 'primeng/dynamicdialog', 'moment', 'primeng/toast', 'primeng/inputmask', 'primeng/dropdown', 'primeng/autocomplete', 'primeng/calendar', 'primeng/inputnumber', 'primeng/fileupload', 'primeng/inputswitch', '@angular/forms', 'primeng/inputtextarea', 'sweetalert2', 'primeng/accordion', 'primeng/avatargroup', 'primeng/avatar', 'primeng/badge', 'primeng/breadcrumb', 'primeng/card', 'primeng/carousel', 'primeng/cascadeselect', 'primeng/checkbox', 'primeng/chip', 'primeng/chips', 'primeng/colorpicker', 'primeng/confirmdialog', 'primeng/confirmpopup', 'primeng/contextmenu', 'primeng/dialog', 'primeng/divider', 'primeng/fieldset', 'primeng/galleria', 'primeng/inplace', 'primeng/knob', 'primeng/listbox', 'primeng/megamenu', 'primeng/menubar', 'primeng/menu', 'primeng/message', 'primeng/messages', 'primeng/multiselect', 'primeng/organizationchart', 'primeng/overlaypanel', 'primeng/panelmenu', 'primeng/panel', 'primeng/password', 'primeng/progressbar', 'primeng/radiobutton', 'primeng/rating', 'primeng/scrollpanel', 'primeng/scrolltop', 'primeng/selectbutton', 'primeng/sidebar', 'primeng/skeleton', 'primeng/slidemenu', 'primeng/slider', 'primeng/splitter', 'primeng/steps', 'primeng/tabmenu', 'primeng/tabview', 'primeng/tag', 'primeng/terminal', 'primeng/tieredmenu', 'primeng/timeline', 'primeng/togglebutton', 'primeng/tooltip', 'primeng/tree'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["sf-crud"] = {}, global.ng.core, global._, global.jsonpath, global.ng.common.http, global.ng.router, global.i3, global.i4, global.i5, global.i6, global.ng.common, global.i2$1, global.i9, global.i10, global.i11, global.i1$1, global.moment, global.i3$2, global.i2$2, global.i3$1, global.i4$1, global.i5$1, global.i6$1, global.i7$1, global.i8, global.ng.forms, global.i12, global.Swal, global.accordion, global.avatargroup, global.avatar, global.badge, global.breadcrumb, global.card, global.carousel, global.cascadeselect, global.checkbox, global.chip, global.chips, global.colorpicker, global.confirmdialog, global.confirmpopup, global.contextmenu, global.dialog, global.divider, global.fieldset, global.galleria, global.inplace, global.knob, global.listbox, global.megamenu, global.menubar, global.menu, global.message, global.messages, global.multiselect, global.organizationchart, global.overlaypanel, global.panelmenu, global.panel, global.password, global.progressbar, global.radiobutton, global.rating, global.scrollpanel, global.scrolltop, global.selectbutton, global.sidebar, global.skeleton, global.slidemenu, global.slider, global.splitter, global.steps, global.tabmenu, global.tabview, global.tag, global.terminal, global.tieredmenu, global.timeline, global.togglebutton, global.tooltip, global.tree));
5
- })(this, (function (exports, i0, _, jsonpath, i1, i2, i3, i4, i5, i6, i7, i2$1, i9, i10, i11, i1$1, moment, i3$2, i2$2, i3$1, i4$1, i5$1, i6$1, i7$1, i8, i10$1, i12, Swal, accordion, avatargroup, avatar, badge, breadcrumb, card, carousel, cascadeselect, checkbox, chip, chips, colorpicker, confirmdialog, confirmpopup, contextmenu, dialog, divider, fieldset, galleria, inplace, knob, listbox, megamenu, menubar, menu, message, messages, multiselect, organizationchart, overlaypanel, panelmenu, panel, password, progressbar, radiobutton, rating, scrollpanel, scrolltop, selectbutton, sidebar, skeleton, slidemenu, slider, splitter, steps, tabmenu, tabview, tag, terminal, tieredmenu, timeline, togglebutton, tooltip, tree) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('lodash'), require('jsonpath'), require('@angular/common/http'), require('@angular/router'), require('rxjs'), require('moment'), require('primeng/toolbar'), require('primeng/table'), require('primeng/splitbutton'), require('@angular/common'), require('primeng/api'), require('primeng/button'), require('primeng/ripple'), require('primeng/inputtext'), require('sweetalert2'), require('sf-pdfsign'), require('sf-simulador'), require('primeng/steps'), require('primeng/tooltip'), require('@angular/platform-browser'), require('sf-ado'), require('primeng/inputmask'), require('primeng/dropdown'), require('primeng/autocomplete'), require('primeng/calendar'), require('primeng/inputnumber'), require('primeng/multiselect'), require('primeng/inputswitch'), require('@angular/forms'), require('primeng/inputtextarea'), require('primeng/toast'), require('primeng/dialog'), require('primeng/accordion'), require('primeng/avatargroup'), require('primeng/avatar'), require('primeng/badge'), require('primeng/blockui'), require('primeng/breadcrumb'), require('primeng/card'), require('primeng/carousel'), require('primeng/cascadeselect'), require('primeng/checkbox'), require('primeng/chip'), require('primeng/chips'), require('primeng/colorpicker'), require('primeng/confirmdialog'), require('primeng/confirmpopup'), require('primeng/contextmenu'), require('primeng/divider'), require('primeng/dynamicdialog'), require('primeng/fieldset'), require('primeng/fileupload'), require('primeng/galleria'), require('primeng/inplace'), require('primeng/knob'), require('primeng/listbox'), require('primeng/megamenu'), require('primeng/menubar'), require('primeng/menu'), require('primeng/message'), require('primeng/organizationchart'), require('primeng/overlaypanel'), require('primeng/panelmenu'), require('primeng/panel'), require('primeng/password'), require('primeng/progressbar'), require('primeng/radiobutton'), require('primeng/rating'), require('primeng/scrollpanel'), require('primeng/scrolltop'), require('primeng/selectbutton'), require('primeng/sidebar'), require('primeng/skeleton'), require('primeng/slidemenu'), require('primeng/slider'), require('primeng/splitter'), require('primeng/tabmenu'), require('primeng/tabview'), require('primeng/tag'), require('primeng/terminal'), require('primeng/tieredmenu'), require('primeng/timeline'), require('primeng/togglebutton'), require('primeng/tree')) :
3
+ typeof define === 'function' && define.amd ? define('sf-crud', ['exports', '@angular/core', 'lodash', 'jsonpath', '@angular/common/http', '@angular/router', 'rxjs', 'moment', 'primeng/toolbar', 'primeng/table', 'primeng/splitbutton', '@angular/common', 'primeng/api', 'primeng/button', 'primeng/ripple', 'primeng/inputtext', 'sweetalert2', 'sf-pdfsign', 'sf-simulador', 'primeng/steps', 'primeng/tooltip', '@angular/platform-browser', 'sf-ado', 'primeng/inputmask', 'primeng/dropdown', 'primeng/autocomplete', 'primeng/calendar', 'primeng/inputnumber', 'primeng/multiselect', 'primeng/inputswitch', '@angular/forms', 'primeng/inputtextarea', 'primeng/toast', 'primeng/dialog', 'primeng/accordion', 'primeng/avatargroup', 'primeng/avatar', 'primeng/badge', 'primeng/blockui', 'primeng/breadcrumb', 'primeng/card', 'primeng/carousel', 'primeng/cascadeselect', 'primeng/checkbox', 'primeng/chip', 'primeng/chips', 'primeng/colorpicker', 'primeng/confirmdialog', 'primeng/confirmpopup', 'primeng/contextmenu', 'primeng/divider', 'primeng/dynamicdialog', 'primeng/fieldset', 'primeng/fileupload', 'primeng/galleria', 'primeng/inplace', 'primeng/knob', 'primeng/listbox', 'primeng/megamenu', 'primeng/menubar', 'primeng/menu', 'primeng/message', 'primeng/organizationchart', 'primeng/overlaypanel', 'primeng/panelmenu', 'primeng/panel', 'primeng/password', 'primeng/progressbar', 'primeng/radiobutton', 'primeng/rating', 'primeng/scrollpanel', 'primeng/scrolltop', 'primeng/selectbutton', 'primeng/sidebar', 'primeng/skeleton', 'primeng/slidemenu', 'primeng/slider', 'primeng/splitter', 'primeng/tabmenu', 'primeng/tabview', 'primeng/tag', 'primeng/terminal', 'primeng/tieredmenu', 'primeng/timeline', 'primeng/togglebutton', 'primeng/tree'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["sf-crud"] = {}, global.ng.core, global._, global.jsonpath, global.ng.common.http, global.ng.router, global.rxjs, global.moment, global.i5, global.i6, global.i7, global.ng.common, global.i1$1, global.i9, global.i11, global.i12$1, global.Swal, global.i6$2, global.i7$1, global.i3, global.i13, global.ng.platformBrowser, global.i5$2, global.i4, global.i5$1, global.i6$1, global.i8, global.i9$1, global.i10, global.i11$1, global.ng.forms, global.i16, global.i11$2, global.i11$3, global.accordion, global.avatargroup, global.avatar, global.badge, global.blockui, global.breadcrumb, global.card, global.carousel, global.cascadeselect, global.checkbox, global.chip, global.chips, global.colorpicker, global.confirmdialog, global.confirmpopup, global.contextmenu, global.divider, global.dynamicdialog, global.fieldset, global.fileupload, global.galleria, global.inplace, global.knob, global.listbox, global.megamenu, global.menubar, global.menu, global.message, global.organizationchart, global.overlaypanel, global.panelmenu, global.panel, global.password, global.progressbar, global.radiobutton, global.rating, global.scrollpanel, global.scrolltop, global.selectbutton, global.sidebar, global.skeleton, global.slidemenu, global.slider, global.splitter, global.tabmenu, global.tabview, global.tag, global.terminal, global.tieredmenu, global.timeline, global.togglebutton, global.tree));
5
+ })(this, (function (exports, i0, _, jsonpath, i1, i2, rxjs, moment, i5, i6, i7, i12, i1$1, i9, i11, i12$1, Swal, i6$2, i7$1, i3, i13, i3$1, i5$2, i4, i5$1, i6$1, i8, i9$1, i10, i11$1, i14, i16, i11$2, i11$3, accordion, avatargroup, avatar, badge, blockui, breadcrumb, card, carousel, cascadeselect, checkbox, chip, chips, colorpicker, confirmdialog, confirmpopup, contextmenu, divider, dynamicdialog, fieldset, fileupload, galleria, inplace, knob, listbox, megamenu, menubar, menu, message, organizationchart, overlaypanel, panelmenu, panel, password, progressbar, radiobutton, rating, scrollpanel, scrolltop, selectbutton, sidebar, skeleton, slidemenu, slider, splitter, tabmenu, tabview, tag, terminal, tieredmenu, timeline, togglebutton, tree) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -29,97 +29,33 @@
29
29
  var jsonpath__namespace = /*#__PURE__*/_interopNamespace(jsonpath);
30
30
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
31
31
  var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
32
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
33
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
32
+ var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
34
33
  var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
35
34
  var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
36
35
  var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
37
- var i2__namespace$1 = /*#__PURE__*/_interopNamespace(i2$1);
36
+ var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
37
+ var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
38
38
  var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
39
- var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
40
39
  var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
41
- var i1__namespace$1 = /*#__PURE__*/_interopNamespace(i1$1);
42
- var moment__namespace = /*#__PURE__*/_interopNamespace(moment);
43
- var i3__namespace$2 = /*#__PURE__*/_interopNamespace(i3$2);
44
- var i2__namespace$2 = /*#__PURE__*/_interopNamespace(i2$2);
40
+ var i12__namespace$1 = /*#__PURE__*/_interopNamespace(i12$1);
41
+ var Swal__default = /*#__PURE__*/_interopDefaultLegacy(Swal);
42
+ var i6__namespace$2 = /*#__PURE__*/_interopNamespace(i6$2);
43
+ var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);
44
+ var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
45
+ var i13__namespace = /*#__PURE__*/_interopNamespace(i13);
45
46
  var i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
46
- var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
47
+ var i5__namespace$2 = /*#__PURE__*/_interopNamespace(i5$2);
48
+ var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
47
49
  var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5$1);
48
50
  var i6__namespace$1 = /*#__PURE__*/_interopNamespace(i6$1);
49
- var i7__namespace$1 = /*#__PURE__*/_interopNamespace(i7$1);
50
51
  var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
51
- var i10__namespace$1 = /*#__PURE__*/_interopNamespace(i10$1);
52
- var i12__namespace = /*#__PURE__*/_interopNamespace(i12);
53
- var Swal__default = /*#__PURE__*/_interopDefaultLegacy(Swal);
54
-
55
- var Shema = /** @class */ (function () {
56
- function Shema() {
57
- this.type = '';
58
- this.subtype = '';
59
- }
60
- return Shema;
61
- }());
62
-
63
- var CrudConfig = /** @class */ (function () {
64
- function CrudConfig() {
65
- this.idEntidad = '';
66
- this.tablero = new ConfigTablero();
67
- this.esquema = new Shema();
68
- this.registro = new ConfigRegistro();
69
- }
70
- return CrudConfig;
71
- }());
72
- var ConfigTablero = /** @class */ (function () {
73
- function ConfigTablero() {
74
- this.columns = [];
75
- this.endpoint = '';
76
- this.method = '';
77
- this.server = '';
78
- this.filters = [];
79
- this.keys = [];
80
- }
81
- return ConfigTablero;
82
- }());
83
- var ConfigRegistro = /** @class */ (function () {
84
- function ConfigRegistro() {
85
- this.operations = [];
86
- this.btnBack = '';
87
- }
88
- return ConfigRegistro;
89
- }());
90
- var Operations = /** @class */ (function () {
91
- function Operations() {
92
- this.type = '';
93
- this.server = '';
94
- this.endpoint = '';
95
- this.method = '';
96
- this.validations = new Validations();
97
- }
98
- return Operations;
99
- }());
100
- var Key = /** @class */ (function () {
101
- function Key() {
102
- }
103
- return Key;
104
- }());
105
- var Validations = /** @class */ (function () {
106
- function Validations() {
107
- this.type = '';
108
- this.required = [];
109
- this.server = '';
110
- this.endpoint = '';
111
- }
112
- return Validations;
113
- }());
114
- var RequestChecking = /** @class */ (function () {
115
- function RequestChecking(dynamics, statics, swal, redirect) {
116
- this.dynamics = dynamics;
117
- this.statics = statics;
118
- this.swal = swal;
119
- this.redirect = redirect;
120
- }
121
- return RequestChecking;
122
- }());
52
+ var i9__namespace$1 = /*#__PURE__*/_interopNamespace(i9$1);
53
+ var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
54
+ var i11__namespace$1 = /*#__PURE__*/_interopNamespace(i11$1);
55
+ var i14__namespace = /*#__PURE__*/_interopNamespace(i14);
56
+ var i16__namespace = /*#__PURE__*/_interopNamespace(i16);
57
+ var i11__namespace$2 = /*#__PURE__*/_interopNamespace(i11$2);
58
+ var i11__namespace$3 = /*#__PURE__*/_interopNamespace(i11$3);
123
59
 
124
60
  /******************************************************************************
125
61
  Copyright (c) Microsoft Corporation.
@@ -533,42 +469,189 @@
533
469
  __classPrivateFieldIn: __classPrivateFieldIn,
534
470
  };
535
471
 
472
+ var CrudConfig = /** @class */ (function () {
473
+ function CrudConfig() {
474
+ this.idEntidad = '';
475
+ this.uiEsquemas = [];
476
+ this.esquemas = [];
477
+ this.registros = [];
478
+ }
479
+ return CrudConfig;
480
+ }());
481
+ var ConfigTablero = /** @class */ (function () {
482
+ function ConfigTablero() {
483
+ this.columns = [];
484
+ this.endpoint = '';
485
+ this.method = '';
486
+ this.server = '';
487
+ this.filters = [];
488
+ this.keys = [];
489
+ }
490
+ return ConfigTablero;
491
+ }());
492
+ var ConfigRegistro = /** @class */ (function () {
493
+ function ConfigRegistro() {
494
+ this.operations = [];
495
+ this.btnBack = '';
496
+ this.canBack = false;
497
+ this.conditions = [];
498
+ }
499
+ return ConfigRegistro;
500
+ }());
501
+ var Operation = /** @class */ (function () {
502
+ function Operation() {
503
+ this.method = '';
504
+ this.changeTrx = [];
505
+ }
506
+ return Operation;
507
+ }());
508
+ var ConstructionId = /** @class */ (function () {
509
+ function ConstructionId() {
510
+ }
511
+ return ConstructionId;
512
+ }());
513
+ var Validations = /** @class */ (function () {
514
+ function Validations() {
515
+ this.type = '';
516
+ this.required = [];
517
+ this.equals = [];
518
+ this.different = [];
519
+ this.server = '';
520
+ this.endpoint = '';
521
+ }
522
+ return Validations;
523
+ }());
524
+ var ValidationRequired = /** @class */ (function () {
525
+ function ValidationRequired() {
526
+ }
527
+ return ValidationRequired;
528
+ }());
529
+ var ValidationEqual = /** @class */ (function (_super) {
530
+ __extends(ValidationEqual, _super);
531
+ function ValidationEqual(value) {
532
+ var _this = _super.call(this) || this;
533
+ _this.value = value;
534
+ return _this;
535
+ }
536
+ return ValidationEqual;
537
+ }(ValidationRequired));
538
+ var ValidationDifferent = /** @class */ (function (_super) {
539
+ __extends(ValidationDifferent, _super);
540
+ function ValidationDifferent(value) {
541
+ var _this = _super.call(this) || this;
542
+ _this.value = value;
543
+ return _this;
544
+ }
545
+ return ValidationDifferent;
546
+ }(ValidationRequired));
547
+ var RequestChecking = /** @class */ (function () {
548
+ function RequestChecking(dynamics, statics, useSwal, redirect, cancelRedirect, allowContinue, parse) {
549
+ this.dynamics = dynamics;
550
+ this.statics = statics;
551
+ this.useSwal = useSwal;
552
+ this.redirect = redirect;
553
+ this.cancelRedirect = cancelRedirect;
554
+ this.allowContinue = allowContinue;
555
+ this.parse = parse;
556
+ }
557
+ return RequestChecking;
558
+ }());
559
+ var Key = /** @class */ (function () {
560
+ function Key() {
561
+ }
562
+ return Key;
563
+ }());
564
+ var OverrideConfig = /** @class */ (function () {
565
+ function OverrideConfig() {
566
+ }
567
+ return OverrideConfig;
568
+ }());
569
+ var keyEsquema = /** @class */ (function () {
570
+ function keyEsquema() {
571
+ }
572
+ return keyEsquema;
573
+ }());
574
+
536
575
  var GeneralService = /** @class */ (function () {
537
576
  function GeneralService(http) {
538
- var _a;
539
577
  this.http = http;
540
578
  this.generales = '';
541
- this.jsonConfig = JSON.parse(sessionStorage.getItem('ConfigJSON') || '{}');
542
- this.generales = (_a = this.jsonConfig) === null || _a === void 0 ? void 0 : _a.ServidorGenerales;
543
579
  }
580
+ Object.defineProperty(GeneralService.prototype, "environment", {
581
+ get: function () {
582
+ if (!this.jsonConfig)
583
+ this.environment = JSON.parse(sessionStorage.getItem('ConfigJSON') || '{}');
584
+ return this.jsonConfig;
585
+ },
586
+ set: function (val) {
587
+ var _a;
588
+ this.jsonConfig = val;
589
+ this.generales = (_a = this.jsonConfig) === null || _a === void 0 ? void 0 : _a.ServidorGenerales;
590
+ },
591
+ enumerable: false,
592
+ configurable: true
593
+ });
594
+ Object.defineProperty(GeneralService.prototype, "idKatios", {
595
+ get: function () {
596
+ return this._idKatios;
597
+ },
598
+ set: function (value) {
599
+ this._idKatios = value;
600
+ },
601
+ enumerable: false,
602
+ configurable: true
603
+ });
544
604
  GeneralService.prototype.getCrudByEntidad = function (idKatios, idEntidad) {
545
605
  return __awaiter(this, void 0, void 0, function () {
546
606
  return __generator(this, function (_b) {
547
- return [2 /*return*/, this.http.get(this.generales + "crud/" + idKatios + "/" + idEntidad)
548
- .toPromise()
549
- .then(function (res) { return res.data; })
550
- .then(function (data) { return data; })];
607
+ return [2 /*return*/, this.http.get(this.generales + "crud/forms/" + idKatios + "/" + idEntidad).toPromise()
608
+ .then(function (res) { return res; })];
609
+ });
610
+ });
611
+ };
612
+ GeneralService.prototype.getFiles = function (urls, names) {
613
+ return __awaiter(this, void 0, void 0, function () {
614
+ var _this = this;
615
+ return __generator(this, function (_b) {
616
+ return [2 /*return*/, Promise.all(urls.map(function (url, i) { return __awaiter(_this, void 0, void 0, function () {
617
+ var response, arrayBuffer, tipo;
618
+ return __generator(this, function (_b) {
619
+ switch (_b.label) {
620
+ case 0: return [4 /*yield*/, this.http.get(url, { responseType: 'blob' }).toPromise()];
621
+ case 1:
622
+ response = _b.sent();
623
+ return [4 /*yield*/, response.arrayBuffer()];
624
+ case 2:
625
+ arrayBuffer = _b.sent();
626
+ tipo = names[i].includes(".pdf") ? 'application/pdf' : "image/" + this.getExt(names[i]);
627
+ return [2 /*return*/, new File([new Uint8Array(arrayBuffer)], names[i], { type: tipo })];
628
+ }
629
+ });
630
+ }); }))];
551
631
  });
552
632
  });
553
633
  };
554
- GeneralService.prototype.genericRequest = function (method, servidor, endpoint, data) {
634
+ GeneralService.prototype.getExt = function (name) {
635
+ var ext = undefined;
636
+ var aux = name.split('.');
637
+ if (aux.length > 0)
638
+ ext = aux[aux.length - 1];
639
+ return ext;
640
+ };
641
+ GeneralService.prototype.genericRequest = function (method, url, data) {
555
642
  return __awaiter(this, void 0, void 0, function () {
556
643
  return __generator(this, function (_b) {
557
644
  switch (method) {
558
645
  case 'GET':
559
- return [2 /*return*/, this.http.get("" + this.jsonConfig[servidor] + endpoint)
560
- .toPromise()];
646
+ return [2 /*return*/, this.http.get(url).toPromise()];
561
647
  case 'POST':
562
- return [2 /*return*/, this.http.post("" + this.jsonConfig[servidor] + endpoint, data)
563
- .toPromise()];
648
+ return [2 /*return*/, this.http.post(url, data).toPromise()];
564
649
  case 'PUT':
565
- return [2 /*return*/, this.http.put("" + this.jsonConfig[servidor] + endpoint, data)
566
- .toPromise()];
650
+ return [2 /*return*/, this.http.put(url, data).toPromise()];
567
651
  case 'DELETE':
568
- return [2 /*return*/, this.http.delete("" + this.jsonConfig[servidor] + endpoint, data)
569
- .toPromise()];
652
+ return [2 /*return*/, this.http.delete(url, data).toPromise()];
570
653
  default:
571
- return [2 /*return*/];
654
+ throw new Error("Invalid method");
572
655
  }
573
656
  return [2 /*return*/];
574
657
  });
@@ -585,81 +668,913 @@
585
668
  }]
586
669
  }], ctorParameters: function () { return [{ type: i1__namespace.HttpClient }]; } });
587
670
 
588
- var TableroComponent = /** @class */ (function () {
589
- function TableroComponent(generalService, router) {
590
- this.generalService = generalService;
591
- this.router = router;
592
- this.opciones = [];
593
- this.idEntidad = '';
594
- this.idKatios = '';
595
- this.onSelectAction = new i0.EventEmitter();
596
- this.items = [];
597
- this.crudConfig = new CrudConfig();
598
- this.enProceso = false;
599
- this.data = [];
600
- this.btn = { create: undefined, read: undefined, update: undefined, delete: undefined };
671
+ var Condition = /** @class */ (function () {
672
+ function Condition(type, attrs, indexData) {
673
+ this.type = type;
674
+ this.attrs = attrs;
675
+ this.indexData = indexData;
601
676
  }
602
- TableroComponent.prototype.ngOnInit = function () {
603
- this.loadConfigCrud();
604
- };
605
- TableroComponent.prototype.loadConfigCrud = function () {
677
+ Condition.instanceContidion = function (index, allConditions) {
606
678
  var _this = this;
607
- this.enProceso = true;
608
- this.generalService.getCrudByEntidad(this.idKatios, this.idEntidad)
609
- .then(function (res) {
610
- _this.crudConfig = res;
611
- _this.getInfoTablero(_this.crudConfig.tablero);
612
- })
613
- .catch(function (err) {
614
- console.log(err);
615
- _this.enProceso = false;
616
- });
679
+ var c;
680
+ switch (allConditions[index].type) {
681
+ case "different":
682
+ c = new ConditionDifferent(allConditions[index].attrs.field, allConditions[index].attrs.value, allConditions[index].attrs.grado || 2, allConditions[index].indexData);
683
+ break;
684
+ case "or":
685
+ var subconditions = allConditions[index].attrs.conditions.map(function (i) { return _this.instanceContidion(i, allConditions); });
686
+ c = new ConditionOr(subconditions, allConditions[index].indexData);
687
+ break;
688
+ case "and":
689
+ var subconditions2 = allConditions[index].attrs.conditions.map(function (i) { return _this.instanceContidion(i, allConditions); });
690
+ c = new ConditionAnd(subconditions2, allConditions[index].indexData);
691
+ break;
692
+ case "equal":
693
+ c = new ConditionEqual(allConditions[index].attrs.field, allConditions[index].attrs.value, allConditions[index].attrs.grado || 2, allConditions[index].indexData);
694
+ break;
695
+ }
696
+ return c;
697
+ };
698
+ return Condition;
699
+ }());
700
+ var ConditionEqual = /** @class */ (function (_super) {
701
+ __extends(ConditionEqual, _super);
702
+ function ConditionEqual(field, value, grado, indexData) {
703
+ var _this = _super.call(this, "equal", {}, indexData) || this;
704
+ _this.field = field;
705
+ _this.value = value;
706
+ _this.grado = grado;
707
+ return _this;
708
+ }
709
+ ConditionEqual.prototype.isValid = function (data) {
710
+ var cumple = true;
711
+ var res = jsonpath__namespace.query(data, this.field);
712
+ if (res.length > 0 && this.grado == 2)
713
+ cumple = this.value == res[0];
714
+ else if (res.length > 0 && this.grado == 3)
715
+ cumple = this.value === res[0];
716
+ return cumple;
717
+ };
718
+ return ConditionEqual;
719
+ }(Condition));
720
+ var ConditionDifferent = /** @class */ (function (_super) {
721
+ __extends(ConditionDifferent, _super);
722
+ function ConditionDifferent(field, value, grado, indexData) {
723
+ var _this = _super.call(this, "different", {}, indexData) || this;
724
+ _this.field = field;
725
+ _this.value = value;
726
+ _this.grado = grado;
727
+ return _this;
728
+ }
729
+ ConditionDifferent.prototype.isValid = function (data) {
730
+ var cumple = true;
731
+ var res = jsonpath__namespace.query(data, this.field);
732
+ if (res.length > 0 && this.grado == 2)
733
+ cumple = this.value != res[0];
734
+ else if (res.length > 0 && this.grado == 3)
735
+ cumple = this.value !== res[0];
736
+ return cumple;
737
+ };
738
+ return ConditionDifferent;
739
+ }(Condition));
740
+ var ConditionOr = /** @class */ (function (_super) {
741
+ __extends(ConditionOr, _super);
742
+ function ConditionOr(conditions, indexData) {
743
+ var _this = _super.call(this, "or", {}, indexData) || this;
744
+ _this.conditions = conditions;
745
+ return _this;
746
+ }
747
+ ConditionOr.prototype.isValid = function (data) {
748
+ return this.conditions.some(function (c) { return c.isValid(data); });
749
+ };
750
+ return ConditionOr;
751
+ }(Condition));
752
+ var ConditionAnd = /** @class */ (function (_super) {
753
+ __extends(ConditionAnd, _super);
754
+ function ConditionAnd(conditions, indexData) {
755
+ var _this = _super.call(this, "and", {}, indexData) || this;
756
+ _this.conditions = conditions;
757
+ return _this;
758
+ }
759
+ ConditionAnd.prototype.isValid = function (data) {
760
+ return this.conditions.every(function (c) { return c.isValid(data); });
761
+ };
762
+ return ConditionAnd;
763
+ }(Condition));
764
+
765
+ var SfCrudService = /** @class */ (function () {
766
+ function SfCrudService() {
767
+ this._esquemas = [];
768
+ this._uiEsquemas = [];
769
+ this._registros = [];
770
+ this._answers = [];
771
+ this._dataSet = [];
772
+ this._ids = [];
773
+ this.__index = 0;
774
+ this._configEmpresa = undefined;
775
+ this._trx = [];
776
+ this._changeData = new rxjs.BehaviorSubject(undefined);
777
+ this.__formLoading = new rxjs.BehaviorSubject({ inProgress: false, target: undefined });
778
+ this._crudLoaded = new rxjs.BehaviorSubject(false);
779
+ }
780
+ Object.defineProperty(SfCrudService.prototype, "user", {
781
+ get: function () {
782
+ if (!this._tfmUser)
783
+ this._tfmUser = JSON.parse(localStorage.getItem("oSessionTFM"));
784
+ return this._tfmUser;
785
+ },
786
+ enumerable: false,
787
+ configurable: true
788
+ });
789
+ Object.defineProperty(SfCrudService.prototype, "currentOperation", {
790
+ get: function () {
791
+ var _this = this;
792
+ return this.registros[this.index].operations.find(function (x) { return x.type.startsWith(_this._trx[_this.index]); });
793
+ },
794
+ enumerable: false,
795
+ configurable: true
796
+ });
797
+ Object.defineProperty(SfCrudService.prototype, "environment", {
798
+ get: function () {
799
+ return this.jsonConfig;
800
+ },
801
+ set: function (val) {
802
+ this.jsonConfig = val;
803
+ },
804
+ enumerable: false,
805
+ configurable: true
806
+ });
807
+ Object.defineProperty(SfCrudService.prototype, "onCrudLoaded$", {
808
+ get: function () {
809
+ return this._crudLoaded.asObservable();
810
+ },
811
+ enumerable: false,
812
+ configurable: true
813
+ });
814
+ Object.defineProperty(SfCrudService.prototype, "crudLoaded", {
815
+ set: function (value) {
816
+ this._crudLoaded.next(value);
817
+ },
818
+ enumerable: false,
819
+ configurable: true
820
+ });
821
+ Object.defineProperty(SfCrudService.prototype, "dataExt", {
822
+ get: function () {
823
+ return this._dataExt;
824
+ },
825
+ set: function (val) {
826
+ this._dataExt = val;
827
+ },
828
+ enumerable: false,
829
+ configurable: true
830
+ });
831
+ Object.defineProperty(SfCrudService.prototype, "index", {
832
+ get: function () {
833
+ return this.__index;
834
+ },
835
+ set: function (value) {
836
+ this.__index = value;
837
+ },
838
+ enumerable: false,
839
+ configurable: true
840
+ });
841
+ Object.defineProperty(SfCrudService.prototype, "idKatios", {
842
+ get: function () {
843
+ return this._idKatios;
844
+ },
845
+ set: function (value) {
846
+ var _a;
847
+ this._idKatios = (_a = value === null || value === void 0 ? void 0 : value.trim()) === null || _a === void 0 ? void 0 : _a.toUpperCase();
848
+ },
849
+ enumerable: false,
850
+ configurable: true
851
+ });
852
+ Object.defineProperty(SfCrudService.prototype, "configEmpresa", {
853
+ get: function () {
854
+ return this._configEmpresa;
855
+ },
856
+ set: function (value) {
857
+ this._configEmpresa = value;
858
+ },
859
+ enumerable: false,
860
+ configurable: true
861
+ });
862
+ SfCrudService.prototype.getURL = function (operation, index, id) {
863
+ if (index === void 0) { index = undefined; }
864
+ if (id === void 0) { id = undefined; }
865
+ var url = operation.url || "" + this.jsonConfig[operation.server] + operation.endpoint;
866
+ url = url.replace('@idKatios', this.idKatios);
867
+ if (id)
868
+ url = url.replace('@id', id);
869
+ url = this.applyStringKeys(url, index);
870
+ return url;
871
+ };
872
+ SfCrudService.prototype.getRegistro = function (index) {
873
+ return this._registros[index];
874
+ };
875
+ SfCrudService.prototype.getId = function (index) {
876
+ return this._ids.length == 1 ? this._ids[0] : this._ids[index];
877
+ };
878
+ Object.defineProperty(SfCrudService.prototype, "dataset", {
879
+ get: function () {
880
+ return this._dataSet;
881
+ },
882
+ enumerable: false,
883
+ configurable: true
884
+ });
885
+ SfCrudService.prototype.getData = function (index) {
886
+ return this._dataSet.length == 1 ? this._dataSet[0] : this._dataSet[index];
887
+ };
888
+ SfCrudService.prototype.getTrx = function (index) {
889
+ return this._trx[index];
890
+ };
891
+ Object.defineProperty(SfCrudService.prototype, "totalData", {
892
+ get: function () {
893
+ return this._dataSet.length;
894
+ },
895
+ enumerable: false,
896
+ configurable: true
897
+ });
898
+ Object.defineProperty(SfCrudService.prototype, "totalRegistros", {
899
+ get: function () {
900
+ return this._registros.length;
901
+ },
902
+ enumerable: false,
903
+ configurable: true
904
+ });
905
+ Object.defineProperty(SfCrudService.prototype, "uiEsquemas", {
906
+ get: function () {
907
+ return this._uiEsquemas;
908
+ },
909
+ set: function (uiEsquemas) {
910
+ this._uiEsquemas = uiEsquemas;
911
+ },
912
+ enumerable: false,
913
+ configurable: true
914
+ });
915
+ SfCrudService.prototype.getEsquema = function (index) {
916
+ return this._esquemas.length == 1 ? this._esquemas[0] : this._esquemas[index];
917
+ };
918
+ SfCrudService.prototype.reset = function () {
919
+ this._ids = [];
920
+ this._dataSet = [];
921
+ };
922
+ SfCrudService.prototype.getURLRedirect = function (initialURL) {
923
+ var finalUrl = this.applyStringKeys(initialURL, undefined);
924
+ finalUrl = finalUrl.replace("@URLBASE", window.location.href.split('?')[0]);
925
+ return finalUrl;
926
+ };
927
+ SfCrudService.prototype.getUIEsquema = function (index) {
928
+ return this._uiEsquemas[index];
929
+ };
930
+ /**
931
+ * using data, apply each keyEsquema over each dataset indicated on indexData of each key
932
+ * @param data
933
+ * @param content
934
+ * @returns
935
+ */
936
+ SfCrudService.prototype.applyObjectKeys = function (data, keysEsquema, registro) {
937
+ var _a;
938
+ for (var i = 0; i < keysEsquema.length; i++) {
939
+ var opt = keysEsquema[i];
940
+ var value = undefined;
941
+ if (opt.indexKey) {
942
+ var keyFound = ((_a = registro.keys) !== null && _a !== void 0 ? _a : [undefined])[opt.indexKey];
943
+ this.applyKey(keyFound, registro, data);
944
+ }
945
+ else if (opt.indexData !== undefined) {
946
+ if (opt.isArray) {
947
+ value = jsonpath__namespace.query(data, opt.scope);
948
+ }
949
+ else {
950
+ value = jsonpath__namespace.query(data, opt.scope)[0];
951
+ }
952
+ }
953
+ if (opt.key == "$")
954
+ Object.assign(this._dataSet[opt.indexData], value);
955
+ else if (opt.key && ((value !== undefined && value !== null) || (opt.canBeValueUndefined === undefined || opt.canBeValueUndefined === true)))
956
+ jsonpath__namespace.value(this._dataSet[opt.indexData], opt.key, value);
957
+ }
958
+ return data;
959
+ };
960
+ SfCrudService.prototype.applyKey = function (key, registro, data) {
961
+ var _a, _b, _c, _d;
962
+ if (key === null || key === void 0 ? void 0 : key.overrideControl) {
963
+ var newVal = undefined;
964
+ var esquemaToSet = this.getControl(key.scope, this.esquemas[(_a = key.indexData) !== null && _a !== void 0 ? _a : this.index]);
965
+ if (!esquemaToSet) {
966
+ console.error({ message: "la key esta mal configurada", data: key });
967
+ return;
968
+ }
969
+ var completed = this.isConditionsCompleted((_b = key.overrideControl.conditions) !== null && _b !== void 0 ? _b : [], registro.conditions || [], data);
970
+ if ((_c = key.overrideControl) === null || _c === void 0 ? void 0 : _c.property)
971
+ jsonpath__namespace.value(esquemaToSet, key.overrideControl.property, completed ? key.overrideControl.value : key.overrideControl.elseValue);
972
+ if (completed && key.overrideControl.newPropertyValue !== undefined) {
973
+ if (key.overrideControl.newPropertyValue == 'RESETOBJECT')
974
+ newVal = this.createObject(esquemaToSet, this.currentOperation);
975
+ else
976
+ newVal = key.overrideControl.newPropertyValue;
977
+ }
978
+ else if (!completed && key.overrideControl.elseNewPropertyValue !== undefined) {
979
+ if (key.overrideControl.elseNewPropertyValue == 'RESETOBJECT')
980
+ newVal = this.createObject(esquemaToSet, this.currentOperation);
981
+ else
982
+ newVal = key.overrideControl.elseNewPropertyValue;
983
+ }
984
+ if (newVal !== undefined)
985
+ jsonpath__namespace.value(this._dataSet[(_d = key.indexData) !== null && _d !== void 0 ? _d : this.index], key.scope.replaceAll('..properties', ''), newVal);
986
+ }
617
987
  };
618
- TableroComponent.prototype.getInfoTablero = function (configTablero) {
988
+ /**
989
+ * Validate conditions on datas
990
+ * @param conditions
991
+ * @param index
992
+ */
993
+ SfCrudService.prototype.isConditionsCompleted = function (iConditions, conditions, data) {
619
994
  var _this = this;
620
- this.generalService.genericRequest(configTablero.method, configTablero.server, this.aplyKeys(configTablero.keys, configTablero.endpoint, this.dataExt))
621
- .then(function (res) {
622
- var aux;
623
- if (!Array.isArray(res))
624
- aux = res.data;
625
- else
626
- aux = res;
627
- _this.generateData(aux);
628
- _this.loadOptions();
629
- _this.enProceso = false;
630
- })
631
- .catch(function (err) {
632
- console.log(err);
633
- _this.enProceso = false;
995
+ var cumple = true;
996
+ iConditions.forEach(function (iCond) {
997
+ var c = Condition.instanceContidion(iCond, conditions);
998
+ var dataToEvaluate = c.indexData !== undefined ? _this._dataSet[c.indexData] : data;
999
+ if (!c.isValid(dataToEvaluate))
1000
+ cumple = false;
634
1001
  });
1002
+ return cumple;
635
1003
  };
636
- TableroComponent.prototype.generateData = function (data) {
1004
+ /**
1005
+ * Apply each key from register over string content
1006
+ * @param indexRegistro
1007
+ * @param content
1008
+ * @returns
1009
+ */
1010
+ SfCrudService.prototype.applyStringKeys = function (content, index) {
637
1011
  var _this = this;
638
- data.forEach(function (item) {
639
- var newItem = {};
640
- _this.crudConfig.tablero.columns.forEach(function (col) {
641
- newItem[col.col] = _this.getValue(col.col, item);
642
- });
643
- _this.data.push(newItem);
1012
+ if (index === void 0) { index = undefined; }
1013
+ var _a;
1014
+ var indexRegistro = index || this.__index;
1015
+ (_a = this._registros[indexRegistro].keys) === null || _a === void 0 ? void 0 : _a.forEach(function (opt) {
1016
+ var value;
1017
+ if (opt.indexId !== undefined && opt.indexId < _this._ids.length)
1018
+ value = _this._ids[opt.indexId];
1019
+ else if (opt.indexAnswer !== undefined && opt.indexAnswer < _this._answers.length)
1020
+ value = jsonpath__namespace.query(_this._answers[opt.indexAnswer], opt.scope)[0];
1021
+ else if (opt.indexData !== undefined)
1022
+ value = jsonpath__namespace.query(_this._dataSet[opt.indexData], opt.scope)[0];
1023
+ if (value === null)
1024
+ value = '';
1025
+ content = content.replace(opt.key, value);
644
1026
  });
645
- console.log(this.data);
1027
+ return content;
646
1028
  };
647
- TableroComponent.prototype.getValue = function (path, item) {
648
- if (path.includes("."))
649
- return jsonpath__namespace.query(item, path)[0];
650
- return item[path];
651
- };
652
- TableroComponent.prototype.loadOptions = function () {
1029
+ SfCrudService.prototype.validateDataLocal = function (operation, data, conditions) {
653
1030
  var _this = this;
654
- this.items = [];
655
- this.btn.create = this.opciones.find(function (x) { return x.label == 'Crear'; });
656
- this.opciones.filter(function (opc) { return opc.valor.action; }).forEach(function (opc) {
657
- _this.items.push({ label: opc.label, icon: opc.icon, command: function () { return _this.execAction(opc.valor); } });
1031
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1032
+ var err = [];
1033
+ //Solo si se cumple la condicion, se valida
1034
+ (_b = (_a = operation.validations) === null || _a === void 0 ? void 0 : _a.required) === null || _b === void 0 ? void 0 : _b.forEach(function (x) {
1035
+ var cumpleCond = x.conditions ? _this.isConditionsCompleted(x.conditions, conditions, data) : true;
1036
+ if (cumpleCond && (!jsonpath__namespace.query(data, x.field)[0] ||
1037
+ (Array.isArray(jsonpath__namespace.query(data, x.field)[0]) && jsonpath__namespace.query(data, x.field)[0].length == 0)))
1038
+ err.push(x.message);
658
1039
  });
659
- };
660
- TableroComponent.prototype.redirect = function (accion, data) {
661
- var _a, _b;
662
- switch (accion) {
1040
+ (_d = (_c = operation.validations) === null || _c === void 0 ? void 0 : _c.different) === null || _d === void 0 ? void 0 : _d.forEach(function (x) {
1041
+ var cumpleCond = x.conditions ? _this.isConditionsCompleted(x.conditions, conditions, data) : true;
1042
+ if (cumpleCond && jsonpath__namespace.query(data, x.field)[0] === x.value)
1043
+ err.push(x.message);
1044
+ });
1045
+ (_f = (_e = operation.validations) === null || _e === void 0 ? void 0 : _e.equals) === null || _f === void 0 ? void 0 : _f.forEach(function (x) {
1046
+ var cumpleCond = x.conditions ? _this.isConditionsCompleted(x.conditions, conditions, data) : true;
1047
+ if (cumpleCond && jsonpath__namespace.query(data, x.field)[0] != x.value)
1048
+ err.push(x.message);
1049
+ });
1050
+ (_h = (_g = operation.validations) === null || _g === void 0 ? void 0 : _g.operations) === null || _h === void 0 ? void 0 : _h.forEach(function (op) {
1051
+ switch (op.action) {
1052
+ case 'sumArray':
1053
+ var var1 = jsonpath__namespace.query(data, op.scope[0]).reduce(function (acc, cur) { return acc += cur[op.key]; }, 0);
1054
+ var var2 = jsonpath__namespace.query(data, op.scope[1]).reduce(function (acc, cur) { return acc += cur[op.key]; }, 0);
1055
+ if (var1 != var2)
1056
+ err.push(op.message);
1057
+ break;
1058
+ default:
1059
+ break;
1060
+ }
1061
+ });
1062
+ return err;
1063
+ };
1064
+ Object.defineProperty(SfCrudService.prototype, "esquemas", {
1065
+ get: function () {
1066
+ return this._esquemas;
1067
+ },
1068
+ set: function (esquemas) {
1069
+ this._esquemas = esquemas;
1070
+ },
1071
+ enumerable: false,
1072
+ configurable: true
1073
+ });
1074
+ Object.defineProperty(SfCrudService.prototype, "ids", {
1075
+ set: function (ids) {
1076
+ this._ids = ids;
1077
+ },
1078
+ enumerable: false,
1079
+ configurable: true
1080
+ });
1081
+ Object.defineProperty(SfCrudService.prototype, "registros", {
1082
+ get: function () {
1083
+ return this._registros;
1084
+ },
1085
+ set: function (registros) {
1086
+ this._registros = registros;
1087
+ },
1088
+ enumerable: false,
1089
+ configurable: true
1090
+ });
1091
+ SfCrudService.prototype.setDataSet = function (data, index) {
1092
+ if (index === void 0) { index = undefined; }
1093
+ index = index ? index : this.__index;
1094
+ if (index >= this.totalData) {
1095
+ this._dataSet.push(data);
1096
+ }
1097
+ };
1098
+ SfCrudService.prototype.setTrx = function (trx, index) {
1099
+ if (Array.isArray(trx))
1100
+ this._trx = trx;
1101
+ else if (index >= this._trx.length)
1102
+ this._trx.push(trx);
1103
+ else
1104
+ this._trx[index] = trx;
1105
+ };
1106
+ SfCrudService.prototype.setAnswers = function (answer, index) {
1107
+ if (Array.isArray(answer))
1108
+ this._answers = answer;
1109
+ else {
1110
+ if (index >= this._answers.length)
1111
+ this._answers.push(answer);
1112
+ else
1113
+ this._answers[index] = answer;
1114
+ }
1115
+ };
1116
+ SfCrudService.prototype.getControl = function (scope, esquema) {
1117
+ return jsonpath__namespace.query(esquema, scope)[0];
1118
+ };
1119
+ SfCrudService.prototype.getValue = function (scope, data) {
1120
+ return jsonpath__namespace.query(data, scope.replaceAll('.properties', ''))[0];
1121
+ };
1122
+ SfCrudService.prototype.createObject = function (esquema, operation) {
1123
+ var _this = this;
1124
+ var _a;
1125
+ var object = {};
1126
+ switch (esquema.type) {
1127
+ case 'numeric':
1128
+ case 'string':
1129
+ case 'date':
1130
+ if (esquema.default && operation) {
1131
+ return this.setDefaultValue(esquema.default, operation);
1132
+ }
1133
+ else
1134
+ return (_a = esquema.default) !== null && _a !== void 0 ? _a : null;
1135
+ case 'boolean':
1136
+ return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
1137
+ case 'array':
1138
+ return [];
1139
+ case 'file':
1140
+ return null;
1141
+ case 'object':
1142
+ Object.getOwnPropertyNames(esquema === null || esquema === void 0 ? void 0 : esquema.properties).forEach(function (key) {
1143
+ var aux = esquema === null || esquema === void 0 ? void 0 : esquema.properties[key];
1144
+ if (aux)
1145
+ object[key] = _this.createObject(aux, operation);
1146
+ });
1147
+ return object;
1148
+ default:
1149
+ return null;
1150
+ }
1151
+ };
1152
+ SfCrudService.prototype.getValueKey = function (key) {
1153
+ var data;
1154
+ switch ((key === null || key === void 0 ? void 0 : key.data) || 'externa') {
1155
+ case "user":
1156
+ data = this.user;
1157
+ break;
1158
+ default:
1159
+ data = this.dataExt;
1160
+ break;
1161
+ }
1162
+ if (data && key) {
1163
+ var aux = jsonpath__namespace.query(data, key.scope);
1164
+ if (aux.length == 0)
1165
+ return undefined;
1166
+ if (aux.length == 1)
1167
+ return aux[0];
1168
+ else
1169
+ return aux;
1170
+ }
1171
+ return undefined;
1172
+ };
1173
+ SfCrudService.prototype.setDefaultValue = function (value, operation) {
1174
+ var data = null;
1175
+ if (value.key && operation.keys) {
1176
+ data = this.getValueKey(operation.keys.find(function (k) { return k.key == value.key; }));
1177
+ value = data;
1178
+ }
1179
+ switch (value) {
1180
+ case '@uactivo':
1181
+ data = this.user.UsuarioSistema.TDOC + "-" + this.user.UsuarioSistema.NDOC;
1182
+ break;
1183
+ case '@tdocactivo':
1184
+ data = this.user.UsuarioSistema.TDOC;
1185
+ break;
1186
+ case '@ndocactivo':
1187
+ data = this.user.UsuarioSistema.NDOC;
1188
+ break;
1189
+ case '@hoy':
1190
+ data = new Date();
1191
+ break;
1192
+ default:
1193
+ data = value;
1194
+ break;
1195
+ }
1196
+ return data;
1197
+ };
1198
+ /**
1199
+ * Validate if schema has pdfsign and it's signed, else return false
1200
+ * @param index
1201
+ * @returns
1202
+ */
1203
+ SfCrudService.prototype.isSignedPDF = function (index) {
1204
+ return this._dataSet[index].signed;
1205
+ };
1206
+ Object.defineProperty(SfCrudService.prototype, "changeData$", {
1207
+ get: function () {
1208
+ return this._changeData.asObservable();
1209
+ },
1210
+ enumerable: false,
1211
+ configurable: true
1212
+ });
1213
+ Object.defineProperty(SfCrudService.prototype, "changeData", {
1214
+ set: function (value) {
1215
+ this._changeData.next(value);
1216
+ },
1217
+ enumerable: false,
1218
+ configurable: true
1219
+ });
1220
+ Object.defineProperty(SfCrudService.prototype, "formLoading$", {
1221
+ get: function () {
1222
+ return this.__formLoading.asObservable();
1223
+ },
1224
+ enumerable: false,
1225
+ configurable: true
1226
+ });
1227
+ Object.defineProperty(SfCrudService.prototype, "formLoading", {
1228
+ set: function (value) {
1229
+ this.__formLoading.next(value);
1230
+ },
1231
+ enumerable: false,
1232
+ configurable: true
1233
+ });
1234
+ SfCrudService.prototype.loadSession = function () {
1235
+ var existSession = localStorage.getItem("esquemas") !== null;
1236
+ if (existSession) {
1237
+ this._esquemas = JSON.parse(localStorage.getItem("esquemas"));
1238
+ this._uiEsquemas = JSON.parse(localStorage.getItem("uiEsquemas"));
1239
+ this._registros = JSON.parse(localStorage.getItem("registros"));
1240
+ this._dataSet = JSON.parse(localStorage.getItem("dataSet"));
1241
+ this._answers = JSON.parse(localStorage.getItem("answers"));
1242
+ this._trx = JSON.parse(localStorage.getItem("trx"));
1243
+ this.__index = +localStorage.getItem("index");
1244
+ localStorage.clear();
1245
+ }
1246
+ return existSession;
1247
+ };
1248
+ Object.defineProperty(SfCrudService.prototype, "reasons", {
1249
+ get: function () {
1250
+ var reasonsStorage = localStorage.getItem("reasons");
1251
+ if (reasonsStorage)
1252
+ return JSON.parse(reasonsStorage);
1253
+ return [];
1254
+ },
1255
+ enumerable: false,
1256
+ configurable: true
1257
+ });
1258
+ SfCrudService.prototype.saveProgress = function (reasons) {
1259
+ localStorage.setItem("reasons", JSON.stringify(reasons));
1260
+ localStorage.setItem("esquemas", JSON.stringify(this._esquemas));
1261
+ localStorage.setItem("trx", JSON.stringify(this._trx));
1262
+ localStorage.setItem("uiEsquemas", JSON.stringify(this._uiEsquemas));
1263
+ localStorage.setItem("registros", JSON.stringify(this._registros));
1264
+ localStorage.setItem("dataSet", JSON.stringify(this._dataSet));
1265
+ localStorage.setItem("answers", JSON.stringify(this._answers));
1266
+ localStorage.setItem("index", this.__index.toString());
1267
+ };
1268
+ SfCrudService.prototype.redirectToInicio = function () {
1269
+ window.location.href = window.location.href.split('?')[0];
1270
+ window.location.reload();
1271
+ };
1272
+ SfCrudService.prototype.applyValuesOnEvent = function (event, esquema, key, data) {
1273
+ var _this = this;
1274
+ if (key) {
1275
+ if (esquema.properties[key][event]) {
1276
+ esquema.properties[key][event].forEach(function (value) {
1277
+ _this.setValueEvent(data, value, esquema);
1278
+ });
1279
+ }
1280
+ }
1281
+ else {
1282
+ for (var key_1 in esquema.properties) {
1283
+ if (esquema.properties[key_1][event]) {
1284
+ esquema.properties[key_1][event].forEach(function (value) {
1285
+ _this.setValueEvent(data, value, esquema);
1286
+ });
1287
+ }
1288
+ }
1289
+ }
1290
+ };
1291
+ SfCrudService.prototype.setValueEvent = function (data, params, esquema) {
1292
+ var _a;
1293
+ var date = moment__namespace(new Date());
1294
+ switch (params.op) {
1295
+ case 'sum':
1296
+ jsonpath__namespace.value(data, params.scope[1], jsonpath__namespace.query(data, params.scope[0]).reduce(function (acc, cur) { return acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur; }, 0));
1297
+ break;
1298
+ case 'concat':
1299
+ var array_1 = [];
1300
+ (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1301
+ array_1.push(jsonpath__namespace.query(data, cur)[0]);
1302
+ }, []);
1303
+ if (params === null || params === void 0 ? void 0 : params.separator)
1304
+ jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1305
+ break;
1306
+ case 'enable':
1307
+ jsonpath__namespace.value(esquema, params.scope[0], false);
1308
+ break;
1309
+ case 'disabled':
1310
+ jsonpath__namespace.value(esquema, params.scope[0], true);
1311
+ break;
1312
+ case 'replace:endpoint':
1313
+ jsonpath__namespace.value(esquema, params.scope[0], esquema.config.endpointtemp.replace(params.scope[1], jsonpath__namespace.query(data, "$.." + params.key)));
1314
+ break;
1315
+ case 'setNull':
1316
+ jsonpath__namespace.value(data, "$." + params.key, null);
1317
+ break;
1318
+ case 'datediff:years':
1319
+ jsonpath__namespace.value(data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(data, params.scope[1])[0]), 'years'));
1320
+ break;
1321
+ case 'datediff:months':
1322
+ jsonpath__namespace.value(data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(data, params.scope[1])[0]), 'months'));
1323
+ break;
1324
+ case 'datediff:weeks':
1325
+ jsonpath__namespace.value(data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(data, params.scope[1])[0]), 'weeks'));
1326
+ break;
1327
+ case 'datediff:days':
1328
+ jsonpath__namespace.value(data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(data, params.scope[1])[0]), 'days'));
1329
+ break;
1330
+ default:
1331
+ break;
1332
+ }
1333
+ console.log('setValueEvent sale:');
1334
+ console.log(data);
1335
+ console.log(esquema);
1336
+ console.log(params);
1337
+ };
1338
+ return SfCrudService;
1339
+ }());
1340
+ SfCrudService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1341
+ SfCrudService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, providedIn: 'root' });
1342
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, decorators: [{
1343
+ type: i0.Injectable,
1344
+ args: [{
1345
+ providedIn: 'root'
1346
+ }]
1347
+ }] });
1348
+ var ChangeData = /** @class */ (function () {
1349
+ function ChangeData(value, scope, index) {
1350
+ this.value = value;
1351
+ this.scope = scope;
1352
+ this.index = index;
1353
+ }
1354
+ return ChangeData;
1355
+ }());
1356
+
1357
+ var StepService = /** @class */ (function () {
1358
+ function StepService() {
1359
+ this._requestApproval = new rxjs.Subject();
1360
+ this._customChildrenEvents = new rxjs.Subject();
1361
+ this._currentPosition = new rxjs.BehaviorSubject(0);
1362
+ this._requestApproved = new rxjs.BehaviorSubject(true);
1363
+ }
1364
+ Object.defineProperty(StepService.prototype, "currentIndex", {
1365
+ get: function () {
1366
+ return this._currentPosition.getValue();
1367
+ },
1368
+ set: function (value) {
1369
+ this._currentPosition.next(value);
1370
+ },
1371
+ enumerable: false,
1372
+ configurable: true
1373
+ });
1374
+ Object.defineProperty(StepService.prototype, "currentIndex$", {
1375
+ get: function () {
1376
+ return this._currentPosition.asObservable();
1377
+ },
1378
+ enumerable: false,
1379
+ configurable: true
1380
+ });
1381
+ Object.defineProperty(StepService.prototype, "requestApproval", {
1382
+ /*
1383
+ Envia una peticion para que se envie el formulario
1384
+ */
1385
+ set: function (newPos) {
1386
+ this._desiredIndex = newPos;
1387
+ this._requestApproval.next({ current: this.currentIndex, desired: newPos });
1388
+ },
1389
+ enumerable: false,
1390
+ configurable: true
1391
+ });
1392
+ Object.defineProperty(StepService.prototype, "requestApproval$", {
1393
+ get: function () {
1394
+ return this._requestApproval.asObservable();
1395
+ },
1396
+ enumerable: false,
1397
+ configurable: true
1398
+ });
1399
+ Object.defineProperty(StepService.prototype, "requestApproved$", {
1400
+ get: function () {
1401
+ return this._requestApproved.asObservable();
1402
+ },
1403
+ enumerable: false,
1404
+ configurable: true
1405
+ });
1406
+ Object.defineProperty(StepService.prototype, "requestApproved", {
1407
+ /**
1408
+ * Useful to deny or approve request made by requestAprroval
1409
+ */
1410
+ set: function (approved) {
1411
+ if (this._desiredIndex === undefined)
1412
+ throw new Error('desiredIndex is not defined');
1413
+ if (approved)
1414
+ this._currentPosition.next(this._desiredIndex);
1415
+ this._requestApproved.next(approved);
1416
+ },
1417
+ enumerable: false,
1418
+ configurable: true
1419
+ });
1420
+ Object.defineProperty(StepService.prototype, "desiredIndex", {
1421
+ set: function (index) {
1422
+ this._desiredIndex = index;
1423
+ },
1424
+ enumerable: false,
1425
+ configurable: true
1426
+ });
1427
+ StepService.prototype.addCustomChildrenEvent = function (name, data) {
1428
+ this._customChildrenEvents.next({ name: name, data: data });
1429
+ };
1430
+ StepService.prototype.reset = function () {
1431
+ //this._requestApproval = new BehaviorSubject({current:0, desired: undefined});
1432
+ //this._customChildrenEvents = new BehaviorSubject(undefined);
1433
+ };
1434
+ Object.defineProperty(StepService.prototype, "customChildrenEvents$", {
1435
+ get: function () {
1436
+ return this._customChildrenEvents.asObservable();
1437
+ },
1438
+ enumerable: false,
1439
+ configurable: true
1440
+ });
1441
+ return StepService;
1442
+ }());
1443
+ StepService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: StepService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1444
+ StepService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: StepService, providedIn: 'root' });
1445
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: StepService, decorators: [{
1446
+ type: i0.Injectable,
1447
+ args: [{
1448
+ providedIn: 'root'
1449
+ }]
1450
+ }] });
1451
+
1452
+ var TableroComponent = /** @class */ (function () {
1453
+ function TableroComponent(generalService, router, sfCrudService, stepService) {
1454
+ this.generalService = generalService;
1455
+ this.router = router;
1456
+ this.sfCrudService = sfCrudService;
1457
+ this.stepService = stepService;
1458
+ this.opciones = [];
1459
+ this.idEntidad = '';
1460
+ this.idKatios = '';
1461
+ this.onSelectAction = new i0.EventEmitter();
1462
+ this.items = [];
1463
+ this.crudConfig = new CrudConfig();
1464
+ this.data = [];
1465
+ this.initialData = [];
1466
+ this.btn = { create: undefined, read: undefined, update: undefined, delete: undefined };
1467
+ this.loading = { inProgress: false, target: undefined };
1468
+ }
1469
+ TableroComponent.prototype.ngOnInit = function () {
1470
+ this.generalService.environment = this.environment;
1471
+ this.loadConfigCrud();
1472
+ };
1473
+ TableroComponent.prototype.loadConfigCrud = function () {
1474
+ var _this = this;
1475
+ this.loading.inProgress = true;
1476
+ this.sfCrudService.formLoading = this.loading;
1477
+ this.generalService.getCrudByEntidad(this.idKatios, this.idEntidad)
1478
+ .then(function (res) {
1479
+ _this.crudConfig = res;
1480
+ _this.getInfoTablero();
1481
+ })
1482
+ .catch(function (err) {
1483
+ console.log(err);
1484
+ _this.loading.inProgress = false;
1485
+ _this.sfCrudService.formLoading = _this.loading;
1486
+ });
1487
+ };
1488
+ TableroComponent.prototype.customizeCompany = function (uiEsquemas) {
1489
+ var _a, _b, _c;
1490
+ this.sfCrudService.configEmpresa = (_a = uiEsquemas.find(function (ui) { return ui.general; })) === null || _a === void 0 ? void 0 : _a.general;
1491
+ if (this.sfCrudService.configEmpresa) {
1492
+ if ((_b = this.sfCrudService.configEmpresa.colors) === null || _b === void 0 ? void 0 : _b.secondary)
1493
+ this.color2 = this.sfCrudService.configEmpresa.colors.secondary;
1494
+ if ((_c = this.sfCrudService.configEmpresa.colors) === null || _c === void 0 ? void 0 : _c.button)
1495
+ this.colorButtons = this.sfCrudService.configEmpresa.colors.secondary;
1496
+ }
1497
+ if (!this.color2)
1498
+ this.color2 = this.colorButtons = "blue";
1499
+ };
1500
+ // submit(index: number) {
1501
+ // let registro = this.sfCrudService.getRegistro(index)
1502
+ // let operation = registro.operations.find(op => op.type.startsWith(this.sfCrudService.getTrx(0)))!
1503
+ // console.log(operation)
1504
+ // let url = this.sfCrudService.getURL(operation, index)
1505
+ // return this.generalService.genericRequest(operation.method, url, this.sfCrudService.getData(index))
1506
+ // .then((res) => {
1507
+ // if (res === null) res = {}
1508
+ // res = this.sfCrudService.applyObjectKeys(res, operation.keysEsquema || [], registro)
1509
+ // console.log(res)
1510
+ // this.sfCrudService.setAnswers(res, 0)
1511
+ // if (operation.changeTrx) operation.changeTrx.forEach(x => this.sfCrudService.setTrx(x.trx, x.index))
1512
+ // // this.notificationService.generateMessage(this.notificationService.genDefaultMessage("success", undefined, "Información subida correctamente", operation.answerChecking), res, operation.answerChecking)
1513
+ // // return res;
1514
+ // })
1515
+ // .catch(err => {
1516
+ // // const operation = this.sfCrudService.getRegistro(this.indexCrud).operations.find(op => op.type.startsWith(this.sfCrudService.getTrx(index)))!
1517
+ // // this.notificationService.generateMessage(this.notificationService.genDefaultMessage("error", "Error no controlado", "Por favor comunicarse con el admin",operation.errorChecking), err.error, operation.errorChecking)
1518
+ // // throw new Error(err)
1519
+ // })
1520
+ // }
1521
+ TableroComponent.prototype.getInfoTablero = function () {
1522
+ var _this = this;
1523
+ //this.submit(0)
1524
+ this.data = [];
1525
+ this.initialData = [];
1526
+ this.loading.inProgress = true;
1527
+ this.sfCrudService.formLoading = this.loading;
1528
+ var url = this.aplyKeys(this.crudConfig.tablero.keys, "" + this.generalService.jsonConfig[this.crudConfig.tablero.server] + this.crudConfig.tablero.endpoint, this.dataExt);
1529
+ this.generalService.genericRequest(this.crudConfig.tablero.method, url, this.dataExt)
1530
+ .then(function (res) {
1531
+ var aux;
1532
+ if (!Array.isArray(res))
1533
+ aux = res.data;
1534
+ else
1535
+ aux = res;
1536
+ _this.initialData = ___namespace.cloneDeep(aux);
1537
+ _this.generateData(aux);
1538
+ _this.loadOptions();
1539
+ })
1540
+ .finally(function () {
1541
+ _this.loading.inProgress = false;
1542
+ _this.sfCrudService.formLoading = _this.loading;
1543
+ });
1544
+ };
1545
+ TableroComponent.prototype.generateData = function (data) {
1546
+ var _this = this;
1547
+ data.forEach(function (item) {
1548
+ var newItem = {};
1549
+ _this.crudConfig.tablero.columns.forEach(function (col) {
1550
+ newItem[col.col] = _this.getValue(col.col, item);
1551
+ });
1552
+ _this.data.push(newItem);
1553
+ });
1554
+ console.log(this.data);
1555
+ };
1556
+ TableroComponent.prototype.getValue = function (path, item) {
1557
+ if (path.includes("."))
1558
+ return jsonpath__namespace.query(item, path)[0];
1559
+ return item[path];
1560
+ };
1561
+ TableroComponent.prototype.externalLinkAction = function () {
1562
+ var _this = this;
1563
+ this.opciones.filter(function (opc) { return opc.valor.action; }).forEach(function (opc) { return _this.execAction(opc.valor); });
1564
+ };
1565
+ TableroComponent.prototype.loadOptions = function () {
1566
+ var _this = this;
1567
+ this.items = [];
1568
+ this.btn.create = this.opciones.find(function (x) { return x.label == 'Crear'; });
1569
+ this.opciones.filter(function (opc) { return opc.valor.action; }).forEach(function (opc) {
1570
+ _this.items.push({ label: opc.label, icon: opc.icon, command: function () { return _this.execAction(opc.valor); } });
1571
+ });
1572
+ };
1573
+ TableroComponent.prototype.redirect = function (accion, data) {
1574
+ var _a, _b;
1575
+ this.stepService.reset();
1576
+ this.sfCrudService.reset();
1577
+ switch (accion) {
663
1578
  case 'create':
664
1579
  this.router.navigateByUrl(((_b = (_a = this.btn.create) === null || _a === void 0 ? void 0 : _a.valor) === null || _b === void 0 ? void 0 : _b.redirect) || '');
665
1580
  break;
@@ -710,54 +1625,499 @@
710
1625
  };
711
1626
  return TableroComponent;
712
1627
  }());
713
- TableroComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TableroComponent, deps: [{ token: GeneralService }, { token: i2__namespace.Router }], target: i0__namespace.ɵɵFactoryTarget.Component });
714
- TableroComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TableroComponent, selector: "sf-crudtablero", inputs: { opciones: "opciones", idEntidad: "idEntidad", idKatios: "idKatios", user: "user", dataExt: "dataExt" }, outputs: { onSelectAction: "onSelectAction" }, ngImport: i0__namespace, template: "<p-blockUI [blocked]=\"enProceso\">\r\n <i class=\"pi pi-cog pi-spin\" style=\"font-size: 50px\"></i>\r\n</p-blockUI>\r\n\r\n<div class=\"card\" *ngIf=\"!enProceso\">\r\n <p-toolbar styleClass=\"mb-4 gap-2\">\r\n <ng-template pTemplate=\"left\">\r\n <button *ngIf=\"btn.create\" 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 #dt [columns]=\"crudConfig.tablero.columns\" [value]=\"data\" [rowHover]=\"true\" [rows]=\"10\" [paginator]=\"true\"\r\n [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\">\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 icon=\"pi pi-align-justify\" [model]=\"items\" appendTo=\"body\"\r\n (onDropdownClick)=\"itemSelected = rowData\"></p-splitButton>\r\n </td>\r\n </tr>\r\n </ng-template>\r\n </p-table>\r\n</div>", components: [{ type: i3__namespace.BlockUI, selector: "p-blockUI", inputs: ["target", "autoZIndex", "baseZIndex", "styleClass", "blocked"] }, { type: i4__namespace.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { type: i5__namespace.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: i6__namespace.SplitButton, selector: "p-splitButton", inputs: ["model", "icon", "iconPos", "label", "style", "styleClass", "menuStyle", "menuStyleClass", "disabled", "tabindex", "appendTo", "dir", "showTransitionOptions", "hideTransitionOptions"], outputs: ["onClick", "onDropdownClick"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }, { type: i11__namespace.InputText, selector: "[pInputText]" }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "date": i7__namespace.DatePipe, "currency": i7__namespace.CurrencyPipe } });
1628
+ TableroComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TableroComponent, deps: [{ token: GeneralService }, { token: i2__namespace.Router }, { token: SfCrudService }, { token: StepService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1629
+ TableroComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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__namespace.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { type: i6__namespace.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__namespace.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__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i11__namespace.Ripple, selector: "[pRipple]" }, { type: i12__namespace$1.InputText, selector: "[pInputText]" }, { type: i12__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i12__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i12__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }], pipes: { "date": i12__namespace.DatePipe, "currency": i12__namespace.CurrencyPipe } });
715
1630
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TableroComponent, decorators: [{
716
1631
  type: i0.Component,
717
1632
  args: [{
718
1633
  selector: 'sf-crudtablero',
719
- templateUrl: './tablero.component.html'
1634
+ templateUrl: './tablero.component.html',
1635
+ styleUrls: ['./tablero.component.css']
720
1636
  }]
721
- }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2__namespace.Router }]; }, propDecorators: { opciones: [{
1637
+ }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2__namespace.Router }, { type: SfCrudService }, { type: StepService }]; }, propDecorators: { opciones: [{
722
1638
  type: i0.Input
723
1639
  }], idEntidad: [{
724
1640
  type: i0.Input
725
1641
  }], idKatios: [{
726
1642
  type: i0.Input
1643
+ }], environment: [{
1644
+ type: i0.Input
727
1645
  }], user: [{
728
1646
  type: i0.Input
729
1647
  }], dataExt: [{
730
1648
  type: i0.Input
731
1649
  }], onSelectAction: [{
732
1650
  type: i0.Output
1651
+ }], color2: [{
1652
+ type: i0.HostBinding,
1653
+ args: ["style.--secondary-color"]
1654
+ }], colorButtons: [{
1655
+ type: i0.HostBinding,
1656
+ args: ["style.--button-color"]
733
1657
  }] } });
734
1658
 
735
- var ControlComponent = /** @class */ (function () {
736
- function ControlComponent(generalService) {
737
- this.generalService = generalService;
738
- this.control = new Shema();
739
- this.label = '';
740
- this.setValue = new i0.EventEmitter();
741
- this.sendNotification = new i0.EventEmitter();
742
- this.sendObject = new i0.EventEmitter();
743
- this.isLoading = false;
744
- this.dataFromService = [];
745
- this.uploadedFiles = [];
746
- this.displayAdd = false;
747
- this.tempValue = {};
1659
+ var NotificationService = /** @class */ (function () {
1660
+ function NotificationService(sfCrudService) {
1661
+ this.sfCrudService = sfCrudService;
1662
+ this._notificationAdded = new rxjs.BehaviorSubject(undefined);
1663
+ }
1664
+ NotificationService.prototype.addNotification = function (msg, requestChecking) {
1665
+ this._notificationAdded.next({ msg: msg, requestChecking: requestChecking });
1666
+ };
1667
+ NotificationService.prototype.notificationAdded$ = function () {
1668
+ return this._notificationAdded.asObservable();
1669
+ };
1670
+ /**
1671
+ * Generates message using answerchecking
1672
+ * @param currentMsg Default message: Message | SweetAlertOptions
1673
+ * @param rta Resquest's response
1674
+ * @param answerChecking
1675
+ */
1676
+ NotificationService.prototype.generateMessage = function (currentMsg, rta, requestChecking) {
1677
+ if (requestChecking) {
1678
+ if (requestChecking.statics)
1679
+ Object.assign(currentMsg, requestChecking.statics);
1680
+ //mapear los dinamicos
1681
+ if (requestChecking.dynamics) {
1682
+ var dynamics = requestChecking.dynamics;
1683
+ try {
1684
+ if (dynamics && typeof (rta) == "string")
1685
+ rta = JSON.parse(rta);
1686
+ if (requestChecking.parse) {
1687
+ var valueParsed = JSON.parse(jsonpath__namespace.query(rta, requestChecking.parse)[0]);
1688
+ jsonpath__namespace.value(rta, requestChecking.parse, valueParsed);
1689
+ }
1690
+ if (dynamics) {
1691
+ for (var property in dynamics) {
1692
+ currentMsg[property] = jsonpath__namespace.query(rta, dynamics[property])[0];
1693
+ }
1694
+ }
1695
+ }
1696
+ catch (error) { //es una respuesta sin JSON
1697
+ if (dynamics)
1698
+ currentMsg.detail = rta;
1699
+ }
1700
+ }
1701
+ }
1702
+ return currentMsg;
1703
+ };
1704
+ NotificationService.prototype.genDefaultMessage = function (severity, title, detail, requestChecking) {
1705
+ var _a, _b, _c, _d, _e, _f;
1706
+ var obj = { title: title, text: detail, icon: severity,
1707
+ 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",
1708
+ 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" };
1709
+ if (requestChecking && requestChecking.useSwal && severity == "error") {
1710
+ obj.showCancelButton = true;
1711
+ obj.confirmButtonText = '<i class="pi pi-check"></i> Continuar';
1712
+ obj.cancelButtonText = '<i class="pi pi-times"></i> Terminar';
1713
+ }
1714
+ if (!requestChecking || !requestChecking.useSwal) {
1715
+ obj.severity = severity;
1716
+ obj.summary = title;
1717
+ obj.detail = detail;
1718
+ }
1719
+ return obj;
1720
+ };
1721
+ return NotificationService;
1722
+ }());
1723
+ NotificationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NotificationService, deps: [{ token: SfCrudService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1724
+ NotificationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NotificationService, providedIn: 'root' });
1725
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NotificationService, decorators: [{
1726
+ type: i0.Injectable,
1727
+ args: [{
1728
+ providedIn: 'root'
1729
+ }]
1730
+ }], ctorParameters: function () { return [{ type: SfCrudService }]; } });
1731
+ var Notification = /** @class */ (function () {
1732
+ function Notification(msg, requestChecking) {
1733
+ this.msg = msg;
1734
+ this.requestChecking = requestChecking;
1735
+ }
1736
+ return Notification;
1737
+ }());
1738
+
1739
+ var StepComponent = /** @class */ (function () {
1740
+ function StepComponent(router, stepService, activatedRoute) {
1741
+ this.router = router;
1742
+ this.stepService = stepService;
1743
+ this.activatedRoute = activatedRoute;
1744
+ this.activeIndex = 0;
1745
+ this.loading = false;
1746
+ this.nextMovement = 0;
1747
+ }
1748
+ StepComponent.prototype.ngOnInit = function () {
1749
+ var _this = this;
1750
+ this.stepService.currentIndex$.subscribe(function (result) {
1751
+ _this.nextMovement = result;
1752
+ _this.router.navigate([_this.items[result].routerLink], { relativeTo: _this.activatedRoute, queryParamsHandling: "preserve" });
1753
+ _this.moveScroll(_this.nextMovement);
1754
+ _this.activeIndex = result;
1755
+ });
1756
+ };
1757
+ StepComponent.prototype.ngAfterViewInit = function () {
1758
+ var _this = this;
1759
+ this.stepService.requestApproved$.subscribe(function (result) {
1760
+ if (result) {
1761
+ _this.navigate();
1762
+ }
1763
+ _this.loading = false;
1764
+ });
1765
+ this.moveScroll(this.nextMovement);
1766
+ };
1767
+ StepComponent.prototype.onactiveIndexChange = function ($event) {
1768
+ this.requestNaviagtion($event - this.activeIndex);
1769
+ };
1770
+ /**
1771
+ * Button solicitates permissions to change tab.
1772
+ * @param add steps to advance. If negative will go back
1773
+ */
1774
+ StepComponent.prototype.requestNaviagtion = function (add) {
1775
+ this.loading = true;
1776
+ this.nextMovement = this.activeIndex + add;
1777
+ this.stepService.requestApproval = this.nextMovement;
1778
+ };
1779
+ StepComponent.prototype.navigate = function () {
1780
+ if (this.nextMovement < this.items.length) {
1781
+ this.activeIndex = this.nextMovement;
1782
+ this.router.navigate([this.items[this.nextMovement].routerLink], { relativeTo: this.activatedRoute, queryParamsHandling: "preserve" });
1783
+ }
1784
+ };
1785
+ StepComponent.prototype.moveScroll = function (nextIndex) {
1786
+ var miDiv = document.getElementById("step-container");
1787
+ var steps = document.querySelector(".p-steps ul[role='tablist']");
1788
+ if (steps !== null) {
1789
+ var i = 0;
1790
+ var value = 0;
1791
+ while (i < nextIndex) {
1792
+ var child = steps.children[i];
1793
+ value += child.clientWidth;
1794
+ i++;
1795
+ }
1796
+ miDiv.scrollLeft = value;
1797
+ }
1798
+ };
1799
+ return StepComponent;
1800
+ }());
1801
+ StepComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: StepComponent, deps: [{ token: i2__namespace.Router }, { token: StepService }, { token: i2__namespace.ActivatedRoute }], target: i0__namespace.ɵɵFactoryTarget.Component });
1802
+ StepComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: StepComponent, selector: "app-step", inputs: { items: "items" }, ngImport: i0__namespace, 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__namespace.Steps, selector: "p-steps", inputs: ["activeIndex", "model", "readonly", "style", "styleClass"], outputs: ["activeIndexChange"] }], directives: [{ type: i2__namespace.RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate"], exportAs: ["outlet"] }, { type: i12__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }] });
1803
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: StepComponent, decorators: [{
1804
+ type: i0.Component,
1805
+ args: [{
1806
+ selector: 'app-step',
1807
+ templateUrl: './step.component.html',
1808
+ styleUrls: ['./step.component.css']
1809
+ }]
1810
+ }], ctorParameters: function () { return [{ type: i2__namespace.Router }, { type: StepService }, { type: i2__namespace.ActivatedRoute }]; }, propDecorators: { items: [{
1811
+ type: i0.Input
1812
+ }] } });
1813
+
1814
+ var Shema = /** @class */ (function () {
1815
+ function Shema() {
1816
+ this.type = '';
1817
+ this.subtype = '';
1818
+ this.configuration = new ShemaConfig();
1819
+ this.allowCustomOption = false;
1820
+ }
1821
+ return Shema;
1822
+ }());
1823
+ var ShemaConfig = /** @class */ (function () {
1824
+ function ShemaConfig() {
1825
+ }
1826
+ return ShemaConfig;
1827
+ }());
1828
+
1829
+ var FileUploadComponent = /** @class */ (function () {
1830
+ function FileUploadComponent(messageSerice) {
1831
+ var _this = this;
1832
+ this.messageSerice = messageSerice;
1833
+ this.files = [];
1834
+ this.loading = false;
1835
+ this.accept = "image/*,application/pdf";
1836
+ this.onUpload = new i0.EventEmitter();
1837
+ this.onDeleteFile = new i0.EventEmitter();
1838
+ this.newFiles = [];
1839
+ window.addEventListener("paste", function (e) {
1840
+ var _a;
1841
+ if (((_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.files) && e.clipboardData.files.length > 0) {
1842
+ _this.appendFile(e.clipboardData.files[0]);
1843
+ }
1844
+ });
1845
+ }
1846
+ FileUploadComponent.prototype.ngOnChanges = function (changes) {
1847
+ };
1848
+ FileUploadComponent.prototype.ngOnInit = function () {
1849
+ };
1850
+ FileUploadComponent.prototype.appendFile = function (file) {
1851
+ var allowedTypes = this.accept.split(",");
1852
+ var allowedFile = allowedTypes.some(function (pattern) {
1853
+ var regexObj = new RegExp(pattern);
1854
+ var match = regexObj.exec(file.type);
1855
+ return match ? (match === null || match === void 0 ? void 0 : match.length) > 0 : false;
1856
+ });
1857
+ if (allowedFile) {
1858
+ var newFile = new File([file], this.getName(file), { type: file.type });
1859
+ if (this.limit == 1) {
1860
+ this.newFiles = [newFile];
1861
+ }
1862
+ else
1863
+ this.newFiles.push(newFile);
1864
+ this.files.push({ name: newFile.name, url: window.URL.createObjectURL(newFile) });
1865
+ }
1866
+ else {
1867
+ this.messageSerice.add({ severity: "warn", detail: "Tipo de archivo no válido" });
1868
+ }
1869
+ };
1870
+ FileUploadComponent.prototype.emitFiles = function () {
1871
+ this.loading = true;
1872
+ this.onUpload.emit(this.newFiles);
1873
+ };
1874
+ FileUploadComponent.prototype.getName = function (file) {
1875
+ var sName = "";
1876
+ var date = new Date();
1877
+ if (this.configName !== undefined) {
1878
+ var name = this.configName.split('|');
1879
+ name.forEach(function (item) {
1880
+ if (item.indexOf("DATE@") != -1)
1881
+ sName += (moment__namespace(date)).format(item.split('@')[1]);
1882
+ else if (item.indexOf("@") == -1)
1883
+ sName += item;
1884
+ });
1885
+ var ext = this.getExt(file);
1886
+ sName += ext ? "." + ext : "";
1887
+ }
1888
+ else
1889
+ sName = file.name;
1890
+ return sName;
1891
+ };
1892
+ FileUploadComponent.prototype.getExt = function (file) {
1893
+ var ext = undefined;
1894
+ var aux = file.name.split('.');
1895
+ if (aux.length > 0)
1896
+ ext = aux[aux.length - 1];
1897
+ return ext;
1898
+ };
1899
+ FileUploadComponent.prototype.appendFiles = function ($event) {
1900
+ if ($event.target.files.length > 0) {
1901
+ this.appendFile($event.target.files[0]);
1902
+ }
1903
+ if (this.limit == this.files.length) {
1904
+ this.stopAnimation();
1905
+ this.emitFiles();
1906
+ }
1907
+ else
1908
+ this.startAnimation();
1909
+ this.fileUploader.nativeElement.value = "";
1910
+ };
1911
+ FileUploadComponent.prototype.dropFile = function (archivo) {
1912
+ var _this = this;
1913
+ this.files.forEach(function (f, index) {
1914
+ if (f == archivo) {
1915
+ _this.files.splice(index, 1);
1916
+ _this.onDeleteFile.emit(index);
1917
+ }
1918
+ });
1919
+ };
1920
+ FileUploadComponent.prototype.openFile = function (archivo) {
1921
+ window.open(archivo.url, '_blank');
1922
+ window.addEventListener('focus', function () { return URL.revokeObjectURL(archivo.url); });
1923
+ };
1924
+ FileUploadComponent.prototype.startAnimation = function () {
1925
+ var button = document.querySelector('.button-upload');
1926
+ if (button) {
1927
+ button.classList.add('animate-pulse');
1928
+ }
1929
+ };
1930
+ FileUploadComponent.prototype.stopAnimation = function () {
1931
+ var button = document.querySelector('.button-upload');
1932
+ if (button) {
1933
+ button.classList.remove('animate-pulse');
1934
+ }
1935
+ };
1936
+ return FileUploadComponent;
1937
+ }());
1938
+ FileUploadComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FileUploadComponent, deps: [{ token: i1__namespace$1.MessageService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1939
+ FileUploadComponent.ɵcmp = i0__namespace.ɵɵ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__namespace, 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__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i11__namespace.Ripple, selector: "[pRipple]" }, { type: i12__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i12__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i12__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }] });
1940
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FileUploadComponent, decorators: [{
1941
+ type: i0.Component,
1942
+ args: [{
1943
+ selector: 'sf-file-upload',
1944
+ templateUrl: './file-upload.component.html',
1945
+ styleUrls: ['./file-upload.component.css']
1946
+ }]
1947
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.MessageService }]; }, propDecorators: { limit: [{
1948
+ type: i0.Input
1949
+ }], files: [{
1950
+ type: i0.Input
1951
+ }], loading: [{
1952
+ type: i0.Input
1953
+ }], configName: [{
1954
+ type: i0.Input
1955
+ }], accept: [{
1956
+ type: i0.Input
1957
+ }], onUpload: [{
1958
+ type: i0.Output
1959
+ }], onDeleteFile: [{
1960
+ type: i0.Output
1961
+ }], fileUploader: [{
1962
+ type: i0.ViewChild,
1963
+ args: ['fileUpload']
1964
+ }] } });
1965
+ var Archivo = /** @class */ (function () {
1966
+ function Archivo() {
1967
+ }
1968
+ return Archivo;
1969
+ }());
1970
+
1971
+ var ControlComponent = /** @class */ (function () {
1972
+ function ControlComponent(generalService, crudService, cdr, notificationService) {
1973
+ this.generalService = generalService;
1974
+ this.crudService = crudService;
1975
+ this.cdr = cdr;
1976
+ this.notificationService = notificationService;
1977
+ this.showTempValue = false;
1978
+ this.control = new Shema();
1979
+ this.label = '';
1980
+ this.setValue = new i0.EventEmitter();
1981
+ this.sendObject = new i0.EventEmitter();
1982
+ this.isLoading = false;
1983
+ this.dataFromService = [];
1984
+ this.uploadedFiles = [];
1985
+ this.displayAdd = false;
1986
+ this.uploadingFiles = false;
748
1987
  }
1988
+ ControlComponent.prototype.ngOnChanges = function (changes) {
1989
+ };
749
1990
  ControlComponent.prototype.ngOnInit = function () {
750
- var _a;
751
- if (((_a = this.control) === null || _a === void 0 ? void 0 : _a.config) && this.control.subtype == 'dropdown')
1991
+ var _this = this;
1992
+ var _a, _b;
1993
+ this.loadDefaultValues();
1994
+ if ((_b = (_a = this.control) === null || _a === void 0 ? void 0 : _a.config) === null || _b === void 0 ? void 0 : _b.depends) {
1995
+ this.crudService.changeData$.subscribe(function (res) {
1996
+ var _a, _b;
1997
+ if (res) {
1998
+ var registro = _this.crudService.getRegistro(_this.crudService.index);
1999
+ var keyFound = (_a = registro.keys) === null || _a === void 0 ? void 0 : _a.find(function (k) { return k.scope === res.scope
2000
+ && _this.control.config.depends.includes(k.key) &&
2001
+ (res.index === k.indexData || res.index === k.indexAnswer); });
2002
+ if (keyFound === null || keyFound === void 0 ? void 0 : keyFound.overrideControl) {
2003
+ var override = keyFound.overrideControl;
2004
+ var completed = _this.crudService.isConditionsCompleted((_b = override.conditions) !== null && _b !== void 0 ? _b : [], registro.conditions || [], _this.crudService.getData(_this.crudService.index));
2005
+ jsonpath__namespace.value(_this.control, override.property, completed ? override.value : override.elseValue);
2006
+ _this.value = _this.getNewValue(override, completed);
2007
+ _this.tempValue = null;
2008
+ _this.sendValue();
2009
+ if (_this.control.subtype == 'dropdown' || _this.control.subtype == 'multiselect')
2010
+ _this.loadDataFromService();
2011
+ //this.cdr.detectChanges()
2012
+ }
2013
+ else if (keyFound) {
2014
+ _this.value = null;
2015
+ _this.sendValue();
2016
+ _this.loadDefaultValues();
2017
+ //this.cdr.detectChanges()
2018
+ }
2019
+ }
2020
+ });
2021
+ }
2022
+ };
2023
+ ControlComponent.prototype.getNewValue = function (override, completed) {
2024
+ var newValue = completed ? override.newPropertyValue : override.elseNewPropertyValue;
2025
+ if (newValue && typeof (newValue) == "string") {
2026
+ if (!newValue.startsWith('$') && !newValue.startsWith('@')) {
2027
+ return newValue;
2028
+ }
2029
+ }
2030
+ return null;
2031
+ };
2032
+ ControlComponent.prototype.loadDefaultValues = function () {
2033
+ var _a, _b, _c, _d, _e;
2034
+ if (((_a = this.control) === null || _a === void 0 ? void 0 : _a.config) && this.control.subtype == 'dropdown' || this.control.subtype == 'multiselect')
752
2035
  this.loadDataFromService();
753
- if (this.value && this.control.subtype == 'autocomplete')
754
- this.setDefaultValue();
2036
+ if (((_b = this.control) === null || _b === void 0 ? void 0 : _b.subtype) == 'autocomplete')
2037
+ this.extracValueFromControlBusqueda();
755
2038
  if (this.value && this.control.type == 'date')
756
- this.setDate();
2039
+ this.instanceDate();
2040
+ if (((_c = this.control) === null || _c === void 0 ? void 0 : _c.subtype) == "file") {
2041
+ this.loadFiles();
2042
+ }
2043
+ if (((_d = this.control) === null || _d === void 0 ? void 0 : _d.type) == 'string')
2044
+ this.lenghtWord = this.value ? this.value.length : 0;
2045
+ if (((_e = this.control) === null || _e === void 0 ? void 0 : _e.subtype) == 'switch')
2046
+ this.instanceBoolField();
2047
+ };
2048
+ ControlComponent.prototype.instanceBoolField = function () {
2049
+ this.tempValue = this.value;
2050
+ if (this.value == true && this.control.trueValue !== undefined) {
2051
+ this.value = this.control.trueValue;
2052
+ this.sendValue();
2053
+ }
2054
+ else if (this.value == false && this.control.falseValue !== undefined) {
2055
+ this.value = this.control.falseValue;
2056
+ this.sendValue();
2057
+ }
2058
+ };
2059
+ ControlComponent.prototype.onChangeSwitch = function () {
2060
+ this.value = this.tempValue;
2061
+ this.sendValue();
2062
+ };
2063
+ ControlComponent.prototype.loadFiles = function () {
2064
+ var _this = this;
2065
+ this.isLoading = true;
2066
+ this.uploadedFiles = [];
2067
+ if (!this.value) {
2068
+ this.isLoading = false;
2069
+ this.cdr.detectChanges();
2070
+ }
2071
+ else if (this.control.config.namePattern && this.control.type == "string") {
2072
+ var urls = this.control.config.separator ? this.value.split(",") : [this.value];
2073
+ urls.forEach(function (url) { return _this.uploadedFiles.push({ url: url, name: _this.getNameFile(_this.control.config.namePattern, url) }); });
2074
+ this.isLoading = false;
2075
+ this.cdr.detectChanges();
2076
+ }
2077
+ else if (this.control.config.namePattern && this.control.type == "array") {
2078
+ this.value.forEach(function (url) { return _this.uploadedFiles.push({ url: url, name: _this.getNameFile(_this.control.config.namePattern, url) }); });
2079
+ this.isLoading = false;
2080
+ this.cdr.detectChanges();
2081
+ }
2082
+ };
2083
+ ControlComponent.prototype.onDeleteFile = function (index) {
2084
+ var _a, _b;
2085
+ 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")
2086
+ this.value = null;
2087
+ else if (this.control.type == "array")
2088
+ this.value.splice(index, 1);
2089
+ };
2090
+ ControlComponent.prototype.getNameFile = function (namePattern, url) {
2091
+ var regexObj = new RegExp(namePattern);
2092
+ var match = regexObj.exec(url);
2093
+ if (!match)
2094
+ throw new Error("El pattern no coincide con la url. " + url);
2095
+ return match[0];
757
2096
  };
758
2097
  ControlComponent.prototype.sendValue = function () {
2098
+ var _a;
2099
+ if (this.control.type == "string" && this.value == "" && ((_a = this.control.config) === null || _a === void 0 ? void 0 : _a.allowEmpty) == false)
2100
+ this.value = null;
759
2101
  this.setValue.emit(this.value);
760
2102
  };
2103
+ ControlComponent.prototype.sendNumberValue = function ($event) {
2104
+ this.value = $event.value;
2105
+ this.sendValue();
2106
+ };
2107
+ ControlComponent.prototype.onInputEmail = function (force) {
2108
+ var aux = Math.abs(this.lenghtWord - this.value.length);
2109
+ this.lenghtWord = this.value.length;
2110
+ if (aux > 1 || force) {
2111
+ var regex = new RegExp(/([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/igm);
2112
+ if (regex.test(this.value))
2113
+ this.sendValue();
2114
+ else {
2115
+ this.value = null;
2116
+ this.sendValue();
2117
+ this.notificationService.addNotification({ severity: 'warn', detail: 'El correo no es válido' }, this.primeChecking());
2118
+ }
2119
+ }
2120
+ };
761
2121
  ControlComponent.prototype.sendValueFromObject = function (event) {
762
2122
  switch (typeof (this.control.config.optionValue)) {
763
2123
  case 'object':
@@ -769,62 +2129,90 @@
769
2129
  break;
770
2130
  }
771
2131
  };
772
- ControlComponent.prototype.validateValue = function (type) {
773
- switch (type) {
774
- case 'email':
775
- var regex = new RegExp(/([\w\.\-_]+)?\w+@[\w-_]+(\.\w+){1,}/igm);
776
- if (regex.test(this.value))
777
- this.sendValue();
778
- else {
779
- this.value = null;
780
- this.sendValue();
781
- this.sendNotification.emit({ severity: 'warn', detail: 'El correo no es válido' });
782
- }
783
- break;
784
- default:
785
- break;
786
- }
787
- };
788
2132
  ControlComponent.prototype.loadDataFromService = function () {
789
2133
  var _this = this;
790
2134
  this.isLoading = true;
791
2135
  this.dataFromService = [];
792
- this.generalService.genericRequest(this.control.config.method, this.control.config.server, this.control.config.endpoint)
2136
+ var op = this.control.config;
2137
+ var url = this.crudService.getURL(op, undefined, undefined);
2138
+ this.generalService.genericRequest(this.control.config.method, url)
793
2139
  .then(function (res) {
794
2140
  _this.dataFromService = res.data;
2141
+ }).finally(function () {
795
2142
  _this.isLoading = false;
2143
+ _this.cdr.detectChanges();
796
2144
  });
797
2145
  };
798
2146
  ControlComponent.prototype.loadDataFromControlBusquedaService = function (event) {
799
2147
  var _this = this;
800
2148
  this.isLoading = true;
801
- this.generalService.genericRequest(this.control.config.method, this.control.config.server, this.control.config.endpoint.replace('@query', (event === null || event === void 0 ? void 0 : event.query) || ''))
2149
+ var op = this.control.config;
2150
+ var url = this.crudService.getURL(op);
2151
+ url = url.replace('@query', (event === null || event === void 0 ? void 0 : event.query) || '');
2152
+ this.generalService.genericRequest(this.control.config.method, url)
802
2153
  .then(function (res) {
2154
+ var _a;
803
2155
  _this.dataFromService = res.data;
2156
+ if (((_a = _this.dataFromService) === null || _a === void 0 ? void 0 : _a.length) == 0 && _this.control.allowCustomOption) {
2157
+ //agregar un campo que el usuario haya digitado
2158
+ var newItem = {};
2159
+ newItem[_this.control.field] = _this.tempValue;
2160
+ newItem[_this.control.config.optionValue] = _this.tempValue;
2161
+ _this.dataFromService.push(newItem);
2162
+ }
2163
+ }).finally(function () {
804
2164
  _this.isLoading = false;
2165
+ _this.cdr.detectChanges();
2166
+ });
2167
+ };
2168
+ ControlComponent.prototype.extracValueFromControlBusqueda = function () {
2169
+ var _this = this;
2170
+ var op = this.control.config;
2171
+ var url = this.crudService.getURL(op);
2172
+ url = url.replace('@query', this.value);
2173
+ this.generalService.genericRequest(this.control.config.method, url)
2174
+ .then(function (res) {
2175
+ var _a;
2176
+ if (((_a = res.data) === null || _a === void 0 ? void 0 : _a.length) == 1 && res.data[0][_this.control.field]) {
2177
+ _this.tempValue = res.data[0];
2178
+ _this.value = res.data[0][_this.control.field];
2179
+ }
2180
+ else
2181
+ _this.setDefaultValue();
2182
+ }).finally(function () {
2183
+ _this.cdr.detectChanges();
2184
+ }).catch(function () {
2185
+ _this.setDefaultValue();
805
2186
  });
806
2187
  };
807
2188
  ControlComponent.prototype.onUpload = function (event) {
808
2189
  var _this = this;
809
- var file = event.files[0];
2190
+ this.uploadingFiles = true;
810
2191
  var formData = new FormData();
811
- var path = 'Imagenes/CRUD/temp';
812
- formData.append('uploadFile', file);
2192
+ var path = this.control.config.path || 'Imagenes/CRUD/temp';
813
2193
  formData.append('Ruta', "/" + path);
814
- this.isLoading = true;
815
- this.generalService.genericRequest(this.control.config.method, this.control.config.server, this.control.config.endpoint, formData)
2194
+ for (var i = 0; i < event.length; i++)
2195
+ formData.append("uploadFile_" + i, event[i]);
2196
+ var op = this.control.config;
2197
+ var url = this.crudService.getURL(op);
2198
+ this.generalService.genericRequest(this.control.config.method, url, formData)
816
2199
  .then(function () {
817
- _this.sendNotification.emit({ severity: 'info', detail: "Archivo cargado correctamente!" });
818
- _this.uploadedFiles.push(file);
819
- _this.isLoading = false;
820
- _this.value = "" + _this.generalService.jsonConfig.Server + path + "/" + file.name;
2200
+ var _a;
2201
+ var separator = ((_a = _this.control.config) === null || _a === void 0 ? void 0 : _a.separator) || ",";
2202
+ //se asume que viene namePattern
2203
+ if (_this.control.type == "string")
2204
+ _this.value = event.map(function (f) { return "" + _this.generalService.jsonConfig.Server + path + "/" + f.name; }).join(separator);
2205
+ else if (_this.control.type == "array")
2206
+ _this.value = event.map(function (f) { return "" + _this.generalService.jsonConfig.Server + path + "/" + f.name; });
2207
+ // SI NO TRAE namePattern, debe retornar un objeto con el nombre y href
2208
+ //else if (this.control.config.namePattern && this.control.type == "array") this.value = event.map(x => x.name)
2209
+ //else if (!this.control.config.namePattern && this.control.type == "array") this.value = event.map(f => `${this.generalService.jsonConfig.Server}${path}/${f.name}`)
821
2210
  _this.sendValue();
2211
+ var msg = !_this.control.config.limit || _this.control.config.limit == 1 ? "Archivo cargado correctamente!" : "Archivos cargados correctamente!";
2212
+ _this.notificationService.addNotification({ severity: 'info', detail: msg }, _this.primeChecking());
822
2213
  })
823
- .catch(function (err) {
824
- console.log(err);
825
- _this.isLoading = false;
826
- _this.sendNotification.emit({ severity: 'error', detail: "Error al cargar el archivo!" });
827
- });
2214
+ .catch(function () { return _this.notificationService.addNotification({ severity: 'error', detail: "Error al cargar el archivo!" }, _this.primeChecking()); })
2215
+ .finally(function () { return _this.uploadingFiles = false; });
828
2216
  };
829
2217
  ControlComponent.prototype.refresData = function () {
830
2218
  var _a, _b;
@@ -832,46 +2220,102 @@
832
2220
  this.loadDataFromService();
833
2221
  };
834
2222
  ControlComponent.prototype.setDefaultValue = function () {
835
- var _a;
836
- Object.defineProperty(this.tempValue, (_a = this.control.config) === null || _a === void 0 ? void 0 : _a.optionLabel, { value: this.value, writable: true, enumerable: true, configurable: true });
2223
+ this.tempValue = {};
2224
+ if (!this.control.config.optionLabel)
2225
+ console.error("No esta bien configurado el control ", this.control);
2226
+ else
2227
+ this.tempValue[this.control.config.optionLabel] = this.value ? this.value : "";
837
2228
  };
838
2229
  ControlComponent.prototype.searchValue = function (value) {
839
2230
  var _this = this;
840
- var endpoint = this.control.config.endpoint.replace('@id', value);
841
- this.generalService.genericRequest(this.control.config.method, this.control.config.server, endpoint)
2231
+ var op = this.control.config;
2232
+ var url = this.crudService.getURL(op, undefined, undefined);
2233
+ url = url.replace('@id', value);
2234
+ this.generalService.genericRequest(this.control.config.method, url)
842
2235
  .then(function (res) {
843
2236
  var _a;
844
2237
  if (((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.length) > 0) {
845
2238
  _this.sendObject.emit({ data: res.data[0], optionValue: _this.control.config.optionValue });
846
2239
  }
847
2240
  else {
848
- _this.sendNotification.emit({ severity: 'warn', detail: "Valor no encontrado." });
2241
+ _this.notificationService.addNotification({ severity: 'warn', detail: "Valor no encontrado." }, _this.primeChecking());
849
2242
  _this.sendObject.emit({ data: null, optionValue: _this.control.config.optionValue });
850
2243
  }
851
2244
  })
852
2245
  .catch(function (err) {
853
- console.log(err);
854
- _this.sendNotification.emit({ severity: 'error', detail: "Error al consumir el servicio." });
2246
+ _this.notificationService.addNotification({ severity: 'error', detail: "Error al consumir el servicio." }, _this.primeChecking());
855
2247
  });
856
2248
  };
857
- ControlComponent.prototype.setDate = function () {
2249
+ ControlComponent.prototype.primeChecking = function () {
2250
+ return new RequestChecking(undefined, undefined, false, undefined, undefined, false, undefined);
2251
+ };
2252
+ ControlComponent.prototype.instanceDate = function () {
858
2253
  var format = this.control.formatMoment;
859
- if (format && this.value && !(this.value instanceof Date)) {
860
- this.value = moment__namespace(this.value, format).toDate();
2254
+ if (this.value) {
2255
+ if (typeof (this.value) == "string" && this.value.includes("T"))
2256
+ this.value = new Date(this.value);
2257
+ else if (typeof (this.value) == "string")
2258
+ this.value = moment__namespace(this.value, format).toDate();
2259
+ this.tempValue = moment__namespace(this.value).format("DD/MM/YYYY");
2260
+ }
2261
+ else {
2262
+ this.tempValue = null;
2263
+ this.value = null;
2264
+ }
2265
+ };
2266
+ /**
2267
+ * Cast tempValue to date
2268
+ */
2269
+ ControlComponent.prototype.onChangeSDate = function () {
2270
+ var aux = moment__namespace(this.tempValue, "DD/MM/YYYY");
2271
+ if (aux.isValid()) {
2272
+ this.value = aux.toDate();
861
2273
  this.sendValue();
862
2274
  }
2275
+ else {
2276
+ this.tempValue = null;
2277
+ this.notificationService.addNotification({ severity: 'warn', detail: 'La fecha no es válida' }, this.primeChecking());
2278
+ }
2279
+ };
2280
+ ControlComponent.prototype.onChangeDate = function () {
2281
+ this.tempValue = moment__namespace(this.value).format("DD/MM/YYYY");
2282
+ this.sendValue();
2283
+ };
2284
+ ControlComponent.prototype.onTouchDescription = function () {
2285
+ var _a;
2286
+ try {
2287
+ (_a = this.tooltips.get(0)) === null || _a === void 0 ? void 0 : _a.activate();
2288
+ }
2289
+ catch (ex) { }
2290
+ };
2291
+ ControlComponent.prototype.onUnTouchDescription = function () {
2292
+ var _a;
2293
+ try {
2294
+ (_a = this.tooltips.get(0)) === null || _a === void 0 ? void 0 : _a.deactivate();
2295
+ }
2296
+ catch (ex) { }
2297
+ };
2298
+ ControlComponent.prototype.doFocusOut = function () {
2299
+ if (document.activeElement) {
2300
+ document.activeElement.blur();
2301
+ }
2302
+ this.cdr.detectChanges();
863
2303
  };
864
2304
  return ControlComponent;
865
2305
  }());
866
- ControlComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ControlComponent, deps: [{ token: GeneralService }], target: i0__namespace.ɵɵFactoryTarget.Component });
867
- ControlComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ControlComponent, selector: "sf-control", inputs: { control: "control", label: "label", value: "value", appendTo: "appendTo" }, outputs: { setValue: "setValue", sendNotification: "sendNotification", sendObject: "sendObject" }, ngImport: i0__namespace, template: "<ng-container [ngSwitch]=\"control.type\" #cc>\r\n <label [for]=\"label\" style=\"width: -webkit-fill-available;\">{{label}}</label>\r\n <ng-container *ngSwitchCase=\"'string'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'input'\">\r\n <input pInputText type=\"text\" [(ngModel)]=\"value\" (focusout)=\"sendValue()\"\r\n [disabled]=\"control?.disabled || false\">\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'textarea'\">\r\n <textarea [rows]=\"control?.rows ? control.rows : 4\" \r\n [(ngModel)]=\"value\" (focusout)=\"sendValue()\" pInputTextarea \r\n [disabled]=\"control?.disabled || false\" [autoResize]=\"control?.autoresize || false\"></textarea>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'password'\">\r\n <input pInputText type=\"password\" [(ngModel)]=\"value\" (focusout)=\"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 (focusout)=\"validateValue('email')\" [disabled]=\"control?.disabled || false\">\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 (focusout)=\"sendValue()\" [disabled]=\"control?.disabled || false\" [unmask]=\"control.unmask || false\"></p-inputMask>\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\"\r\n [optionValue]=\"control?.field || control.config.optionValue\" (onClick)=\"refresData()\"\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=\"'dropdown:replace'\">\r\n <p-dropdown [lazy]=\"isLoading\" [options]=\"dataFromService\"\r\n (onChange)=\"sendValueFromObject($event)\" [optionLabel]=\"control.config.optionLabel\"\r\n (onClick)=\"refresData()\" 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 <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=\"'date'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'calendar'\">\r\n <p-calendar [(ngModel)]=\"value\" (onSelect)=\"sendValue()\" (onBlur)=\"sendValue()\" [monthNavigator]=\"true\"\r\n [yearNavigator]=\"true\" yearRange=\"1900:2035\" [dateFormat]=\"control?.format || 'yy-mm-dd'\"\r\n appendTo=\"body\" [disabled]=\"control?.disabled || false\" [showOnFocus]=\"!control?.hide\"\r\n [placeholder]=\"control?.placeholder || 'aaaa-mm-dd'\" [touchUI]=\"control?.touchUI || false\"\r\n [showIcon]=\"control?.showIcon || false\"></p-calendar>\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\" mode=\"currency\" [minFractionDigits]=\"control?.minFractionDigits || 0\"\r\n [min]=\"control?.min || null\" [max]=\"control?.max || null\" (focusout)=\"sendValue()\" [locale]=\"control?.locale || undefined\"\r\n [currency]=\"control?.currency || 'USD'\" [disabled]=\"control?.disabled || false\"></p-inputNumber>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'decimal'\">\r\n <p-inputNumber [(ngModel)]=\"value\" mode=\"decimal\" (focusout)=\"sendValue()\" [min]=\"control?.min || null\"\r\n [max]=\"control?.max || null\" [minFractionDigits]=\"control?.minFractionDigits || 0\" [locale]=\"control?.locale || undefined\"\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=\" %\" (focusout)=\"sendValue()\" [min]=\"control?.min || null\"\r\n [max]=\"control?.max || null\" [minFractionDigits]=\"control?.minFractionDigits || 2\" [locale]=\"control?.locale || undefined\"\r\n [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 <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=\"'file'\">\r\n <ng-container [ngSwitch]=\"control.subtype\">\r\n <ng-container *ngSwitchCase=\"'filetmp'\">\r\n <p-fileUpload [accept]=\"control.config.accept\" [customUpload]=\"true\" (uploadHandler)=\"onUpload($event)\"\r\n [maxFileSize]=\"control.config?.maxFileSize || null\" fileLimit=\"1\">\r\n <ng-template pTemplate=\"content\">\r\n <ul *ngIf=\"uploadedFiles.length\">\r\n <li *ngFor=\"let file of uploadedFiles\">{{file.name}} - {{file.size}} bytes</li>\r\n </ul>\r\n </ng-template>\r\n </p-fileUpload>\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)]=\"value\" (onChange)=\"sendValue()\" [id]=\"label\"></p-inputSwitch>\r\n </ng-container>\r\n </ng-container>\r\n </ng-container>\r\n</ng-container>", components: [{ type: i2__namespace$2.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: i3__namespace$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: i4__namespace$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: i5__namespace$1.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: i6__namespace$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: i7__namespace$1.FileUpload, selector: "p-fileUpload", inputs: ["name", "url", "method", "multiple", "accept", "disabled", "auto", "withCredentials", "maxFileSize", "invalidFileSizeMessageSummary", "invalidFileSizeMessageDetail", "invalidFileTypeMessageSummary", "invalidFileTypeMessageDetail", "invalidFileLimitMessageDetail", "invalidFileLimitMessageSummary", "style", "styleClass", "previewWidth", "chooseLabel", "uploadLabel", "cancelLabel", "chooseIcon", "uploadIcon", "cancelIcon", "showUploadButton", "showCancelButton", "mode", "headers", "customUpload", "fileLimit", "files"], outputs: ["onBeforeUpload", "onSend", "onUpload", "onError", "onClear", "onRemove", "onSelect", "onProgress", "uploadHandler"] }, { type: i8__namespace.InputSwitch, selector: "p-inputSwitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "ariaLabelledBy"], outputs: ["onChange"] }], directives: [{ type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i10__namespace$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i11__namespace.InputText, selector: "[pInputText]" }, { type: i10__namespace$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i10__namespace$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12__namespace.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize"], outputs: ["onResize"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace$1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
2306
+ ControlComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ControlComponent, deps: [{ token: GeneralService }, { token: SfCrudService }, { token: i0__namespace.ChangeDetectorRef }, { token: NotificationService }], target: i0__namespace.ɵɵFactoryTarget.Component });
2307
+ ControlComponent.ɵcmp = i0__namespace.ɵɵ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" }, viewQueries: [{ propertyName: "tooltips", predicate: i13.Tooltip, descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<p *ngIf=\"showTempValue && tempValue\">{{tempValue[control.field]}}</p>\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=\"'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\"\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=\"99/99/9999\" [placeholder]=\"control.placeholder\"\r\n (onComplete)=\"onChangeSDate()\" [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__namespace.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__namespace$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__namespace$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__namespace.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__namespace$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__namespace.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__namespace$1.InputSwitch, selector: "p-inputSwitch", inputs: ["style", "styleClass", "tabindex", "inputId", "name", "disabled", "readonly", "ariaLabelledBy"], outputs: ["onChange"] }], directives: [{ type: i12__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i12__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i13__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i12__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i14__namespace.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__namespace$1.InputText, selector: "[pInputText]" }, { type: i14__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i14__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i16__namespace.InputTextarea, selector: "[pInputTextarea]", inputs: ["autoResize"], outputs: ["onResize"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i14__namespace.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
868
2308
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ControlComponent, decorators: [{
869
2309
  type: i0.Component,
870
2310
  args: [{
871
2311
  selector: 'sf-control',
872
- templateUrl: './control.component.html'
2312
+ templateUrl: './control.component.html',
2313
+ styleUrls: ['./control.component.css'],
2314
+ changeDetection: i0.ChangeDetectionStrategy.OnPush
873
2315
  }]
874
- }], ctorParameters: function () { return [{ type: GeneralService }]; }, propDecorators: { control: [{
2316
+ }], ctorParameters: function () { return [{ type: GeneralService }, { type: SfCrudService }, { type: i0__namespace.ChangeDetectorRef }, { type: NotificationService }]; }, propDecorators: { showTempValue: [{
2317
+ type: i0.Input
2318
+ }], control: [{
875
2319
  type: i0.Input
876
2320
  }], label: [{
877
2321
  type: i0.Input
@@ -881,1025 +2325,157 @@
881
2325
  type: i0.Input
882
2326
  }], setValue: [{
883
2327
  type: i0.Output
884
- }], sendNotification: [{
885
- type: i0.Output
886
2328
  }], sendObject: [{
887
2329
  type: i0.Output
2330
+ }], tooltips: [{
2331
+ type: i0.ViewChildren,
2332
+ args: [i13.Tooltip]
888
2333
  }] } });
889
2334
 
890
- var RegistroDetalleComponent = /** @class */ (function () {
891
- function RegistroDetalleComponent(ref, config, messageService) {
892
- this.ref = ref;
893
- this.config = config;
2335
+ var FormComponent = /** @class */ (function () {
2336
+ function FormComponent(messageService, crudService, domSanitizer, stepService, adoService, jwtService) {
2337
+ var _this = this;
894
2338
  this.messageService = messageService;
895
- this.esquema = new Shema();
2339
+ this.crudService = crudService;
2340
+ this.domSanitizer = domSanitizer;
2341
+ this.stepService = stepService;
2342
+ this.adoService = adoService;
2343
+ this.jwtService = jwtService;
2344
+ this.isDialog = false;
2345
+ this.controlsLoaded = false;
2346
+ this.isMobile = false;
2347
+ this.loading = { inProgress: true, target: undefined };
2348
+ if (window.innerWidth <= 768)
2349
+ this.isMobile = true;
2350
+ window.addEventListener('resize', function () {
2351
+ if (window.innerWidth <= 768)
2352
+ _this.isMobile = true;
2353
+ });
896
2354
  }
897
- RegistroDetalleComponent.prototype.ngOnInit = function () {
898
- var _a;
899
- this.uiEsquema = this.config.data.uiEsquema[0];
900
- this.esquema = this.config.data.esquema;
901
- this.data = (_a = this.config.data) === null || _a === void 0 ? void 0 : _a.data;
902
- if (!this.data) {
903
- this.data = this.createObject(this.esquema);
904
- jsonpath__namespace.value(this.data, '$..id', this.config.data.id);
905
- }
906
- };
907
- RegistroDetalleComponent.prototype.getControl = function (scope) {
908
- return jsonpath__namespace.query(this.esquema, scope)[0];
909
- };
910
- RegistroDetalleComponent.prototype.getValue = function (scope) {
911
- return jsonpath__namespace.query(this.data, scope.replace('.properties', ''))[0];
2355
+ FormComponent.prototype.ngOnChanges = function (changes) {
2356
+ this.buildControls();
912
2357
  };
913
- RegistroDetalleComponent.prototype.setValue = function (value, scope) {
2358
+ FormComponent.prototype.ngOnInit = function () {
914
2359
  var _this = this;
915
- switch (typeof (value)) {
916
- case 'object':
917
- if (Array.isArray(value))
918
- value.forEach(function (val) { return jsonpath__namespace.value(_this.data, val.scope.replace('.properties', ''), val.value); });
919
- else
920
- jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
921
- break;
922
- default:
923
- jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
924
- break;
925
- }
926
- this.applyValuesOnEvent('onChange', this.esquema, scope.replace('$..properties.', ''));
927
- };
928
- RegistroDetalleComponent.prototype.createObject = function (esquema) {
929
- var object = {};
930
- var resultArray = [];
931
- switch (esquema.type) {
932
- case 'numeric':
933
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
934
- case 'string':
935
- case 'date':
936
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
937
- case 'boolean':
938
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
939
- case 'file':
940
- return null;
941
- case 'array':
942
- case 'object':
943
- for (var key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
944
- Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
2360
+ try {
2361
+ this.jwtService.idKatios = this.crudService.idKatios;
2362
+ this.jwtService.servidorIntegraciones = this.crudService.environment.ServidorIntegraciones;
2363
+ this.adoService.servidorIntegraciones = this.crudService.environment.ServidorIntegraciones;
2364
+ this.idKatios = this.crudService.idKatios;
2365
+ this.stepService.requestApproved$.subscribe(function (approved) {
2366
+ if (!_this.isDialog && approved) {
2367
+ _this.uiEsquema = _this.crudService.getUIEsquema(_this.stepService.currentIndex);
2368
+ _this.esquema = _this.crudService.getEsquema(_this.stepService.currentIndex);
2369
+ _this.data = _this.crudService.getData(_this.stepService.currentIndex);
2370
+ _this.registro = _this.crudService.getRegistro(_this.stepService.currentIndex);
2371
+ _this.buildControls();
945
2372
  }
946
- break;
947
- default:
948
- break;
2373
+ });
2374
+ }
2375
+ catch (error) {
2376
+ console.error(error);
949
2377
  }
950
- return object;
951
2378
  };
952
- RegistroDetalleComponent.prototype.setDefaultValue = function (value) {
953
- var data = null;
954
- var uactivo;
955
- switch (value) {
956
- case '@uactivo':
957
- uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
958
- if (!uactivo)
959
- console.log('Validar configuracion de sesion');
960
- else
961
- data = uactivo.UsuarioSistema.TDOC + "-" + uactivo.UsuarioSistema.NDOC;
962
- break;
963
- case '@tdocactivo':
964
- uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
965
- if (!uactivo)
966
- console.log('Validar configuracion de sesion');
967
- else
968
- data = uactivo.UsuarioSistema.TDOC;
969
- break;
970
- case '@ndocactivo':
971
- uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
972
- if (!uactivo)
973
- console.log('Validar configuracion de sesion');
974
- else
975
- data = uactivo.UsuarioSistema.NDOC;
976
- break;
977
- case '@hoy':
978
- data = new Date();
979
- break;
980
- default:
981
- data = value;
982
- break;
983
- }
984
- return data;
985
- };
986
- RegistroDetalleComponent.prototype.submit = function () {
987
- this.applyValuesOnEvent('onSubmit', this.esquema);
988
- if (!this.validateData())
989
- return;
990
- this.ref.close(this.data);
991
- };
992
- RegistroDetalleComponent.prototype.cancel = function () {
993
- this.applyValuesOnEvent('onCancel', this.esquema);
994
- this.ref.close();
995
- };
996
- RegistroDetalleComponent.prototype.validateData = function () {
997
- if (this.esquema.validations.type == 'local')
998
- return this.validateDataLocal();
999
- return true;
1000
- };
1001
- RegistroDetalleComponent.prototype.validateDataLocal = function () {
1002
- var _this = this;
1003
- var err = [];
1004
- this.esquema.validations.required.forEach(function (x) {
1005
- if (!jsonpath__namespace.query(_this.data, x.field)[0])
1006
- err.push(x.message);
1007
- });
1008
- if (err.length != 0)
1009
- this.messageService.add({ severity: 'warn', detail: err.join('. ') });
1010
- return err.length == 0;
1011
- };
1012
- RegistroDetalleComponent.prototype.applyValuesOnEvent = function (event, esquema, scope) {
1013
- var _this = this;
1014
- if (scope) {
1015
- if (esquema.properties[scope][event]) {
1016
- esquema.properties[scope][event].forEach(function (value) {
1017
- _this.setValueEvent(_this.data, value);
1018
- });
1019
- }
1020
- }
1021
- else {
1022
- for (var key in esquema.properties) {
1023
- if (esquema.properties[key][event]) {
1024
- esquema.properties[key][event].forEach(function (value) {
1025
- _this.setValueEvent(_this.data, value);
1026
- });
1027
- }
1028
- }
1029
- }
1030
- };
1031
- RegistroDetalleComponent.prototype.setValueEvent = function (data, params) {
1032
- var _a;
1033
- var value;
1034
- var date = moment__namespace(new Date());
1035
- switch (params.op) {
1036
- case 'sum':
1037
- value = jsonpath__namespace.query(data, params === null || params === void 0 ? void 0 : params.scope[0]).reduce(function (acc, cur) { return acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur; }, 0);
1038
- break;
1039
- case 'concat':
1040
- var array_1 = [];
1041
- (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1042
- array_1.push(jsonpath__namespace.query(data, cur)[0]);
1043
- }, []);
1044
- if (params === null || params === void 0 ? void 0 : params.separator)
1045
- jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1046
- break;
1047
- case 'enable':
1048
- jsonpath__namespace.value(this.esquema, params.scope[0], false);
1049
- break;
1050
- case 'disabled':
1051
- jsonpath__namespace.value(this.esquema, params.scope[0], true);
1052
- break;
1053
- case 'replace:endpoint':
1054
- jsonpath__namespace.value(this.esquema, params.scope[0], jsonpath__namespace.query(this.esquema, params.scope[1])[0].replace(params.scope[2], jsonpath__namespace.query(data, "$.." + params.key)));
1055
- break;
1056
- case 'setNull':
1057
- jsonpath__namespace.value(this.data, "$." + params.key, null);
1058
- break;
1059
- case 'datediff:years':
1060
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'years'));
1061
- break;
1062
- case 'datediff:months':
1063
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'months'));
1064
- break;
1065
- case 'datediff:weeks':
1066
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'weeks'));
1067
- break;
1068
- case 'datediff:days':
1069
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'days'));
1070
- break;
1071
- default:
1072
- break;
1073
- }
1074
- return value;
1075
- };
1076
- RegistroDetalleComponent.prototype.sendNotification = function (message) {
1077
- this.messageService.add(message);
1078
- };
1079
- RegistroDetalleComponent.prototype.applyValuesFromObject = function (event) {
2379
+ FormComponent.prototype.emitLoadingForm = function ($event) {
1080
2380
  var _this = this;
1081
- if (event.data)
1082
- event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), _this.aplyFormatValue(value.scope, event.data[value.key])); });
1083
- else
1084
- event.optionValue.forEach(function (value) { return jsonpath__namespace.value(_this.data, value.scope.replace('.properties', ''), null); });
2381
+ this.loading.inProgress = $event;
2382
+ Promise.resolve().then(function () { return _this.crudService.formLoading = _this.loading; }); //si no se usa asi el enproceso totea con el simulador
1085
2383
  };
1086
- RegistroDetalleComponent.prototype.aplyFormatValue = function (scope, value) {
1087
- var control = jsonpath__namespace.query(this.esquema, scope)[0];
1088
- var resp;
1089
- switch (control.type) {
1090
- case 'date':
1091
- resp = new Date("" + value);
1092
- break;
1093
- case 'numeric':
1094
- resp = +value;
1095
- break;
1096
- default:
1097
- resp = value;
1098
- break;
1099
- }
1100
- return resp;
1101
- };
1102
- return RegistroDetalleComponent;
1103
- }());
1104
- RegistroDetalleComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroDetalleComponent, deps: [{ token: i1__namespace$1.DynamicDialogRef }, { token: i1__namespace$1.DynamicDialogConfig }, { token: i2__namespace$1.MessageService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1105
- RegistroDetalleComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroDetalleComponent, selector: "lib-registro-detalle", ngImport: i0__namespace, template: "<p-toast></p-toast>\r\n<div *ngFor=\"let element of uiEsquema.elements\" [class]=\"element?.class\" #a>\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *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\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"getControl(el.scope)\" [label]=\"el.label\"\r\n [value]=\"getValue(el.scope)\" (setValue)=\"setValue($event, el.scope)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\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\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"getControl(el.scope)\" [label]=\"el.label\"\r\n [value]=\"getValue(el.scope)\" (setValue)=\"setValue($event, el.scope)\"\r\n (sendNotification)=\"sendNotification($event)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n </ng-container>\r\n </div>\r\n </ng-container>\r\n <ng-container *ngSwitchCase=\"'Control'\">\r\n <sf-control [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n<div class=\"card-footer mt-2\">\r\n <button pButton pRipple type=\"button\" label=\"Guardar\" (click)=\"submit()\" class=\"mr-2\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Cancelar\" (click)=\"cancel()\" class=\"p-button-danger\"></button>\r\n</div>", styles: [""], components: [{ type: i3__namespace$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value", "appendTo"], outputs: ["setValue", "sendNotification", "sendObject"] }], directives: [{ type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }] });
1106
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroDetalleComponent, decorators: [{
1107
- type: i0.Component,
1108
- args: [{
1109
- selector: 'lib-registro-detalle',
1110
- templateUrl: './registro-detalle.component.html',
1111
- styleUrls: ['./registro-detalle.component.css']
1112
- }]
1113
- }], ctorParameters: function () { return [{ type: i1__namespace$1.DynamicDialogRef }, { type: i1__namespace$1.DynamicDialogConfig }, { type: i2__namespace$1.MessageService }]; } });
1114
-
1115
- var RegistroChildComponent = /** @class */ (function () {
1116
- function RegistroChildComponent(ref, config, messageService, dialogService) {
1117
- this.ref = ref;
1118
- this.config = config;
1119
- this.messageService = messageService;
1120
- this.dialogService = dialogService;
1121
- this.esquema = new Shema();
1122
- this.trx = 'c';
1123
- this.controlsLoaded = false;
1124
- }
1125
- RegistroChildComponent.prototype.ngOnInit = function () {
1126
- var _a;
1127
- this.uiEsquema = this.config.data.uiEsquema[0];
1128
- this.esquema = this.config.data.esquema;
1129
- this.data = (_a = this.config.data) === null || _a === void 0 ? void 0 : _a.data;
1130
- if (!this.data) {
1131
- this.data = this.createObject(this.esquema);
1132
- jsonpath__namespace.value(this.data, '$..id', this.config.data.id);
1133
- }
1134
- this.buildControls();
1135
- };
1136
- RegistroChildComponent.prototype.buildControls = function () {
2384
+ FormComponent.prototype.buildControls = function () {
1137
2385
  var _this = this;
2386
+ var _a, _b, _c;
2387
+ this.visible = [];
1138
2388
  this.controlsLoaded = false;
1139
2389
  this.controls = [];
1140
2390
  this.values = [];
1141
2391
  this.uiEsquema.elements.forEach(function (layout, i) {
1142
2392
  var _a;
2393
+ var isVisible = layout.conditions ? _this.crudService.isConditionsCompleted(layout.conditions, _this.registro.conditions || [], _this.data) : true;
2394
+ _this.visible.push(layout.elements ? layout.elements.map(function () { return isVisible; }) : [isVisible]);
1143
2395
  _this.controls.push([]);
1144
2396
  _this.values.push([]);
1145
2397
  (_a = layout.elements) === null || _a === void 0 ? void 0 : _a.forEach(function (element, j) {
1146
- if (!element.scope)
1147
- console.log("CONFIGURAR BIEN " + element);
1148
- _this.controls[i].push(_this.getControl(element.scope));
1149
- _this.controls[i][j].scope = element.scope;
1150
- _this.values[i].push(_this.getValue(element.scope));
1151
- });
1152
- });
1153
- this.controlsLoaded = true;
1154
- };
1155
- RegistroChildComponent.prototype.getControl = function (scope) {
1156
- return jsonpath__namespace.query(this.esquema, scope)[0];
1157
- };
1158
- RegistroChildComponent.prototype.getValue = function (scope) {
1159
- return jsonpath__namespace.query(this.data, scope.replace('.properties', ''))[0];
1160
- };
1161
- RegistroChildComponent.prototype.setValue = function (value, scope, i, j) {
1162
- var _this = this;
1163
- switch (typeof (value)) {
1164
- case 'object':
1165
- if (Array.isArray(value))
1166
- value.forEach(function (val) {
1167
- _this.setValueByScope(val.scope, val.value);
1168
- jsonpath__namespace.value(_this.data, val.scope.replace('.properties', ''), val.value);
1169
- });
1170
- else {
1171
- this.values[i][j] = value;
1172
- jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
2398
+ if (element.conditions)
2399
+ _this.visible[i][j] = _this.crudService.isConditionsCompleted(element.conditions, _this.registro.conditions || [], _this.data);
2400
+ if (element.ngStyle && typeof (element.ngStyle) == "string")
2401
+ element.ngStyle = JSON.parse(element.ngStyle);
2402
+ if (element.url) {
2403
+ _this.controls[i].push(undefined);
2404
+ var url = _this.crudService.applyStringKeys(element.url);
2405
+ _this.values[i].push(_this.domSanitizer.bypassSecurityTrustResourceUrl(url));
1173
2406
  }
1174
- break;
1175
- default:
1176
- this.values[i][j] = value;
1177
- jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1178
- break;
1179
- }
1180
- this.applyValuesOnEvent('onChange', this.esquema, scope.replace('$..properties.', ''));
1181
- };
1182
- RegistroChildComponent.prototype.createObject = function (esquema) {
1183
- var object = {};
1184
- var resultArray = [];
1185
- switch (esquema.type) {
1186
- case 'numeric':
1187
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
1188
- case 'string':
1189
- case 'date':
1190
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
1191
- case 'boolean':
1192
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
1193
- case 'file':
1194
- return null;
1195
- case 'array':
1196
- case 'object':
1197
- for (var key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
1198
- Object.defineProperty(object, key, { value: this.createObjectChild(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
2407
+ else if (!element.scope) {
2408
+ _this.controls[i].push(undefined);
2409
+ _this.values[i].push(undefined);
1199
2410
  }
1200
- break;
1201
- default:
1202
- break;
1203
- }
1204
- return object;
1205
- };
1206
- RegistroChildComponent.prototype.createObjectChild = function (esquema) {
1207
- var object = {};
1208
- var resultArray = [];
1209
- switch (esquema.type) {
1210
- case 'numeric':
1211
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
1212
- case 'string':
1213
- case 'date':
1214
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
1215
- case 'boolean':
1216
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
1217
- case 'file':
1218
- return null;
1219
- case 'array':
1220
- return [];
1221
- case 'object':
1222
- for (var key in esquema === null || esquema === void 0 ? void 0 : esquema.properties) {
1223
- Object.defineProperty(object, key, { value: this.createObject(esquema === null || esquema === void 0 ? void 0 : esquema.properties[key]), writable: true, enumerable: true, configurable: true });
1224
- }
1225
- break;
1226
- default:
1227
- break;
1228
- }
1229
- return object;
1230
- };
1231
- RegistroChildComponent.prototype.setDefaultValue = function (value) {
1232
- var data = null;
1233
- var uactivo;
1234
- switch (value) {
1235
- case '@uactivo':
1236
- uactivo = JSON.parse(localStorage.getItem('oSessionTFM') || '{}');
1237
- if (!uactivo)
1238
- console.log('Validar configuracion de sesion');
1239
- else
1240
- data = uactivo.UsuarioSistema.TDOC + "-" + uactivo.UsuarioSistema.NDOC;
1241
- break;
1242
- case '@tdocactivo':
1243
- uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
1244
- if (!uactivo)
1245
- console.log('Validar configuracion de sesion');
1246
- else
1247
- data = uactivo.UsuarioSistema.TDOC;
1248
- break;
1249
- case '@ndocactivo':
1250
- uactivo = JSON.parse(sessionStorage.getItem('usrSesion') || '{}');
1251
- if (!uactivo)
1252
- console.log('Validar configuracion de sesion');
1253
- else
1254
- data = uactivo.UsuarioSistema.NDOC;
1255
- break;
1256
- case '@hoy':
1257
- data = new Date();
1258
- break;
1259
- default:
1260
- data = value;
1261
- break;
1262
- }
1263
- return data;
1264
- };
1265
- RegistroChildComponent.prototype.submit = function () {
1266
- this.applyValuesOnEvent('onSubmit', this.esquema);
1267
- if (!this.validateData())
1268
- return;
1269
- this.ref.close(this.data);
1270
- };
1271
- RegistroChildComponent.prototype.cancel = function () {
1272
- this.applyValuesOnEvent('onCancel', this.esquema);
1273
- this.ref.close();
1274
- };
1275
- RegistroChildComponent.prototype.validateData = function () {
1276
- if (this.esquema.validations.type == 'local')
1277
- return this.validateDataLocal();
1278
- return true;
1279
- };
1280
- RegistroChildComponent.prototype.validateDataLocal = function () {
1281
- var _this = this;
1282
- var err = [];
1283
- this.esquema.validations.required.forEach(function (x) {
1284
- if (!jsonpath__namespace.query(_this.data, x.field)[0])
1285
- err.push(x.message);
1286
- });
1287
- if (err.length != 0)
1288
- this.messageService.add({ severity: 'warn', detail: err.join('. ') });
1289
- return err.length == 0;
1290
- };
1291
- RegistroChildComponent.prototype.applyValuesOnEvent = function (event, esquema, scope) {
1292
- var _this = this;
1293
- if (scope) {
1294
- if (esquema.properties[scope][event]) {
1295
- esquema.properties[scope][event].forEach(function (value) {
1296
- _this.setValueEvent(_this.data, value);
1297
- });
1298
- }
1299
- }
1300
- else {
1301
- for (var key in esquema.properties) {
1302
- if (esquema.properties[key][event]) {
1303
- esquema.properties[key][event].forEach(function (value) {
1304
- _this.setValueEvent(_this.data, value);
1305
- });
1306
- }
1307
- }
1308
- }
1309
- };
1310
- RegistroChildComponent.prototype.setValueEvent = function (data, params) {
1311
- var _a;
1312
- var value;
1313
- var date = moment__namespace(new Date());
1314
- switch (params.op) {
1315
- case 'sum':
1316
- value = jsonpath__namespace.query(data, params === null || params === void 0 ? void 0 : params.scope[0]).reduce(function (acc, cur) { return acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur; }, 0);
1317
- break;
1318
- case 'concat':
1319
- var array_1 = [];
1320
- (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1321
- array_1.push(jsonpath__namespace.query(data, cur)[0]);
1322
- }, []);
1323
- if (params === null || params === void 0 ? void 0 : params.separator)
1324
- jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1325
- break;
1326
- case 'enable':
1327
- jsonpath__namespace.value(this.esquema, params.scope[0], false);
1328
- break;
1329
- case 'disabled':
1330
- jsonpath__namespace.value(this.esquema, params.scope[0], true);
1331
- break;
1332
- case 'replace:endpoint':
1333
- jsonpath__namespace.value(this.esquema, params.scope[0], jsonpath__namespace.query(this.esquema, params.scope[1])[0].replace(params.scope[2], jsonpath__namespace.query(data, "$.." + params.key)));
1334
- break;
1335
- case 'setNull':
1336
- jsonpath__namespace.value(this.data, "$." + params.key, null);
1337
- break;
1338
- case 'datediff:years':
1339
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'years'));
1340
- break;
1341
- case 'datediff:months':
1342
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'months'));
1343
- break;
1344
- case 'datediff:weeks':
1345
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'weeks'));
1346
- break;
1347
- case 'datediff:days':
1348
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'days'));
1349
- break;
1350
- default:
1351
- break;
1352
- }
1353
- return value;
1354
- };
1355
- RegistroChildComponent.prototype.sendNotification = function (message) {
1356
- this.messageService.add(message);
1357
- };
1358
- RegistroChildComponent.prototype.addObjectArray = function (element) {
1359
- var _this = this;
1360
- this.dialogRef = this.dialogService.open(RegistroDetalleComponent, {
1361
- header: element.label ? element.label : 'Detalle',
1362
- width: '70%',
1363
- modal: true,
1364
- closable: false,
1365
- data: {
1366
- uiEsquema: Object.assign({}, element.elements),
1367
- esquema: this.getControl(element.scope),
1368
- id: this.getValue(element.scope).length + 1
1369
- }
1370
- });
1371
- this.dialogRef.onClose.subscribe(function (data) {
1372
- if (data)
1373
- _this.data[element.scope.replace('$..properties.', '')].push(data);
1374
- _this.applyValuesOnEvent('onChange', _this.esquema, element.scope.replace('$..properties.', ''));
1375
- });
1376
- };
1377
- RegistroChildComponent.prototype.editRow = function (element, data, index) {
1378
- var _this = this;
1379
- this.dialogRef = this.dialogService.open(RegistroDetalleComponent, {
1380
- header: element.label ? element.label : 'Detalle',
1381
- width: '70%',
1382
- modal: true,
1383
- closable: false,
1384
- data: {
1385
- uiEsquema: Object.assign({}, element.elements),
1386
- esquema: this.getControl(element.scope),
1387
- data: Object.assign({}, data)
1388
- }
1389
- });
1390
- this.dialogRef.onClose.subscribe(function (data) {
1391
- if (data)
1392
- _this.data[element.scope.replace('$..properties.', '')][index] = data;
1393
- _this.applyValuesOnEvent('onChange', _this.esquema, element.scope.replace('$..properties.', ''));
1394
- });
1395
- };
1396
- RegistroChildComponent.prototype.deleteRow = function (element, index) {
1397
- this.data[element.scope.replace('$..properties.', '')].splice(index, 1);
1398
- index = 1;
1399
- this.data[element.scope.replace('$..properties.', '')].forEach(function (el) {
1400
- el.id = index;
1401
- index++;
1402
- });
1403
- this.applyValuesOnEvent('onChange', this.esquema, element.scope.replace('$..properties.', ''));
1404
- };
1405
- RegistroChildComponent.prototype.setValueByScope = function (scope, newVal) {
1406
- var _this = this;
1407
- var _loop_1 = function (i) {
1408
- var row = this_1.controls[i];
1409
- row.forEach(function (el, j) {
1410
- if (el.scope && el.scope.replace('.properties', '') == scope.replace('.properties', '')) {
1411
- _this.values[i][j] = newVal;
1412
- }
1413
- });
1414
- };
1415
- var this_1 = this;
1416
- for (var i = 0; i < this.controls.length; i++) {
1417
- _loop_1(i);
1418
- }
1419
- };
1420
- RegistroChildComponent.prototype.applyValuesFromObject = function (event) {
1421
- if (event.optionValue) {
1422
- for (var i = 0; i < event.optionValue.length; i++) {
1423
- var optionVal = event.optionValue[i];
1424
- var newVal = event.data ? this.aplyFormatValue(optionVal.scope, event.data[optionVal.key]) : null;
1425
- jsonpath__namespace.value(this.data, optionVal.scope.replace('.properties', ''), this.aplyFormatValue(optionVal.scope, event.data[optionVal.key]));
1426
- this.setValueByScope(optionVal.scope, newVal);
1427
- }
1428
- }
1429
- };
1430
- RegistroChildComponent.prototype.aplyFormatValue = function (scope, value) {
1431
- var control = jsonpath__namespace.query(this.esquema, scope)[0];
1432
- var resp;
1433
- switch (control.type) {
1434
- case 'date':
1435
- resp = new Date("" + value);
1436
- break;
1437
- case 'numeric':
1438
- resp = +value;
1439
- break;
1440
- default:
1441
- resp = value;
1442
- break;
1443
- }
1444
- return resp;
1445
- };
1446
- return RegistroChildComponent;
1447
- }());
1448
- RegistroChildComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroChildComponent, deps: [{ token: i1__namespace$1.DynamicDialogRef }, { token: i1__namespace$1.DynamicDialogConfig }, { token: i2__namespace$1.MessageService }, { token: i1__namespace$1.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1449
- RegistroChildComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroChildComponent, selector: "lib-registro-child", providers: [i2$1.MessageService, i1$1.DialogService], ngImport: i0__namespace, template: "<p-toast></p-toast>\r\n<div *ngIf=\"controlsLoaded\">\r\n<div *ngFor=\"let element of uiEsquema.elements; let i = index\" [class]=\"element?.class\" #a>\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *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\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][j]\" [label]=\"el.label\" [value]=\"values[i][j]\"\r\n (setValue)=\"setValue($event, el.scope, i, j)\" (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\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 k =index\" [class]=\"el?.class\">\r\n <ng-container [ngSwitch]=\"el.type\">\r\n <sf-control *ngSwitchCase=\"'Control'\" [control]=\"controls[i][k]\" [label]=\"el.label\"\r\n [value]=\"values[i][k]\" (setValue)=\"setValue($event, el.scope, i, k)\"\r\n (sendNotification)=\"sendNotification($event)\"\r\n (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n <ng-container *ngSwitchCase=\"'Table'\">\r\n <p-table [value]=\"getValue(el.scope)\" [columns]=\"getControl(el.scope).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\"></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 *ngIf=\"trx == 'c' || trx == 'u'\">\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=\"'text'\">\r\n <td>{{rowData[col.col]}}</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 *ngIf=\"trx == 'c' || trx == 'u'\">\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)\"\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 *ngSwitchCase=\"'Control'\">\r\n <sf-control [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </ng-container>\r\n </ng-container>\r\n</div>\r\n<div class=\"card-footer mt-2\">\r\n <button pButton pRipple type=\"button\" label=\"Guardar\" (click)=\"submit()\" class=\"mr-2\"></button>\r\n <button pButton pRipple type=\"button\" label=\"Cancelar\" (click)=\"cancel()\" class=\"p-button-danger\"></button>\r\n</div>\r\n</div>\r\n", components: [{ type: i3__namespace$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value", "appendTo"], outputs: ["setValue", "sendNotification", "sendObject"] }, { type: i5__namespace.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"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }], pipes: { "currency": i7__namespace.CurrencyPipe, "date": i7__namespace.DatePipe } });
1450
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroChildComponent, decorators: [{
1451
- type: i0.Component,
1452
- args: [{
1453
- selector: 'lib-registro-child',
1454
- templateUrl: './registro-child.component.html',
1455
- providers: [i2$1.MessageService, i1$1.DialogService]
1456
- }]
1457
- }], ctorParameters: function () { return [{ type: i1__namespace$1.DynamicDialogRef }, { type: i1__namespace$1.DynamicDialogConfig }, { type: i2__namespace$1.MessageService }, { type: i1__namespace$1.DialogService }]; } });
1458
-
1459
- var SfCrudService = /** @class */ (function () {
1460
- function SfCrudService() {
1461
- this._dataTemp = [];
1462
- }
1463
- SfCrudService.prototype.saveDataTemp = function (scope, value) {
1464
- this._dataTemp.push({ scope: scope, value: value });
1465
- sessionStorage.setItem('dataTemp', JSON.stringify(this._dataTemp));
1466
- };
1467
- SfCrudService.prototype.getDataTemp = function () {
1468
- var dataTemp = sessionStorage.getItem('dataTemp');
1469
- sessionStorage.removeItem('dataTemp');
1470
- return dataTemp ? JSON.parse(dataTemp) : [];
1471
- };
1472
- SfCrudService.prototype.cleanDataTemp = function () {
1473
- sessionStorage.removeItem('dataTemp');
1474
- };
1475
- return SfCrudService;
1476
- }());
1477
- SfCrudService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1478
- SfCrudService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, providedIn: 'root' });
1479
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudService, decorators: [{
1480
- type: i0.Injectable,
1481
- args: [{
1482
- providedIn: 'root'
1483
- }]
1484
- }], ctorParameters: function () { return []; } });
1485
-
1486
- var RegistroComponent = /** @class */ (function () {
1487
- function RegistroComponent(generalService, router, messageSerice, dialogService, sfCrudService) {
1488
- this.generalService = generalService;
1489
- this.router = router;
1490
- this.messageSerice = messageSerice;
1491
- this.dialogService = dialogService;
1492
- this.sfCrudService = sfCrudService;
1493
- this.idKatios = '';
1494
- this.idEntidad = '';
1495
- this.trx = '';
1496
- this.id = '';
1497
- this.sendData = new i0.EventEmitter();
1498
- this.onSubmit = new i0.EventEmitter();
1499
- this.dataTemp = [];
1500
- this.crudConfig = new CrudConfig();
1501
- this.enProceso = false;
1502
- this.configOperation = new Operations();
1503
- this.isLocal = false;
1504
- this.controlsLoaded = false;
1505
- this.dataTemp = this.sfCrudService.getDataTemp();
1506
- }
1507
- RegistroComponent.prototype.ngOnInit = function () {
1508
- this.loadConfigCrud();
1509
- };
1510
- RegistroComponent.prototype.loadConfigCrud = function () {
1511
- var _this = this;
1512
- this.enProceso = true;
1513
- this.generalService.getCrudByEntidad(this.idKatios, this.idEntidad)
1514
- .then(function (res) {
1515
- _this.setDataTemp(res.esquema, _this.dataTemp);
1516
- _this.crudConfig = res;
1517
- if (_this.trx == 'c') {
1518
- _this.configOperation = _this.crudConfig.registro.operations.find(function (x) { return x.type.startsWith(_this.trx); }) || new Operations();
1519
- _this.data = _this.createObject(_this.crudConfig.esquema);
1520
- console.log(_this.data);
1521
- _this.setLabelSumbit();
1522
- _this.enProceso = false;
1523
- _this.buildControls();
1524
- }
1525
- else
1526
- _this.getInfoRegistro(_this.crudConfig.registro);
1527
- })
1528
- .catch(function (err) {
1529
- console.log(err);
1530
- _this.enProceso = false;
1531
- });
1532
- };
1533
- RegistroComponent.prototype.buildControls = function () {
1534
- var _this = this;
1535
- this.controlsLoaded = false;
1536
- this.controls = [];
1537
- this.values = [];
1538
- this.crudConfig.uiEsquema.elements.forEach(function (layout, i) {
1539
- var _a;
1540
- _this.controls.push([]);
1541
- _this.values.push([]);
1542
- (_a = layout.elements) === null || _a === void 0 ? void 0 : _a.forEach(function (element, j) {
1543
- _this.controls[i].push(_this.getControl(element.scope));
1544
- _this.controls[i][j].scope = element.scope;
1545
- _this.values[i].push(_this.getValue(element.scope));
1546
- });
1547
- });
1548
- this.controlsLoaded = true;
1549
- };
1550
- RegistroComponent.prototype.setLabelSumbit = function () {
1551
- if (this.trx == 'c')
1552
- this.btnSubmit = { label: 'Guardar', icon: 'pi pi-save' };
1553
- else if (this.trx == 'r')
1554
- this.btnSubmit = undefined;
1555
- else if (this.trx == 'u')
1556
- this.btnSubmit = { label: 'Actualizar', icon: 'pi pi-sync' };
1557
- else if (this.trx == 'd')
1558
- this.btnSubmit = { label: 'Eliminar', icon: 'pi pi-trash' };
1559
- };
1560
- RegistroComponent.prototype.getInfoRegistro = function (configRegistro) {
1561
- var _this = this;
1562
- var op = configRegistro.operations.find(function (x) { return x.type == 'read'; });
1563
- var endpoint = (op === null || op === void 0 ? void 0 : op.endpoint) || '';
1564
- endpoint = endpoint.replace('@idKatios', this.idKatios);
1565
- endpoint = endpoint.replace('@ndocactivo', this.user.UsuarioSistema.NDOC);
1566
- endpoint = endpoint.replace('@id', this.id);
1567
- this.generalService.genericRequest((op === null || op === void 0 ? void 0 : op.method) || '', (op === null || op === void 0 ? void 0 : op.server) || '', endpoint)
1568
- .then(function (res) {
1569
- if (res === null || res === void 0 ? void 0 : res.data) {
1570
- if (Array.isArray(res.data))
1571
- _this.data = res.data[0];
1572
- else
1573
- _this.data = res.data;
1574
- _this.trx = 'u';
1575
- }
1576
- else {
1577
- _this.trx = 'c';
1578
- _this.data = _this.createObject(_this.crudConfig.esquema);
1579
- }
1580
- _this.buildControls();
1581
- _this.enProceso = false;
1582
- _this.configOperation = _this.crudConfig.registro.operations.find(function (x) { return x.type.startsWith(_this.trx); }) || new Operations();
1583
- _this.setLabelSumbit();
1584
- })
1585
- .catch(function (err) {
1586
- console.log(err);
1587
- _this.enProceso = false;
1588
- });
1589
- };
1590
- RegistroComponent.prototype.back = function () {
1591
- this.router.navigateByUrl(this.crudConfig.registro.btnBack);
1592
- };
1593
- RegistroComponent.prototype.getControl = function (scope) {
1594
- return jsonpath__namespace.query(this.crudConfig.esquema, scope)[0];
1595
- };
1596
- RegistroComponent.prototype.getValue = function (scope) {
1597
- return jsonpath__namespace.query(this.data, scope.replace('.properties', ''))[0];
1598
- };
1599
- RegistroComponent.prototype.setValue = function (value, scope, i, j) {
1600
- var _this = this;
1601
- switch (typeof (value)) {
1602
- case 'object':
1603
- if (Array.isArray(value))
1604
- value.forEach(function (val) {
1605
- _this.setValueByScope(val.scope, val.value);
1606
- jsonpath__namespace.value(_this.data, val.scope.replace('.properties', ''), val.value);
1607
- });
1608
- else {
1609
- this.values[i][j] = value;
1610
- jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1611
- }
1612
- break;
1613
- default:
1614
- this.values[i][j] = value;
1615
- jsonpath__namespace.value(this.data, scope.replace('.properties', ''), value);
1616
- break;
1617
- }
1618
- this.applyValuesOnEvent('onChange', this.crudConfig.esquema);
1619
- };
1620
- RegistroComponent.prototype.createObject = function (esquema) {
1621
- var _this = this;
1622
- var object = {};
1623
- switch (esquema.type) {
1624
- case 'numeric':
1625
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || 0;
1626
- case 'string':
1627
- case 'date':
1628
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) ? this.setDefaultValue(esquema.default) : null;
1629
- case 'boolean':
1630
- return (esquema === null || esquema === void 0 ? void 0 : esquema.default) || false;
1631
- case 'array':
1632
- return [];
1633
- case 'file':
1634
- return null;
1635
- case 'object':
1636
- Object.getOwnPropertyNames(esquema === null || esquema === void 0 ? void 0 : esquema.properties).forEach(function (key) {
1637
- var aux = esquema === null || esquema === void 0 ? void 0 : esquema.properties[key];
1638
- if (aux)
1639
- object[key] = _this.createObject(aux);
1640
- });
1641
- return object;
1642
- default:
1643
- return null;
1644
- }
1645
- };
1646
- RegistroComponent.prototype.submit = function () {
1647
- var _this = this;
1648
- console.log(this.data);
1649
- if (!this.validateData())
1650
- return;
1651
- this.applyValuesOnEvent('onSubmit', this.crudConfig.esquema);
1652
- this.enProceso = true;
1653
- var endpoint = this.configOperation.endpoint;
1654
- endpoint = endpoint.replace('@idKatios', this.idKatios);
1655
- endpoint = endpoint.replace('@id', this.id);
1656
- this.generalService.genericRequest(this.configOperation.method, this.configOperation.server, endpoint, this.data)
1657
- .then(function (res) {
1658
- _this.generateMessage({ severity: 'success', detail: "Proceso exitoso!" }, res, _this.configOperation.answerChecking);
1659
- _this.enProceso = false;
1660
- setTimeout(function () {
1661
- var _a, _b;
1662
- if ((_a = _this.configOperation) === null || _a === void 0 ? void 0 : _a.redirect)
1663
- _this.router.navigate([(_b = _this.configOperation) === null || _b === void 0 ? void 0 : _b.redirect]);
1664
- else
1665
- _this.onSubmit.emit(_this.data);
1666
- }, 2000);
1667
- })
1668
- .catch(function (err) {
1669
- var operation = _this.crudConfig.registro.operations.find(function (op) { return op.type.startsWith(_this.trx); });
1670
- _this.generateMessage({ severity: "error", detail: "Por favor comunicarse con el admin", summary: "Error no controlado" }, err.error, operation.errorChecking);
1671
- _this.enProceso = false;
1672
- });
1673
- };
1674
- /**
1675
- * Generates message using answerchecking
1676
- * @param currentMsg Default message: Message
1677
- * @param rta Resquest's response
1678
- * @param answerChecking
1679
- */
1680
- RegistroComponent.prototype.generateMessage = function (currentMsg, rta, requestChecking) {
1681
- if (requestChecking) {
1682
- if (requestChecking.statics)
1683
- Object.assign(currentMsg, requestChecking.statics);
1684
- //mapear los dinamicos
1685
- if (requestChecking.dynamics) {
1686
- var dynamics = requestChecking.dynamics;
1687
- try {
1688
- if (dynamics && typeof (rta) == "string")
1689
- rta = JSON.parse(rta);
1690
- if (dynamics) {
1691
- for (var property in dynamics) {
1692
- currentMsg[property] = jsonpath__namespace.query(rta, dynamics[property])[0];
1693
- }
1694
- }
1695
- }
1696
- catch (error) { //es una respuesta sin JSON
1697
- if (dynamics)
1698
- currentMsg.detail = rta;
1699
- }
1700
- }
1701
- }
1702
- if ((requestChecking === null || requestChecking === void 0 ? void 0 : requestChecking.redirect) || (requestChecking === null || requestChecking === void 0 ? void 0 : requestChecking.swal))
1703
- Swal__default["default"].fire(currentMsg.summary, currentMsg.detail, currentMsg.severity).then(function (res) {
1704
- if (res.isConfirmed && requestChecking.redirect)
1705
- window.location.href = requestChecking.redirect;
1706
- });
1707
- else
1708
- this.messageSerice.add(currentMsg);
1709
- };
1710
- RegistroComponent.prototype.validateData = function () {
1711
- if (this.configOperation.validations.type == 'local')
1712
- return this.validateDataLocal();
1713
- return true;
1714
- };
1715
- RegistroComponent.prototype.validateDataLocal = function () {
1716
- var _this = this;
1717
- var _a, _b, _c, _d;
1718
- var err = [];
1719
- (_b = (_a = this.configOperation.validations) === null || _a === void 0 ? void 0 : _a.required) === null || _b === void 0 ? void 0 : _b.forEach(function (x) {
1720
- if (!jsonpath__namespace.query(_this.data, x.field)[0])
1721
- err.push(x.message);
1722
- });
1723
- (_d = (_c = this.configOperation.validations) === null || _c === void 0 ? void 0 : _c.operations) === null || _d === void 0 ? void 0 : _d.forEach(function (op) {
1724
- switch (op.action) {
1725
- case 'sumArray':
1726
- var var1 = jsonpath__namespace.query(_this.data, op.scope[0]).reduce(function (acc, cur) { return acc += cur[op.key]; }, 0);
1727
- var var2 = jsonpath__namespace.query(_this.data, op.scope[1]).reduce(function (acc, cur) { return acc += cur[op.key]; }, 0);
1728
- if (var1 != var2)
1729
- err.push(op.message);
1730
- break;
1731
- default:
1732
- break;
1733
- }
1734
- });
1735
- if (err.length != 0)
1736
- this.messageSerice.add({ severity: 'warn', detail: err.join('. ') });
1737
- return err.length == 0;
1738
- };
1739
- RegistroComponent.prototype.setDefaultValue = function (value) {
1740
- var data = null;
1741
- if (value.key && this.configOperation.keys) {
1742
- data = this.getValueKey(this.configOperation.keys.find(function (k) { return k.key == value.key; }));
1743
- value = data;
1744
- }
1745
- switch (value) {
1746
- case '@uactivo':
1747
- data = this.user.UsuarioSistema.TDOC + "-" + this.user.UsuarioSistema.NDOC;
1748
- break;
1749
- case '@tdocactivo':
1750
- data = this.user.UsuarioSistema.TDOC;
1751
- break;
1752
- case '@ndocactivo':
1753
- data = this.user.UsuarioSistema.NDOC;
1754
- break;
1755
- case '@hoy':
1756
- data = new Date();
1757
- break;
1758
- default:
1759
- data = value;
1760
- break;
1761
- }
1762
- return data;
1763
- };
1764
- RegistroComponent.prototype.getValueKey = function (key) {
1765
- var data;
1766
- switch (key.data || 'externa') {
1767
- case "user":
1768
- data = this.user;
1769
- break;
1770
- default:
1771
- data = this.dataExt;
1772
- break;
1773
- }
1774
- if (data) {
1775
- var aux = jsonpath__namespace.query(data, key.scope);
1776
- if (aux.length == 0)
1777
- return undefined;
1778
- if (aux.length == 1)
1779
- return aux[0];
1780
- else
1781
- return aux;
1782
- }
1783
- return undefined;
1784
- };
1785
- RegistroComponent.prototype.sendNotification = function (message) {
1786
- this.messageSerice.add(message);
1787
- };
1788
- RegistroComponent.prototype.addObjectArray = function (element) {
1789
- var _this = this;
1790
- this.dialogRef = this.dialogService.open(RegistroChildComponent, {
1791
- header: element.label ? element.label : 'Detalle',
1792
- width: '70%',
1793
- modal: true,
1794
- closable: true,
1795
- data: {
1796
- uiEsquema: Object.assign({}, element.elements),
1797
- esquema: this.getControl(element.scope),
1798
- id: this.getValue(element.scope).length + 1
1799
- }
1800
- });
1801
- this.dialogRef.onClose.subscribe(function (data) {
1802
- if (data)
1803
- _this.data[element.scope.replace('$..properties.', '')].push(data);
1804
- _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1805
- });
1806
- };
1807
- RegistroComponent.prototype.editRow = function (element, data, index) {
1808
- var _this = this;
1809
- this.dialogRef = this.dialogService.open(RegistroChildComponent, {
1810
- header: element.label ? element.label : 'Detalle',
1811
- width: '70%',
1812
- modal: true,
1813
- closable: true,
1814
- data: {
1815
- uiEsquema: Object.assign({}, element.elements),
1816
- esquema: this.getControl(element.scope),
1817
- data: Object.assign({}, data)
1818
- }
1819
- });
1820
- this.dialogRef.onClose.subscribe(function (data) {
1821
- if (data)
1822
- _this.data[element.scope.replace('$..properties.', '')][index] = data;
1823
- _this.applyValuesOnEvent('onChange', _this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
1824
- });
1825
- };
1826
- RegistroComponent.prototype.deleteRow = function (element, index) {
1827
- this.data[element.scope.replace('$..properties.', '')].splice(index, 1);
1828
- index = 1;
1829
- this.data[element.scope.replace('$..properties.', '')].forEach(function (el) {
1830
- el.id = index;
1831
- index++;
2411
+ else {
2412
+ _this.controls[i].push(_this.crudService.getControl(element.scope, _this.esquema));
2413
+ _this.controls[i][j].scope = element.scope;
2414
+ _this.values[i].push(_this.crudService.getValue(element.scope, _this.data));
2415
+ }
2416
+ });
1832
2417
  });
1833
- this.applyValuesOnEvent('onChange', this.crudConfig.esquema, element.scope.replace('$..properties.', ''));
2418
+ this.controlsLoaded = true;
2419
+ var idProceso = (_b = (_a = this.data.ADO) === null || _a === void 0 ? void 0 : _a.dataProceso) === null || _b === void 0 ? void 0 : _b.idProceso;
2420
+ if (idProceso && ((_c = this.proceso) === null || _c === void 0 ? void 0 : _c.id) != idProceso)
2421
+ this.refreshIntegracion(idProceso);
1834
2422
  };
1835
- RegistroComponent.prototype.applyValuesOnEvent = function (event, esquema, key) {
2423
+ FormComponent.prototype.refreshIntegracion = function (idProceso) {
1836
2424
  var _this = this;
1837
- if (key) {
1838
- if (esquema.properties[key][event]) {
1839
- esquema.properties[key][event].forEach(function (value) {
1840
- _this.setValueEvent(_this.data, value);
1841
- });
1842
- }
1843
- }
1844
- else {
1845
- for (var key_1 in esquema.properties) {
1846
- if (esquema.properties[key_1][event]) {
1847
- esquema.properties[key_1][event].forEach(function (value) {
1848
- _this.setValueEvent(_this.data, value);
1849
- });
1850
- }
1851
- }
1852
- }
2425
+ this.emitLoadingForm(true);
2426
+ return Promise.all([
2427
+ this.adoService.getProceso(idProceso).then(function (proceso) {
2428
+ _this.proceso = proceso;
2429
+ _this.data.ADO.proceso = _this.proceso;
2430
+ })
2431
+ ])
2432
+ .finally(function () { return _this.emitLoadingForm(false); });
2433
+ };
2434
+ FormComponent.prototype.extracControlFromTableElements = function (i, j, col) {
2435
+ var property = this.controls[i][j].properties[col.col];
2436
+ return property;
2437
+ };
2438
+ FormComponent.prototype.extracValueFromTableElements = function (i, j, k, col) {
2439
+ var value = this.values[i][j][k][col.col];
2440
+ return value;
1853
2441
  };
1854
- RegistroComponent.prototype.setValueEvent = function (data, params) {
2442
+ FormComponent.prototype.setValue = function (value, scope, i, j) {
2443
+ var _this = this;
1855
2444
  var _a;
1856
- var date = moment__namespace(new Date());
1857
- switch (params.op) {
1858
- case 'sum':
1859
- jsonpath__namespace.value(data, params.scope[1], jsonpath__namespace.query(data, params.scope[0]).reduce(function (acc, cur) { return acc += (params === null || params === void 0 ? void 0 : params.key) ? cur[params.key] : cur; }, 0));
1860
- break;
1861
- case 'concat':
1862
- var array_1 = [];
1863
- (_a = params === null || params === void 0 ? void 0 : params.key) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, cur) {
1864
- array_1.push(jsonpath__namespace.query(data, cur)[0]);
1865
- }, []);
1866
- if (params === null || params === void 0 ? void 0 : params.separator)
1867
- jsonpath__namespace.value(data, params.scope[0], array_1.join((params === null || params === void 0 ? void 0 : params.separator) || ' '));
1868
- break;
1869
- case 'enable':
1870
- jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], false);
1871
- break;
1872
- case 'disabled':
1873
- jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], true);
1874
- break;
1875
- case 'replace:endpoint':
1876
- jsonpath__namespace.value(this.crudConfig.esquema, params.scope[0], this.crudConfig.esquema.config.endpointtemp.replace(params.scope[1], jsonpath__namespace.query(data, "$.." + params.key)));
1877
- break;
1878
- case 'setNull':
1879
- jsonpath__namespace.value(this.data, "$." + params.key, null);
1880
- break;
1881
- case 'datediff:years':
1882
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'years'));
1883
- break;
1884
- case 'datediff:months':
1885
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'months'));
1886
- break;
1887
- case 'datediff:weeks':
1888
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'weeks'));
1889
- break;
1890
- case 'datediff:days':
1891
- jsonpath__namespace.value(this.data, params.scope[0], date.diff(moment__namespace(jsonpath__namespace.query(this.data, params.scope[1])[0]), 'days'));
1892
- break;
1893
- default:
1894
- break;
2445
+ scope = scope.replaceAll('..properties', '');
2446
+ if (scope) {
2447
+ var control = this.controls[i][j];
2448
+ this.values[i][j] = value;
2449
+ jsonpath__namespace.value(this.data, scope, value);
2450
+ this.crudService.changeData = new ChangeData(value, scope, this.crudService.index);
2451
+ this.uiEsquema.elements.forEach(function (layout, iLayout) {
2452
+ var _a;
2453
+ if (layout.conditions) {
2454
+ var isVisible_1 = _this.crudService.isConditionsCompleted(layout.conditions, _this.crudService.getRegistro(_this.crudService.index).conditions || [], _this.data);
2455
+ if (layout.elements)
2456
+ _this.visible[iLayout] = layout.elements.map(function () { return isVisible_1; });
2457
+ else
2458
+ _this.visible[iLayout][0] = isVisible_1;
2459
+ }
2460
+ (_a = layout.elements) === null || _a === void 0 ? void 0 : _a.forEach(function (element, indexEl) {
2461
+ if (element.conditions) {
2462
+ _this.visible[iLayout][indexEl] = _this.crudService.isConditionsCompleted(element.conditions, _this.registro.conditions || [], _this.data);
2463
+ }
2464
+ });
2465
+ });
2466
+ (_a = control.applyKeys) === null || _a === void 0 ? void 0 : _a.forEach(function (i) {
2467
+ var key = _this.registro.keys ? _this.registro.keys[i] : undefined;
2468
+ if (key)
2469
+ _this.crudService.applyKey(key, _this.registro, key.indexData ? _this.crudService.getData(key.indexData) : _this.data);
2470
+ });
2471
+ this.buildControls();
1895
2472
  }
2473
+ this.crudService.applyValuesOnEvent('onChange', this.esquema, undefined, this.data);
1896
2474
  };
1897
- RegistroComponent.prototype.setDataTemp = function (esquema, dataTemp) {
1898
- dataTemp.forEach(function (data) {
1899
- jsonpath__namespace.value(esquema, data.scope, data.value);
1900
- });
2475
+ FormComponent.prototype.sendNotification = function (message) {
2476
+ this.messageService.add(message);
1901
2477
  };
1902
- RegistroComponent.prototype.applyValuesFromObject = function (event) {
2478
+ FormComponent.prototype.applyValuesFromObject = function (event) {
1903
2479
  if (event.optionValue) {
1904
2480
  for (var i = 0; i < event.optionValue.length; i++) {
1905
2481
  var optionVal = event.optionValue[i];
@@ -1909,7 +2485,7 @@
1909
2485
  }
1910
2486
  }
1911
2487
  };
1912
- RegistroComponent.prototype.setValueByScope = function (scope, newVal) {
2488
+ FormComponent.prototype.setValueByScope = function (scope, newVal) {
1913
2489
  var _this = this;
1914
2490
  var _loop_1 = function (i) {
1915
2491
  var row = this_1.controls[i];
@@ -1924,8 +2500,8 @@
1924
2500
  _loop_1(i);
1925
2501
  }
1926
2502
  };
1927
- RegistroComponent.prototype.aplyFormatValue = function (scope, value) {
1928
- var control = jsonpath__namespace.query(this.crudConfig.esquema, scope)[0];
2503
+ FormComponent.prototype.aplyFormatValue = function (scope, value) {
2504
+ var control = jsonpath__namespace.query(this.esquema, scope)[0];
1929
2505
  var resp;
1930
2506
  switch (control.type) {
1931
2507
  case 'date':
@@ -1940,21 +2516,649 @@
1940
2516
  }
1941
2517
  return resp;
1942
2518
  };
2519
+ FormComponent.prototype.editRow = function (element, data, index) {
2520
+ this.stepService.addCustomChildrenEvent("onClickedEditButton", { element: element, data: data, index: index });
2521
+ };
2522
+ FormComponent.prototype.deleteRow = function (element, index) {
2523
+ this.stepService.addCustomChildrenEvent("onClickedDeleteButton", { element: element, index: index });
2524
+ };
2525
+ FormComponent.prototype.addObjectArray = function (element) {
2526
+ this.stepService.addCustomChildrenEvent("onClickedAddButton", { element: element });
2527
+ };
2528
+ FormComponent.prototype.onStateDocument = function (state) {
2529
+ this.data.pdf.signed = state.toUpperCase() == "FIRMADO";
2530
+ };
2531
+ FormComponent.prototype.onSimuladorChange = function ($event) {
2532
+ var _this = this;
2533
+ Promise.resolve().then(function () { return Object.assign(_this.data, $event); });
2534
+ };
2535
+ FormComponent.prototype.goToADO = function () {
2536
+ var _a;
2537
+ var url = window.location.href;
2538
+ var callback = url.split('?')[0] + ("?id=" + this.data.idForm);
2539
+ var idProceso = (_a = this.data.ADO.dataProceso) === null || _a === void 0 ? void 0 : _a.idProceso;
2540
+ var dataProceso = this.data.ADO.dataProceso;
2541
+ dataProceso.ctivo = this.data.idForm;
2542
+ //this.data.ADO.idTransaction = null
2543
+ //this.data.ADO.idProceso = null
2544
+ if (idProceso) {
2545
+ window.location.href = this.crudService.environment.WebUtilities + "GWV/ADO/" + this.crudService.idKatios + "?id=" + idProceso;
2546
+ window.location.reload();
2547
+ }
2548
+ else if (dataProceso) {
2549
+ window.location.href = this.crudService.environment.WebUtilities + "GWV/ADO/" + this.crudService.idKatios + "?dataProceso=" + btoa(JSON.stringify(dataProceso)) + "&callback=" + encodeURIComponent(callback);
2550
+ window.location.reload();
2551
+ }
2552
+ };
2553
+ FormComponent.prototype.onTouchDescription = function (id, alignRight) {
2554
+ if (alignRight === void 0) { alignRight = true; }
2555
+ var foundTooltip = this.tooltips.find(function (tooltip) { return tooltip.el.nativeElement.id === id; });
2556
+ try {
2557
+ foundTooltip.activate();
2558
+ alignRight ? foundTooltip.alignRight() : foundTooltip.alignTop();
2559
+ }
2560
+ catch (ex) { }
2561
+ };
2562
+ FormComponent.prototype.onUnTouchDescription = function (descripcion) {
2563
+ var foundTooltip = this.tooltips.find(function (tooltip) { return tooltip.el.nativeElement.id === descripcion; });
2564
+ try {
2565
+ foundTooltip.deactivate();
2566
+ }
2567
+ catch (ex) { }
2568
+ };
2569
+ FormComponent.prototype.copyToClipboard = function (idProceso) {
2570
+ var url = this.crudService.environment.WebUtilities + "GWV/ADO/" + this.crudService.idKatios + "?id=" + idProceso;
2571
+ navigator.clipboard.writeText(url);
2572
+ };
2573
+ return FormComponent;
2574
+ }());
2575
+ FormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FormComponent, deps: [{ token: i1__namespace$1.MessageService }, { token: SfCrudService }, { token: i3__namespace$1.DomSanitizer }, { token: StepService }, { token: i5__namespace$2.AdoService }, { token: i5__namespace$2.JWTService }], target: i0__namespace.ɵɵFactoryTarget.Component });
2576
+ FormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FormComponent, selector: "app-form", inputs: { uiEsquema: "uiEsquema", esquema: "esquema", data: "data", isDialog: "isDialog" }, viewQueries: [{ propertyName: "tooltips", predicate: i13.Tooltip, descendants: true }], usesOnChanges: true, ngImport: i0__namespace, template: "<div *ngIf=\"controlsLoaded\" class=\"frm-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)\"></sf-control>\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)\"></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\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=\"'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>", 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"] }, { type: i6__namespace$2.SignComponent, selector: "sf-sign", inputs: ["idkatios", "tdoc", "ndoc", "idDocument", "typeDocument", "allowDownload"], outputs: ["stateDocument", "loading"] }, { type: i7__namespace$1.SfSimuladorComponent, selector: "sf-simulador", inputs: ["simulador", "otherToolTips", "labels"], outputs: ["simuladorChange", "enProceso"] }, { type: i9__namespace.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { type: i6__namespace.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__namespace$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }], directives: [{ type: i12__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i12__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i12__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i12__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i12__namespace.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i13__namespace.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i1__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i11__namespace.Ripple, selector: "[pRipple]" }], pipes: { "currency": i12__namespace.CurrencyPipe, "date": i12__namespace.DatePipe } });
2577
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FormComponent, decorators: [{
2578
+ type: i0.Component,
2579
+ args: [{
2580
+ selector: 'app-form',
2581
+ templateUrl: './form.component.html',
2582
+ styleUrls: ['./form.component.css']
2583
+ }]
2584
+ }], ctorParameters: function () { return [{ type: i1__namespace$1.MessageService }, { type: SfCrudService }, { type: i3__namespace$1.DomSanitizer }, { type: StepService }, { type: i5__namespace$2.AdoService }, { type: i5__namespace$2.JWTService }]; }, propDecorators: { uiEsquema: [{
2585
+ type: i0.Input
2586
+ }], esquema: [{
2587
+ type: i0.Input
2588
+ }], data: [{
2589
+ type: i0.Input
2590
+ }], isDialog: [{
2591
+ type: i0.Input
2592
+ }], tooltips: [{
2593
+ type: i0.ViewChildren,
2594
+ args: [i13.Tooltip]
2595
+ }] } });
2596
+
2597
+ var RegistroComponent = /** @class */ (function () {
2598
+ function RegistroComponent(generalService, activeRoute, messageService, sfCrudService, stepService, sfPdfSignService, sfSimuladorService, notificationService, router) {
2599
+ this.generalService = generalService;
2600
+ this.activeRoute = activeRoute;
2601
+ this.messageService = messageService;
2602
+ this.sfCrudService = sfCrudService;
2603
+ this.stepService = stepService;
2604
+ this.sfPdfSignService = sfPdfSignService;
2605
+ this.sfSimuladorService = sfSimuladorService;
2606
+ this.notificationService = notificationService;
2607
+ this.router = router;
2608
+ this.idKatios = '';
2609
+ this.trx = '';
2610
+ this.id = '';
2611
+ this.ids = [];
2612
+ this.sendData = new i0.EventEmitter();
2613
+ this.onSubmit = new i0.EventEmitter();
2614
+ this.subsToKillOnDestroy = [];
2615
+ this.isLocal = false;
2616
+ this.displays = [];
2617
+ this.firstLoad = true;
2618
+ this.dialogElements = [];
2619
+ this.items = [];
2620
+ this.loading = { inProgress: true, target: undefined };
2621
+ }
2622
+ Object.defineProperty(RegistroComponent.prototype, "idEntidad", {
2623
+ set: function (value) {
2624
+ this.idForm = value;
2625
+ },
2626
+ enumerable: false,
2627
+ configurable: true
2628
+ });
2629
+ RegistroComponent.prototype.ngOnChanges = function (changes) {
2630
+ if (this.idKatios && this.idForm && this.environment && (changes["idKatios"] || changes["idEntidad"])) {
2631
+ this.sfCrudService.ids = this.ids;
2632
+ this.sfCrudService.idKatios = this.idKatios;
2633
+ this.sfCrudService.environment = this.environment;
2634
+ this.generalService.idKatios = this.idKatios;
2635
+ this.generalService.environment = this.environment;
2636
+ this.sfPdfSignService.setEnviroments(this.environment);
2637
+ this.sfSimuladorService.environments = this.environment;
2638
+ this.sfSimuladorService.idKatios = this.idKatios;
2639
+ this.loadConfigCrud();
2640
+ }
2641
+ };
2642
+ RegistroComponent.prototype.ngOnInit = function () {
2643
+ var _this = this;
2644
+ this.instanceSubsStepService();
2645
+ this.notificationSubscription = this.notificationService.notificationAdded$().subscribe(function (notification) {
2646
+ var _a, _b;
2647
+ if ((_a = notification === null || notification === void 0 ? void 0 : notification.requestChecking) === null || _a === void 0 ? void 0 : _a.useSwal) {
2648
+ Swal__default["default"].fire(notification.msg).then(function (res) {
2649
+ var _a, _b;
2650
+ if (notification.msg.showCancelButton && res.isDismissed && ((_a = notification.requestChecking) === null || _a === void 0 ? void 0 : _a.cancelRedirect)) {
2651
+ if (notification.requestChecking.cancelRedirect.toUpperCase() == "INICIO")
2652
+ _this.sfCrudService.redirectToInicio();
2653
+ else
2654
+ window.location.href = notification.requestChecking.cancelRedirect;
2655
+ }
2656
+ else if (res.isConfirmed && ((_b = notification.requestChecking) === null || _b === void 0 ? void 0 : _b.redirect)) {
2657
+ if (notification.requestChecking.redirect.toUpperCase() == "INICIO")
2658
+ _this.sfCrudService.redirectToInicio();
2659
+ else
2660
+ window.location.href = notification.requestChecking.redirect;
2661
+ }
2662
+ });
2663
+ }
2664
+ else if ((notification === null || notification === void 0 ? void 0 : notification.msg) && ((_b = notification.requestChecking) === null || _b === void 0 ? void 0 : _b.redirect)) {
2665
+ _this.messageService.add(notification.msg);
2666
+ if (notification.requestChecking.redirect.toUpperCase() == "INICIO")
2667
+ _this.sfCrudService.redirectToInicio();
2668
+ else {
2669
+ var newURL = _this.sfCrudService.getURLRedirect(notification.requestChecking.redirect);
2670
+ window.location.href = newURL;
2671
+ window.location.reload();
2672
+ }
2673
+ }
2674
+ else if (notification === null || notification === void 0 ? void 0 : notification.msg) {
2675
+ _this.messageService.add(notification.msg);
2676
+ }
2677
+ });
2678
+ };
2679
+ RegistroComponent.prototype.ngOnDestroy = function () {
2680
+ if (this.notificationSubscription) {
2681
+ this.notificationSubscription.unsubscribe();
2682
+ }
2683
+ this.subsToKillOnDestroy.forEach(function (sub) { return sub.unsubscribe(); });
2684
+ this.stepService.reset();
2685
+ this.sfCrudService.reset();
2686
+ console.log("destroy");
2687
+ };
2688
+ RegistroComponent.prototype.instanceSubsStepService = function () {
2689
+ var _this = this;
2690
+ this.subsToKillOnDestroy.push(this.stepService.customChildrenEvents$.subscribe(function (event) {
2691
+ if (!event)
2692
+ return;
2693
+ switch (event.name.toUpperCase()) {
2694
+ case "ONCLICKEDEDITBUTTON":
2695
+ _this.onClickedEditButton(event.data.element, event.data.data, event.data.index);
2696
+ break;
2697
+ case "ONCLICKEDDELETEBUTTON":
2698
+ _this.deleteRow(event.data.element, event.data.index);
2699
+ break;
2700
+ case "ONCLICKEDADDBUTTON":
2701
+ _this.onClickedAddButton(event.data.element);
2702
+ break;
2703
+ }
2704
+ }));
2705
+ this.subsToKillOnDestroy.push(this.stepService.requestApproval$.subscribe(function (value) {
2706
+ console.log(value);
2707
+ if ((value === null || value === void 0 ? void 0 : value.desired) != undefined) {
2708
+ if (value.desired < value.current) {
2709
+ _this.stepService.requestApproved = true;
2710
+ _this.sfCrudService.index = _this.stepService.currentIndex;
2711
+ _this.scrollTop();
2712
+ }
2713
+ else {
2714
+ var operation = _this.sfCrudService.getRegistro(_this.indexCrud).operations.find(function (op) { return op.type.startsWith(_this.sfCrudService.getTrx(_this.indexCrud)); });
2715
+ if (!_this.validateData(operation, _this.sfCrudService.getData(_this.indexCrud), _this.sfCrudService.getRegistro(_this.indexCrud).conditions || []))
2716
+ _this.stepService.requestApproved = false;
2717
+ else if (operation.method != null)
2718
+ _this.uploadInfoStep(value);
2719
+ else if (operation.answerChecking) { //no tiene request, solo un mensaje
2720
+ _this.stepService.requestApproved = true;
2721
+ _this.loading.inProgress = false;
2722
+ _this.sfCrudService.formLoading = _this.loading;
2723
+ _this.notificationService.addNotification(_this.notificationService.generateMessage(_this.notificationService.genDefaultMessage("success", undefined, "Información subida correctamente", operation.answerChecking), {}, operation.answerChecking), operation.answerChecking);
2724
+ _this.sfCrudService.index = _this.stepService.currentIndex;
2725
+ _this.scrollTop();
2726
+ }
2727
+ else { //no tiene nada configurado
2728
+ _this.stepService.requestApproved = true;
2729
+ _this.sfCrudService.index = _this.stepService.currentIndex;
2730
+ _this.scrollTop();
2731
+ }
2732
+ }
2733
+ }
2734
+ }));
2735
+ console.log("subs step service terminadas");
2736
+ };
2737
+ RegistroComponent.prototype.uploadInfoStep = function (position) {
2738
+ var _this = this;
2739
+ this.loading.inProgress = true;
2740
+ this.sfCrudService.formLoading = this.loading;
2741
+ this.submit(position.current).then(function () {
2742
+ var _a, _b, _c;
2743
+ var 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;
2744
+ console.log(_this.items.length);
2745
+ if (_this.items.length == 1) {
2746
+ _this.stepService.requestApproved = false;
2747
+ //this.stepService.desiredIndex = undefined
2748
+ _this.sfCrudService.index = _this.stepService.currentIndex;
2749
+ }
2750
+ else if (!tieneRedirect) {
2751
+ _this.advance(position.current, position.desired, false);
2752
+ }
2753
+ _this.scrollTop();
2754
+ })
2755
+ .catch(function () {
2756
+ _this.stepService.requestApproved = false;
2757
+ }).finally(function () {
2758
+ _this.loading.inProgress = false;
2759
+ _this.sfCrudService.formLoading = _this.loading;
2760
+ });
2761
+ };
2762
+ RegistroComponent.prototype.onClickBtnSubmit = function () {
2763
+ this.stepService.requestApproval = this.indexCrud;
2764
+ };
2765
+ RegistroComponent.prototype.loadConfigCrud = function () {
2766
+ var _this = this;
2767
+ this.loading.inProgress = true;
2768
+ this.sfCrudService.formLoading = this.loading;
2769
+ this.sfCrudService.dataExt = this.dataExt;
2770
+ this.sfCrudService.crudLoaded = false;
2771
+ if (this.loadSession()) {
2772
+ this.sfCrudService.crudLoaded = true;
2773
+ return;
2774
+ }
2775
+ this.generalService.getCrudByEntidad(this.idKatios, this.idForm)
2776
+ .then(function (res) {
2777
+ console.log("crud cargado");
2778
+ _this.sfCrudService.uiEsquemas = res.uiEsquemas;
2779
+ _this.sfCrudService.esquemas = res.esquemas;
2780
+ _this.sfCrudService.registros = res.registros;
2781
+ _this.customizeCompany(res.uiEsquemas);
2782
+ _this.sfCrudService.registros.forEach(function (_, i) { return _this.sfCrudService.setTrx("c", i); });
2783
+ _this.loadData()
2784
+ .then(function () {
2785
+ _this.setLabelSumbit();
2786
+ _this.sfCrudService.dataset.forEach(function (data, i) {
2787
+ var _a;
2788
+ if (_this.activeRoute.snapshot.queryParams["_idGWVADO"] && ((_a = data.ADO) === null || _a === void 0 ? void 0 : _a.dataProceso)) {
2789
+ data.ADO.dataProceso.idProceso = _this.activeRoute.snapshot.queryParams["_idGWVADO"];
2790
+ }
2791
+ if (_this.activeRoute.snapshot.queryParams["_idADO"] && data.ADO) {
2792
+ data.ADO.idTransaction = _this.activeRoute.snapshot.queryParams["_idADO"];
2793
+ }
2794
+ _this.sfCrudService.setDataSet(data, i);
2795
+ });
2796
+ })
2797
+ .finally(function () {
2798
+ var willExecuteRequest = _this.advance(0, _this.sfCrudService.uiEsquemas.length - 1, true);
2799
+ _this.createSteps(res.uiEsquemas);
2800
+ _this.sfCrudService.crudLoaded = true;
2801
+ if (!willExecuteRequest) {
2802
+ _this.loading.inProgress = false;
2803
+ _this.sfCrudService.formLoading = _this.loading;
2804
+ }
2805
+ });
2806
+ }).catch(function (ex) {
2807
+ console.error(ex);
2808
+ _this.loading.inProgress = false;
2809
+ _this.sfCrudService.formLoading = _this.loading;
2810
+ });
2811
+ };
2812
+ /**
2813
+ * Step will advance until esquema is not completed
2814
+ */
2815
+ RegistroComponent.prototype.advance = function (start, limit, executeRequest) {
2816
+ var _this = this;
2817
+ var _a;
2818
+ console.log("advance desde ", start, " hasta ", limit);
2819
+ var i = start;
2820
+ var op;
2821
+ var willExecuteRequest = false;
2822
+ var registro;
2823
+ while (i < limit) {
2824
+ registro = this.sfCrudService.getRegistro(i);
2825
+ op = registro.operations.find(function (op) { return op.type.startsWith(_this.sfCrudService.getTrx(i)); });
2826
+ if (!this.validateData(op, this.sfCrudService.getData(i), registro.conditions || [], false))
2827
+ break;
2828
+ i++;
2829
+ }
2830
+ this.sfCrudService.index = i;
2831
+ this.stepService.currentIndex = i;
2832
+ this.stepService.desiredIndex = i;
2833
+ console.log("advance", i);
2834
+ this.stepService.requestApproved = true;
2835
+ registro = this.sfCrudService.getRegistro(i);
2836
+ var dataCurrentStep = this.sfCrudService.getData(i);
2837
+ op = this.sfCrudService.getRegistro(i).operations.find(function (op) { return op.type.startsWith(_this.sfCrudService.getTrx(i)); });
2838
+ if (executeRequest && (this.activeRoute.snapshot.queryParams["_idGWVADO"] || this.activeRoute.snapshot.queryParams["_idADO"]) //Viene de ADO
2839
+ && dataCurrentStep.ADO && this.validateData(op, dataCurrentStep, (_a = registro.conditions) !== null && _a !== void 0 ? _a : [], false) //El step esta completo
2840
+ ) {
2841
+ console.log("advance with approval", i);
2842
+ this.stepService.requestApproval = i;
2843
+ willExecuteRequest = true;
2844
+ }
2845
+ return willExecuteRequest;
2846
+ };
2847
+ RegistroComponent.prototype.loadSession = function () {
2848
+ var wasLoaded = this.sfCrudService.loadSession();
2849
+ if (wasLoaded) {
2850
+ this.customizeCompany(this.sfCrudService.uiEsquemas);
2851
+ this.stepService.currentIndex = this.sfCrudService.index;
2852
+ this.createSteps(this.sfCrudService.uiEsquemas);
2853
+ this.loading.inProgress = false;
2854
+ this.sfCrudService.formLoading = this.loading;
2855
+ }
2856
+ return wasLoaded;
2857
+ };
2858
+ RegistroComponent.prototype.customizeCompany = function (uiEsquemas) {
2859
+ var _a, _b, _c, _d, _e, _f;
2860
+ this.sfCrudService.configEmpresa = (_a = uiEsquemas.find(function (ui) { return ui.general; })) === null || _a === void 0 ? void 0 : _a.general;
2861
+ this.logo = (_c = (_b = this.sfCrudService.configEmpresa) === null || _b === void 0 ? void 0 : _b.icons) === null || _c === void 0 ? void 0 : _c.carga;
2862
+ if (this.sfCrudService.configEmpresa) {
2863
+ if ((_d = this.sfCrudService.configEmpresa.colors) === null || _d === void 0 ? void 0 : _d.main)
2864
+ this.color = this.sfCrudService.configEmpresa.colors.main;
2865
+ if ((_e = this.sfCrudService.configEmpresa.colors) === null || _e === void 0 ? void 0 : _e.secondary)
2866
+ this.color2 = this.sfCrudService.configEmpresa.colors.secondary;
2867
+ if ((_f = this.sfCrudService.configEmpresa.colors) === null || _f === void 0 ? void 0 : _f.button)
2868
+ this.colorButton = this.sfCrudService.configEmpresa.colors.button;
2869
+ }
2870
+ if (!this.colorButton)
2871
+ this.colorButton = "blue";
2872
+ if (!this.color2)
2873
+ this.color2 = "blue";
2874
+ if (!this.color)
2875
+ this.color = "blue";
2876
+ };
2877
+ RegistroComponent.prototype.scrollTop = function () {
2878
+ window.scroll({
2879
+ top: 0,
2880
+ left: 0,
2881
+ behavior: 'smooth'
2882
+ });
2883
+ };
2884
+ RegistroComponent.prototype.createSteps = function (uiEsquemas) {
2885
+ var _this = this;
2886
+ this.items = [];
2887
+ uiEsquemas.forEach(function (uiEsq, index) {
2888
+ if (uiEsq.step)
2889
+ _this.items.push({ label: uiEsq.step, routerLink: index, queryParamsHandling: "preserve" });
2890
+ else
2891
+ _this.items.push({ label: "paso " + index, routerLink: index });
2892
+ _this.sfCrudService.getRegistro(index); //ver si tiene un change
2893
+ });
2894
+ };
2895
+ /**
2896
+ * Instancia todos los esquemas, y realiza los requests para traer la data de todos los step.
2897
+ * @param esquema
2898
+ * @param registro
2899
+ * @returns
2900
+ */
2901
+ RegistroComponent.prototype.loadData = function () {
2902
+ var _this = this;
2903
+ this.sfCrudService.esquemas.forEach(function (esquema, i) {
2904
+ var op = _this.sfCrudService.registros[i].operations.find(function (x) { return x.type.startsWith(_this.sfCrudService.getTrx(i)); });
2905
+ _this.sfCrudService.setDataSet(_this.sfCrudService.createObject(esquema, op), i);
2906
+ });
2907
+ console.log("loadData");
2908
+ return Promise.all(this.sfCrudService.registros.map(function (registro, i) { return _this.ids.length > 0 ? _this.getInfoRegistro(registro, i, _this.ids[i]) : Promise.resolve(); }));
2909
+ };
2910
+ RegistroComponent.prototype.getInfoRegistro = function (configRegistro, index, id) {
2911
+ var _this = this;
2912
+ var op = configRegistro.operations.find(function (x) { return x.type == 'read'; });
2913
+ if (!op)
2914
+ return;
2915
+ var url = this.sfCrudService.getURL(op, index, id);
2916
+ return this.generalService.genericRequest(op.method, url)
2917
+ .then(function (res) {
2918
+ var value = undefined;
2919
+ if (res === null || res === void 0 ? void 0 : res.data) {
2920
+ value = Array.isArray(res.data) ? res.data[0] : res.data;
2921
+ }
2922
+ else
2923
+ value = Array.isArray(res) ? res[0] : res;
2924
+ _this.sfCrudService.applyObjectKeys(value, op.keysEsquema || [], configRegistro);
2925
+ if (op.changeTrx)
2926
+ op.changeTrx.forEach(function (x) { return _this.sfCrudService.setTrx(x.trx, x.index); });
2927
+ console.log("getInfoRegistro", op.changeTrx);
2928
+ })
2929
+ .catch(function (error) {
2930
+ console.log(error);
2931
+ var errorChecking;
2932
+ if (Array.isArray(op.errorChecking))
2933
+ errorChecking = op.errorChecking[0];
2934
+ else
2935
+ errorChecking = op.errorChecking;
2936
+ _this.notificationService.addNotification(_this.notificationService.generateMessage(_this.notificationService.genDefaultMessage("error", "Formulario no cargado correctamente", "", errorChecking), error.error, errorChecking), errorChecking);
2937
+ throw error;
2938
+ });
2939
+ };
2940
+ RegistroComponent.prototype.setDefaultValue = function (value) {
2941
+ var _a;
2942
+ var data = null;
2943
+ if (value.key && ((_a = this.sfCrudService.currentOperation) === null || _a === void 0 ? void 0 : _a.keys)) {
2944
+ data = this.sfCrudService.getValueKey(this.sfCrudService.currentOperation.keys.find(function (k) { return k.key == value.key; }));
2945
+ value = data;
2946
+ }
2947
+ else {
2948
+ switch (value) {
2949
+ case '@uactivo':
2950
+ data = this.user.UsuarioSistema.TDOC + "-" + this.user.UsuarioSistema.NDOC;
2951
+ break;
2952
+ case '@tdocactivo':
2953
+ data = this.user.UsuarioSistema.TDOC;
2954
+ break;
2955
+ case '@ndocactivo':
2956
+ data = this.user.UsuarioSistema.NDOC;
2957
+ break;
2958
+ case '@hoy':
2959
+ data = new Date();
2960
+ break;
2961
+ default:
2962
+ data = value;
2963
+ break;
2964
+ }
2965
+ return data;
2966
+ }
2967
+ };
2968
+ Object.defineProperty(RegistroComponent.prototype, "indexCrud", {
2969
+ get: function () {
2970
+ return this.stepService.currentIndex;
2971
+ },
2972
+ enumerable: false,
2973
+ configurable: true
2974
+ });
2975
+ RegistroComponent.prototype.primeChecking = function () {
2976
+ return new RequestChecking(undefined, undefined, false, undefined, undefined, false, undefined);
2977
+ };
2978
+ RegistroComponent.prototype.submit = function (index) {
2979
+ var _this = this;
2980
+ this.sfCrudService.applyValuesOnEvent('onSubmit', this.sfCrudService.getEsquema(index), undefined, this.sfCrudService.getData(index));
2981
+ var registro = this.sfCrudService.getRegistro(index);
2982
+ console.log("trx actual: ", this.sfCrudService.getTrx(this.indexCrud));
2983
+ var operation = registro.operations.find(function (op) { return op.type.startsWith(_this.sfCrudService.getTrx(_this.indexCrud)); });
2984
+ var url = this.sfCrudService.getURL(operation, index);
2985
+ return this.generalService.genericRequest(operation.method, url, this.sfCrudService.getData(index))
2986
+ .then(function (res) {
2987
+ if (res === null)
2988
+ res = {};
2989
+ res = _this.sfCrudService.applyObjectKeys(res, operation.keysEsquema || [], registro);
2990
+ _this.sfCrudService.setAnswers(res, _this.indexCrud);
2991
+ if (operation.changeTrx)
2992
+ operation.changeTrx.forEach(function (x) { return _this.sfCrudService.setTrx(x.trx, x.index); });
2993
+ _this.notificationService.addNotification(_this.notificationService.generateMessage(_this.notificationService.genDefaultMessage("success", undefined, "Información subida correctamente", operation.answerChecking), res, operation.answerChecking), operation.answerChecking);
2994
+ return res;
2995
+ })
2996
+ .catch(function (err) {
2997
+ _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);
2998
+ throw new Error(err);
2999
+ });
3000
+ // return Promise.resolve({})
3001
+ };
3002
+ RegistroComponent.prototype.onCloseAddItem = function (index) {
3003
+ var scope = this.dialogElements[index].scope.replaceAll('.properties', '');
3004
+ var item = ___namespace.cloneDeep(this.dialogElements[index].data);
3005
+ if (index == 0) {
3006
+ jsonpath__namespace.query(this.sfCrudService.getData(this.indexCrud), scope)[0].push(item);
3007
+ }
3008
+ else
3009
+ jsonpath__namespace.query(this.dialogElements[index - 1].data, scope)[0].push(item);
3010
+ };
3011
+ RegistroComponent.prototype.deleteRow = function (element, indexElement) {
3012
+ var scope = element.scope.replaceAll('.properties', '');
3013
+ var indexDialog = this.dialogElements.length - 1;
3014
+ if (indexDialog == -1)
3015
+ jsonpath__namespace.query(this.sfCrudService.getData(this.indexCrud), scope)[0].splice(indexElement, 1);
3016
+ else {
3017
+ indexDialog = indexDialog == 0 ? 1 : indexDialog;
3018
+ jsonpath__namespace.query(this.dialogElements[indexDialog - 1].data, scope)[0].splice(indexElement, 1);
3019
+ }
3020
+ this.sfCrudService.applyValuesOnEvent('onChange', this.sfCrudService.getEsquema(this.indexCrud), element.scope.replace('$..properties.', ''), this.sfCrudService.getData(this.indexCrud));
3021
+ };
3022
+ RegistroComponent.prototype.onCloseEditRow = function (index) {
3023
+ var scope = undefined;
3024
+ try {
3025
+ var iArray = this.dialogElements[index].index;
3026
+ scope = this.dialogElements[index].scope.replaceAll('.properties', '');
3027
+ var item = ___namespace.cloneDeep(this.dialogElements[index].data);
3028
+ if (index == 0) {
3029
+ jsonpath__namespace.query(this.sfCrudService.getData(this.indexCrud), scope)[0][iArray] = item;
3030
+ }
3031
+ else {
3032
+ jsonpath__namespace.query(this.dialogElements[index - 1].data, scope)[0][iArray] = item;
3033
+ }
3034
+ }
3035
+ catch (error) {
3036
+ console.error(error);
3037
+ console.log(this.dialogElements);
3038
+ console.log(index);
3039
+ console.log(scope);
3040
+ console.log(this.indexCrud);
3041
+ console.log(this.sfCrudService.getData(this.indexCrud));
3042
+ if (index == 0 && scope) {
3043
+ console.log(jsonpath__namespace.query(this.sfCrudService.getData(this.indexCrud), scope));
3044
+ }
3045
+ else if (scope) {
3046
+ console.log(jsonpath__namespace.query(this.dialogElements[index - 1].data, scope));
3047
+ }
3048
+ throw error;
3049
+ }
3050
+ };
3051
+ RegistroComponent.prototype.validateData = function (operation, data, conditions, printErrors) {
3052
+ if (printErrors === void 0) { printErrors = true; }
3053
+ var _a;
3054
+ if (((_a = operation === null || operation === void 0 ? void 0 : operation.validations) === null || _a === void 0 ? void 0 : _a.type) == 'local') {
3055
+ var err = this.sfCrudService.validateDataLocal(operation, data, conditions);
3056
+ if (err.length != 0 && printErrors)
3057
+ this.notificationService.addNotification({ severity: 'warn', detail: err.slice(0, 5).join('. ') }, this.primeChecking());
3058
+ return err.length == 0;
3059
+ }
3060
+ return true;
3061
+ };
3062
+ RegistroComponent.prototype.onConfirm = function () {
3063
+ this.messageService.clear('c');
3064
+ };
3065
+ RegistroComponent.prototype.onReject = function () {
3066
+ this.messageService.clear('c');
3067
+ };
3068
+ RegistroComponent.prototype.onClickedEditButton = function (element, data, index) {
3069
+ this.dialogOperation = "u";
3070
+ var esquema = ___namespace.cloneDeep(this.sfCrudService.getControl(element.scope, this.sfCrudService.getEsquema(this.indexCrud)));
3071
+ esquema.type = "object";
3072
+ var currentElement = {
3073
+ data: ___namespace.cloneDeep(data),
3074
+ uiEsquema: ___namespace.cloneDeep(element.elements[0]),
3075
+ esquema: esquema,
3076
+ scope: element.scope,
3077
+ index: index
3078
+ };
3079
+ this.displays.push(true);
3080
+ this.dialogElements.push(currentElement);
3081
+ };
3082
+ RegistroComponent.prototype.onClickedAddButton = function (element) {
3083
+ var _this = this;
3084
+ this.dialogOperation = "c";
3085
+ var esquema = ___namespace.cloneDeep(this.sfCrudService.getControl(element.scope, this.sfCrudService.getEsquema(this.indexCrud)));
3086
+ var op = this.sfCrudService.registros[this.indexCrud].operations.find(function (x) { return x.type.startsWith(_this.sfCrudService.getTrx(_this.indexCrud)); });
3087
+ esquema.type = "object";
3088
+ var currentElement = {
3089
+ data: this.sfCrudService.createObject(esquema, op),
3090
+ uiEsquema: ___namespace.cloneDeep(element.elements[0]),
3091
+ esquema: esquema,
3092
+ scope: element.scope,
3093
+ index: 0
3094
+ };
3095
+ try {
3096
+ currentElement.data.id = this.sfCrudService.getValue(element.scope, this.sfCrudService.getData(this.indexCrud)).length + 1;
3097
+ }
3098
+ catch (error) {
3099
+ console.log("error agregando un id");
3100
+ console.error(error);
3101
+ }
3102
+ this.displays.push(true);
3103
+ this.dialogElements.push(currentElement);
3104
+ };
3105
+ RegistroComponent.prototype.onCloseDialog = function (index) {
3106
+ var validated = true;
3107
+ if (this.dialogElements[index].esquema.validations) {
3108
+ var op = new Operation();
3109
+ op.validations = this.dialogElements[index].esquema.validations;
3110
+ validated = this.validateData(op, this.dialogElements[index].data, this.sfCrudService.getRegistro(this.indexCrud).conditions || []);
3111
+ }
3112
+ console.log(this.dialogElements[index].esquema);
3113
+ if (validated) {
3114
+ switch (this.dialogOperation) {
3115
+ case "c":
3116
+ this.onCloseAddItem(index);
3117
+ break;
3118
+ case "u":
3119
+ this.onCloseEditRow(index);
3120
+ break;
3121
+ }
3122
+ this.removeDialogItem();
3123
+ }
3124
+ };
3125
+ RegistroComponent.prototype.removeDialogItem = function () {
3126
+ this.dialogElements.pop();
3127
+ this.displays.pop();
3128
+ };
3129
+ RegistroComponent.prototype.setLabelSumbit = function () {
3130
+ var x = { "c": { label: 'Guardar', icon: 'pi pi-save' },
3131
+ "u": { label: 'Actualizar', icon: 'pi pi-sync' },
3132
+ "d": { label: 'Eliminar', icon: 'pi pi-trash' }
3133
+ };
3134
+ this.btnSubmit = x[this.sfCrudService.getTrx(0)];
3135
+ };
3136
+ RegistroComponent.prototype.back = function () {
3137
+ this.router.navigateByUrl(this.sfCrudService.registros[0].btnBack);
3138
+ };
1943
3139
  return RegistroComponent;
1944
3140
  }());
1945
- RegistroComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroComponent, deps: [{ token: GeneralService }, { token: i2__namespace.Router }, { token: i2__namespace$1.MessageService }, { token: i1__namespace$1.DialogService }, { token: SfCrudService }], target: i0__namespace.ɵɵFactoryTarget.Component });
1946
- RegistroComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: RegistroComponent, selector: "sf-registro", inputs: { idKatios: "idKatios", idEntidad: "idEntidad", trx: "trx", id: "id", user: "user", dataExt: "dataExt" }, outputs: { sendData: "sendData", onSubmit: "onSubmit" }, providers: [i2$1.MessageService, i1$1.DialogService, i1$1.DynamicDialogConfig, i1$1.DynamicDialogRef], ngImport: i0__namespace, template: "<p-blockUI [blocked]=\"enProceso\">\r\n <i class=\"pi pi-cog pi-spin\" style=\"font-size: 50px\"></i>\r\n</p-blockUI>\r\n\r\n<p-toast></p-toast>\r\n\r\n<div class=\"card\" *ngIf=\"!enProceso && controlsLoaded\">\r\n <h5 class=\"card-header mb-2\" style=\"display: flex; justify-content: space-between;align-items: center;\">\r\n <span>{{crudConfig.registro?.label || idEntidad}} {{id != '' ? '-' + id : ''}}</span>\r\n <button *ngIf=\"crudConfig.registro?.canBack\" pButton pRipple type=\"button\" icon=\"pi pi-arrow-left\" (click)=\"back()\"></button>\r\n </h5>\r\n <div *ngFor=\"let element of crudConfig.uiEsquema.elements; let i = index\" [class]=\"element?.class\">\r\n <ng-container [ngSwitch]=\"element.type\">\r\n <div *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\">\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)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\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\">\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)\" (sendObject)=\"applyValuesFromObject($event)\"></sf-control>\r\n <ng-container *ngSwitchCase=\"'Table'\">\r\n <p-table [value]=\"getValue(el.scope)\" [columns]=\"getControl(el.scope).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\"></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 *ngIf=\"trx == 'c' || trx == 'u'\">\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=\"'text'\">\r\n <td>{{rowData[col.col]}}</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 *ngIf=\"trx == 'c' || trx == 'u'\">\r\n <td>\r\n <button pButton pRipple type=\"button\" (click)=\"editRow(el, rowData, rowIndex)\" icon=\"pi pi-pencil\" class=\"p-button-rounded p-button-info mr-1\"></button>\r\n <button pButton pRipple type=\"button\" (click)=\"deleteRow(el, rowIndex)\" 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 *ngSwitchCase=\"'Control'\">\r\n <sf-control [control]=\"getControl(element.scope)\" [label]=\"element.label\"></sf-control>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n <div class=\"card-footer mt-2\" *ngIf=\"btnSubmit\">\r\n <button pButton pRipple type=\"button\" [icon]=\"btnSubmit.icon\" [label]=\"btnSubmit.label\"\r\n (click)=\"submit()\"></button>\r\n </div>\r\n</div>\r\n", components: [{ type: i3__namespace.BlockUI, selector: "p-blockUI", inputs: ["target", "autoZIndex", "baseZIndex", "styleClass", "blocked"] }, { type: i3__namespace$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { type: ControlComponent, selector: "sf-control", inputs: ["control", "label", "value", "appendTo"], outputs: ["setValue", "sendNotification", "sendObject"] }, { type: i5__namespace.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"] }], directives: [{ type: i7__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i10__namespace.Ripple, selector: "[pRipple]" }, { type: i7__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i7__namespace.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { type: i7__namespace.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { type: i2__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }], pipes: { "currency": i7__namespace.CurrencyPipe, "date": i7__namespace.DatePipe } });
3141
+ RegistroComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroComponent, deps: [{ token: GeneralService }, { token: i2__namespace.ActivatedRoute }, { token: i1__namespace$1.MessageService }, { token: SfCrudService }, { token: StepService }, { token: i6__namespace$2.SfPdfsignService }, { token: i7__namespace$1.SfSimuladorService }, { token: NotificationService }, { token: i2__namespace.Router }], target: i0__namespace.ɵɵFactoryTarget.Component });
3142
+ RegistroComponent.ɵcmp = i0__namespace.ɵɵ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: [i1$1.MessageService], usesOnChanges: true, ngImport: i0__namespace, 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]\"></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"] }, { type: i11__namespace$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__namespace.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass"], outputs: ["onClick", "onFocus", "onBlur"] }, { type: i11__namespace$2.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }], directives: [{ type: i12__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9__namespace.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { type: i11__namespace.Ripple, selector: "[pRipple]" }, { type: i12__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i12__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i1__namespace$1.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { type: i12__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
1947
3143
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RegistroComponent, decorators: [{
1948
3144
  type: i0.Component,
1949
3145
  args: [{
1950
3146
  selector: 'sf-registro',
1951
3147
  templateUrl: './registro.component.html',
1952
- providers: [i2$1.MessageService, i1$1.DialogService, i1$1.DynamicDialogConfig, i1$1.DynamicDialogRef],
1953
- entryComponents: [RegistroComponent]
3148
+ providers: [i1$1.MessageService],
3149
+ entryComponents: [RegistroComponent],
3150
+ styleUrls: ['./registro.component.css']
1954
3151
  }]
1955
- }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2__namespace.Router }, { type: i2__namespace$1.MessageService }, { type: i1__namespace$1.DialogService }, { type: SfCrudService }]; }, propDecorators: { idKatios: [{
1956
- type: i0.Input
1957
- }], idEntidad: [{
3152
+ }], ctorParameters: function () { return [{ type: GeneralService }, { type: i2__namespace.ActivatedRoute }, { type: i1__namespace$1.MessageService }, { type: SfCrudService }, { type: StepService }, { type: i6__namespace$2.SfPdfsignService }, { type: i7__namespace$1.SfSimuladorService }, { type: NotificationService }, { type: i2__namespace.Router }]; }, propDecorators: { color: [{
3153
+ type: i0.HostBinding,
3154
+ args: ["style.--primary-color"]
3155
+ }], color2: [{
3156
+ type: i0.HostBinding,
3157
+ args: ["style.--secondary-color"]
3158
+ }], colorButton: [{
3159
+ type: i0.HostBinding,
3160
+ args: ["style.--button-color"]
3161
+ }], idKatios: [{
1958
3162
  type: i0.Input
1959
3163
  }], trx: [{
1960
3164
  type: i0.Input
@@ -1964,10 +3168,18 @@
1964
3168
  type: i0.Input
1965
3169
  }], dataExt: [{
1966
3170
  type: i0.Input
3171
+ }], ids: [{
3172
+ type: i0.Input
3173
+ }], environment: [{
3174
+ type: i0.Input
3175
+ }], buttonsFooterTemplate: [{
3176
+ type: i0.Input
1967
3177
  }], sendData: [{
1968
3178
  type: i0.Output
1969
3179
  }], onSubmit: [{
1970
3180
  type: i0.Output
3181
+ }], idEntidad: [{
3182
+ type: i0.Input
1971
3183
  }] } });
1972
3184
 
1973
3185
  var SfCrudComponent = /** @class */ (function () {
@@ -1988,6 +3200,27 @@
1988
3200
  }]
1989
3201
  }], ctorParameters: function () { return []; } });
1990
3202
 
3203
+ var routes = [
3204
+ { path: ':idStep',
3205
+ component: FormComponent
3206
+ }
3207
+ ];
3208
+ var SfCrudRoutingModule = /** @class */ (function () {
3209
+ function SfCrudRoutingModule() {
3210
+ }
3211
+ return SfCrudRoutingModule;
3212
+ }());
3213
+ SfCrudRoutingModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudRoutingModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
3214
+ SfCrudRoutingModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudRoutingModule, imports: [i2__namespace.RouterModule], exports: [i2.RouterModule] });
3215
+ SfCrudRoutingModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudRoutingModule, imports: [[i2.RouterModule.forChild(routes)], i2.RouterModule] });
3216
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudRoutingModule, decorators: [{
3217
+ type: i0.NgModule,
3218
+ args: [{
3219
+ imports: [i2.RouterModule.forChild(routes)],
3220
+ exports: [i2.RouterModule]
3221
+ }]
3222
+ }] });
3223
+
1991
3224
  var SfCrudModule = /** @class */ (function () {
1992
3225
  function SfCrudModule() {
1993
3226
  }
@@ -1998,16 +3231,20 @@
1998
3231
  TableroComponent,
1999
3232
  RegistroComponent,
2000
3233
  ControlComponent,
2001
- RegistroChildComponent,
2002
- RegistroDetalleComponent], imports: [accordion.AccordionModule,
2003
- i4$1.AutoCompleteModule,
3234
+ StepComponent,
3235
+ FormComponent,
3236
+ FileUploadComponent], imports: [SfCrudRoutingModule,
3237
+ i6$2.SfPdfsignModule,
3238
+ i7$1.SfSimuladorModule,
3239
+ accordion.AccordionModule,
3240
+ i6$1.AutoCompleteModule,
2004
3241
  avatargroup.AvatarGroupModule,
2005
3242
  avatar.AvatarModule,
2006
3243
  badge.BadgeModule,
2007
- i3.BlockUIModule,
3244
+ blockui.BlockUIModule,
2008
3245
  breadcrumb.BreadcrumbModule,
2009
3246
  i9.ButtonModule,
2010
- i5$1.CalendarModule,
3247
+ i8.CalendarModule,
2011
3248
  card.CardModule,
2012
3249
  carousel.CarouselModule,
2013
3250
  cascadeselect.CascadeSelectModule,
@@ -2018,29 +3255,28 @@
2018
3255
  confirmdialog.ConfirmDialogModule,
2019
3256
  confirmpopup.ConfirmPopupModule,
2020
3257
  contextmenu.ContextMenuModule,
2021
- dialog.DialogModule,
3258
+ i11$3.DialogModule,
2022
3259
  divider.DividerModule,
2023
- i3$1.DropdownModule,
2024
- i1$1.DynamicDialogModule,
3260
+ i5$1.DropdownModule,
3261
+ dynamicdialog.DynamicDialogModule,
2025
3262
  fieldset.FieldsetModule,
2026
- i7$1.FileUploadModule,
2027
- i10$1.FormsModule,
3263
+ fileupload.FileUploadModule,
3264
+ i14.FormsModule,
2028
3265
  galleria.GalleriaModule,
2029
3266
  i1.HttpClientModule,
2030
3267
  inplace.InplaceModule,
2031
- i2$2.InputMaskModule,
2032
- i6$1.InputNumberModule,
2033
- i8.InputSwitchModule,
2034
- i12.InputTextareaModule,
2035
- i11.InputTextModule,
3268
+ i4.InputMaskModule,
3269
+ i9$1.InputNumberModule,
3270
+ i11$1.InputSwitchModule,
3271
+ i16.InputTextareaModule,
3272
+ i12$1.InputTextModule,
2036
3273
  knob.KnobModule,
2037
3274
  listbox.ListboxModule,
2038
3275
  megamenu.MegaMenuModule,
2039
3276
  menubar.MenubarModule,
2040
3277
  menu.MenuModule,
2041
3278
  message.MessageModule,
2042
- messages.MessagesModule,
2043
- multiselect.MultiSelectModule,
3279
+ i10.MultiSelectModule,
2044
3280
  organizationchart.OrganizationChartModule,
2045
3281
  overlaypanel.OverlayPanelModule,
2046
3282
  panelmenu.PanelMenuModule,
@@ -2049,7 +3285,7 @@
2049
3285
  progressbar.ProgressBarModule,
2050
3286
  radiobutton.RadioButtonModule,
2051
3287
  rating.RatingModule,
2052
- i10.RippleModule,
3288
+ i11.RippleModule,
2053
3289
  scrollpanel.ScrollPanelModule,
2054
3290
  scrolltop.ScrollTopModule,
2055
3291
  selectbutton.SelectButtonModule,
@@ -2057,34 +3293,38 @@
2057
3293
  skeleton.SkeletonModule,
2058
3294
  slidemenu.SlideMenuModule,
2059
3295
  slider.SliderModule,
2060
- i6.SplitButtonModule,
3296
+ i7.SplitButtonModule,
2061
3297
  splitter.SplitterModule,
2062
- steps.StepsModule,
2063
- i5.TableModule,
3298
+ i3.StepsModule,
3299
+ i6.TableModule,
2064
3300
  tabmenu.TabMenuModule,
2065
3301
  tabview.TabViewModule,
2066
3302
  tag.TagModule,
2067
3303
  terminal.TerminalModule,
2068
3304
  tieredmenu.TieredMenuModule,
2069
3305
  timeline.TimelineModule,
2070
- i3$2.ToastModule,
3306
+ i11$2.ToastModule,
2071
3307
  togglebutton.ToggleButtonModule,
2072
- i4.ToolbarModule,
2073
- tooltip.TooltipModule,
2074
- tree.TreeModule], exports: [SfCrudComponent,
3308
+ i5.ToolbarModule,
3309
+ i13.TooltipModule,
3310
+ tree.TreeModule,
3311
+ i5$2.SfAdoModule], exports: [SfCrudComponent,
2075
3312
  TableroComponent,
2076
3313
  RegistroComponent,
2077
3314
  ControlComponent] });
2078
3315
  SfCrudModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudModule, imports: [[
3316
+ SfCrudRoutingModule,
3317
+ i6$2.SfPdfsignModule,
3318
+ i7$1.SfSimuladorModule,
2079
3319
  accordion.AccordionModule,
2080
- i4$1.AutoCompleteModule,
3320
+ i6$1.AutoCompleteModule,
2081
3321
  avatargroup.AvatarGroupModule,
2082
3322
  avatar.AvatarModule,
2083
3323
  badge.BadgeModule,
2084
- i3.BlockUIModule,
3324
+ blockui.BlockUIModule,
2085
3325
  breadcrumb.BreadcrumbModule,
2086
3326
  i9.ButtonModule,
2087
- i5$1.CalendarModule,
3327
+ i8.CalendarModule,
2088
3328
  card.CardModule,
2089
3329
  carousel.CarouselModule,
2090
3330
  cascadeselect.CascadeSelectModule,
@@ -2095,29 +3335,28 @@
2095
3335
  confirmdialog.ConfirmDialogModule,
2096
3336
  confirmpopup.ConfirmPopupModule,
2097
3337
  contextmenu.ContextMenuModule,
2098
- dialog.DialogModule,
3338
+ i11$3.DialogModule,
2099
3339
  divider.DividerModule,
2100
- i3$1.DropdownModule,
2101
- i1$1.DynamicDialogModule,
3340
+ i5$1.DropdownModule,
3341
+ dynamicdialog.DynamicDialogModule,
2102
3342
  fieldset.FieldsetModule,
2103
- i7$1.FileUploadModule,
2104
- i10$1.FormsModule,
3343
+ fileupload.FileUploadModule,
3344
+ i14.FormsModule,
2105
3345
  galleria.GalleriaModule,
2106
3346
  i1.HttpClientModule,
2107
3347
  inplace.InplaceModule,
2108
- i2$2.InputMaskModule,
2109
- i6$1.InputNumberModule,
2110
- i8.InputSwitchModule,
2111
- i12.InputTextareaModule,
2112
- i11.InputTextModule,
3348
+ i4.InputMaskModule,
3349
+ i9$1.InputNumberModule,
3350
+ i11$1.InputSwitchModule,
3351
+ i16.InputTextareaModule,
3352
+ i12$1.InputTextModule,
2113
3353
  knob.KnobModule,
2114
3354
  listbox.ListboxModule,
2115
3355
  megamenu.MegaMenuModule,
2116
3356
  menubar.MenubarModule,
2117
3357
  menu.MenuModule,
2118
3358
  message.MessageModule,
2119
- messages.MessagesModule,
2120
- multiselect.MultiSelectModule,
3359
+ i10.MultiSelectModule,
2121
3360
  organizationchart.OrganizationChartModule,
2122
3361
  overlaypanel.OverlayPanelModule,
2123
3362
  panelmenu.PanelMenuModule,
@@ -2126,7 +3365,7 @@
2126
3365
  progressbar.ProgressBarModule,
2127
3366
  radiobutton.RadioButtonModule,
2128
3367
  rating.RatingModule,
2129
- i10.RippleModule,
3368
+ i11.RippleModule,
2130
3369
  scrollpanel.ScrollPanelModule,
2131
3370
  scrolltop.ScrollTopModule,
2132
3371
  selectbutton.SelectButtonModule,
@@ -2134,21 +3373,22 @@
2134
3373
  skeleton.SkeletonModule,
2135
3374
  slidemenu.SlideMenuModule,
2136
3375
  slider.SliderModule,
2137
- i6.SplitButtonModule,
3376
+ i7.SplitButtonModule,
2138
3377
  splitter.SplitterModule,
2139
- steps.StepsModule,
2140
- i5.TableModule,
3378
+ i3.StepsModule,
3379
+ i6.TableModule,
2141
3380
  tabmenu.TabMenuModule,
2142
3381
  tabview.TabViewModule,
2143
3382
  tag.TagModule,
2144
3383
  terminal.TerminalModule,
2145
3384
  tieredmenu.TieredMenuModule,
2146
3385
  timeline.TimelineModule,
2147
- i3$2.ToastModule,
3386
+ i11$2.ToastModule,
2148
3387
  togglebutton.ToggleButtonModule,
2149
- i4.ToolbarModule,
2150
- tooltip.TooltipModule,
3388
+ i5.ToolbarModule,
3389
+ i13.TooltipModule,
2151
3390
  tree.TreeModule,
3391
+ i5$2.SfAdoModule
2152
3392
  ]] });
2153
3393
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SfCrudModule, decorators: [{
2154
3394
  type: i0.NgModule,
@@ -2158,19 +3398,23 @@
2158
3398
  TableroComponent,
2159
3399
  RegistroComponent,
2160
3400
  ControlComponent,
2161
- RegistroChildComponent,
2162
- RegistroDetalleComponent
3401
+ StepComponent,
3402
+ FormComponent,
3403
+ FileUploadComponent
2163
3404
  ],
2164
3405
  imports: [
3406
+ SfCrudRoutingModule,
3407
+ i6$2.SfPdfsignModule,
3408
+ i7$1.SfSimuladorModule,
2165
3409
  accordion.AccordionModule,
2166
- i4$1.AutoCompleteModule,
3410
+ i6$1.AutoCompleteModule,
2167
3411
  avatargroup.AvatarGroupModule,
2168
3412
  avatar.AvatarModule,
2169
3413
  badge.BadgeModule,
2170
- i3.BlockUIModule,
3414
+ blockui.BlockUIModule,
2171
3415
  breadcrumb.BreadcrumbModule,
2172
3416
  i9.ButtonModule,
2173
- i5$1.CalendarModule,
3417
+ i8.CalendarModule,
2174
3418
  card.CardModule,
2175
3419
  carousel.CarouselModule,
2176
3420
  cascadeselect.CascadeSelectModule,
@@ -2181,29 +3425,28 @@
2181
3425
  confirmdialog.ConfirmDialogModule,
2182
3426
  confirmpopup.ConfirmPopupModule,
2183
3427
  contextmenu.ContextMenuModule,
2184
- dialog.DialogModule,
3428
+ i11$3.DialogModule,
2185
3429
  divider.DividerModule,
2186
- i3$1.DropdownModule,
2187
- i1$1.DynamicDialogModule,
3430
+ i5$1.DropdownModule,
3431
+ dynamicdialog.DynamicDialogModule,
2188
3432
  fieldset.FieldsetModule,
2189
- i7$1.FileUploadModule,
2190
- i10$1.FormsModule,
3433
+ fileupload.FileUploadModule,
3434
+ i14.FormsModule,
2191
3435
  galleria.GalleriaModule,
2192
3436
  i1.HttpClientModule,
2193
3437
  inplace.InplaceModule,
2194
- i2$2.InputMaskModule,
2195
- i6$1.InputNumberModule,
2196
- i8.InputSwitchModule,
2197
- i12.InputTextareaModule,
2198
- i11.InputTextModule,
3438
+ i4.InputMaskModule,
3439
+ i9$1.InputNumberModule,
3440
+ i11$1.InputSwitchModule,
3441
+ i16.InputTextareaModule,
3442
+ i12$1.InputTextModule,
2199
3443
  knob.KnobModule,
2200
3444
  listbox.ListboxModule,
2201
3445
  megamenu.MegaMenuModule,
2202
3446
  menubar.MenubarModule,
2203
3447
  menu.MenuModule,
2204
3448
  message.MessageModule,
2205
- messages.MessagesModule,
2206
- multiselect.MultiSelectModule,
3449
+ i10.MultiSelectModule,
2207
3450
  organizationchart.OrganizationChartModule,
2208
3451
  overlaypanel.OverlayPanelModule,
2209
3452
  panelmenu.PanelMenuModule,
@@ -2212,7 +3455,7 @@
2212
3455
  progressbar.ProgressBarModule,
2213
3456
  radiobutton.RadioButtonModule,
2214
3457
  rating.RatingModule,
2215
- i10.RippleModule,
3458
+ i11.RippleModule,
2216
3459
  scrollpanel.ScrollPanelModule,
2217
3460
  scrolltop.ScrollTopModule,
2218
3461
  selectbutton.SelectButtonModule,
@@ -2220,30 +3463,28 @@
2220
3463
  skeleton.SkeletonModule,
2221
3464
  slidemenu.SlideMenuModule,
2222
3465
  slider.SliderModule,
2223
- i6.SplitButtonModule,
3466
+ i7.SplitButtonModule,
2224
3467
  splitter.SplitterModule,
2225
- steps.StepsModule,
2226
- i5.TableModule,
3468
+ i3.StepsModule,
3469
+ i6.TableModule,
2227
3470
  tabmenu.TabMenuModule,
2228
3471
  tabview.TabViewModule,
2229
3472
  tag.TagModule,
2230
3473
  terminal.TerminalModule,
2231
3474
  tieredmenu.TieredMenuModule,
2232
3475
  timeline.TimelineModule,
2233
- i3$2.ToastModule,
3476
+ i11$2.ToastModule,
2234
3477
  togglebutton.ToggleButtonModule,
2235
- i4.ToolbarModule,
2236
- tooltip.TooltipModule,
3478
+ i5.ToolbarModule,
3479
+ i13.TooltipModule,
2237
3480
  tree.TreeModule,
3481
+ i5$2.SfAdoModule
2238
3482
  ],
2239
3483
  exports: [
2240
3484
  SfCrudComponent,
2241
3485
  TableroComponent,
2242
3486
  RegistroComponent,
2243
3487
  ControlComponent
2244
- ],
2245
- entryComponents: [
2246
- RegistroChildComponent
2247
3488
  ]
2248
3489
  }]
2249
3490
  }] });
@@ -2256,12 +3497,28 @@
2256
3497
  * Generated bundle index. Do not edit.
2257
3498
  */
2258
3499
 
3500
+ exports.ChangeData = ChangeData;
3501
+ exports.ConfigRegistro = ConfigRegistro;
3502
+ exports.ConfigTablero = ConfigTablero;
3503
+ exports.ConstructionId = ConstructionId;
2259
3504
  exports.ControlComponent = ControlComponent;
3505
+ exports.CrudConfig = CrudConfig;
3506
+ exports.FormComponent = FormComponent;
3507
+ exports.Key = Key;
3508
+ exports.Notification = Notification;
3509
+ exports.NotificationService = NotificationService;
3510
+ exports.Operation = Operation;
3511
+ exports.OverrideConfig = OverrideConfig;
2260
3512
  exports.RegistroComponent = RegistroComponent;
3513
+ exports.RequestChecking = RequestChecking;
2261
3514
  exports.SfCrudComponent = SfCrudComponent;
2262
3515
  exports.SfCrudModule = SfCrudModule;
2263
3516
  exports.SfCrudService = SfCrudService;
3517
+ exports.Shema = Shema;
3518
+ exports.StepService = StepService;
2264
3519
  exports.TableroComponent = TableroComponent;
3520
+ exports.Validations = Validations;
3521
+ exports.keyEsquema = keyEsquema;
2265
3522
 
2266
3523
  Object.defineProperty(exports, '__esModule', { value: true });
2267
3524