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