@senior-gestao-pessoas/payroll-core 9.4.0 → 9.5.0-32c4c8b1-bb0c-491c-8ec0-0eef83fe1088

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 (45) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +1419 -533
  2. package/bundles/senior-gestao-pessoas-payroll-core.umd.js.map +1 -1
  3. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js +16 -1
  4. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js.map +1 -1
  5. package/components/historical-pix-account/historical-pix-account-base.d.ts +27 -0
  6. package/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.d.ts +9 -40
  7. package/components/historical-pix-account/historical-pix-account.component.d.ts +103 -14
  8. package/components/historical-pix-account/historical-pix-account.service.d.ts +1 -0
  9. package/components/historical-pix-account-list/historical-pix-account-list.component.d.ts +14 -2
  10. package/components/shared/index.d.ts +1 -0
  11. package/components/shared/shared-state.service.d.ts +25 -0
  12. package/components/utils/format-utils/format-utils.service.d.ts +30 -3
  13. package/esm2015/components/historical-pix-account/historical-pix-account-base.js +180 -0
  14. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +34 -190
  15. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +647 -37
  16. package/esm2015/components/historical-pix-account/historical-pix-account.module.js +5 -1
  17. package/esm2015/components/historical-pix-account/historical-pix-account.service.js +8 -1
  18. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.component.js +91 -34
  19. package/esm2015/components/shared/index.js +2 -0
  20. package/esm2015/components/shared/shared-state.service.js +57 -0
  21. package/esm2015/components/utils/format-utils/format-utils.service.js +90 -5
  22. package/esm2015/public_api.js +2 -1
  23. package/esm2015/senior-gestao-pessoas-payroll-core.js +3 -2
  24. package/esm5/components/historical-pix-account/historical-pix-account-base.js +193 -0
  25. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +58 -204
  26. package/esm5/components/historical-pix-account/historical-pix-account.component.js +699 -66
  27. package/esm5/components/historical-pix-account/historical-pix-account.module.js +5 -1
  28. package/esm5/components/historical-pix-account/historical-pix-account.service.js +8 -1
  29. package/esm5/components/historical-pix-account-list/historical-pix-account-list.component.js +100 -34
  30. package/esm5/components/shared/index.js +2 -0
  31. package/esm5/components/shared/shared-state.service.js +58 -0
  32. package/esm5/components/utils/format-utils/format-utils.service.js +90 -5
  33. package/esm5/public_api.js +2 -1
  34. package/esm5/senior-gestao-pessoas-payroll-core.js +3 -2
  35. package/fesm2015/senior-gestao-pessoas-payroll-core.js +1330 -499
  36. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  37. package/fesm5/senior-gestao-pessoas-payroll-core.js +1415 -530
  38. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  39. package/locale/en-US.json +1 -1
  40. package/locale/es-ES.json +1 -1
  41. package/locale/pt-BR.json +1 -1
  42. package/package.json +2 -32
  43. package/public_api.d.ts +1 -0
  44. package/senior-gestao-pessoas-payroll-core.d.ts +2 -1
  45. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('primeng/blockui'), require('primeng/progressspinner'), require('@angular/router'), require('@ngx-translate/core'), require('rxjs/operators'), require('primeng/breadcrumb'), require('@angular/common'), require('primeng/dropdown'), require('primeng/inputmask'), require('primeng/inputtext'), require('primeng/shared'), require('@seniorsistemas/angular-components'), require('moment'), require('rxjs'), require('primeng/tooltip'), require('primeng/table'), require('@angular/common/http'), require('primeng/api'), require('@senior-gestao-pessoas/angular-components'), require('ng2-img-cropper'), require('primeng/button'), require('primeng/dialog'), require('primeng/fileupload'), require('chance'), require('moment-business'), require('primeng/autocomplete'), require('primeng/splitbutton'), require('primeng/components/common/messageservice'), require('@seniorsistemas/senior-platform-data'), require('primeng/toast'), require('ng2-currency-mask'), require('primeng/fieldset'), require('primeng/panel'), require('primeng/confirmdialog')) :
