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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +1419 -533
  2. package/bundles/senior-gestao-pessoas-payroll-core.umd.js.map +1 -1
  3. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js +16 -1
  4. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js.map +1 -1
  5. package/components/historical-pix-account/historical-pix-account-base.d.ts +27 -0
  6. package/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.d.ts +9 -40
  7. package/components/historical-pix-account/historical-pix-account.component.d.ts +103 -14
  8. package/components/historical-pix-account/historical-pix-account.service.d.ts +1 -0
  9. package/components/historical-pix-account-list/historical-pix-account-list.component.d.ts +14 -2
  10. package/components/shared/index.d.ts +1 -0
  11. package/components/shared/shared-state.service.d.ts +25 -0
  12. package/components/utils/format-utils/format-utils.service.d.ts +30 -3
  13. package/esm2015/components/historical-pix-account/historical-pix-account-base.js +180 -0
  14. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +34 -190
  15. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +647 -37
  16. package/esm2015/components/historical-pix-account/historical-pix-account.module.js +5 -1
  17. package/esm2015/components/historical-pix-account/historical-pix-account.service.js +8 -1
  18. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.component.js +91 -34
  19. package/esm2015/components/shared/index.js +2 -0
  20. package/esm2015/components/shared/shared-state.service.js +57 -0
  21. package/esm2015/components/utils/format-utils/format-utils.service.js +90 -5
  22. package/esm2015/public_api.js +2 -1
  23. package/esm2015/senior-gestao-pessoas-payroll-core.js +3 -2
  24. package/esm5/components/historical-pix-account/historical-pix-account-base.js +193 -0
  25. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +58 -204
  26. package/esm5/components/historical-pix-account/historical-pix-account.component.js +699 -66
  27. package/esm5/components/historical-pix-account/historical-pix-account.module.js +5 -1
  28. package/esm5/components/historical-pix-account/historical-pix-account.service.js +8 -1
  29. package/esm5/components/historical-pix-account-list/historical-pix-account-list.component.js +100 -34
  30. package/esm5/components/shared/index.js +2 -0
  31. package/esm5/components/shared/shared-state.service.js +58 -0
  32. package/esm5/components/utils/format-utils/format-utils.service.js +90 -5
  33. package/esm5/public_api.js +2 -1
  34. package/esm5/senior-gestao-pessoas-payroll-core.js +3 -2
  35. package/fesm2015/senior-gestao-pessoas-payroll-core.js +1330 -499
  36. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  37. package/fesm5/senior-gestao-pessoas-payroll-core.js +1415 -530
  38. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  39. package/locale/en-US.json +1 -1
  40. package/locale/es-ES.json +1 -1
  41. package/locale/pt-BR.json +1 -1
  42. package/package.json +2 -32
  43. package/public_api.d.ts +1 -0
  44. package/senior-gestao-pessoas-payroll-core.d.ts +2 -1
  45. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
@@ -1,4 +1,4 @@
1
- import { __decorate, __assign, __spread, __awaiter, __generator, __read, __values } from 'tslib';
1
+ import { __decorate, __assign, __spread, __awaiter, __generator, __read, __values, __extends } from 'tslib';
2
2
  import { Input, Component, NgModule, EventEmitter, ViewChild, Output, ElementRef, HostListener, Directive, Injectable, ViewEncapsulation, ɵɵdefineInjectable, ɵɵinject, ChangeDetectorRef } from '@angular/core';
3
3
  import { FormsModule, ReactiveFormsModule, FormGroup, FormArray, FormControl, Validators, FormBuilder } from '@angular/forms';
4
4
  import { BlockUIModule } from 'primeng/blockui';
@@ -36,6 +36,7 @@ import { CurrencyMaskModule } from 'ng2-currency-mask';
36
36
  import { FieldsetModule } from 'primeng/fieldset';
37
37
  import { PanelModule } from 'primeng/panel';
38
38
  import { ConfirmDialogModule } from 'primeng/confirmdialog';
39
+ import { TabViewModule } from 'primeng/tabview';
39
40
 
40
41
  /**
41
42
  * Created by Bruno.Curioletti on 30/05/2017.
@@ -9173,6 +9174,25 @@ var FormatUtilsService = /** @class */ (function () {
9173
9174
  }
9174
9175
  return null;
9175
9176
  };
9177
+ /**
9178
+ * Retorna o CPF formatado
9179
+ * @param cpf CPF
9180
+ */
9181
+ FormatUtilsService.getFormattedCpfEdited = function (cpf) {
9182
+ if (!cpf)
9183
+ return '';
9184
+ cpf = cpf.replace(/\D/g, '').slice(0, 11);
9185
+ if (cpf.length > 9) {
9186
+ cpf = cpf.replace(/^(\d{3})(\d{3})(\d{3})(\d{2})$/, "$1.$2.$3-$4");
9187
+ }
9188
+ else if (cpf.length > 6) {
9189
+ cpf = cpf.replace(/^(\d{3})(\d{3})(\d{0,3})$/, "$1.$2.$3");
9190
+ }
9191
+ else if (cpf.length > 3) {
9192
+ cpf = cpf.replace(/^(\d{3})(\d{0,3})$/, "$1.$2");
9193
+ }
9194
+ return cpf;
9195
+ };
9176
9196
  /**
9177
9197
  * Retorna o CNPJ formatado
9178
9198
  * @param cnpj CNPJ
@@ -9188,6 +9208,28 @@ var FormatUtilsService = /** @class */ (function () {
9188
9208
  }
9189
9209
  return null;
9190
9210
  };
9211
+ /**
9212
+ * Retorna o CNPJ formatado
9213
+ * @param cnpj CNPJ
9214
+ */
9215
+ FormatUtilsService.getFormattedCnpjEdited = function (cnpj) {
9216
+ if (!cnpj)
9217
+ return '';
9218
+ cnpj = cnpj.replace(/\D/g, '').slice(0, 14);
9219
+ if (cnpj.length > 12) {
9220
+ cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5");
9221
+ }
9222
+ else if (cnpj.length > 8) {
9223
+ cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{3})(\d{0,4})$/, "$1.$2.$3/$4");
9224
+ }
9225
+ else if (cnpj.length > 5) {
9226
+ cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{0,3})$/, "$1.$2.$3");
9227
+ }
9228
+ else if (cnpj.length > 2) {
9229
+ cnpj = cnpj.replace(/^(\d{2})(\d{0,3})$/, "$1.$2");
9230
+ }
9231
+ return cnpj;
9232
+ };
9191
9233
  /**
9192
9234
  * Retorna a mascara do CPF/CNPJ
9193
9235
  * @param key Valores possíveis são CPF ou CNPJ
@@ -9202,6 +9244,24 @@ var FormatUtilsService = /** @class */ (function () {
9202
9244
  return "";
9203
9245
  }
9204
9246
  };
9247
+ /**
9248
+ * Método para formatar o número de inscrição do cliente.
9249
+ * @param subscriptionNumber
9250
+ * @param pixKeyType
9251
+ * @returns
9252
+ */
9253
+ FormatUtilsService.getFormattedSubscriptionNumber = function (subscriptionNumber, pixKeyType) {
9254
+ if (!subscriptionNumber || !pixKeyType)
9255
+ return subscriptionNumber;
9256
+ switch (pixKeyType) {
9257
+ case 'CNPJ':
9258
+ return this.getFormattedCnpjEdited(subscriptionNumber);
9259
+ case 'CPF':
9260
+ return this.getFormattedCpfEdited(subscriptionNumber);
9261
+ default:
9262
+ return subscriptionNumber;
9263
+ }
9264
+ };
9205
9265
  /**
9206
9266
  * Metódo para formatar o número de telefone.
9207
9267
  * @param telephoneNumber String contendo o número de telefone.
@@ -9233,6 +9293,13 @@ var FormatUtilsService = /** @class */ (function () {
9233
9293
  }
9234
9294
  return tel;
9235
9295
  };
9296
+ /**
9297
+ * Metódo para formatar a porcentagem para 2 casas decimais.
9298
+ * @param value Número a ser formatado.
9299
+ */
9300
+ FormatUtilsService.getFormattedPercentage = function (value) {
9301
+ return parseFloat(value).toFixed(2).replace('.', ',') + '%';
9302
+ };
9236
9303
  /**
9237
9304
  * Metódo para formatar o número de telefone de um campo Input.
9238
9305
  * @param event Evento do Input do campo de telefone.
@@ -9245,61 +9312,528 @@ var FormatUtilsService = /** @class */ (function () {
9245
9312
  }
9246
9313
  event.target.value = FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9247
9314
  };
