@senior-gestao-pessoas/payroll-core 9.4.0 → 9.5.0-71c63479-42df-4b8e-8295-7f214bdd37f5

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 +950 -522
  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 +8 -40
  7. package/components/historical-pix-account/historical-pix-account.component.d.ts +37 -8
  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 +11 -2
  10. package/components/shared/index.d.ts +1 -0
  11. package/components/shared/shared-state.service.d.ts +17 -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 +173 -0
  14. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +29 -187
  15. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +231 -20
  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 +68 -34
  19. package/esm2015/components/shared/index.js +2 -0
  20. package/esm2015/components/shared/shared-state.service.js +41 -0
  21. package/esm2015/components/utils/format-utils/format-utils.service.js +88 -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 +186 -0
  25. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +53 -201
  26. package/esm5/components/historical-pix-account/historical-pix-account.component.js +273 -49
  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 +77 -34
  30. package/esm5/components/shared/index.js +2 -0
  31. package/esm5/components/shared/shared-state.service.js +42 -0
  32. package/esm5/components/utils/format-utils/format-utils.service.js +88 -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 +867 -484
  36. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  37. package/fesm5/senior-gestao-pessoas-payroll-core.js +946 -519
  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.
@@ -9412,60 +9478,500 @@
9412
9478
  event.target.value = FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9413
9479
  };
9414
9480
  /**
9415
- * Metódo para formatar a porcentagem para 2 casas decimais.
9416
- * @param value Número a ser formatado.
9481
+ * Formata o campo de input de CPF em tempo real.
9482
+ * @param event Evento do input
9417
9483
  */
9418
- FormatUtilsService.getFormattedPercentage = function (value) {
9419
- return parseFloat(value).toFixed(2).replace('.', ',') + '%';
9484
+ FormatUtilsService.formatCpfInputEvent = function (event) {
9485
+ var cpf = event.target.value;
9486
+ // Permite apagar nos pontos sensíveis
9487
+ if (event.keyCode === 8 && (cpf.length === 4 || cpf.length === 8 || cpf.length === 12)) {
9488
+ return;
9489
+ }
9490
+ event.target.value = FormatUtilsService.getFormattedCpfEdited(cpf);
9491
+ };
9492
+ /**
9493
+ * Formata o campo de input de CNPJ em tempo real.
9494
+ * @param event Evento do input
9495
+ */
9496
+ FormatUtilsService.formatCnpjInputEvent = function (event) {
9497
+ var cnpj = event.target.value;
9498
+ // Permite apagar nos pontos sensíveis
9499
+ if (event.keyCode === 8 && (cnpj.length === 3 || cnpj.length === 7 || cnpj.length === 11 || cnpj.length === 16)) {
9500
+ return;
9501
+ }
9502
+ event.target.value = FormatUtilsService.getFormattedCnpjEdited(cnpj);
9420
9503
  };
9421
9504
  return FormatUtilsService;
9422
9505
  }());
9423
9506
 