3
- typeof define === 'function' && define.amd ? define('@senior-gestao-pessoas/payroll-core', ['exports', '@angular/core', '@angular/forms', 'primeng/blockui', 'primeng/progressspinner', '@angular/router', '@ngx-translate/core', 'rxjs/operators', 'primeng/breadcrumb', '@angular/common', 'primeng/dropdown', 'primeng/inputmask', 'primeng/inputtext', 'primeng/shared', '@seniorsistemas/angular-components', 'moment', 'rxjs', 'primeng/tooltip', 'primeng/table', '@angular/common/http', 'primeng/api', '@senior-gestao-pessoas/angular-components', 'ng2-img-cropper', 'primeng/button', 'primeng/dialog', 'primeng/fileupload', 'chance', 'moment-business', 'primeng/autocomplete', 'primeng/splitbutton', 'primeng/components/common/messageservice', '@seniorsistemas/senior-platform-data', 'primeng/toast', 'ng2-currency-mask', 'primeng/fieldset', 'primeng/panel', 'primeng/confirmdialog'], factory) :
4
- (global = global || self, factory((global['senior-gestao-pessoas'] = global['senior-gestao-pessoas'] || {}, global['senior-gestao-pessoas']['payroll-core'] = {}), global.ng.core, global.ng.forms, global.blockui, global.progressspinner, global.ng.router, global.core$1, global.rxjs.operators, global.breadcrumb, global.ng.common, global.dropdown, global.inputmask, global.inputtext, global.shared, global.angularComponents, global.moment_, global.rxjs, global.tooltip, global.table, global.ng.common.http, global.api, global.angularComponents$1, global.ng2ImgCropper, global.button, global.dialog, global.fileupload, global.chance, global.business, global.autocomplete, global.splitbutton, global.messageservice, global.seniorPlatformData, global.toast, global.ng2CurrencyMask, global.fieldset, global.panel, global.confirmdialog));
5
- }(this, (function (exports, core, forms, blockui, progressspinner, router, core$1, operators, breadcrumb, common, dropdown, inputmask, inputtext, shared, angularComponents, moment_, rxjs, tooltip, table, http, api, angularComponents$1, ng2ImgCropper, button, dialog, fileupload, chance, business, autocomplete, splitbutton, messageservice, seniorPlatformData, toast, ng2CurrencyMask, fieldset, panel, confirmdialog) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('primeng/blockui'), require('primeng/progressspinner'), require('@angular/router'), require('@ngx-translate/core'), require('rxjs/operators'), require('primeng/breadcrumb'), require('@angular/common'), require('primeng/dropdown'), require('primeng/inputmask'), require('primeng/inputtext'), require('primeng/shared'), require('@seniorsistemas/angular-components'), require('moment'), require('rxjs'), require('primeng/tooltip'), require('primeng/table'), require('@angular/common/http'), require('primeng/api'), require('@senior-gestao-pessoas/angular-components'), require('ng2-img-cropper'), require('primeng/button'), require('primeng/dialog'), require('primeng/fileupload'), require('chance'), require('moment-business'), require('primeng/autocomplete'), require('primeng/splitbutton'), require('primeng/components/common/messageservice'), require('@seniorsistemas/senior-platform-data'), require('primeng/toast'), require('ng2-currency-mask'), require('primeng/fieldset'), require('primeng/panel'), require('primeng/confirmdialog'), require('primeng/tabview')) :
3
+ typeof define === 'function' && define.amd ? define('@senior-gestao-pessoas/payroll-core', ['exports', '@angular/core', '@angular/forms', 'primeng/blockui', 'primeng/progressspinner', '@angular/router', '@ngx-translate/core', 'rxjs/operators', 'primeng/breadcrumb', '@angular/common', 'primeng/dropdown', 'primeng/inputmask', 'primeng/inputtext', 'primeng/shared', '@seniorsistemas/angular-components', 'moment', 'rxjs', 'primeng/tooltip', 'primeng/table', '@angular/common/http', 'primeng/api', '@senior-gestao-pessoas/angular-components', 'ng2-img-cropper', 'primeng/button', 'primeng/dialog', 'primeng/fileupload', 'chance', 'moment-business', 'primeng/autocomplete', 'primeng/splitbutton', 'primeng/components/common/messageservice', '@seniorsistemas/senior-platform-data', 'primeng/toast', 'ng2-currency-mask', 'primeng/fieldset', 'primeng/panel', 'primeng/confirmdialog', 'primeng/tabview'], factory) :
4
+ (global = global || self, factory((global['senior-gestao-pessoas'] = global['senior-gestao-pessoas'] || {}, global['senior-gestao-pessoas']['payroll-core'] = {}), global.ng.core, global.ng.forms, global.blockui, global.progressspinner, global.ng.router, global.core$1, global.rxjs.operators, global.breadcrumb, global.ng.common, global.dropdown, global.inputmask, global.inputtext, global.shared, global.angularComponents, global.moment_, global.rxjs, global.tooltip, global.table, global.ng.common.http, global.api, global.angularComponents$1, global.ng2ImgCropper, global.button, global.dialog, global.fileupload, global.chance, global.business, global.autocomplete, global.splitbutton, global.messageservice, global.seniorPlatformData, global.toast, global.ng2CurrencyMask, global.fieldset, global.panel, global.confirmdialog, global.tabview));
5
+ }(this, (function (exports, core, forms, blockui, progressspinner, router, core$1, operators, breadcrumb, common, dropdown, inputmask, inputtext, shared, angularComponents, moment_, rxjs, tooltip, table, http, api, angularComponents$1, ng2ImgCropper, button, dialog, fileupload, chance, business, autocomplete, splitbutton, messageservice, seniorPlatformData, toast, ng2CurrencyMask, fieldset, panel, confirmdialog, tabview) { 'use strict';
6
6
 
7
7
  business = business && business.hasOwnProperty('default') ? business['default'] : business;
8
8
 
@@ -9339,6 +9339,25 @@
9339
9339
  }
9340
9340
  return null;
9341
9341
  };
9342
+ /**
9343
+ * Retorna o CPF formatado
9344
+ * @param cpf CPF
9345
+ */
9346
+ FormatUtilsService.getFormattedCpfEdited = function (cpf) {
9347
+ if (!cpf)
9348
+ return '';
9349
+ cpf = cpf.replace(/\D/g, '').slice(0, 11);
9350
+ if (cpf.length > 9) {
9351
+ cpf = cpf.replace(/^(\d{3})(\d{3})(\d{3})(\d{2})$/, "$1.$2.$3-$4");
9352
+ }
9353
+ else if (cpf.length > 6) {
9354
+ cpf = cpf.replace(/^(\d{3})(\d{3})(\d{0,3})$/, "$1.$2.$3");
9355
+ }
9356
+ else if (cpf.length > 3) {
9357
+ cpf = cpf.replace(/^(\d{3})(\d{0,3})$/, "$1.$2");
9358
+ }
9359
+ return cpf;
9360
+ };
9342
9361
  /**
9343
9362
  * Retorna o CNPJ formatado
9344
9363
  * @param cnpj CNPJ
@@ -9354,6 +9373,28 @@
9354
9373
  }
9355
9374
  return null;
9356
9375
  };
9376
+ /**
9377
+ * Retorna o CNPJ formatado
9378
+ * @param cnpj CNPJ
9379
+ */
9380
+ FormatUtilsService.getFormattedCnpjEdited = function (cnpj) {
9381
+ if (!cnpj)
9382
+ return '';
9383
+ cnpj = cnpj.replace(/\D/g, '').slice(0, 14);
9384
+ if (cnpj.length > 12) {
9385
+ cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5");
9386
+ }
9387
+ else if (cnpj.length > 8) {
9388
+ cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{3})(\d{0,4})$/, "$1.$2.$3/$4");
9389
+ }
9390
+ else if (cnpj.length > 5) {
9391
+ cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{0,3})$/, "$1.$2.$3");
9392
+ }
9393
+ else if (cnpj.length > 2) {
9394
+ cnpj = cnpj.replace(/^(\d{2})(\d{0,3})$/, "$1.$2");
9395
+ }
9396
+ return cnpj;
9397
+ };
9357
9398
  /**
9358
9399
  * Retorna a mascara do CPF/CNPJ
9359
9400
  * @param key Valores possíveis são CPF ou CNPJ
@@ -9368,6 +9409,24 @@
9368
9409
  return "";
9369
9410
  }
9370
9411
  };
9412
+ /**
9413
+ * Método para formatar o número de inscrição do cliente.
9414
+ * @param subscriptionNumber
9415
+ * @param pixKeyType
9416
+ * @returns
9417
+ */
9418
+ FormatUtilsService.getFormattedSubscriptionNumber = function (subscriptionNumber, pixKeyType) {
9419
+ if (!subscriptionNumber || !pixKeyType)
9420
+ return subscriptionNumber;
9421
+ switch (pixKeyType) {
9422
+ case 'CNPJ':
9423
+ return this.getFormattedCnpjEdited(subscriptionNumber);
9424
+ case 'CPF':
9425
+ return this.getFormattedCpfEdited(subscriptionNumber);
9426
+ default:
9427
+ return subscriptionNumber;
9428
+ }
9429
+ };
9371
9430
  /**
9372
9431
  * Metódo para formatar o número de telefone.
9373
9432
  * @param telephoneNumber String contendo o número de telefone.
@@ -9399,6 +9458,13 @@
9399
9458
  }
9400
9459
  return tel;
9401
9460
  };
9461
+ /**
9462
+ * Metódo para formatar a porcentagem para 2 casas decimais.
9463
+ * @param value Número a ser formatado.
9464
+ */
9465
+ FormatUtilsService.getFormattedPercentage = function (value) {
9466
+ return parseFloat(value).toFixed(2).replace('.', ',') + '%';
9467
+ };
9402
9468
  /**
9403
9469
  * Metódo para formatar o número de telefone de um campo Input.
9404
9470
  * @param event Evento do Input do campo de telefone.
@@ -9411,61 +9477,528 @@
9411
9477
  }
9412
9478
  event.target.value = FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9413
9479
  };
9414
- /**
9415
- * Metódo para formatar a porcentagem para 2 casas decimais.
9416
- * @param value Número a ser formatado.
9417
- */
9418
- FormatUtilsService.getFormattedPercentage = function (value) {
9419
- return parseFloat(value).toFixed(2).replace('.', ',') + '%';
9480
+ /**
9481
+ * Formata o campo de input de CPF em tempo real.
9482
+ * @param event Evento do input
9483
+ */
9484
+ FormatUtilsService.formatCpfInputEvent = function (event) {
9485
+ var cpf = event.target.value;
9486
+ console.log("FormatUtilsService.formatCpfInputEvent.cpf: " + cpf);
9487
+ // Permite apagar nos pontos sensíveis
9488
+ if (event.keyCode === 8 && (cpf.length === 4 || cpf.length === 8 || cpf.length === 12)) {
9489
+ return;
9490
+ }
9491
+ event.target.value = FormatUtilsService.getFormattedCpfEdited(cpf);
9492
+ };
9493
+ /**
9494
+ * Formata o campo de input de CNPJ em tempo real.
9495
+ * @param event Evento do input
9496
+ */
9497
+ FormatUtilsService.formatCnpjInputEvent = function (event) {
9498
+ var cnpj = event.target.value;
9499
+ console.log("FormatUtilsService.formatCnpjInputEvent.cnpj: " + cnpj);
9500
+ // Permite apagar nos pontos sensíveis
9501
+ if (event.keyCode === 8 && (cnpj.length === 3 || cnpj.length === 7 || cnpj.length === 11 || cnpj.length === 16)) {
9502
+ return;
9503
+ }
9504
+ event.target.value = FormatUtilsService.getFormattedCnpjEdited(cnpj);
9505
+ };
9506
+ return FormatUtilsService;
9507
+ }());
9508
+
9509
+ var SharedStateService = /** @class */ (function () {
9510
+ function SharedStateService() {
9511
+ this.hideFieldSubject = new rxjs.BehaviorSubject(true);
9512
+ this.hideField$ = this.hideFieldSubject.asObservable();
9513
+ this.showButtonSubject = new rxjs.BehaviorSubject(true);
9514
+ this.showButton$ = this.showButtonSubject.asObservable();
9515
+ this.saveButtonSubject = new rxjs.BehaviorSubject(true);
9516
+ this.saveButton$ = this.saveButtonSubject.asObservable();
9517
+ this.showEditMode = new rxjs.BehaviorSubject(true);
9518
+ this.showEditMode$ = this.showEditMode.asObservable();
9519
+ this.activeValidatorsOnEditModalOpen = new rxjs.Subject();
9520
+ this.activeValidatorsOnEditModalOpen$ = this.activeValidatorsOnEditModalOpen.asObservable();
9521
+ this.hideBtnAddForViewMode = new rxjs.BehaviorSubject(false);
9522
+ this.hideBtnAddForViewMode$ = this.hideBtnAddForViewMode.asObservable();
9523
+ this.activeHideOptionsOnView = new rxjs.BehaviorSubject(true);
9524
+ this.activeHideOptionsOnView$ = this.activeHideOptionsOnView.asObservable();
9525
+ }
9526
+ SharedStateService.prototype.setHideField = function (value) {
9527
+ this.hideFieldSubject.next(value);
9528
+ };
9529
+ SharedStateService.prototype.setShowButton = function (value) {
9530
+ this.showButtonSubject.next(value);
9531
+ };
9532
+ SharedStateService.prototype.setSaveButton = function (value) {
9533
+ this.saveButtonSubject.next(value);
9534
+ };
9535
+ SharedStateService.prototype.setShowEditMode = function (value) {
9536
+ this.showEditMode.next(value);
9537
+ };
9538
+ SharedStateService.prototype.triggerActiveValidatorsOnEditModalOpen = function () {
9539
+ this.activeValidatorsOnEditModalOpen.next();
9540
+ };
9541
+ SharedStateService.prototype.setHideBtnAddForViewMode = function (value) {
9542
+ this.hideBtnAddForViewMode.next(value);
9543
+ };
9544
+ SharedStateService.prototype.resetHideField = function () {
9545
+ this.hideFieldSubject.next(true);
9546
+ };
9547
+ SharedStateService.prototype.setActiveHideOptionsOnView = function (value) {
9548
+ this.activeHideOptionsOnView.next(value);
9549
+ };
9550
+ SharedStateService.prototype.getActiveHideOptionsOnView = function () {
9551
+ return this.activeHideOptionsOnView.getValue();
9552
+ };
9553
+ SharedStateService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function SharedStateService_Factory() { return new SharedStateService(); }, token: SharedStateService, providedIn: "root" });
9554
+ SharedStateService = __decorate([
9555
+ core.Injectable({
9556
+ providedIn: 'root',
9557
+ })
9558
+ ], SharedStateService);
9559
+ return SharedStateService;
9560
+ }());
9561
+
9562
+ var GenericValidator = /** @class */ (function () {
9563
+ function GenericValidator() {
9564
+ }
9565
+ /**
9566
+ * Valida o CEI (Cadastro específico de INSS) digitado.
9567
+ */
9568
+ GenericValidator.isValidCei = function (control) {
9569
+ var cei = control.value;
9570
+ if (!cei)
9571
+ return null;
9572
+ else if (cei.length != 11)
9573
+ return null;
9574
+ var multiplicadorBase = "3298765432";
9575
+ var total = 0;
9576
+ var resto = 0;
9577
+ var multiplicando = 0;
9578
+ var multiplicador = 0;
9579
+ if (cei.length !== 11 ||
9580
+ cei === "00000000000" ||
9581
+ cei === "11111111111" ||
9582
+ cei === "22222222222" ||
9583
+ cei === "33333333333" ||
9584
+ cei === "44444444444" ||
9585
+ cei === "55555555555" ||
9586
+ cei === "66666666666" ||
9587
+ cei === "77777777777" ||
9588
+ cei === "88888888888" ||
9589
+ cei === "99999999999")
9590
+ return { invalidCei: true };
9591
+ else {
9592
+ for (var i = 0; i < 10; i++) {
9593
+ multiplicando = parseInt(cei.substring(i, i + 1), 10);
9594
+ multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
9595
+ total += multiplicando * multiplicador;
9596
+ }
9597
+ resto = 11 - (total % 11);
9598
+ resto = resto === 10 || resto === 11 ? 0 : resto;
9599
+ var digito = parseInt("" + cei.charAt(10), 10);
9600
+ return resto === digito ? null : { invalidCei: true };
9601
+ }
9602
+ };
9603
+ /**
9604
+ * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9605
+ */
9606
+ GenericValidator.isValidCpf = function (control) {
9607
+ var cpf = control.value;
9608
+ if (cpf) {
9609
+ var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9610
+ equalDigits = 1;
9611
+ if (cpf.length < 11) {
9612
+ return null;
9613
+ }
9614
+ for (i = 0; i < cpf.length - 1; i++) {
9615
+ if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9616
+ equalDigits = 0;
9617
+ break;
9618
+ }
9619
+ }
9620
+ if (!equalDigits) {
9621
+ numbers = cpf.substring(0, 9);
9622
+ digits = cpf.substring(9);
9623
+ sum = 0;
9624
+ for (i = 10; i > 1; i--) {
9625
+ sum += numbers.charAt(10 - i) * i;
9626
+ }
9627
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9628
+ if (result !== Number(digits.charAt(0))) {
9629
+ return { cpfNotValid: true };
9630
+ }
9631
+ numbers = cpf.substring(0, 10);
9632
+ sum = 0;
9633
+ for (i = 11; i > 1; i--) {
9634
+ sum += numbers.charAt(11 - i) * i;
9635
+ }
9636
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9637
+ if (result !== Number(digits.charAt(1))) {
9638
+ return { cpfNotValid: true };
9639
+ }
9640
+ return null;
9641
+ }
9642
+ else {
9643
+ return { cpfNotValid: true };
9644
+ }
9645
+ }
9646
+ return null;
9647
+ };
9648
+ /**
9649
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9650
+ */
9651
+ GenericValidator.isValidCnpj = function (control) {
9652
+ var cnpj = control.value;
9653
+ if (cnpj) {
9654
+ var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9655
+ cnpj = cnpj.replace(/[^\d]+/g, '');
9656
+ if (cnpj.length !== 14) {
9657
+ return null;
9658
+ }
9659
+ // Elimina CNPJs invalidos conhecidos
9660
+ if (cnpj === '00000000000000' ||
9661
+ cnpj === '11111111111111' ||
9662
+ cnpj === '22222222222222' ||
9663
+ cnpj === '33333333333333' ||
9664
+ cnpj === '44444444444444' ||
9665
+ cnpj === '55555555555555' ||
9666
+ cnpj === '66666666666666' ||
9667
+ cnpj === '77777777777777' ||
9668
+ cnpj === '88888888888888' ||
9669
+ cnpj === '99999999999999') {
9670
+ return { cnpjNotValid: true };
9671
+ }
9672
+ // Valida DVs
9673
+ size = cnpj.length - 2;
9674
+ numbers = cnpj.substring(0, size);
9675
+ digits = cnpj.substring(size);
9676
+ sum = 0;
9677
+ pos = size - 7;
9678
+ for (var i = size; i >= 1; i--) {
9679
+ sum += numbers.charAt(size - i) * pos--;
9680
+ if (pos < 2) {
9681
+ pos = 9;
9682
+ }
9683
+ }
9684
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9685
+ if (result !== Number(digits.charAt(0))) {
9686
+ return { cnpjNotValid: true };
9687
+ }
9688
+ size = size + 1;
9689
+ numbers = cnpj.substring(0, size);
9690
+ sum = 0;
9691
+ pos = size - 7;
9692
+ for (var i = size; i >= 1; i--) {
9693
+ sum += numbers.charAt(size - i) * pos--;
9694
+ if (pos < 2) {
9695
+ pos = 9;
9696
+ }
9697
+ }
9698
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9699
+ if (result !== Number(digits.charAt(1))) {
9700
+ return { cnpjNotValid: true };
9701
+ }
9702
+ return null;
9703
+ }
9704
+ return null;
9705
+ };
9706
+ /**
9707
+ * Válida o número de telefone da chave PIX.
9708
+ */
9709
+ GenericValidator.isValidPhoneNumber = function (control) {
9710
+ var cellPhoneKey = control.value || '';
9711
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9712
+ var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9713
+ var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9714
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9715
+ };
9716
+ /**
9717
+ * Valida o email da chave PIX.
9718
+ */
9719
+ GenericValidator.isValidEmail = function (control) {
9720
+ var emailKey = control.value;
9721
+ var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9722
+ var isValidEmail = regexValidEmail.test(emailKey);
9723
+ return isValidEmail ? null : { invalidEmail: true };
9724
+ };
9725
+ return GenericValidator;
9726
+ }());
9727
+
9728
+ var HistoricakPixAccountBase = /** @class */ (function () {
9729
+ function HistoricakPixAccountBase(formBuilder) {
9730
+ this._paramsForm = new forms.FormGroup({});
9731
+ this._defaultCpfNumber = null;
9732
+ this.initialValidatorOfPercentage = [forms.Validators.required, forms.Validators.min(0.01)];
9733
+ this.pixAccountList = [];
9734
+ this.maxValuePercentage = 100.0;
9735
+ this.isShowPixKeyFieldValidatorMessage = false;
9736
+ this.formBuilder = formBuilder;
9737
+ this.createFormGroupBase();
9738
+ }
9739
+ HistoricakPixAccountBase.prototype.phoneMask = function (event) {
9740
+ FormatUtilsService.formatTelephoneInputEvent(event);
9741
+ };
9742
+ HistoricakPixAccountBase.prototype.cpfMask = function (event) {
9743
+ FormatUtilsService.formatCpfInputEvent(event);
9744
+ };
9745
+ HistoricakPixAccountBase.prototype.cnpjMask = function (event) {
9746
+ FormatUtilsService.formatCnpjInputEvent(event);
9747
+ };
9748
+ HistoricakPixAccountBase.prototype.onChangePixKeyType = function (item, form) {
9749
+ if (!item || !item.key)
9750
+ return;
9751
+ this.pixKeyType = item.key;
9752
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9753
+ ? form
9754
+ : this.pixAccountFormGroup;
9755
+ this.isShowPixKeyFieldValidatorMessage = true;
9756
+ var pixKeyControl = targetForm.get("pixKey");
9757
+ if (pixKeyControl) {
9758
+ pixKeyControl.reset();
9759
+ }
9760
+ this.setPixKeyValidators(true, targetForm);
9761
+ if (item.key === "CPF") {
9762
+ this.setDefaultCpfPixKey(targetForm);
9763
+ }
9764
+ };
9765
+ HistoricakPixAccountBase.prototype.onClearPixKeyType = function (form) {
9766
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9767
+ ? form
9768
+ : this.pixAccountFormGroup;
9769
+ this.isShowPixKeyFieldValidatorMessage = false;
9770
+ if (targetForm.get("pixKey")) {
9771
+ targetForm.get("pixKey").reset();
9772
+ }
9773
+ };
9774
+ HistoricakPixAccountBase.prototype.setDefaultCpfPixKey = function (form) {
9775
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9776
+ ? form
9777
+ : this.pixAccountFormGroup;
9778
+ if (this._defaultCpfNumber) {
9779
+ if (targetForm.get("pixKey")) {
9780
+ targetForm.get("pixKey").setValue(this._defaultCpfNumber);
9781
+ }
9782
+ }
9783
+ else {
9784
+ var sheetDocument = this._paramsForm.get("sheetDocument");
9785
+ if (sheetDocument && sheetDocument.get("cpfNumber")) {
9786
+ var cpf = sheetDocument.get("cpfNumber").value;
9787
+ if (cpf && targetForm.get("pixKey")) {
9788
+ targetForm.get("pixKey").setValue(cpf);
9789
+ }
9790
+ }
9791
+ }
9792
+ };
9793
+ HistoricakPixAccountBase.prototype.createFormGroupBase = function () {
9794
+ this.pixAccountFormGroup = this.formBuilder.group({
9795
+ id: this.formBuilder.control(null),
9796
+ index: this.formBuilder.control(null),
9797
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9798
+ dateChange: this.formBuilder.control(null),
9799
+ pixKeyType: this.formBuilder.control(null, forms.Validators.required),
9800
+ pixKey: this.formBuilder.control(null),
9801
+ percentage: this.formBuilder.control(null, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9802
+ forms.Validators.max(this.maxValuePercentage),
9803
+ ]))),
9804
+ externalId: this.formBuilder.control(null),
9805
+ customFields: this.formBuilder.control(null),
9806
+ });
9807
+ };
9808
+ HistoricakPixAccountBase.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode, form) {
9809
+ if (index === void 0) { index = null; }
9810
+ if (isEditMode === void 0) { isEditMode = true; }
9811
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9812
+ ? form
9813
+ : this.pixAccountFormGroup;
9814
+ this.pixAccountList = (pixAccountList && pixAccountList.length > 0)
9815
+ ? [].concat(pixAccountList)
9816
+ : [];
9817
+ var percentageIncluded = [];
9818
+ for (var i = 0; i < this.pixAccountList.length; i++) {
9819
+ var field = this.pixAccountList[i];
9820
+ if (field && field.percentage && i !== index) {
9821
+ percentageIncluded.push(field.percentage);
9822
+ }
9823
+ }
9824
+ this.beforeSetPixKeyTypeValidator(targetForm);
9825
+ this.setPixKeyValidators(isEditMode, targetForm);
9826
+ this.validatePercentageValid(percentageIncluded, targetForm);
9827
+ };
9828
+ HistoricakPixAccountBase.prototype.beforeSetPixKeyTypeValidator = function (form) {
9829
+ var control = form.get("pixKeyType");
9830
+ if (this.pixAccountList && this.pixAccountList.length) {
9831
+ control.setValidators(forms.Validators.compose([
9832
+ forms.Validators.required,
9833
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
9834
+ ]));
9835
+ }
9836
+ else {
9837
+ control.setValidators(forms.Validators.required);
9838
+ }
9839
+ control.updateValueAndValidity();
9840
+ };
9841
+ HistoricakPixAccountBase.prototype.setPixKeyValidators = function (isEditMode, form) {
9842
+ var pixKey = form.get("pixKey");
9843
+ switch (this.pixKeyType) {
9844
+ case "TELEPHONE":
9845
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidPhoneNumber]));
9846
+ break;
9847
+ case "EMAIL":
9848
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidEmail]));
9849
+ break;
9850
+ case "CPF":
9851
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidCpf]));
9852
+ break;
9853
+ case "CNPJ":
9854
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidCnpj]));
9855
+ break;
9856
+ case "RANDOM_KEY":
9857
+ pixKey.setValidators(forms.Validators.required);
9858
+ break;
9859
+ case "BANK_ACCOUNT":
9860
+ pixKey.clearValidators();
9861
+ pixKey.setValue('');
9862
+ break;
9863
+ default:
9864
+ pixKey.clearValidators();
9865
+ }
9866
+ if (this.pixKeyType === "BANK_ACCOUNT") {
9867
+ pixKey.disable();
9868
+ }
9869
+ else if (isEditMode) {
9870
+ pixKey.enable();
9871
+ }
9872
+ pixKey.updateValueAndValidity();
9873
+ };
9874
+ HistoricakPixAccountBase.prototype.validatePercentageValid = function (listValue, form) {
9875
+ var percentage = form.get("percentage");
9876
+ this.maxValuePercentage = listValue.reduce(function (acc, val) { return acc - val; }, 100.0);
9877
+ percentage.setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9878
+ forms.Validators.max(this.maxValuePercentage),
9879
+ ])));
9880
+ percentage.updateValueAndValidity();
9881
+ };
9882
+ HistoricakPixAccountBase.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
9883
+ return function (control) {
9884
+ var value = control.value;
9885
+ var isDuplicate = listCompare.some(function (field) {
9886
+ return value &&
9887
+ field.pixKeyType.key === "BANK_ACCOUNT" &&
9888
+ value.key === "BANK_ACCOUNT";
9889
+ });
9890
+ return isDuplicate ? { pixKeyTypeBankAccountDuplicate: true } : null;
9891
+ };
9892
+ };
9893
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "paramsForm", {
9894
+ get: function () {
9895
+ return this._paramsForm;
9896
+ },
9897
+ set: function (value) {
9898
+ this._paramsForm = value;
9899
+ },
9900
+ enumerable: true,
9901
+ configurable: true
9902
+ });
9903
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "defaultCpfNumber", {
9904
+ get: function () {
9905
+ return this._defaultCpfNumber;
9906
+ },
9907
+ set: function (value) {
9908
+ this._defaultCpfNumber = value;
9909
+ },
9910
+ enumerable: true,
9911
+ configurable: true
9912
+ });
9913
+ return HistoricakPixAccountBase;
9914
+ }());
9915
+
9916
+ var HistoricalPixAccountService = /** @class */ (function () {
9917
+ function HistoricalPixAccountService(http) {
9918
+ this.http = http;
9919
+ }
9920
+ HistoricalPixAccountService.prototype.query = function (path, body, service) {
9921
+ if (service === void 0) { service = exports.ServiceType.PAYROLL; }
9922
+ return this.http.query(path, body, service);
9923
+ };
9924
+ HistoricalPixAccountService.prototype.enumQuery = function () {
9925
+ var path = 'enumQuery';
9926
+ var body = {
9927
+ names: ['PixKeyType']
9928
+ };
9929
+ return this.http.query(path, body, exports.ServiceType.PAYROLL);
9420
9930
  };
9421
- return FormatUtilsService;
9931
+ HistoricalPixAccountService.ctorParameters = function () { return [
9932
+ { type: HttpClientService }
9933
+ ]; };
9934
+ HistoricalPixAccountService = __decorate([
9935
+ core.Injectable()
9936
+ ], HistoricalPixAccountService);
9937
+ return HistoricalPixAccountService;
9422
9938
  }());
