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