9424
- var HistoricalPixAccountComponent = /** @class */ (function () {
9425
- function HistoricalPixAccountComponent(translateService, cd, formBuilder, messageService) {
9426
- var _this = this;
9427
- this.translateService = translateService;
9428
- this.cd = cd;
9507
+ var SharedStateService = /** @class */ (function () {
9508
+ function SharedStateService() {
9509
+ this.hideFieldSubject = new rxjs.BehaviorSubject(true);
9510
+ this.hideField$ = this.hideFieldSubject.asObservable();
9511
+ this.showButtonSubject = new rxjs.BehaviorSubject(true);
9512
+ this.showButton$ = this.showButtonSubject.asObservable();
9513
+ this.saveButtonSubject = new rxjs.BehaviorSubject(true);
9514
+ this.saveButton$ = this.saveButtonSubject.asObservable();
9515
+ this.showEditMode = new rxjs.BehaviorSubject(true);
9516
+ this.showEditMode$ = this.showEditMode.asObservable();
9517
+ this.activeValidatorsOnEditModalOpen = new rxjs.Subject();
9518
+ this.activeValidatorsOnEditModalOpen$ = this.activeValidatorsOnEditModalOpen.asObservable();
9519
+ }
9520
+ SharedStateService.prototype.setHideField = function (value) {
9521
+ this.hideFieldSubject.next(value);
9522
+ };
9523
+ SharedStateService.prototype.setShowButton = function (value) {
9524
+ this.showButtonSubject.next(value);
9525
+ };
9526
+ SharedStateService.prototype.setSaveButton = function (value) {
9527
+ this.saveButtonSubject.next(value);
9528
+ };
9529
+ SharedStateService.prototype.setShowEditMode = function (value) {
9530
+ this.showEditMode.next(value);
9531
+ };
9532
+ SharedStateService.prototype.triggerActiveValidatorsOnEditModalOpen = function () {
9533
+ this.activeValidatorsOnEditModalOpen.next();
9534
+ };
9535
+ SharedStateService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function SharedStateService_Factory() { return new SharedStateService(); }, token: SharedStateService, providedIn: "root" });
9536
+ SharedStateService = __decorate([
9537
+ core.Injectable({
9538
+ providedIn: 'root',
9539
+ })
9540
+ ], SharedStateService);
9541
+ return SharedStateService;
9542
+ }());
9543
+
9544
+ var GenericValidator = /** @class */ (function () {
9545
+ function GenericValidator() {
9546
+ }
9547
+ /**
9548
+ * Valida o CEI (Cadastro específico de INSS) digitado.
9549
+ */
9550
+ GenericValidator.isValidCei = function (control) {
9551
+ var cei = control.value;
9552
+ if (!cei)
9553
+ return null;
9554
+ else if (cei.length != 11)
9555
+ return null;
9556
+ var multiplicadorBase = "3298765432";
9557
+ var total = 0;
9558
+ var resto = 0;
9559
+ var multiplicando = 0;
9560
+ var multiplicador = 0;
9561
+ if (cei.length !== 11 ||
9562
+ cei === "00000000000" ||
9563
+ cei === "11111111111" ||
9564
+ cei === "22222222222" ||
9565
+ cei === "33333333333" ||
9566
+ cei === "44444444444" ||
9567
+ cei === "55555555555" ||
9568
+ cei === "66666666666" ||
9569
+ cei === "77777777777" ||
9570
+ cei === "88888888888" ||
9571
+ cei === "99999999999")
9572
+ return { invalidCei: true };
9573
+ else {
9574
+ for (var i = 0; i < 10; i++) {
9575
+ multiplicando = parseInt(cei.substring(i, i + 1), 10);
9576
+ multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
9577
+ total += multiplicando * multiplicador;
9578
+ }
9579
+ resto = 11 - (total % 11);
9580
+ resto = resto === 10 || resto === 11 ? 0 : resto;
9581
+ var digito = parseInt("" + cei.charAt(10), 10);
9582
+ return resto === digito ? null : { invalidCei: true };
9583
+ }
9584
+ };
9585
+ /**
9586
+ * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9587
+ */
9588
+ GenericValidator.isValidCpf = function (control) {
9589
+ var cpf = control.value;
9590
+ if (cpf) {
9591
+ var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9592
+ equalDigits = 1;
9593
+ if (cpf.length < 11) {
9594
+ return null;
9595
+ }
9596
+ for (i = 0; i < cpf.length - 1; i++) {
9597
+ if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9598
+ equalDigits = 0;
9599
+ break;
9600
+ }
9601
+ }
9602
+ if (!equalDigits) {
9603
+ numbers = cpf.substring(0, 9);
9604
+ digits = cpf.substring(9);
9605
+ sum = 0;
9606
+ for (i = 10; i > 1; i--) {
9607
+ sum += numbers.charAt(10 - i) * i;
9608
+ }
9609
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9610
+ if (result !== Number(digits.charAt(0))) {
9611
+ return { cpfNotValid: true };
9612
+ }
9613
+ numbers = cpf.substring(0, 10);
9614
+ sum = 0;
9615
+ for (i = 11; i > 1; i--) {
9616
+ sum += numbers.charAt(11 - i) * i;
9617
+ }
9618
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9619
+ if (result !== Number(digits.charAt(1))) {
9620
+ return { cpfNotValid: true };
9621
+ }
9622
+ return null;
9623
+ }
9624
+ else {
9625
+ return { cpfNotValid: true };
9626
+ }
9627
+ }
9628
+ return null;
9629
+ };
9630
+ /**
9631
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9632
+ */
9633
+ GenericValidator.isValidCnpj = function (control) {
9634
+ var cnpj = control.value;
9635
+ if (cnpj) {
9636
+ var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9637
+ cnpj = cnpj.replace(/[^\d]+/g, '');
9638
+ if (cnpj.length !== 14) {
9639
+ return null;
9640
+ }
9641
+ // Elimina CNPJs invalidos conhecidos
9642
+ if (cnpj === '00000000000000' ||
9643
+ cnpj === '11111111111111' ||
9644
+ cnpj === '22222222222222' ||
9645
+ cnpj === '33333333333333' ||
9646
+ cnpj === '44444444444444' ||
9647
+ cnpj === '55555555555555' ||
9648
+ cnpj === '66666666666666' ||
9649
+ cnpj === '77777777777777' ||
9650
+ cnpj === '88888888888888' ||
9651
+ cnpj === '99999999999999') {
9652
+ return { cnpjNotValid: true };
9653
+ }
9654
+ // Valida DVs
9655
+ size = cnpj.length - 2;
9656
+ numbers = cnpj.substring(0, size);
9657
+ digits = cnpj.substring(size);
9658
+ sum = 0;
9659
+ pos = size - 7;
9660
+ for (var i = size; i >= 1; i--) {
9661
+ sum += numbers.charAt(size - i) * pos--;
9662
+ if (pos < 2) {
9663
+ pos = 9;
9664
+ }
9665
+ }
9666
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9667
+ if (result !== Number(digits.charAt(0))) {
9668
+ return { cnpjNotValid: true };
9669
+ }
9670
+ size = size + 1;
9671
+ numbers = cnpj.substring(0, size);
9672
+ sum = 0;
9673
+ pos = size - 7;
9674
+ for (var i = size; i >= 1; i--) {
9675
+ sum += numbers.charAt(size - i) * pos--;
9676
+ if (pos < 2) {
9677
+ pos = 9;
9678
+ }
9679
+ }
9680
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9681
+ if (result !== Number(digits.charAt(1))) {
9682
+ return { cnpjNotValid: true };
9683
+ }
9684
+ return null;
9685
+ }
9686
+ return null;
9687
+ };
9688
+ /**
9689
+ * Válida o número de telefone da chave PIX.
9690
+ */
9691
+ GenericValidator.isValidPhoneNumber = function (control) {
9692
+ var cellPhoneKey = control.value || '';
9693
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9694
+ var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9695
+ var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9696
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9697
+ };
9698
+ /**
9699
+ * Valida o email da chave PIX.
9700
+ */
9701
+ GenericValidator.isValidEmail = function (control) {
9702
+ var emailKey = control.value;
9703
+ var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9704
+ var isValidEmail = regexValidEmail.test(emailKey);
9705
+ return isValidEmail ? null : { invalidEmail: true };
9706
+ };
9707
+ return GenericValidator;
9708
+ }());
9709
+
9710
+ var HistoricakPixAccountBase = /** @class */ (function () {
9711
+ function HistoricakPixAccountBase(formBuilder) {
9712
+ this._paramsForm = new forms.FormGroup({});
9713
+ this._defaultCpfNumber = null;
9714
+ this.initialValidatorOfPercentage = [forms.Validators.required, forms.Validators.min(0.01)];
9715
+ this.pixAccountList = [];
9716
+ this.maxValuePercentage = 100.0;
9717
+ this.isShowPixKeyFieldValidatorMessage = false;
9429
9718
  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 = {
9719
+ this.createFormGroupBase();
9720
+ }
9721
+ HistoricakPixAccountBase.prototype.phoneMask = function (event) {
9722
+ FormatUtilsService.formatTelephoneInputEvent(event);
9723
+ };
9724
+ HistoricakPixAccountBase.prototype.cpfMask = function (event) {
9725
+ FormatUtilsService.formatCpfInputEvent(event);
9726
+ };
9727
+ HistoricakPixAccountBase.prototype.cnpjMask = function (event) {
9728
+ FormatUtilsService.formatCnpjInputEvent(event);
9729
+ };
9730
+ HistoricakPixAccountBase.prototype.onChangePixKeyType = function (item, form) {
9731
+ if (!item || !item.key)
9732
+ return;
9733
+ this.pixKeyType = item.key;
9734
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9735
+ ? form
9736
+ : this.pixAccountFormGroup;
9737
+ this.isShowPixKeyFieldValidatorMessage = true;
9738
+ var pixKeyControl = targetForm.get("pixKey");
9739
+ if (pixKeyControl) {
9740
+ pixKeyControl.reset();
9741
+ }
9742
+ this.setPixKeyValidators(true, targetForm);
9743
+ if (item.key === "CPF") {
9744
+ this.setDefaultCpfPixKey(targetForm);
9745
+ }
9746
+ };
9747
+ HistoricakPixAccountBase.prototype.onClearPixKeyType = function (form) {
9748
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9749
+ ? form
9750
+ : this.pixAccountFormGroup;
9751
+ this.isShowPixKeyFieldValidatorMessage = false;
9752
+ if (targetForm.get("pixKey")) {
9753
+ targetForm.get("pixKey").reset();
9754
+ }
9755
+ };
9756
+ HistoricakPixAccountBase.prototype.setDefaultCpfPixKey = function (form) {
9757
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9758
+ ? form
9759
+ : this.pixAccountFormGroup;
9760
+ if (this._defaultCpfNumber) {
9761
+ if (targetForm.get("pixKey")) {
9762
+ targetForm.get("pixKey").setValue(this._defaultCpfNumber);
9763
+ }
9764
+ }
9765
+ else {
9766
+ var sheetDocument = this._paramsForm.get("sheetDocument");
9767
+ if (sheetDocument && sheetDocument.get("cpfNumber")) {
9768
+ var cpf = sheetDocument.get("cpfNumber").value;
9769
+ if (cpf && targetForm.get("pixKey")) {
9770
+ targetForm.get("pixKey").setValue(cpf);
9771
+ }
9772
+ }
9773
+ }
9774
+ };
9775
+ HistoricakPixAccountBase.prototype.createFormGroupBase = function () {
9776
+ this.pixAccountFormGroup = this.formBuilder.group({
9777
+ id: this.formBuilder.control(null),
9778
+ index: this.formBuilder.control(null),
9779
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9780
+ dateChange: this.formBuilder.control(null),
9781
+ pixKeyType: this.formBuilder.control(null, forms.Validators.required),
9782
+ pixKey: this.formBuilder.control(null),
9783
+ percentage: this.formBuilder.control(null, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9784
+ forms.Validators.max(this.maxValuePercentage),
9785
+ ]))),
9786
+ externalId: this.formBuilder.control(null),
9787
+ customFields: this.formBuilder.control(null),
9788
+ });
9789
+ };
9790
+ HistoricakPixAccountBase.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode, form) {
9791
+ if (index === void 0) { index = null; }
9792
+ if (isEditMode === void 0) { isEditMode = true; }
9793
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9794
+ ? form
9795
+ : this.pixAccountFormGroup;
9796
+ this.pixAccountList = (pixAccountList && pixAccountList.length > 0)
9797
+ ? [].concat(pixAccountList)
9798
+ : [];
9799
+ var percentageIncluded = [];
9800
+ for (var i = 0; i < this.pixAccountList.length; i++) {
9801
+ var field = this.pixAccountList[i];
9802
+ if (field && field.percentage && i !== index) {
9803
+ percentageIncluded.push(field.percentage);
9804
+ }
9805
+ }
9806
+ this.beforeSetPixKeyTypeValidator(targetForm);
9807
+ this.setPixKeyValidators(isEditMode, targetForm);
9808
+ this.validatePercentageValid(percentageIncluded, targetForm);
9809
+ };
9810
+ HistoricakPixAccountBase.prototype.beforeSetPixKeyTypeValidator = function (form) {
9811
+ var control = form.get("pixKeyType");
9812
+ if (this.pixAccountList && this.pixAccountList.length) {
9813
+ control.setValidators(forms.Validators.compose([
9814
+ forms.Validators.required,
9815
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
9816
+ ]));
9817
+ }
9818
+ else {
9819
+ control.setValidators(forms.Validators.required);
9820
+ }
9821
+ control.updateValueAndValidity();
9822
+ };
9823
+ HistoricakPixAccountBase.prototype.setPixKeyValidators = function (isEditMode, form) {
9824
+ var pixKey = form.get("pixKey");
9825
+ switch (this.pixKeyType) {
9826
+ case "TELEPHONE":
9827
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidPhoneNumber]));
9828
+ break;
9829
+ case "EMAIL":
9830
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidEmail]));
9831
+ break;
9832
+ case "CPF":
9833
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidCpf]));
9834
+ break;
9835
+ case "CNPJ":
9836
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidCnpj]));
9837
+ break;
9838
+ case "RANDOM_KEY":
9839
+ pixKey.setValidators(forms.Validators.required);
9840
+ break;
9841
+ default:
9842
+ pixKey.clearValidators();
9843
+ }
9844
+ if (isEditMode) {
9845
+ pixKey.enable();
9846
+ }
9847
+ pixKey.updateValueAndValidity();
9848
+ };
9849
+ HistoricakPixAccountBase.prototype.validatePercentageValid = function (listValue, form) {
9850
+ var percentage = form.get("percentage");
9851
+ this.maxValuePercentage = listValue.reduce(function (acc, val) { return acc - val; }, 100.0);
9852
+ percentage.setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9853
+ forms.Validators.max(this.maxValuePercentage),
9854
+ ])));
9855
+ percentage.updateValueAndValidity();
9856
+ };
9857
+ HistoricakPixAccountBase.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
9858
+ return function (control) {
9859
+ var value = control.value;
9860
+ var isDuplicate = listCompare.some(function (field) {
9861
+ return value &&
9862
+ field.pixKeyType.key === "BANK_ACCOUNT" &&
9863
+ value.key === "BANK_ACCOUNT";
9864
+ });
9865
+ return isDuplicate ? { pixKeyTypeBankAccountDuplicate: true } : null;
9866
+ };
9867
+ };
9868
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "paramsForm", {
9869
+ get: function () {
9870
+ return this._paramsForm;
9871
+ },
9872
+ set: function (value) {
9873
+ this._paramsForm = value;
9874
+ },
9875
+ enumerable: true,
9876
+ configurable: true
9877
+ });
9878
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "defaultCpfNumber", {
9879
+ get: function () {
9880
+ return this._defaultCpfNumber;
9881
+ },
9882
+ set: function (value) {
9883
+ this._defaultCpfNumber = value;
9884
+ },
9885
+ enumerable: true,
9886
+ configurable: true
9887
+ });
9888
+ return HistoricakPixAccountBase;
9889
+ }());
9890
+
9891
+ var HistoricalPixAccountService = /** @class */ (function () {
9892
+ function HistoricalPixAccountService(http) {
9893
+ this.http = http;
9894
+ }
9895
+ HistoricalPixAccountService.prototype.query = function (path, body, service) {
9896
+ if (service === void 0) { service = exports.ServiceType.PAYROLL; }
9897
+ return this.http.query(path, body, service);
9898
+ };
9899
+ HistoricalPixAccountService.prototype.enumQuery = function () {
9900
+ var path = 'enumQuery';
9901
+ var body = {
9902
+ names: ['PixKeyType']
9903
+ };
9904
+ return this.http.query(path, body, exports.ServiceType.PAYROLL);
9905
+ };
9906
+ HistoricalPixAccountService.ctorParameters = function () { return [
9907
+ { type: HttpClientService }
9908
+ ]; };
9909
+ HistoricalPixAccountService = __decorate([
9910
+ core.Injectable()
9911
+ ], HistoricalPixAccountService);
9912
+ return HistoricalPixAccountService;
9913
+ }());
9914
+
9915
+ var HistoricalPixAccountComponent = /** @class */ (function (_super) {
9916
+ __extends(HistoricalPixAccountComponent, _super);
9917
+ function HistoricalPixAccountComponent(translateService, cd, formBuilder, sharedStateService, service) {
9918
+ var _this = _super.call(this, formBuilder) || this;
9919
+ _this.translateService = translateService;
9920
+ _this.cd = cd;
9921
+ _this.sharedStateService = sharedStateService;
9922
+ _this.service = service;
9923
+ _this.recordByRow = 1;
9924
+ _this.showDateChange = false;
9925
+ _this.isEditMode = false;
9926
+ _this.isViewMode = false;
9927
+ _this.withSideBar = true;
9928
+ _this.listDataReciever = [];
9929
+ _this.addExistentHistoricData = [];
9930
+ _this.getListPixAccount = [];
9931
+ _this.isEditModeForSave = false;
9932
+ _this.isViewModeActive = new core.EventEmitter();
9933
+ _this.isEditModeActive = new core.EventEmitter();
9934
+ _this.isDeleteModeActive = new core.EventEmitter();
9935
+ _this.isValidChangeForm = new core.EventEmitter();
9936
+ _this.listFromApp = [];
9937
+ _this.visibleChange = new core.EventEmitter();
9938
+ _this.ngUnsubscribe = new rxjs.Subject();
9939
+ _this.orderBy = {
9445
9940
  field: "dateChange",
9446
9941
  direction: exports.DirectionEnumeration.DESC,
9447
9942
  };
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 = [
9943
+ _this.pixAccountItemInput = {};
9944
+ _this.totalRecords = 0;
9945
+ _this.actionLabel = _this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9946
+ _this.loading = true;
9947
+ _this.listData = [];
9948
+ _this.listDataNoPage = [];
9949
+ _this.showButtonView = true;
9950
+ _this.showEditMode = false;
9951
+ _this.hasRecordsPix = true;
9952
+ _this.maxValuePercentage = 100.00;
9953
+ _this.hideFields = _this.sharedStateService.hideField$;
9954
+ _this.suggestions = [];
9955
+ _this.formGroupByRow = {};
9956
+ _this.cols = [
9455
9957
  {
9456
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9958
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9457
9959
  field: "pixKeyType",
9458
9960
  },
9459
9961
  {
9460
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9962
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9461
9963
  field: "pixKey",
9462
9964
  },
9463
9965
  {
9464
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9966
+ label: _this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9465
9967
  field: "percentage",
9466
9968
  },
9969
+ {
9970
+ label: _this.translateService.instant("hcm.payroll.movimentation_generic_action"),
9971
+ field: "actions",
9972
+ }
9467
9973
  ];
9468
- this.actions = function (rowData, key) {
9974
+ _this.actions = function (rowData, key) {
9469
9975
  if (rowData === void 0) { rowData = {}; }
9470
9976
  return [
9471
9977
  {
@@ -9502,7 +10008,7 @@
9502
10008
  },
9503
10009
  },
9504
10010
  {
9505
- visible: !_this.isEditMode,
10011
+ visible: !_this.isEditMode || _this.showEditMode,
9506
10012
  label: _this.translateService.instant("hcm.payroll.delete"),
9507
10013
  command: function () {
9508
10014
  if (_this.isAllowToDeleteHistorical) {
@@ -9520,15 +10026,41 @@
9520
10026
  },
9521
10027
  ];
9522
10028
  };
9523
- this.createFormGroup();
10029
+ _this.createFormGroup();
10030
+ return _this;
9524
10031
  }
9525
10032
  HistoricalPixAccountComponent.prototype.ngOnInit = function () {
10033
+ var _this = this;
9526
10034
  this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
10035
+ this.sharedStateService.showButton$.subscribe(function (value) {
10036
+ _this.showButtonView = value;
10037
+ });
10038
+ this.sharedStateService.showEditMode$.subscribe(function (value) {
10039
+ _this.showEditMode = value;
10040
+ _this.isEditModeForSave = value;
10041
+ });
10042
+ this.sharedStateService.activeValidatorsOnEditModalOpen$
10043
+ .subscribe(function () {
10044
+ Object.values(_this.formGroupByRow).forEach(function (fg) {
10045
+ Object.values(fg.controls).forEach(function (control) {
10046
+ control.markAsTouched();
10047
+ control.updateValueAndValidity();
10048
+ });
10049
+ });
10050
+ _this.emitFormValidity();
10051
+ });
9527
10052
  };
9528
10053
  HistoricalPixAccountComponent.prototype.ngOnChanges = function (changes) {
9529
10054
  if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
9530
10055
  this.listFromApp = changes['listDataReciever'].currentValue;
9531
10056
  }
10057
+ if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
10058
+ this.getHistoricalPixAccountList();
10059
+ }
10060
+ if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
10061
+ var newData = changes['addExistentHistoricData'].currentValue;
10062
+ this.rebuildFormGroupMap(newData);
10063
+ }
9532
10064
  };
9533
10065
  HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9534
10066
  this.historicalPixAccountList = this.formBuilder.group({
@@ -9542,6 +10074,98 @@
9542
10074
  HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9543
10075
  this.cd.detectChanges();
9544
10076
  };
10077
+ HistoricalPixAccountComponent.prototype.emitFormValidity = function () {
10078
+ var allValid = Object.values(this.formGroupByRow).every(function (fg) {
10079
+ fg.updateValueAndValidity();
10080
+ return fg.valid;
10081
+ });
10082
+ this.isValidChangeForm.emit(allValid);
10083
+ };
10084
+ HistoricalPixAccountComponent.prototype.filterPixKeyType = function (event) {
10085
+ var _this = this;
10086
+ var query = event.query;
10087
+ this.service.enumQuery().subscribe(function (response) {
10088
+ var pixKeyTypeEnum = response.results.find(function (result) { return result.enumName === 'PixKeyType'; });
10089
+ if (pixKeyTypeEnum) {
10090
+ _this.suggestions = pixKeyTypeEnum.items.filter(function (item) {
10091
+ return item.value.toLowerCase().includes(query.toLowerCase());
10092
+ });
10093
+ }
10094
+ else {
10095
+ _this.suggestions = [];
10096
+ }
10097
+ });
10098
+ };
10099
+ HistoricalPixAccountComponent.prototype.createPixRowFormGroup = function () {
10100
+ return this.formBuilder.group({
10101
+ pixKeyType: [null, forms.Validators.required],
10102
+ pixKey: [null],
10103
+ percentage: [0, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10104
+ forms.Validators.max(this.maxValuePercentage),
10105
+ ]))]
10106
+ });
10107
+ };
10108
+ HistoricalPixAccountComponent.prototype.onPixKeyInput = function (event, index) {
10109
+ var inputValue = event.target.value;
10110
+ var inputRawValue = inputValue.replace(/\D/g, '');
10111
+ var form = this.formGroupByRow[index];
10112
+ var pixKeyControl = form.get('pixKey');
10113
+ if (pixKeyControl) {
10114
+ pixKeyControl.setValue(inputRawValue, { emitEvent: false });
10115
+ pixKeyControl.markAsDirty();
10116
+ pixKeyControl.updateValueAndValidity();
10117
+ }
10118
+ this.setPixKeyValidators(true, form);
10119
+ this.emitFormValidity();
10120
+ };
10121
+ HistoricalPixAccountComponent.prototype.onBlurPixCpfAndCnpj = function (index) {
10122
+ var form = this.formGroupByRow[index];
10123
+ var pixKeyControl = form.get('pixKey');
10124
+ var pixKeyTypeControl = form.get('pixKeyType');
10125
+ if (!pixKeyControl || !pixKeyTypeControl)
10126
+ return;
10127
+ var currentValue = pixKeyControl.value;
10128
+ var pixKeyType = pixKeyTypeControl.value.key;
10129
+ var rawValue = (currentValue || '').replace(/\D/g, '');
10130
+ pixKeyControl.setValue(rawValue, { emitEvent: false });
10131
+ if (pixKeyControl.valid) {
10132
+ form.patchValue({
10133
+ pixKeyFormatted: FormatUtilsService.getFormattedSubscriptionNumber(rawValue, pixKeyType)
10134
+ });
10135
+ }
10136
+ this.emitFormValidity();
10137
+ };
10138
+ HistoricalPixAccountComponent.prototype.getFormattedPixKey = function (type, value) {
10139
+ return FormatUtilsService.getFormattedSubscriptionNumber(value, type);
10140
+ };
10141
+ HistoricalPixAccountComponent.prototype.syncPixDataToParentForm = function () {
10142
+ if (!this.isEditModeForSave)
10143
+ return;
10144
+ var values = Object.values(this.formGroupByRow).map(function (fg) {
10145
+ var value = fg.getRawValue();
10146
+ var pixKeyType = value.pixKeyType.key;
10147
+ if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ') {
10148
+ value.pixKey = (value.pixKey || '').replace(/[.\-\/]/g, '');
10149
+ }
10150
+ else if (pixKeyType === 'TELEPHONE') {
10151
+ value.pixKey = (value.pixKey || '').replace(/[()\s\-]/g, '');
10152
+ }
10153
+ return value;
10154
+ });
10155
+ this.formGroup
10156
+ .get(this.fieldFormGroup)
10157
+ .get('historicalPixAccountList')
10158
+ .setValue(values);
10159
+ this.emitFormValidity();
10160
+ };
10161
+ HistoricalPixAccountComponent.prototype.syncResetPixFormToParent = function () {
10162
+ this.formGroupByRow = {};
10163
+ this.historicalPixAccountList.reset();
10164
+ this.historicalPixAccountList.get('historicalPixAccountList').setValue([]);
10165
+ if (this.addExistentHistoricData.length) {
10166
+ this.rebuildFormGroupMap(this.addExistentHistoricData);
10167
+ }
10168
+ };
9545
10169
  HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