9423
9939
 
9424
- var HistoricalPixAccountComponent = /** @class */ (function () {
9425
- function HistoricalPixAccountComponent(translateService, cd, formBuilder, messageService) {
9426
- var _this = this;
9427
- this.translateService = translateService;
9428
- this.cd = cd;
9429
- this.formBuilder = formBuilder;
9430
- this.messageService = messageService;
9431
- this.recordByRow = 1;
9432
- this.showDateChange = false;
9433
- this.isEditMode = false;
9434
- this.isViewMode = false;
9435
- this.withSideBar = true;
9436
- this.defaultCpfNumber = null;
9437
- this.listDataReciever = [];
9438
- this.isViewModeActive = new core.EventEmitter();
9439
- this.isEditModeActive = new core.EventEmitter();
9440
- this.isDeleteModeActive = new core.EventEmitter();
9441
- this.listFromApp = [];
9442
- this.visibleChange = new core.EventEmitter();
9443
- this.ngUnsubscribe = new rxjs.Subject();
9444
- this.orderBy = {
9940
+ var HistoricalPixAccountComponent = /** @class */ (function (_super) {
9941
+ __extends(HistoricalPixAccountComponent, _super);
9942
+ function HistoricalPixAccountComponent(translateService, cd, formBuilder, sharedStateService, service) {
9943
+ var _this = _super.call(this, formBuilder) || this;
9944
+ _this.translateService = translateService;
9945
+ _this.cd = cd;
9946
+ _this.sharedStateService = sharedStateService;
9947
+ _this.service = service;
9948
+ _this.recordByRow = 1;
9949
+ _this.showDateChange = false;
9950
+ _this.isEditMode = false;
9951
+ _this.isViewMode = false;
9952
+ _this.withSideBar = true;
9953
+ _this.listDataReciever = [];
9954
+ _this.addExistentHistoricData = [];
9955
+ _this.getListPixAccount = [];
9956
+ _this.isEditModeForSave = false;
9957
+ _this.showField = false;
9958
+ _this.hideBtnAddForViewMode = false;
9959
+ _this.showButtonView = true;
9960
+ _this.isViewModeActive = new core.EventEmitter();
9961
+ _this.isEditModeActive = new core.EventEmitter();
9962
+ _this.isDeleteModeActive = new core.EventEmitter();
9963
+ _this.isValidChangeForm = new core.EventEmitter();
9964
+ _this.listFromApp = [];
9965
+ _this.visibleChange = new core.EventEmitter();
9966
+ _this.ngUnsubscribe = new rxjs.Subject();
9967
+ _this.orderBy = {
9445
9968
  field: "dateChange",
9446
9969
  direction: exports.DirectionEnumeration.DESC,
9447
9970
  };
9448
- this.pixAccountItemInput = {};
9449
- this.totalRecords = 0;
9450
- this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9451
- this.loading = true;
9452
- this.listData = [];
9453
- this.listDataNoPage = [];
9454
- this.cols = [
9971
+ _this.pixAccountItemInput = {};
9972
+ _this.totalRecords = 0;
9973
+ _this.actionLabel = _this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9974
+ _this.loading = true;
9975
+ _this.listData = [];
9976
+ _this.listDataNoPage = [];
9977
+ _this.showEditMode = false;
9978
+ _this.hasRecordsPix = true;
9979
+ _this.hideFields = _this.sharedStateService.hideField$;
9980
+ _this.suggestions = [];
9981
+ _this.formGroupByRow = {};
9982
+ _this.isSyncingPercentage = false;
9983
+ _this.cols = [
9455
9984
  {
9456
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9985
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9457
9986
  field: "pixKeyType",
9458
9987
  },
9459
9988
  {
9460
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9989
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9461
9990
  field: "pixKey",
9462
9991
  },
9463
9992
  {
9464
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9993
+ label: _this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9465
9994
  field: "percentage",
9466
9995
  },
9996
+ {
9997
+ label: _this.translateService.instant("hcm.payroll.movimentation_generic_action"),
9998
+ field: "actions",
9999
+ }
9467
10000
  ];
9468
- this.actions = function (rowData, key) {
10001
+ _this.actions = function (rowData, key) {
9469
10002
  if (rowData === void 0) { rowData = {}; }
9470
10003
  return [
9471
10004
  {
@@ -9502,7 +10035,7 @@
9502
10035
  },
9503
10036
  },
9504
10037
  {
9505
- visible: !_this.isEditMode,
10038
+ visible: !_this.isEditMode || _this.showEditMode,
9506
10039
  label: _this.translateService.instant("hcm.payroll.delete"),
9507
10040
  command: function () {
9508
10041
  if (_this.isAllowToDeleteHistorical) {
@@ -9520,15 +10053,49 @@
9520
10053
  },
9521
10054
  ];
9522
10055
  };
9523
- this.createFormGroup();
10056
+ _this.createFormGroup();
10057
+ return _this;
9524
10058
  }
9525
10059
  HistoricalPixAccountComponent.prototype.ngOnInit = function () {
10060
+ var _this = this;
10061
+ this.showFields = this.showField;
9526
10062
  this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
10063
+ this.sharedStateService.showEditMode$.subscribe(function (value) {
10064
+ _this.showEditMode = value;
10065
+ _this.isEditModeForSave = value;
10066
+ });
10067
+ this.sharedStateService.activeHideOptionsOnView$.subscribe(function (value) {
10068
+ if (value) {
10069
+ _this.showButtonView = false;
10070
+ }
10071
+ });
10072
+ this.sharedStateService.activeValidatorsOnEditModalOpen$
10073
+ .subscribe(function () {
10074
+ Object.values(_this.formGroupByRow).forEach(function (fg) {
10075
+ Object.values(fg.controls).forEach(function (control) {
10076
+ control.markAsTouched();
10077
+ control.updateValueAndValidity();
10078
+ });
10079
+ });
10080
+ _this.emitFormValidity();
10081
+ });
10082
+ this.resetFormState();
9527
10083
  };
9528
10084
  HistoricalPixAccountComponent.prototype.ngOnChanges = function (changes) {
9529
10085
  if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
9530
10086
  this.listFromApp = changes['listDataReciever'].currentValue;
9531
10087
  }
10088
+ if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
10089
+ this.getHistoricalPixAccountList();
10090
+ }
10091
+ if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
10092
+ var newData = changes['addExistentHistoricData'].currentValue;
10093
+ this.rebuildFormGroupMap(newData);
10094
+ }
10095
+ if (changes['isEditMode']) {
10096
+ this.isEditMode = changes['isEditMode'].currentValue;
10097
+ this.cd.detectChanges();
10098
+ }
9532
10099
  };
9533
10100
  HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9534
10101
  this.historicalPixAccountList = this.formBuilder.group({
@@ -9542,6 +10109,122 @@
9542
10109
  HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9543
10110
  this.cd.detectChanges();
9544
10111
  };
10112
+ HistoricalPixAccountComponent.prototype.emitFormValidity = function () {
10113
+ if (!this.formGroupByRow || Object.keys(this.formGroupByRow).length === 0) {
10114
+ this.isValidChangeForm.emit(false);
10115
+ return;
10116
+ }
10117
+ var allValid = true;
10118
+ Object.values(this.formGroupByRow).forEach(function (fg) {
10119
+ // Verifica cada controle individualmente
10120
+ Object.keys(fg.controls).forEach(function (key) {
10121
+ var control = fg.get(key);
10122
+ // Verifica se o controle é obrigatório e está vazio
10123
+ if (control.validator && control.validator({})) {
10124
+ var validatorFn = control.validator({});
10125
+ if (validatorFn && validatorFn.required && !control.value) {
10126
+ allValid = false;
10127
+ }
10128
+ }
10129
+ // Verifica se o controle tem erros
10130
+ if (control.errors) {
10131
+ allValid = false;
10132
+ }
10133
+ });
10134
+ fg.updateValueAndValidity();
10135
+ if (!fg.valid) {
10136
+ allValid = false;
10137
+ }
10138
+ });
10139
+ this.isValidChangeForm.emit(allValid);
10140
+ };
10141
+ HistoricalPixAccountComponent.prototype.filterPixKeyType = function (event) {
10142
+ var _this = this;
10143
+ var query = event.query;
10144
+ this.service.enumQuery().subscribe(function (response) {
10145
+ var pixKeyTypeEnum = response.results.find(function (result) { return result.enumName === 'PixKeyType'; });
10146
+ if (pixKeyTypeEnum) {
10147
+ _this.suggestions = pixKeyTypeEnum.items.filter(function (item) {
10148
+ return item.value.toLowerCase().includes(query.toLowerCase());
10149
+ });
10150
+ }
10151
+ else {
10152
+ _this.suggestions = [];
10153
+ }
10154
+ });
10155
+ };
10156
+ HistoricalPixAccountComponent.prototype.createPixRowFormGroup = function () {
10157
+ return this.formBuilder.group({
10158
+ id: [null],
10159
+ pixKeyType: [null, forms.Validators.required],
10160
+ pixKey: [null],
10161
+ percentage: [0, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10162
+ forms.Validators.max(this.maxValuePercentage),
10163
+ ]))],
10164
+ externalId: [null],
10165
+ });
10166
+ };
10167
+ /**
10168
+ * Sincroniza todos os dados do NgModel para os FormGroups antes de enviar ao componente pai
10169
+ */
10170
+ HistoricalPixAccountComponent.prototype.syncPixDataToParentForm = function () {
10171
+ this.syncAllModelToForm();
10172
+ var historicalPix = __spread(this.addExistentHistoricData);
10173
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(historicalPix);
10174
+ if (this.formGroup) {
10175
+ this.formGroup.get(this.fieldFormGroup).patchValue({
10176
+ historicalPixAccountList: historicalPix
10177
+ });
10178
+ }
10179
+ };
10180
+ HistoricalPixAccountComponent.prototype.syncResetPixFormToParent = function () {
10181
+ this.formGroupByRow = {};
10182
+ this.historicalPixAccountList.reset();
10183
+ this.historicalPixAccountList.get('historicalPixAccountList').setValue([]);
10184
+ if (this.addExistentHistoricData.length) {
10185
+ this.rebuildFormGroupMap(this.addExistentHistoricData);
10186
+ }
10187
+ };
10188
+ /**
10189
+ * Valida todos os formulários
10190
+ */
10191
+ HistoricalPixAccountComponent.prototype.validateAllForms = function () {
10192
+ var _this = this;
10193
+ this.forceCloseAllCellEditors();
10194
+ this.syncAllModelToForm();
10195
+ if (!this.formGroupByRow || Object.keys(this.formGroupByRow).length === 0) {
10196
+ return true;
10197
+ }
10198
+ var isAllValid = true;
10199
+ Object.keys(this.formGroupByRow).forEach(function (indexKey) {
10200
+ var index = Number(indexKey);
10201
+ var form = _this.formGroupByRow[index];
10202
+ if (form) {
10203
+ Object.keys(form.controls).forEach(function (controlName) {
10204
+ var control = form.get(controlName);
10205
+ control.markAsTouched();
10206
+ if (controlName === 'pixKey') {
10207
+ var pixKeyTypeControl = form.get('pixKeyType');
10208
+ if (pixKeyTypeControl.value) {
10209
+ _this.validateDocumentField(index, pixKeyTypeControl.value.key);
10210
+ }
10211
+ }
10212
+ });
10213
+ form.updateValueAndValidity();
10214
+ if (form.invalid) {
10215
+ isAllValid = false;
10216
+ }
10217
+ }
10218
+ });
10219
+ if (isAllValid && this.addExistentHistoricData && this.addExistentHistoricData.length > 0) {
10220
+ var totalPercentage = this.addExistentHistoricData.reduce(function (sum, item) { return sum + (parseFloat(item.percentage) || 0); }, 0);
10221
+ if (Math.abs(totalPercentage - 100) > 0.01) {
10222
+ isAllValid = false;
10223
+ }
10224
+ }
10225
+ this.isValidChangeForm.emit(isAllValid);
10226
+ return isAllValid;
10227
+ };
9545
10228
  HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
9546
10229
  var _this = this;
9547
10230
  var first = event && event.first ? event.first : 0;
@@ -9569,6 +10252,7 @@
9569
10252
  this.refreshCssInIE11();
9570
10253
  }
9571
10254
  this.loading = false;
10255
+ this.cd.detectChanges();
9572
10256
  };
9573
10257
  /**
9574
10258
  * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
@@ -9586,12 +10270,86 @@
9586
10270
  this.pixAccountItemInput = {};
9587
10271
  this.visible = true;
9588
10272
  };
9589
- HistoricalPixAccountComponent.prototype.isNotAllowMessage = function () {
9590
- this.messageService.add({
9591
- severity: "error",
9592
- summary: this.translateService.instant("hcm.payroll.error"),
9593
- detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
10273
+ HistoricalPixAccountComponent.prototype.addPix = function () {
10274
+ var newItem = {
10275
+ id: null,
10276
+ pixKeyType: {},
10277
+ pixKey: '',
10278
+ percentage: '',
10279
+ externalId: '',
10280
+ };
10281
+ var index = this.addExistentHistoricData.length;
10282
+ this.addExistentHistoricData = __spread(this.addExistentHistoricData, [
10283
+ newItem
10284
+ ]);
10285
+ this.formGroupByRow[index] = this.createPixRowFormGroup();
10286
+ this.setValidatorsAccordingList(this.addExistentHistoricData, index, true);
10287
+ this.emitFormValidity();
10288
+ };
10289
+ HistoricalPixAccountComponent.prototype.deletePix = function (index) {
10290
+ var _this = this;
10291
+ if (this.dataListPix.editingCell) {
10292
+ this.dataListPix.editingCell = null;
10293
+ }
10294
+ this.addExistentHistoricData = this.addExistentHistoricData.filter(function (_, i) { return i !== index; });
10295
+ var currentList = this.historicalPixAccountList.get("historicalPixAccountList").value || [];
10296
+ var updatedList = currentList.filter(function (_, i) { return i !== index; });
10297
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(updatedList);
10298
+ if (this.formGroup) {
10299
+ this.formGroup.get(this.fieldFormGroup).patchValue({
10300
+ historicalPixAccountList: updatedList
10301
+ });
10302
+ }
10303
+ this.rebuildFormGroupMap(this.addExistentHistoricData);
10304
+ this.addExistentHistoricData.forEach(function (_, i) {
10305
+ if (_this.formGroupByRow[i]) {
10306
+ var allValues = _this.addExistentHistoricData
10307
+ .map(function (item, idx) { return idx === i ? 0 : (parseFloat(item.percentage) || 0); });
10308
+ _this.validatePercentageValid(allValues, _this.formGroupByRow[i]);
10309
+ }
9594
10310
  });
10311
+ this.emitFormValidity();
10312
+ };
10313
+ HistoricalPixAccountComponent.prototype.rebuildFormGroupMap = function (data) {
10314
+ var _this = this;
10315
+ this.formGroupByRow = {};
10316
+ data.forEach(function (item, index) {
10317
+ var form = _this.createPixRowFormGroup();
10318
+ var pixKeyType = item.pixKeyType.key;
10319
+ var pixKeyRaw = item.pixKey;
10320
+ if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ') {
10321
+ item.pixKey = FormatUtilsService.getFormattedSubscriptionNumber(pixKeyRaw, pixKeyType);
10322
+ }
10323
+ if (pixKeyType === 'TELEPHONE') {
10324
+ item.pixKey = FormatUtilsService.getFormattedTelephoneNumber(pixKeyRaw);
10325
+ }
10326
+ form.patchValue(item);
10327
+ _this.formGroupByRow[index] = form;
10328
+ _this.pixKeyType = pixKeyType;
10329
+ _this.setPixKeyValidators(true, form);
10330
+ _this.setValidatorsAccordingList(data, index, _this.isEditMode);
10331
+ var listValues = data
10332
+ .filter(function (_, i) { return i !== index; })
10333
+ .map(function (row) { return row.percentage ? parseFloat(row.percentage) : 0; });
10334
+ _this.validatePercentageValid(listValues, form);
10335
+ });
10336
+ this.emitFormValidity();
10337
+ };
10338
+ HistoricalPixAccountComponent.prototype.onPixKeyTypeChange = function (item, index) {
10339
+ var _this = this;
10340
+ var form = this.formGroupByRow[index];
10341
+ this.onChangePixKeyType(item, form);
10342
+ this.addExistentHistoricData[index].pixKey = '';
10343
+ setTimeout(function () {
10344
+ if (_this.dataListPix.editingCell) {
10345
+ _this.dataListPix.editingCell = null;
10346
+ }
10347
+ });
10348
+ this.cd.detectChanges();
10349
+ };
10350
+ HistoricalPixAccountComponent.prototype.onPixKeyTypeClear = function (index) {
10351
+ var form = this.formGroupByRow[index];
10352
+ this.onClearPixKeyType(form);
9595
10353
  };
9596
10354
  HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
9597
10355
  var newlist = __spread(this.getHistoricalPixAccountList());
@@ -9624,6 +10382,7 @@
9624
10382
  }
9625
10383
  $event["dateChange"] = this.dateChange;
9626
10384
  newDataList.push($event);
10385
+ this.addExistentHistoricData.push(__assign({}, $event));
9627
10386
  }
9628
10387
  this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9629
10388
  this.verifyTotalPercentage();
@@ -9653,6 +10412,368 @@
9653
10412
  this.msgTotalLimitByPercentage = null;
9654
10413
  }
9655
10414
  };
10415
+ HistoricalPixAccountComponent.prototype.formatPercentage = function (value) {
10416
+ if (value == null || value === '' || isNaN(Number(value))) {
10417
+ return '0.00';
10418
+ }
10419
+ return Number(value).toFixed(2);
10420
+ };
10421
+ HistoricalPixAccountComponent.prototype.onSyncValue = function (field, index) {
10422
+ var _this = this;
10423
+ if (this.formGroupByRow &&
10424
+ this.formGroupByRow[index] &&
10425
+ this.formGroupByRow[index].get(field)) {
10426
+ var control = this.formGroupByRow[index].get(field);
10427
+ var value = control.value;
10428
+ this.addExistentHistoricData[index][field] = value;
10429
+ control.markAsDirty();
10430
+ control.markAsTouched();
10431
+ if (field === 'percentage') {
10432
+ var currentList = this.addExistentHistoricData
10433
+ .map(function (item, i) { return i === index ? 0 : (parseFloat(item.percentage) || 0); });
10434
+ this.validatePercentageValid(currentList, this.formGroupByRow[index]);
10435
+ if (!this.isSyncingPercentage) {
10436
+ this.isSyncingPercentage = true;
10437
+ setTimeout(function () {
10438
+ _this.syncPixDataToParentForm();
10439
+ _this.isSyncingPercentage = false;
10440
+ }, 0);
10441
+ }
10442
+ }
10443
+ control.updateValueAndValidity();
10444
+ this.formGroupByRow[index].updateValueAndValidity();
10445
+ this.emitFormValidity();
10446
+ }
10447
+ };
10448
+ HistoricalPixAccountComponent.prototype.close = function () {
10449
+ this.visible = false;
10450
+ };
10451
+ HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
10452
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
10453
+ };
10454
+ HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
10455
+ return FormatUtilsService.getFormattedCpf(cpf);
10456
+ };
10457
+ HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
10458
+ return FormatUtilsService.getFormattedCnpj(cnpj);
10459
+ };
10460
+ HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
10461
+ return FormatUtilsService.getFormattedPercentage(value);
10462
+ };
10463
+ /**
10464
+ * Reseta completamente o estado do formulário e controles
10465
+ */
10466
+ HistoricalPixAccountComponent.prototype.resetFormState = function () {
10467
+ if (this.formGroupByRow) {
10468
+ Object.values(this.formGroupByRow).forEach(function (form) {
10469
+ if (form) {
10470
+ Object.keys(form.controls).forEach(function (controlName) {
10471
+ var control = form.get(controlName);
10472
+ if (control) {
10473
+ control.setErrors(null);
10474
+ control.markAsUntouched();
10475
+ control.markAsPristine();
10476
+ }
10477
+ });
10478
+ form.updateValueAndValidity();
10479
+ }
10480
+ });
10481
+ }
10482
+ if (this.dataListPix) {
10483
+ if (typeof this.dataListPix.closeAllCellEditors === 'function') {
10484
+ try {
10485
+ this.dataListPix.closeAllCellEditors();
10486
+ }
10487
+ catch (e) {
10488
+ console.error('Erro ao tentar fechar cell editors:', e);
10489
+ }
10490
+ }
10491
+ else if (this.dataListPix.editingCell) {
10492
+ this.dataListPix.editingCell = null;
10493
+ }
10494
+ if (this.dataListPix.editing !== undefined) {
10495
+ this.dataListPix.editing = false;
10496
+ }
10497
+ }
10498
+ this.cd.detectChanges();
10499
+ };
10500
+ /**
10501
+ * Formata a chave PIX para exibição baseada no tipo
10502
+ */
10503
+ HistoricalPixAccountComponent.prototype.getFormattedPixKey = function (pixKeyType, pixKey) {
10504
+ if (!pixKey)
10505
+ return '';
10506
+ switch (pixKeyType) {
10507
+ case 'CPF':
10508
+ return FormatUtilsService.getFormattedCpf(pixKey);
10509
+ case 'CNPJ':
10510
+ return FormatUtilsService.getFormattedCnpj(pixKey);
10511
+ case 'TELEPHONE':
10512
+ return FormatUtilsService.getFormattedTelephoneNumber(pixKey);
10513
+ case 'EMAIL':
10514
+ case 'RANDOM_KEY':
10515
+ default:
10516
+ return pixKey;
10517
+ }
10518
+ };
10519
+ /**
10520
+ * Obtém o tipo de chave PIX do item atual
10521
+ */
10522
+ HistoricalPixAccountComponent.prototype.getPixKeyType = function (item) {
10523
+ return item && item.pixKeyType && item.pixKeyType.key || '';
10524
+ };
10525
+ /**
10526
+ * Verifica se um controle está inválido para os campos editáveis
10527
+ */
10528
+ HistoricalPixAccountComponent.prototype.isInvalid = function (index, controlName) {
10529
+ var form = this.formGroupByRow[index];
10530
+ if (!form)
10531
+ return false;
10532
+ var control = form.get(controlName);
10533
+ if (!control)
10534
+ return false;
10535
+ return control.invalid && (control.touched || control.dirty);
10536
+ };
10537
+ /**
10538
+ * Método chamado quando uma célula entra no modo de edição
10539
+ */
10540
+ HistoricalPixAccountComponent.prototype.onCellEditInit = function (event) {
10541
+ var rowIndex = this.addExistentHistoricData.findIndex(function (item) { return item === event.data; });
10542
+ if (rowIndex < 0)
10543
+ return;
10544
+ var form = this.formGroupByRow[rowIndex];
10545
+ if (form && form.get('pixKey')) {
10546
+ var pixKeyControl = form.get('pixKey');
10547
+ var currentValue = this.addExistentHistoricData[rowIndex].pixKey;
10548
+ pixKeyControl.setValue(currentValue);
10549
+ }
10550
+ };
10551
+ /**
10552
+ * Recupera o FormControl específico para um campo em determinado índice
10553
+ */
10554
+ HistoricalPixAccountComponent.prototype.getFormControl = function (index, controlName) {
10555
+ var form = this.formGroupByRow[index];
10556
+ if (!form)
10557
+ return null;
10558
+ return form.get(controlName);
10559
+ };
10560
+ /**
10561
+ * Valida campos de documento (CPF, CNPJ) quando o usuário termina de digitar no form de edição
10562
+ */
10563
+ HistoricalPixAccountComponent.prototype.validateDocumentField = function (index, fieldType) {
10564
+ var _a;
10565
+ var form = this.formGroupByRow[index];
10566
+ var item = this.addExistentHistoricData[index];
10567
+ if (!form || !item)
10568
+ return;
10569
+ var pixKeyControl = form.get('pixKey');
10570
+ if (!pixKeyControl)
10571
+ return;
10572
+ var value = item.pixKey;
10573
+ pixKeyControl.setValue(value);
10574
+ if (fieldType === 'CPF' || fieldType === 'CNPJ' || fieldType === 'TELEPHONE') {
10575
+ value = value ? value.toString().replace(/\D/g, '') : '';
10576
+ item.pixKey = value;
10577
+ pixKeyControl.setValue(value);
10578
+ }
10579
+ if (!value || value.toString().trim() === '') {
10580
+ pixKeyControl.setErrors({ required: true });
10581
+ pixKeyControl.markAsTouched();
10582
+ form.updateValueAndValidity();
10583
+ this.emitFormValidity();
10584
+ return;
10585
+ }
10586
+ var cleanValue = value;
10587
+ if (fieldType === 'CPF' || fieldType === 'CNPJ') {
10588
+ cleanValue = value.toString().replace(/\D/g, '');
10589
+ item.pixKey = cleanValue;
10590
+ pixKeyControl.setValue(cleanValue);
10591
+ }
10592
+ var isValid = false;
10593
+ switch (fieldType) {
10594
+ case 'CPF':
10595
+ isValid = cleanValue.length === 11 && GenericValidator.isValidCpf({ value: cleanValue }) === null;
10596
+ break;
10597
+ case 'CNPJ':
10598
+ isValid = cleanValue.length === 14 && GenericValidator.isValidCnpj({ value: cleanValue }) === null;
10599
+ break;
10600
+ case 'TELEPHONE':
10601
+ cleanValue = value.toString().replace(/\D/g, '');
10602
+ isValid = GenericValidator.isValidPhoneNumber({ value: cleanValue }) === null;
10603
+ break;
10604
+ case 'EMAIL':
10605
+ isValid = GenericValidator.isValidEmail({ value: value }) === null;
10606
+ break;
10607
+ case 'RANDOM_KEY':
10608
+ isValid = true;
10609
+ break;
10610
+ default:
10611
+ isValid = true;
10612
+ }
10613
+ pixKeyControl.markAsTouched();
10614
+ if (isValid) {
10615
+ pixKeyControl.setErrors(null);
10616
+ }
10617
+ else {
10618
+ var errorType = this.getErrorTypeForField(fieldType);
10619
+ pixKeyControl.setErrors((_a = {}, _a[errorType] = true, _a));
10620
+ }
10621
+ form.updateValueAndValidity();
10622
+ this.emitFormValidity();
10623
+ this.cd.detectChanges();
10624
+ };
10625
+ /**
10626
+ * Obtém o tipo de erro para cada tipo de campo editável
10627
+ */
10628
+ HistoricalPixAccountComponent.prototype.getErrorTypeForField = function (fieldType) {
10629
+ switch (fieldType) {
10630
+ case 'CPF': return 'invalidCpf';
10631
+ case 'CNPJ': return 'invalidCnpj';
10632
+ case 'TELEPHONE': return 'invalidPhoneNumber';
10633
+ case 'EMAIL': return 'invalidEmail';
10634
+ default: return 'required';
10635
+ }
10636
+ };
10637
+ /**
10638
+ * Retorna a mensagem de erro apropriada para um campo
10639
+ */
10640
+ HistoricalPixAccountComponent.prototype.getErrorMessage = function (index, controlName) {
10641
+ var form = this.formGroupByRow[index];
10642
+ if (!form)
10643
+ return '';
10644
+ var control = form.get(controlName);
10645
+ if (!control || !control.errors)
10646
+ return '';
10647
+ var fieldValue = control.value || '';
10648
+ if (control.hasError('required')) {
10649
+ return this.translateService.instant('hcm.payroll.required');
10650
+ }
10651
+ if (control.hasError('invalidCpf')) {
10652
+ return this.translateService.instant('hcm.payroll.employees_addition_cpf_error');
10653
+ }
10654
+ else if (control.hasError('invalidCnpj')) {
10655
+ return this.translateService.instant('hcm.payroll.employees_addition_cnpj_error');
10656
+ }
10657
+ else if (control.hasError('invalidEmail')) {
10658
+ return this.translateService.instant('hcm.payroll.employees_addition_email_invalid');
10659
+ }
10660
+ else if (control.hasError('invalidPhoneNumber')) {
10661
+ return this.translateService.instant('hcm.payroll.employees_addition_invalid_phone_number', { value: fieldValue });
10662
+ }
10663
+ return '';
10664
+ };
10665
+ /**
10666
+ * Tratamento ao perder o foco em campos de documento
10667
+ */
10668
+ HistoricalPixAccountComponent.prototype.onDocumentBlur = function (index) {
10669
+ var form = this.formGroupByRow[index];
10670
+ var item = this.addExistentHistoricData[index];
10671
+ if (!form || !item)
10672
+ return;
10673
+ var pixKeyControl = form.get('pixKey');
10674
+ var pixKeyTypeControl = form.get('pixKeyType');
10675
+ if (!pixKeyControl || !pixKeyTypeControl.value)
10676
+ return;
10677
+ var pixKeyType = pixKeyTypeControl.value.key;
10678
+ var value = item.pixKey;
10679
+ if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ' || pixKeyType === 'TELEPHONE') {
10680
+ value = value ? value.toString().replace(/\D/g, '') : '';
10681
+ item.pixKey = value;
10682
+ }
10683
+ pixKeyControl.setValue(value);
10684
+ this.validateDocumentField(index, pixKeyType);
10685
+ if (value) {
10686
+ if (pixKeyType === 'CPF') {
10687
+ item.pixKeyFormatted = FormatUtilsService.getFormattedCpf(value);
10688
+ }
10689
+ else if (pixKeyType === 'CNPJ') {
10690
+ item.pixKeyFormatted = FormatUtilsService.getFormattedCnpj(value);
10691
+ }
10692
+ else if (pixKeyType === 'TELEPHONE') {
10693
+ item.pixKeyFormatted = FormatUtilsService.getFormattedTelephoneNumber(value);
10694
+ }
10695
+ else {
10696
+ item.pixKeyFormatted = value;
10697
+ }
10698
+ }
10699
+ this.finishEditing();
10700
+ };
10701
+ HistoricalPixAccountComponent.prototype.finishEditing = function () {
10702
+ this.syncAllModelToForm();
10703
+ this.cd.detectChanges();
10704
+ };
10705
+ HistoricalPixAccountComponent.prototype.clearErrorsTemporarily = function (rowIndex) {
10706
+ var form = this.formGroupByRow[rowIndex];
10707
+ if (form && form.get('pixKey')) {
10708
+ var currentValue = form.get('pixKey').value;
10709
+ form.get('pixKey').setErrors(null);
10710
+ form.get('pixKey').setValue(currentValue);
10711
+ }
10712
+ };
10713
+ HistoricalPixAccountComponent.prototype.closeEditModeManually = function () {
10714
+ var _this = this;
10715
+ setTimeout(function () {
10716
+ if (_this.dataListPix) {
10717
+ if (typeof _this.dataListPix.closeAllCellEditors === 'function') {
10718
+ _this.dataListPix.closeAllCellEditors();
10719
+ }
10720
+ else if (_this.dataListPix.editingCell) {
10721
+ _this.dataListPix.editingCell = null;
10722
+ }
10723
+ _this.cd.detectChanges();
10724
+ }
10725
+ }, 100);
10726
+ };
10727
+ HistoricalPixAccountComponent.prototype.syncAllModelToForm = function () {
10728
+ var _this = this;
10729
+ if (!this.addExistentHistoricData || !this.formGroupByRow)
10730
+ return;
10731
+ this.addExistentHistoricData.forEach(function (item, index) {
10732
+ var form = _this.formGroupByRow[index];
10733
+ if (form) {
10734
+ Object.keys(form.controls).forEach(function (controlName) {
10735
+ var control = form.get(controlName);
10736
+ if (control && item[controlName] !== undefined) {
10737
+ control.setValue(item[controlName]);
10738
+ }
10739
+ });
10740
+ var pixKeyTypeControl = form.get('pixKeyType');
10741
+ if (pixKeyTypeControl.value) {
10742
+ _this.validateDocumentField(index, pixKeyTypeControl.value.key);
10743
+ }
10744
+ }
10745
+ });
10746
+ };
10747
+ /**
10748
+ * Método para forçar o fechamento de todas as células em edição
10749
+ */
10750
+ HistoricalPixAccountComponent.prototype.forceCloseAllCellEditors = function () {
10751
+ this.finishEditing();
10752
+ this.syncAllModelToForm();
10753
+ };
10754
+ HistoricalPixAccountComponent.prototype.isPixKeyType = function (item, type) {
10755
+ return item && item.pixKeyType && item.pixKeyType.key === type;
10756
+ };
10757
+ HistoricalPixAccountComponent.prototype.getPixKey = function (rowData) {
10758
+ return rowData ? rowData.pixKey : null;
10759
+ };
10760
+ HistoricalPixAccountComponent.prototype.setPixKey = function (rowData, value) {
10761
+ if (rowData) {
10762
+ rowData.pixKey = value;
10763
+ }
10764
+ };
10765
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isTotalPercentage100", {
10766
+ get: function () {
10767
+ if (!this.addExistentHistoricData || this.addExistentHistoricData.length === 0) {
10768
+ return false;
10769
+ }
10770
+ var totalPercentage = this.addExistentHistoricData
10771
+ .reduce(function (sum, item) { return sum + (parseFloat(item.percentage) || 0); }, 0);
10772
+ return totalPercentage >= 100;
10773
+ },
10774
+ enumerable: true,
10775
+ configurable: true
10776
+ });
9656
10777
  Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