9248
- /**
9249
- * Metódo para formatar a porcentagem para 2 casas decimais.
9250
- * @param value Número a ser formatado.
9251
- */
9252
- FormatUtilsService.getFormattedPercentage = function (value) {
9253
- return parseFloat(value).toFixed(2).replace('.', ',') + '%';
9315
+ /**
9316
+ * Formata o campo de input de CPF em tempo real.
9317
+ * @param event Evento do input
9318
+ */
9319
+ FormatUtilsService.formatCpfInputEvent = function (event) {
9320
+ var cpf = event.target.value;
9321
+ console.log("FormatUtilsService.formatCpfInputEvent.cpf: " + cpf);
9322
+ // Permite apagar nos pontos sensíveis
9323
+ if (event.keyCode === 8 && (cpf.length === 4 || cpf.length === 8 || cpf.length === 12)) {
9324
+ return;
9325
+ }
9326
+ event.target.value = FormatUtilsService.getFormattedCpfEdited(cpf);
9327
+ };
9328
+ /**
9329
+ * Formata o campo de input de CNPJ em tempo real.
9330
+ * @param event Evento do input
9331
+ */
9332
+ FormatUtilsService.formatCnpjInputEvent = function (event) {
9333
+ var cnpj = event.target.value;
9334
+ console.log("FormatUtilsService.formatCnpjInputEvent.cnpj: " + cnpj);
9335
+ // Permite apagar nos pontos sensíveis
9336
+ if (event.keyCode === 8 && (cnpj.length === 3 || cnpj.length === 7 || cnpj.length === 11 || cnpj.length === 16)) {
9337
+ return;
9338
+ }
9339
+ event.target.value = FormatUtilsService.getFormattedCnpjEdited(cnpj);
9340
+ };
9341
+ return FormatUtilsService;
9342
+ }());
9343
+
9344
+ var SharedStateService = /** @class */ (function () {
9345
+ function SharedStateService() {
9346
+ this.hideFieldSubject = new BehaviorSubject(true);
9347
+ this.hideField$ = this.hideFieldSubject.asObservable();
9348
+ this.showButtonSubject = new BehaviorSubject(true);
9349
+ this.showButton$ = this.showButtonSubject.asObservable();
9350
+ this.saveButtonSubject = new BehaviorSubject(true);
9351
+ this.saveButton$ = this.saveButtonSubject.asObservable();
9352
+ this.showEditMode = new BehaviorSubject(true);
9353
+ this.showEditMode$ = this.showEditMode.asObservable();
9354
+ this.activeValidatorsOnEditModalOpen = new Subject();
9355
+ this.activeValidatorsOnEditModalOpen$ = this.activeValidatorsOnEditModalOpen.asObservable();
9356
+ this.hideBtnAddForViewMode = new BehaviorSubject(false);
9357
+ this.hideBtnAddForViewMode$ = this.hideBtnAddForViewMode.asObservable();
9358
+ this.activeHideOptionsOnView = new BehaviorSubject(true);
9359
+ this.activeHideOptionsOnView$ = this.activeHideOptionsOnView.asObservable();
9360
+ }
9361
+ SharedStateService.prototype.setHideField = function (value) {
9362
+ this.hideFieldSubject.next(value);
9363
+ };
9364
+ SharedStateService.prototype.setShowButton = function (value) {
9365
+ this.showButtonSubject.next(value);
9366
+ };
9367
+ SharedStateService.prototype.setSaveButton = function (value) {
9368
+ this.saveButtonSubject.next(value);
9369
+ };
9370
+ SharedStateService.prototype.setShowEditMode = function (value) {
9371
+ this.showEditMode.next(value);
9372
+ };
9373
+ SharedStateService.prototype.triggerActiveValidatorsOnEditModalOpen = function () {
9374
+ this.activeValidatorsOnEditModalOpen.next();
9375
+ };
9376
+ SharedStateService.prototype.setHideBtnAddForViewMode = function (value) {
9377
+ this.hideBtnAddForViewMode.next(value);
9378
+ };
9379
+ SharedStateService.prototype.resetHideField = function () {
9380
+ this.hideFieldSubject.next(true);
9381
+ };
9382
+ SharedStateService.prototype.setActiveHideOptionsOnView = function (value) {
9383
+ this.activeHideOptionsOnView.next(value);
9384
+ };
9385
+ SharedStateService.prototype.getActiveHideOptionsOnView = function () {
9386
+ return this.activeHideOptionsOnView.getValue();
9387
+ };
9388
+ SharedStateService.ngInjectableDef = ɵɵdefineInjectable({ factory: function SharedStateService_Factory() { return new SharedStateService(); }, token: SharedStateService, providedIn: "root" });
9389
+ SharedStateService = __decorate([
9390
+ Injectable({
9391
+ providedIn: 'root',
9392
+ })
9393
+ ], SharedStateService);
9394
+ return SharedStateService;
9395
+ }());
9396
+
9397
+ var GenericValidator = /** @class */ (function () {
9398
+ function GenericValidator() {
9399
+ }
9400
+ /**
9401
+ * Valida o CEI (Cadastro específico de INSS) digitado.
9402
+ */
9403
+ GenericValidator.isValidCei = function (control) {
9404
+ var cei = control.value;
9405
+ if (!cei)
9406
+ return null;
9407
+ else if (cei.length != 11)
9408
+ return null;
9409
+ var multiplicadorBase = "3298765432";
9410
+ var total = 0;
9411
+ var resto = 0;
9412
+ var multiplicando = 0;
9413
+ var multiplicador = 0;
9414
+ if (cei.length !== 11 ||
9415
+ cei === "00000000000" ||
9416
+ cei === "11111111111" ||
9417
+ cei === "22222222222" ||
9418
+ cei === "33333333333" ||
9419
+ cei === "44444444444" ||
9420
+ cei === "55555555555" ||
9421
+ cei === "66666666666" ||
9422
+ cei === "77777777777" ||
9423
+ cei === "88888888888" ||
9424
+ cei === "99999999999")
9425
+ return { invalidCei: true };
9426
+ else {
9427
+ for (var i = 0; i < 10; i++) {
9428
+ multiplicando = parseInt(cei.substring(i, i + 1), 10);
9429
+ multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
9430
+ total += multiplicando * multiplicador;
9431
+ }
9432
+ resto = 11 - (total % 11);
9433
+ resto = resto === 10 || resto === 11 ? 0 : resto;
9434
+ var digito = parseInt("" + cei.charAt(10), 10);
9435
+ return resto === digito ? null : { invalidCei: true };
9436
+ }
9437
+ };
9438
+ /**
9439
+ * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9440
+ */
9441
+ GenericValidator.isValidCpf = function (control) {
9442
+ var cpf = control.value;
9443
+ if (cpf) {
9444
+ var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9445
+ equalDigits = 1;
9446
+ if (cpf.length < 11) {
9447
+ return null;
9448
+ }
9449
+ for (i = 0; i < cpf.length - 1; i++) {
9450
+ if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9451
+ equalDigits = 0;
9452
+ break;
9453
+ }
9454
+ }
9455
+ if (!equalDigits) {
9456
+ numbers = cpf.substring(0, 9);
9457
+ digits = cpf.substring(9);
9458
+ sum = 0;
9459
+ for (i = 10; i > 1; i--) {
9460
+ sum += numbers.charAt(10 - i) * i;
9461
+ }
9462
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9463
+ if (result !== Number(digits.charAt(0))) {
9464
+ return { cpfNotValid: true };
9465
+ }
9466
+ numbers = cpf.substring(0, 10);
9467
+ sum = 0;
9468
+ for (i = 11; i > 1; i--) {
9469
+ sum += numbers.charAt(11 - i) * i;
9470
+ }
9471
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9472
+ if (result !== Number(digits.charAt(1))) {
9473
+ return { cpfNotValid: true };
9474
+ }
9475
+ return null;
9476
+ }
9477
+ else {
9478
+ return { cpfNotValid: true };
9479
+ }
9480
+ }
9481
+ return null;
9482
+ };
9483
+ /**
9484
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9485
+ */
9486
+ GenericValidator.isValidCnpj = function (control) {
9487
+ var cnpj = control.value;
9488
+ if (cnpj) {
9489
+ var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9490
+ cnpj = cnpj.replace(/[^\d]+/g, '');
9491
+ if (cnpj.length !== 14) {
9492
+ return null;
9493
+ }
9494
+ // Elimina CNPJs invalidos conhecidos
9495
+ if (cnpj === '00000000000000' ||
9496
+ cnpj === '11111111111111' ||
9497
+ cnpj === '22222222222222' ||
9498
+ cnpj === '33333333333333' ||
9499
+ cnpj === '44444444444444' ||
9500
+ cnpj === '55555555555555' ||
9501
+ cnpj === '66666666666666' ||
9502
+ cnpj === '77777777777777' ||
9503
+ cnpj === '88888888888888' ||
9504
+ cnpj === '99999999999999') {
9505
+ return { cnpjNotValid: true };
9506
+ }
9507
+ // Valida DVs
9508
+ size = cnpj.length - 2;
9509
+ numbers = cnpj.substring(0, size);
9510
+ digits = cnpj.substring(size);
9511
+ sum = 0;
9512
+ pos = size - 7;
9513
+ for (var i = size; i >= 1; i--) {
9514
+ sum += numbers.charAt(size - i) * pos--;
9515
+ if (pos < 2) {
9516
+ pos = 9;
9517
+ }
9518
+ }
9519
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9520
+ if (result !== Number(digits.charAt(0))) {
9521
+ return { cnpjNotValid: true };
9522
+ }
9523
+ size = size + 1;
9524
+ numbers = cnpj.substring(0, size);
9525
+ sum = 0;
9526
+ pos = size - 7;
9527
+ for (var i = size; i >= 1; i--) {
9528
+ sum += numbers.charAt(size - i) * pos--;
9529
+ if (pos < 2) {
9530
+ pos = 9;
9531
+ }
9532
+ }
9533
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9534
+ if (result !== Number(digits.charAt(1))) {
9535
+ return { cnpjNotValid: true };
9536
+ }
9537
+ return null;
9538
+ }
9539
+ return null;
9540
+ };
9541
+ /**
9542
+ * Válida o número de telefone da chave PIX.
9543
+ */
9544
+ GenericValidator.isValidPhoneNumber = function (control) {
9545
+ var cellPhoneKey = control.value || '';
9546
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9547
+ var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9548
+ var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9549
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9550
+ };
9551
+ /**
9552
+ * Valida o email da chave PIX.
9553
+ */
9554
+ GenericValidator.isValidEmail = function (control) {
9555
+ var emailKey = control.value;
9556
+ var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9557
+ var isValidEmail = regexValidEmail.test(emailKey);
9558
+ return isValidEmail ? null : { invalidEmail: true };
9559
+ };
9560
+ return GenericValidator;
9561
+ }());
9562
+
9563
+ var HistoricakPixAccountBase = /** @class */ (function () {
9564
+ function HistoricakPixAccountBase(formBuilder) {
9565
+ this._paramsForm = new FormGroup({});
9566
+ this._defaultCpfNumber = null;
9567
+ this.initialValidatorOfPercentage = [Validators.required, Validators.min(0.01)];
9568
+ this.pixAccountList = [];
9569
+ this.maxValuePercentage = 100.0;
9570
+ this.isShowPixKeyFieldValidatorMessage = false;
9571
+ this.formBuilder = formBuilder;
9572
+ this.createFormGroupBase();
9573
+ }
9574
+ HistoricakPixAccountBase.prototype.phoneMask = function (event) {
9575
+ FormatUtilsService.formatTelephoneInputEvent(event);
9576
+ };
9577
+ HistoricakPixAccountBase.prototype.cpfMask = function (event) {
9578
+ FormatUtilsService.formatCpfInputEvent(event);
9579
+ };
9580
+ HistoricakPixAccountBase.prototype.cnpjMask = function (event) {
9581
+ FormatUtilsService.formatCnpjInputEvent(event);
9582
+ };
9583
+ HistoricakPixAccountBase.prototype.onChangePixKeyType = function (item, form) {
9584
+ if (!item || !item.key)
9585
+ return;
9586
+ this.pixKeyType = item.key;
9587
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9588
+ ? form
9589
+ : this.pixAccountFormGroup;
9590
+ this.isShowPixKeyFieldValidatorMessage = true;
9591
+ var pixKeyControl = targetForm.get("pixKey");
9592
+ if (pixKeyControl) {
9593
+ pixKeyControl.reset();
9594
+ }
9595
+ this.setPixKeyValidators(true, targetForm);
9596
+ if (item.key === "CPF") {
9597
+ this.setDefaultCpfPixKey(targetForm);
9598
+ }
9599
+ };
9600
+ HistoricakPixAccountBase.prototype.onClearPixKeyType = function (form) {
9601
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9602
+ ? form
9603
+ : this.pixAccountFormGroup;
9604
+ this.isShowPixKeyFieldValidatorMessage = false;
9605
+ if (targetForm.get("pixKey")) {
9606
+ targetForm.get("pixKey").reset();
9607
+ }
9608
+ };
9609
+ HistoricakPixAccountBase.prototype.setDefaultCpfPixKey = function (form) {
9610
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9611
+ ? form
9612
+ : this.pixAccountFormGroup;
9613
+ if (this._defaultCpfNumber) {
9614
+ if (targetForm.get("pixKey")) {
9615
+ targetForm.get("pixKey").setValue(this._defaultCpfNumber);
9616
+ }
9617
+ }
9618
+ else {
9619
+ var sheetDocument = this._paramsForm.get("sheetDocument");
9620
+ if (sheetDocument && sheetDocument.get("cpfNumber")) {
9621
+ var cpf = sheetDocument.get("cpfNumber").value;
9622
+ if (cpf && targetForm.get("pixKey")) {
9623
+ targetForm.get("pixKey").setValue(cpf);
9624
+ }
9625
+ }
9626
+ }
9627
+ };
9628
+ HistoricakPixAccountBase.prototype.createFormGroupBase = function () {
9629
+ this.pixAccountFormGroup = this.formBuilder.group({
9630
+ id: this.formBuilder.control(null),
9631
+ index: this.formBuilder.control(null),
9632
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9633
+ dateChange: this.formBuilder.control(null),
9634
+ pixKeyType: this.formBuilder.control(null, Validators.required),
9635
+ pixKey: this.formBuilder.control(null),
9636
+ percentage: this.formBuilder.control(null, Validators.compose(__spread(this.initialValidatorOfPercentage, [
9637
+ Validators.max(this.maxValuePercentage),
9638
+ ]))),
9639
+ externalId: this.formBuilder.control(null),
9640
+ customFields: this.formBuilder.control(null),
9641
+ });
9642
+ };
9643
+ HistoricakPixAccountBase.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode, form) {
9644
+ if (index === void 0) { index = null; }
9645
+ if (isEditMode === void 0) { isEditMode = true; }
9646
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9647
+ ? form
9648
+ : this.pixAccountFormGroup;
9649
+ this.pixAccountList = (pixAccountList && pixAccountList.length > 0)
9650
+ ? [].concat(pixAccountList)
9651
+ : [];
9652
+ var percentageIncluded = [];
9653
+ for (var i = 0; i < this.pixAccountList.length; i++) {
9654
+ var field = this.pixAccountList[i];
9655
+ if (field && field.percentage && i !== index) {
9656
+ percentageIncluded.push(field.percentage);
9657
+ }
9658
+ }
9659
+ this.beforeSetPixKeyTypeValidator(targetForm);
9660
+ this.setPixKeyValidators(isEditMode, targetForm);
9661
+ this.validatePercentageValid(percentageIncluded, targetForm);
9662
+ };
9663
+ HistoricakPixAccountBase.prototype.beforeSetPixKeyTypeValidator = function (form) {
9664
+ var control = form.get("pixKeyType");
9665
+ if (this.pixAccountList && this.pixAccountList.length) {
9666
+ control.setValidators(Validators.compose([
9667
+ Validators.required,
9668
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
9669
+ ]));
9670
+ }
9671
+ else {
9672
+ control.setValidators(Validators.required);
9673
+ }
9674
+ control.updateValueAndValidity();
9675
+ };
9676
+ HistoricakPixAccountBase.prototype.setPixKeyValidators = function (isEditMode, form) {
9677
+ var pixKey = form.get("pixKey");
9678
+ switch (this.pixKeyType) {
9679
+ case "TELEPHONE":
9680
+ pixKey.setValidators(Validators.compose([Validators.required, GenericValidator.isValidPhoneNumber]));
9681
+ break;
9682
+ case "EMAIL":
9683
+ pixKey.setValidators(Validators.compose([Validators.required, GenericValidator.isValidEmail]));
9684
+ break;
9685
+ case "CPF":
9686
+ pixKey.setValidators(Validators.compose([Validators.required, GenericValidator.isValidCpf]));
9687
+ break;
9688
+ case "CNPJ":
9689
+ pixKey.setValidators(Validators.compose([Validators.required, GenericValidator.isValidCnpj]));
9690
+ break;
9691
+ case "RANDOM_KEY":
9692
+ pixKey.setValidators(Validators.required);
9693
+ break;
9694
+ case "BANK_ACCOUNT":
9695
+ pixKey.clearValidators();
9696
+ pixKey.setValue('');
9697
+ break;
9698
+ default:
9699
+ pixKey.clearValidators();
9700
+ }
9701
+ if (this.pixKeyType === "BANK_ACCOUNT") {
9702
+ pixKey.disable();
9703
+ }
9704
+ else if (isEditMode) {
9705
+ pixKey.enable();
9706
+ }
9707
+ pixKey.updateValueAndValidity();
9708
+ };
9709
+ HistoricakPixAccountBase.prototype.validatePercentageValid = function (listValue, form) {
9710
+ var percentage = form.get("percentage");
9711
+ this.maxValuePercentage = listValue.reduce(function (acc, val) { return acc - val; }, 100.0);
9712
+ percentage.setValidators(Validators.compose(__spread(this.initialValidatorOfPercentage, [
9713
+ Validators.max(this.maxValuePercentage),
9714
+ ])));
9715
+ percentage.updateValueAndValidity();
9716
+ };
9717
+ HistoricakPixAccountBase.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
9718
+ return function (control) {
9719
+ var value = control.value;
9720
+ var isDuplicate = listCompare.some(function (field) {
9721
+ return value &&
9722
+ field.pixKeyType.key === "BANK_ACCOUNT" &&
9723
+ value.key === "BANK_ACCOUNT";
9724
+ });
9725
+ return isDuplicate ? { pixKeyTypeBankAccountDuplicate: true } : null;
9726
+ };
9727
+ };
9728
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "paramsForm", {
9729
+ get: function () {
9730
+ return this._paramsForm;
9731
+ },
9732
+ set: function (value) {
9733
+ this._paramsForm = value;
9734
+ },
9735
+ enumerable: true,
9736
+ configurable: true
9737
+ });
9738
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "defaultCpfNumber", {
9739
+ get: function () {
9740
+ return this._defaultCpfNumber;
9741
+ },
9742
+ set: function (value) {
9743
+ this._defaultCpfNumber = value;
9744
+ },
9745
+ enumerable: true,
9746
+ configurable: true
9747
+ });
9748
+ return HistoricakPixAccountBase;
9749
+ }());
9750
+
9751
+ var HistoricalPixAccountService = /** @class */ (function () {
9752
+ function HistoricalPixAccountService(http) {
9753
+ this.http = http;
9754
+ }
9755
+ HistoricalPixAccountService.prototype.query = function (path, body, service) {
9756
+ if (service === void 0) { service = ServiceType.PAYROLL; }
9757
+ return this.http.query(path, body, service);
9758
+ };
9759
+ HistoricalPixAccountService.prototype.enumQuery = function () {
9760
+ var path = 'enumQuery';
9761
+ var body = {
9762
+ names: ['PixKeyType']
9763
+ };
9764
+ return this.http.query(path, body, ServiceType.PAYROLL);
9254
9765
  };
9255
- return FormatUtilsService;
9766
+ HistoricalPixAccountService.ctorParameters = function () { return [
9767
+ { type: HttpClientService }
9768
+ ]; };
9769
+ HistoricalPixAccountService = __decorate([
9770
+ Injectable()
9771
+ ], HistoricalPixAccountService);
9772
+ return HistoricalPixAccountService;
9256
9773
  }());
9257
9774
 