9546
10170
  var _this = this;
9547
10171
  var first = event && event.first ? event.first : 0;
@@ -9569,6 +10193,7 @@
9569
10193
  this.refreshCssInIE11();
9570
10194
  }
9571
10195
  this.loading = false;
10196
+ this.cd.detectChanges();
9572
10197
  };
9573
10198
  /**
9574
10199
  * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
@@ -9586,12 +10211,61 @@
9586
10211
  this.pixAccountItemInput = {};
9587
10212
  this.visible = true;
9588
10213
  };
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"),
10214
+ HistoricalPixAccountComponent.prototype.addPix = function () {
10215
+ var newItem = {
10216
+ pixKeyType: {},
10217
+ pixKey: '',
10218
+ percentage: 0
10219
+ };
10220
+ var index = this.addExistentHistoricData.length;
10221
+ this.addExistentHistoricData = __spread(this.addExistentHistoricData, [
10222
+ newItem
10223
+ ]);
10224
+ this.formGroupByRow[index] = this.createPixRowFormGroup();
10225
+ this.setValidatorsAccordingList(this.addExistentHistoricData, index, true);
10226
+ this.emitFormValidity();
10227
+ };
10228
+ HistoricalPixAccountComponent.prototype.deletePix = function (index) {
10229
+ this.addExistentHistoricData = this.addExistentHistoricData.filter(function (_, i) { return i !== index; });
10230
+ this.rebuildFormGroupMap(this.addExistentHistoricData);
10231
+ this.emitFormValidity();
10232
+ };
10233
+ HistoricalPixAccountComponent.prototype.rebuildFormGroupMap = function (data) {
10234
+ var _this = this;
10235
+ this.formGroupByRow = {};
10236
+ data.forEach(function (item, index) {
10237
+ var form = _this.createPixRowFormGroup();
10238
+ var pixKeyType = item.pixKeyType.key;
10239
+ var pixKeyRaw = item.pixKey;
10240
+ if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ') {
10241
+ item.pixKey = FormatUtilsService.getFormattedSubscriptionNumber(pixKeyRaw, pixKeyType);
10242
+ }
10243
+ if (pixKeyType === 'TELEPHONE') {
10244
+ item.pixKey = FormatUtilsService.getFormattedTelephoneNumber(pixKeyRaw);
10245
+ }
10246
+ form.patchValue(item);
10247
+ _this.formGroupByRow[index] = form;
10248
+ _this.pixKeyType = pixKeyType;
10249
+ _this.setPixKeyValidators(true, form);
10250
+ _this.setValidatorsAccordingList(data, index, _this.isEditMode);
10251
+ });
10252
+ this.emitFormValidity();
10253
+ };
10254
+ HistoricalPixAccountComponent.prototype.onPixKeyTypeChange = function (item, index) {
10255
+ var _this = this;
10256
+ var form = this.formGroupByRow[index];
10257
+ this.onChangePixKeyType(item, form);
10258
+ this.addExistentHistoricData[index].pixKey = '';
10259
+ setTimeout(function () {
10260
+ if (_this.dataListPix.editingCell) {
10261
+ _this.dataListPix.editingCell = null;
10262
+ }
9594
10263
  });
10264
+ this.cd.detectChanges();
10265
+ };
10266
+ HistoricalPixAccountComponent.prototype.onPixKeyTypeClear = function (index) {
10267
+ var form = this.formGroupByRow[index];
10268
+ this.onClearPixKeyType(form);
9595
10269
  };
9596
10270
  HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
9597
10271
  var newlist = __spread(this.getHistoricalPixAccountList());
@@ -9653,6 +10327,15 @@
9653
10327
  this.msgTotalLimitByPercentage = null;
9654
10328
  }
9655
10329
  };
10330
+ HistoricalPixAccountComponent.prototype.onSyncValue = function (field, index) {
10331
+ if (this.formGroupByRow &&
10332
+ this.formGroupByRow[index] &&
10333
+ this.formGroupByRow[index].get(field)) {
10334
+ var value = this.formGroupByRow[index].get(field).value;
10335
+ this.addExistentHistoricData[index][field] = value;
10336
+ }
10337
+ this.emitFormValidity();
10338
+ };
9656
10339
  Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
9657
10340
  get: function () {
9658
10341
  return this.actions.bind(this);
@@ -9723,6 +10406,20 @@
9723
10406
  enumerable: true,
9724
10407
  configurable: true
9725
10408
  });
10409
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "paramsForm", {
10410
+ set: function (value) {
10411
+ this._paramsForm = value;
10412
+ },
10413
+ enumerable: true,
10414
+ configurable: true
10415
+ });
10416
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "defaultCpfNumber", {
10417
+ set: function (value) {
10418
+ this._defaultCpfNumber = value;
10419
+ },
10420
+ enumerable: true,
10421
+ configurable: true
10422
+ });
9726
10423
  HistoricalPixAccountComponent.prototype.close = function () {
9727
10424
  this.visible = false;
9728
10425
  };
@@ -9770,11 +10467,15 @@
9770
10467
  { type: core$1.TranslateService },
9771
10468
  { type: core.ChangeDetectorRef },
9772
10469
  { type: forms.FormBuilder },
9773
- { type: api.MessageService }
10470
+ { type: SharedStateService },
10471
+ { type: HistoricalPixAccountService }
9774
10472
  ]; };
9775
10473
  __decorate([
9776
10474
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
9777
10475
  ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
10476
+ __decorate([
10477
+ core.ViewChild('dataListPix', { static: false })
10478
+ ], HistoricalPixAccountComponent.prototype, "dataListPix", void 0);
9778
10479
  __decorate([
9779
10480
  core.Input()
9780
10481
  ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
@@ -9799,253 +10500,97 @@
9799
10500
  __decorate([
9800
10501
  core.Input()
9801
10502
  ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
9802
- __decorate([
9803
- core.Input()
9804
- ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
9805
- __decorate([
9806
- core.Input()
9807
- ], HistoricalPixAccountComponent.prototype, "currency", void 0);
9808
- __decorate([
9809
- core.Input()
9810
- ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9811
- __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
- };
10503
+ __decorate([
10504
+ core.Input()
10505
+ ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
10506
+ __decorate([
10507
+ core.Input()
10508
+ ], HistoricalPixAccountComponent.prototype, "currency", void 0);
10509
+ __decorate([
10510
+ core.Input()
10511
+ ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
10512
+ __decorate([
10513
+ core.Input()
10514
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
10515
+ __decorate([
10516
+ core.Input()
10517
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
10518
+ __decorate([
10519
+ core.Input()
10520
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
10521
+ __decorate([
10522
+ core.Input()
10523
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
10524
+ __decorate([
10525
+ core.Input()
10526
+ ], HistoricalPixAccountComponent.prototype, "addExistentHistoricData", void 0);
10527
+ __decorate([
10528
+ core.Input()
10529
+ ], HistoricalPixAccountComponent.prototype, "getListPixAccount", void 0);
10530
+ __decorate([
10531
+ core.Input()
10532
+ ], HistoricalPixAccountComponent.prototype, "isEditModeForSave", void 0);
10533
+ __decorate([
10534
+ core.Output()
10535
+ ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
10536
+ __decorate([
10537
+ core.Output()
10538
+ ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
10539
+ __decorate([
10540
+ core.Output()
10541
+ ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
10542
+ __decorate([
10543
+ core.Output()
10544
+ ], HistoricalPixAccountComponent.prototype, "isValidChangeForm", void 0);
10545
+ __decorate([
10546
+ core.Input()
10547
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
10548
+ __decorate([
10549
+ core.Input()
10550
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
10551
+ __decorate([
10552
+ core.Input()
10553
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
10554
+ __decorate([
10555
+ core.Input()
10556
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
10557
+ __decorate([
10558
+ core.Input()
10559
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", null);
10560
+ __decorate([
10561
+ core.Input()
10562
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", null);
10563
+ HistoricalPixAccountComponent = __decorate([
10564
+ core.Component({
10565
+ // tslint:disable-next-line:component-selector
10566
+ selector: "c-historical-pix-account",
10567
+ 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 *ngIf=\"!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=\"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 (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 <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 [ngClass]=\"{'required': item.pixKeyType.key !== 'BANK_ACCOUNT',\n 'disabled': item.pixKeyType && item.pixKeyType.key === 'BANK_ACCOUNT'\n }\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <ng-container [ngSwitch]=\"item.pixKeyType.key\">\n <input *ngSwitchCase=\"'TELEPHONE'\"\n only-number\n pInputText\n type=\"text\"\n formControlName=\"pixKey\"\n (keyup)=\"phoneMask($event)\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n maxlength=\"15\"\n placeholder=\"(__) ____-____\" />\n\n <input *ngSwitchCase=\"'CPF'\"\n type=\"text\"\n pInputText\n formControlName=\"pixKey\"\n maxlength=\"14\"\n placeholder=\"___.___.___-__\"\n (input)=\"onPixKeyInput($event, rowIndex)\"\n (blur)=\"onBlurPixCpfAndCnpj(rowIndex)\"\n (keyup)=\"cpfMask($event)\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\" />\n\n <input *ngSwitchCase=\"'CNPJ'\"\n type=\"text\"\n pInputText\n formControlName=\"pixKey\"\n maxlength=\"18\"\n placeholder=\"___.___.___/____-__\"\n (input)=\"onPixKeyInput($event, rowIndex)\"\n (blur)=\"onBlurPixCpfAndCnpj(rowIndex)\"\n (keyup)=\"cnpjMask($event)\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\" />\n\n <input *ngSwitchCase=\"'EMAIL'\"\n pInputText\n type=\"email\"\n formControlName=\"pixKey\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n placeholder=\"{{ 'hcm.payroll.employees_addition_email' | translate }}\" />\n\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\"\n pInputText\n formControlName=\"pixKey\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n [disabled]=\"true\" />\n\n <input *ngSwitchDefault\n pInputText\n type=\"text\"\n formControlName=\"pixKey\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n maxlength=\"100\" />\n </ng-container>\n\n <s-control-errors *ngIf=\"isShowPixKeyFieldValidatorMessage\"\n [control]=\"formGroupByRow[rowIndex]?.get('pixKey')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n invalidPhoneNumber: 'hcm.payroll.employees_addition_invalid_phone_number' | translate: { value: formGroupByRow[rowIndex]?.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 </ng-template>\n <ng-template pTemplate=\"output\">\n {{ getFormattedPixKey(item.pixKeyType?.key, 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 {{ item.percentage?.toFixed(2).replace('.', ',') }}%\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",
10568
+ 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}"]
10569
+ })
10570
+ ], HistoricalPixAccountComponent);
10571
+ return HistoricalPixAccountComponent;
10572
+ }(HistoricakPixAccountBase));
10573
+
10574
+ var HistoricalPixAccountFormComponent = /** @class */ (function (_super) {
10575
+ __extends(HistoricalPixAccountFormComponent, _super);
10576
+ function HistoricalPixAccountFormComponent(formBuilder, cd, sharedStateService) {
10577
+ var _this = _super.call(this, formBuilder) || this;
10578
+ _this.cd = cd;
10579
+ _this.sharedStateService = sharedStateService;
10580
+ _this.withSideBar = true;
10581
+ _this.isEditMode = false;
10582
+ _this.visibleChange = new core.EventEmitter();
10583
+ _this.pixAccountItemToList = new core.EventEmitter();
10584
+ _this.ngUnsubscribe = new rxjs.Subject();
10585
+ _this.labelBtnAdd = "hcm.payroll.employees_add";
10586
+ _this.visibleBtnSave = true;
10587
+ _this.isView = false;
10588
+ _this.isShowPixKeyFieldValidatorMessage = false;
10589
+ _this.hideFields = _this.sharedStateService.hideField$;
10590
+ _this.registerSubjects();
10591
+ return _this;
10592
+ }
10593
+ HistoricalPixAccountFormComponent.prototype.ngOnInit = function () { };
10049
10594
  HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
10050
10595
  this.cd.detectChanges();
10051
10596
  };
@@ -10053,38 +10598,7 @@
10053
10598
  this.ngUnsubscribe.next(true);
10054
10599
  this.ngUnsubscribe.unsubscribe();
10055
10600
  };
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
- };
10601
+ HistoricalPixAccountFormComponent.prototype.registerSubjects = function () { };
10088
10602
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
10089
10603
  get: function () {
10090
10604
  return this._visible;
@@ -10123,7 +10637,8 @@
10123
10637
  });