9657
10778
  get: function () {
9658
10779
  return this.actions.bind(this);
@@ -9662,7 +10783,8 @@
9662
10783
  });
9663
10784
  Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
9664
10785
  get: function () {
9665
- return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
10786
+ return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ?
10787
+ this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
9666
10788
  },
9667
10789
  enumerable: true,
9668
10790
  configurable: true
@@ -9723,21 +10845,20 @@
9723
10845
  enumerable: true,
9724
10846
  configurable: true
9725
10847
  });
9726
- HistoricalPixAccountComponent.prototype.close = function () {
9727
- this.visible = false;
9728
- };
9729
- HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
9730
- return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9731
- };
9732
- HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
9733
- return FormatUtilsService.getFormattedCpf(cpf);
9734
- };
9735
- HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
9736
- return FormatUtilsService.getFormattedCnpj(cnpj);
9737
- };
9738
- HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
9739
- return FormatUtilsService.getFormattedPercentage(value);
9740
- };
10848
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "paramsForm", {
10849
+ set: function (value) {
10850
+ this._paramsForm = value;
10851
+ },
10852
+ enumerable: true,
10853
+ configurable: true
10854
+ });
10855
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "defaultCpfNumber", {
10856
+ set: function (value) {
10857
+ this._defaultCpfNumber = value;
10858
+ },
10859
+ enumerable: true,
10860
+ configurable: true
10861
+ });
9741
10862
  Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