9258
- var HistoricalPixAccountComponent = /** @class */ (function () {
9259
- function HistoricalPixAccountComponent(translateService, cd, formBuilder, messageService) {
9260
- var _this = this;
9261
- this.translateService = translateService;
9262
- this.cd = cd;
9263
- this.formBuilder = formBuilder;
9264
- this.messageService = messageService;
9265
- this.recordByRow = 1;
9266
- this.showDateChange = false;
9267
- this.isEditMode = false;
9268
- this.isViewMode = false;
9269
- this.withSideBar = true;
9270
- this.defaultCpfNumber = null;
9271
- this.listDataReciever = [];
9272
- this.isViewModeActive = new EventEmitter();
9273
- this.isEditModeActive = new EventEmitter();
9274
- this.isDeleteModeActive = new EventEmitter();
9275
- this.listFromApp = [];
9276
- this.visibleChange = new EventEmitter();
9277
- this.ngUnsubscribe = new Subject();
9278
- this.orderBy = {
9775
+ var HistoricalPixAccountComponent = /** @class */ (function (_super) {
9776
+ __extends(HistoricalPixAccountComponent, _super);
9777
+ function HistoricalPixAccountComponent(translateService, cd, formBuilder, sharedStateService, service) {
9778
+ var _this = _super.call(this, formBuilder) || this;
9779
+ _this.translateService = translateService;
9780
+ _this.cd = cd;
9781
+ _this.sharedStateService = sharedStateService;
9782
+ _this.service = service;
9783
+ _this.recordByRow = 1;
9784
+ _this.showDateChange = false;
9785
+ _this.isEditMode = false;
9786
+ _this.isViewMode = false;
9787
+ _this.withSideBar = true;
9788
+ _this.listDataReciever = [];
9789
+ _this.addExistentHistoricData = [];
9790
+ _this.getListPixAccount = [];
9791
+ _this.isEditModeForSave = false;
9792
+ _this.showField = false;
9793
+ _this.hideBtnAddForViewMode = false;
9794
+ _this.showButtonView = true;
9795
+ _this.isViewModeActive = new EventEmitter();
9796
+ _this.isEditModeActive = new EventEmitter();
9797
+ _this.isDeleteModeActive = new EventEmitter();
9798
+ _this.isValidChangeForm = new EventEmitter();
9799
+ _this.listFromApp = [];
9800
+ _this.visibleChange = new EventEmitter();
9801
+ _this.ngUnsubscribe = new Subject();
9802
+ _this.orderBy = {
9279
9803
  field: "dateChange",
9280
9804
  direction: DirectionEnumeration.DESC,
9281
9805
  };
9282
- this.pixAccountItemInput = {};
9283
- this.totalRecords = 0;
9284
- this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9285
- this.loading = true;
9286
- this.listData = [];
9287
- this.listDataNoPage = [];
9288
- this.cols = [
9806
+ _this.pixAccountItemInput = {};
9807
+ _this.totalRecords = 0;
9808
+ _this.actionLabel = _this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9809
+ _this.loading = true;
9810
+ _this.listData = [];
9811
+ _this.listDataNoPage = [];
9812
+ _this.showEditMode = false;
9813
+ _this.hasRecordsPix = true;
9814
+ _this.hideFields = _this.sharedStateService.hideField$;
9815
+ _this.suggestions = [];
9816
+ _this.formGroupByRow = {};
9817
+ _this.isSyncingPercentage = false;
9818
+ _this.cols = [
9289
9819
  {
9290
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9820
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9291
9821
  field: "pixKeyType",
9292
9822
  },
9293
9823
  {
9294
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9824
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9295
9825
  field: "pixKey",
9296
9826
  },
9297
9827
  {
9298
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9828
+ label: _this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9299
9829
  field: "percentage",
9300
9830
  },
9831
+ {
9832
+ label: _this.translateService.instant("hcm.payroll.movimentation_generic_action"),
9833
+ field: "actions",
9834
+ }
9301
9835
  ];
9302
- this.actions = function (rowData, key) {
9836
+ _this.actions = function (rowData, key) {
9303
9837
  if (rowData === void 0) { rowData = {}; }
9304
9838
  return [
9305
9839
  {
@@ -9336,7 +9870,7 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9336
9870
  },
9337
9871
  },
9338
9872
  {
9339
- visible: !_this.isEditMode,
9873
+ visible: !_this.isEditMode || _this.showEditMode,
9340
9874
  label: _this.translateService.instant("hcm.payroll.delete"),
9341
9875
  command: function () {
9342
9876
  if (_this.isAllowToDeleteHistorical) {
@@ -9354,15 +9888,49 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9354
9888
  },
9355
9889
  ];
9356
9890
  };
9357
- this.createFormGroup();
9891
+ _this.createFormGroup();
9892
+ return _this;
9358
9893
  }
9359
9894
  HistoricalPixAccountComponent.prototype.ngOnInit = function () {
9895
+ var _this = this;
9896
+ this.showFields = this.showField;
9360
9897
  this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9898
+ this.sharedStateService.showEditMode$.subscribe(function (value) {
9899
+ _this.showEditMode = value;
9900
+ _this.isEditModeForSave = value;
9901
+ });
9902
+ this.sharedStateService.activeHideOptionsOnView$.subscribe(function (value) {
9903
+ if (value) {
9904
+ _this.showButtonView = false;
9905
+ }
9906
+ });
9907
+ this.sharedStateService.activeValidatorsOnEditModalOpen$
9908
+ .subscribe(function () {
9909
+ Object.values(_this.formGroupByRow).forEach(function (fg) {
9910
+ Object.values(fg.controls).forEach(function (control) {
9911
+ control.markAsTouched();
9912
+ control.updateValueAndValidity();
9913
+ });
9914
+ });
9915
+ _this.emitFormValidity();
9916
+ });
9917
+ this.resetFormState();
9361
9918
  };
9362
9919
  HistoricalPixAccountComponent.prototype.ngOnChanges = function (changes) {
9363
9920
  if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
9364
9921
  this.listFromApp = changes['listDataReciever'].currentValue;
9365
9922
  }
9923
+ if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
9924
+ this.getHistoricalPixAccountList();
9925
+ }
9926
+ if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
9927
+ var newData = changes['addExistentHistoricData'].currentValue;
9928
+ this.rebuildFormGroupMap(newData);
9929
+ }
9930
+ if (changes['isEditMode']) {
9931
+ this.isEditMode = changes['isEditMode'].currentValue;
9932
+ this.cd.detectChanges();
9933
+ }
9366
9934
  };
9367
9935
  HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9368
9936
  this.historicalPixAccountList = this.formBuilder.group({
@@ -9376,6 +9944,122 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9376
9944
  HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9377
9945
  this.cd.detectChanges();
9378
9946
  };
9947
+ HistoricalPixAccountComponent.prototype.emitFormValidity = function () {
9948
+ if (!this.formGroupByRow || Object.keys(this.formGroupByRow).length === 0) {
9949
+ this.isValidChangeForm.emit(false);
9950
+ return;
9951
+ }
9952
+ var allValid = true;
9953
+ Object.values(this.formGroupByRow).forEach(function (fg) {
9954
+ // Verifica cada controle individualmente
9955
+ Object.keys(fg.controls).forEach(function (key) {
9956
+ var control = fg.get(key);
9957
+ // Verifica se o controle é obrigatório e está vazio
9958
+ if (control.validator && control.validator({})) {
9959
+ var validatorFn = control.validator({});
9960
+ if (validatorFn && validatorFn.required && !control.value) {
9961
+ allValid = false;
9962
+ }
9963
+ }
9964
+ // Verifica se o controle tem erros
9965
+ if (control.errors) {
9966
+ allValid = false;
9967
+ }
9968
+ });
9969
+ fg.updateValueAndValidity();
9970
+ if (!fg.valid) {
9971
+ allValid = false;
9972
+ }
9973
+ });
9974
+ this.isValidChangeForm.emit(allValid);
9975
+ };
9976
+ HistoricalPixAccountComponent.prototype.filterPixKeyType = function (event) {
9977
+ var _this = this;
9978
+ var query = event.query;
9979
+ this.service.enumQuery().subscribe(function (response) {
9980
+ var pixKeyTypeEnum = response.results.find(function (result) { return result.enumName === 'PixKeyType'; });
9981
+ if (pixKeyTypeEnum) {
9982
+ _this.suggestions = pixKeyTypeEnum.items.filter(function (item) {
9983
+ return item.value.toLowerCase().includes(query.toLowerCase());
9984
+ });
9985
+ }
9986
+ else {
9987
+ _this.suggestions = [];
9988
+ }
9989
+ });
9990
+ };
9991
+ HistoricalPixAccountComponent.prototype.createPixRowFormGroup = function () {
9992
+ return this.formBuilder.group({
9993
+ id: [null],
9994
+ pixKeyType: [null, Validators.required],
9995
+ pixKey: [null],
9996
+ percentage: [0, Validators.compose(__spread(this.initialValidatorOfPercentage, [
9997
+ Validators.max(this.maxValuePercentage),
9998
+ ]))],
9999
+ externalId: [null],
10000
+ });
10001
+ };
10002
+ /**
10003
+ * Sincroniza todos os dados do NgModel para os FormGroups antes de enviar ao componente pai
10004
+ */
10005
+ HistoricalPixAccountComponent.prototype.syncPixDataToParentForm = function () {
10006
+ this.syncAllModelToForm();
10007
+ var historicalPix = __spread(this.addExistentHistoricData);
10008
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(historicalPix);
10009
+ if (this.formGroup) {
10010
+ this.formGroup.get(this.fieldFormGroup).patchValue({
10011
+ historicalPixAccountList: historicalPix
10012
+ });
10013
+ }
10014
+ };
10015
+ HistoricalPixAccountComponent.prototype.syncResetPixFormToParent = function () {
10016
+ this.formGroupByRow = {};
10017
+ this.historicalPixAccountList.reset();
10018
+ this.historicalPixAccountList.get('historicalPixAccountList').setValue([]);
10019
+ if (this.addExistentHistoricData.length) {
10020
+ this.rebuildFormGroupMap(this.addExistentHistoricData);
10021
+ }
10022
+ };
10023
+ /**
10024
+ * Valida todos os formulários
10025
+ */
10026
+ HistoricalPixAccountComponent.prototype.validateAllForms = function () {
10027
+ var _this = this;
10028
+ this.forceCloseAllCellEditors();
10029
+ this.syncAllModelToForm();
10030
+ if (!this.formGroupByRow || Object.keys(this.formGroupByRow).length === 0) {
10031
+ return true;
10032
+ }
10033
+ var isAllValid = true;
10034
+ Object.keys(this.formGroupByRow).forEach(function (indexKey) {
10035
+ var index = Number(indexKey);
10036
+ var form = _this.formGroupByRow[index];
10037
+ if (form) {
10038
+ Object.keys(form.controls).forEach(function (controlName) {
10039
+ var control = form.get(controlName);
10040
+ control.markAsTouched();
10041
+ if (controlName === 'pixKey') {
10042
+ var pixKeyTypeControl = form.get('pixKeyType');
10043
+ if (pixKeyTypeControl.value) {
10044
+ _this.validateDocumentField(index, pixKeyTypeControl.value.key);
10045
+ }
10046
+ }
10047
+ });
10048
+ form.updateValueAndValidity();
10049
+ if (form.invalid) {
10050
+ isAllValid = false;
10051
+ }
10052
+ }
10053
+ });
10054
+ if (isAllValid && this.addExistentHistoricData && this.addExistentHistoricData.length > 0) {
10055
+ var totalPercentage = this.addExistentHistoricData.reduce(function (sum, item) { return sum + (parseFloat(item.percentage) || 0); }, 0);
10056
+ if (Math.abs(totalPercentage - 100) > 0.01) {
10057
+ isAllValid = false;
10058
+ }
10059
+ }
10060
+ this.isValidChangeForm.emit(isAllValid);
10061
+ return isAllValid;
10062
+ };
9379
10063
  HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
9380
10064
  var _this = this;
9381
10065
  var first = event && event.first ? event.first : 0;
@@ -9403,6 +10087,7 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9403
10087
  this.refreshCssInIE11();
9404
10088
  }
9405
10089
  this.loading = false;
10090
+ this.cd.detectChanges();
9406
10091
  };
9407
10092
  /**
9408
10093
  * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
@@ -9420,12 +10105,86 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9420
10105
  this.pixAccountItemInput = {};
9421
10106
  this.visible = true;
9422
10107
  };
9423
- HistoricalPixAccountComponent.prototype.isNotAllowMessage = function () {
9424
- this.messageService.add({
9425
- severity: "error",
9426
- summary: this.translateService.instant("hcm.payroll.error"),
9427
- detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
10108
+ HistoricalPixAccountComponent.prototype.addPix = function () {
10109
+ var newItem = {
10110
+ id: null,
10111
+ pixKeyType: {},
10112
+ pixKey: '',
10113
+ percentage: '',
10114
+ externalId: '',
10115
+ };
10116
+ var index = this.addExistentHistoricData.length;
10117
+ this.addExistentHistoricData = __spread(this.addExistentHistoricData, [
10118
+ newItem
10119
+ ]);
10120
+ this.formGroupByRow[index] = this.createPixRowFormGroup();
10121
+ this.setValidatorsAccordingList(this.addExistentHistoricData, index, true);
10122
+ this.emitFormValidity();
10123
+ };
10124
+ HistoricalPixAccountComponent.prototype.deletePix = function (index) {
10125
+ var _this = this;
10126
+ if (this.dataListPix.editingCell) {
10127
+ this.dataListPix.editingCell = null;
10128
+ }
10129
+ this.addExistentHistoricData = this.addExistentHistoricData.filter(function (_, i) { return i !== index; });
10130
+ var currentList = this.historicalPixAccountList.get("historicalPixAccountList").value || [];
10131
+ var updatedList = currentList.filter(function (_, i) { return i !== index; });
10132
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(updatedList);
10133
+ if (this.formGroup) {
10134
+ this.formGroup.get(this.fieldFormGroup).patchValue({
10135
+ historicalPixAccountList: updatedList
10136
+ });
10137
+ }
10138
+ this.rebuildFormGroupMap(this.addExistentHistoricData);
10139
+ this.addExistentHistoricData.forEach(function (_, i) {
10140
+ if (_this.formGroupByRow[i]) {
10141
+ var allValues = _this.addExistentHistoricData
10142
+ .map(function (item, idx) { return idx === i ? 0 : (parseFloat(item.percentage) || 0); });
10143
+ _this.validatePercentageValid(allValues, _this.formGroupByRow[i]);
10144
+ }
9428
10145
  });
10146
+ this.emitFormValidity();
10147
+ };
10148
+ HistoricalPixAccountComponent.prototype.rebuildFormGroupMap = function (data) {
10149
+ var _this = this;
10150
+ this.formGroupByRow = {};
10151
+ data.forEach(function (item, index) {
10152
+ var form = _this.createPixRowFormGroup();
10153
+ var pixKeyType = item.pixKeyType.key;
10154
+ var pixKeyRaw = item.pixKey;
10155
+ if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ') {
10156
+ item.pixKey = FormatUtilsService.getFormattedSubscriptionNumber(pixKeyRaw, pixKeyType);
10157
+ }
10158
+ if (pixKeyType === 'TELEPHONE') {
10159
+ item.pixKey = FormatUtilsService.getFormattedTelephoneNumber(pixKeyRaw);
10160
+ }
10161
+ form.patchValue(item);
10162
+ _this.formGroupByRow[index] = form;
10163
+ _this.pixKeyType = pixKeyType;
10164
+ _this.setPixKeyValidators(true, form);
10165
+ _this.setValidatorsAccordingList(data, index, _this.isEditMode);
10166
+ var listValues = data
10167
+ .filter(function (_, i) { return i !== index; })
10168
+ .map(function (row) { return row.percentage ? parseFloat(row.percentage) : 0; });
10169
+ _this.validatePercentageValid(listValues, form);
10170
+ });
10171
+ this.emitFormValidity();
10172
+ };
10173
+ HistoricalPixAccountComponent.prototype.onPixKeyTypeChange = function (item, index) {
10174
+ var _this = this;
10175
+ var form = this.formGroupByRow[index];
10176
+ this.onChangePixKeyType(item, form);
10177
+ this.addExistentHistoricData[index].pixKey = '';
10178
+ setTimeout(function () {
10179
+ if (_this.dataListPix.editingCell) {
10180
+ _this.dataListPix.editingCell = null;
10181
+ }
10182
+ });
10183
+ this.cd.detectChanges();
10184
+ };
10185
+ HistoricalPixAccountComponent.prototype.onPixKeyTypeClear = function (index) {
10186
+ var form = this.formGroupByRow[index];
10187
+ this.onClearPixKeyType(form);
9429
10188
  };
9430
10189
  HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
9431
10190
  var newlist = __spread(this.getHistoricalPixAccountList());
@@ -9458,6 +10217,7 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9458
10217
  }
9459
10218
  $event["dateChange"] = this.dateChange;
9460
10219
  newDataList.push($event);
10220
+ this.addExistentHistoricData.push(__assign({}, $event));
9461
10221
  }
9462
10222
  this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9463
10223
  this.verifyTotalPercentage();
@@ -9487,6 +10247,368 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9487
10247
  this.msgTotalLimitByPercentage = null;
9488
10248
  }
9489
10249
  };
10250
+ HistoricalPixAccountComponent.prototype.formatPercentage = function (value) {
10251
+ if (value == null || value === '' || isNaN(Number(value))) {
10252
+ return '0.00';
10253
+ }
10254
+ return Number(value).toFixed(2);
10255
+ };
10256
+ HistoricalPixAccountComponent.prototype.onSyncValue = function (field, index) {
10257
+ var _this = this;
10258
+ if (this.formGroupByRow &&
10259
+ this.formGroupByRow[index] &&
10260
+ this.formGroupByRow[index].get(field)) {
10261
+ var control = this.formGroupByRow[index].get(field);
10262
+ var value = control.value;
10263
+ this.addExistentHistoricData[index][field] = value;
10264
+ control.markAsDirty();
10265
+ control.markAsTouched();
10266
+ if (field === 'percentage') {
10267
+ var currentList = this.addExistentHistoricData
10268
+ .map(function (item, i) { return i === index ? 0 : (parseFloat(item.percentage) || 0); });
10269
+ this.validatePercentageValid(currentList, this.formGroupByRow[index]);
10270
+ if (!this.isSyncingPercentage) {
10271
+ this.isSyncingPercentage = true;
10272
+ setTimeout(function () {
10273
+ _this.syncPixDataToParentForm();
10274
+ _this.isSyncingPercentage = false;
10275
+ }, 0);
10276
+ }
10277
+ }
10278
+ control.updateValueAndValidity();
10279
+ this.formGroupByRow[index].updateValueAndValidity();
10280
+ this.emitFormValidity();
10281
+ }
10282
+ };
10283
+ HistoricalPixAccountComponent.prototype.close = function () {
10284
+ this.visible = false;
10285
+ };
10286
+ HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
10287
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
10288
+ };
10289
+ HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
10290
+ return FormatUtilsService.getFormattedCpf(cpf);
10291
+ };
10292
+ HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
10293
+ return FormatUtilsService.getFormattedCnpj(cnpj);
10294
+ };
10295
+ HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
10296
+ return FormatUtilsService.getFormattedPercentage(value);
10297
+ };
10298
+ /**
10299
+ * Reseta completamente o estado do formulário e controles
10300
+ */
10301
+ HistoricalPixAccountComponent.prototype.resetFormState = function () {
10302
+ if (this.formGroupByRow) {
10303
+ Object.values(this.formGroupByRow).forEach(function (form) {
10304
+ if (form) {
10305
+ Object.keys(form.controls).forEach(function (controlName) {
10306
+ var control = form.get(controlName);
10307
+ if (control) {
10308
+ control.setErrors(null);
10309
+ control.markAsUntouched();
10310
+ control.markAsPristine();
10311
+ }
10312
+ });
10313
+ form.updateValueAndValidity();
10314
+ }
10315
+ });
10316
+ }
10317
+ if (this.dataListPix) {
10318
+ if (typeof this.dataListPix.closeAllCellEditors === 'function') {
10319
+ try {
10320
+ this.dataListPix.closeAllCellEditors();
10321
+ }
10322
+ catch (e) {
10323
+ console.error('Erro ao tentar fechar cell editors:', e);
10324
+ }
10325
+ }
10326
+ else if (this.dataListPix.editingCell) {
10327
+ this.dataListPix.editingCell = null;
10328
+ }
10329
+ if (this.dataListPix.editing !== undefined) {
10330
+ this.dataListPix.editing = false;
10331
+ }
10332
+ }
10333
+ this.cd.detectChanges();
10334
+ };
10335
+ /**
10336
+ * Formata a chave PIX para exibição baseada no tipo
10337
+ */
10338
+ HistoricalPixAccountComponent.prototype.getFormattedPixKey = function (pixKeyType, pixKey) {
10339
+ if (!pixKey)
10340
+ return '';
10341
+ switch (pixKeyType) {
10342
+ case 'CPF':
10343
+ return FormatUtilsService.getFormattedCpf(pixKey);
10344
+ case 'CNPJ':
10345
+ return FormatUtilsService.getFormattedCnpj(pixKey);
10346
+ case 'TELEPHONE':
10347
+ return FormatUtilsService.getFormattedTelephoneNumber(pixKey);
10348
+ case 'EMAIL':
10349
+ case 'RANDOM_KEY':
10350
+ default:
10351
+ return pixKey;
10352
+ }
10353
+ };
10354
+ /**
10355
+ * Obtém o tipo de chave PIX do item atual
10356
+ */
10357
+ HistoricalPixAccountComponent.prototype.getPixKeyType = function (item) {
10358
+ return item && item.pixKeyType && item.pixKeyType.key || '';
10359
+ };
10360
+ /**
10361
+ * Verifica se um controle está inválido para os campos editáveis
10362
+ */
10363
+ HistoricalPixAccountComponent.prototype.isInvalid = function (index, controlName) {
10364
+ var form = this.formGroupByRow[index];
10365
+ if (!form)
10366
+ return false;
10367
+ var control = form.get(controlName);
10368
+ if (!control)
10369
+ return false;
10370
+ return control.invalid && (control.touched || control.dirty);
10371
+ };
10372
+ /**
10373
+ * Método chamado quando uma célula entra no modo de edição
10374
+ */
10375
+ HistoricalPixAccountComponent.prototype.onCellEditInit = function (event) {
10376
+ var rowIndex = this.addExistentHistoricData.findIndex(function (item) { return item === event.data; });
10377
+ if (rowIndex < 0)
10378
+ return;
10379
+ var form = this.formGroupByRow[rowIndex];
10380
+ if (form && form.get('pixKey')) {
10381
+ var pixKeyControl = form.get('pixKey');
10382
+ var currentValue = this.addExistentHistoricData[rowIndex].pixKey;
10383
+ pixKeyControl.setValue(currentValue);
10384
+ }
10385
+ };
10386
+ /**
10387
+ * Recupera o FormControl específico para um campo em determinado índice
10388
+ */
10389
+ HistoricalPixAccountComponent.prototype.getFormControl = function (index, controlName) {
10390
+ var form = this.formGroupByRow[index];
10391
+ if (!form)
10392
+ return null;
10393
+ return form.get(controlName);
10394
+ };
10395
+ /**
10396
+ * Valida campos de documento (CPF, CNPJ) quando o usuário termina de digitar no form de edição
10397
+ */
10398
+ HistoricalPixAccountComponent.prototype.validateDocumentField = function (index, fieldType) {
10399
+ var _a;
10400
+ var form = this.formGroupByRow[index];
10401
+ var item = this.addExistentHistoricData[index];
10402
+ if (!form || !item)
10403
+ return;
10404
+ var pixKeyControl = form.get('pixKey');
10405
+ if (!pixKeyControl)
10406
+ return;
10407
+ var value = item.pixKey;
10408
+ pixKeyControl.setValue(value);
10409
+ if (fieldType === 'CPF' || fieldType === 'CNPJ' || fieldType === 'TELEPHONE') {
10410
+ value = value ? value.toString().replace(/\D/g, '') : '';
10411
+ item.pixKey = value;
10412
+ pixKeyControl.setValue(value);
10413
+ }
10414
+ if (!value || value.toString().trim() === '') {
10415
+ pixKeyControl.setErrors({ required: true });
10416
+ pixKeyControl.markAsTouched();
10417
+ form.updateValueAndValidity();
10418
+ this.emitFormValidity();
10419
+ return;
10420
+ }
10421
+ var cleanValue = value;
10422
+ if (fieldType === 'CPF' || fieldType === 'CNPJ') {
10423
+ cleanValue = value.toString().replace(/\D/g, '');
10424
+ item.pixKey = cleanValue;
10425
+ pixKeyControl.setValue(cleanValue);
10426
+ }
10427
+ var isValid = false;
10428
+ switch (fieldType) {
10429
+ case 'CPF':
10430
+ isValid = cleanValue.length === 11 && GenericValidator.isValidCpf({ value: cleanValue }) === null;
10431
+ break;
10432
+ case 'CNPJ':
10433
+ isValid = cleanValue.length === 14 && GenericValidator.isValidCnpj({ value: cleanValue }) === null;
10434
+ break;
10435
+ case 'TELEPHONE':
10436
+ cleanValue = value.toString().replace(/\D/g, '');
10437
+ isValid = GenericValidator.isValidPhoneNumber({ value: cleanValue }) === null;
10438
+ break;
10439
+ case 'EMAIL':
10440
+ isValid = GenericValidator.isValidEmail({ value: value }) === null;
10441
+ break;
10442
+ case 'RANDOM_KEY':
10443
+ isValid = true;
10444
+ break;
10445
+ default:
10446
+ isValid = true;
10447
+ }
10448
+ pixKeyControl.markAsTouched();
10449
+ if (isValid) {
10450
+ pixKeyControl.setErrors(null);
10451
+ }
10452
+ else {
10453
+ var errorType = this.getErrorTypeForField(fieldType);
10454
+ pixKeyControl.setErrors((_a = {}, _a[errorType] = true, _a));
10455
+ }
10456
+ form.updateValueAndValidity();
10457
+ this.emitFormValidity();
10458
+ this.cd.detectChanges();
10459
+ };
10460
+ /**
10461
+ * Obtém o tipo de erro para cada tipo de campo editável
10462
+ */
10463
+ HistoricalPixAccountComponent.prototype.getErrorTypeForField = function (fieldType) {
10464
+ switch (fieldType) {
10465
+ case 'CPF': return 'invalidCpf';
10466
+ case 'CNPJ': return 'invalidCnpj';
10467
+ case 'TELEPHONE': return 'invalidPhoneNumber';
10468
+ case 'EMAIL': return 'invalidEmail';
10469
+ default: return 'required';
10470
+ }
10471
+ };
10472
+ /**
10473
+ * Retorna a mensagem de erro apropriada para um campo
10474
+ */
10475
+ HistoricalPixAccountComponent.prototype.getErrorMessage = function (index, controlName) {
10476
+ var form = this.formGroupByRow[index];
10477
+ if (!form)
10478
+ return '';
10479
+ var control = form.get(controlName);
10480
+ if (!control || !control.errors)
10481
+ return '';
10482
+ var fieldValue = control.value || '';
10483
+ if (control.hasError('required')) {
10484
+ return this.translateService.instant('hcm.payroll.required');
10485
+ }
10486
+ if (control.hasError('invalidCpf')) {
10487
+ return this.translateService.instant('hcm.payroll.employees_addition_cpf_error');
10488
+ }
10489
+ else if (control.hasError('invalidCnpj')) {
10490
+ return this.translateService.instant('hcm.payroll.employees_addition_cnpj_error');
10491
+ }
10492
+ else if (control.hasError('invalidEmail')) {
10493
+ return this.translateService.instant('hcm.payroll.employees_addition_email_invalid');
10494
+ }
10495
+ else if (control.hasError('invalidPhoneNumber')) {
10496
+ return this.translateService.instant('hcm.payroll.employees_addition_invalid_phone_number', { value: fieldValue });
10497
+ }
10498
+ return '';
10499
+ };
10500
+ /**
10501
+ * Tratamento ao perder o foco em campos de documento
10502
+ */
10503
+ HistoricalPixAccountComponent.prototype.onDocumentBlur = function (index) {
10504
+ var form = this.formGroupByRow[index];
10505
+ var item = this.addExistentHistoricData[index];
10506
+ if (!form || !item)
10507
+ return;
10508
+ var pixKeyControl = form.get('pixKey');
10509
+ var pixKeyTypeControl = form.get('pixKeyType');
10510
+ if (!pixKeyControl || !pixKeyTypeControl.value)
10511
+ return;
10512
+ var pixKeyType = pixKeyTypeControl.value.key;
10513
+ var value = item.pixKey;
10514
+ if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ' || pixKeyType === 'TELEPHONE') {
10515
+ value = value ? value.toString().replace(/\D/g, '') : '';
10516
+ item.pixKey = value;
10517
+ }
10518
+ pixKeyControl.setValue(value);
10519
+ this.validateDocumentField(index, pixKeyType);
10520
+ if (value) {
10521
+ if (pixKeyType === 'CPF') {
10522
+ item.pixKeyFormatted = FormatUtilsService.getFormattedCpf(value);
10523
+ }
10524
+ else if (pixKeyType === 'CNPJ') {
10525
+ item.pixKeyFormatted = FormatUtilsService.getFormattedCnpj(value);
10526
+ }
10527
+ else if (pixKeyType === 'TELEPHONE') {
10528
+ item.pixKeyFormatted = FormatUtilsService.getFormattedTelephoneNumber(value);
10529
+ }
10530
+ else {
10531
+ item.pixKeyFormatted = value;
10532
+ }
10533
+ }
10534
+ this.finishEditing();
10535
+ };
10536
+ HistoricalPixAccountComponent.prototype.finishEditing = function () {
10537
+ this.syncAllModelToForm();
10538
+ this.cd.detectChanges();
10539
+ };
10540
+ HistoricalPixAccountComponent.prototype.clearErrorsTemporarily = function (rowIndex) {
10541
+ var form = this.formGroupByRow[rowIndex];
10542
+ if (form && form.get('pixKey')) {
10543
+ var currentValue = form.get('pixKey').value;
10544
+ form.get('pixKey').setErrors(null);
10545
+ form.get('pixKey').setValue(currentValue);
10546
+ }
10547
+ };
10548
+ HistoricalPixAccountComponent.prototype.closeEditModeManually = function () {
10549
+ var _this = this;
10550
+ setTimeout(function () {
10551
+ if (_this.dataListPix) {
10552
+ if (typeof _this.dataListPix.closeAllCellEditors === 'function') {
10553
+ _this.dataListPix.closeAllCellEditors();
10554
+ }
10555
+ else if (_this.dataListPix.editingCell) {
10556
+ _this.dataListPix.editingCell = null;
10557
+ }
10558
+ _this.cd.detectChanges();
10559
+ }
10560
+ }, 100);
10561
+ };
10562
+ HistoricalPixAccountComponent.prototype.syncAllModelToForm = function () {
10563
+ var _this = this;
10564
+ if (!this.addExistentHistoricData || !this.formGroupByRow)
10565
+ return;
10566
+ this.addExistentHistoricData.forEach(function (item, index) {
10567
+ var form = _this.formGroupByRow[index];
10568
+ if (form) {
10569
+ Object.keys(form.controls).forEach(function (controlName) {
10570
+ var control = form.get(controlName);
10571
+ if (control && item[controlName] !== undefined) {
10572
+ control.setValue(item[controlName]);
10573
+ }
10574
+ });
10575
+ var pixKeyTypeControl = form.get('pixKeyType');
10576
+ if (pixKeyTypeControl.value) {
10577
+ _this.validateDocumentField(index, pixKeyTypeControl.value.key);
10578
+ }
10579
+ }
10580
+ });
10581
+ };
10582
+ /**
10583
+ * Método para forçar o fechamento de todas as células em edição
10584
+ */
10585
+ HistoricalPixAccountComponent.prototype.forceCloseAllCellEditors = function () {
10586
+ this.finishEditing();
10587
+ this.syncAllModelToForm();
10588
+ };
10589
+ HistoricalPixAccountComponent.prototype.isPixKeyType = function (item, type) {
10590
+ return item && item.pixKeyType && item.pixKeyType.key === type;
10591
+ };
10592
+ HistoricalPixAccountComponent.prototype.getPixKey = function (rowData) {
10593
+ return rowData ? rowData.pixKey : null;
10594
+ };
10595
+ HistoricalPixAccountComponent.prototype.setPixKey = function (rowData, value) {
10596
+ if (rowData) {
10597
+ rowData.pixKey = value;
10598
+ }
10599
+ };
10600
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isTotalPercentage100", {
10601
+ get: function () {
10602
+ if (!this.addExistentHistoricData || this.addExistentHistoricData.length === 0) {
10603
+ return false;
10604
+ }
10605
+ var totalPercentage = this.addExistentHistoricData
10606
+ .reduce(function (sum, item) { return sum + (parseFloat(item.percentage) || 0); }, 0);
10607
+ return totalPercentage >= 100;
10608
+ },
10609
+ enumerable: true,
10610
+ configurable: true
10611
+ });
9490
10612
  Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
9491
10613
  get: function () {
9492
10614
  return this.actions.bind(this);
@@ -9496,7 +10618,8 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9496
10618
  });
9497
10619
  Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
9498
10620
  get: function () {
9499
- return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
10621
+ return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ?
10622
+ this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
9500
10623
  },
9501
10624
  enumerable: true,
9502
10625
  configurable: true
@@ -9557,21 +10680,20 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9557
10680
  enumerable: true,
9558
10681
  configurable: true
9559
10682
  });