10124
10638
  HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
10125
10639
  if (this.pixKeyType === "TELEPHONE") {
10126
- this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
10640
+ var pixKeyCtrl = this.pixAccountFormGroup.get("pixKey");
10641
+ pixKeyCtrl.setValue(FormatUtilsService.getFormattedTelephoneNumber(pixKeyCtrl.value));
10127
10642
  }
10128
10643
  };
10129
10644
  HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
@@ -10135,14 +10650,14 @@
10135
10650
  this.visibleBtnSave = isEditMode;
10136
10651
  if (this.pixAccountFormGroup.get("pixKeyType").value) {
10137
10652
  this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
10138
- this.setPixKeyValidators(isEditMode);
10653
+ this.setPixKeyValidators(isEditMode, this.pixAccountFormGroup);
10139
10654
  this.formatPixKeyTelephoneNumber();
10140
10655
  }
10141
10656
  configEnabledFields(this.pixAccountFormGroup, isEditMode, [
10142
10657
  "pixKeyType",
10143
10658
  "pixKey",
10144
10659
  "percentage",
10145
- "customFields",
10660
+ "customFields"
10146
10661
  ], []);
10147
10662
  };
10148
10663
  HistoricalPixAccountFormComponent.prototype.close = function () {
@@ -10156,7 +10671,7 @@
10156
10671
  if (this.employeeId) {
10157
10672
  this.pixAccountFormGroup.get("employee").setValue({
10158
10673
  tableId: this.employeeId,
10159
- name: "",
10674
+ name: ""
10160
10675
  });
10161
10676
  }
10162
10677
  this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
@@ -10188,14 +10703,10 @@
10188
10703
  return {
10189
10704
  prefix: "",
10190
10705
  thousands: this.currency.thousandsSeparator,
10191
- decimal: this.currency.decimalSeparator,
10706
+ decimal: this.currency.decimalSeparator
10192
10707
  };
10193
10708
  };