9742
10863
  get: function () {
9743
10864
  return (this.permission["incluir"]);
@@ -9770,11 +10891,15 @@
9770
10891
  { type: core$1.TranslateService },
9771
10892
  { type: core.ChangeDetectorRef },
9772
10893
  { type: forms.FormBuilder },
9773
- { type: api.MessageService }
10894
+ { type: SharedStateService },
10895
+ { type: HistoricalPixAccountService }
9774
10896
  ]; };
9775
10897
  __decorate([
9776
10898
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
9777
10899
  ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
10900
+ __decorate([
10901
+ core.ViewChild('dataListPix', { static: false })
10902
+ ], HistoricalPixAccountComponent.prototype, "dataListPix", void 0);
9778
10903
  __decorate([
9779
10904
  core.Input()
9780
10905
  ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
@@ -9809,243 +10934,97 @@
9809
10934
  core.Input()
9810
10935
  ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9811
10936
  __decorate([
9812
- core.Input()
9813
- ], HistoricalPixAccountComponent.prototype, "customService", void 0);
9814
- __decorate([
9815
- core.Input()
9816
- ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
9817
- __decorate([
9818
- core.Input()
9819
- ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
9820
- __decorate([
9821
- core.Input()
9822
- ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
9823
- __decorate([
9824
- core.Input()
9825
- ], HistoricalPixAccountComponent.prototype, "permission", void 0);
9826
- __decorate([
9827
- core.Input()
9828
- ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
9829
- __decorate([
9830
- core.Output()
9831
- ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
9832
- __decorate([
9833
- core.Output()
9834
- ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
9835
- __decorate([
9836
- core.Output()
9837
- ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
9838
- __decorate([
9839
- core.Input()
9840
- ], HistoricalPixAccountComponent.prototype, "dateChange", null);
9841
- __decorate([
9842
- core.Input()
9843
- ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
9844
- __decorate([
9845
- core.Input()
9846
- ], HistoricalPixAccountComponent.prototype, "addListData", null);
9847
- __decorate([
9848
- core.Input()
9849
- ], HistoricalPixAccountComponent.prototype, "visible", null);
9850
- HistoricalPixAccountComponent = __decorate([
9851
- core.Component({
9852
- // tslint:disable-next-line:component-selector
9853
- selector: "c-historical-pix-account",
9854
- template: "<s-sidebar *ngIf=\"withSideBar\" [visible]=\"visible\" (visibleChange)=\"close()\"\n header=\"{{'hcm.payroll.historical_pix_account_title_form'|translate}}\">\n<pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</s-sidebar>\n\n<div *ngIf=\"!withSideBar\">\n <pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [withSideBar]=\"false\"\n [isViewMode]=\"isViewMode\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</div>\n\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"actions(rowData, key).length > 1\" [label]=\"actionLabel\"\n priority=\"default\" [model]=\"scopedActions(rowData, key)\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n\n <s-button id=\"table-admission-btn-action-{{key}}\"\n *ngIf=\"actions(rowData, key).length <= 1\"\n [label]=\"scopedActions(rowData, key)[0].label\"\n priority=\"default\"\n (click)=\"scopedActions(rowData, key)[0].command()\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length +2\">\n {{'hcm.payroll.admission_empty_message'|translate}}\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span *ngIf=\"totalRecords\">{{recordsMessage}}</span>\n </ng-template>\n </p-table>\n</div>\n",
9855
- styles: [".refresh{width:100%!important}#table-annuity .col-default-s{width:10%}#table-annuity .col-default-m{width:12%}#table-annuity .col-default-l{width:16%}#table-annuity .col-action{width:10%}#table-annuity .icon-warning{text-align:center!important;color:#ff6d00c7!important}@media screen and (max-width:612px){#table-annuity .col-default-1,#table-annuity .col-default-2{width:16%}#table-annuity .col-default-3{width:26%}#table-annuity .col-icon{width:10%}#table-annuity .col-action{width:27%}}#main{display:-webkit-box;display:flex;height:100%;width:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}#main form{height:100%}#main .footer{border-top:1px solid #ccc;padding-top:15px;margin-top:15px;flex-shrink:0;margin-bottom:-18px}#main .footer-s-border{padding-left:7px;flex-shrink:0;margin-bottom:-18px}"]
9856
- })
9857
- ], HistoricalPixAccountComponent);
9858
- return HistoricalPixAccountComponent;
9859
- }());
9860
-
9861
- var GenericValidator = /** @class */ (function () {
9862
- function GenericValidator() {
9863
- }
9864
- /**
9865
- * Valida o CEI (Cadastro específico de INSS) digitado.
9866
- */
9867
- GenericValidator.isValidCei = function (control) {
9868
- var cei = control.value;
9869
- if (!cei)
9870
- return null;
9871
- else if (cei.length != 11)
9872
- return null;
9873
- var multiplicadorBase = "3298765432";
9874
- var total = 0;
9875
- var resto = 0;
9876
- var multiplicando = 0;
9877
- var multiplicador = 0;
9878
- if (cei.length !== 11 ||
9879
- cei === "00000000000" ||
9880
- cei === "11111111111" ||
9881
- cei === "22222222222" ||
9882
- cei === "33333333333" ||
9883
- cei === "44444444444" ||
9884
- cei === "55555555555" ||
9885
- cei === "66666666666" ||
9886
- cei === "77777777777" ||
9887
- cei === "88888888888" ||
9888
- cei === "99999999999")
9889
- return { invalidCei: true };
9890
- else {
9891
- for (var i = 0; i < 10; i++) {
9892
- multiplicando = parseInt(cei.substring(i, i + 1), 10);
9893
- multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
9894
- total += multiplicando * multiplicador;
9895
- }
9896
- resto = 11 - (total % 11);
9897
- resto = resto === 10 || resto === 11 ? 0 : resto;
9898
- var digito = parseInt("" + cei.charAt(10), 10);
9899
- return resto === digito ? null : { invalidCei: true };
9900
- }
9901
- };
9902
- /**
9903
- * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9904
- */
9905
- GenericValidator.isValidCpf = function (control) {
9906
- var cpf = control.value;
9907
- if (cpf) {
9908
- var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9909
- equalDigits = 1;
9910
- if (cpf.length < 11) {
9911
- return null;
9912
- }
9913
- for (i = 0; i < cpf.length - 1; i++) {
9914
- if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9915
- equalDigits = 0;
9916
- break;
9917
- }
9918
- }
9919
- if (!equalDigits) {
9920
- numbers = cpf.substring(0, 9);
9921
- digits = cpf.substring(9);
9922
- sum = 0;
9923
- for (i = 10; i > 1; i--) {
9924
- sum += numbers.charAt(10 - i) * i;
9925
- }
9926
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9927
- if (result !== Number(digits.charAt(0))) {
9928
- return { cpfNotValid: true };
9929
- }
9930
- numbers = cpf.substring(0, 10);
9931
- sum = 0;
9932
- for (i = 11; i > 1; i--) {
9933
- sum += numbers.charAt(11 - i) * i;
9934
- }
9935
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9936
- if (result !== Number(digits.charAt(1))) {
9937
- return { cpfNotValid: true };
9938
- }
9939
- return null;
9940
- }
9941
- else {
9942
- return { cpfNotValid: true };
9943
- }
9944
- }
9945
- return null;
9946
- };
9947
- /**
9948
- * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9949
- */
9950
- GenericValidator.isValidCnpj = function (control) {
9951
- var cnpj = control.value;
9952
- if (cnpj) {
9953
- var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9954
- cnpj = cnpj.replace(/[^\d]+/g, '');
9955
- if (cnpj.length !== 14) {
9956
- return null;
9957
- }
9958
- // Elimina CNPJs invalidos conhecidos
9959
- if (cnpj === '00000000000000' ||
9960
- cnpj === '11111111111111' ||
9961
- cnpj === '22222222222222' ||
9962
- cnpj === '33333333333333' ||
9963
- cnpj === '44444444444444' ||
9964
- cnpj === '55555555555555' ||
9965
- cnpj === '66666666666666' ||
9966
- cnpj === '77777777777777' ||
9967
- cnpj === '88888888888888' ||
9968
- cnpj === '99999999999999') {
9969
- return { cnpjNotValid: true };
9970
- }
9971
- // Valida DVs
9972
- size = cnpj.length - 2;
9973
- numbers = cnpj.substring(0, size);
9974
- digits = cnpj.substring(size);
9975
- sum = 0;
9976
- pos = size - 7;
9977
- for (var i = size; i >= 1; i--) {
9978
- sum += numbers.charAt(size - i) * pos--;
9979
- if (pos < 2) {
9980
- pos = 9;
9981
- }
9982
- }
9983
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9984
- if (result !== Number(digits.charAt(0))) {
9985
- return { cnpjNotValid: true };
9986
- }
9987
- size = size + 1;
9988
- numbers = cnpj.substring(0, size);
9989
- sum = 0;
9990
- pos = size - 7;
9991
- for (var i = size; i >= 1; i--) {
9992
- sum += numbers.charAt(size - i) * pos--;
9993
- if (pos < 2) {
9994
- pos = 9;
9995
- }
9996
- }
9997
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9998
- if (result !== Number(digits.charAt(1))) {
9999
- return { cnpjNotValid: true };
10000
- }
10001
- return null;
10002
- }
10003
- return null;
10004
- };
10005
- /**
10006
- * Válida o número de telefone da chave PIX.
10007
- */
10008
- GenericValidator.isValidPhoneNumber = function (control) {
10009
- var cellPhoneKey = control.value || '';
10010
- cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
10011
- var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
10012
- var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
10013
- return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
10014
- };
10015
- /**
10016
- * Valida o email da chave PIX.
10017
- */
10018
- GenericValidator.isValidEmail = function (control) {
10019
- var emailKey = control.value;
10020
- var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
10021
- var isValidEmail = regexValidEmail.test(emailKey);
10022
- return isValidEmail ? null : { invalidEmail: true };
10023
- };
10024
- return GenericValidator;
10025
- }());
10026
-
10027
- var HistoricalPixAccountFormComponent = /** @class */ (function () {
10028
- function HistoricalPixAccountFormComponent(formBuilder, cd) {
10029
- this.formBuilder = formBuilder;
10030
- this.cd = cd;
10031
- this.withSideBar = true;
10032
- this.isEditMode = false;
10033
- this.paramsForm = new forms.FormGroup({});
10034
- this.defaultCpfNumber = null;
10035
- this.visibleChange = new core.EventEmitter();
10036
- this.pixAccountItemToList = new core.EventEmitter();
10037
- this.ngUnsubscribe = new rxjs.Subject();
10038
- this.initialValidatorOfPercentage = [forms.Validators.required, forms.Validators.min(0.01)];
10039
- this.labelBtnAdd = "hcm.payroll.employees_add";
10040
- this.maxValuePercentage = 100.00;
10041
- this.visibleBtnSave = true;
10042
- this.isView = false;
10043
- this.isShowPixKeyFieldValidatorMessage = false;
10044
- this.createFormGroup();
10045
- this.registerSubjects();
10046
- }
10047
- HistoricalPixAccountFormComponent.prototype.ngOnInit = function () {
10048
- };
10937
+ core.Input()
10938
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
10939
+ __decorate([
10940
+ core.Input()
10941
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
10942
+ __decorate([
10943
+ core.Input()
10944
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
10945
+ __decorate([
10946
+ core.Input()
10947
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
10948
+ __decorate([
10949
+ core.Input()
10950
+ ], HistoricalPixAccountComponent.prototype, "addExistentHistoricData", void 0);
10951
+ __decorate([
10952
+ core.Input()
10953
+ ], HistoricalPixAccountComponent.prototype, "getListPixAccount", void 0);
10954
+ __decorate([
10955
+ core.Input()
10956
+ ], HistoricalPixAccountComponent.prototype, "isEditModeForSave", void 0);
10957
+ __decorate([
10958
+ core.Input()
10959
+ ], HistoricalPixAccountComponent.prototype, "showField", void 0);
10960
+ __decorate([
10961
+ core.Input()
10962
+ ], HistoricalPixAccountComponent.prototype, "hideBtnAddForViewMode", void 0);
10963
+ __decorate([
10964
+ core.Input()
10965
+ ], HistoricalPixAccountComponent.prototype, "showButtonView", void 0);
10966
+ __decorate([
10967
+ core.Output()
10968
+ ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
10969
+ __decorate([
10970
+ core.Output()
10971
+ ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
10972
+ __decorate([
10973
+ core.Output()
10974
+ ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
10975
+ __decorate([
10976
+ core.Output()
10977
+ ], HistoricalPixAccountComponent.prototype, "isValidChangeForm", void 0);
10978
+ __decorate([
10979
+ core.Input()
10980
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
10981
+ __decorate([
10982
+ core.Input()
10983
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
10984
+ __decorate([
10985
+ core.Input()
10986
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
10987
+ __decorate([
10988
+ core.Input()
10989
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
10990
+ __decorate([
10991
+ core.Input()
10992
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", null);
10993
+ __decorate([
10994
+ core.Input()
10995
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", null);
10996
+ HistoricalPixAccountComponent = __decorate([
10997
+ core.Component({
10998
+ // tslint:disable-next-line:component-selector
10999
+ selector: "c-historical-pix-account",
11000
+ template: "<s-sidebar *ngIf=\"withSideBar\" [visible]=\"visible\" (visibleChange)=\"close()\"\n header=\"{{'hcm.payroll.historical_pix_account_title_form'|translate}}\">\n<pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [paramsForm]=\"paramsForm\"\n [showField]=\"showFields\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</s-sidebar>\n\n<div *ngIf=\"!withSideBar\">\n <pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [withSideBar]=\"false\"\n [isViewMode]=\"isViewMode\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</div>\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode && !hideBtnAddForViewMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div *ngIf=\"showFields || !showEditMode || !(hideFields | async)\" class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col *ngIf=\"showButtonView\" [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th *ngIf=\"showButtonView\" id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length && showButtonView\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"!isViewMode && actions(rowData, key).length > 1\" [label]=\"actionLabel\"\n priority=\"default\" [model]=\"scopedActions(rowData, key)\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n\n <s-button id=\"table-admission-btn-action-{{key}}\"\n *ngIf=\"!isViewMode && actions(rowData, key).length <= 1\"\n [label]=\"scopedActions(rowData, key)[0].label\"\n priority=\"default\"\n (click)=\"scopedActions(rowData, key)[0].command()\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length +2\">\n {{'hcm.payroll.admission_empty_message'|translate}}\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span *ngIf=\"totalRecords\">{{recordsMessage}}</span>\n </ng-template>\n </p-table>\n</div>\n\n<!-- Template exlusivo para edi\u00E7\u00E3o de pix via modal-->\n<div *ngIf=\"!withSideBar && showEditMode && (hideFields | async)\" class=\"ui-g-12\">\n <!-- Bot\u00E3o Adicionar -->\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <s-button\n id=\"btn-save\"\n label=\"{{ 'hcm.payroll.historical_pix_account_add' | translate}}\"\n priority=\"primary\"\n [disabled]=\"isTotalPercentage100\"\n [pTooltip]=\"isTotalPercentage100 ? ('hcm.payroll.historical_pix_account_msg_limit_total_by_percentage' | translate) : ''\"\n tooltipPosition=\"top\"\n (onClick)=\"addPix()\">\n </s-button>\n </div>\n </div>\n\n <!-- Tabela -->\n <p-table #dataListPix sortField=\"percentage\"\n [columns]=\"cols\"\n [value]=\"addExistentHistoricData\"\n [pageLinks]=\"3\"\n [paginator]=\"true\"\n [responsive]=\"true\"\n [rows]=\"10\"\n [resetPageOnSort]=\"false\"\n [tableStyle]=\"{'margin-top': '2rem'}\"\n [customSort]=\"true\"\n (onEditInit)=\"onCellEditInit($event)\">\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of cols\">\n {{ col.label }}\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-rowIndex=\"rowIndex\">\n <ng-container *ngIf=\"formGroupByRow[rowIndex]\" [formGroup]=\"formGroupByRow[rowIndex]\">\n <tr>\n <!-- Tipo de Chave -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.pixKeyType\" pEditableColumnField=\"pixKeyType\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <div style=\"width: 100%; position: relative;\">\n <p-autoComplete\n [suggestions]=\"suggestions\"\n (completeMethod)=\"filterPixKeyType($event)\"\n formControlName=\"pixKeyType\"\n [dropdown]=\"true\"\n (onSelect)=\"onPixKeyTypeChange($event, rowIndex)\"\n (onClear)=\"onPixKeyTypeClear(rowIndex)\"\n (ngModelChange)=\"onSyncValue('pixKeyType', rowIndex)\"\n field=\"value\"\n placeholder=\"{{'hcm.payroll.select' | translate}}\"\n appendTo=\"body\"\n [panelStyle]=\"{ maxWidth: '300px', width: '100%' }\"\n [inputStyle]=\"{ width: '100%' }\"\n ></p-autoComplete>\n\n <s-control-errors [control]=\"formGroupByRow[rowIndex]?.get('pixKeyType')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n pixKeyTypeBankAccountDuplicate: 'hcm.payroll.historical_pix_key_type_bank_account_duplicate' | translate\n }\">\n </s-control-errors>\n </div>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ item.pixKeyType?.value }}\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Chave Pix -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.pixKey\" pEditableColumnField=\"pixKey\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <div class=\"ui-fluid\">\n <!-- \u00C1rea de inputs din\u00E2micos -->\n <div [ngSwitch]=\"getPixKeyType(item)\" class=\"ui-fluid\">\n <!-- CPF -->\n <p-inputMask *ngSwitchCase=\"'CPF'\"\n mask=\"999.999.999-99\"\n unmask=\"true\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n styleClass=\"full-width-input\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (onComplete)=\"validateDocumentField(rowIndex, 'CPF')\"\n (onBlur)=\"onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n </p-inputMask>\n\n <!-- CNPJ -->\n <p-inputMask *ngSwitchCase=\"'CNPJ'\"\n mask=\"99.999.999/9999-99\"\n unmask=\"true\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n styleClass=\"full-width-input\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (onComplete)=\"validateDocumentField(rowIndex, 'CNPJ')\"\n (onBlur)=\"onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n </p-inputMask>\n\n <!-- TELEPHONE -->\n <p-inputMask *ngSwitchCase=\"'TELEPHONE'\"\n mask=\"(99) 99999-9999\"\n unmask=\"true\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n styleClass=\"full-width-input\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (onComplete)=\"validateDocumentField(rowIndex, 'TELEPHONE')\"\n (onBlur)=\"onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n </p-inputMask>\n\n <!-- EMAIL -->\n <input *ngSwitchCase=\"'EMAIL'\"\n type=\"email\"\n pInputText\n class=\"p-inputtext p-component full-width-input\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (blur)=\"validateDocumentField(rowIndex, 'EMAIL'); onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n\n <!-- RANDOM_KEY -->\n <input *ngSwitchCase=\"'RANDOM_KEY'\"\n type=\"text\"\n pInputText\n class=\"p-inputtext p-component full-width-input\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (blur)=\"validateDocumentField(rowIndex, 'RANDOM_KEY'); onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n\n <!-- BANK_ACCOUNT -->\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\"\n type=\"text\"\n pInputText\n class=\"p-inputtext p-component full-width-input\"\n [disabled]=\"true\">\n </div>\n\n <!-- \u00DAnico s-control-errors para todos os tipos -->\n <small *ngIf=\"isInvalid(rowIndex, 'pixKey')\" class=\"p-error error-text\">\n {{getErrorMessage(rowIndex, 'pixKey')}}\n </small>\n </div>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{getFormattedPixKey(getPixKeyType(item), item.pixKey)}}\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Percentual -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.percentage\" pEditableColumnField=\"percentage\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <input\n pInputText type=\"number\"\n formControlName=\"percentage\"\n (ngModelChange)=\"onSyncValue('percentage', rowIndex)\"\n >\n <s-control-errors\n [control]=\"formGroupByRow[rowIndex]?.get('percentage')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n maxlength: 'hcm.payroll.error_max_length' | translate: { value: '6' },\n max: 'hcm.payroll.error_max_value_number' | translate: { value: maxValuePercentage },\n min: 'hcm.payroll.error_min_value_number' | translate: { value: '0,01' }\n }\">\n </s-control-errors>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ formatPercentage(item.percentage) }}%\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Bot\u00E3o de excluir -->\n <td>\n <s-button\n id=\"btn-delete\"\n label=\"{{ 'hcm.payroll.delete' | translate }}\"\n priority=\"default\"\n (onClick)=\"deletePix(rowIndex)\">\n </s-button>\n </td>\n </tr>\n </ng-container>\n </ng-template>\n </p-table>\n</div>\n",
11001
+ styles: [".refresh{width:100%!important}#table-annuity .col-default-s{width:10%}#table-annuity .col-default-m{width:12%}#table-annuity .col-default-l{width:16%}#table-annuity .col-action{width:10%}#table-annuity .icon-warning{text-align:center!important;color:#ff6d00c7!important}@media screen and (max-width:612px){#table-annuity .col-default-1,#table-annuity .col-default-2{width:16%}#table-annuity .col-default-3{width:26%}#table-annuity .col-icon{width:10%}#table-annuity .col-action{width:27%}}#main{display:-webkit-box;display:flex;height:100%;width:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}#main form{height:100%}#main .footer{border-top:1px solid #ccc;padding-top:15px;margin-top:15px;flex-shrink:0;margin-bottom:-18px}#main .footer-s-border{padding-left:7px;flex-shrink:0;margin-bottom:-18px}:host ::ng-deep .p-cell-editing{padding:0!important}:host ::ng-deep .full-width-input{width:100%!important;min-height:34px!important;padding:6px 12px!important}:host ::ng-deep .p-inputtext{width:100%;min-height:34px;padding:6px 12px}:host ::ng-deep .p-inputmask{width:100%;display:block}:host ::ng-deep .p-inputmask .p-inputmask-input{width:100%!important;min-height:34px!important;padding:6px 12px!important}:host ::ng-deep p-celleditor{width:100%}:host ::ng-deep p-celleditor .ui-fluid{width:100%;display:block;padding:0}:host ::ng-deep .p-error{margin-top:4px;font-size:12px}:host ::ng-deep .error-text{color:#f44336;display:block;margin-top:4px;font-size:.875em}"]
11002
+ })
11003
+ ], HistoricalPixAccountComponent);
11004
+ return HistoricalPixAccountComponent;
11005
+ }(HistoricakPixAccountBase));
11006
+
11007
+ var HistoricalPixAccountFormComponent = /** @class */ (function (_super) {
11008
+ __extends(HistoricalPixAccountFormComponent, _super);
11009
+ function HistoricalPixAccountFormComponent(formBuilder, cd, sharedStateService) {
11010
+ var _this = _super.call(this, formBuilder) || this;
11011
+ _this.cd = cd;
11012
+ _this.sharedStateService = sharedStateService;
11013
+ _this.withSideBar = true;
11014
+ _this.isEditMode = false;
11015
+ _this.showField = false;
11016
+ _this.visibleChange = new core.EventEmitter();
11017
+ _this.pixAccountItemToList = new core.EventEmitter();
11018
+ _this.ngUnsubscribe = new rxjs.Subject();
11019
+ _this.labelBtnAdd = "hcm.payroll.employees_add";
11020
+ _this.visibleBtnSave = true;
11021
+ _this.isView = false;
11022
+ _this.isShowPixKeyFieldValidatorMessage = false;
11023
+ _this.hideFields = _this.sharedStateService.hideField$;
11024
+ _this.registerSubjects();
11025
+ return _this;
11026
+ }
11027
+ HistoricalPixAccountFormComponent.prototype.ngOnInit = function () { };
10049
11028
  HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
10050
11029
  this.cd.detectChanges();
10051
11030
  };
@@ -10053,38 +11032,7 @@
10053
11032
  this.ngUnsubscribe.next(true);
10054
11033
  this.ngUnsubscribe.unsubscribe();
10055
11034
  };
10056
- HistoricalPixAccountFormComponent.prototype.registerSubjects = function () {
10057
- };
10058
- HistoricalPixAccountFormComponent.prototype.createFormGroup = function () {
10059
- this.pixAccountFormGroup = this.formBuilder.group({
10060
- id: this.formBuilder.control(null),
10061
- index: this.formBuilder.control(null),
10062
- employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
10063
- dateChange: this.formBuilder.control(null),
10064
- pixKeyType: this.formBuilder.control(null, forms.Validators.required),
10065
- pixKey: this.formBuilder.control(null),
10066
- percentage: this.formBuilder.control(null, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10067
- forms.Validators.max(this.maxValuePercentage),
10068
- ]))),
10069
- externalId: this.formBuilder.control(null),
10070
- customFields: this.formBuilder.control(null),
10071
- });
10072
- };
10073
- HistoricalPixAccountFormComponent.prototype.onChangePixKeyType = function (item) {
10074
- if (item.key) {
10075
- this.pixKeyType = item.key;
10076
- this.isShowPixKeyFieldValidatorMessage = true;
10077
- this.pixAccountFormGroup.get("pixKey").reset();
10078
- this.setPixKeyValidators(true);
10079
- if (item.key === "CPF") {
10080
- this.setDefaultCpfPixKey();
10081
- }
10082
- }
10083
- };
10084
- HistoricalPixAccountFormComponent.prototype.onClearPixKeyType = function () {
10085
- this.isShowPixKeyFieldValidatorMessage = false;
10086
- this.pixAccountFormGroup.get("pixKey").reset();
10087
- };
11035
+ HistoricalPixAccountFormComponent.prototype.registerSubjects = function () { };
10088
11036
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
10089
11037
  get: function () {
10090
11038
  return this._visible;
@@ -10123,7 +11071,8 @@
10123
11071
  });
10124
11072
  HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
10125
11073
  if (this.pixKeyType === "TELEPHONE") {
10126
- this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
11074
+ var pixKeyCtrl = this.pixAccountFormGroup.get("pixKey");
11075
+ pixKeyCtrl.setValue(FormatUtilsService.getFormattedTelephoneNumber(pixKeyCtrl.value));
10127
11076
  }
10128
11077
  };
10129
11078
  HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
@@ -10135,14 +11084,14 @@
10135
11084
  this.visibleBtnSave = isEditMode;
10136
11085
  if (this.pixAccountFormGroup.get("pixKeyType").value) {
10137
11086
  this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
10138
- this.setPixKeyValidators(isEditMode);
11087
+ this.setPixKeyValidators(isEditMode, this.pixAccountFormGroup);
10139
11088
  this.formatPixKeyTelephoneNumber();
10140
11089
  }
10141
11090
  configEnabledFields(this.pixAccountFormGroup, isEditMode, [
10142
11091
  "pixKeyType",
10143
11092
  "pixKey",
10144
11093
  "percentage",
10145
- "customFields",
11094
+ "customFields"
10146
11095
  ], []);
10147
11096
  };
10148
11097
  HistoricalPixAccountFormComponent.prototype.close = function () {
@@ -10150,13 +11099,11 @@
10150
11099
  this.visible = false;
10151
11100
  };
10152
11101
  HistoricalPixAccountFormComponent.prototype.addItem = function () {
10153
- this.pixAccountFormGroup.updateValueAndValidity();
10154
- verifyValidationsForm.call(this.pixAccountFormGroup);
10155
11102
  if (this.pixAccountFormGroup.valid) {
10156
11103
  if (this.employeeId) {
10157
11104
  this.pixAccountFormGroup.get("employee").setValue({
10158
11105
  tableId: this.employeeId,
10159
- name: "",
11106
+ name: ""
10160
11107
  });
10161
11108
  }
10162
11109
  this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
@@ -10188,14 +11135,10 @@
10188
11135
  return {
10189
11136
  prefix: "",
10190
11137
  thousands: this.currency.thousandsSeparator,
10191
- decimal: this.currency.decimalSeparator,
11138
+ decimal: this.currency.decimalSeparator
10192
11139
  };
10193
11140
  };
10194
11141
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "getListPixAccount", {
10195
- /**
10196
- * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
10197
- * @param pixAccountList
10198
- */
10199
11142
  set: function (pixAccountList) {
10200
11143
  if (pixAccountList) {
10201
11144
  this.setValidatorsAccordingList(pixAccountList, null, false);
@@ -10207,85 +11150,6 @@
10207
11150
  enumerable: true,
10208
11151
  configurable: true
10209
11152
  });
10210
- /**
10211
- * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
10212
- * a validação dos campos "percentage" e "pixAccount".
10213
- * Quando tem index significa que está em uma edição, os valores na posição do registro da edição (index) não serão adicionados
10214
- * no array de comparação dos validators.
10215
- * @param pixAccountList
10216
- * @param index
10217
- */
10218
- HistoricalPixAccountFormComponent.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode) {
10219
- if (index === void 0) { index = null; }
10220
- if (isEditMode === void 0) { isEditMode = true; }
10221
- this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
10222
- var percentageIncluded = [];
10223
- if (this.pixAccountList && this.pixAccountList.length) {
10224
- this.pixAccountList.filter(function (field, key) {
10225
- if (field["percentage"] && key != index) {
10226
- percentageIncluded.push(field["percentage"]);
10227
- }
10228
- });
10229
- }
10230
- this.beforeSetPixKeyTypeValidator();
10231
- this.setPixKeyValidators(isEditMode);
10232
- this.validatePercentageValid(percentageIncluded);
10233
- };
10234
- /**
10235
- * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
10236
- */
10237
- HistoricalPixAccountFormComponent.prototype.setPixKeyValidators = function (isEditMode) {
10238
- var genericPixKey = this.pixAccountFormGroup.get("pixKey");
10239
- if (this.pixKeyType) {
10240
- switch (this.pixKeyType) {
10241
- case "TELEPHONE":
10242
- genericPixKey.setValidators(forms.Validators.compose([
10243
- forms.Validators.required, GenericValidator.isValidPhoneNumber,
10244
- ]));
10245
- break;
10246
- case "EMAIL":
10247
- genericPixKey.setValidators(forms.Validators.compose([
10248
- forms.Validators.required, GenericValidator.isValidEmail,
10249
- ]));
10250
- break;
10251
- case "CPF":
10252
- genericPixKey.setValidators(forms.Validators.compose([
10253
- forms.Validators.required, GenericValidator.isValidCpf,
10254
- ]));
10255
- break;
10256
- case "CNPJ":
10257
- genericPixKey.setValidators(forms.Validators.compose([
10258
- forms.Validators.required, GenericValidator.isValidCnpj,
10259
- ]));
10260
- break;
10261
- case "RANDOM_KEY":
10262
- genericPixKey.setValidators(forms.Validators.required);
10263
- break;
10264
- default:
10265
- genericPixKey.setValidators(null);
10266
- break;
10267
- }
10268
- if (isEditMode) {
10269
- genericPixKey.enable();
10270
- }
10271
- genericPixKey.updateValueAndValidity();
10272
- }
10273
- };
10274
- /**
10275
- * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
10276
- * 100% na validação do campo "percentage" como um novo maxValue;
10277
- * @param listValue
10278
- */
10279
- HistoricalPixAccountFormComponent.prototype.validatePercentageValid = function (listValue) {
10280
- var percentage = this.pixAccountFormGroup.get("percentage");
10281
- this.maxValuePercentage = listValue
10282
- .reduce(function (currentValue, total) { return currentValue - total; }, 100.00);
10283
- percentage
10284
- .setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10285
- forms.Validators.max(this.maxValuePercentage),
10286
- ])));
10287
- percentage.updateValueAndValidity();
10288
- };
10289
11153
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10290
11154
  set: function (condition) {
10291
11155
  this.isView = !!(condition && !this.withSideBar);
@@ -10296,58 +11160,24 @@
10296
11160
  enumerable: true,
10297
11161
  configurable: true
10298
11162
  });
10299
- HistoricalPixAccountFormComponent.prototype.phoneMask = function (event) {
10300
- FormatUtilsService.formatTelephoneInputEvent(event);
10301
- };
10302
- HistoricalPixAccountFormComponent.prototype.setDefaultCpfPixKey = function () {
10303
- if (this.defaultCpfNumber) {
10304
- this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
10305
- }
10306
- else {
10307
- var sheetDocument = this.paramsForm.get("sheetDocument");
10308
- if (sheetDocument) {
10309
- var cpf = sheetDocument.get("cpfNumber").value;
10310
- if (cpf) {
10311
- this.pixAccountFormGroup.get("pixKey").setValue(cpf);
10312
- }
10313
- }
10314
- }
10315
- };
10316
- HistoricalPixAccountFormComponent.prototype.beforeSetPixKeyTypeValidator = function () {
10317
- var pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
10318
- if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
10319
- pixKeyType
10320
- .setValidators(forms.Validators.compose([
10321
- forms.Validators.required,
10322
- this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
10323
- ]));
10324
- }
10325
- else {
10326
- pixKeyType.setValidators(forms.Validators.required);
10327
- }
10328
- };
10329
- HistoricalPixAccountFormComponent.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
10330
- return function (control) {
10331
- var value = control && control.value;
10332
- var condition = false;
10333
- listCompare.filter(function (field) {
10334
- if (value) {
10335
- if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
10336
- return condition = true;
10337
- }
10338
- }
10339
- });
10340
- if (condition) {
10341
- return { pixKeyTypeBankAccountDuplicate: true };
10342
- }
10343
- else {
10344
- return null;
10345
- }
10346
- };
10347
- };
11163
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "paramsForm", {
11164
+ set: function (value) {
11165
+ this._paramsForm = value;
11166
+ },
11167
+ enumerable: true,
11168
+ configurable: true
11169
+ });
11170
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", {
11171
+ set: function (value) {
11172
+ this._defaultCpfNumber = value;
11173
+ },
11174
+ enumerable: true,
11175
+ configurable: true
11176
+ });
10348
11177
  HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10349
11178
  { type: forms.FormBuilder },
10350
- { type: core.ChangeDetectorRef }
11179
+ { type: core.ChangeDetectorRef },
11180
+ { type: SharedStateService }
10351
11181
  ]; };
10352
11182
  __decorate([
10353
11183
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: true })
@@ -10369,10 +11199,7 @@
10369
11199
  ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
10370
11200
  __decorate([
10371
11201
  core.Input()
10372
- ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
10373
- __decorate([
10374
- core.Input()
10375
- ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
11202
+ ], HistoricalPixAccountFormComponent.prototype, "showField", void 0);
10376
11203
  __decorate([
10377
11204
  core.Output()
10378
11205
  ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
@@ -10391,32 +11218,21 @@
10391
11218
  __decorate([
10392
11219
  core.Input()
10393
11220
  ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
11221
+ __decorate([
11222
+ core.Input()
11223
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", null);
11224
+ __decorate([
11225
+ core.Input()
11226
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", null);
10394
11227
  HistoricalPixAccountFormComponent = __decorate([
10395
11228
  core.Component({
10396
11229
  selector: "pix-account",
10397
- template: "<div id=\"main\">\n <form [formGroup]=\"pixAccountFormGroup\" autocomplete=\"off\">\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <!-- Tipo de chave -->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label>{{'hcm.payroll.employees_addition_pix_key_type'|translate}}</label>\n <input-rest-auto-complete-enum [dropdown]=\"true\" server=\"payroll\"\n enumeration=\"PixKeyType\"\n placeholder=\"{{'hcm.payroll.select' | translate}}\"\n name=\"pixKeyType\" [form]=\"pixAccountFormGroup\"\n (onSelect)=\"onChangePixKeyType($event)\"\n (onClear)=\"onClearPixKeyType()\"\n id=\"ta-pixKeyType\"></input-rest-auto-complete-enum>\n <s-control-errors [control]=\"pixAccountFormGroup.get('pixKeyType')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n pixKeyTypeBankAccountDuplicate: 'hcm.payroll.historical_pix_key_type_bank_account_duplicate' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Chave Pix-->\n <div class=\"ui-md-6 ui-sm-12\" [ngClass]=\"{'required': pixKeyType !== 'BANK_ACCOUNT'}\">\n <label>{{'hcm.payroll.employees_addition_pix_key' | translate}}</label>\n <ng-container [ngSwitch]=\"pixKeyType\">\n <input *ngSwitchCase=\"'TELEPHONE'\" only-number\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n (keyup)=\"phoneMask($event)\" maxlength=\"15\"\n placeholder=\"(__) ____-____\">\n <p-inputMask *ngSwitchCase=\"'CPF'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"___.___.___-__\"\n mask=\"999.999.999-99\" [unmask]=\"true\"></p-inputMask>\n <p-inputMask *ngSwitchCase=\"'CNPJ'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"__.___.___/____-__\"\n mask=\"99.999.999/9999-99\" [unmask]=\"true\"></p-inputMask>\n <input *ngSwitchCase=\"'EMAIL'\"\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"{{'hcm.payroll.employees_addition_email'|translate}}\"/>\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\" disabled\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"/>\n <input *ngSwitchDefault\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\" maxlength=\"100\" />\n </ng-container>\n <s-control-errors *ngIf=\"isShowPixKeyFieldValidatorMessage\" id=\"er-pix-key\"\n [control]=\"pixAccountFormGroup.get('pixKey')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n invalidPhoneNumber: 'hcm.payroll.employees_addition_invalid_phone_number' | translate: { value: pixAccountFormGroup.get('pixKey').value },\n invalidEmail: 'hcm.payroll.employees_addition_email_invalid' | translate,\n cpfNotValid: 'hcm.payroll.employees_addition_cpf_error' | translate,\n cnpjNotValid: 'hcm.payroll.employees_addition_cnpj_error' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Percentual-->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label id=\"lb-percentage\"\n for=\"ff-percentage\">{{ 'hcm.payroll.historical_bank_account_label_percentage' | translate }}</label>\n <div class=\"ui-inputgroup\">\n <span class=\"ui-inputgroup-addon\">%</span>\n <input pInputText id=\"ff-percentage\" name=\"percentage\"\n formControlName=\"percentage\"\n currencyMask\n [options]=\"optionsPercentage\"\n [placeholder]=\"percentagePlaceholder\"/>\n </div>\n <s-control-errors [control]=\"pixAccountFormGroup.get('percentage')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n maxlength: 'hcm.payroll.error_max_length' | translate: { value: '6' },\n max: 'hcm.payroll.error_max_value_number' | translate: { value: maxValuePercentage },\n min: 'hcm.payroll.error_min_value_number' | translate: { value: '0,01' }\n }\">\n </s-control-errors>\n </div>\n <div class=\"ui-g-12\">\n <p-fieldset\n legend=\"{{ 'hcm.payroll.custom_fields' | translate }}\"\n [attr.data-hidden]=\"!customFields || !customFields.fields.length\"\n >\n <s-custom-fields\n domain=\"hcm\"\n service=\"{{customService}}\"\n entity=\"{{customEntity}}\"\n formControlName=\"customFields\"\n [invalidErrorLabel]=\"'hcm.payroll.employees_invalid_field' | translate\"\n >\n </s-custom-fields>\n </p-fieldset>\n </div>\n </div>\n </div>\n </form>\n\n <div [ngClass]=\"withSideBar ? 'footer' : 'footer-s-border'\">\n <div class=\"form-group\">\n <s-button id=\"btn-save\" label=\"{{ labelBtnAdd | translate}}\" priority=\"primary\"\n (onClick)=\"addItem()\" *ngIf=\"visibleBtnSave && !this.isView\"></s-button>\n <s-button *ngIf=\"withSideBar\" id=\"btn-close\" label=\"{{'hcm.payroll.cancel'|translate}}\" priority=\"secondary\"\n priority=\"link\" (onClick)=\"close()\"></s-button>\n </div>\n </div>\n</div>\n",
10398
- styles: [".refresh{width:100%!important}#table-annuity .col-default-s{width:10%}#table-annuity .col-default-m{width:12%}#table-annuity .col-default-l{width:16%}#table-annuity .col-action{width:10%}#table-annuity .icon-warning{text-align:center!important;color:#ff6d00c7!important}@media screen and (max-width:612px){#table-annuity .col-default-1,#table-annuity .col-default-2{width:16%}#table-annuity .col-default-3{width:26%}#table-annuity .col-icon{width:10%}#table-annuity .col-action{width:27%}}#main{display:-webkit-box;display:flex;height:100%;width:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}#main form{height:100%}#main .footer{border-top:1px solid #ccc;padding-top:15px;margin-top:15px;flex-shrink:0;margin-bottom:-18px}#main .footer-s-border{padding-left:7px;flex-shrink:0;margin-bottom:-18px}"]
11230
+ template: "<div id=\"main\">\n <form *ngIf=\"showField || !(hideFields | async)\" [formGroup]=\"pixAccountFormGroup\" autocomplete=\"off\">\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <!-- Tipo de chave -->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label>{{'hcm.payroll.employees_addition_pix_key_type'|translate}}</label>\n <input-rest-auto-complete-enum [dropdown]=\"true\" server=\"payroll\"\n enumeration=\"PixKeyType\"\n placeholder=\"{{'hcm.payroll.select' | translate}}\"\n name=\"pixKeyType\" [form]=\"pixAccountFormGroup\"\n (onSelect)=\"onChangePixKeyType($event)\"\n (onClear)=\"onClearPixKeyType()\"\n id=\"ta-pixKeyType\"></input-rest-auto-complete-enum>\n <s-control-errors [control]=\"pixAccountFormGroup.get('pixKeyType')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n pixKeyTypeBankAccountDuplicate: 'hcm.payroll.historical_pix_key_type_bank_account_duplicate' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Chave Pix-->\n <div class=\"ui-md-6 ui-sm-12\" [ngClass]=\"{'required': pixKeyType !== 'BANK_ACCOUNT'}\">\n <label>{{'hcm.payroll.employees_addition_pix_key' | translate}}</label>\n <ng-container [ngSwitch]=\"pixKeyType\">\n <input *ngSwitchCase=\"'TELEPHONE'\" only-number\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n (keyup)=\"phoneMask($event)\" maxlength=\"15\"\n placeholder=\"(__) ____-____\">\n <p-inputMask *ngSwitchCase=\"'CPF'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"___.___.___-__\"\n mask=\"999.999.999-99\" [unmask]=\"true\"></p-inputMask>\n <p-inputMask *ngSwitchCase=\"'CNPJ'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"__.___.___/____-__\"\n mask=\"99.999.999/9999-99\" [unmask]=\"true\"></p-inputMask>\n <input *ngSwitchCase=\"'EMAIL'\"\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"{{'hcm.payroll.employees_addition_email'|translate}}\"/>\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\" disabled\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"/>\n <input *ngSwitchDefault\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\" maxlength=\"100\" />\n </ng-container>\n <s-control-errors *ngIf=\"isShowPixKeyFieldValidatorMessage\" id=\"er-pix-key\"\n [control]=\"pixAccountFormGroup.get('pixKey')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n invalidPhoneNumber: 'hcm.payroll.employees_addition_invalid_phone_number' | translate: { value: pixAccountFormGroup.get('pixKey').value },\n invalidEmail: 'hcm.payroll.employees_addition_email_invalid' | translate,\n cpfNotValid: 'hcm.payroll.employees_addition_cpf_error' | translate,\n cnpjNotValid: 'hcm.payroll.employees_addition_cnpj_error' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Percentual-->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label id=\"lb-percentage\"\n for=\"ff-percentage\">{{ 'hcm.payroll.historical_bank_account_label_percentage' | translate }}</label>\n <div class=\"ui-inputgroup\">\n <span class=\"ui-inputgroup-addon\">%</span>\n <input pInputText id=\"ff-percentage\" name=\"percentage\"\n formControlName=\"percentage\"\n currencyMask\n [options]=\"optionsPercentage\"\n [placeholder]=\"percentagePlaceholder\"/>\n </div>\n <s-control-errors [control]=\"pixAccountFormGroup.get('percentage')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n maxlength: 'hcm.payroll.error_max_length' | translate: { value: '6' },\n max: 'hcm.payroll.error_max_value_number' | translate: { value: maxValuePercentage },\n min: 'hcm.payroll.error_min_value_number' | translate: { value: '0,01' }\n }\">\n </s-control-errors>\n </div>\n <div class=\"ui-g-12\">\n <p-fieldset\n legend=\"{{ 'hcm.payroll.custom_fields' | translate }}\"\n [attr.data-hidden]=\"!customFields || !customFields.fields.length\"\n >\n <s-custom-fields\n domain=\"hcm\"\n service=\"{{customService}}\"\n entity=\"{{customEntity}}\"\n formControlName=\"customFields\"\n [invalidErrorLabel]=\"'hcm.payroll.employees_invalid_field' | translate\"\n >\n </s-custom-fields>\n </p-fieldset>\n </div>\n </div>\n </div>\n </form>\n\n <div [ngClass]=\"withSideBar ? 'footer' : 'footer-s-border'\">\n <div class=\"form-group\">\n <s-button id=\"btn-save\" label=\"{{ labelBtnAdd | translate}}\" priority=\"primary\"\n (onClick)=\"addItem()\" *ngIf=\"visibleBtnSave && !this.isView\"></s-button>\n <s-button *ngIf=\"withSideBar\" id=\"btn-close\" label=\"{{'hcm.payroll.cancel'|translate}}\" priority=\"secondary\"\n priority=\"link\" (onClick)=\"close()\"></s-button>\n </div>\n </div>\n</div>\n",
11231
+ styles: [".refresh{width:100%!important}#table-annuity .col-default-s{width:10%}#table-annuity .col-default-m{width:12%}#table-annuity .col-default-l{width:16%}#table-annuity .col-action{width:10%}#table-annuity .icon-warning{text-align:center!important;color:#ff6d00c7!important}@media screen and (max-width:612px){#table-annuity .col-default-1,#table-annuity .col-default-2{width:16%}#table-annuity .col-default-3{width:26%}#table-annuity .col-icon{width:10%}#table-annuity .col-action{width:27%}}#main{display:-webkit-box;display:flex;height:100%;width:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}#main form{height:100%}#main .footer{border-top:1px solid #ccc;padding-top:15px;margin-top:15px;flex-shrink:0;margin-bottom:-18px}#main .footer-s-border{padding-left:7px;flex-shrink:0;margin-bottom:-18px}:host ::ng-deep .p-cell-editing{padding:0!important}:host ::ng-deep .full-width-input{width:100%!important;min-height:34px!important;padding:6px 12px!important}:host ::ng-deep .p-inputtext{width:100%;min-height:34px;padding:6px 12px}:host ::ng-deep .p-inputmask{width:100%;display:block}:host ::ng-deep .p-inputmask .p-inputmask-input{width:100%!important;min-height:34px!important;padding:6px 12px!important}:host ::ng-deep p-celleditor{width:100%}:host ::ng-deep p-celleditor .ui-fluid{width:100%;display:block;padding:0}:host ::ng-deep .p-error{margin-top:4px;font-size:12px}:host ::ng-deep .error-text{color:#f44336;display:block;margin-top:4px;font-size:.875em}"]
10399
11232
  })
10400
11233
  ], HistoricalPixAccountFormComponent);
10401
11234
  return HistoricalPixAccountFormComponent;
10402
- }());
10403
-
10404
- var HistoricalPixAccountService = /** @class */ (function () {
10405
- function HistoricalPixAccountService(http) {
10406
- this.http = http;
10407
- }
10408
- HistoricalPixAccountService.prototype.query = function (path, body, service) {
10409
- if (service === void 0) { service = exports.ServiceType.PAYROLL; }
10410
- return this.http.query(path, body, service);
10411
- };
10412
- HistoricalPixAccountService.ctorParameters = function () { return [
10413
- { type: HttpClientService }
10414
- ]; };
10415
- HistoricalPixAccountService = __decorate([
10416
- core.Injectable()
10417
- ], HistoricalPixAccountService);
10418
- return HistoricalPixAccountService;
10419
- }());
11235
+ }(HistoricakPixAccountBase));
10420
11236
 
10421
11237
  var HistoricalPixAccountModule = /** @class */ (function () {
10422
11238
  function HistoricalPixAccountModule() {
@@ -10446,6 +11262,8 @@
10446
11262
  angularComponents.CustomFieldsModule,
10447
11263
  panel.PanelModule,
10448
11264
  inputmask.InputMaskModule,
11265
+ dropdown.DropdownModule,
11266
+ tabview.TabViewModule,
10449
11267
  ],
10450
11268
  declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
10451
11269
  providers: [HistoricalPixAccountService, api.ConfirmationService],
@@ -10488,7 +11306,7 @@
10488
11306
 
10489
11307
  var moment$e = moment_;
10490
11308
  var HistoricalPixAccountListComponent = /** @class */ (function () {
10491
- function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService) {
11309
+ function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService, sharedStateService) {
10492
11310
  this.confirmationService = confirmationService;
10493
11311
  this.translateService = translateService;
10494
11312
  this.activatedRoute = activatedRoute;
@@ -10496,11 +11314,17 @@
10496
11314
  this.router = router;
10497
11315
  this.messageService = messageService;
10498
11316
  this.historicalPixAccountListService = historicalPixAccountListService;
11317
+ this.sharedStateService = sharedStateService;
10499
11318
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
10500
11319
  this.keyPayload = "historicalEmployeePix";
10501
11320
  this.withSidebar = true;
11321
+ this.showActionsButtonOnAdd = false;
10502
11322
  this.isOnlyView = new core.EventEmitter();
11323
+ this.isOnlyEdit = new core.EventEmitter();
10503
11324
  this.enableView = new core.EventEmitter();
11325
+ this.isEditJudicialDependentPix = new core.EventEmitter();
11326
+ this.isHideBtnAddForViewMode = new core.EventEmitter();
11327
+ this.isShowActionsButton = new core.EventEmitter();
10504
11328
  this.ngUnsubscribe = new rxjs.Subject();
10505
11329
  this.loading = true;
10506
11330
  this.columns = [
@@ -10508,18 +11332,6 @@
10508
11332
  label: this.translateService.instant("hcm.payroll.historical_pix_account_label_date_change"),
10509
11333
  field: "dateChange",
10510
11334
  },
10511
- {
10512
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_pix_key_type"),
10513
- field: "pixKeyType.value",
10514
- },
10515
- {
10516
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_pix_key"),
10517
- field: "pixKey",
10518
- },
10519
- {
10520
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
10521
- field: "percentage",
10522
- },
10523
11335
  {
10524
11336
  label: this.translateService.instant("hcm.payroll.employees_movimentation_historical_pix_account_label_qtd_account"),
10525
11337
  field: "numberOfPixAccount",
@@ -10532,6 +11344,7 @@
10532
11344
  HistoricalPixAccountListComponent.prototype.ngOnDestroy = function () {
10533
11345
  this.ngUnsubscribe.next();
10534
11346
  this.ngUnsubscribe.complete();
11347
+ this.unsubscribe();
10535
11348
  };
10536
11349
  HistoricalPixAccountListComponent.prototype.ngAfterViewInit = function () {
10537
11350
  this.cd.detectChanges();
@@ -10540,27 +11353,10 @@
10540
11353
  var _this = this;
10541
11354
  payload.forEach(function (value) {
10542
11355
  value.dateChange = moment$e(value.dateChange).format(_this.dateFormat);
10543
- value.pixKey = _this.formatPixKeyByType(value.pixKeyType, value.pixKey);
10544
- value.percentage = FormatUtilsService.getFormattedPercentage(value.percentage);
10545
11356
  });
10546
11357
  this.onGridLoad(payload);
10547
11358
  this.loading = false;
10548
11359
  };
10549
- HistoricalPixAccountListComponent.prototype.formatPixKeyByType = function (pixKeyType, pixKey) {
10550
- var keyType = pixKeyType ? pixKeyType.key.toUpperCase() : "";
10551
- if (keyType === "TELEPHONE") {
10552
- return FormatUtilsService.getFormattedTelephoneNumber(pixKey);
10553
- }
10554
- else if (keyType === "CPF") {
10555
- return FormatUtilsService.getFormattedCpf(pixKey);
10556
- }
10557
- else if (keyType === "CNPJ") {
10558
- return FormatUtilsService.getFormattedCnpj(pixKey);
10559
- }
10560
- else {
10561
- return pixKey;
10562
- }
10563
- };
10564
11360
  HistoricalPixAccountListComponent.prototype.getMenuActions = function (rowData) {
10565
11361
  var _this = this;
10566
11362
  return [
@@ -10568,14 +11364,55 @@
10568
11364
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
10569
11365
  command: function () {
10570
11366
  if (_this.isAllowToViewHistorical) {
11367
+ _this.sharedStateService.setHideField(true);
11368
+ _this.isShowActionsButton.emit(false);
11369
+ _this.sharedStateService.setShowEditMode(false);
10571
11370
  var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
10572
11371
  if (_this.withSidebar) {
10573
11372
  _this.isOnlyView.emit(true);
11373
+ _this.isOnlyEdit.emit(false);
11374
+ _this.isHideBtnAddForViewMode.emit(true);
11375
+ _this.sharedStateService.setHideBtnAddForViewMode(true);
11376
+ _this.sharedStateService.setActiveHideOptionsOnView(true);
11377
+ _this.router.navigate(["historical-pix-account/" + dateChange], {
11378
+ relativeTo: _this.activatedRoute,
11379
+ });
11380
+ }
11381
+ else {
11382
+ _this.sharedStateService.setActiveHideOptionsOnView(true);
11383
+ _this.sharedStateService.setSaveButton(false);
11384
+ _this.enableView.emit(dateChange);
11385
+ }
11386
+ }
11387
+ else {
11388
+ _this.isNotAllowMessage();
11389
+ }
11390
+ },
11391
+ },
11392
+ {
11393
+ label: this.translateService.instant("hcm.payroll.edit"),
11394
+ command: function () {
11395
+ if (_this.isAllowToEditHistorical) {
11396
+ _this.sharedStateService.setHideField(true);
11397
+ _this.isShowActionsButton.emit(true);
11398
+ _this.sharedStateService.setShowEditMode(true);
11399
+ var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
11400
+ if (_this.withSidebar) {
11401
+ _this.isOnlyView.emit(false);
11402
+ _this.isOnlyEdit.emit(true);
11403
+ _this.isHideBtnAddForViewMode.emit(false);
11404
+ _this.sharedStateService.setHideBtnAddForViewMode(false);
11405
+ _this.sharedStateService.setActiveHideOptionsOnView(false);
10574
11406
  _this.router.navigate(["historical-pix-account/" + dateChange], {
10575
11407
  relativeTo: _this.activatedRoute,
10576
11408
  });
10577
11409
  }
10578
11410
  else {
11411
+ _this.sharedStateService.setActiveHideOptionsOnView(false);
11412
+ setTimeout(function () {
11413
+ _this.sharedStateService.triggerActiveValidatorsOnEditModalOpen();
11414
+ });
11415
+ _this.sharedStateService.setSaveButton(true);
10579
11416
  _this.enableView.emit(dateChange);
10580
11417
  }
10581
11418
  }
@@ -10594,7 +11431,7 @@
10594
11431
  _this.isNotAllowMessage();
10595
11432
  }
10596
11433
  },
10597
- },
11434
+ }
10598
11435
  ];
10599
11436
  };
10600
11437
  HistoricalPixAccountListComponent.prototype.delete = function (id, dateChange) {
@@ -10661,6 +11498,24 @@
10661
11498
  this.lastRecord = payload[0];
10662
11499
  }
10663
11500
  };
11501
+ HistoricalPixAccountListComponent.prototype.unsubscribe = function () {
11502
+ if (this._subscription) {
11503
+ this._subscription.unsubscribe();
11504
+ }
11505
+ };
11506
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", {
11507
+ set: function (subject) {
11508
+ var _this = this;
11509
+ this.unsubscribe();
11510
+ if (subject) {
11511
+ this._subscription = subject.subscribe(function (value) {
11512
+ _this.sharedStateService.setHideField(value);
11513
+ });
11514
+ }
11515
+ },
11516
+ enumerable: true,
11517
+ configurable: true
11518
+ });
10664
11519
  Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToAddHistorical", {
10665
11520
  get: function () {
10666
11521
  return (this.permission["incluir"]);
@@ -10682,6 +11537,13 @@
10682
11537
  enumerable: true,
10683
11538
  configurable: true
10684
11539
  });
11540
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToEditHistorical", {
11541
+ get: function () {
11542
+ return (this.permission["editar"]);
11543
+ },
11544
+ enumerable: true,
11545
+ configurable: true
11546
+ });
10685
11547
  Object.defineProperty(HistoricalPixAccountListComponent.prototype, "scopedActions", {
10686
11548
  get: function () {
10687
11549
  return this.getMenuActions.bind(this);
@@ -10706,7 +11568,8 @@
10706
11568
  { type: core.ChangeDetectorRef },
10707
11569
  { type: router.Router },
10708
11570
  { type: api.MessageService },
10709
- { type: HistoricalPixAccountListService }
11571
+ { type: HistoricalPixAccountListService },
11572
+ { type: SharedStateService }
10710
11573
  ]; };
10711
11574
  __decorate([
10712
11575
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
@@ -10732,12 +11595,33 @@
10732
11595
  __decorate([
10733
11596
  core.Input()
10734
11597
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
11598
+ __decorate([
11599
+ core.Input()
11600
+ ], HistoricalPixAccountListComponent.prototype, "hideField", void 0);
11601
+ __decorate([
11602
+ core.Input()
11603
+ ], HistoricalPixAccountListComponent.prototype, "showActionsButtonOnAdd", void 0);
10735
11604
  __decorate([
10736
11605
  core.Output()
10737
11606
  ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
11607
+ __decorate([
11608
+ core.Output()
11609
+ ], HistoricalPixAccountListComponent.prototype, "isOnlyEdit", void 0);
10738
11610
  __decorate([
10739
11611
  core.Output()
10740
11612
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
11613
+ __decorate([
11614
+ core.Output()
11615
+ ], HistoricalPixAccountListComponent.prototype, "isEditJudicialDependentPix", void 0);
11616
+ __decorate([
11617
+ core.Output()
11618
+ ], HistoricalPixAccountListComponent.prototype, "isHideBtnAddForViewMode", void 0);
11619
+ __decorate([
11620
+ core.Output()
11621
+ ], HistoricalPixAccountListComponent.prototype, "isShowActionsButton", void 0);
11622
+ __decorate([
11623
+ core.Input()
11624
+ ], HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", null);
10741
11625
  __decorate([
10742
11626
  core.Input()
10743
11627
  ], HistoricalPixAccountListComponent.prototype, "reloadList", null);
@@ -10860,6 +11744,7 @@
10860
11744
  exports.PermissionService = PermissionService;
10861
11745
  exports.ReportService = ReportService;
10862
11746
  exports.ServicesModule = ServicesModule;
11747
+ exports.SharedStateService = SharedStateService;
10863
11748
  exports.SpinnerLoaderComponent = SpinnerLoaderComponent;
10864
11749
  exports.SpinnerLoaderModule = SpinnerLoaderModule;
10865
11750
  exports.StringMethods = StringMethods;
@@ -10955,7 +11840,8 @@
10955
11840
  exports.ɵo = AutocompleteService;
10956
11841
  exports.ɵp = LookupService$1;
10957
11842
  exports.ɵq = HistoricalBankAccountFormComponent;
10958
- exports.ɵr = HistoricalPixAccountFormComponent;
11843
+ exports.ɵr = HistoricakPixAccountBase;
11844
+ exports.ɵs = HistoricalPixAccountFormComponent;
10959
11845
 
10960
11846
  Object.defineProperty(exports, '__esModule', { value: true });
10961
11847