9560
- HistoricalPixAccountComponent.prototype.close = function () {
9561
- this.visible = false;
9562
- };
9563
- HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
9564
- return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9565
- };
9566
- HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
9567
- return FormatUtilsService.getFormattedCpf(cpf);
9568
- };
9569
- HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
9570
- return FormatUtilsService.getFormattedCnpj(cnpj);
9571
- };
9572
- HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
9573
- return FormatUtilsService.getFormattedPercentage(value);
9574
- };
10683
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "paramsForm", {
10684
+ set: function (value) {
10685
+ this._paramsForm = value;
10686
+ },
10687
+ enumerable: true,
10688
+ configurable: true
10689
+ });
10690
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "defaultCpfNumber", {
10691
+ set: function (value) {
10692
+ this._defaultCpfNumber = value;
10693
+ },
10694
+ enumerable: true,
10695
+ configurable: true
10696
+ });
9575
10697
  Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
9576
10698
  get: function () {
9577
10699
  return (this.permission["incluir"]);
@@ -9604,11 +10726,15 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9604
10726
  { type: TranslateService },
9605
10727
  { type: ChangeDetectorRef },
9606
10728
  { type: FormBuilder },
9607
- { type: MessageService }
10729
+ { type: SharedStateService },
10730
+ { type: HistoricalPixAccountService }
9608
10731
  ]; };
