form-aurora-stefanini 0.1.10 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +133 -133
  2. package/bundles/form-aurora-stefanini.umd.js +1078 -954
  3. package/bundles/form-aurora-stefanini.umd.js.map +1 -1
  4. package/bundles/form-aurora-stefanini.umd.min.js +2 -2
  5. package/bundles/form-aurora-stefanini.umd.min.js.map +1 -1
  6. package/esm2015/form-aurora-stefanini.js +4 -4
  7. package/esm2015/lib/Components/from-aurora/form-aurora.component.js +685 -685
  8. package/esm2015/lib/Models/company-parameters.js +7 -7
  9. package/esm2015/lib/Models/company.js +1 -1
  10. package/esm2015/lib/Models/fill.js +3 -3
  11. package/esm2015/lib/Models/state.js +1 -1
  12. package/esm2015/lib/Models/step.js +1 -1
  13. package/esm2015/lib/Models/stepMethod.js +3 -3
  14. package/esm2015/lib/form-aurora.module.js +22 -22
  15. package/esm2015/lib/services/TemplateService.js +85 -85
  16. package/esm2015/lib/services/data.service.js +90 -82
  17. package/esm2015/lib/utils/Offusqued.js +120 -0
  18. package/esm2015/lib/utils/regex.js +52 -52
  19. package/esm2015/public-api.js +10 -10
  20. package/esm5/form-aurora-stefanini.js +4 -4
  21. package/esm5/lib/Components/from-aurora/form-aurora.component.js +732 -732
  22. package/esm5/lib/Models/company-parameters.js +19 -19
  23. package/esm5/lib/Models/company.js +1 -1
  24. package/esm5/lib/Models/fill.js +7 -7
  25. package/esm5/lib/Models/state.js +1 -1
  26. package/esm5/lib/Models/step.js +1 -1
  27. package/esm5/lib/Models/stepMethod.js +7 -7
  28. package/esm5/lib/form-aurora.module.js +25 -25
  29. package/esm5/lib/services/TemplateService.js +97 -97
  30. package/esm5/lib/services/data.service.js +93 -85
  31. package/esm5/lib/utils/Offusqued.js +121 -0
  32. package/esm5/lib/utils/regex.js +52 -52
  33. package/esm5/public-api.js +10 -10
  34. package/fesm2015/form-aurora-stefanini.js +1013 -890
  35. package/fesm2015/form-aurora-stefanini.js.map +1 -1
  36. package/fesm5/form-aurora-stefanini.js +1082 -958
  37. package/fesm5/form-aurora-stefanini.js.map +1 -1
  38. package/form-aurora-stefanini.d.ts +4 -4
  39. package/form-aurora-stefanini.metadata.json +1 -1
  40. package/lib/Components/from-aurora/form-aurora.component.d.ts +108 -108
  41. package/lib/Models/company-parameters.d.ts +14 -14
  42. package/lib/Models/company.d.ts +22 -22
  43. package/lib/Models/fill.d.ts +6 -6
  44. package/lib/Models/state.d.ts +5 -5
  45. package/lib/Models/step.d.ts +14 -14
  46. package/lib/Models/stepMethod.d.ts +8 -8
  47. package/lib/form-aurora.module.d.ts +2 -2
  48. package/lib/services/TemplateService.d.ts +8 -8
  49. package/lib/services/data.service.d.ts +35 -35
  50. package/lib/utils/Offusqued.d.ts +7 -0
  51. package/lib/utils/regex.d.ts +51 -51
  52. package/package.json +1 -1
  53. package/public-api.d.ts +6 -6
@@ -223,970 +223,1094 @@
223
223
  return value;
224
224
  }
225
225
 
226
- var regexType = {
227
- default: {
228
- exp: '^[a-zA-Z0-9ñÑáéíóúüÁÉÍÓÚÜ,.\\-_\\s]*$',
229
- message: 'Formato inválido, no use caracteres especiales'
230
- },
231
- word: {
232
- exp: '^[a-zA-Z0-9ñÑáéíóúüÁÉÍÓÚÜ,.\\-_]*$',
233
- message: 'Formato inválido, no use caracteres especiales ni espacios'
234
- },
235
- name: {
236
- exp: '^[a-zA-ZñÑáéíóúüÁÉÍÓÚÜ\\s]*$',
237
- message: 'Formato inválido, no use caracteres especiales ni números'
238
- },
239
- alphanumberWord: {
240
- exp: '^[a-zA-Z0-9]*$',
241
- message: 'Formato alfanúmerico inválido'
242
- },
243
- charWord: {
244
- exp: '^[a-zA-Z]*$',
245
- message: 'Formato de caracteres inválido'
246
- },
247
- anyWord: {
248
- exp: '^\\S*$',
249
- message: 'Formato inválido'
250
- },
251
- percent: {
252
- exp: '^100$|^[0-9]{1,2}$|^[0-9]{1,2}\\.[0-9]{1,2}$',
253
- message: 'Formato de porcentaje inválido, use el punto decimal (.)'
254
- },
255
- email: {
256
- exp: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
257
- message: 'Formato de e-mail inválido'
258
- },
259
- number: {
260
- exp: '^[0-9]*$',
261
- message: 'Formato de número inválido'
262
- },
263
- time24: {
264
- exp: '^([01]?[0-9]|2[0-3]):[0-5][0-9]$',
265
- message: 'Formato de hora militar inválido, use 23:45'
266
- },
267
- date: {
268
- exp: '^[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}$',
269
- message: 'Formato de fecha inválido',
270
- internal: 'dd/mm/yyyy'
271
- },
272
- password: {
273
- exp: '^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$',
274
- message: 'La contraseña debe incluir una longitud mínima de 8 caracteres, una letra mayúscula, una letra minúscula, un número, un carácter especial (@#$%^&+=/.) y no debe tener espacios.'
275
- }
226
+ var regexType = {
227
+ default: {
228
+ exp: '^[a-zA-Z0-9ñÑáéíóúüÁÉÍÓÚÜ,.\\-_\\s]*$',
229
+ message: 'Formato inválido, no use caracteres especiales'
230
+ },
231
+ word: {
232
+ exp: '^[a-zA-Z0-9ñÑáéíóúüÁÉÍÓÚÜ,.\\-_]*$',
233
+ message: 'Formato inválido, no use caracteres especiales ni espacios'
234
+ },
235
+ name: {
236
+ exp: '^[a-zA-ZñÑáéíóúüÁÉÍÓÚÜ\\s]*$',
237
+ message: 'Formato inválido, no use caracteres especiales ni números'
238
+ },
239
+ alphanumberWord: {
240
+ exp: '^[a-zA-Z0-9]*$',
241
+ message: 'Formato alfanúmerico inválido'
242
+ },
243
+ charWord: {
244
+ exp: '^[a-zA-Z]*$',
245
+ message: 'Formato de caracteres inválido'
246
+ },
247
+ anyWord: {
248
+ exp: '^\\S*$',
249
+ message: 'Formato inválido'
250
+ },
251
+ percent: {
252
+ exp: '^100$|^[0-9]{1,2}$|^[0-9]{1,2}\\.[0-9]{1,2}$',
253
+ message: 'Formato de porcentaje inválido, use el punto decimal (.)'
254
+ },
255
+ email: {
256
+ exp: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
257
+ message: 'Formato de e-mail inválido'
258
+ },
259
+ number: {
260
+ exp: '^[0-9]*$',
261
+ message: 'Formato de número inválido'
262
+ },
263
+ time24: {
264
+ exp: '^([01]?[0-9]|2[0-3]):[0-5][0-9]$',
265
+ message: 'Formato de hora militar inválido, use 23:45'
266
+ },
267
+ date: {
268
+ exp: '^[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}$',
269
+ message: 'Formato de fecha inválido',
270
+ internal: 'dd/mm/yyyy'
271
+ },
272
+ password: {
273
+ exp: '^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$',
274
+ message: 'La contraseña debe incluir una longitud mínima de 8 caracteres, una letra mayúscula, una letra minúscula, un número, un carácter especial (@#$%^&+=/.) y no debe tener espacios.'
275
+ }
276
276
  };
277
277
 
278
- var CommonDataService = /** @class */ (function () {
279
- function CommonDataService() {
280
- }
281
- CommonDataService_1 = CommonDataService;
282
- CommonDataService.prototype.getData = function () {
283
- if (localStorage.getItem("data") != null) {
284
- var data = new Map(JSON.parse(localStorage.getItem("data")));
285
- return data;
286
- }
287
- else {
288
- /** Error get cookie */
289
- }
290
- };
291
- CommonDataService.prototype.setData = function (data) {
292
- localStorage.setItem("data", JSON.stringify(Array.from(data.entries())));
293
- };
294
- CommonDataService.prototype.initData = function () {
295
- this.setData(new Map());
296
- };
297
- CommonDataService.prototype.putValue = function (key, value) {
298
- var data = this.getData();
299
- data = data.set(key, value);
300
- this.setData(data);
301
- };
302
- CommonDataService.prototype.addValue = function (keyPrimary, keySecond, value) {
303
- var data = this.getValue(keyPrimary);
304
- var dataReturn = this.getData();
305
- data[keySecond] = value;
306
- dataReturn = dataReturn.set(keyPrimary, data);
307
- this.setData(dataReturn);
308
- };
309
- CommonDataService.prototype.getValue = function (key) {
310
- return !this.getData() || !this.getData().has(key) ? undefined : this.getData().get(key);
311
- };
312
- CommonDataService.prototype.hasValue = function (key) {
313
- return this.getData() != undefined ? this.getData().has(key) : null;
314
- };
315
- CommonDataService.prototype.clearMap = function () {
316
- if (this.hasValue(CommonDataService_1.COMPANY_KEY)) {
317
- var company = this.getValue(CommonDataService_1.COMPANY_KEY);
318
- this.initData();
319
- this.putValue(CommonDataService_1.COMPANY_KEY, company);
320
- }
321
- else {
322
- this.initData();
323
- }
324
- };
325
- var CommonDataService_1;
326
- CommonDataService.COMPANY_KEY = "company";
327
- CommonDataService.DOC_NUMBER_KEY = "docNumber";
328
- CommonDataService.DOC_TYPE_KEY = "docType";
329
- CommonDataService.PHONE_KEY = "phone";
330
- CommonDataService.TYPE_ATTENTION_KEY = "typeAttention";
331
- CommonDataService.OFFICE_KEY = "office";
332
- CommonDataService.TYPE_TURN_KEY = "typeTurn";
333
- CommonDataService.SERVICE_KEY = "service";
334
- CommonDataService.TURN_KEY = "turn";
335
- CommonDataService.PROGRAMED_TURN_KEY = "programedTurn";
336
- CommonDataService.REQUEST_CALL = "requestCall";
337
- CommonDataService.FORM_DATA = "formdata";
338
- CommonDataService.TEMPLATE = "template";
339
- CommonDataService.TURN_RESCHEDULE = "turnReschedule";
340
- CommonDataService.USER_GENDER = "genderUser";
341
- CommonDataService.AUTO_REDIRECT = "autoRedirect";
342
- CommonDataService.SCHEDULE_GENERAL = "scheduleGeneral";
343
- CommonDataService.AGENDAMIENTO_TTP = "potencialCustomer";
344
- CommonDataService.SINGLE_PAGE_ONE = "singlePageOne";
345
- CommonDataService.AVAILABLE_SCHEDULE_GRAL = "availableScheduleGral";
346
- CommonDataService.PROFILE = "profile";
347
- CommonDataService.PAGE_NEXT = "pageNext";
348
- CommonDataService.STEPS = "steps";
349
- CommonDataService.TYPE_TURN_ID = "typeTurnId";
350
- CommonDataService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function CommonDataService_Factory() { return new CommonDataService(); }, token: CommonDataService, providedIn: "root" });
351
- CommonDataService = CommonDataService_1 = __decorate([
352
- core.Injectable({
353
- providedIn: "root",
354
- })
355
- ], CommonDataService);
356
- return CommonDataService;
278
+ var Offusqued = /** @class */ (function () {
279
+ function Offusqued() {
280
+ this.dataMap = new Map();
281
+ this.dataMap.set('A', '2,');
282
+ this.dataMap.set('J', '29,');
283
+ this.dataMap.set('S', '67,');
284
+ this.dataMap.set('B', '3,');
285
+ this.dataMap.set('K', '31,');
286
+ this.dataMap.set('T', '71,');
287
+ this.dataMap.set('C', '5,');
288
+ this.dataMap.set('L', '37,');
289
+ this.dataMap.set('U', '73,');
290
+ this.dataMap.set('D', '7,');
291
+ this.dataMap.set('M', '41,');
292
+ this.dataMap.set('V', '79,');
293
+ this.dataMap.set('E', '11,');
294
+ this.dataMap.set('N', '43,');
295
+ this.dataMap.set('W', '83,');
296
+ this.dataMap.set('F', '13,');
297
+ this.dataMap.set('O', '47,');
298
+ this.dataMap.set('X', '89,');
299
+ this.dataMap.set('G', '17,');
300
+ this.dataMap.set('P', '53,');
301
+ this.dataMap.set('Y', '97,');
302
+ this.dataMap.set('H', '19,');
303
+ this.dataMap.set('Q', '59,');
304
+ this.dataMap.set('Z', '101,');
305
+ this.dataMap.set('I', '23,');
306
+ this.dataMap.set('R', '61,');
307
+ this.dataMap.set('a', '103,');
308
+ this.dataMap.set('j', '151,');
309
+ this.dataMap.set('s', '157,');
310
+ this.dataMap.set('b', '107,');
311
+ this.dataMap.set('k', '163,');
312
+ this.dataMap.set('t', '167,');
313
+ this.dataMap.set('c', '109,');
314
+ this.dataMap.set('l', '173,');
315
+ this.dataMap.set('u', '179,');
316
+ this.dataMap.set('d', '113,');
317
+ this.dataMap.set('m', '181,');
318
+ this.dataMap.set('v', '191,');
319
+ this.dataMap.set('e', '127,');
320
+ this.dataMap.set('n', '193,');
321
+ this.dataMap.set('w', '227,');
322
+ this.dataMap.set('f', '132,');
323
+ this.dataMap.set('o', '197,');
324
+ this.dataMap.set('x', '229,');
325
+ this.dataMap.set('g', '137,');
326
+ this.dataMap.set('p', '199,');
327
+ this.dataMap.set('y', '233,');
328
+ this.dataMap.set('h', '139,');
329
+ this.dataMap.set('q', '211,');
330
+ this.dataMap.set('z', '239,');
331
+ this.dataMap.set('i', '149,');
332
+ this.dataMap.set('r', '223,');
333
+ this.dataMap.set('0', 'Z,');
334
+ this.dataMap.set('1', 'Y,');
335
+ this.dataMap.set('2', 'X,');
336
+ this.dataMap.set('3', 'W,');
337
+ this.dataMap.set('4', 'V,');
338
+ this.dataMap.set('5', 'U,');
339
+ this.dataMap.set('6', 'T,');
340
+ this.dataMap.set('7', 'S,');
341
+ this.dataMap.set('8', 'R,');
342
+ this.dataMap.set('9', 'Q,');
343
+ this.dataMap.set(',', '&');
344
+ this.dataMap.set('{', '1000,');
345
+ this.dataMap.set('}', '0000,');
346
+ }
347
+ Offusqued.prototype.ofusquedData = function (data) {
348
+ var responce = '';
349
+ var ofusquedData = data.toString().split('');
350
+ // tslint:disable-next-line:prefer-for-of
351
+ for (var i = 0; i < ofusquedData.length; i++) {
352
+ var letter = ofusquedData[i].toString();
353
+ if (this.dataMap.has(letter)) {
354
+ responce += this.dataMap.get(letter).toString();
355
+ }
356
+ else {
357
+ responce += letter + ',';
358
+ }
359
+ }
360
+ return responce;
361
+ };
362
+ Offusqued.prototype.decodeOfusquedData = function (data) {
363
+ var respoce = '';
364
+ var arrayData = data.split(',');
365
+ // tslint:disable-next-line:prefer-for-of
366
+ for (var i = 0; i < arrayData.length; i++) {
367
+ respoce += this.readValueInMap(arrayData[i]);
368
+ }
369
+ // @ts-ignore
370
+ return respoce.replaceAll('&', ',');
371
+ };
372
+ Offusqued.prototype.readValueInMap = function (data) {
373
+ var respoce = '';
374
+ var status = true;
375
+ this.dataMap.forEach(function (value, key) {
376
+ if (data + ',' === value) {
377
+ respoce = key;
378
+ status = false;
379
+ }
380
+ });
381
+ if (status) {
382
+ respoce = data;
383
+ }
384
+ return respoce;
385
+ };
386
+ Offusqued.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function Offusqued_Factory() { return new Offusqued(); }, token: Offusqued, providedIn: "root" });
387
+ Offusqued = __decorate([
388
+ core.Injectable({
389
+ providedIn: 'root',
390
+ })
391
+ ], Offusqued);
392
+ return Offusqued;
357
393
  }());