10194
10709
  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
10710
  set: function (pixAccountList) {
10200
10711
  if (pixAccountList) {
10201
10712
  this.setValidatorsAccordingList(pixAccountList, null, false);
@@ -10207,85 +10718,6 @@
10207
10718
  enumerable: true,
10208
10719
  configurable: true
10209
10720
  });
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
10721
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10290
10722
  set: function (condition) {
10291
10723
  this.isView = !!(condition && !this.withSideBar);
@@ -10296,58 +10728,24 @@
10296
10728
  enumerable: true,
10297
10729
  configurable: true
10298
10730
  });
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
- };
10731
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "paramsForm", {
10732
+ set: function (value) {
10733
+ this._paramsForm = value;
10734
+ },
10735
+ enumerable: true,
10736
+ configurable: true
10737
+ });
10738
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", {
10739
+ set: function (value) {
10740
+ this._defaultCpfNumber = value;
10741
+ },
10742
+ enumerable: true,
10743
+ configurable: true
10744
+ });
10348
10745
  HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10349
10746
  { type: forms.FormBuilder },
10350
- { type: core.ChangeDetectorRef }
10747
+ { type: core.ChangeDetectorRef },
10748
+ { type: SharedStateService }
10351
10749
  ]; };
10352
10750
  __decorate([
10353
10751
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: true })
@@ -10367,12 +10765,6 @@
10367
10765
  __decorate([
10368
10766
  core.Input()
10369
10767
  ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
10370
- __decorate([
10371
- core.Input()
10372
- ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
10373
- __decorate([
10374
- core.Input()
10375
- ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
10376
10768
  __decorate([
10377
10769
  core.Output()
10378
10770
  ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
@@ -10391,32 +10783,21 @@
10391
10783
  __decorate([
10392
10784
  core.Input()
10393
10785
  ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
10786
+ __decorate([
10787
+ core.Input()
10788
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", null);
10789
+ __decorate([
10790
+ core.Input()
10791
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", null);
10394
10792
  HistoricalPixAccountFormComponent = __decorate([
10395
10793
  core.Component({
10396
10794
  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",
10795
+ template: "<div id=\"main\">\n <form *ngIf=\"!(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",
10398
10796
  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}"]
10399
10797
  })
10400
10798
  ], HistoricalPixAccountFormComponent);
10401
10799
  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
- }());
10800
+ }(HistoricakPixAccountBase));
10420
10801
 
10421
10802
  var HistoricalPixAccountModule = /** @class */ (function () {
10422
10803
  function HistoricalPixAccountModule() {
@@ -10446,6 +10827,8 @@
10446
10827
  angularComponents.CustomFieldsModule,
10447
10828
  panel.PanelModule,
10448
10829
  inputmask.InputMaskModule,
10830
+ dropdown.DropdownModule,
10831
+ tabview.TabViewModule,
10449
10832
  ],
10450
10833
  declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
10451
10834
  providers: [HistoricalPixAccountService, api.ConfirmationService],
@@ -10488,7 +10871,7 @@
10488
10871
 
10489
10872
  var moment$e = moment_;
10490
10873
  var HistoricalPixAccountListComponent = /** @class */ (function () {
10491
- function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService) {
10874
+ function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService, sharedStateService) {
10492
10875
  this.confirmationService = confirmationService;
10493
10876
  this.translateService = translateService;
10494
10877
  this.activatedRoute = activatedRoute;
@@ -10496,11 +10879,14 @@
10496
10879
  this.router = router;
10497
10880
  this.messageService = messageService;
10498
10881
  this.historicalPixAccountListService = historicalPixAccountListService;
10882
+ this.sharedStateService = sharedStateService;
10499
10883
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
10500
10884
  this.keyPayload = "historicalEmployeePix";
10501
10885
  this.withSidebar = true;
10502
10886
  this.isOnlyView = new core.EventEmitter();
10887
+ this.isOnlyEdit = new core.EventEmitter();
10503
10888
  this.enableView = new core.EventEmitter();
10889
+ this.isEditJudicialDependentPix = new core.EventEmitter();
10504
10890
  this.ngUnsubscribe = new rxjs.Subject();
10505
10891
  this.loading = true;
10506
10892
  this.columns = [
@@ -10508,18 +10894,6 @@
10508
10894
  label: this.translateService.instant("hcm.payroll.historical_pix_account_label_date_change"),
10509
10895
  field: "dateChange",
10510
10896
  },
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
10897
  {
10524
10898
  label: this.translateService.instant("hcm.payroll.employees_movimentation_historical_pix_account_label_qtd_account"),
10525
10899
  field: "numberOfPixAccount",
@@ -10532,6 +10906,7 @@
10532
10906
  HistoricalPixAccountListComponent.prototype.ngOnDestroy = function () {
10533
10907
  this.ngUnsubscribe.next();
10534
10908
  this.ngUnsubscribe.complete();
10909
+ this.unsubscribe();
10535
10910
  };
10536
10911
  HistoricalPixAccountListComponent.prototype.ngAfterViewInit = function () {
10537
10912
  this.cd.detectChanges();
@@ -10540,27 +10915,10 @@
10540
10915
  var _this = this;
10541
10916
  payload.forEach(function (value) {
10542
10917
  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
10918
  });
10546
10919
  this.onGridLoad(payload);
10547
10920
  this.loading = false;
10548
10921
  };
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
10922
  HistoricalPixAccountListComponent.prototype.getMenuActions = function (rowData) {
10565
10923
  var _this = this;
10566
10924
  return [
@@ -10568,6 +10926,9 @@
10568
10926
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
10569
10927
  command: function () {
10570
10928
  if (_this.isAllowToViewHistorical) {
10929
+ _this.sharedStateService.setHideField(true);
10930
+ _this.sharedStateService.setShowButton(false);
10931
+ _this.sharedStateService.setShowEditMode(false);
10571
10932
  var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
10572
10933
  if (_this.withSidebar) {
10573
10934
  _this.isOnlyView.emit(true);
@@ -10576,6 +10937,33 @@
10576
10937
  });
10577
10938
  }
10578
10939
  else {
10940
+ _this.sharedStateService.setSaveButton(false);
10941
+ _this.enableView.emit(dateChange);
10942
+ }
10943
+ }
10944
+ else {
10945
+ _this.isNotAllowMessage();
10946
+ }
10947
+ },
10948
+ },
10949
+ {
10950
+ label: this.translateService.instant("hcm.payroll.edit"),
10951
+ command: function () {
10952
+ if (_this.isAllowToEditHistorical) {
10953
+ _this.sharedStateService.setHideField(true);
10954
+ _this.sharedStateService.setShowButton(false);
10955
+ _this.sharedStateService.setShowEditMode(true);
10956
+ var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
10957
+ if (_this.withSidebar) {
10958
+ _this.router.navigate(["historical-pix-account/" + dateChange], {
10959
+ relativeTo: _this.activatedRoute,
10960
+ });
10961
+ }
10962
+ else {
10963
+ setTimeout(function () {
10964
+ _this.sharedStateService.triggerActiveValidatorsOnEditModalOpen();
10965
+ });
10966
+ _this.sharedStateService.setSaveButton(true);
10579
10967
  _this.enableView.emit(dateChange);
10580
10968
  }
10581
10969
  }
@@ -10594,7 +10982,7 @@
10594
10982
  _this.isNotAllowMessage();
10595
10983
  }
10596
10984
  },
10597
- },
10985
+ }
10598
10986
  ];
10599
10987
  };
10600
10988
  HistoricalPixAccountListComponent.prototype.delete = function (id, dateChange) {
@@ -10661,6 +11049,24 @@
10661
11049
  this.lastRecord = payload[0];
10662
11050
  }
10663
11051
  };
11052
+ HistoricalPixAccountListComponent.prototype.unsubscribe = function () {
11053
+ if (this._subscription) {
11054
+ this._subscription.unsubscribe();
11055
+ }
11056
+ };
11057
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", {
11058
+ set: function (subject) {
11059
+ var _this = this;
11060
+ this.unsubscribe();
11061
+ if (subject) {
11062
+ this._subscription = subject.subscribe(function (value) {
11063
+ _this.sharedStateService.setHideField(value);
11064
+ });
11065
+ }
11066
+ },
11067
+ enumerable: true,
11068
+ configurable: true
11069
+ });
10664
11070
  Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToAddHistorical", {
10665
11071
  get: function () {
10666
11072
  return (this.permission["incluir"]);
@@ -10682,6 +11088,13 @@
10682
11088
  enumerable: true,
10683
11089
  configurable: true
10684
11090
  });
11091
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToEditHistorical", {
11092
+ get: function () {
11093
+ return (this.permission["editar"]);
11094
+ },
11095
+ enumerable: true,
11096
+ configurable: true
11097
+ });
10685
11098
  Object.defineProperty(HistoricalPixAccountListComponent.prototype, "scopedActions", {
10686
11099
  get: function () {
10687
11100
  return this.getMenuActions.bind(this);
@@ -10706,7 +11119,8 @@
10706
11119
  { type: core.ChangeDetectorRef },
10707
11120
  { type: router.Router },
10708
11121
  { type: api.MessageService },
10709
- { type: HistoricalPixAccountListService }
11122
+ { type: HistoricalPixAccountListService },
11123
+ { type: SharedStateService }
10710
11124
  ]; };
10711
11125
  __decorate([
10712
11126
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
@@ -10732,12 +11146,24 @@
10732
11146
  __decorate([
10733
11147
  core.Input()
10734
11148
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
11149
+ __decorate([
11150
+ core.Input()
11151
+ ], HistoricalPixAccountListComponent.prototype, "hideField", void 0);
10735
11152
  __decorate([
10736
11153
  core.Output()
10737
11154
  ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
11155
+ __decorate([
11156
+ core.Output()
11157
+ ], HistoricalPixAccountListComponent.prototype, "isOnlyEdit", void 0);
10738
11158
  __decorate([
10739
11159
  core.Output()
10740
11160
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
11161
+ __decorate([
11162
+ core.Output()
11163
+ ], HistoricalPixAccountListComponent.prototype, "isEditJudicialDependentPix", void 0);
11164
+ __decorate([
11165
+ core.Input()
11166
+ ], HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", null);
10741
11167
  __decorate([
10742
11168
  core.Input()
10743
11169
  ], HistoricalPixAccountListComponent.prototype, "reloadList", null);
@@ -10860,6 +11286,7 @@
10860
11286
  exports.PermissionService = PermissionService;
10861
11287
  exports.ReportService = ReportService;
10862
11288
  exports.ServicesModule = ServicesModule;
11289
+ exports.SharedStateService = SharedStateService;
10863
11290
  exports.SpinnerLoaderComponent = SpinnerLoaderComponent;
10864
11291
  exports.SpinnerLoaderModule = SpinnerLoaderModule;
10865
11292
  exports.StringMethods = StringMethods;
@@ -10955,7 +11382,8 @@
10955
11382
  exports.ɵo = AutocompleteService;
10956
11383
  exports.ɵp = LookupService$1;
10957
11384
  exports.ɵq = HistoricalBankAccountFormComponent;
10958
- exports.ɵr = HistoricalPixAccountFormComponent;
11385
+ exports.ɵr = HistoricakPixAccountBase;
11386
+ exports.ɵs = HistoricalPixAccountFormComponent;
10959
11387
 
10960
11388
  Object.defineProperty(exports, '__esModule', { value: true });
10961
11389