9609
10732
  __decorate([
9610
10733
  ViewChild(CustomFieldsComponent$1, { static: false })
9611
10734
  ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
10735
+ __decorate([
10736
+ ViewChild('dataListPix', { static: false })
10737
+ ], HistoricalPixAccountComponent.prototype, "dataListPix", void 0);
9612
10738
  __decorate([
9613
10739
  Input()
9614
10740
  ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
@@ -9643,243 +10769,97 @@ var HistoricalPixAccountComponent = /** @class */ (function () {
9643
10769
  Input()
9644
10770
  ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9645
10771
  __decorate([
9646
- Input()
9647
- ], HistoricalPixAccountComponent.prototype, "customService", void 0);
9648
- __decorate([
9649
- Input()
9650
- ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
9651
- __decorate([
9652
- Input()
9653
- ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
9654
- __decorate([
9655
- Input()
9656
- ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
9657
- __decorate([
9658
- Input()
9659
- ], HistoricalPixAccountComponent.prototype, "permission", void 0);
9660
- __decorate([
9661
- Input()
9662
- ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
9663
- __decorate([
9664
- Output()
9665
- ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
9666
- __decorate([
9667
- Output()
9668
- ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
9669
- __decorate([
9670
- Output()
9671
- ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
9672
- __decorate([
9673
- Input()
9674
- ], HistoricalPixAccountComponent.prototype, "dateChange", null);
9675
- __decorate([
9676
- Input()
9677
- ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
9678
- __decorate([
9679
- Input()
9680
- ], HistoricalPixAccountComponent.prototype, "addListData", null);
9681
- __decorate([
9682
- Input()
9683
- ], HistoricalPixAccountComponent.prototype, "visible", null);
9684
- HistoricalPixAccountComponent = __decorate([
9685
- Component({
9686
- // tslint:disable-next-line:component-selector
9687
- selector: "c-historical-pix-account",
9688
- 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",
9689
- 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}"]
9690
- })
9691
- ], HistoricalPixAccountComponent);
9692
- return HistoricalPixAccountComponent;
9693
- }());
9694
-
9695
- var GenericValidator = /** @class */ (function () {
9696
- function GenericValidator() {
9697
- }
9698
- /**
9699
- * Valida o CEI (Cadastro específico de INSS) digitado.
9700
- */
9701
- GenericValidator.isValidCei = function (control) {
9702
- var cei = control.value;
9703
- if (!cei)
9704
- return null;
9705
- else if (cei.length != 11)
9706
- return null;
9707
- var multiplicadorBase = "3298765432";
9708
- var total = 0;
9709
- var resto = 0;
9710
- var multiplicando = 0;
9711
- var multiplicador = 0;
9712
- if (cei.length !== 11 ||
9713
- cei === "00000000000" ||
9714
- cei === "11111111111" ||
9715
- cei === "22222222222" ||
9716
- cei === "33333333333" ||
9717
- cei === "44444444444" ||
9718
- cei === "55555555555" ||
9719
- cei === "66666666666" ||
9720
- cei === "77777777777" ||
9721
- cei === "88888888888" ||
9722
- cei === "99999999999")
9723
- return { invalidCei: true };
9724
- else {
9725
- for (var i = 0; i < 10; i++) {
9726
- multiplicando = parseInt(cei.substring(i, i + 1), 10);
9727
- multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
9728
- total += multiplicando * multiplicador;
9729
- }
9730
- resto = 11 - (total % 11);
9731
- resto = resto === 10 || resto === 11 ? 0 : resto;
9732
- var digito = parseInt("" + cei.charAt(10), 10);
9733
- return resto === digito ? null : { invalidCei: true };
9734
- }
9735
- };
9736
- /**
9737
- * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9738
- */
9739
- GenericValidator.isValidCpf = function (control) {
9740
- var cpf = control.value;
9741
- if (cpf) {
9742
- var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9743
- equalDigits = 1;
9744
- if (cpf.length < 11) {
9745
- return null;
9746
- }
9747
- for (i = 0; i < cpf.length - 1; i++) {
9748
- if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9749
- equalDigits = 0;
9750
- break;
9751
- }
9752
- }
9753
- if (!equalDigits) {
9754
- numbers = cpf.substring(0, 9);
9755
- digits = cpf.substring(9);
9756
- sum = 0;
9757
- for (i = 10; i > 1; i--) {
9758
- sum += numbers.charAt(10 - i) * i;
9759
- }
9760
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9761
- if (result !== Number(digits.charAt(0))) {
9762
- return { cpfNotValid: true };
9763
- }
9764
- numbers = cpf.substring(0, 10);
9765
- sum = 0;
9766
- for (i = 11; i > 1; i--) {
9767
- sum += numbers.charAt(11 - i) * i;
9768
- }
9769
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9770
- if (result !== Number(digits.charAt(1))) {
9771
- return { cpfNotValid: true };
9772
- }
9773
- return null;
9774
- }
9775
- else {
9776
- return { cpfNotValid: true };
9777
- }
9778
- }
9779
- return null;
9780
- };
9781
- /**
9782
- * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9783
- */
9784
- GenericValidator.isValidCnpj = function (control) {
9785
- var cnpj = control.value;
9786
- if (cnpj) {
9787
- var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9788
- cnpj = cnpj.replace(/[^\d]+/g, '');
9789
- if (cnpj.length !== 14) {
9790
- return null;
9791
- }
9792
- // Elimina CNPJs invalidos conhecidos
9793
- if (cnpj === '00000000000000' ||
9794
- cnpj === '11111111111111' ||
9795
- cnpj === '22222222222222' ||
9796
- cnpj === '33333333333333' ||
9797
- cnpj === '44444444444444' ||
9798
- cnpj === '55555555555555' ||
9799
- cnpj === '66666666666666' ||
9800
- cnpj === '77777777777777' ||
9801
- cnpj === '88888888888888' ||
9802
- cnpj === '99999999999999') {
9803
- return { cnpjNotValid: true };
9804
- }
9805
- // Valida DVs
9806
- size = cnpj.length - 2;
9807
- numbers = cnpj.substring(0, size);
9808
- digits = cnpj.substring(size);
9809
- sum = 0;
9810
- pos = size - 7;
9811
- for (var i = size; i >= 1; i--) {
9812
- sum += numbers.charAt(size - i) * pos--;
9813
- if (pos < 2) {
9814
- pos = 9;
9815
- }
9816
- }
9817
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9818
- if (result !== Number(digits.charAt(0))) {
9819
- return { cnpjNotValid: true };
9820
- }
9821
- size = size + 1;
9822
- numbers = cnpj.substring(0, size);
9823
- sum = 0;
9824
- pos = size - 7;
9825
- for (var i = size; i >= 1; i--) {
9826
- sum += numbers.charAt(size - i) * pos--;
9827
- if (pos < 2) {
9828
- pos = 9;
9829
- }
9830
- }
9831
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9832
- if (result !== Number(digits.charAt(1))) {
9833
- return { cnpjNotValid: true };
9834
- }
9835
- return null;
9836
- }
9837
- return null;
9838
- };
9839
- /**
9840
- * Válida o número de telefone da chave PIX.
9841
- */
9842
- GenericValidator.isValidPhoneNumber = function (control) {
9843
- var cellPhoneKey = control.value || '';
9844
- cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9845
- var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9846
- var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9847
- return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9848
- };
9849
- /**
9850
- * Valida o email da chave PIX.
9851
- */
9852
- GenericValidator.isValidEmail = function (control) {
9853
- var emailKey = control.value;
9854
- var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9855
- var isValidEmail = regexValidEmail.test(emailKey);
9856
- return isValidEmail ? null : { invalidEmail: true };
9857
- };
9858
- return GenericValidator;
9859
- }());
9860
-
9861
- var HistoricalPixAccountFormComponent = /** @class */ (function () {
9862
- function HistoricalPixAccountFormComponent(formBuilder, cd) {
9863
- this.formBuilder = formBuilder;
9864
- this.cd = cd;
9865
- this.withSideBar = true;
9866
- this.isEditMode = false;
9867
- this.paramsForm = new FormGroup({});
9868
- this.defaultCpfNumber = null;
9869
- this.visibleChange = new EventEmitter();
9870
- this.pixAccountItemToList = new EventEmitter();
9871
- this.ngUnsubscribe = new Subject();
9872
- this.initialValidatorOfPercentage = [Validators.required, Validators.min(0.01)];
9873
- this.labelBtnAdd = "hcm.payroll.employees_add";
9874
- this.maxValuePercentage = 100.00;
9875
- this.visibleBtnSave = true;
9876
- this.isView = false;
9877
- this.isShowPixKeyFieldValidatorMessage = false;
9878
- this.createFormGroup();
9879
- this.registerSubjects();
9880
- }
9881
- HistoricalPixAccountFormComponent.prototype.ngOnInit = function () {
9882
- };
10772
+ Input()
10773
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
10774
+ __decorate([
10775
+ Input()
10776
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
10777
+ __decorate([
10778
+ Input()
10779
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
10780
+ __decorate([
10781
+ Input()
10782
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
10783
+ __decorate([
10784
+ Input()
10785
+ ], HistoricalPixAccountComponent.prototype, "addExistentHistoricData", void 0);
10786
+ __decorate([
10787
+ Input()
10788
+ ], HistoricalPixAccountComponent.prototype, "getListPixAccount", void 0);
10789
+ __decorate([
10790
+ Input()
10791
+ ], HistoricalPixAccountComponent.prototype, "isEditModeForSave", void 0);
10792
+ __decorate([
10793
+ Input()
10794
+ ], HistoricalPixAccountComponent.prototype, "showField", void 0);
10795
+ __decorate([
10796
+ Input()
10797
+ ], HistoricalPixAccountComponent.prototype, "hideBtnAddForViewMode", void 0);
10798
+ __decorate([
10799
+ Input()
10800
+ ], HistoricalPixAccountComponent.prototype, "showButtonView", void 0);
10801
+ __decorate([
10802
+ Output()
10803
+ ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
10804
+ __decorate([
10805
+ Output()
10806
+ ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
10807
+ __decorate([
10808
+ Output()
10809
+ ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
10810
+ __decorate([
10811
+ Output()
10812
+ ], HistoricalPixAccountComponent.prototype, "isValidChangeForm", void 0);
10813
+ __decorate([
10814
+ Input()
10815
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
10816
+ __decorate([
10817
+ Input()
10818
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
10819
+ __decorate([
10820
+ Input()
10821
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
10822
+ __decorate([
10823
+ Input()
10824
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
10825
+ __decorate([
10826
+ Input()
10827
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", null);
10828
+ __decorate([
10829
+ Input()
10830
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", null);
10831
+ HistoricalPixAccountComponent = __decorate([
10832
+ Component({
10833
+ // tslint:disable-next-line:component-selector
10834
+ selector: "c-historical-pix-account",
10835
+ template: "<s-sidebar *ngIf=\"withSideBar\" [visible]=\"visible\" (visibleChange)=\"close()\"\n header=\"{{'hcm.payroll.historical_pix_account_title_form'|translate}}\">\n<pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [paramsForm]=\"paramsForm\"\n [showField]=\"showFields\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</s-sidebar>\n\n<div *ngIf=\"!withSideBar\">\n <pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [withSideBar]=\"false\"\n [isViewMode]=\"isViewMode\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</div>\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode && !hideBtnAddForViewMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div *ngIf=\"showFields || !showEditMode || !(hideFields | async)\" class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col *ngIf=\"showButtonView\" [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th *ngIf=\"showButtonView\" id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length && showButtonView\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"!isViewMode && actions(rowData, key).length > 1\" [label]=\"actionLabel\"\n priority=\"default\" [model]=\"scopedActions(rowData, key)\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n\n <s-button id=\"table-admission-btn-action-{{key}}\"\n *ngIf=\"!isViewMode && actions(rowData, key).length <= 1\"\n [label]=\"scopedActions(rowData, key)[0].label\"\n priority=\"default\"\n (click)=\"scopedActions(rowData, key)[0].command()\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length +2\">\n {{'hcm.payroll.admission_empty_message'|translate}}\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span *ngIf=\"totalRecords\">{{recordsMessage}}</span>\n </ng-template>\n </p-table>\n</div>\n\n<!-- Template exlusivo para edi\u00E7\u00E3o de pix via modal-->\n<div *ngIf=\"!withSideBar && showEditMode && (hideFields | async)\" class=\"ui-g-12\">\n <!-- Bot\u00E3o Adicionar -->\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <s-button\n id=\"btn-save\"\n label=\"{{ 'hcm.payroll.historical_pix_account_add' | translate}}\"\n priority=\"primary\"\n [disabled]=\"isTotalPercentage100\"\n [pTooltip]=\"isTotalPercentage100 ? ('hcm.payroll.historical_pix_account_msg_limit_total_by_percentage' | translate) : ''\"\n tooltipPosition=\"top\"\n (onClick)=\"addPix()\">\n </s-button>\n </div>\n </div>\n\n <!-- Tabela -->\n <p-table #dataListPix sortField=\"percentage\"\n [columns]=\"cols\"\n [value]=\"addExistentHistoricData\"\n [pageLinks]=\"3\"\n [paginator]=\"true\"\n [responsive]=\"true\"\n [rows]=\"10\"\n [resetPageOnSort]=\"false\"\n [tableStyle]=\"{'margin-top': '2rem'}\"\n [customSort]=\"true\"\n (onEditInit)=\"onCellEditInit($event)\">\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of cols\">\n {{ col.label }}\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-rowIndex=\"rowIndex\">\n <ng-container *ngIf=\"formGroupByRow[rowIndex]\" [formGroup]=\"formGroupByRow[rowIndex]\">\n <tr>\n <!-- Tipo de Chave -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.pixKeyType\" pEditableColumnField=\"pixKeyType\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <div style=\"width: 100%; position: relative;\">\n <p-autoComplete\n [suggestions]=\"suggestions\"\n (completeMethod)=\"filterPixKeyType($event)\"\n formControlName=\"pixKeyType\"\n [dropdown]=\"true\"\n (onSelect)=\"onPixKeyTypeChange($event, rowIndex)\"\n (onClear)=\"onPixKeyTypeClear(rowIndex)\"\n (ngModelChange)=\"onSyncValue('pixKeyType', rowIndex)\"\n field=\"value\"\n placeholder=\"{{'hcm.payroll.select' | translate}}\"\n appendTo=\"body\"\n [panelStyle]=\"{ maxWidth: '300px', width: '100%' }\"\n [inputStyle]=\"{ width: '100%' }\"\n ></p-autoComplete>\n\n <s-control-errors [control]=\"formGroupByRow[rowIndex]?.get('pixKeyType')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n pixKeyTypeBankAccountDuplicate: 'hcm.payroll.historical_pix_key_type_bank_account_duplicate' | translate\n }\">\n </s-control-errors>\n </div>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ item.pixKeyType?.value }}\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Chave Pix -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.pixKey\" pEditableColumnField=\"pixKey\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <div class=\"ui-fluid\">\n <!-- \u00C1rea de inputs din\u00E2micos -->\n <div [ngSwitch]=\"getPixKeyType(item)\" class=\"ui-fluid\">\n <!-- CPF -->\n <p-inputMask *ngSwitchCase=\"'CPF'\"\n mask=\"999.999.999-99\"\n unmask=\"true\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n styleClass=\"full-width-input\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (onComplete)=\"validateDocumentField(rowIndex, 'CPF')\"\n (onBlur)=\"onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n </p-inputMask>\n\n <!-- CNPJ -->\n <p-inputMask *ngSwitchCase=\"'CNPJ'\"\n mask=\"99.999.999/9999-99\"\n unmask=\"true\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n styleClass=\"full-width-input\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (onComplete)=\"validateDocumentField(rowIndex, 'CNPJ')\"\n (onBlur)=\"onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n </p-inputMask>\n\n <!-- TELEPHONE -->\n <p-inputMask *ngSwitchCase=\"'TELEPHONE'\"\n mask=\"(99) 99999-9999\"\n unmask=\"true\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n styleClass=\"full-width-input\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (onComplete)=\"validateDocumentField(rowIndex, 'TELEPHONE')\"\n (onBlur)=\"onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n </p-inputMask>\n\n <!-- EMAIL -->\n <input *ngSwitchCase=\"'EMAIL'\"\n type=\"email\"\n pInputText\n class=\"p-inputtext p-component full-width-input\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (blur)=\"validateDocumentField(rowIndex, 'EMAIL'); onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n\n <!-- RANDOM_KEY -->\n <input *ngSwitchCase=\"'RANDOM_KEY'\"\n type=\"text\"\n pInputText\n class=\"p-inputtext p-component full-width-input\"\n [(ngModel)]=\"item.pixKey\"\n [ngModelOptions]=\"{standalone: true}\"\n [ngClass]=\"{'ng-invalid': isInvalid(rowIndex, 'pixKey')}\"\n (blur)=\"validateDocumentField(rowIndex, 'RANDOM_KEY'); onDocumentBlur(rowIndex)\"\n (keydown.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.tab)=\"onDocumentBlur(rowIndex)\"\n (keydown.enter)=\"onDocumentBlur(rowIndex)\"\n (keydown.esc)=\"onDocumentBlur(rowIndex)\"\n (keydown.shift.esc)=\"onDocumentBlur(rowIndex)\">\n\n <!-- BANK_ACCOUNT -->\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\"\n type=\"text\"\n pInputText\n class=\"p-inputtext p-component full-width-input\"\n [disabled]=\"true\">\n </div>\n\n <!-- \u00DAnico s-control-errors para todos os tipos -->\n <small *ngIf=\"isInvalid(rowIndex, 'pixKey')\" class=\"p-error error-text\">\n {{getErrorMessage(rowIndex, 'pixKey')}}\n </small>\n </div>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{getFormattedPixKey(getPixKeyType(item), item.pixKey)}}\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Percentual -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.percentage\" pEditableColumnField=\"percentage\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <input\n pInputText type=\"number\"\n formControlName=\"percentage\"\n (ngModelChange)=\"onSyncValue('percentage', rowIndex)\"\n >\n <s-control-errors\n [control]=\"formGroupByRow[rowIndex]?.get('percentage')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n maxlength: 'hcm.payroll.error_max_length' | translate: { value: '6' },\n max: 'hcm.payroll.error_max_value_number' | translate: { value: maxValuePercentage },\n min: 'hcm.payroll.error_min_value_number' | translate: { value: '0,01' }\n }\">\n </s-control-errors>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ formatPercentage(item.percentage) }}%\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Bot\u00E3o de excluir -->\n <td>\n <s-button\n id=\"btn-delete\"\n label=\"{{ 'hcm.payroll.delete' | translate }}\"\n priority=\"default\"\n (onClick)=\"deletePix(rowIndex)\">\n </s-button>\n </td>\n </tr>\n </ng-container>\n </ng-template>\n </p-table>\n</div>\n",
10836
+ styles: [".refresh{width:100%!important}#table-annuity .col-default-s{width:10%}#table-annuity .col-default-m{width:12%}#table-annuity .col-default-l{width:16%}#table-annuity .col-action{width:10%}#table-annuity .icon-warning{text-align:center!important;color:#ff6d00c7!important}@media screen and (max-width:612px){#table-annuity .col-default-1,#table-annuity .col-default-2{width:16%}#table-annuity .col-default-3{width:26%}#table-annuity .col-icon{width:10%}#table-annuity .col-action{width:27%}}#main{display:-webkit-box;display:flex;height:100%;width:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}#main form{height:100%}#main .footer{border-top:1px solid #ccc;padding-top:15px;margin-top:15px;flex-shrink:0;margin-bottom:-18px}#main .footer-s-border{padding-left:7px;flex-shrink:0;margin-bottom:-18px}:host ::ng-deep .p-cell-editing{padding:0!important}:host ::ng-deep .full-width-input{width:100%!important;min-height:34px!important;padding:6px 12px!important}:host ::ng-deep .p-inputtext{width:100%;min-height:34px;padding:6px 12px}:host ::ng-deep .p-inputmask{width:100%;display:block}:host ::ng-deep .p-inputmask .p-inputmask-input{width:100%!important;min-height:34px!important;padding:6px 12px!important}:host ::ng-deep p-celleditor{width:100%}:host ::ng-deep p-celleditor .ui-fluid{width:100%;display:block;padding:0}:host ::ng-deep .p-error{margin-top:4px;font-size:12px}:host ::ng-deep .error-text{color:#f44336;display:block;margin-top:4px;font-size:.875em}"]
10837
+ })
10838
+ ], HistoricalPixAccountComponent);
10839
+ return HistoricalPixAccountComponent;
10840
+ }(HistoricakPixAccountBase));
10841
+
10842
+ var HistoricalPixAccountFormComponent = /** @class */ (function (_super) {
10843
+ __extends(HistoricalPixAccountFormComponent, _super);
10844
+ function HistoricalPixAccountFormComponent(formBuilder, cd, sharedStateService) {
10845
+ var _this = _super.call(this, formBuilder) || this;
10846
+ _this.cd = cd;
10847
+ _this.sharedStateService = sharedStateService;
10848
+ _this.withSideBar = true;
10849
+ _this.isEditMode = false;
10850
+ _this.showField = false;
10851
+ _this.visibleChange = new EventEmitter();
10852
+ _this.pixAccountItemToList = new EventEmitter();
10853
+ _this.ngUnsubscribe = new Subject();
10854
+ _this.labelBtnAdd = "hcm.payroll.employees_add";
10855
+ _this.visibleBtnSave = true;
10856
+ _this.isView = false;
10857
+ _this.isShowPixKeyFieldValidatorMessage = false;
10858
+ _this.hideFields = _this.sharedStateService.hideField$;
10859
+ _this.registerSubjects();
10860
+ return _this;
10861
+ }
10862
+ HistoricalPixAccountFormComponent.prototype.ngOnInit = function () { };
9883
10863
  HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
9884
10864
  this.cd.detectChanges();
9885
10865
  };
@@ -9887,38 +10867,7 @@ var HistoricalPixAccountFormComponent = /** @class */ (function () {
9887
10867
  this.ngUnsubscribe.next(true);
9888
10868
  this.ngUnsubscribe.unsubscribe();
9889
10869
  };
9890
- HistoricalPixAccountFormComponent.prototype.registerSubjects = function () {
9891
- };
9892
- HistoricalPixAccountFormComponent.prototype.createFormGroup = function () {
9893
- this.pixAccountFormGroup = this.formBuilder.group({
9894
- id: this.formBuilder.control(null),
9895
- index: this.formBuilder.control(null),
9896
- employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9897
- dateChange: this.formBuilder.control(null),
9898
- pixKeyType: this.formBuilder.control(null, Validators.required),
9899
- pixKey: this.formBuilder.control(null),
9900
- percentage: this.formBuilder.control(null, Validators.compose(__spread(this.initialValidatorOfPercentage, [
9901
- Validators.max(this.maxValuePercentage),
9902
- ]))),
9903
- externalId: this.formBuilder.control(null),
9904
- customFields: this.formBuilder.control(null),
9905
- });
9906
- };
9907
- HistoricalPixAccountFormComponent.prototype.onChangePixKeyType = function (item) {
9908
- if (item.key) {
9909
- this.pixKeyType = item.key;
9910
- this.isShowPixKeyFieldValidatorMessage = true;
9911
- this.pixAccountFormGroup.get("pixKey").reset();
9912
- this.setPixKeyValidators(true);
9913
- if (item.key === "CPF") {
9914
- this.setDefaultCpfPixKey();
9915
- }
9916
- }
9917
- };
9918
- HistoricalPixAccountFormComponent.prototype.onClearPixKeyType = function () {
9919
- this.isShowPixKeyFieldValidatorMessage = false;
9920
- this.pixAccountFormGroup.get("pixKey").reset();
9921
- };
10870
+ HistoricalPixAccountFormComponent.prototype.registerSubjects = function () { };
9922
10871
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
9923
10872
  get: function () {
9924
10873
  return this._visible;
@@ -9957,7 +10906,8 @@ var HistoricalPixAccountFormComponent = /** @class */ (function () {
9957
10906
  });
9958
10907
  HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
9959
10908
  if (this.pixKeyType === "TELEPHONE") {
9960
- this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
10909
+ var pixKeyCtrl = this.pixAccountFormGroup.get("pixKey");
10910
+ pixKeyCtrl.setValue(FormatUtilsService.getFormattedTelephoneNumber(pixKeyCtrl.value));
9961
10911
  }
9962
10912
  };
9963
10913
  HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
@@ -9969,14 +10919,14 @@ var HistoricalPixAccountFormComponent = /** @class */ (function () {
9969
10919
  this.visibleBtnSave = isEditMode;
9970
10920
  if (this.pixAccountFormGroup.get("pixKeyType").value) {
9971
10921
  this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9972
- this.setPixKeyValidators(isEditMode);
10922
+ this.setPixKeyValidators(isEditMode, this.pixAccountFormGroup);
9973
10923
  this.formatPixKeyTelephoneNumber();
9974
10924
  }
9975
10925
  configEnabledFields(this.pixAccountFormGroup, isEditMode, [
9976
10926
  "pixKeyType",
9977
10927
  "pixKey",
9978
10928
  "percentage",
9979
- "customFields",
10929
+ "customFields"
9980
10930
  ], []);
9981
10931
  };
9982
10932
  HistoricalPixAccountFormComponent.prototype.close = function () {
@@ -9984,13 +10934,11 @@ var HistoricalPixAccountFormComponent = /** @class */ (function () {
9984
10934
  this.visible = false;
9985
10935
  };
9986
10936
  HistoricalPixAccountFormComponent.prototype.addItem = function () {
9987
- this.pixAccountFormGroup.updateValueAndValidity();
9988
- verifyValidationsForm.call(this.pixAccountFormGroup);
9989
10937
  if (this.pixAccountFormGroup.valid) {
9990
10938
  if (this.employeeId) {
9991
10939
  this.pixAccountFormGroup.get("employee").setValue({
9992
10940
  tableId: this.employeeId,
9993
- name: "",
10941
+ name: ""
9994
10942
  });
9995
10943
  }
9996
10944
  this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
@@ -10022,14 +10970,10 @@ var HistoricalPixAccountFormComponent = /** @class */ (function () {
10022
10970
  return {
10023
10971
  prefix: "",
10024
10972
  thousands: this.currency.thousandsSeparator,
10025
- decimal: this.currency.decimalSeparator,
10973
+ decimal: this.currency.decimalSeparator
10026
10974
  };
10027
10975
  };
10028
10976
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "getListPixAccount", {
10029
- /**
10030
- * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
10031
- * @param pixAccountList
10032
- */
10033
10977
  set: function (pixAccountList) {
10034
10978
  if (pixAccountList) {
10035
10979
  this.setValidatorsAccordingList(pixAccountList, null, false);
@@ -10041,85 +10985,6 @@ var HistoricalPixAccountFormComponent = /** @class */ (function () {
10041
10985
  enumerable: true,
10042
10986
  configurable: true
10043
10987
  });
10044
- /**
10045
- * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
10046
- * a validação dos campos "percentage" e "pixAccount".
10047
- * 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
10048
- * no array de comparação dos validators.
10049
- * @param pixAccountList
10050
- * @param index
10051
- */
10052
- HistoricalPixAccountFormComponent.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode) {
10053
- if (index === void 0) { index = null; }
10054
- if (isEditMode === void 0) { isEditMode = true; }
10055
- this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
10056
- var percentageIncluded = [];
10057
- if (this.pixAccountList && this.pixAccountList.length) {
10058
- this.pixAccountList.filter(function (field, key) {
10059
- if (field["percentage"] && key != index) {
10060
- percentageIncluded.push(field["percentage"]);
10061
- }
10062
- });
10063
- }
10064
- this.beforeSetPixKeyTypeValidator();
10065
- this.setPixKeyValidators(isEditMode);
10066
- this.validatePercentageValid(percentageIncluded);
10067
- };
10068
- /**
10069
- * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
10070
- */
10071
- HistoricalPixAccountFormComponent.prototype.setPixKeyValidators = function (isEditMode) {
10072
- var genericPixKey = this.pixAccountFormGroup.get("pixKey");
10073
- if (this.pixKeyType) {
10074
- switch (this.pixKeyType) {
10075
- case "TELEPHONE":
10076
- genericPixKey.setValidators(Validators.compose([
10077
- Validators.required, GenericValidator.isValidPhoneNumber,
10078
- ]));
10079
- break;
10080
- case "EMAIL":
10081
- genericPixKey.setValidators(Validators.compose([
10082
- Validators.required, GenericValidator.isValidEmail,
10083
- ]));
10084
- break;
10085
- case "CPF":
10086
- genericPixKey.setValidators(Validators.compose([
10087
- Validators.required, GenericValidator.isValidCpf,
10088
- ]));
10089
- break;
10090
- case "CNPJ":
10091
- genericPixKey.setValidators(Validators.compose([
10092
- Validators.required, GenericValidator.isValidCnpj,
10093
- ]));
10094
- break;
10095
- case "RANDOM_KEY":
10096
- genericPixKey.setValidators(Validators.required);
10097
- break;
10098
- default:
10099
- genericPixKey.setValidators(null);
10100
- break;
10101
- }
10102
- if (isEditMode) {
10103
- genericPixKey.enable();
10104
- }
10105
- genericPixKey.updateValueAndValidity();
10106
- }
10107
- };
10108
- /**
10109
- * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
10110
- * 100% na validação do campo "percentage" como um novo maxValue;
10111
- * @param listValue
10112
- */
10113
- HistoricalPixAccountFormComponent.prototype.validatePercentageValid = function (listValue) {
10114
- var percentage = this.pixAccountFormGroup.get("percentage");
10115
- this.maxValuePercentage = listValue
10116
- .reduce(function (currentValue, total) { return currentValue - total; }, 100.00);
10117
- percentage
10118
- .setValidators(Validators.compose(__spread(this.initialValidatorOfPercentage, [
10119
- Validators.max(this.maxValuePercentage),
10120
- ])));
10121
- percentage.updateValueAndValidity();
10122
- };
10123
10988
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10124
10989
  set: function (condition) {
10125
10990
  this.isView = !!(condition && !this.withSideBar);
@@ -10130,58 +10995,24 @@ var HistoricalPixAccountFormComponent = /** @class */ (function () {
10130
10995
  enumerable: true,
10131
10996
  configurable: true
10132
10997
  });
10133
- HistoricalPixAccountFormComponent.prototype.phoneMask = function (event) {
10134
- FormatUtilsService.formatTelephoneInputEvent(event);
10135
- };
10136
- HistoricalPixAccountFormComponent.prototype.setDefaultCpfPixKey = function () {
10137
- if (this.defaultCpfNumber) {
10138
- this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
10139
- }
10140
- else {
10141
- var sheetDocument = this.paramsForm.get("sheetDocument");
10142
- if (sheetDocument) {
10143
- var cpf = sheetDocument.get("cpfNumber").value;
10144
- if (cpf) {
10145
- this.pixAccountFormGroup.get("pixKey").setValue(cpf);
10146
- }
10147
- }
10148
- }
10149
- };
10150
- HistoricalPixAccountFormComponent.prototype.beforeSetPixKeyTypeValidator = function () {
10151
- var pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
10152
- if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
10153
- pixKeyType
10154
- .setValidators(Validators.compose([
10155
- Validators.required,
10156
- this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
10157
- ]));
10158
- }
10159
- else {
10160
- pixKeyType.setValidators(Validators.required);
10161
- }
10162
- };
10163
- HistoricalPixAccountFormComponent.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
10164
- return function (control) {
10165
- var value = control && control.value;
10166
- var condition = false;
10167
- listCompare.filter(function (field) {
10168
- if (value) {
10169
- if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
10170
- return condition = true;
10171
- }
10172
- }
10173
- });
10174
- if (condition) {
10175
- return { pixKeyTypeBankAccountDuplicate: true };
10176
- }
10177
- else {
10178
- return null;
10179
- }
10180
- };
10181
- };
10998
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "paramsForm", {
10999
+ set: function (value) {
11000
+ this._paramsForm = value;
11001
+ },
11002
+ enumerable: true,
11003
+ configurable: true
11004
+ });
11005
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", {
11006
+ set: function (value) {
11007
+ this._defaultCpfNumber = value;
11008
+ },
11009
+ enumerable: true,
11010
+ configurable: true
11011
+ });
10182
11012
  HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10183
11013
  { type: FormBuilder },
10184
- { type: ChangeDetectorRef }
11014
+ { type: ChangeDetectorRef },
11015
+ { type: SharedStateService }
10185
11016
  ]; };
10186
11017
  __decorate([
10187
11018
  ViewChild(CustomFieldsComponent$1, { static: true })
@@ -10203,10 +11034,7 @@ var HistoricalPixAccountFormComponent = /** @class */ (function () {
10203
11034
  ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
10204
11035
  __decorate([
10205
11036
  Input()
10206
- ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
10207
- __decorate([
10208
- Input()
10209
- ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
11037
+ ], HistoricalPixAccountFormComponent.prototype, "showField", void 0);
10210
11038
  __decorate([
10211
11039
  Output()
10212
11040
  ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
@@ -10225,32 +11053,21 @@ var HistoricalPixAccountFormComponent = /** @class */ (function () {
10225
11053
  __decorate([
10226
11054
  Input()
10227
11055
  ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
11056
+ __decorate([
11057
+ Input()
11058
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", null);
11059
+ __decorate([
11060
+ Input()
11061
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", null);
10228
11062
  HistoricalPixAccountFormComponent = __decorate([
10229
11063
  Component({
10230
11064
  selector: "pix-account",
10231
- 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",
10232
- 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}"]
11065
+ template: "<div id=\"main\">\n <form *ngIf=\"showField || !(hideFields | async)\" [formGroup]=\"pixAccountFormGroup\" autocomplete=\"off\">\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <!-- Tipo de chave -->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label>{{'hcm.payroll.employees_addition_pix_key_type'|translate}}</label>\n <input-rest-auto-complete-enum [dropdown]=\"true\" server=\"payroll\"\n enumeration=\"PixKeyType\"\n placeholder=\"{{'hcm.payroll.select' | translate}}\"\n name=\"pixKeyType\" [form]=\"pixAccountFormGroup\"\n (onSelect)=\"onChangePixKeyType($event)\"\n (onClear)=\"onClearPixKeyType()\"\n id=\"ta-pixKeyType\"></input-rest-auto-complete-enum>\n <s-control-errors [control]=\"pixAccountFormGroup.get('pixKeyType')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n pixKeyTypeBankAccountDuplicate: 'hcm.payroll.historical_pix_key_type_bank_account_duplicate' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Chave Pix-->\n <div class=\"ui-md-6 ui-sm-12\" [ngClass]=\"{'required': pixKeyType !== 'BANK_ACCOUNT'}\">\n <label>{{'hcm.payroll.employees_addition_pix_key' | translate}}</label>\n <ng-container [ngSwitch]=\"pixKeyType\">\n <input *ngSwitchCase=\"'TELEPHONE'\" only-number\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n (keyup)=\"phoneMask($event)\" maxlength=\"15\"\n placeholder=\"(__) ____-____\">\n <p-inputMask *ngSwitchCase=\"'CPF'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"___.___.___-__\"\n mask=\"999.999.999-99\" [unmask]=\"true\"></p-inputMask>\n <p-inputMask *ngSwitchCase=\"'CNPJ'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"__.___.___/____-__\"\n mask=\"99.999.999/9999-99\" [unmask]=\"true\"></p-inputMask>\n <input *ngSwitchCase=\"'EMAIL'\"\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"{{'hcm.payroll.employees_addition_email'|translate}}\"/>\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\" disabled\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"/>\n <input *ngSwitchDefault\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\" maxlength=\"100\" />\n </ng-container>\n <s-control-errors *ngIf=\"isShowPixKeyFieldValidatorMessage\" id=\"er-pix-key\"\n [control]=\"pixAccountFormGroup.get('pixKey')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n invalidPhoneNumber: 'hcm.payroll.employees_addition_invalid_phone_number' | translate: { value: pixAccountFormGroup.get('pixKey').value },\n invalidEmail: 'hcm.payroll.employees_addition_email_invalid' | translate,\n cpfNotValid: 'hcm.payroll.employees_addition_cpf_error' | translate,\n cnpjNotValid: 'hcm.payroll.employees_addition_cnpj_error' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Percentual-->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label id=\"lb-percentage\"\n for=\"ff-percentage\">{{ 'hcm.payroll.historical_bank_account_label_percentage' | translate }}</label>\n <div class=\"ui-inputgroup\">\n <span class=\"ui-inputgroup-addon\">%</span>\n <input pInputText id=\"ff-percentage\" name=\"percentage\"\n formControlName=\"percentage\"\n currencyMask\n [options]=\"optionsPercentage\"\n [placeholder]=\"percentagePlaceholder\"/>\n </div>\n <s-control-errors [control]=\"pixAccountFormGroup.get('percentage')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n maxlength: 'hcm.payroll.error_max_length' | translate: { value: '6' },\n max: 'hcm.payroll.error_max_value_number' | translate: { value: maxValuePercentage },\n min: 'hcm.payroll.error_min_value_number' | translate: { value: '0,01' }\n }\">\n </s-control-errors>\n </div>\n <div class=\"ui-g-12\">\n <p-fieldset\n legend=\"{{ 'hcm.payroll.custom_fields' | translate }}\"\n [attr.data-hidden]=\"!customFields || !customFields.fields.length\"\n >\n <s-custom-fields\n domain=\"hcm\"\n service=\"{{customService}}\"\n entity=\"{{customEntity}}\"\n formControlName=\"customFields\"\n [invalidErrorLabel]=\"'hcm.payroll.employees_invalid_field' | translate\"\n >\n </s-custom-fields>\n </p-fieldset>\n </div>\n </div>\n </div>\n </form>\n\n <div [ngClass]=\"withSideBar ? 'footer' : 'footer-s-border'\">\n <div class=\"form-group\">\n <s-button id=\"btn-save\" label=\"{{ labelBtnAdd | translate}}\" priority=\"primary\"\n (onClick)=\"addItem()\" *ngIf=\"visibleBtnSave && !this.isView\"></s-button>\n <s-button *ngIf=\"withSideBar\" id=\"btn-close\" label=\"{{'hcm.payroll.cancel'|translate}}\" priority=\"secondary\"\n priority=\"link\" (onClick)=\"close()\"></s-button>\n </div>\n </div>\n</div>\n",
11066
+ styles: [".refresh{width:100%!important}#table-annuity .col-default-s{width:10%}#table-annuity .col-default-m{width:12%}#table-annuity .col-default-l{width:16%}#table-annuity .col-action{width:10%}#table-annuity .icon-warning{text-align:center!important;color:#ff6d00c7!important}@media screen and (max-width:612px){#table-annuity .col-default-1,#table-annuity .col-default-2{width:16%}#table-annuity .col-default-3{width:26%}#table-annuity .col-icon{width:10%}#table-annuity .col-action{width:27%}}#main{display:-webkit-box;display:flex;height:100%;width:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}#main form{height:100%}#main .footer{border-top:1px solid #ccc;padding-top:15px;margin-top:15px;flex-shrink:0;margin-bottom:-18px}#main .footer-s-border{padding-left:7px;flex-shrink:0;margin-bottom:-18px}:host ::ng-deep .p-cell-editing{padding:0!important}:host ::ng-deep .full-width-input{width:100%!important;min-height:34px!important;padding:6px 12px!important}:host ::ng-deep .p-inputtext{width:100%;min-height:34px;padding:6px 12px}:host ::ng-deep .p-inputmask{width:100%;display:block}:host ::ng-deep .p-inputmask .p-inputmask-input{width:100%!important;min-height:34px!important;padding:6px 12px!important}:host ::ng-deep p-celleditor{width:100%}:host ::ng-deep p-celleditor .ui-fluid{width:100%;display:block;padding:0}:host ::ng-deep .p-error{margin-top:4px;font-size:12px}:host ::ng-deep .error-text{color:#f44336;display:block;margin-top:4px;font-size:.875em}"]
10233
11067
  })
10234
11068
  ], HistoricalPixAccountFormComponent);
10235
11069
  return HistoricalPixAccountFormComponent;
10236
- }());
10237
-
10238
- var HistoricalPixAccountService = /** @class */ (function () {
10239
- function HistoricalPixAccountService(http) {
10240
- this.http = http;
10241
- }
10242
- HistoricalPixAccountService.prototype.query = function (path, body, service) {
10243
- if (service === void 0) { service = ServiceType.PAYROLL; }
10244
- return this.http.query(path, body, service);
10245
- };
10246
- HistoricalPixAccountService.ctorParameters = function () { return [
10247
- { type: HttpClientService }
10248
- ]; };
10249
- HistoricalPixAccountService = __decorate([
10250
- Injectable()
10251
- ], HistoricalPixAccountService);
10252
- return HistoricalPixAccountService;
10253
- }());
11070
+ }(HistoricakPixAccountBase));
10254
11071
 
10255
11072
  var HistoricalPixAccountModule = /** @class */ (function () {
10256
11073
  function HistoricalPixAccountModule() {
@@ -10280,6 +11097,8 @@ var HistoricalPixAccountModule = /** @class */ (function () {
10280
11097
  CustomFieldsModule$1,
10281
11098
  PanelModule,
10282
11099
  InputMaskModule,
11100
+ DropdownModule,
11101
+ TabViewModule,
10283
11102
  ],
10284
11103
  declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
10285
11104
  providers: [HistoricalPixAccountService, ConfirmationService],
@@ -10322,7 +11141,7 @@ var HistoricalPixAccountListService = /** @class */ (function () {
10322
11141
 
10323
11142
  var moment$e = moment_;
10324
11143
  var HistoricalPixAccountListComponent = /** @class */ (function () {
10325
- function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService) {
11144
+ function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService, sharedStateService) {
10326
11145
  this.confirmationService = confirmationService;
10327
11146
  this.translateService = translateService;
10328
11147
  this.activatedRoute = activatedRoute;
@@ -10330,11 +11149,17 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10330
11149
  this.router = router;
10331
11150
  this.messageService = messageService;
10332
11151
  this.historicalPixAccountListService = historicalPixAccountListService;
11152
+ this.sharedStateService = sharedStateService;
10333
11153
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
10334
11154
  this.keyPayload = "historicalEmployeePix";
10335
11155
  this.withSidebar = true;
11156
+ this.showActionsButtonOnAdd = false;
10336
11157
  this.isOnlyView = new EventEmitter();
11158
+ this.isOnlyEdit = new EventEmitter();
10337
11159
  this.enableView = new EventEmitter();
11160
+ this.isEditJudicialDependentPix = new EventEmitter();
11161
+ this.isHideBtnAddForViewMode = new EventEmitter();
11162
+ this.isShowActionsButton = new EventEmitter();
10338
11163
  this.ngUnsubscribe = new Subject();
10339
11164
  this.loading = true;
10340
11165
  this.columns = [
@@ -10342,18 +11167,6 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10342
11167
  label: this.translateService.instant("hcm.payroll.historical_pix_account_label_date_change"),
10343
11168
  field: "dateChange",
10344
11169
  },
10345
- {
10346
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_pix_key_type"),
10347
- field: "pixKeyType.value",
10348
- },
10349
- {
10350
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_pix_key"),
10351
- field: "pixKey",
10352
- },
10353
- {
10354
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
10355
- field: "percentage",
10356
- },
10357
11170
  {
10358
11171
  label: this.translateService.instant("hcm.payroll.employees_movimentation_historical_pix_account_label_qtd_account"),
10359
11172
  field: "numberOfPixAccount",
@@ -10366,6 +11179,7 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10366
11179
  HistoricalPixAccountListComponent.prototype.ngOnDestroy = function () {
10367
11180
  this.ngUnsubscribe.next();
10368
11181
  this.ngUnsubscribe.complete();
11182
+ this.unsubscribe();
10369
11183
  };
10370
11184
  HistoricalPixAccountListComponent.prototype.ngAfterViewInit = function () {
10371
11185
  this.cd.detectChanges();
@@ -10374,27 +11188,10 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10374
11188
  var _this = this;
10375
11189
  payload.forEach(function (value) {
10376
11190
  value.dateChange = moment$e(value.dateChange).format(_this.dateFormat);
10377
- value.pixKey = _this.formatPixKeyByType(value.pixKeyType, value.pixKey);
10378
- value.percentage = FormatUtilsService.getFormattedPercentage(value.percentage);
10379
11191
  });
10380
11192
  this.onGridLoad(payload);
10381
11193
  this.loading = false;
10382
11194
  };
10383
- HistoricalPixAccountListComponent.prototype.formatPixKeyByType = function (pixKeyType, pixKey) {
10384
- var keyType = pixKeyType ? pixKeyType.key.toUpperCase() : "";
10385
- if (keyType === "TELEPHONE") {
10386
- return FormatUtilsService.getFormattedTelephoneNumber(pixKey);
10387
- }
10388
- else if (keyType === "CPF") {
10389
- return FormatUtilsService.getFormattedCpf(pixKey);
10390
- }
10391
- else if (keyType === "CNPJ") {
10392
- return FormatUtilsService.getFormattedCnpj(pixKey);
10393
- }
10394
- else {
10395
- return pixKey;
10396
- }
10397
- };
10398
11195
  HistoricalPixAccountListComponent.prototype.getMenuActions = function (rowData) {
10399
11196
  var _this = this;
10400
11197
  return [
@@ -10402,14 +11199,55 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10402
11199
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
10403
11200
  command: function () {
10404
11201
  if (_this.isAllowToViewHistorical) {
11202
+ _this.sharedStateService.setHideField(true);
11203
+ _this.isShowActionsButton.emit(false);
11204
+ _this.sharedStateService.setShowEditMode(false);
10405
11205
  var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
10406
11206
  if (_this.withSidebar) {
10407
11207
  _this.isOnlyView.emit(true);
11208
+ _this.isOnlyEdit.emit(false);
11209
+ _this.isHideBtnAddForViewMode.emit(true);
11210
+ _this.sharedStateService.setHideBtnAddForViewMode(true);
11211
+ _this.sharedStateService.setActiveHideOptionsOnView(true);
11212
+ _this.router.navigate(["historical-pix-account/" + dateChange], {
11213
+ relativeTo: _this.activatedRoute,
11214
+ });
11215
+ }
11216
+ else {
11217
+ _this.sharedStateService.setActiveHideOptionsOnView(true);
11218
+ _this.sharedStateService.setSaveButton(false);
11219
+ _this.enableView.emit(dateChange);
11220
+ }
11221
+ }
11222
+ else {
11223
+ _this.isNotAllowMessage();
11224
+ }
11225
+ },
11226
+ },
11227
+ {
11228
+ label: this.translateService.instant("hcm.payroll.edit"),
11229
+ command: function () {
11230
+ if (_this.isAllowToEditHistorical) {
11231
+ _this.sharedStateService.setHideField(true);
11232
+ _this.isShowActionsButton.emit(true);
11233
+ _this.sharedStateService.setShowEditMode(true);
11234
+ var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
11235
+ if (_this.withSidebar) {
11236
+ _this.isOnlyView.emit(false);
11237
+ _this.isOnlyEdit.emit(true);
11238
+ _this.isHideBtnAddForViewMode.emit(false);
11239
+ _this.sharedStateService.setHideBtnAddForViewMode(false);
11240
+ _this.sharedStateService.setActiveHideOptionsOnView(false);
10408
11241
  _this.router.navigate(["historical-pix-account/" + dateChange], {
10409
11242
  relativeTo: _this.activatedRoute,
10410
11243
  });
10411
11244
  }
10412
11245
  else {
11246
+ _this.sharedStateService.setActiveHideOptionsOnView(false);
11247
+ setTimeout(function () {
11248
+ _this.sharedStateService.triggerActiveValidatorsOnEditModalOpen();
11249
+ });
11250
+ _this.sharedStateService.setSaveButton(true);
10413
11251
  _this.enableView.emit(dateChange);
10414
11252
  }
10415
11253
  }
@@ -10428,7 +11266,7 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10428
11266
  _this.isNotAllowMessage();
10429
11267
  }
10430
11268
  },
10431
- },
11269
+ }
10432
11270
  ];
10433
11271
  };
10434
11272
  HistoricalPixAccountListComponent.prototype.delete = function (id, dateChange) {
@@ -10495,6 +11333,24 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10495
11333
  this.lastRecord = payload[0];
10496
11334
  }
10497
11335
  };
11336
+ HistoricalPixAccountListComponent.prototype.unsubscribe = function () {
11337
+ if (this._subscription) {
11338
+ this._subscription.unsubscribe();
11339
+ }
11340
+ };
11341
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", {
11342
+ set: function (subject) {
11343
+ var _this = this;
11344
+ this.unsubscribe();
11345
+ if (subject) {
11346
+ this._subscription = subject.subscribe(function (value) {
11347
+ _this.sharedStateService.setHideField(value);
11348
+ });
11349
+ }
11350
+ },
11351
+ enumerable: true,
11352
+ configurable: true
11353
+ });
10498
11354
  Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToAddHistorical", {
10499
11355
  get: function () {
10500
11356
  return (this.permission["incluir"]);
@@ -10516,6 +11372,13 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10516
11372
  enumerable: true,
10517
11373
  configurable: true
10518
11374
  });
11375
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToEditHistorical", {
11376
+ get: function () {
11377
+ return (this.permission["editar"]);
11378
+ },
11379
+ enumerable: true,
11380
+ configurable: true
11381
+ });
10519
11382
  Object.defineProperty(HistoricalPixAccountListComponent.prototype, "scopedActions", {
10520
11383
  get: function () {
10521
11384
  return this.getMenuActions.bind(this);
@@ -10540,7 +11403,8 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10540
11403
  { type: ChangeDetectorRef },
10541
11404
  { type: Router },
10542
11405
  { type: MessageService },
10543
- { type: HistoricalPixAccountListService }
11406
+ { type: HistoricalPixAccountListService },
11407
+ { type: SharedStateService }
10544
11408
  ]; };
10545
11409
  __decorate([
10546
11410
  ViewChild(CustomFieldsComponent$1, { static: false })
@@ -10566,12 +11430,33 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10566
11430
  __decorate([
10567
11431
  Input()
10568
11432
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
11433
+ __decorate([
11434
+ Input()
11435
+ ], HistoricalPixAccountListComponent.prototype, "hideField", void 0);
11436
+ __decorate([
11437
+ Input()
11438
+ ], HistoricalPixAccountListComponent.prototype, "showActionsButtonOnAdd", void 0);
10569
11439
  __decorate([
10570
11440
  Output()
10571
11441
  ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
11442
+ __decorate([
11443
+ Output()
11444
+ ], HistoricalPixAccountListComponent.prototype, "isOnlyEdit", void 0);
10572
11445
  __decorate([
10573
11446
  Output()
10574
11447
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
11448
+ __decorate([
11449
+ Output()
11450
+ ], HistoricalPixAccountListComponent.prototype, "isEditJudicialDependentPix", void 0);
11451
+ __decorate([
11452
+ Output()
11453
+ ], HistoricalPixAccountListComponent.prototype, "isHideBtnAddForViewMode", void 0);
11454
+ __decorate([
11455
+ Output()
11456
+ ], HistoricalPixAccountListComponent.prototype, "isShowActionsButton", void 0);
11457
+ __decorate([
11458
+ Input()
11459
+ ], HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", null);
10575
11460
  __decorate([
10576
11461
  Input()
10577
11462
  ], HistoricalPixAccountListComponent.prototype, "reloadList", null);
@@ -10621,5 +11506,5 @@ var HistoricalPixAccountListModule = /** @class */ (function () {
10621
11506
  * Generated bundle index. Do not edit.
10622
11507
  */
10623
11508
 
10624
- export { AdmissionDraftSummaryComponent, AdmissionDraftSummaryModule, AdmissionDraftSummaryService, AutocompleteParametersService, BlockUiComponent, BlockUiModule, BreadcrumbComponent, BreadcrumbSDSModule, CNPJValidator, CPFValidator, CompanyIndicationType, CompanyIndicationsService, CompareType, ControlMessagesErrorComponent, ControlMessagesErrorModule, CoreDirectives, CoreFieldType, CustomFieldsComponent, CustomFieldsModule, DataListModule, DataListRestModule, DateValidator, DirectionEnumeration, EmployeeSelectorComponent, EmployeeSelectorModule, EmployeeSummaryComponent, EmployeeSummaryModule, EmployeeSummaryService, EntityODataParameter, ErrorPageComponent, ErrorPageModule, FieldValidatorComponent, FieldValidatorModule, FileUploadComponent, FileUploadCoreModule, FormComparatorService, FromToComponent, FromToModule, HistoricalBankAccountComponent, HistoricalBankAccountListComponent, HistoricalBankAccountListModule, HistoricalBankAccountListService, HistoricalBankAccountModule, HistoricalBankAccountService, HistoricalPixAccountComponent, HistoricalPixAccountListComponent, HistoricalPixAccountListModule, HistoricalPixAccountListService, HistoricalPixAccountModule, HistoricalPixAccountService, HttpClientService, HttpRequestType, ImageCropComponent, ImageCropModule, ImageCropService, InputDateComponent, InputDateModelComponent, InputDateModelModule, InputDateModule, InputRestAutoCompleteComponent, InputRestAutoCompleteEmployeeModelModule, InputRestAutoCompleteEmployeeModelService, InputRestAutoCompleteEmployeeModule, InputRestAutoCompleteEmployeeService, InputRestAutoCompleteEnumComponent, InputRestAutoCompleteEnumModule, InputRestAutoCompleteEnumService, InputRestAutoCompleteJobpositionComponent, InputRestAutoCompleteJobpositionModule, InputRestAutoCompleteJobpositionService, InputRestAutoCompleteModelEnumModule, InputRestAutoCompleteModelEnumService, InputRestAutoCompleteModelModule, InputRestAutoCompleteModelService, InputRestAutoCompleteModule, InputRestAutoCompleteService, IntegrationService, ListRestComponent, ListRestModule, LookupModule, LookupParametersService, MenuType, ModuleType, NameNotSpacesDirective, OnlyNumberDirective, Operators, ParameterType, PermissionService, ReportFormat, ReportService, ReportStage, ServiceType, ServicesModule, SpinnerLoaderComponent, SpinnerLoaderModule, StringMethods, ToastComponent, ToastModule, ToastService, TypeAdmissionModule, TypeAdmissionServices, UsingType, WorkflowDataService, WorkflowIntegrator, WorkstationgroupLookupDto, WorkstationgroupLookupModule, _moment, assign, autoCompleteObjectForIdObject, clearValues, cnpjValidator, compareValues, configEnabledFields, containsMoreThanOneConsecutiveAbbreviation, containsMoreThanOneConsecutiveBlankSpace, containsMoreThanTwoRepeatedCharacters, containsSpecialCharacters, convertBooleanString, convertStringToBoolean, cpfValidator, firstNameIsValid, firstNameLengthIsValid, formatMoney, fullNameLengthIsValid, getAddWeekDaysBusiness, getFormat, getFormatDate, getMoment, getNowDate, getObjValids, getQueryParams, getWeekDaysBusiness, getYears, invertFieldDate, isBirthDayValid, isDateCompare, isDateExpirationBeforeExpeditionDate, isDateField, isDateSameOrAfterCurrentDate, isFullDate, isMax, isNumber, isObject, isRequired, isShallow, isValid, isValidDate, isValidPIS, mountCustomForSave, mountCustomForShow, mountCustomToSave, mountCustomToShow, mountGeneratedCustomToSave, ngCalendarFormat, notEmpty, numberOrZero, removeCharacteresSpecials, removeEmpty, removeWhiteSpaces, setCustonFields, setDisableField, setErrors, setRequired, setRequiredFields, setValidator, setValidatorsAndDisableFields, setValueCustom, stringMethods, sun, uiid, validateBirthDate, verifyValidationsForm, SharedModule as ɵa, DataListRestComponent as ɵb, DataListRestService as ɵc, FileUploadService as ɵd, InputRestAutoCompleteEmployeeComponent as ɵe, InputRestAutoCompleteEmployeeModelComponent as ɵf, InputRestAutoCompleteModelComponent as ɵg, InputRestAutoCompleteModelEnumComponent as ɵh, ListRestService as ɵi, DataListComponent as ɵj, DataListService as ɵk, LookupComponent as ɵl, LookupService as ɵm, WorkstationgroupLookupComponent as ɵn, AutocompleteService as ɵo, LookupService$1 as ɵp, HistoricalBankAccountFormComponent as ɵq, HistoricalPixAccountFormComponent as ɵr };
11509
+ export { AdmissionDraftSummaryComponent, AdmissionDraftSummaryModule, AdmissionDraftSummaryService, AutocompleteParametersService, BlockUiComponent, BlockUiModule, BreadcrumbComponent, BreadcrumbSDSModule, CNPJValidator, CPFValidator, CompanyIndicationType, CompanyIndicationsService, CompareType, ControlMessagesErrorComponent, ControlMessagesErrorModule, CoreDirectives, CoreFieldType, CustomFieldsComponent, CustomFieldsModule, DataListModule, DataListRestModule, DateValidator, DirectionEnumeration, EmployeeSelectorComponent, EmployeeSelectorModule, EmployeeSummaryComponent, EmployeeSummaryModule, EmployeeSummaryService, EntityODataParameter, ErrorPageComponent, ErrorPageModule, FieldValidatorComponent, FieldValidatorModule, FileUploadComponent, FileUploadCoreModule, FormComparatorService, FromToComponent, FromToModule, HistoricalBankAccountComponent, HistoricalBankAccountListComponent, HistoricalBankAccountListModule, HistoricalBankAccountListService, HistoricalBankAccountModule, HistoricalBankAccountService, HistoricalPixAccountComponent, HistoricalPixAccountListComponent, HistoricalPixAccountListModule, HistoricalPixAccountListService, HistoricalPixAccountModule, HistoricalPixAccountService, HttpClientService, HttpRequestType, ImageCropComponent, ImageCropModule, ImageCropService, InputDateComponent, InputDateModelComponent, InputDateModelModule, InputDateModule, InputRestAutoCompleteComponent, InputRestAutoCompleteEmployeeModelModule, InputRestAutoCompleteEmployeeModelService, InputRestAutoCompleteEmployeeModule, InputRestAutoCompleteEmployeeService, InputRestAutoCompleteEnumComponent, InputRestAutoCompleteEnumModule, InputRestAutoCompleteEnumService, InputRestAutoCompleteJobpositionComponent, InputRestAutoCompleteJobpositionModule, InputRestAutoCompleteJobpositionService, InputRestAutoCompleteModelEnumModule, InputRestAutoCompleteModelEnumService, InputRestAutoCompleteModelModule, InputRestAutoCompleteModelService, InputRestAutoCompleteModule, InputRestAutoCompleteService, IntegrationService, ListRestComponent, ListRestModule, LookupModule, LookupParametersService, MenuType, ModuleType, NameNotSpacesDirective, OnlyNumberDirective, Operators, ParameterType, PermissionService, ReportFormat, ReportService, ReportStage, ServiceType, ServicesModule, SharedStateService, SpinnerLoaderComponent, SpinnerLoaderModule, StringMethods, ToastComponent, ToastModule, ToastService, TypeAdmissionModule, TypeAdmissionServices, UsingType, WorkflowDataService, WorkflowIntegrator, WorkstationgroupLookupDto, WorkstationgroupLookupModule, _moment, assign, autoCompleteObjectForIdObject, clearValues, cnpjValidator, compareValues, configEnabledFields, containsMoreThanOneConsecutiveAbbreviation, containsMoreThanOneConsecutiveBlankSpace, containsMoreThanTwoRepeatedCharacters, containsSpecialCharacters, convertBooleanString, convertStringToBoolean, cpfValidator, firstNameIsValid, firstNameLengthIsValid, formatMoney, fullNameLengthIsValid, getAddWeekDaysBusiness, getFormat, getFormatDate, getMoment, getNowDate, getObjValids, getQueryParams, getWeekDaysBusiness, getYears, invertFieldDate, isBirthDayValid, isDateCompare, isDateExpirationBeforeExpeditionDate, isDateField, isDateSameOrAfterCurrentDate, isFullDate, isMax, isNumber, isObject, isRequired, isShallow, isValid, isValidDate, isValidPIS, mountCustomForSave, mountCustomForShow, mountCustomToSave, mountCustomToShow, mountGeneratedCustomToSave, ngCalendarFormat, notEmpty, numberOrZero, removeCharacteresSpecials, removeEmpty, removeWhiteSpaces, setCustonFields, setDisableField, setErrors, setRequired, setRequiredFields, setValidator, setValidatorsAndDisableFields, setValueCustom, stringMethods, sun, uiid, validateBirthDate, verifyValidationsForm, SharedModule as ɵa, DataListRestComponent as ɵb, DataListRestService as ɵc, FileUploadService as ɵd, InputRestAutoCompleteEmployeeComponent as ɵe, InputRestAutoCompleteEmployeeModelComponent as ɵf, InputRestAutoCompleteModelComponent as ɵg, InputRestAutoCompleteModelEnumComponent as ɵh, ListRestService as ɵi, DataListComponent as ɵj, DataListService as ɵk, LookupComponent as ɵl, LookupService as ɵm, WorkstationgroupLookupComponent as ɵn, AutocompleteService as ɵo, LookupService$1 as ɵp, HistoricalBankAccountFormComponent as ɵq, HistoricakPixAccountBase as ɵr, HistoricalPixAccountFormComponent as ɵs };
10625
11510
  //# sourceMappingURL=senior-gestao-pessoas-payroll-core.js.map