358
394
 
359
- var moment = moment_;
360
- /**
361
- * This Service handles how the date is represented in scripts i.e. ngModel.
362
- */
363
- var CustomAdapter = /** @class */ (function (_super) {
364
- __extends(CustomAdapter, _super);
365
- function CustomAdapter() {
366
- var _this = _super !== null && _super.apply(this, arguments) || this;
367
- _this.DELIMITER = '/';
368
- return _this;
369
- }
370
- CustomAdapter.prototype.fromModel = function (value) {
371
- if (value) {
372
- var date = value.split(this.DELIMITER);
373
- return {
374
- day: parseInt(date[0], 10),
375
- month: parseInt(date[1], 10),
376
- year: parseInt(date[2], 10)
377
- };
378
- }
379
- return null;
380
- };
381
- CustomAdapter.prototype.toModel = function (date) {
382
- return date ? (date.day < 10 ? 0 + date.day : date.day) + this.DELIMITER + (date.month < 10 ? 0 + date.month : date.month) + this.DELIMITER + date.year : '';
383
- };
384
- CustomAdapter = __decorate([
385
- core.Injectable()
386
- ], CustomAdapter);
387
- return CustomAdapter;
388
- }(ngBootstrap.NgbDateAdapter));
389
- /**
390
- * This Service handles how the date is rendered and parsed from keyboard i.e. in the bound input field.
391
- */
392
- var CustomDateParserFormatter = /** @class */ (function (_super) {
393
- __extends(CustomDateParserFormatter, _super);
394
- function CustomDateParserFormatter() {
395
- var _this = _super !== null && _super.apply(this, arguments) || this;
396
- _this.DELIMITER = '/';
397
- return _this;
398
- }
399
- CustomDateParserFormatter.prototype.parse = function (value) {
400
- if (value) {
401
- var date = value.split(this.DELIMITER);
402
- return {
403
- day: parseInt(date[0], 10),
404
- month: parseInt(date[1], 10),
405
- year: parseInt(date[2], 10)
406
- };
407
- }
408
- return null;
409
- };
410
- CustomDateParserFormatter.prototype.format = function (date) {
411
- return date ? (date.day < 10 ? '0' + date.day : date.day) + this.DELIMITER + (date.month < 10 ? '0' + date.month : date.month) + this.DELIMITER + date.year : '';
412
- };
413
- CustomDateParserFormatter = __decorate([
414
- core.Injectable()
415
- ], CustomDateParserFormatter);
416
- return CustomDateParserFormatter;
417
- }(ngBootstrap.NgbDateParserFormatter));
418
- var I18N_VALUES = {
419
- 'es': {
420
- weekdays: ['Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa', 'Do'],
421
- months: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
422
- weekLabel: 'sem'
423
- }
424
- // other languages you would support
425
- };
426
- var I18n = /** @class */ (function () {
427
- function I18n() {
428
- this.language = 'es';
429
- }
430
- I18n = __decorate([
431
- core.Injectable()
432
- ], I18n);
433
- return I18n;
434
- }());
435
- // Define custom service providing the months and weekdays translations
436
- var CustomDatepickerI18n = /** @class */ (function (_super) {
437
- __extends(CustomDatepickerI18n, _super);
438
- function CustomDatepickerI18n(_i18n) {
439
- var _this = _super.call(this) || this;
440
- _this._i18n = _i18n;
441
- return _this;
442
- }
443
- CustomDatepickerI18n.prototype.getWeekdayLabel = function (weekday) {
444
- return I18N_VALUES[this._i18n.language].weekdays[weekday - 1];
445
- };
446
- CustomDatepickerI18n.prototype.getWeekLabel = function () {
447
- return I18N_VALUES[this._i18n.language].weekLabel;
448
- };
449
- CustomDatepickerI18n.prototype.getMonthShortName = function (month) {
450
- return I18N_VALUES[this._i18n.language].months[month - 1];
451
- };
452
- CustomDatepickerI18n.prototype.getMonthFullName = function (month) {
453
- return this.getMonthShortName(month);
454
- };
455
- CustomDatepickerI18n.prototype.getDayAriaLabel = function (date) {
456
- return date.day + "-" + date.month + "-" + date.year;
457
- };
458
- CustomDatepickerI18n.prototype.getWeekdayShortName = function (weekday) {
459
- return I18N_VALUES[this._i18n.language].weekdays[weekday - 1];
460
- };
461
- ;
462
- CustomDatepickerI18n.ctorParameters = function () { return [
463
- { type: I18n }
464
- ]; };
465
- CustomDatepickerI18n = __decorate([
466
- core.Injectable()
467
- ], CustomDatepickerI18n);
468
- return CustomDatepickerI18n;
469
- }(ngBootstrap.NgbDatepickerI18n));
470
- var FormAuroraComponent = /** @class */ (function () {
471
- function FormAuroraComponent(data, http) {
472
- this.data = data;
473
- this.http = http;
474
- this.response = new core.EventEmitter();
475
- this.summit = new core.EventEmitter();
476
- this.viewAuthData = new core.EventEmitter();
477
- this.tipodocNumDoc = false;
478
- this.countSubmit = 0;
479
- this.watchValid = false;
480
- this.watchRequired = false;
481
- this.captchaValid = false;
482
- this.today = moment(new Date());
483
- this.maxYear = this.today.year();
484
- this.minYear = this.today.year() - 82;
485
- this.minDate = this.minYear.toString() + '-' + this.today.month().toString().padStart(2, '0') + '-' + this.today.date().toString().padStart(2, '0'); // {year: this.minYear, month: this.today.month(), day: this.today.date()};
486
- this.maxDate = this.maxYear.toString() + '-' + (this.today.month() + 1).toString().padStart(2, '0') + '-' + this.today.date().toString().padStart(2, '0'); // {year: this.maxYear, month: this.today.month() + 1, day: this.today.date()};
487
- this.recharge = false;
488
- this.indicativo = "57";
489
- this.defaultDocType = "Cédula de ciudadanía";
490
- this.patternNotValidDcto = false;
491
- this.patternNotValidCel = false;
492
- this.range = new forms.FormGroup({
493
- start: new forms.FormControl(),
494
- end: new forms.FormControl(),
495
- });
496
- }
497
- FormAuroraComponent.prototype.ngOnInit = function () {
498
- var _this = this;
499
- this.minDate = new Date(this.minDate).toISOString().split('T')[0];
500
- setTimeout(function () {
501
- _this.startComponent();
502
- }, 2000);
503
- };
504
- FormAuroraComponent.prototype.startComponent = function () {
505
- var e_1, _a;
506
- var _this = this;
507
- //ordena los campos
508
- if (this.dataForm != null && this.dataForm.formQuestions != undefined) {
509
- //Same row fields
510
- this.tipodocNumDoc = (this.dataForm.formQuestions.some(function (question) { return question.question.value === "tipoDoc"; }) && this.dataForm.formQuestions.some(function (question) { return question.question.value === "numeroDoc"; })) ? true : false;
511
- this.dataForm.formQuestions = this.dataForm.formQuestions.sort(function (a, b) {
512
- return a.order - b.order;
513
- });
514
- var existcaptcha = this.dataForm.formQuestions.filter(function (item) { return item.question.questionType.id == 6; });
515
- if (existcaptcha.length == 0) {
516
- this.captchaValid = true;
517
- }
518
- var _loop_1 = function (item) {
519
- if (item.question.maxlength == null || item.question.maxlength == undefined || item.question.maxlength == 0) {
520
- item.question.maxlength = 524288; //defaultvalue
521
- }
522
- if (item.question.minLength == null || item.question.minLength == undefined) {
523
- item.question.minLength = 0;
524
- }
525
- this_1.dataReloadForm.forEach(function (element) {
526
- _this.filldata = element;
527
- if ((item.question.questionType.id === 2 || item.question.questionType.id === 1 ||
528
- item.question.questionType.id === 3) && (_this.filldata.data !== null &&
529
- _this.filldata.data !== undefined) && item.question.id === _this.filldata.id) {
530
- item.question.registred = _this.filldata.data;
531
- }
532
- });
533
- if (item.question.registred == null || item.question.minLength == undefined) {
534
- item.question.registred = '';
535
- }
536
- };
537
- var this_1 = this;
538
- try {
539
- for (var _b = __values(this.dataForm.formQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
540
- var item = _c.value;
541
- _loop_1(item);
542
- }
543
- }
544
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
545
- finally {
546
- try {
547
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
548
- }
549
- finally { if (e_1) throw e_1.error; }
550
- }
551
- }
552
- };
553
- FormAuroraComponent.prototype.resolvedCaptcha = function (captchaResponse) {
554
- this.captchaValid = true;
555
- if (!this.formDynamic.form.value.captcha) {
556
- this.formDynamic.controls.captcha.setValue(captchaResponse);
557
- this.formDynamic.form.value.captcha = captchaResponse;
558
- document.getElementById("btnIng").style.opacity = !this.formDynamic.valid ? "0.65" : "1";
559
- }
560
- };
561
- //Forms
562
- //Metodo para evitar el render de los items del for
563
- FormAuroraComponent.prototype.trackByIndex = function (index, obj) {
564
- return index;
565
- };
566
- FormAuroraComponent.prototype.onChangeValidPatter = function (event, question) {
567
- var _this = this;
568
- if (question.pattern != undefined) {
569
- var valid = true;
570
- var keyvalid = [8, 32, 37, 38, 39, 40, 46, 9];
571
- //diferente de Backpsace
572
- //se deja catch por error no controlable en otro tiempo de ejecucion
573
- try {
574
- if (!keyvalid.includes(event.keyCode)) {
575
- var regex = new RegExp(question.pattern);
576
- valid = regex.test(event.key);
577
- }
578
- }
579
- catch (error) { }
580
- return valid;
581
- }
582
- if (question.questionType !== undefined) {
583
- if (question.questionType.description === 'Number') {
584
- if (question.value === 'numeroDoc') {
585
- this.validateNumeroDocumento(this.formDynamic.controls["numeroDoc"].value.toString());
586
- }
587
- else if (question.value === 'celular') {
588
- this.validateCelular(this.formDynamic.controls["celular"].value.toString());
589
- }
590
- }
591
- }
592
- document.getElementById("char" + question.value).setAttribute("hidden", "true");
593
- //if temporal mientras se migran todos los tipos de campos al foreach
594
- if (question.questionType.id != 11 && question.questionType.id != 7) {
595
- if (this.validMinLength(this.formDynamic, question)) {
596
- document.getElementById(question.value).style.borderColor = "#FF0000";
597
- document.getElementById("ml" + question.value).removeAttribute("hidden");
598
- }
599
- else {
600
- document.getElementById(question.value).style.borderColor = "#E4E4E4";
601
- document.getElementById("ml" + question.value).setAttribute("hidden", "true");
602
- }
603
- if (this.validMaxLength(this.formDynamic, question)) {
604
- document.getElementById(question.value).style.borderColor = "#FF0000";
605
- document.getElementById("mxl" + question.value).removeAttribute("hidden");
606
- }
607
- else {
608
- document.getElementById(question.value).style.borderColor = "#E4E4E4";
609
- document.getElementById("mxl" + question.value).setAttribute("hidden", "true");
610
- }
611
- }
612
- this.dataForm.formQuestions.forEach(function (formQuestion) {
613
- switch (formQuestion.question.questionType.id) {
614
- //se valida campo de tipo calendario
615
- case 7:
616
- if (question.questionType.id == 7)
617
- _this.calendarRulesValidate(formQuestion);
618
- break;
619
- //se valida campo de tipo email
620
- case 11:
621
- if (question.questionType.id == 11)
622
- _this.emailRulesValidate(formQuestion);
623
- break;
624
- }
625
- });
626
- document.getElementById("btnIng").style.opacity = !this.formDynamic.valid ? "0.65" : "1";
627
- };
628
- FormAuroraComponent.prototype.validOnlyText = function (event) {
629
- var regex = /^[a-zA-Z\u00C0-\u017F]+$/g;
630
- if (event.charCode == 32) {
631
- return true;
632
- }
633
- var valid = regex.test(event.key);
634
- return valid;
635
- };
636
- FormAuroraComponent.prototype.validDate = function (event) {
637
- /*let pattern = /(?:0[1-9]|[12][0-9]|3[01])\/(?:0[1-9]|1[0-2])\/(?:19|20)[0-9]{2}/;
638
- const regex = new RegExp(pattern);
639
- valid = regex.test(event.key);
640
- */
641
- var matches = String(event.key).match(regexType.date.exp);
642
- var valid = true;
643
- if (matches === null)
644
- valid = false;
645
- // alert(valid);
646
- return valid;
647
- };
648
- FormAuroraComponent.prototype.onChangeValidDate = function (event) {
649
- //let pattern = /(?:0[1-9]|1[0-2])\/(?:0[1-9]|[12][0-9]|3[01])\/(?:19|20)[0-9]{2}/;
650
- var dateN = /[0-9]|\//;
651
- var valid = true;
652
- var regex = new RegExp(dateN);
653
- valid = regex.test(event.key);
654
- return valid;
655
- };
656
- FormAuroraComponent.prototype.rediretoutside = function (event, question) {
657
- //se deja catch por error no controlable en otro tiempo de ejecucion
658
- try {
659
- event.preventDefault();
660
- window.open(question.value, "_blank");
661
- }
662
- catch (error) { }
663
- };
664
- /**
665
- * Dispatch submit event for validations exists
666
- * @param change
667
- */
668
- FormAuroraComponent.prototype.ngOnChanges = function (change) {
669
- this.countSubmit++;
670
- };
671
- //onSubmit(form: NgForm) {
672
- FormAuroraComponent.prototype.onSubmit = function () {
673
- var _this = this;
674
- var form = this.formDynamic;
675
- this.watchValid = true;
676
- this.watchRequired = true;
677
- if (form.valid) {
678
- if (!this.validRulesFields(form.controls["numeroDoc"].value.toString(), form.controls["celular"].value.toString(), form.controls["email"].value))
679
- return false;
680
- }
681
- if (this.validMinlenghtAllQuestions(form.value) && this.validMaxLengthAllQuestions(form.value) && form.valid) {
682
- if (this.dataForm.urlSend != "" && this.captchaValid) {
683
- this.http.post(this.dataForm.urlSend, form.value).subscribe(function (resp) { return _this.response.emit(resp); });
684
- }
685
- else if (form.valid && this.captchaValid) {
686
- this.summit.emit(form.value);
687
- }
688
- }
689
- };
690
- FormAuroraComponent.prototype.findParamBoolean = function (params, idParam) {
691
- var showDescriptionParam = params.find(function (x) { return x.id == idParam; });
692
- return showDescriptionParam != null && showDescriptionParam.value == "true";
693
- };
694
- FormAuroraComponent.prototype.validRulesFields = function (numeroDoc, numeroCel, email) {
695
- var _this = this;
696
- // Validaciones para celular en caso de indicativo en Colombia
697
- var cel = document.getElementById("charcelular");
698
- var doc = document.getElementById("charnumeroDoc");
699
- var valOk = true;
700
- if (this.indicativo == "+57" || this.indicativo == "57") {
701
- var stringOrdenado = this.orderString(numeroDoc);
702
- if (this.nameCompany.toUpperCase() !== 'CLARO') { //claro acepta nro consecutivos
703
- if (numeroDoc == stringOrdenado) {
704
- doc.style.borderColor = "#FF0000";
705
- doc.removeAttribute("hidden");
706
- doc.textContent = "El numero documento No debe contener caracteres consecutivos";
707
- valOk = false;
708
- //this.msgErrorCampo = "El numero documento No debe contener caracteres consecutivos";
709
- //return false;
710
- }
711
- }
712
- if (numeroCel.substring(0, 1) != "3") {
713
- cel.style.borderColor = "#FF0000";
714
- cel.removeAttribute("hidden");
715
- cel.textContent = "El primer carácter del celular debe ser 3";
716
- valOk = false;
717
- //this.msgErrorCampo = "El primer carácter del celular debe ser 3";
718
- //return false;
719
- }
720
- /*
721
- if (parseInt(numeroCel.substring(0, 3)) > 350) {
722
- cel.style.borderColor = "#FF0000";
723
- cel.removeAttribute("hidden");
724
- cel.textContent = "El prefijo del celular no debe ser mayor a 350";
725
- valOk = false;
726
- //this.msgErrorCampo = "El prefijo del celular no debe ser mayor a 350";
727
- //return false;
728
- }
729
- */
730
- //En caso de que el número se repita, ejemplo 33333333
731
- var listnumber = numeroDoc.substring(0, 1);
732
- for (var index = 1; index < numeroDoc.length; index++) {
733
- listnumber = listnumber + numeroDoc.substring(0, 1);
734
- }
735
- if (numeroDoc == listnumber) {
736
- doc.style.borderColor = "#FF0000";
737
- doc.removeAttribute("hidden");
738
- doc.textContent = "Caracteres numéricos no se pueden repetirse de manera continua ";
739
- valOk = false;
740
- //this.msgErrorCampo = "Caracteres numéricos no se pueden repetirse de manera continua ";
741
- //return false;
742
- }
743
- if (!this.validateNumeroDocumento(numeroDoc)) {
744
- return false;
745
- }
746
- if (!this.validateCelular(numeroCel)) {
747
- return false;
748
- }
749
- // En caso de que el número se repita, ejemplo 33333333
750
- var arrayPhoneRepeat = Array.from(String(numeroCel), Number);
751
- var arrayPhoneOutRepeat = __spread(new Set(arrayPhoneRepeat));
752
- if (arrayPhoneOutRepeat.length == 1) {
753
- cel.style.borderColor = "#FF0000";
754
- cel.removeAttribute("hidden");
755
- cel.textContent = "El número que ingresa no es valido";
756
- valOk = false;
757
- //this.msgErrorCampo = "El número que ingresa no es valido";
758
- //return false;
759
- }
760
- }
761
- else if (this.indicativo == "+593" || this.indicativo == "593") {
762
- if (numeroCel.substring(0, 1) != "9") {
763
- cel.style.borderColor = "#FF0000";
764
- cel.removeAttribute("hidden");
765
- cel.textContent = "El primer carácter del celular debe ser 9";
766
- valOk = false;
767
- //this.msgErrorCampo = "El primer carácter del celular debe ser 9";
768
- //return false;
769
- }
770
- }
771
- //se validan los campos por tipo de campo y no por value
772
- this.dataForm.formQuestions.forEach(function (formQuestion) {
773
- switch (formQuestion.question.questionType.id) {
774
- //se valida campo de tipo email
775
- case 11:
776
- valOk = _this.emailRulesValidate(formQuestion);
777
- break;
778
- }
779
- });
780
- return valOk;
781
- };
782
- FormAuroraComponent.prototype.orderString = function (value) {
783
- var arrayNumber = [];
784
- for (var index = 0; index < value.length; index++) {
785
- arrayNumber.push(parseInt(value.substring(index, index + 1)));
786
- }
787
- //ordena el array
788
- arrayNumber.sort(function (a, b) {
789
- return a - b;
790
- });
791
- var numberOrder = "";
792
- numberOrder = arrayNumber[0];
793
- for (var index = 1; index < arrayNumber.length; index++) {
794
- numberOrder = numberOrder + (arrayNumber[0] + index).toString();
795
- }
796
- return numberOrder;
797
- };
798
- FormAuroraComponent.prototype.validMinlenghtAllQuestions = function (form) {
799
- var e_2, _a;
800
- try {
801
- for (var _b = __values(this.dataForm.formQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
802
- var item = _c.value;
803
- if (item.question.questionType.id == 1 || item.question.questionType.id == 2) {
804
- var minLength = parseInt(item.question.minLength);
805
- var formValueLength = parseInt(form[item.question.value].toString().length);
806
- if (minLength > 0 && formValueLength != minLength && formValueLength < minLength)
807
- return false;
808
- }
809
- }
810
- }
811
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
812
- finally {
813
- try {
814
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
815
- }
816
- finally { if (e_2) throw e_2.error; }
817
- }
818
- return true;
819
- };
820
- FormAuroraComponent.prototype.validMaxLengthAllQuestions = function (form) {
821
- var e_3, _a;
822
- try {
823
- for (var _b = __values(this.dataForm.formQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
824
- var item = _c.value;
825
- if (item.question.questionType.id == 1 || item.question.questionType.id == 2) {
826
- var maxLength = parseInt(item.question.maxLength);
827
- var formValueLength = parseInt(form[item.question.value].toString().length);
828
- if (maxLength > 0 && formValueLength != maxLength && formValueLength > maxLength)
829
- return false;
830
- }
831
- }
832
- }
833
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
834
- finally {
835
- try {
836
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
837
- }
838
- finally { if (e_3) throw e_3.error; }
839
- }
840
- return true;
841
- };
842
- FormAuroraComponent.prototype.validRequired = function (form, question) {
843
- //se deja catch por error no controlable en otro tiempo de ejecucion
844
- try {
845
- if (question != undefined && question.value != undefined) {
846
- if (form.controls[question.value] != undefined &&
847
- form.controls[question.value].errors != null &&
848
- form.controls[question.value].errors.required) {
849
- return true;
850
- }
851
- }
852
- }
853
- catch (error) { }
854
- return false;
855
- };
856
- FormAuroraComponent.prototype.validMinLength = function (form, question) {
857
- //se deja catch por error no controlable en otro tiempo de ejecucion
858
- try {
859
- if (question != undefined && question.value != undefined) {
860
- if (question.minLength > form.controls[question.value].value.toLocaleString().length && question.minLength > 0) {
861
- return true;
862
- }
863
- }
864
- }
865
- catch (error) { }
866
- return false;
867
- };
868
- FormAuroraComponent.prototype.validMaxLength = function (form, question) {
869
- //se deja catch por error no controlable en otro tiempo de ejecucion
870
- try {
871
- if (question != undefined && question.value != undefined) {
872
- if (question.maxLength > 0) {
873
- if (question.maxLength + 1 <= form.controls[question.value].value.toString().replace(/\./g, '').length) {
874
- if (!this.formDynamic.controls[question.value].hasError('errorMaxLength')) {
875
- this.formDynamic.controls[question.value].setErrors({ 'errorMaxLength': true });
876
- }
877
- return true;
878
- }
879
- }
880
- }
881
- }
882
- catch (error) { }
883
- return false;
884
- };
885
- FormAuroraComponent.prototype.tycSelection = function (event) {
886
- this.viewAuthData.emit(event);
887
- };
888
- FormAuroraComponent.prototype.openLabelUrl = function (event, question) {
889
- event.preventDefault();
890
- var tyc = document.getElementById("check" + question.id);
891
- tyc.style.color = "#A3AD32";
892
- window.open(question.urllabel, "_blank");
893
- };
894
- FormAuroraComponent.prototype.cancellKeypress = function () {
895
- return false;
896
- };
897
- FormAuroraComponent.prototype.emailRulesValidate = function (formQuestion) {
898
- var valOk = true;
899
- try {
900
- var hasError = false;
901
- document.getElementById(formQuestion.question.id).setAttribute("hidden", "true");
902
- var eml = document.getElementById(formQuestion.question.id);
903
- var email = formQuestion.question.registred;
904
- if (!hasError) {
905
- if (formQuestion.question.required && (email == "" || email == undefined || email == null)) {
906
- eml.style.borderColor = "#FF0000";
907
- eml.textContent = "El correco eléctronico es requerido";
908
- eml.removeAttribute("hidden");
909
- valOk = false;
910
- hasError = true;
911
- }
912
- }
913
- if (!hasError) {
914
- if (this.validMinLength(undefined, formQuestion.question)) {
915
- eml.style.borderColor = "#FF0000";
916
- eml.textContent = "Debe ser mínimo de " + formQuestion.question.minLength + " caracteres";
917
- document.getElementById(formQuestion.question.id).removeAttribute("hidden");
918
- valOk = false;
919
- hasError = true;
920
- }
921
- }
922
- if (!hasError) {
923
- if (this.validMaxLength(undefined, formQuestion.question)) {
924
- eml.style.borderColor = "#FF0000";
925
- eml.textContent = "Debe ser maximo de " + formQuestion.question.maxLength + " caracteres";
926
- document.getElementById(formQuestion.question.id).removeAttribute("hidden");
927
- valOk = false;
928
- hasError = true;
929
- }
930
- }
931
- if (!hasError) {
932
- var matches = String(email).match(regexType.email.exp);
933
- if (matches == null) {
934
- eml.style.borderColor = "#FF0000";
935
- eml.textContent = "Tu email es invalido";
936
- eml.removeAttribute("hidden");
937
- valOk = false;
938
- hasError = true;
939
- }
940
- }
941
- }
942
- catch (error) {
943
- }
944
- return valOk;
945
- };
946
- FormAuroraComponent.prototype.calendarRulesValidate = function (formQuestion) {
947
- var hasError = false;
948
- try {
949
- document.getElementById(formQuestion.question.id).setAttribute("hidden", "true");
950
- var ecalendar = document.getElementById(formQuestion.question.id);
951
- //se valida que no sea null si es requerido
952
- var date = formQuestion.question.registred;
953
- if (formQuestion.question.required && (date == "" || date == undefined || date == null)) {
954
- ecalendar.style.borderColor = "#FF0000";
955
- ecalendar.textContent = "La fecha es requerida";
956
- ecalendar.removeAttribute("hidden");
957
- }
958
- }
959
- catch (error) {
960
- }
961
- };
962
- FormAuroraComponent.prototype.validateNotSpace = function (event) {
963
- if (event.charCode == 32) {
964
- return false;
965
- }
966
- else {
967
- return true;
968
- }
969
- };
970
- FormAuroraComponent.prototype.validateNumeroDocumento = function (numeroDoc) {
971
- if (!numeroDoc.match("^[0-9]*$")) {
972
- this.formDynamic.controls["numeroDoc"].setValidators([forms.Validators.pattern('^[0-9]*$')]);
973
- this.formDynamic.controls["numeroDoc"].markAsDirty();
974
- this.formDynamic.controls["numeroDoc"].updateValueAndValidity();
975
- this.formDynamic.controls["numeroDoc"].markAsTouched();
976
- this.patternNotValidDcto = true;
977
- return false;
978
- }
979
- this.patternNotValidDcto = false;
980
- return true;
981
- };
982
- FormAuroraComponent.prototype.validateCelular = function (numeroCel) {
983
- if (!numeroCel.match("^[0-9]*$")) {
984
- this.formDynamic.controls["celular"].setValidators([forms.Validators.pattern('^[0-9]*$')]);
985
- this.formDynamic.controls["celular"].markAsDirty();
986
- this.formDynamic.controls["celular"].updateValueAndValidity();
987
- this.formDynamic.controls["celular"].markAsTouched();
988
- this.patternNotValidCel = true;
989
- return false;
990
- }
991
- this.patternNotValidCel = false;
992
- return true;
993
- };
994
- FormAuroraComponent.prototype.onkeypress = function (event) {
995
- return (event.charCode == 0) ? null : event.charCode >= 48 && event.charCode <= 57;
996
- };
997
- FormAuroraComponent.prototype.onChangeStep = function (step, nextStep, value) {
998
- if (nextStep && nextStep.stepOrder != 1) {
999
- this.resetField(step);
1000
- nextStep.viewData = [];
1001
- nextStep.viewData = nextStep.stepData.filter(function (x) { return x.relationalIds.includes(Number(value)); });
1002
- }
1003
- };
1004
- FormAuroraComponent.prototype.resetField = function (stepIn) {
1005
- this.steps.forEach(function (step) {
1006
- if (step.stepOrder > stepIn.stepOrder) {
1007
- step.viewData = undefined;
1008
- step.value = undefined;
1009
- }
1010
- });
1011
- };
1012
- FormAuroraComponent.ctorParameters = function () { return [
1013
- { type: CommonDataService },
1014
- { type: http.HttpClient }
1015
- ]; };
1016
- __decorate([
1017
- core.Input()
1018
- ], FormAuroraComponent.prototype, "dataClassCss", void 0);
1019
- __decorate([
1020
- core.Input()
1021
- ], FormAuroraComponent.prototype, "dataForm", void 0);
1022
- __decorate([
1023
- core.Input()
1024
- ], FormAuroraComponent.prototype, "clickSubmit", void 0);
1025
- __decorate([
1026
- core.Input()
1027
- ], FormAuroraComponent.prototype, "dataReloadForm", void 0);
1028
- __decorate([
1029
- core.Input()
1030
- ], FormAuroraComponent.prototype, "welcomeTitle", void 0);
1031
- __decorate([
1032
- core.Input()
1033
- ], FormAuroraComponent.prototype, "welcomeDescription", void 0);
1034
- __decorate([
1035
- core.Input()
1036
- ], FormAuroraComponent.prototype, "urlPdf", void 0);
1037
- __decorate([
1038
- core.Input()
1039
- ], FormAuroraComponent.prototype, "nameCompany", void 0);
1040
- __decorate([
1041
- core.Input()
1042
- ], FormAuroraComponent.prototype, "schedule", void 0);
1043
- __decorate([
1044
- core.Input()
1045
- ], FormAuroraComponent.prototype, "isSimpleFlow", void 0);
1046
- __decorate([
1047
- core.Input()
1048
- ], FormAuroraComponent.prototype, "steps", void 0);
1049
- __decorate([
1050
- core.ViewChild('formDynamic', { static: true })
1051
- ], FormAuroraComponent.prototype, "formDynamic", void 0);
1052
- __decorate([
1053
- core.Output()
1054
- ], FormAuroraComponent.prototype, "response", void 0);
1055
- __decorate([
1056
- core.Output()
1057
- ], FormAuroraComponent.prototype, "summit", void 0);
1058
- __decorate([
1059
- core.Output()
1060
- ], FormAuroraComponent.prototype, "viewAuthData", void 0);
1061
- FormAuroraComponent = __decorate([
1062
- core.Component({
1063
- selector: 'lib-FormAurora',
1064
- template: "<div class=\"card\">\r\n <span class=\"text-center mt-2 d-none d-sm-block\" *ngIf=\"!isSimpleFlow\">\r\n <img style=\"width: 115px; height:96px;\" [class]=\"dataClassCss.logo\" id=\"logo\">\r\n </span>\r\n <div class=\"text-center mt-2 d-none d-sm-block\" *ngIf=\"isSimpleFlow\" style=\"margin-top: 4%!important;\">\r\n </div>\r\n <div class=\"card-body pt-0\">\r\n <ng-container *ngIf=\"schedule\">\r\n <h4 class=\"card-title text-center mb-0\" [class]=\"dataClassCss.bienvenida2\" style=\"color: #EE7E0E;\">\r\n Horarios de atenci\u00F3n\r\n </h4>\r\n <small class=\"text-center d-block\">{{schedule}}</small>\r\n </ng-container>\r\n <form #formDynamic=\"ngForm\">\r\n <div *ngFor=\"let control of dataForm?.formQuestions; let index = index; trackBy: trackByIndex\">\r\n <div\r\n *ngIf=\"(index > 0 && (dataForm.formQuestions[index - 1].question.questionType.id == 3 && dataForm.formQuestions[index].question.questionType.id == 2)) || (index < dataForm.formQuestions.length && dataForm.formQuestions[index].question.questionType.id == 3 && dataForm.formQuestions[index + 1].question.questionType.id == 2); else switchTemp\">\r\n <div class=\"row\"\r\n *ngIf=\"(index > 0 && (dataForm.formQuestions[index - 1].question.questionType.id == 3 && dataForm.formQuestions[index].question.questionType.id == 2))\">\r\n <div class=\"col-lg-6 col-xs-12\">\r\n <div [class]=\"dataClassCss.cl12\">\r\n <label for=\"{{dataForm.formQuestions[index - 1].question.value}}\" class=\"col-sm-12\"\r\n style=\"display: block; text-align: left;\">\r\n <span class=\"h6 small bg-white text-muted\">{{dataForm.formQuestions[index -\r\n 1].question.label}}</span>\r\n </label>\r\n <div class=\"selectContainer\">\r\n <select [name]=\"dataForm.formQuestions[index - 1].question.value\"\r\n [required]=\"dataForm.formQuestions[index - 1].question.required\"\r\n [class]=\"dataClassCss.formcontrol\"\r\n id=\"{{dataForm.formQuestions[index - 1].question.value}}\"\r\n style=\"margin-top: -1rem !important;\"\r\n [(ngModel)]=\"defaultDocType !== '' ? defaultDocType : dataForm.formQuestions[index - 1].question.registred\">\r\n <option value=\"\" selected disabled hidden>Selecciona</option>\r\n <ng-container\r\n *ngFor=\"let item of dataForm.formQuestions[index - 1].question.questionAnswers\">\r\n <option *ngIf=\"item.answer.state.id == 1\" [value]=\"item.answer.value\">\r\n {{ item.answer.field }}\r\n </option>\r\n </ng-container>\r\n </select>\r\n </div>\r\n </div>\r\n <div style=\"margin-left: 15px;\"\r\n *ngIf=\"dataForm.formQuestions[index].question.questionType.id != 5 && dataForm.formQuestions[index].question.questionType.id != 6\">\r\n <span class=\"error\" [id]=\"'char'+dataForm.formQuestions[index-1].question.value\"\r\n hidden></span>\r\n </div>\r\n </div>\r\n <div class=\"col-lg-6 col-xs-12\">\r\n <div [class]=\"dataClassCss.cl12\">\r\n <label for=\"{{dataForm.formQuestions[index].question.value}}\"\r\n class=\"col-sm-12 p-sm-0 px-sm-1\" style=\"display: block; text-align: left;\">\r\n <span\r\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\r\n </label>\r\n <input type=\"text\" pattern=\"\\d*\" inputmode=\"numeric\"\r\n id=\"{{dataForm.formQuestions[index].question.value}}\"\r\n style=\"margin-top: -1rem !important;\"\r\n [name]=\"dataForm.formQuestions[index].question.value\" placeholder=\"Escribe\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (keyup)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n onkeypress=\"onkeypress($event)\" onkeyup=\"(this.value=(value.replace(/[.]*/g,'')))\"\r\n maxlength=\"dataForm.formQuestions[index].question.maxLength\"\r\n [minLength]=\"dataForm.formQuestions[index].question.minLength\"\r\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\r\n [class]=\"dataClassCss.formcontrol\" />\r\n\r\n </div>\r\n\r\n <div style=\"margin-left: 15px;\"\r\n *ngIf=\"dataForm.formQuestions[index].question.questionType.id != 5 && dataForm.formQuestions[index].question.questionType.id != 6\">\r\n <span class=\"error\" [id]=\"'rq'+dataForm.formQuestions[index].question.value\"\r\n *ngIf=\"validRequired(formDynamic,dataForm.formQuestions[index].question) && watchValid\">\r\n Este campo es obligatorio</span>\r\n <span class=\"error\" [id]=\"'ml'+dataForm.formQuestions[index].question.value\" hidden>\r\n Debe ser m\u00EDnimo de\r\n {{ dataForm.formQuestions[index].question.minLength }} caracteres</span>\r\n <span class=\"error\" [id]=\"'mxl'+dataForm.formQuestions[index].question.value\" hidden>\r\n Debe ser maximo de\r\n {{ dataForm.formQuestions[index].question.maxLength }} caracteres</span>\r\n <span class=\"error\" [id]=\"'char'+dataForm.formQuestions[index].question.value\"\r\n hidden></span>\r\n <span *ngIf=\"patternNotValidDcto === true\" class=\"error\">Formato no valido</span>\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <ng-template #switchTemp>\r\n <div [ngSwitch]=\"dataForm.formQuestions[index].question.questionType.id\">\r\n <div *ngSwitchCase=\"1\">\r\n <div [class]=\"dataClassCss.cl12\">\r\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\r\n style=\"display: block; text-align: left; \">\r\n <span\r\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\r\n </label>\r\n <input type=\"text\" id=\"{{dataForm.formQuestions[index].question.value}}\"\r\n [class]=\"dataClassCss.formcontrol\" placeholder=\"Escribe\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n [maxlength]=\"dataForm.formQuestions[index].question.maxLength\"\r\n [name]=\"dataForm.formQuestions[index].question.value\"\r\n (keydown)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\r\n style=\"margin-top: -1rem !important;\" />\r\n </div>\r\n </div>\r\n <div *ngSwitchCase=\"2\">\r\n\r\n <div [class]=\"dataClassCss.cl12\">\r\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\r\n style=\"display: block; text-align: left;\">\r\n <span\r\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\r\n </label>\r\n <input type=\"text\" pattern=\"\\d*\" inputmode=\"numeric\"\r\n id=\"{{dataForm.formQuestions[index].question.value}}\"\r\n style=\"margin-top: -1rem !important;\"\r\n [name]=\"dataForm.formQuestions[index].question.value\" placeholder=\"Escribe\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n (keydown)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n onkeypress=\"onkeypress($event)\" onkeyup=\"(this.value=(value.replace(/[.]*/g,'')))\"\r\n maxlength=\"dataForm.formQuestions[index].question.maxLength\"\r\n [minLength]=\"dataForm.formQuestions[index].question.minLength\"\r\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\r\n [class]=\"dataClassCss.formcontrol\" />\r\n <span *ngIf=\"patternNotValidCel === true\" class=\"error\">Formato no valido</span>\r\n </div>\r\n\r\n </div>\r\n <div *ngSwitchCase=\"3\">\r\n <div [class]=\"dataClassCss.cl12\">\r\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\r\n style=\"display: block; text-align: left;\">\r\n <span\r\n class=\"h6 small bg-white text-muted\">{{dataForm.formQuestions[index].question.label}}</span>\r\n </label>\r\n <select [name]=\"dataForm.formQuestions[index].question.value\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n [class]=\"dataClassCss.formcontrol\"\r\n id=\"{{dataForm.formQuestions[index].question.value}}\"\r\n style=\"margin-top: -1rem !important;\"\r\n [(ngModel)]=\"defaultDocType !== '' ? defaultDocType : dataForm.formQuestions[index].question.registred\">\r\n <option value=\"\" selected disabled hidden>Selecciona</option>\r\n <ng-container\r\n *ngFor=\"let item of dataForm.formQuestions[index].question.questionAnswers\">\r\n <option *ngIf=\"item.answer.state.id == 1\" [value]=\"item.answer.value\">\r\n {{ item.answer.field }}\r\n </option>\r\n </ng-container>\r\n </select>\r\n </div>\r\n </div>\r\n <div *ngSwitchCase=\"4\">\r\n <select class=\"{{ dataClassCss.formcontrol }} select-checkbox\"\r\n style=\"overflow: hidden; border-style: hidden;\"\r\n [style.height.px]=\"dataForm.formQuestions[index].question.questionAnswers.length * 24\"\r\n [name]=\"dataForm.formQuestions[index].question.value\"\r\n [required]=\"dataForm.formQuestions[index].question.required\" ngModel multiple>\r\n <option (mousemove)=\"$event.preventDefault()\"\r\n *ngFor=\"let item of dataForm.formQuestions[index].question.questionAnswers\"\r\n [value]=\"item.answer.value\">\r\n {{ item.answer.field }}\r\n </option>\r\n </select>\r\n </div>\r\n <div *ngSwitchCase=\"5\">\r\n <a (click)=\"rediretoutside($event,dataForm.formQuestions[index].question)\" href=\"\">\r\n <span>{{ dataForm.formQuestions[index].question.label }}</span>\r\n </a>\r\n </div>\r\n <div *ngSwitchCase=\"6\">\r\n <div [class]=\"dataClassCss.cl12\" [id]=\"'reCaptcha'\">\r\n <div class=\"cnt-captcha\">\r\n <re-captcha (resolved)=\"resolvedCaptcha($event)\"\r\n siteKey=\"6Lf9DcQfAAAAAI6HCNB5OyKUpOPpfl5ocoBJcigZ\"></re-captcha>\r\n <input hidden type=\"text\" [name]=\"dataForm.formQuestions[index].question.value\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\">\r\n </div>\r\n <span class=\"error\" *ngIf=\"watchValid && !captchaValid\" style=\"margin-top: 0;\">\r\n Debe resolver la captcha para continuar\r\n </span>\r\n </div>\r\n </div>\r\n <div *ngSwitchCase=\"7\">\r\n <div [class]=\"dataClassCss.cl12\">\r\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\r\n style=\"display: block; text-align: left; margin-bottom: 0 ;\">\r\n <span\r\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\r\n </label>\r\n <input placeholder=\"dd/mm/aaaa\" style=\"margin-top: -0.4rem !important;\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n [name]=\"dataForm.formQuestions[index].question.value\" type=\"date\" min=\"{{minDate}}\"\r\n max=\"{{maxDate}}\" [maxlength]=\"10\" (paste)=\"false\"\r\n id=\"{{dataForm.formQuestions[index].question.value}}\"\r\n [class]=\"dataClassCss.txtCalendar\"\r\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\r\n (keydown)=\"cancellKeypress()\"\r\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\">\r\n\r\n <button class=\"btn\" id=\"{{dataForm.formQuestions[index].question.value}}\" type=\"button\"\r\n style=\"width: 46px;\r\n top: 12px;\r\n color: white;\r\n right: 15px;\r\n position: absolute;\r\n background: #D25D42;\r\n pointer-events: none;\">\r\n <i class=\"fa fa-calendar\"></i>\r\n </button>\r\n\r\n </div>\r\n </div>\r\n <div *ngSwitchCase=\"8\">\r\n <div [class]=\"dataClassCss.cl12\" style=\"text-align: left; margin-bottom: 10px;\">\r\n <input\r\n style=\"width: 4% !important; height: auto !important; display: inline !important;\"\r\n type=\"checkbox\" [name]=\"dataForm.formQuestions[index].question.value\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\r\n [class]=\"dataClassCss.formcontrol\">\r\n <a target=\"_blank\" style=\"text-decoration: underline;color:blue;cursor: pointer;\"\r\n id=\"txtPoliticas\" (click)=\"tycSelection($event)\">\r\n {{dataForm.formQuestions[index].question.label}}\r\n </a>\r\n </div>\r\n </div>\r\n <div *ngSwitchCase=\"9\">\r\n <div [class]=\"dataClassCss.cl12\">\r\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\r\n style=\"display: block; text-align: left; \">\r\n <span\r\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\r\n </label>\r\n <input type=\"text\" id=\"{{dataForm.formQuestions[index].question.value}}\"\r\n [class]=\"dataClassCss.formcontrol\" placeholder=\"Escribe\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n [maxlength]=\"dataForm.formQuestions[index].question.maxLength\"\r\n [name]=\"dataForm.formQuestions[index].question.value\"\r\n (keydown)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (keypress)=\"validOnlyText($event)\"\r\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\r\n style=\"margin-top: -1rem !important;\" />\r\n </div>\r\n </div>\r\n <div *ngSwitchCase=\"10\">\r\n <div [class]=\"dataClassCss.cl12\" style=\"text-align: left; margin-bottom: 10px;\">\r\n <input\r\n style=\"width: 4% !important; height: auto !important; display: inline !important;\"\r\n type=\"checkbox\" [name]=\"dataForm.formQuestions[index].question.value\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\">\r\n <a target=\"_blank\" style=\"text-decoration: underline;color:blue;cursor: pointer;\"\r\n id=\"check{{dataForm.formQuestions[index].question.id}}\"\r\n (click)=\"openLabelUrl($event,dataForm.formQuestions[index].question)\">\r\n {{dataForm.formQuestions[index].question.label}}\r\n </a>\r\n </div>\r\n </div>\r\n <div *ngSwitchCase=\"11\">\r\n <div [class]=\"dataClassCss.cl12\">\r\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\r\n style=\"display: block; text-align: left; \">\r\n <span\r\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\r\n </label>\r\n <input type=\"text\" id=\"{{dataForm.formQuestions[index].question.value}}\"\r\n [class]=\"dataClassCss.formcontrol\" placeholder=\"Escribe\"\r\n [required]=\"dataForm.formQuestions[index].question.required\"\r\n [maxlength]=\"dataForm.formQuestions[index].question.maxLength\"\r\n [name]=\"dataForm.formQuestions[index].question.value\"\r\n (keydown)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\r\n (keypress)=\"validateNotSpace($event)\"\r\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\r\n style=\"margin-top: -1rem !important;\" />\r\n </div>\r\n </div>\r\n <div *ngSwitchDefault>Tipo de control no detectado</div>\r\n <div style=\"margin-left: 15px;\"\r\n *ngIf=\"dataForm.formQuestions[index].question.questionType.id != 5 && dataForm.formQuestions[index].question.questionType.id != 6\">\r\n <span class=\"error\" [id]=\"'rq'+dataForm.formQuestions[index].question.value\"\r\n *ngIf=\"validRequired(formDynamic,dataForm.formQuestions[index].question) && watchValid\">\r\n Este campo es obligatorio</span>\r\n <span class=\"error\" [id]=\"'ml'+dataForm.formQuestions[index].question.value\" hidden>\r\n Debe ser m\u00EDnimo de\r\n {{ dataForm.formQuestions[index].question.minLength }} caracteres</span>\r\n <span class=\"error\" [id]=\"'mxl'+dataForm.formQuestions[index].question.value\" hidden>\r\n Debe ser maximo de\r\n {{ dataForm.formQuestions[index].question.maxLength }} caracteres</span>\r\n <span class=\"error\" [id]=\"'char'+dataForm.formQuestions[index].question.value\"\r\n hidden></span>\r\n <span class=\"error\" [id]=\"dataForm.formQuestions[index].question.id\" hidden></span>\r\n </div>\r\n </div>\r\n </ng-template>\r\n </div>\r\n <section *ngIf=\"isSimpleFlow\">\r\n <div *ngFor=\"let step of steps let index = index;\">\r\n <div [class]=\"dataClassCss.cl12\" *ngIf=\"step.viewData\">\r\n <label for=\"{{step.id}}\" class=\"col-sm-12\" style=\"display: block; text-align: left;\">\r\n <span class=\"h6 small bg-white text-muted\">{{step.step}}</span>\r\n </label>\r\n <select [name]=\"step.step\" [required]=\"true\" [class]=\"dataClassCss.formcontrol\"\r\n id=\"{{step.step}}\" style=\"margin-top: -1rem !important;\" [(ngModel)]=\"step.value\"\r\n (ngModelChange)=\"onChangeStep(step,steps[index+1],$event)\">\r\n <option value=\"\" selected disabled hidden>Selecciona</option>\r\n <ng-container *ngFor=\"let subitem of step.viewData\">\r\n <option [value]=\"subitem.id\">\r\n {{ subitem.description }}\r\n </option>\r\n </ng-container>\r\n </select>\r\n </div>\r\n </div>\r\n </section>\r\n <div class=\"mt-3 text-center\">\r\n <button type=\"button\" [class]=\"dataClassCss.btn\" (click)=\"onSubmit()\" [disabled]=\"!formDynamic.valid\"\r\n id=\"btnIng\">Ingresar</button>\r\n </div>\r\n </form>\r\n </div>\r\n</div>",
1065
- providers: [
1066
- { provide: ngBootstrap.NgbDateAdapter, useClass: CustomAdapter },
1067
- { provide: ngBootstrap.NgbDateParserFormatter, useClass: CustomDateParserFormatter },
1068
- { provide: ngBootstrap.NgbDatepickerI18n, useClass: CustomDatepickerI18n },
1069
- I18n
1070
- ],
1071
- styles: ["form{font-size:12px;overflow-y:scroll;overflow-x:hidden}form input,form select{border:1px solid #e4e4e4;height:40px;margin-bottom:5px}.selectContainer select{-webkit-appearance:none;-moz-appearance:none;appearance:none}.selectContainer::after{content:\"\\025be\";display:table-cell;text-align:center;padding-top:7px;width:30px;height:30px;position:absolute;top:14px;right:20px;pointer-events:none}form .error{color:red;font-size:12px;text-align:left;margin:-15px 0 15px;padding:0;width:90%}.error:after{content:\" \";display:block}.card{width:90%;margin:2% auto;border-radius:12px}@media (max-width:412px){.card{width:100%}.cnt-captcha{transform:scale(.77)}}@media (max-width:575.98px){.card{width:100%}.cnt-captcha{transform:scale(.77)}}@media (max-width:880.98px){.cnt-captcha{transform:scale(.82)}}input[type=date]::-webkit-calendar-picker-indicator{background:0 0;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-track{background:#f5f5f5}::-webkit-scrollbar-thumb{background:#e0e0e0}::-webkit-scrollbar-thumb:hover{background:#bdbdbd}"]
1072
- })
1073
- ], FormAuroraComponent);
1074
- return FormAuroraComponent;
395
+ var CommonDataService = /** @class */ (function () {
396
+ function CommonDataService() {
397
+ }
398
+ CommonDataService_1 = CommonDataService;
399
+ CommonDataService.prototype.getData = function () {
400
+ var dataOffuscade = new Offusqued();
401
+ if (localStorage.getItem("data") != null) {
402
+ var data = new Map(JSON.parse(localStorage.getItem("data")));
403
+ return data;
404
+ }
405
+ else {
406
+ /** Error get cookie */
407
+ }
408
+ };
409
+ CommonDataService.prototype.setData = function (data) {
410
+ var dataOffuscade = new Offusqued();
411
+ var datatem = JSON.stringify(Array.from(data.entries()));
412
+ var inf = dataOffuscade.ofusquedData(datatem);
413
+ console.log('OFUSCADO');
414
+ console.log(inf);
415
+ localStorage.setItem('data', inf);
416
+ //localStorage.setItem('data', JSON.stringify(Array.from(data.entries())));
417
+ };
418
+ CommonDataService.prototype.initData = function () {
419
+ this.setData(new Map());
420
+ };
421
+ CommonDataService.prototype.putValue = function (key, value) {
422
+ var data = this.getData();
423
+ data = data.set(key, value);
424
+ this.setData(data);
425
+ };
426
+ CommonDataService.prototype.addValue = function (keyPrimary, keySecond, value) {
427
+ var data = this.getValue(keyPrimary);
428
+ var dataReturn = this.getData();
429
+ data[keySecond] = value;
430
+ dataReturn = dataReturn.set(keyPrimary, data);
431
+ this.setData(dataReturn);
432
+ };
433
+ CommonDataService.prototype.getValue = function (key) {
434
+ return !this.getData() || !this.getData().has(key) ? undefined : this.getData().get(key);
435
+ };
436
+ CommonDataService.prototype.hasValue = function (key) {
437
+ return this.getData() != undefined ? this.getData().has(key) : null;
438
+ };
439
+ CommonDataService.prototype.clearMap = function () {
440
+ if (this.hasValue(CommonDataService_1.COMPANY_KEY)) {
441
+ var company = this.getValue(CommonDataService_1.COMPANY_KEY);
442
+ this.initData();
443
+ this.putValue(CommonDataService_1.COMPANY_KEY, company);
444
+ }
445
+ else {
446
+ this.initData();
447
+ }
448
+ };
449
+ var CommonDataService_1;
450
+ CommonDataService.COMPANY_KEY = "company";
451
+ CommonDataService.DOC_NUMBER_KEY = "docNumber";
452
+ CommonDataService.DOC_TYPE_KEY = "docType";
453
+ CommonDataService.PHONE_KEY = "phone";
454
+ CommonDataService.TYPE_ATTENTION_KEY = "typeAttention";
455
+ CommonDataService.OFFICE_KEY = "office";
456
+ CommonDataService.TYPE_TURN_KEY = "typeTurn";
457
+ CommonDataService.SERVICE_KEY = "service";
458
+ CommonDataService.TURN_KEY = "turn";
459
+ CommonDataService.PROGRAMED_TURN_KEY = "programedTurn";
460
+ CommonDataService.REQUEST_CALL = "requestCall";
461
+ CommonDataService.FORM_DATA = "formdata";
462
+ CommonDataService.TEMPLATE = "template";
463
+ CommonDataService.TURN_RESCHEDULE = "turnReschedule";
464
+ CommonDataService.USER_GENDER = "genderUser";
465
+ CommonDataService.AUTO_REDIRECT = "autoRedirect";
466
+ CommonDataService.SCHEDULE_GENERAL = "scheduleGeneral";
467
+ CommonDataService.AGENDAMIENTO_TTP = "potencialCustomer";
468
+ CommonDataService.SINGLE_PAGE_ONE = "singlePageOne";
469
+ CommonDataService.AVAILABLE_SCHEDULE_GRAL = "availableScheduleGral";
470
+ CommonDataService.PROFILE = "profile";
471
+ CommonDataService.PAGE_NEXT = "pageNext";
472
+ CommonDataService.STEPS = "steps";
473
+ CommonDataService.TYPE_TURN_ID = "typeTurnId";
474
+ CommonDataService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function CommonDataService_Factory() { return new CommonDataService(); }, token: CommonDataService, providedIn: "root" });
475
+ CommonDataService = CommonDataService_1 = __decorate([
476
+ core.Injectable({
477
+ providedIn: "root",
478
+ })
479
+ ], CommonDataService);
480
+ return CommonDataService;
1075
481
  }());
1076
482
 
1077
- var CommonTemplateService = /** @class */ (function () {
1078
- function CommonTemplateService(http) {
1079
- this.http = http;
1080
- }
1081
- CommonTemplateService.prototype.getTemplate = function (idCompany, url) {
1082
- return this.http.get(url + "/template/findByCompany/" + idCompany);
1083
- };
1084
- CommonTemplateService.prototype.reloadStylePage = function (currentDocument, templateCompany) {
1085
- var e_1, _a;
1086
- var objects = currentDocument.getElementsByClassName("template");
1087
- // debugger
1088
- for (var index = 0; index < objects.length; index++) {
1089
- var item = objects[index];
1090
- var itemClassName = typeof (item.className) == "object" ? item.className['baseVal'] : item.className;
1091
- var indexStart = itemClassName.indexOf("template");
1092
- // let keyString = itemClassName.substring(indexStart, itemClassName.length).split(' ')[1]
1093
- var keysString = itemClassName.substring(indexStart, itemClassName.length).split(' ').filter(function (a) { return a.indexOf('tmp_') !== -1; });
1094
- try {
1095
- for (var keysString_1 = (e_1 = void 0, __values(keysString)), keysString_1_1 = keysString_1.next(); !keysString_1_1.done; keysString_1_1 = keysString_1.next()) {
1096
- var keyString = keysString_1_1.value;
1097
- if (templateCompany[keyString] != undefined) {
1098
- if (keyString.includes("tmp_type_text_")) {
1099
- if (keyString.includes('tmp_type_text_6')) {
1100
- item['style'].setProperty('--' + keyString, templateCompany[keyString].color);
1101
- }
1102
- else {
1103
- item["style"].color = templateCompany[keyString].color;
1104
- if (itemClassName.includes("ratting-faces-v2")) {
1105
- item["style"].backgroundColor = templateCompany[keyString].color;
1106
- item["style"].borderColor = templateCompany[keyString].color;
1107
- item["style"].color = "white";
1108
- }
1109
- }
1110
- }
1111
- if (keyString.includes("title1")) {
1112
- /*item["style"].color = templateCompany[keyString].color*/
1113
- item["style"].color = "#EE7E0E";
1114
- }
1115
- if (keyString.includes("tmp_type_svg_")) {
1116
- item["style"].fill = templateCompany[keyString].fill;
1117
- }
1118
- if (keyString.includes("tmp_type_img_")) {
1119
- if (item.nodeName == "IMG") {
1120
- item["src"] = templateCompany[keyString].src;
1121
- }
1122
- else {
1123
- item["style"].background = templateCompany[keyString].background;
1124
- item["style"].backgroundSize = templateCompany[keyString].backgroundSize;
1125
- }
1126
- }
1127
- if (keyString.includes("tmp_type_head_")) {
1128
- item["style"].setProperty('--' + keyString, templateCompany[keyString].color);
1129
- }
1130
- if (keyString.includes("tmp_type_footer_")) {
1131
- // debugger
1132
- item["style"].setProperty('--' + keyString, templateCompany[keyString].color);
1133
- }
1134
- if (itemClassName.includes("tmp_type_cnt_")) {
1135
- indexStart = itemClassName.indexOf("tmp_type_cnt_");
1136
- keyString = itemClassName.substring(indexStart, itemClassName.length).split(' ')[0];
1137
- if (!!templateCompany[keyString]) {
1138
- item["style"].backgroundColor = templateCompany[keyString].backgroundColor;
1139
- }
1140
- }
1141
- if (keyString.includes('tmp_type_font_')) {
1142
- item['style'].setProperty('font-family', templateCompany[keyString]['font-family'], 'important');
1143
- }
1144
- }
1145
- }
1146
- }
1147
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1148
- finally {
1149
- try {
1150
- if (keysString_1_1 && !keysString_1_1.done && (_a = keysString_1.return)) _a.call(keysString_1);
1151
- }
1152
- finally { if (e_1) throw e_1.error; }
1153
- }
1154
- }
1155
- };
1156
- CommonTemplateService.ctorParameters = function () { return [
1157
- { type: http.HttpClient }
1158
- ]; };
1159
- CommonTemplateService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function CommonTemplateService_Factory() { return new CommonTemplateService(core.ɵɵinject(http.HttpClient)); }, token: CommonTemplateService, providedIn: "root" });
1160
- CommonTemplateService = __decorate([
1161
- core.Injectable({
1162
- providedIn: "root",
1163
- })
1164
- ], CommonTemplateService);
1165
- return CommonTemplateService;
483
+ var moment = moment_;
484
+ /**
485
+ * This Service handles how the date is represented in scripts i.e. ngModel.
486
+ */
487
+ var CustomAdapter = /** @class */ (function (_super) {
488
+ __extends(CustomAdapter, _super);
489
+ function CustomAdapter() {
490
+ var _this = _super !== null && _super.apply(this, arguments) || this;
491
+ _this.DELIMITER = '/';
492
+ return _this;
493
+ }
494
+ CustomAdapter.prototype.fromModel = function (value) {
495
+ if (value) {
496
+ var date = value.split(this.DELIMITER);
497
+ return {
498
+ day: parseInt(date[0], 10),
499
+ month: parseInt(date[1], 10),
500
+ year: parseInt(date[2], 10)
501
+ };
502
+ }
503
+ return null;
504
+ };
505
+ CustomAdapter.prototype.toModel = function (date) {
506
+ return date ? (date.day < 10 ? 0 + date.day : date.day) + this.DELIMITER + (date.month < 10 ? 0 + date.month : date.month) + this.DELIMITER + date.year : '';
507
+ };
508
+ CustomAdapter = __decorate([
509
+ core.Injectable()
510
+ ], CustomAdapter);
511
+ return CustomAdapter;
512
+ }(ngBootstrap.NgbDateAdapter));
513
+ /**
514
+ * This Service handles how the date is rendered and parsed from keyboard i.e. in the bound input field.
515
+ */
516
+ var CustomDateParserFormatter = /** @class */ (function (_super) {
517
+ __extends(CustomDateParserFormatter, _super);
518
+ function CustomDateParserFormatter() {
519
+ var _this = _super !== null && _super.apply(this, arguments) || this;
520
+ _this.DELIMITER = '/';
521
+ return _this;
522
+ }
523
+ CustomDateParserFormatter.prototype.parse = function (value) {
524
+ if (value) {
525
+ var date = value.split(this.DELIMITER);
526
+ return {
527
+ day: parseInt(date[0], 10),
528
+ month: parseInt(date[1], 10),
529
+ year: parseInt(date[2], 10)
530
+ };
531
+ }
532
+ return null;
533
+ };
534
+ CustomDateParserFormatter.prototype.format = function (date) {
535
+ return date ? (date.day < 10 ? '0' + date.day : date.day) + this.DELIMITER + (date.month < 10 ? '0' + date.month : date.month) + this.DELIMITER + date.year : '';
536
+ };
537
+ CustomDateParserFormatter = __decorate([
538
+ core.Injectable()
539
+ ], CustomDateParserFormatter);
540
+ return CustomDateParserFormatter;
541
+ }(ngBootstrap.NgbDateParserFormatter));
542
+ var I18N_VALUES = {
543
+ 'es': {
544
+ weekdays: ['Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa', 'Do'],
545
+ months: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
546
+ weekLabel: 'sem'
547
+ }
548
+ // other languages you would support
549
+ };
550
+ var I18n = /** @class */ (function () {
551
+ function I18n() {
552
+ this.language = 'es';
553
+ }
554
+ I18n = __decorate([
555
+ core.Injectable()
556
+ ], I18n);
557
+ return I18n;
558
+ }());
559
+ // Define custom service providing the months and weekdays translations
560
+ var CustomDatepickerI18n = /** @class */ (function (_super) {
561
+ __extends(CustomDatepickerI18n, _super);
562
+ function CustomDatepickerI18n(_i18n) {
563
+ var _this = _super.call(this) || this;
564
+ _this._i18n = _i18n;
565
+ return _this;
566
+ }
567
+ CustomDatepickerI18n.prototype.getWeekdayLabel = function (weekday) {
568
+ return I18N_VALUES[this._i18n.language].weekdays[weekday - 1];
569
+ };
570
+ CustomDatepickerI18n.prototype.getWeekLabel = function () {
571
+ return I18N_VALUES[this._i18n.language].weekLabel;
572
+ };
573
+ CustomDatepickerI18n.prototype.getMonthShortName = function (month) {
574
+ return I18N_VALUES[this._i18n.language].months[month - 1];
575
+ };
576
+ CustomDatepickerI18n.prototype.getMonthFullName = function (month) {
577
+ return this.getMonthShortName(month);
578
+ };
579
+ CustomDatepickerI18n.prototype.getDayAriaLabel = function (date) {
580
+ return date.day + "-" + date.month + "-" + date.year;
581
+ };
582
+ CustomDatepickerI18n.prototype.getWeekdayShortName = function (weekday) {
583
+ return I18N_VALUES[this._i18n.language].weekdays[weekday - 1];
584
+ };
585
+ ;
586
+ CustomDatepickerI18n.ctorParameters = function () { return [
587
+ { type: I18n }
588
+ ]; };
589
+ CustomDatepickerI18n = __decorate([
590
+ core.Injectable()
591
+ ], CustomDatepickerI18n);
592
+ return CustomDatepickerI18n;
593
+ }(ngBootstrap.NgbDatepickerI18n));
594
+ var FormAuroraComponent = /** @class */ (function () {
595
+ function FormAuroraComponent(data, http) {
596
+ this.data = data;
597
+ this.http = http;
598
+ this.response = new core.EventEmitter();
599
+ this.summit = new core.EventEmitter();
600
+ this.viewAuthData = new core.EventEmitter();
601
+ this.tipodocNumDoc = false;
602
+ this.countSubmit = 0;
603
+ this.watchValid = false;
604
+ this.watchRequired = false;
605
+ this.captchaValid = false;
606
+ this.today = moment(new Date());
607
+ this.maxYear = this.today.year();
608
+ this.minYear = this.today.year() - 82;
609
+ this.minDate = this.minYear.toString() + '-' + this.today.month().toString().padStart(2, '0') + '-' + this.today.date().toString().padStart(2, '0'); // {year: this.minYear, month: this.today.month(), day: this.today.date()};
610
+ this.maxDate = this.maxYear.toString() + '-' + (this.today.month() + 1).toString().padStart(2, '0') + '-' + this.today.date().toString().padStart(2, '0'); // {year: this.maxYear, month: this.today.month() + 1, day: this.today.date()};
611
+ this.recharge = false;
612
+ this.indicativo = "57";
613
+ this.defaultDocType = "Cédula de ciudadanía";
614
+ this.patternNotValidDcto = false;
615
+ this.patternNotValidCel = false;
616
+ this.range = new forms.FormGroup({
617
+ start: new forms.FormControl(),
618
+ end: new forms.FormControl(),
619
+ });
620
+ }
621
+ FormAuroraComponent.prototype.ngOnInit = function () {
622
+ var _this = this;
623
+ this.minDate = new Date(this.minDate).toISOString().split('T')[0];
624
+ setTimeout(function () {
625
+ _this.startComponent();
626
+ }, 2000);
627
+ };
628
+ FormAuroraComponent.prototype.startComponent = function () {
629
+ var e_1, _a;
630
+ var _this = this;
631
+ //ordena los campos
632
+ if (this.dataForm != null && this.dataForm.formQuestions != undefined) {
633
+ //Same row fields
634
+ this.tipodocNumDoc = (this.dataForm.formQuestions.some(function (question) { return question.question.value === "tipoDoc"; }) && this.dataForm.formQuestions.some(function (question) { return question.question.value === "numeroDoc"; })) ? true : false;
635
+ this.dataForm.formQuestions = this.dataForm.formQuestions.sort(function (a, b) {
636
+ return a.order - b.order;
637
+ });
638
+ var existcaptcha = this.dataForm.formQuestions.filter(function (item) { return item.question.questionType.id == 6; });
639
+ if (existcaptcha.length == 0) {
640
+ this.captchaValid = true;
641
+ }
642
+ var _loop_1 = function (item) {
643
+ if (item.question.maxlength == null || item.question.maxlength == undefined || item.question.maxlength == 0) {
644
+ item.question.maxlength = 524288; //defaultvalue
645
+ }
646
+ if (item.question.minLength == null || item.question.minLength == undefined) {
647
+ item.question.minLength = 0;
648
+ }
649
+ this_1.dataReloadForm.forEach(function (element) {
650
+ _this.filldata = element;
651
+ if ((item.question.questionType.id === 2 || item.question.questionType.id === 1 ||
652
+ item.question.questionType.id === 3) && (_this.filldata.data !== null &&
653
+ _this.filldata.data !== undefined) && item.question.id === _this.filldata.id) {
654
+ item.question.registred = _this.filldata.data;
655
+ }
656
+ });
657
+ if (item.question.registred == null || item.question.minLength == undefined) {
658
+ item.question.registred = '';
659
+ }
660
+ };
661
+ var this_1 = this;
662
+ try {
663
+ for (var _b = __values(this.dataForm.formQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
664
+ var item = _c.value;
665
+ _loop_1(item);
666
+ }
667
+ }
668
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
669
+ finally {
670
+ try {
671
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
672
+ }
673
+ finally { if (e_1) throw e_1.error; }
674
+ }
675
+ }
676
+ };
677
+ FormAuroraComponent.prototype.resolvedCaptcha = function (captchaResponse) {
678
+ this.captchaValid = true;
679
+ if (!this.formDynamic.form.value.captcha) {
680
+ this.formDynamic.controls.captcha.setValue(captchaResponse);
681
+ this.formDynamic.form.value.captcha = captchaResponse;
682
+ document.getElementById("btnIng").style.opacity = !this.formDynamic.valid ? "0.65" : "1";
683
+ }
684
+ };
685
+ //Forms
686
+ //Metodo para evitar el render de los items del for
687
+ FormAuroraComponent.prototype.trackByIndex = function (index, obj) {
688
+ return index;
689
+ };
690
+ FormAuroraComponent.prototype.onChangeValidPatter = function (event, question) {
691
+ var _this = this;
692
+ if (question.pattern != undefined) {
693
+ var valid = true;
694
+ var keyvalid = [8, 32, 37, 38, 39, 40, 46, 9];
695
+ //diferente de Backpsace
696
+ //se deja catch por error no controlable en otro tiempo de ejecucion
697
+ try {
698
+ if (!keyvalid.includes(event.keyCode)) {
699
+ var regex = new RegExp(question.pattern);
700
+ valid = regex.test(event.key);
701
+ }
702
+ }
703
+ catch (error) { }
704
+ return valid;
705
+ }
706
+ if (question.questionType !== undefined) {
707
+ if (question.questionType.description === 'Number') {
708
+ if (question.value === 'numeroDoc') {
709
+ this.validateNumeroDocumento(this.formDynamic.controls["numeroDoc"].value.toString());
710
+ }
711
+ else if (question.value === 'celular') {
712
+ this.validateCelular(this.formDynamic.controls["celular"].value.toString());
713
+ }
714
+ }
715
+ }
716
+ document.getElementById("char" + question.value).setAttribute("hidden", "true");
717
+ //if temporal mientras se migran todos los tipos de campos al foreach
718
+ if (question.questionType.id != 11 && question.questionType.id != 7) {
719
+ if (this.validMinLength(this.formDynamic, question)) {
720
+ document.getElementById(question.value).style.borderColor = "#FF0000";
721
+ document.getElementById("ml" + question.value).removeAttribute("hidden");
722
+ }
723
+ else {
724
+ document.getElementById(question.value).style.borderColor = "#E4E4E4";
725
+ document.getElementById("ml" + question.value).setAttribute("hidden", "true");
726
+ }
727
+ if (this.validMaxLength(this.formDynamic, question)) {
728
+ document.getElementById(question.value).style.borderColor = "#FF0000";
729
+ document.getElementById("mxl" + question.value).removeAttribute("hidden");
730
+ }
731
+ else {
732
+ document.getElementById(question.value).style.borderColor = "#E4E4E4";
733
+ document.getElementById("mxl" + question.value).setAttribute("hidden", "true");
734
+ }
735
+ }
736
+ this.dataForm.formQuestions.forEach(function (formQuestion) {
737
+ switch (formQuestion.question.questionType.id) {
738
+ //se valida campo de tipo calendario
739
+ case 7:
740
+ if (question.questionType.id == 7)
741
+ _this.calendarRulesValidate(formQuestion);
742
+ break;
743
+ //se valida campo de tipo email
744
+ case 11:
745
+ if (question.questionType.id == 11)
746
+ _this.emailRulesValidate(formQuestion);
747
+ break;
748
+ }
749
+ });
750
+ document.getElementById("btnIng").style.opacity = !this.formDynamic.valid ? "0.65" : "1";
751
+ };
752
+ FormAuroraComponent.prototype.validOnlyText = function (event) {
753
+ var regex = /^[a-zA-Z\u00C0-\u017F]+$/g;
754
+ if (event.charCode == 32) {
755
+ return true;
756
+ }
757
+ var valid = regex.test(event.key);
758
+ return valid;
759
+ };
760
+ FormAuroraComponent.prototype.validDate = function (event) {
761
+ /*let pattern = /(?:0[1-9]|[12][0-9]|3[01])\/(?:0[1-9]|1[0-2])\/(?:19|20)[0-9]{2}/;
762
+ const regex = new RegExp(pattern);
763
+ valid = regex.test(event.key);
764
+ */
765
+ var matches = String(event.key).match(regexType.date.exp);
766
+ var valid = true;
767
+ if (matches === null)
768
+ valid = false;
769
+ // alert(valid);
770
+ return valid;
771
+ };
772
+ FormAuroraComponent.prototype.onChangeValidDate = function (event) {
773
+ //let pattern = /(?:0[1-9]|1[0-2])\/(?:0[1-9]|[12][0-9]|3[01])\/(?:19|20)[0-9]{2}/;
774
+ var dateN = /[0-9]|\//;
775
+ var valid = true;
776
+ var regex = new RegExp(dateN);
777
+ valid = regex.test(event.key);
778
+ return valid;
779
+ };
780
+ FormAuroraComponent.prototype.rediretoutside = function (event, question) {
781
+ //se deja catch por error no controlable en otro tiempo de ejecucion
782
+ try {
783
+ event.preventDefault();
784
+ window.open(question.value, "_blank");
785
+ }
786
+ catch (error) { }
787
+ };
788
+ /**
789
+ * Dispatch submit event for validations exists
790
+ * @param change
791
+ */
792
+ FormAuroraComponent.prototype.ngOnChanges = function (change) {
793
+ this.countSubmit++;
794
+ };
795
+ //onSubmit(form: NgForm) {
796
+ FormAuroraComponent.prototype.onSubmit = function () {
797
+ var _this = this;
798
+ var form = this.formDynamic;
799
+ this.watchValid = true;
800
+ this.watchRequired = true;
801
+ if (form.valid) {
802
+ if (!this.validRulesFields(form.controls["numeroDoc"].value.toString(), form.controls["celular"].value.toString(), form.controls["email"].value))
803
+ return false;
804
+ }
805
+ if (this.validMinlenghtAllQuestions(form.value) && this.validMaxLengthAllQuestions(form.value) && form.valid) {
806
+ if (this.dataForm.urlSend != "" && this.captchaValid) {
807
+ this.http.post(this.dataForm.urlSend, form.value).subscribe(function (resp) { return _this.response.emit(resp); });
808
+ }
809
+ else if (form.valid && this.captchaValid) {
810
+ this.summit.emit(form.value);
811
+ }
812
+ }
813
+ };
814
+ FormAuroraComponent.prototype.findParamBoolean = function (params, idParam) {
815
+ var showDescriptionParam = params.find(function (x) { return x.id == idParam; });
816
+ return showDescriptionParam != null && showDescriptionParam.value == "true";
817
+ };
818
+ FormAuroraComponent.prototype.validRulesFields = function (numeroDoc, numeroCel, email) {
819
+ var _this = this;
820
+ // Validaciones para celular en caso de indicativo en Colombia
821
+ var cel = document.getElementById("charcelular");
822
+ var doc = document.getElementById("charnumeroDoc");
823
+ var valOk = true;
824
+ if (this.indicativo == "+57" || this.indicativo == "57") {
825
+ var stringOrdenado = this.orderString(numeroDoc);
826
+ if (this.nameCompany.toUpperCase() !== 'CLARO') { //claro acepta nro consecutivos
827
+ if (numeroDoc == stringOrdenado) {
828
+ doc.style.borderColor = "#FF0000";
829
+ doc.removeAttribute("hidden");
830
+ doc.textContent = "El numero documento No debe contener caracteres consecutivos";
831
+ valOk = false;
832
+ //this.msgErrorCampo = "El numero documento No debe contener caracteres consecutivos";
833
+ //return false;
834
+ }
835
+ }
836
+ if (numeroCel.substring(0, 1) != "3") {
837
+ cel.style.borderColor = "#FF0000";
838
+ cel.removeAttribute("hidden");
839
+ cel.textContent = "El primer carácter del celular debe ser 3";
840
+ valOk = false;
841
+ //this.msgErrorCampo = "El primer carácter del celular debe ser 3";
842
+ //return false;
843
+ }
844
+ /*
845
+ if (parseInt(numeroCel.substring(0, 3)) > 350) {
846
+ cel.style.borderColor = "#FF0000";
847
+ cel.removeAttribute("hidden");
848
+ cel.textContent = "El prefijo del celular no debe ser mayor a 350";
849
+ valOk = false;
850
+ //this.msgErrorCampo = "El prefijo del celular no debe ser mayor a 350";
851
+ //return false;
852
+ }
853
+ */
854
+ //En caso de que el número se repita, ejemplo 33333333
855
+ var listnumber = numeroDoc.substring(0, 1);
856
+ for (var index = 1; index < numeroDoc.length; index++) {
857
+ listnumber = listnumber + numeroDoc.substring(0, 1);
858
+ }
859
+ if (numeroDoc == listnumber) {
860
+ doc.style.borderColor = "#FF0000";
861
+ doc.removeAttribute("hidden");
862
+ doc.textContent = "Caracteres numéricos no se pueden repetirse de manera continua ";
863
+ valOk = false;
864
+ //this.msgErrorCampo = "Caracteres numéricos no se pueden repetirse de manera continua ";
865
+ //return false;
866
+ }
867
+ if (!this.validateNumeroDocumento(numeroDoc)) {
868
+ return false;
869
+ }
870
+ if (!this.validateCelular(numeroCel)) {
871
+ return false;
872
+ }
873
+ // En caso de que el número se repita, ejemplo 33333333
874
+ var arrayPhoneRepeat = Array.from(String(numeroCel), Number);
875
+ var arrayPhoneOutRepeat = __spread(new Set(arrayPhoneRepeat));
876
+ if (arrayPhoneOutRepeat.length == 1) {
877
+ cel.style.borderColor = "#FF0000";
878
+ cel.removeAttribute("hidden");
879
+ cel.textContent = "El número que ingresa no es valido";
880
+ valOk = false;
881
+ //this.msgErrorCampo = "El número que ingresa no es valido";
882
+ //return false;
883
+ }
884
+ }
885
+ else if (this.indicativo == "+593" || this.indicativo == "593") {
886
+ if (numeroCel.substring(0, 1) != "9") {
887
+ cel.style.borderColor = "#FF0000";
888
+ cel.removeAttribute("hidden");
889
+ cel.textContent = "El primer carácter del celular debe ser 9";
890
+ valOk = false;
891
+ //this.msgErrorCampo = "El primer carácter del celular debe ser 9";
892
+ //return false;
893
+ }
894
+ }
895
+ //se validan los campos por tipo de campo y no por value
896
+ this.dataForm.formQuestions.forEach(function (formQuestion) {
897
+ switch (formQuestion.question.questionType.id) {
898
+ //se valida campo de tipo email
899
+ case 11:
900
+ valOk = _this.emailRulesValidate(formQuestion);
901
+ break;
902
+ }
903
+ });
904
+ return valOk;
905
+ };
906
+ FormAuroraComponent.prototype.orderString = function (value) {
907
+ var arrayNumber = [];
908
+ for (var index = 0; index < value.length; index++) {
909
+ arrayNumber.push(parseInt(value.substring(index, index + 1)));
910
+ }
911
+ //ordena el array
912
+ arrayNumber.sort(function (a, b) {
913
+ return a - b;
914
+ });
915
+ var numberOrder = "";
916
+ numberOrder = arrayNumber[0];
917
+ for (var index = 1; index < arrayNumber.length; index++) {
918
+ numberOrder = numberOrder + (arrayNumber[0] + index).toString();
919
+ }
920
+ return numberOrder;
921
+ };
922
+ FormAuroraComponent.prototype.validMinlenghtAllQuestions = function (form) {
923
+ var e_2, _a;
924
+ try {
925
+ for (var _b = __values(this.dataForm.formQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
926
+ var item = _c.value;
927
+ if (item.question.questionType.id == 1 || item.question.questionType.id == 2) {
928
+ var minLength = parseInt(item.question.minLength);
929
+ var formValueLength = parseInt(form[item.question.value].toString().length);
930
+ if (minLength > 0 && formValueLength != minLength && formValueLength < minLength)
931
+ return false;
932
+ }
933
+ }
934
+ }
935
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
936
+ finally {
937
+ try {
938
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
939
+ }
940
+ finally { if (e_2) throw e_2.error; }
941
+ }
942
+ return true;
943
+ };
944
+ FormAuroraComponent.prototype.validMaxLengthAllQuestions = function (form) {
945
+ var e_3, _a;
946
+ try {
947
+ for (var _b = __values(this.dataForm.formQuestions), _c = _b.next(); !_c.done; _c = _b.next()) {
948
+ var item = _c.value;
949
+ if (item.question.questionType.id == 1 || item.question.questionType.id == 2) {
950
+ var maxLength = parseInt(item.question.maxLength);
951
+ var formValueLength = parseInt(form[item.question.value].toString().length);
952
+ if (maxLength > 0 && formValueLength != maxLength && formValueLength > maxLength)
953
+ return false;
954
+ }
955
+ }
956
+ }
957
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
958
+ finally {
959
+ try {
960
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
961
+ }
962
+ finally { if (e_3) throw e_3.error; }
963
+ }
964
+ return true;
965
+ };
966
+ FormAuroraComponent.prototype.validRequired = function (form, question) {
967
+ //se deja catch por error no controlable en otro tiempo de ejecucion
968
+ try {
969
+ if (question != undefined && question.value != undefined) {
970
+ if (form.controls[question.value] != undefined &&
971
+ form.controls[question.value].errors != null &&
972
+ form.controls[question.value].errors.required) {
973
+ return true;
974
+ }
975
+ }
976
+ }
977
+ catch (error) { }
978
+ return false;
979
+ };
980
+ FormAuroraComponent.prototype.validMinLength = function (form, question) {
981
+ //se deja catch por error no controlable en otro tiempo de ejecucion
982
+ try {
983
+ if (question != undefined && question.value != undefined) {
984
+ if (question.minLength > form.controls[question.value].value.toLocaleString().length && question.minLength > 0) {
985
+ return true;
986
+ }
987
+ }
988
+ }
989
+ catch (error) { }
990
+ return false;
991
+ };
992
+ FormAuroraComponent.prototype.validMaxLength = function (form, question) {
993
+ //se deja catch por error no controlable en otro tiempo de ejecucion
994
+ try {
995
+ if (question != undefined && question.value != undefined) {
996
+ if (question.maxLength > 0) {
997
+ if (question.maxLength + 1 <= form.controls[question.value].value.toString().replace(/\./g, '').length) {
998
+ if (!this.formDynamic.controls[question.value].hasError('errorMaxLength')) {
999
+ this.formDynamic.controls[question.value].setErrors({ 'errorMaxLength': true });
1000
+ }
1001
+ return true;
1002
+ }
1003
+ }
1004
+ }
1005
+ }
1006
+ catch (error) { }
1007
+ return false;
1008
+ };
1009
+ FormAuroraComponent.prototype.tycSelection = function (event) {
1010
+ this.viewAuthData.emit(event);
1011
+ };
1012
+ FormAuroraComponent.prototype.openLabelUrl = function (event, question) {
1013
+ event.preventDefault();
1014
+ var tyc = document.getElementById("check" + question.id);
1015
+ tyc.style.color = "#A3AD32";
1016
+ window.open(question.urllabel, "_blank");
1017
+ };
1018
+ FormAuroraComponent.prototype.cancellKeypress = function () {
1019
+ return false;
1020
+ };
1021
+ FormAuroraComponent.prototype.emailRulesValidate = function (formQuestion) {
1022
+ var valOk = true;
1023
+ try {
1024
+ var hasError = false;
1025
+ document.getElementById(formQuestion.question.id).setAttribute("hidden", "true");
1026
+ var eml = document.getElementById(formQuestion.question.id);
1027
+ var email = formQuestion.question.registred;
1028
+ if (!hasError) {
1029
+ if (formQuestion.question.required && (email == "" || email == undefined || email == null)) {
1030
+ eml.style.borderColor = "#FF0000";
1031
+ eml.textContent = "El correco eléctronico es requerido";
1032
+ eml.removeAttribute("hidden");
1033
+ valOk = false;
1034
+ hasError = true;
1035
+ }
1036
+ }
1037
+ if (!hasError) {
1038
+ if (this.validMinLength(undefined, formQuestion.question)) {
1039
+ eml.style.borderColor = "#FF0000";
1040
+ eml.textContent = "Debe ser mínimo de " + formQuestion.question.minLength + " caracteres";
1041
+ document.getElementById(formQuestion.question.id).removeAttribute("hidden");
1042
+ valOk = false;
1043
+ hasError = true;
1044
+ }
1045
+ }
1046
+ if (!hasError) {
1047
+ if (this.validMaxLength(undefined, formQuestion.question)) {
1048
+ eml.style.borderColor = "#FF0000";
1049
+ eml.textContent = "Debe ser maximo de " + formQuestion.question.maxLength + " caracteres";
1050
+ document.getElementById(formQuestion.question.id).removeAttribute("hidden");
1051
+ valOk = false;
1052
+ hasError = true;
1053
+ }
1054
+ }
1055
+ if (!hasError) {
1056
+ var matches = String(email).match(regexType.email.exp);
1057
+ if (matches == null) {
1058
+ eml.style.borderColor = "#FF0000";
1059
+ eml.textContent = "Tu email es invalido";
1060
+ eml.removeAttribute("hidden");
1061
+ valOk = false;
1062
+ hasError = true;
1063
+ }
1064
+ }
1065
+ }
1066
+ catch (error) {
1067
+ }
1068
+ return valOk;
1069
+ };
1070
+ FormAuroraComponent.prototype.calendarRulesValidate = function (formQuestion) {
1071
+ var hasError = false;
1072
+ try {
1073
+ document.getElementById(formQuestion.question.id).setAttribute("hidden", "true");
1074
+ var ecalendar = document.getElementById(formQuestion.question.id);
1075
+ //se valida que no sea null si es requerido
1076
+ var date = formQuestion.question.registred;
1077
+ if (formQuestion.question.required && (date == "" || date == undefined || date == null)) {
1078
+ ecalendar.style.borderColor = "#FF0000";
1079
+ ecalendar.textContent = "La fecha es requerida";
1080
+ ecalendar.removeAttribute("hidden");
1081
+ }
1082
+ }
1083
+ catch (error) {
1084
+ }
1085
+ };
1086
+ FormAuroraComponent.prototype.validateNotSpace = function (event) {
1087
+ if (event.charCode == 32) {
1088
+ return false;
1089
+ }
1090
+ else {
1091
+ return true;
1092
+ }
1093
+ };
1094
+ FormAuroraComponent.prototype.validateNumeroDocumento = function (numeroDoc) {
1095
+ if (!numeroDoc.match("^[0-9]*$")) {
1096
+ this.formDynamic.controls["numeroDoc"].setValidators([forms.Validators.pattern('^[0-9]*$')]);
1097
+ this.formDynamic.controls["numeroDoc"].markAsDirty();
1098
+ this.formDynamic.controls["numeroDoc"].updateValueAndValidity();
1099
+ this.formDynamic.controls["numeroDoc"].markAsTouched();
1100
+ this.patternNotValidDcto = true;
1101
+ return false;
1102
+ }
1103
+ this.patternNotValidDcto = false;
1104
+ return true;
1105
+ };
1106
+ FormAuroraComponent.prototype.validateCelular = function (numeroCel) {
1107
+ if (!numeroCel.match("^[0-9]*$")) {
1108
+ this.formDynamic.controls["celular"].setValidators([forms.Validators.pattern('^[0-9]*$')]);
1109
+ this.formDynamic.controls["celular"].markAsDirty();
1110
+ this.formDynamic.controls["celular"].updateValueAndValidity();
1111
+ this.formDynamic.controls["celular"].markAsTouched();
1112
+ this.patternNotValidCel = true;
1113
+ return false;
1114
+ }
1115
+ this.patternNotValidCel = false;
1116
+ return true;
1117
+ };
1118
+ FormAuroraComponent.prototype.onkeypress = function (event) {
1119
+ return (event.charCode == 0) ? null : event.charCode >= 48 && event.charCode <= 57;
1120
+ };
1121
+ FormAuroraComponent.prototype.onChangeStep = function (step, nextStep, value) {
1122
+ if (nextStep && nextStep.stepOrder != 1) {
1123
+ this.resetField(step);
1124
+ nextStep.viewData = [];
1125
+ nextStep.viewData = nextStep.stepData.filter(function (x) { return x.relationalIds.includes(Number(value)); });
1126
+ }
1127
+ };
1128
+ FormAuroraComponent.prototype.resetField = function (stepIn) {
1129
+ this.steps.forEach(function (step) {
1130
+ if (step.stepOrder > stepIn.stepOrder) {
1131
+ step.viewData = undefined;
1132
+ step.value = undefined;
1133
+ }
1134
+ });
1135
+ };
1136
+ FormAuroraComponent.ctorParameters = function () { return [
1137
+ { type: CommonDataService },
1138
+ { type: http.HttpClient }
1139
+ ]; };
1140
+ __decorate([
1141
+ core.Input()
1142
+ ], FormAuroraComponent.prototype, "dataClassCss", void 0);
1143
+ __decorate([
1144
+ core.Input()
1145
+ ], FormAuroraComponent.prototype, "dataForm", void 0);
1146
+ __decorate([
1147
+ core.Input()
1148
+ ], FormAuroraComponent.prototype, "clickSubmit", void 0);
1149
+ __decorate([
1150
+ core.Input()
1151
+ ], FormAuroraComponent.prototype, "dataReloadForm", void 0);
1152
+ __decorate([
1153
+ core.Input()
1154
+ ], FormAuroraComponent.prototype, "welcomeTitle", void 0);
1155
+ __decorate([
1156
+ core.Input()
1157
+ ], FormAuroraComponent.prototype, "welcomeDescription", void 0);
1158
+ __decorate([
1159
+ core.Input()
1160
+ ], FormAuroraComponent.prototype, "urlPdf", void 0);
1161
+ __decorate([
1162
+ core.Input()
1163
+ ], FormAuroraComponent.prototype, "nameCompany", void 0);
1164
+ __decorate([
1165
+ core.Input()
1166
+ ], FormAuroraComponent.prototype, "schedule", void 0);
1167
+ __decorate([
1168
+ core.Input()
1169
+ ], FormAuroraComponent.prototype, "isSimpleFlow", void 0);
1170
+ __decorate([
1171
+ core.Input()
1172
+ ], FormAuroraComponent.prototype, "steps", void 0);
1173
+ __decorate([
1174
+ core.ViewChild('formDynamic', { static: true })
1175
+ ], FormAuroraComponent.prototype, "formDynamic", void 0);
1176
+ __decorate([
1177
+ core.Output()
1178
+ ], FormAuroraComponent.prototype, "response", void 0);
1179
+ __decorate([
1180
+ core.Output()
1181
+ ], FormAuroraComponent.prototype, "summit", void 0);
1182
+ __decorate([
1183
+ core.Output()
1184
+ ], FormAuroraComponent.prototype, "viewAuthData", void 0);
1185
+ FormAuroraComponent = __decorate([
1186
+ core.Component({
1187
+ selector: 'lib-FormAurora',
1188
+ template: "<div class=\"card\">\n <span class=\"text-center mt-2 d-none d-sm-block\" *ngIf=\"!isSimpleFlow\">\n <img style=\"width: 115px; height:96px;\" [class]=\"dataClassCss.logo\" id=\"logo\">\n </span>\n <div class=\"text-center mt-2 d-none d-sm-block\" *ngIf=\"isSimpleFlow\" style=\"margin-top: 4%!important;\">\n </div>\n <div class=\"card-body pt-0\">\n <ng-container *ngIf=\"schedule\">\n <h4 class=\"card-title text-center mb-0\" [class]=\"dataClassCss.bienvenida2\" style=\"color: #EE7E0E;\">\n Horarios de atenci\u00F3n\n </h4>\n <small class=\"text-center d-block\">{{schedule}}</small>\n </ng-container>\n <form #formDynamic=\"ngForm\">\n <div *ngFor=\"let control of dataForm?.formQuestions; let index = index; trackBy: trackByIndex\">\n <div\n *ngIf=\"(index > 0 && (dataForm.formQuestions[index - 1].question.questionType.id == 3 && dataForm.formQuestions[index].question.questionType.id == 2)) || (index < dataForm.formQuestions.length && dataForm.formQuestions[index].question.questionType.id == 3 && dataForm.formQuestions[index + 1].question.questionType.id == 2); else switchTemp\">\n <div class=\"row\"\n *ngIf=\"(index > 0 && (dataForm.formQuestions[index - 1].question.questionType.id == 3 && dataForm.formQuestions[index].question.questionType.id == 2))\">\n <div class=\"col-lg-6 col-xs-12\">\n <div [class]=\"dataClassCss.cl12\">\n <label for=\"{{dataForm.formQuestions[index - 1].question.value}}\" class=\"col-sm-12\"\n style=\"display: block; text-align: left;\">\n <span class=\"h6 small bg-white text-muted\">{{dataForm.formQuestions[index -\n 1].question.label}}</span>\n </label>\n <div class=\"selectContainer\">\n <select [name]=\"dataForm.formQuestions[index - 1].question.value\"\n [required]=\"dataForm.formQuestions[index - 1].question.required\"\n [class]=\"dataClassCss.formcontrol\"\n id=\"{{dataForm.formQuestions[index - 1].question.value}}\"\n style=\"margin-top: -1rem !important;\"\n [(ngModel)]=\"defaultDocType !== '' ? defaultDocType : dataForm.formQuestions[index - 1].question.registred\">\n <option value=\"\" selected disabled hidden>Selecciona</option>\n <ng-container\n *ngFor=\"let item of dataForm.formQuestions[index - 1].question.questionAnswers\">\n <option *ngIf=\"item.answer.state.id == 1\" [value]=\"item.answer.value\">\n {{ item.answer.field }}\n </option>\n </ng-container>\n </select>\n </div>\n </div>\n <div style=\"margin-left: 15px;\"\n *ngIf=\"dataForm.formQuestions[index].question.questionType.id != 5 && dataForm.formQuestions[index].question.questionType.id != 6\">\n <span class=\"error\" [id]=\"'char'+dataForm.formQuestions[index-1].question.value\"\n hidden></span>\n </div>\n </div>\n <div class=\"col-lg-6 col-xs-12\">\n <div [class]=\"dataClassCss.cl12\">\n <label for=\"{{dataForm.formQuestions[index].question.value}}\"\n class=\"col-sm-12 p-sm-0 px-sm-1\" style=\"display: block; text-align: left;\">\n <span\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\n </label>\n <input type=\"text\" pattern=\"\\d*\" inputmode=\"numeric\"\n id=\"{{dataForm.formQuestions[index].question.value}}\"\n style=\"margin-top: -1rem !important;\"\n [name]=\"dataForm.formQuestions[index].question.value\" placeholder=\"Escribe\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (keyup)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n onkeypress=\"onkeypress($event)\" onkeyup=\"(this.value=(value.replace(/[.]*/g,'')))\"\n maxlength=\"dataForm.formQuestions[index].question.maxLength\"\n [minLength]=\"dataForm.formQuestions[index].question.minLength\"\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\n [class]=\"dataClassCss.formcontrol\" />\n\n </div>\n\n <div style=\"margin-left: 15px;\"\n *ngIf=\"dataForm.formQuestions[index].question.questionType.id != 5 && dataForm.formQuestions[index].question.questionType.id != 6\">\n <span class=\"error\" [id]=\"'rq'+dataForm.formQuestions[index].question.value\"\n *ngIf=\"validRequired(formDynamic,dataForm.formQuestions[index].question) && watchValid\">\n Este campo es obligatorio</span>\n <span class=\"error\" [id]=\"'ml'+dataForm.formQuestions[index].question.value\" hidden>\n Debe ser m\u00EDnimo de\n {{ dataForm.formQuestions[index].question.minLength }} caracteres</span>\n <span class=\"error\" [id]=\"'mxl'+dataForm.formQuestions[index].question.value\" hidden>\n Debe ser maximo de\n {{ dataForm.formQuestions[index].question.maxLength }} caracteres</span>\n <span class=\"error\" [id]=\"'char'+dataForm.formQuestions[index].question.value\"\n hidden></span>\n <span *ngIf=\"patternNotValidDcto === true\" class=\"error\">Formato no valido</span>\n </div>\n </div>\n </div>\n </div>\n\n <ng-template #switchTemp>\n <div [ngSwitch]=\"dataForm.formQuestions[index].question.questionType.id\">\n <div *ngSwitchCase=\"1\">\n <div [class]=\"dataClassCss.cl12\">\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\n style=\"display: block; text-align: left; \">\n <span\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\n </label>\n <input type=\"text\" id=\"{{dataForm.formQuestions[index].question.value}}\"\n [class]=\"dataClassCss.formcontrol\" placeholder=\"Escribe\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n [maxlength]=\"dataForm.formQuestions[index].question.maxLength\"\n [name]=\"dataForm.formQuestions[index].question.value\"\n (keydown)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\n style=\"margin-top: -1rem !important;\" />\n </div>\n </div>\n <div *ngSwitchCase=\"2\">\n\n <div [class]=\"dataClassCss.cl12\">\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\n style=\"display: block; text-align: left;\">\n <span\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\n </label>\n <input type=\"text\" pattern=\"\\d*\" inputmode=\"numeric\"\n id=\"{{dataForm.formQuestions[index].question.value}}\"\n style=\"margin-top: -1rem !important;\"\n [name]=\"dataForm.formQuestions[index].question.value\" placeholder=\"Escribe\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n (keydown)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n onkeypress=\"onkeypress($event)\" onkeyup=\"(this.value=(value.replace(/[.]*/g,'')))\"\n maxlength=\"dataForm.formQuestions[index].question.maxLength\"\n [minLength]=\"dataForm.formQuestions[index].question.minLength\"\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\n [class]=\"dataClassCss.formcontrol\" />\n <span *ngIf=\"patternNotValidCel === true\" class=\"error\">Formato no valido</span>\n </div>\n\n </div>\n <div *ngSwitchCase=\"3\">\n <div [class]=\"dataClassCss.cl12\">\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\n style=\"display: block; text-align: left;\">\n <span\n class=\"h6 small bg-white text-muted\">{{dataForm.formQuestions[index].question.label}}</span>\n </label>\n <select [name]=\"dataForm.formQuestions[index].question.value\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n [class]=\"dataClassCss.formcontrol\"\n id=\"{{dataForm.formQuestions[index].question.value}}\"\n style=\"margin-top: -1rem !important;\"\n [(ngModel)]=\"defaultDocType !== '' ? defaultDocType : dataForm.formQuestions[index].question.registred\">\n <option value=\"\" selected disabled hidden>Selecciona</option>\n <ng-container\n *ngFor=\"let item of dataForm.formQuestions[index].question.questionAnswers\">\n <option *ngIf=\"item.answer.state.id == 1\" [value]=\"item.answer.value\">\n {{ item.answer.field }}\n </option>\n </ng-container>\n </select>\n </div>\n </div>\n <div *ngSwitchCase=\"4\">\n <select class=\"{{ dataClassCss.formcontrol }} select-checkbox\"\n style=\"overflow: hidden; border-style: hidden;\"\n [style.height.px]=\"dataForm.formQuestions[index].question.questionAnswers.length * 24\"\n [name]=\"dataForm.formQuestions[index].question.value\"\n [required]=\"dataForm.formQuestions[index].question.required\" ngModel multiple>\n <option (mousemove)=\"$event.preventDefault()\"\n *ngFor=\"let item of dataForm.formQuestions[index].question.questionAnswers\"\n [value]=\"item.answer.value\">\n {{ item.answer.field }}\n </option>\n </select>\n </div>\n <div *ngSwitchCase=\"5\">\n <a (click)=\"rediretoutside($event,dataForm.formQuestions[index].question)\" href=\"\">\n <span>{{ dataForm.formQuestions[index].question.label }}</span>\n </a>\n </div>\n <div *ngSwitchCase=\"6\">\n <div [class]=\"dataClassCss.cl12\" [id]=\"'reCaptcha'\">\n <div class=\"cnt-captcha\">\n <re-captcha (resolved)=\"resolvedCaptcha($event)\"\n siteKey=\"6Lf9DcQfAAAAAI6HCNB5OyKUpOPpfl5ocoBJcigZ\"></re-captcha>\n <input hidden type=\"text\" [name]=\"dataForm.formQuestions[index].question.value\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\">\n </div>\n <span class=\"error\" *ngIf=\"watchValid && !captchaValid\" style=\"margin-top: 0;\">\n Debe resolver la captcha para continuar\n </span>\n </div>\n </div>\n <div *ngSwitchCase=\"7\">\n <div [class]=\"dataClassCss.cl12\">\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\n style=\"display: block; text-align: left; margin-bottom: 0 ;\">\n <span\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\n </label>\n <input placeholder=\"dd/mm/aaaa\" style=\"margin-top: -0.4rem !important;\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n [name]=\"dataForm.formQuestions[index].question.value\" type=\"date\" min=\"{{minDate}}\"\n max=\"{{maxDate}}\" [maxlength]=\"10\" (paste)=\"false\"\n id=\"{{dataForm.formQuestions[index].question.value}}\"\n [class]=\"dataClassCss.txtCalendar\"\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\n (keydown)=\"cancellKeypress()\"\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\">\n\n <button class=\"btn\" id=\"{{dataForm.formQuestions[index].question.value}}\" type=\"button\"\n style=\"width: 46px;\n top: 12px;\n color: white;\n right: 15px;\n position: absolute;\n background: #D25D42;\n pointer-events: none;\">\n <i class=\"fa fa-calendar\"></i>\n </button>\n\n </div>\n </div>\n <div *ngSwitchCase=\"8\">\n <div [class]=\"dataClassCss.cl12\" style=\"text-align: left; margin-bottom: 10px;\">\n <input\n style=\"width: 4% !important; height: auto !important; display: inline !important;\"\n type=\"checkbox\" [name]=\"dataForm.formQuestions[index].question.value\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\n [class]=\"dataClassCss.formcontrol\">\n <a target=\"_blank\" style=\"text-decoration: underline;color:blue;cursor: pointer;\"\n id=\"txtPoliticas\" (click)=\"tycSelection($event)\">\n {{dataForm.formQuestions[index].question.label}}\n </a>\n </div>\n </div>\n <div *ngSwitchCase=\"9\">\n <div [class]=\"dataClassCss.cl12\">\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\n style=\"display: block; text-align: left; \">\n <span\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\n </label>\n <input type=\"text\" id=\"{{dataForm.formQuestions[index].question.value}}\"\n [class]=\"dataClassCss.formcontrol\" placeholder=\"Escribe\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n [maxlength]=\"dataForm.formQuestions[index].question.maxLength\"\n [name]=\"dataForm.formQuestions[index].question.value\"\n (keydown)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (keypress)=\"validOnlyText($event)\"\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\n style=\"margin-top: -1rem !important;\" />\n </div>\n </div>\n <div *ngSwitchCase=\"10\">\n <div [class]=\"dataClassCss.cl12\" style=\"text-align: left; margin-bottom: 10px;\">\n <input\n style=\"width: 4% !important; height: auto !important; display: inline !important;\"\n type=\"checkbox\" [name]=\"dataForm.formQuestions[index].question.value\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\">\n <a target=\"_blank\" style=\"text-decoration: underline;color:blue;cursor: pointer;\"\n id=\"check{{dataForm.formQuestions[index].question.id}}\"\n (click)=\"openLabelUrl($event,dataForm.formQuestions[index].question)\">\n {{dataForm.formQuestions[index].question.label}}\n </a>\n </div>\n </div>\n <div *ngSwitchCase=\"11\">\n <div [class]=\"dataClassCss.cl12\">\n <label for=\"{{dataForm.formQuestions[index].question.value}}\" class=\"col-sm-12\"\n style=\"display: block; text-align: left; \">\n <span\n class=\"h6 small bg-white text-muted pt-1 pl-2 pr-2\">{{dataForm.formQuestions[index].question.label}}</span>\n </label>\n <input type=\"text\" id=\"{{dataForm.formQuestions[index].question.value}}\"\n [class]=\"dataClassCss.formcontrol\" placeholder=\"Escribe\"\n [required]=\"dataForm.formQuestions[index].question.required\"\n [maxlength]=\"dataForm.formQuestions[index].question.maxLength\"\n [name]=\"dataForm.formQuestions[index].question.value\"\n (keydown)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (change)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (blur)=\"onChangeValidPatter($event, dataForm.formQuestions[index].question)\"\n (keypress)=\"validateNotSpace($event)\"\n [(ngModel)]=\"dataForm.formQuestions[index].question.registred\"\n style=\"margin-top: -1rem !important;\" />\n </div>\n </div>\n <div *ngSwitchDefault>Tipo de control no detectado</div>\n <div style=\"margin-left: 15px;\"\n *ngIf=\"dataForm.formQuestions[index].question.questionType.id != 5 && dataForm.formQuestions[index].question.questionType.id != 6\">\n <span class=\"error\" [id]=\"'rq'+dataForm.formQuestions[index].question.value\"\n *ngIf=\"validRequired(formDynamic,dataForm.formQuestions[index].question) && watchValid\">\n Este campo es obligatorio</span>\n <span class=\"error\" [id]=\"'ml'+dataForm.formQuestions[index].question.value\" hidden>\n Debe ser m\u00EDnimo de\n {{ dataForm.formQuestions[index].question.minLength }} caracteres</span>\n <span class=\"error\" [id]=\"'mxl'+dataForm.formQuestions[index].question.value\" hidden>\n Debe ser maximo de\n {{ dataForm.formQuestions[index].question.maxLength }} caracteres</span>\n <span class=\"error\" [id]=\"'char'+dataForm.formQuestions[index].question.value\"\n hidden></span>\n <span class=\"error\" [id]=\"dataForm.formQuestions[index].question.id\" hidden></span>\n </div>\n </div>\n </ng-template>\n </div>\n <section *ngIf=\"isSimpleFlow\">\n <div *ngFor=\"let step of steps let index = index;\">\n <div [class]=\"dataClassCss.cl12\" *ngIf=\"step.viewData\">\n <label for=\"{{step.id}}\" class=\"col-sm-12\" style=\"display: block; text-align: left;\">\n <span class=\"h6 small bg-white text-muted\">{{step.step}}</span>\n </label>\n <select [name]=\"step.step\" [required]=\"true\" [class]=\"dataClassCss.formcontrol\"\n id=\"{{step.step}}\" style=\"margin-top: -1rem !important;\" [(ngModel)]=\"step.value\"\n (ngModelChange)=\"onChangeStep(step,steps[index+1],$event)\">\n <option value=\"\" selected disabled hidden>Selecciona</option>\n <ng-container *ngFor=\"let subitem of step.viewData\">\n <option [value]=\"subitem.id\">\n {{ subitem.description }}\n </option>\n </ng-container>\n </select>\n </div>\n </div>\n </section>\n <div class=\"mt-3 text-center\">\n <button type=\"button\" [class]=\"dataClassCss.btn\" (click)=\"onSubmit()\" [disabled]=\"!formDynamic.valid\"\n id=\"btnIng\">Ingresar</button>\n </div>\n </form>\n </div>\n</div>",
1189
+ providers: [
1190
+ { provide: ngBootstrap.NgbDateAdapter, useClass: CustomAdapter },
1191
+ { provide: ngBootstrap.NgbDateParserFormatter, useClass: CustomDateParserFormatter },
1192
+ { provide: ngBootstrap.NgbDatepickerI18n, useClass: CustomDatepickerI18n },
1193
+ I18n
1194
+ ],
1195
+ styles: ["form{font-size:12px;overflow-y:scroll;overflow-x:hidden}form input,form select{border:1px solid #e4e4e4;height:40px;margin-bottom:5px}.selectContainer select{-webkit-appearance:none;-moz-appearance:none;appearance:none}.selectContainer::after{content:\"\\025be\";display:table-cell;text-align:center;padding-top:7px;width:30px;height:30px;position:absolute;top:14px;right:20px;pointer-events:none}form .error{color:red;font-size:12px;text-align:left;margin:-15px 0 15px;padding:0;width:90%}.error:after{content:\" \";display:block}.card{width:90%;margin:2% auto;border-radius:12px}@media (max-width:412px){.card{width:100%}.cnt-captcha{transform:scale(.77)}}@media (max-width:575.98px){.card{width:100%}.cnt-captcha{transform:scale(.77)}}@media (max-width:880.98px){.cnt-captcha{transform:scale(.82)}}input[type=date]::-webkit-calendar-picker-indicator{background:0 0;bottom:0;color:transparent;cursor:pointer;height:auto;left:0;position:absolute;right:0;top:0;width:auto}::-webkit-scrollbar{width:5px}::-webkit-scrollbar-track{background:#f5f5f5}::-webkit-scrollbar-thumb{background:#e0e0e0}::-webkit-scrollbar-thumb:hover{background:#bdbdbd}"]
1196
+ })
1197
+ ], FormAuroraComponent);
1198
+ return FormAuroraComponent;
1166
1199
  }());
1167
1200
 
1168
- var Fill = /** @class */ (function () {
1169
- function Fill() {
1170
- }
1171
- return Fill;
1201
+ var CommonTemplateService = /** @class */ (function () {
1202
+ function CommonTemplateService(http) {
1203
+ this.http = http;
1204
+ }
1205
+ CommonTemplateService.prototype.getTemplate = function (idCompany, url) {
1206
+ return this.http.get(url + "/template/findByCompany/" + idCompany);
1207
+ };
1208
+ CommonTemplateService.prototype.reloadStylePage = function (currentDocument, templateCompany) {
1209
+ var e_1, _a;
1210
+ var objects = currentDocument.getElementsByClassName("template");
1211
+ // debugger
1212
+ for (var index = 0; index < objects.length; index++) {
1213
+ var item = objects[index];
1214
+ var itemClassName = typeof (item.className) == "object" ? item.className['baseVal'] : item.className;
1215
+ var indexStart = itemClassName.indexOf("template");
1216
+ // let keyString = itemClassName.substring(indexStart, itemClassName.length).split(' ')[1]
1217
+ var keysString = itemClassName.substring(indexStart, itemClassName.length).split(' ').filter(function (a) { return a.indexOf('tmp_') !== -1; });
1218
+ try {
1219
+ for (var keysString_1 = (e_1 = void 0, __values(keysString)), keysString_1_1 = keysString_1.next(); !keysString_1_1.done; keysString_1_1 = keysString_1.next()) {
1220
+ var keyString = keysString_1_1.value;
1221
+ if (templateCompany[keyString] != undefined) {
1222
+ if (keyString.includes("tmp_type_text_")) {
1223
+ if (keyString.includes('tmp_type_text_6')) {
1224
+ item['style'].setProperty('--' + keyString, templateCompany[keyString].color);
1225
+ }
1226
+ else {
1227
+ item["style"].color = templateCompany[keyString].color;
1228
+ if (itemClassName.includes("ratting-faces-v2")) {
1229
+ item["style"].backgroundColor = templateCompany[keyString].color;
1230
+ item["style"].borderColor = templateCompany[keyString].color;
1231
+ item["style"].color = "white";
1232
+ }
1233
+ }
1234
+ }
1235
+ if (keyString.includes("title1")) {
1236
+ /*item["style"].color = templateCompany[keyString].color*/
1237
+ item["style"].color = "#EE7E0E";
1238
+ }
1239
+ if (keyString.includes("tmp_type_svg_")) {
1240
+ item["style"].fill = templateCompany[keyString].fill;
1241
+ }
1242
+ if (keyString.includes("tmp_type_img_")) {
1243
+ if (item.nodeName == "IMG") {
1244
+ item["src"] = templateCompany[keyString].src;
1245
+ }
1246
+ else {
1247
+ item["style"].background = templateCompany[keyString].background;
1248
+ item["style"].backgroundSize = templateCompany[keyString].backgroundSize;
1249
+ }
1250
+ }
1251
+ if (keyString.includes("tmp_type_head_")) {
1252
+ item["style"].setProperty('--' + keyString, templateCompany[keyString].color);
1253
+ }
1254
+ if (keyString.includes("tmp_type_footer_")) {
1255
+ // debugger
1256
+ item["style"].setProperty('--' + keyString, templateCompany[keyString].color);
1257
+ }
1258
+ if (itemClassName.includes("tmp_type_cnt_")) {
1259
+ indexStart = itemClassName.indexOf("tmp_type_cnt_");
1260
+ keyString = itemClassName.substring(indexStart, itemClassName.length).split(' ')[0];
1261
+ if (!!templateCompany[keyString]) {
1262
+ item["style"].backgroundColor = templateCompany[keyString].backgroundColor;
1263
+ }
1264
+ }
1265
+ if (keyString.includes('tmp_type_font_')) {
1266
+ item['style'].setProperty('font-family', templateCompany[keyString]['font-family'], 'important');
1267
+ }
1268
+ }
1269
+ }
1270
+ }
1271
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1272
+ finally {
1273
+ try {
1274
+ if (keysString_1_1 && !keysString_1_1.done && (_a = keysString_1.return)) _a.call(keysString_1);
1275
+ }
1276
+ finally { if (e_1) throw e_1.error; }
1277
+ }
1278
+ }
1279
+ };
1280
+ CommonTemplateService.ctorParameters = function () { return [
1281
+ { type: http.HttpClient }
1282
+ ]; };
1283
+ CommonTemplateService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function CommonTemplateService_Factory() { return new CommonTemplateService(core.ɵɵinject(http.HttpClient)); }, token: CommonTemplateService, providedIn: "root" });
1284
+ CommonTemplateService = __decorate([
1285
+ core.Injectable({
1286
+ providedIn: "root",
1287
+ })
1288
+ ], CommonTemplateService);
1289
+ return CommonTemplateService;
1172
1290
  }());
1173
1291
 
1174
- var FormAuroraModule = /** @class */ (function () {
1175
- function FormAuroraModule() {
1176
- }
1177
- FormAuroraModule = __decorate([
1178
- core.NgModule({
1179
- declarations: [FormAuroraComponent],
1180
- imports: [
1181
- common.CommonModule,
1182
- forms.FormsModule,
1183
- ngRecaptcha.RecaptchaModule,
1184
- ngRecaptcha.RecaptchaFormsModule
1185
- ],
1186
- exports: [FormAuroraComponent]
1187
- })
1188
- ], FormAuroraModule);
1189
- return FormAuroraModule;
1292
+ var Fill = /** @class */ (function () {
1293
+ function Fill() {
1294
+ }
1295
+ return Fill;
1296
+ }());
1297
+
1298
+ var FormAuroraModule = /** @class */ (function () {
1299
+ function FormAuroraModule() {
1300
+ }
1301
+ FormAuroraModule = __decorate([
1302
+ core.NgModule({
1303
+ declarations: [FormAuroraComponent],
1304
+ imports: [
1305
+ common.CommonModule,
1306
+ forms.FormsModule,
1307
+ ngRecaptcha.RecaptchaModule,
1308
+ ngRecaptcha.RecaptchaFormsModule
1309
+ ],
1310
+ exports: [FormAuroraComponent]
1311
+ })
1312
+ ], FormAuroraModule);
1313
+ return FormAuroraModule;
1190
1314
  }());
1191
1315
 
1192
1316
  exports.CommonDataService = CommonDataService;