@senior-gestao-pessoas/payroll-core 9.5.0-fbdcba79-4ef6-4255-9628-f5e2e790112a → 9.5.0-feature-hcmgdp-11492-f438f1e4

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 (42) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +444 -881
  2. package/bundles/senior-gestao-pessoas-payroll-core.umd.js.map +1 -1
  3. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js +1 -16
  4. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js.map +1 -1
  5. package/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.d.ts +43 -10
  6. package/components/historical-pix-account/historical-pix-account.component.d.ts +13 -41
  7. package/components/historical-pix-account/historical-pix-account.service.d.ts +0 -1
  8. package/components/historical-pix-account-list/historical-pix-account-list.component.d.ts +2 -9
  9. package/components/utils/format-utils/format-utils.service.d.ts +3 -30
  10. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +205 -34
  11. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +43 -264
  12. package/esm2015/components/historical-pix-account/historical-pix-account.module.js +1 -5
  13. package/esm2015/components/historical-pix-account/historical-pix-account.service.js +1 -8
  14. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.component.js +6 -44
  15. package/esm2015/components/utils/format-utils/format-utils.service.js +5 -88
  16. package/esm2015/public_api.js +1 -2
  17. package/esm2015/senior-gestao-pessoas-payroll-core.js +2 -3
  18. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +220 -58
  19. package/esm5/components/historical-pix-account/historical-pix-account.component.js +72 -306
  20. package/esm5/components/historical-pix-account/historical-pix-account.module.js +1 -5
  21. package/esm5/components/historical-pix-account/historical-pix-account.service.js +1 -8
  22. package/esm5/components/historical-pix-account-list/historical-pix-account-list.component.js +6 -49
  23. package/esm5/components/utils/format-utils/format-utils.service.js +5 -88
  24. package/esm5/public_api.js +1 -2
  25. package/esm5/senior-gestao-pessoas-payroll-core.js +2 -3
  26. package/fesm2015/senior-gestao-pessoas-payroll-core.js +388 -785
  27. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  28. package/fesm5/senior-gestao-pessoas-payroll-core.js +441 -877
  29. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  30. package/package.json +1 -1
  31. package/public_api.d.ts +0 -1
  32. package/senior-gestao-pessoas-payroll-core.d.ts +1 -2
  33. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
  34. package/components/historical-pix-account/historical-pix-account-base.d.ts +0 -27
  35. package/components/shared/index.d.ts +0 -1
  36. package/components/shared/shared-state.service.d.ts +0 -24
  37. package/esm2015/components/historical-pix-account/historical-pix-account-base.js +0 -173
  38. package/esm2015/components/shared/index.js +0 -2
  39. package/esm2015/components/shared/shared-state.service.js +0 -54
  40. package/esm5/components/historical-pix-account/historical-pix-account-base.js +0 -186
  41. package/esm5/components/shared/index.js +0 -2
  42. package/esm5/components/shared/shared-state.service.js +0 -55
@@ -36,7 +36,6 @@ 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';
40
39
 
41
40
  /**
42
41
  * Created by Bruno.Curioletti on 30/05/2017.
@@ -8441,25 +8440,6 @@ class FormatUtilsService {
8441
8440
  }
8442
8441
  return null;
8443
8442
  }
8444
- /**
8445
- * Retorna o CPF formatado
8446
- * @param cpf CPF
8447
- */
8448
- static getFormattedCpfEdited(cpf) {
8449
- if (!cpf)
8450
- return '';
8451
- cpf = cpf.replace(/\D/g, '').slice(0, 11);
8452
- if (cpf.length > 9) {
8453
- cpf = cpf.replace(/^(\d{3})(\d{3})(\d{3})(\d{2})$/, "$1.$2.$3-$4");
8454
- }
8455
- else if (cpf.length > 6) {
8456
- cpf = cpf.replace(/^(\d{3})(\d{3})(\d{0,3})$/, "$1.$2.$3");
8457
- }
8458
- else if (cpf.length > 3) {
8459
- cpf = cpf.replace(/^(\d{3})(\d{0,3})$/, "$1.$2");
8460
- }
8461
- return cpf;
8462
- }
8463
8443
  /**
8464
8444
  * Retorna o CNPJ formatado
8465
8445
  * @param cnpj CNPJ
@@ -8475,28 +8455,6 @@ class FormatUtilsService {
8475
8455
  }
8476
8456
  return null;
8477
8457
  }
8478
- /**
8479
- * Retorna o CNPJ formatado
8480
- * @param cnpj CNPJ
8481
- */
8482
- static getFormattedCnpjEdited(cnpj) {
8483
- if (!cnpj)
8484
- return '';
8485
- cnpj = cnpj.replace(/\D/g, '').slice(0, 14);
8486
- if (cnpj.length > 12) {
8487
- cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5");
8488
- }
8489
- else if (cnpj.length > 8) {
8490
- cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{3})(\d{0,4})$/, "$1.$2.$3/$4");
8491
- }
8492
- else if (cnpj.length > 5) {
8493
- cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{0,3})$/, "$1.$2.$3");
8494
- }
8495
- else if (cnpj.length > 2) {
8496
- cnpj = cnpj.replace(/^(\d{2})(\d{0,3})$/, "$1.$2");
8497
- }
8498
- return cnpj;
8499
- }
8500
8458
  /**
8501
8459
  * Retorna a mascara do CPF/CNPJ
8502
8460
  * @param key Valores possíveis são CPF ou CNPJ
@@ -8511,24 +8469,6 @@ class FormatUtilsService {
8511
8469
  return "";
8512
8470
  }
8513
8471
  }
8514
- /**
8515
- * Método para formatar o número de inscrição do cliente.
8516
- * @param subscriptionNumber
8517
- * @param pixKeyType
8518
- * @returns
8519
- */
8520
- static getFormattedSubscriptionNumber(subscriptionNumber, pixKeyType) {
8521
- if (!subscriptionNumber || !pixKeyType)
8522
- return subscriptionNumber;
8523
- switch (pixKeyType) {
8524
- case 'CNPJ':
8525
- return this.getFormattedCnpjEdited(subscriptionNumber);
8526
- case 'CPF':
8527
- return this.getFormattedCpfEdited(subscriptionNumber);
8528
- default:
8529
- return subscriptionNumber;
8530
- }
8531
- }
8532
8472
  /**
8533
8473
  * Metódo para formatar o número de telefone.
8534
8474
  * @param telephoneNumber String contendo o número de telefone.
@@ -8560,13 +8500,6 @@ class FormatUtilsService {
8560
8500
  }
8561
8501
  return tel;
8562
8502
  }
8563
- /**
8564
- * Metódo para formatar a porcentagem para 2 casas decimais.
8565
- * @param value Número a ser formatado.
8566
- */
8567
- static getFormattedPercentage(value) {
8568
- return parseFloat(value).toFixed(2).replace('.', ',') + '%';
8569
- }
8570
8503
  /**
8571
8504
  * Metódo para formatar o número de telefone de um campo Input.
8572
8505
  * @param event Evento do Input do campo de telefone.
@@ -8580,80 +8513,14 @@ class FormatUtilsService {
8580
8513
  event.target.value = FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
8581
8514
  }
8582
8515
  /**
8583
- * Formata o campo de input de CPF em tempo real.
8584
- * @param event Evento do input
8585
- */
8586
- static formatCpfInputEvent(event) {
8587
- let cpf = event.target.value;
8588
- // Permite apagar nos pontos sensíveis
8589
- if (event.keyCode === 8 && (cpf.length === 4 || cpf.length === 8 || cpf.length === 12)) {
8590
- return;
8591
- }
8592
- event.target.value = FormatUtilsService.getFormattedCpfEdited(cpf);
8593
- }
8594
- /**
8595
- * Formata o campo de input de CNPJ em tempo real.
8596
- * @param event Evento do input
8516
+ * Metódo para formatar a porcentagem para 2 casas decimais.
8517
+ * @param value Número a ser formatado.
8597
8518
  */
8598
- static formatCnpjInputEvent(event) {
8599
- let cnpj = event.target.value;
8600
- // Permite apagar nos pontos sensíveis
8601
- if (event.keyCode === 8 && (cnpj.length === 3 || cnpj.length === 7 || cnpj.length === 11 || cnpj.length === 16)) {
8602
- return;
8603
- }
8604
- event.target.value = FormatUtilsService.getFormattedCnpjEdited(cnpj);
8519
+ static getFormattedPercentage(value) {
8520
+ return parseFloat(value).toFixed(2).replace('.', ',') + '%';
8605
8521
  }
8606
8522
  }
8607
8523
 
8608
- let SharedStateService = class SharedStateService {
8609
- constructor() {
8610
- this.hideFieldSubject = new BehaviorSubject(true);
8611
- this.hideField$ = this.hideFieldSubject.asObservable();
8612
- this.showButtonSubject = new BehaviorSubject(true);
8613
- this.showButton$ = this.showButtonSubject.asObservable();
8614
- this.saveButtonSubject = new BehaviorSubject(true);
8615
- this.saveButton$ = this.saveButtonSubject.asObservable();
8616
- this.showEditMode = new BehaviorSubject(true);
8617
- this.showEditMode$ = this.showEditMode.asObservable();
8618
- this.activeValidatorsOnEditModalOpen = new Subject();
8619
- this.activeValidatorsOnEditModalOpen$ = this.activeValidatorsOnEditModalOpen.asObservable();
8620
- this.shouldReloadWindowOnlyEditMode = new BehaviorSubject(false);
8621
- this.shouldReloadWindowOnlyEditMode$ = this.shouldReloadWindowOnlyEditMode.asObservable();
8622
- this.hideBtnAddForViewMode = new BehaviorSubject(false);
8623
- this.hideBtnAddForViewMode$ = this.hideBtnAddForViewMode.asObservable();
8624
- }
8625
- setHideField(value) {
8626
- this.hideFieldSubject.next(value);
8627
- }
8628
- setShowButton(value) {
8629
- this.showButtonSubject.next(value);
8630
- }
8631
- setSaveButton(value) {
8632
- this.saveButtonSubject.next(value);
8633
- }
8634
- setShowEditMode(value) {
8635
- this.showEditMode.next(value);
8636
- }
8637
- setShouldReloadWindowOnlyEditMode(value) {
8638
- this.shouldReloadWindowOnlyEditMode.next(value);
8639
- }
8640
- triggerActiveValidatorsOnEditModalOpen() {
8641
- this.activeValidatorsOnEditModalOpen.next();
8642
- }
8643
- setHideBtnAddForViewMode(value) {
8644
- this.hideBtnAddForViewMode.next(value);
8645
- }
8646
- resetHideField() {
8647
- this.hideFieldSubject.next(true);
8648
- }
8649
- };
8650
- SharedStateService.ngInjectableDef = ɵɵdefineInjectable({ factory: function SharedStateService_Factory() { return new SharedStateService(); }, token: SharedStateService, providedIn: "root" });
8651
- SharedStateService = __decorate([
8652
- Injectable({
8653
- providedIn: 'root',
8654
- })
8655
- ], SharedStateService);
8656
-
8657
8524
  class GenericValidator {
8658
8525
  constructor() { }
8659
8526
  /**
@@ -8818,72 +8685,47 @@ class GenericValidator {
8818
8685
  }
8819
8686
  }
8820
8687
 
8821
- class HistoricakPixAccountBase {
8822
- constructor(formBuilder) {
8823
- this._paramsForm = new FormGroup({});
8824
- this._defaultCpfNumber = null;
8688
+ let HistoricalPixAccountFormComponent = class HistoricalPixAccountFormComponent {
8689
+ constructor(formBuilder, cd) {
8690
+ this.formBuilder = formBuilder;
8691
+ this.cd = cd;
8692
+ this.withSideBar = true;
8693
+ this.isEditMode = false;
8694
+ this.paramsForm = new FormGroup({});
8695
+ this.defaultCpfNumber = null;
8696
+ this.permitsEditBankAccountForm = false;
8697
+ this.visibleChange = new EventEmitter();
8698
+ this.pixAccountItemToList = new EventEmitter();
8699
+ this.ngUnsubscribe = new Subject();
8825
8700
  this.initialValidatorOfPercentage = [Validators.required, Validators.min(0.01)];
8826
- this.pixAccountList = [];
8827
- this.maxValuePercentage = 100.0;
8701
+ this.labelBtnAdd = "hcm.payroll.employees_add";
8702
+ this.maxValuePercentage = 100.00;
8703
+ this.visibleBtnSave = true;
8704
+ this.isView = false;
8828
8705
  this.isShowPixKeyFieldValidatorMessage = false;
8829
- this.formBuilder = formBuilder;
8830
- this.createFormGroupBase();
8706
+ this.createFormGroup();
8707
+ this.registerSubjects();
8831
8708
  }
8832
- phoneMask(event) {
8833
- FormatUtilsService.formatTelephoneInputEvent(event);
8709
+ ngOnInit() {
8834
8710
  }
8835
- cpfMask(event) {
8836
- FormatUtilsService.formatCpfInputEvent(event);
8711
+ ngDoCheck() {
8712
+ if (this.pixAccountFormGroup && this.pixKeyType === "BANK_ACCOUNT") {
8713
+ const pixKeyControl = this.pixAccountFormGroup.get("pixKey");
8714
+ if (pixKeyControl && !pixKeyControl.disabled) {
8715
+ pixKeyControl.disable();
8716
+ }
8717
+ }
8837
8718
  }
8838
- cnpjMask(event) {
8839
- FormatUtilsService.formatCnpjInputEvent(event);
8719
+ ngAfterViewInit() {
8720
+ this.cd.detectChanges();
8840
8721
  }
8841
- onChangePixKeyType(item, form) {
8842
- if (!item || !item.key)
8843
- return;
8844
- this.pixKeyType = item.key;
8845
- const targetForm = (typeof form !== 'undefined' && form !== null)
8846
- ? form
8847
- : this.pixAccountFormGroup;
8848
- this.isShowPixKeyFieldValidatorMessage = true;
8849
- const pixKeyControl = targetForm.get("pixKey");
8850
- if (pixKeyControl) {
8851
- pixKeyControl.reset();
8852
- }
8853
- this.setPixKeyValidators(true, targetForm);
8854
- if (item.key === "CPF") {
8855
- this.setDefaultCpfPixKey(targetForm);
8856
- }
8857
- }
8858
- onClearPixKeyType(form) {
8859
- var targetForm = (typeof form !== 'undefined' && form !== null)
8860
- ? form
8861
- : this.pixAccountFormGroup;
8862
- this.isShowPixKeyFieldValidatorMessage = false;
8863
- if (targetForm.get("pixKey")) {
8864
- targetForm.get("pixKey").reset();
8865
- }
8722
+ ngOnDestroy() {
8723
+ this.ngUnsubscribe.next(true);
8724
+ this.ngUnsubscribe.unsubscribe();
8866
8725
  }
8867
- setDefaultCpfPixKey(form) {
8868
- var targetForm = (typeof form !== 'undefined' && form !== null)
8869
- ? form
8870
- : this.pixAccountFormGroup;
8871
- if (this._defaultCpfNumber) {
8872
- if (targetForm.get("pixKey")) {
8873
- targetForm.get("pixKey").setValue(this._defaultCpfNumber);
8874
- }
8875
- }
8876
- else {
8877
- var sheetDocument = this._paramsForm.get("sheetDocument");
8878
- if (sheetDocument && sheetDocument.get("cpfNumber")) {
8879
- var cpf = sheetDocument.get("cpfNumber").value;
8880
- if (cpf && targetForm.get("pixKey")) {
8881
- targetForm.get("pixKey").setValue(cpf);
8882
- }
8883
- }
8884
- }
8726
+ registerSubjects() {
8885
8727
  }
8886
- createFormGroupBase() {
8728
+ createFormGroup() {
8887
8729
  this.pixAccountFormGroup = this.formBuilder.group({
8888
8730
  id: this.formBuilder.control(null),
8889
8731
  index: this.formBuilder.control(null),
@@ -8899,139 +8741,334 @@ class HistoricakPixAccountBase {
8899
8741
  customFields: this.formBuilder.control(null),
8900
8742
  });
8901
8743
  }
8902
- setValidatorsAccordingList(pixAccountList, index = null, isEditMode = true, form) {
8903
- var targetForm = (typeof form !== 'undefined' && form !== null)
8904
- ? form
8905
- : this.pixAccountFormGroup;
8906
- this.pixAccountList = (pixAccountList && pixAccountList.length > 0)
8907
- ? [].concat(pixAccountList)
8908
- : [];
8909
- var percentageIncluded = [];
8910
- for (var i = 0; i < this.pixAccountList.length; i++) {
8911
- var field = this.pixAccountList[i];
8912
- if (field && field.percentage && i !== index) {
8913
- percentageIncluded.push(field.percentage);
8914
- }
8915
- }
8916
- this.beforeSetPixKeyTypeValidator(targetForm);
8917
- this.setPixKeyValidators(isEditMode, targetForm);
8918
- this.validatePercentageValid(percentageIncluded, targetForm);
8919
- }
8920
- beforeSetPixKeyTypeValidator(form) {
8921
- const control = form.get("pixKeyType");
8922
- if (this.pixAccountList && this.pixAccountList.length) {
8923
- control.setValidators(Validators.compose([
8924
- Validators.required,
8925
- this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
8926
- ]));
8744
+ onChangePixKeyType(item) {
8745
+ if (item.key) {
8746
+ this.pixKeyType = item.key;
8747
+ this.isShowPixKeyFieldValidatorMessage = true;
8748
+ this.pixAccountFormGroup.get("pixKey").reset();
8749
+ this.setPixKeyValidators(true);
8750
+ if (item.key === "CPF") {
8751
+ this.setDefaultCpfPixKey();
8752
+ }
8753
+ }
8754
+ }
8755
+ onClearPixKeyType() {
8756
+ this.isShowPixKeyFieldValidatorMessage = false;
8757
+ this.pixAccountFormGroup.get("pixKey").reset();
8758
+ }
8759
+ get visible() {
8760
+ return this._visible;
8761
+ }
8762
+ set visible(value) {
8763
+ this._visible = value;
8764
+ this.visibleChange.emit(this.visible);
8765
+ }
8766
+ set isEditAndViewValue(value) {
8767
+ this.resetForm();
8768
+ this.visibleBtnSave = true;
8769
+ if (value && value.permitsEditBankAccount) {
8770
+ this.permitsEditBankAccountForm = true;
8771
+ }
8772
+ if (value && value.currentItem && Object.keys(value.currentItem).length) {
8773
+ this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(Object.assign({}, value.currentItem)));
8774
+ this.labelBtnAdd = "hcm.payroll.employees_update";
8775
+ this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
8776
+ if (!this.isView) {
8777
+ this.configEnableFields(value && value["isEditMode"]);
8778
+ }
8779
+ else {
8780
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
8781
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
8782
+ this.formatPixKeyTelephoneNumber();
8783
+ }
8784
+ }
8927
8785
  }
8928
8786
  else {
8929
- control.setValidators(Validators.required);
8930
- }
8931
- control.updateValueAndValidity();
8932
- }
8933
- setPixKeyValidators(isEditMode, form) {
8934
- const pixKey = form.get("pixKey");
8935
- switch (this.pixKeyType) {
8936
- case "TELEPHONE":
8937
- pixKey.setValidators(Validators.compose([Validators.required, GenericValidator.isValidPhoneNumber]));
8938
- break;
8939
- case "EMAIL":
8940
- pixKey.setValidators(Validators.compose([Validators.required, GenericValidator.isValidEmail]));
8941
- break;
8942
- case "CPF":
8943
- pixKey.setValidators(Validators.compose([Validators.required, GenericValidator.isValidCpf]));
8944
- break;
8945
- case "CNPJ":
8946
- pixKey.setValidators(Validators.compose([Validators.required, GenericValidator.isValidCnpj]));
8947
- break;
8948
- case "RANDOM_KEY":
8949
- pixKey.setValidators(Validators.required);
8950
- break;
8951
- default:
8952
- pixKey.clearValidators();
8787
+ this.labelBtnAdd = "hcm.payroll.employees_add";
8953
8788
  }
8954
- if (isEditMode) {
8955
- pixKey.enable();
8789
+ }
8790
+ formatPixKeyTelephoneNumber() {
8791
+ if (this.pixKeyType === "TELEPHONE") {
8792
+ this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
8956
8793
  }
8957
- pixKey.updateValueAndValidity();
8958
8794
  }
8959
- validatePercentageValid(listValue, form) {
8960
- const percentage = form.get("percentage");
8961
- this.maxValuePercentage = listValue.reduce((acc, val) => acc - val, 100.0);
8962
- percentage.setValidators(Validators.compose([
8963
- ...this.initialValidatorOfPercentage,
8964
- Validators.max(this.maxValuePercentage),
8965
- ]));
8966
- percentage.updateValueAndValidity();
8795
+ convertDTOToShowWithCustomFields(data) {
8796
+ const obj = Object.assign({}, data);
8797
+ obj["customFields"] = mountCustomToShow(obj["customFields"]);
8798
+ return obj;
8967
8799
  }
8968
- validateDuplicatePixKeyTypeBankAccount(listCompare) {
8969
- return (control) => {
8970
- const value = control.value;
8971
- const isDuplicate = listCompare.some((field) => value &&
8972
- field.pixKeyType.key === "BANK_ACCOUNT" &&
8973
- value.key === "BANK_ACCOUNT");
8974
- return isDuplicate ? { pixKeyTypeBankAccountDuplicate: true } : null;
8800
+ configEnableFields(isEditMode) {
8801
+ this.visibleBtnSave = isEditMode;
8802
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
8803
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
8804
+ this.setPixKeyValidators(isEditMode);
8805
+ this.formatPixKeyTelephoneNumber();
8806
+ }
8807
+ configEnabledFields(this.pixAccountFormGroup, isEditMode, [
8808
+ "pixKeyType",
8809
+ "pixKey",
8810
+ "percentage",
8811
+ "customFields",
8812
+ ], []);
8813
+ }
8814
+ close() {
8815
+ this.resetForm();
8816
+ this.visible = false;
8817
+ }
8818
+ addItem() {
8819
+ this.pixAccountFormGroup.updateValueAndValidity();
8820
+ verifyValidationsForm.call(this.pixAccountFormGroup);
8821
+ if (this.pixAccountFormGroup.valid) {
8822
+ if (this.employeeId) {
8823
+ this.pixAccountFormGroup.get("employee").setValue({
8824
+ tableId: this.employeeId,
8825
+ name: "",
8826
+ });
8827
+ }
8828
+ this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
8829
+ this.visible = false;
8830
+ this.resetForm();
8831
+ }
8832
+ }
8833
+ resetForm() {
8834
+ this.pixAccountFormGroup.reset();
8835
+ this.labelBtnAdd = "hcm.payroll.employees_add";
8836
+ if (this.customFields && this.customFields.formGroup)
8837
+ this.customFields.formGroup.reset();
8838
+ }
8839
+ get percentagePlaceholder() {
8840
+ return `0${this.currency && this.currency.decimalSeparator}00`;
8841
+ }
8842
+ get optionsPercentage() {
8843
+ return Object.assign({}, this.getOptions(), { precision: 2 });
8844
+ }
8845
+ getOptions() {
8846
+ return {
8847
+ prefix: "",
8848
+ thousands: this.currency.thousandsSeparator,
8849
+ decimal: this.currency.decimalSeparator,
8975
8850
  };
8976
8851
  }
8977
- get paramsForm() {
8978
- return this._paramsForm;
8852
+ /**
8853
+ * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
8854
+ * @param pixAccountList
8855
+ */
8856
+ set getListPixAccount(pixAccountList) {
8857
+ if (pixAccountList) {
8858
+ this.setValidatorsAccordingList(pixAccountList, null, false);
8859
+ }
8860
+ else {
8861
+ this.resetForm();
8862
+ }
8863
+ }
8864
+ /**
8865
+ * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
8866
+ * a validação dos campos "percentage" e "pixAccount".
8867
+ * 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
8868
+ * no array de comparação dos validators.
8869
+ * @param pixAccountList
8870
+ * @param index
8871
+ */
8872
+ setValidatorsAccordingList(pixAccountList, index = null, isEditMode = true) {
8873
+ this.pixAccountList = pixAccountList && pixAccountList.length ? [...pixAccountList] : [];
8874
+ const percentageIncluded = [];
8875
+ if (this.pixAccountList && this.pixAccountList.length) {
8876
+ this.pixAccountList.filter((field, key) => {
8877
+ if (field["percentage"] && key != index) {
8878
+ percentageIncluded.push(field["percentage"]);
8879
+ }
8880
+ });
8881
+ }
8882
+ this.beforeSetPixKeyTypeValidator();
8883
+ this.setPixKeyValidators(isEditMode);
8884
+ this.validatePercentageValid(percentageIncluded);
8979
8885
  }
8980
- set paramsForm(value) {
8981
- this._paramsForm = value;
8886
+ /**
8887
+ * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
8888
+ */
8889
+ setPixKeyValidators(isEditMode) {
8890
+ const genericPixKey = this.pixAccountFormGroup.get("pixKey");
8891
+ if (this.pixKeyType) {
8892
+ switch (this.pixKeyType) {
8893
+ case "TELEPHONE":
8894
+ genericPixKey.setValidators(Validators.compose([
8895
+ Validators.required, GenericValidator.isValidPhoneNumber,
8896
+ ]));
8897
+ break;
8898
+ case "EMAIL":
8899
+ genericPixKey.setValidators(Validators.compose([
8900
+ Validators.required, GenericValidator.isValidEmail,
8901
+ ]));
8902
+ break;
8903
+ case "CPF":
8904
+ genericPixKey.setValidators(Validators.compose([
8905
+ Validators.required, GenericValidator.isValidCpf,
8906
+ ]));
8907
+ break;
8908
+ case "CNPJ":
8909
+ genericPixKey.setValidators(Validators.compose([
8910
+ Validators.required, GenericValidator.isValidCnpj,
8911
+ ]));
8912
+ break;
8913
+ case "RANDOM_KEY":
8914
+ genericPixKey.setValidators(Validators.required);
8915
+ break;
8916
+ default:
8917
+ genericPixKey.setValidators(null);
8918
+ break;
8919
+ }
8920
+ if (isEditMode) {
8921
+ genericPixKey.enable();
8922
+ }
8923
+ genericPixKey.updateValueAndValidity();
8924
+ }
8982
8925
  }
8983
- get defaultCpfNumber() {
8984
- return this._defaultCpfNumber;
8926
+ /**
8927
+ * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
8928
+ * 100% na validação do campo "percentage" como um novo maxValue;
8929
+ * @param listValue
8930
+ */
8931
+ validatePercentageValid(listValue) {
8932
+ const percentage = this.pixAccountFormGroup.get("percentage");
8933
+ this.maxValuePercentage = listValue
8934
+ .reduce((currentValue, total) => currentValue - total, 100.00);
8935
+ percentage
8936
+ .setValidators(Validators.compose([
8937
+ ...this.initialValidatorOfPercentage,
8938
+ Validators.max(this.maxValuePercentage),
8939
+ ]));
8940
+ percentage.updateValueAndValidity();
8985
8941
  }
8986
- set defaultCpfNumber(value) {
8987
- this._defaultCpfNumber = value;
8942
+ set isViewMode(condition) {
8943
+ this.isView = !!(condition && !this.withSideBar);
8944
+ this.configEnableFields(!this.isView);
8945
+ if (!this.isView)
8946
+ this.resetForm();
8988
8947
  }
8989
- }
8990
-
8991
- let HistoricalPixAccountService = class HistoricalPixAccountService {
8992
- constructor(http) {
8993
- this.http = http;
8948
+ phoneMask(event) {
8949
+ FormatUtilsService.formatTelephoneInputEvent(event);
8994
8950
  }
8995
- query(path, body, service = ServiceType.PAYROLL) {
8996
- return this.http.query(path, body, service);
8951
+ setDefaultCpfPixKey() {
8952
+ if (this.defaultCpfNumber) {
8953
+ this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
8954
+ }
8955
+ else {
8956
+ const sheetDocument = this.paramsForm.get("sheetDocument");
8957
+ if (sheetDocument) {
8958
+ const cpf = sheetDocument.get("cpfNumber").value;
8959
+ if (cpf) {
8960
+ this.pixAccountFormGroup.get("pixKey").setValue(cpf);
8961
+ }
8962
+ }
8963
+ }
8997
8964
  }
8998
- enumQuery() {
8999
- const path = 'enumQuery';
9000
- const body = {
9001
- names: ['PixKeyType']
8965
+ beforeSetPixKeyTypeValidator() {
8966
+ const pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
8967
+ if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
8968
+ pixKeyType
8969
+ .setValidators(Validators.compose([
8970
+ Validators.required,
8971
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
8972
+ ]));
8973
+ }
8974
+ else {
8975
+ pixKeyType.setValidators(Validators.required);
8976
+ }
8977
+ }
8978
+ validateDuplicatePixKeyTypeBankAccount(listCompare) {
8979
+ return (control) => {
8980
+ const value = control && control.value;
8981
+ let condition = false;
8982
+ listCompare.filter((field) => {
8983
+ if (value) {
8984
+ if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
8985
+ return condition = true;
8986
+ }
8987
+ }
8988
+ });
8989
+ if (condition && !this.permitsEditBankAccountForm) {
8990
+ return { pixKeyTypeBankAccountDuplicate: true };
8991
+ }
8992
+ else {
8993
+ return null;
8994
+ }
9002
8995
  };
9003
- return this.http.query(path, body, ServiceType.PAYROLL);
9004
8996
  }
9005
8997
  };
9006
- HistoricalPixAccountService.ctorParameters = () => [
9007
- { type: HttpClientService }
8998
+ HistoricalPixAccountFormComponent.ctorParameters = () => [
8999
+ { type: FormBuilder },
9000
+ { type: ChangeDetectorRef }
9008
9001
  ];
9009
- HistoricalPixAccountService = __decorate([
9010
- Injectable()
9011
- ], HistoricalPixAccountService);
9002
+ __decorate([
9003
+ ViewChild(CustomFieldsComponent$1, { static: true })
9004
+ ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
9005
+ __decorate([
9006
+ Input()
9007
+ ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
9008
+ __decorate([
9009
+ Input()
9010
+ ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
9011
+ __decorate([
9012
+ Input()
9013
+ ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
9014
+ __decorate([
9015
+ Input()
9016
+ ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
9017
+ __decorate([
9018
+ Input()
9019
+ ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
9020
+ __decorate([
9021
+ Input()
9022
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
9023
+ __decorate([
9024
+ Input()
9025
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
9026
+ __decorate([
9027
+ Input()
9028
+ ], HistoricalPixAccountFormComponent.prototype, "permitsEditBankAccountForm", void 0);
9029
+ __decorate([
9030
+ Output()
9031
+ ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
9032
+ __decorate([
9033
+ Output()
9034
+ ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
9035
+ __decorate([
9036
+ Input()
9037
+ ], HistoricalPixAccountFormComponent.prototype, "visible", null);
9038
+ __decorate([
9039
+ Input()
9040
+ ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
9041
+ __decorate([
9042
+ Input()
9043
+ ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
9044
+ __decorate([
9045
+ Input()
9046
+ ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
9047
+ HistoricalPixAccountFormComponent = __decorate([
9048
+ Component({
9049
+ selector: "pix-account",
9050
+ 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",
9051
+ 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}"]
9052
+ })
9053
+ ], HistoricalPixAccountFormComponent);
9012
9054
 
9013
- let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends HistoricakPixAccountBase {
9014
- constructor(translateService, cd, formBuilder, sharedStateService, service) {
9015
- super(formBuilder);
9055
+ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
9056
+ constructor(translateService, cd, formBuilder, messageService) {
9016
9057
  this.translateService = translateService;
9017
9058
  this.cd = cd;
9018
- this.sharedStateService = sharedStateService;
9019
- this.service = service;
9059
+ this.formBuilder = formBuilder;
9060
+ this.messageService = messageService;
9020
9061
  this.recordByRow = 1;
9021
9062
  this.showDateChange = false;
9022
9063
  this.isEditMode = false;
9023
9064
  this.isViewMode = false;
9024
9065
  this.withSideBar = true;
9066
+ this.defaultCpfNumber = null;
9025
9067
  this.listDataReciever = [];
9026
- this.addExistentHistoricData = [];
9027
- this.getListPixAccount = [];
9028
- this.isEditModeForSave = false;
9029
- this.showField = false;
9068
+ this.showButtonEdit = false;
9030
9069
  this.isViewModeActive = new EventEmitter();
9031
9070
  this.isEditModeActive = new EventEmitter();
9032
9071
  this.isDeleteModeActive = new EventEmitter();
9033
- this.isValidChangeForm = new EventEmitter();
9034
- this.reloadOnlyOnEdit = new EventEmitter();
9035
9072
  this.listFromApp = [];
9036
9073
  this.visibleChange = new EventEmitter();
9037
9074
  this.ngUnsubscribe = new Subject();
@@ -9045,12 +9082,7 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9045
9082
  this.loading = true;
9046
9083
  this.listData = [];
9047
9084
  this.listDataNoPage = [];
9048
- this.showButtonView = true;
9049
- this.showEditMode = false;
9050
- this.hasRecordsPix = true;
9051
- this.hideFields = this.sharedStateService.hideField$;
9052
- this.suggestions = [];
9053
- this.formGroupByRow = {};
9085
+ this.permitsEditBankAccount = false;
9054
9086
  this.cols = [
9055
9087
  {
9056
9088
  label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
@@ -9064,10 +9096,6 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9064
9096
  label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9065
9097
  field: "percentage",
9066
9098
  },
9067
- {
9068
- label: this.translateService.instant("hcm.payroll.movimentation_generic_action"),
9069
- field: "actions",
9070
- }
9071
9099
  ];
9072
9100
  this.actions = (rowData = {}, key) => {
9073
9101
  return [
@@ -9086,26 +9114,30 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9086
9114
  },
9087
9115
  },
9088
9116
  {
9089
- visible: !!(!this.isEditMode && this.withSideBar),
9117
+ visible: !!((!this.isEditMode && this.withSideBar) || this.showButtonEdit),
9090
9118
  label: this.translateService.instant("hcm.payroll.edit"),
9091
9119
  command: () => {
9120
+ this.permitsEditBankAccount = true;
9092
9121
  if (this.isAllowToEditHistorical) {
9093
9122
  rowData["index"] = key;
9094
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
9123
+ this.pixAccountItemInput = {
9124
+ currentItem: rowData, listData: this.listDataNoPage, isEditMode: true, permitsEditBankAccount: true
9125
+ };
9095
9126
  this.visible = true;
9096
9127
  }
9097
9128
  else {
9098
9129
  this.isEditModeActive.emit(true);
9099
9130
  if (this.listFromApp.length == 0) {
9100
9131
  rowData["index"] = key;
9101
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
9102
- this.visible = true;
9132
+ this.pixAccountItemInput = {
9133
+ currentItem: rowData, listData: this.listDataNoPage, isEditMode: true, permitsEditBankAccount: true
9134
+ };
9103
9135
  }
9104
9136
  }
9105
9137
  },
9106
9138
  },
9107
9139
  {
9108
- visible: !this.isEditMode || this.showEditMode,
9140
+ visible: !this.isEditMode,
9109
9141
  label: this.translateService.instant("hcm.payroll.delete"),
9110
9142
  command: () => {
9111
9143
  if (this.isAllowToDeleteHistorical) {
@@ -9123,49 +9155,17 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9123
9155
  },
9124
9156
  ];
9125
9157
  };
9126
- this.createFormGroup();
9127
- }
9128
- ngOnInit() {
9129
- this.showFields = this.showField;
9130
- this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9131
- this.sharedStateService.showButton$.subscribe((value) => {
9132
- this.showButtonView = value;
9133
- });
9134
- this.sharedStateService.showEditMode$.subscribe((value) => {
9135
- this.showEditMode = value;
9136
- this.isEditModeForSave = value;
9137
- });
9138
- this.sharedStateService.shouldReloadWindowOnlyEditMode$.subscribe((value) => {
9139
- this.reloadOnlyOnEdit.emit(value);
9140
- });
9141
- this.sharedStateService.hideBtnAddForViewMode$.subscribe((value) => {
9142
- this.hideBtnAddForViewMode = value;
9143
- });
9144
- this.sharedStateService.activeValidatorsOnEditModalOpen$
9145
- .subscribe(() => {
9146
- Object.values(this.formGroupByRow).forEach(fg => {
9147
- Object.values(fg.controls).forEach(control => {
9148
- control.markAsTouched();
9149
- control.updateValueAndValidity();
9150
- });
9151
- });
9152
- this.emitFormValidity();
9153
- });
9158
+ this.createFormGroup();
9159
+ }
9160
+ ngOnInit() {
9161
+ this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9154
9162
  }
9155
9163
  ngOnChanges(changes) {
9156
9164
  if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
9157
9165
  this.listFromApp = changes['listDataReciever'].currentValue;
9158
9166
  }
9159
- if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
9160
- this.getHistoricalPixAccountList();
9161
- }
9162
- if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
9163
- const newData = changes['addExistentHistoricData'].currentValue;
9164
- this.rebuildFormGroupMap(newData);
9165
- }
9166
- if (changes['isEditMode']) {
9167
- this.isEditMode = changes['isEditMode'].currentValue;
9168
- this.cd.detectChanges();
9167
+ if (changes['showButtonEdit'] && changes['showButtonEdit'].currentValue) {
9168
+ this.permitsEditBankAccount = changes['showButtonEdit'].currentValue;
9169
9169
  }
9170
9170
  }
9171
9171
  createFormGroup() {
@@ -9180,96 +9180,6 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9180
9180
  ngAfterViewInit() {
9181
9181
  this.cd.detectChanges();
9182
9182
  }
9183
- emitFormValidity() {
9184
- const allValid = Object.values(this.formGroupByRow).every(fg => {
9185
- fg.updateValueAndValidity();
9186
- return fg.valid;
9187
- });
9188
- this.isValidChangeForm.emit(allValid);
9189
- }
9190
- filterPixKeyType(event) {
9191
- const query = event.query;
9192
- this.service.enumQuery().subscribe((response) => {
9193
- const pixKeyTypeEnum = response.results.find((result) => result.enumName === 'PixKeyType');
9194
- if (pixKeyTypeEnum) {
9195
- this.suggestions = pixKeyTypeEnum.items.filter((item) => item.value.toLowerCase().includes(query.toLowerCase()));
9196
- }
9197
- else {
9198
- this.suggestions = [];
9199
- }
9200
- });
9201
- }
9202
- createPixRowFormGroup() {
9203
- return this.formBuilder.group({
9204
- pixKeyType: [null, Validators.required],
9205
- pixKey: [null],
9206
- percentage: [0, Validators.compose([
9207
- ...this.initialValidatorOfPercentage,
9208
- Validators.max(this.maxValuePercentage),
9209
- ])]
9210
- });
9211
- }
9212
- onPixKeyInput(event, index) {
9213
- const inputValue = event.target.value;
9214
- const inputRawValue = inputValue.replace(/\D/g, '');
9215
- const form = this.formGroupByRow[index];
9216
- const pixKeyControl = form.get('pixKey');
9217
- if (pixKeyControl) {
9218
- pixKeyControl.setValue(inputRawValue, { emitEvent: false });
9219
- pixKeyControl.markAsDirty();
9220
- pixKeyControl.updateValueAndValidity();
9221
- }
9222
- this.setPixKeyValidators(true, form);
9223
- this.emitFormValidity();
9224
- }
9225
- onBlurPixCpfAndCnpj(index) {
9226
- const form = this.formGroupByRow[index];
9227
- const pixKeyControl = form.get('pixKey');
9228
- const pixKeyTypeControl = form.get('pixKeyType');
9229
- if (!pixKeyControl || !pixKeyTypeControl)
9230
- return;
9231
- const currentValue = pixKeyControl.value;
9232
- const pixKeyType = pixKeyTypeControl.value.key;
9233
- const rawValue = (currentValue || '').replace(/\D/g, '');
9234
- pixKeyControl.setValue(rawValue, { emitEvent: false });
9235
- if (pixKeyControl.valid) {
9236
- form.patchValue({
9237
- pixKeyFormatted: FormatUtilsService.getFormattedSubscriptionNumber(rawValue, pixKeyType)
9238
- });
9239
- }
9240
- this.emitFormValidity();
9241
- }
9242
- getFormattedPixKey(type, value) {
9243
- return FormatUtilsService.getFormattedSubscriptionNumber(value, type);
9244
- }
9245
- syncPixDataToParentForm() {
9246
- if (!this.isEditModeForSave)
9247
- return;
9248
- const values = Object.values(this.formGroupByRow).map(fg => {
9249
- const value = fg.getRawValue();
9250
- const pixKeyType = value.pixKeyType.key;
9251
- if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ') {
9252
- value.pixKey = (value.pixKey || '').replace(/[.\-\/]/g, '');
9253
- }
9254
- else if (pixKeyType === 'TELEPHONE') {
9255
- value.pixKey = (value.pixKey || '').replace(/[()\s\-]/g, '');
9256
- }
9257
- return value;
9258
- });
9259
- this.formGroup
9260
- .get(this.fieldFormGroup)
9261
- .get('historicalPixAccountList')
9262
- .setValue(values);
9263
- this.emitFormValidity();
9264
- }
9265
- syncResetPixFormToParent() {
9266
- this.formGroupByRow = {};
9267
- this.historicalPixAccountList.reset();
9268
- this.historicalPixAccountList.get('historicalPixAccountList').setValue([]);
9269
- if (this.addExistentHistoricData.length) {
9270
- this.rebuildFormGroupMap(this.addExistentHistoricData);
9271
- }
9272
- }
9273
9183
  onLazyLoad(event) {
9274
9184
  const first = event && event.first ? event.first : 0;
9275
9185
  const rows = event && event.rows ? event.rows : this.recordByRow;
@@ -9296,7 +9206,6 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9296
9206
  this.refreshCssInIE11();
9297
9207
  }
9298
9208
  this.loading = false;
9299
- this.cd.detectChanges();
9300
9209
  }
9301
9210
  /**
9302
9211
  * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
@@ -9314,67 +9223,12 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9314
9223
  this.pixAccountItemInput = {};
9315
9224
  this.visible = true;
9316
9225
  }
9317
- addPix() {
9318
- const newItem = {
9319
- pixKeyType: {},
9320
- pixKey: '',
9321
- percentage: 0
9322
- };
9323
- const index = this.addExistentHistoricData.length;
9324
- this.addExistentHistoricData = [
9325
- ...this.addExistentHistoricData,
9326
- newItem
9327
- ];
9328
- this.formGroupByRow[index] = this.createPixRowFormGroup();
9329
- this.setValidatorsAccordingList(this.addExistentHistoricData, index, true);
9330
- this.emitFormValidity();
9331
- }
9332
- deletePix(index) {
9333
- if (this.dataListPix.editingCell) {
9334
- this.dataListPix.editingCell = null;
9335
- }
9336
- this.addExistentHistoricData = this.addExistentHistoricData.filter((_, i) => i !== index);
9337
- this.rebuildFormGroupMap(this.addExistentHistoricData);
9338
- this.emitFormValidity();
9339
- }
9340
- rebuildFormGroupMap(data) {
9341
- this.formGroupByRow = {};
9342
- data.forEach((item, index) => {
9343
- const form = this.createPixRowFormGroup();
9344
- const pixKeyType = item.pixKeyType.key;
9345
- const pixKeyRaw = item.pixKey;
9346
- if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ') {
9347
- item.pixKey = FormatUtilsService.getFormattedSubscriptionNumber(pixKeyRaw, pixKeyType);
9348
- }
9349
- if (pixKeyType === 'TELEPHONE') {
9350
- item.pixKey = FormatUtilsService.getFormattedTelephoneNumber(pixKeyRaw);
9351
- }
9352
- form.patchValue(item);
9353
- this.formGroupByRow[index] = form;
9354
- this.pixKeyType = pixKeyType;
9355
- this.setPixKeyValidators(true, form);
9356
- this.setValidatorsAccordingList(data, index, this.isEditMode);
9357
- const listValues = data
9358
- .filter((_, i) => i !== index)
9359
- .map(row => row.percentage ? parseFloat(row.percentage) : 0);
9360
- this.validatePercentageValid(listValues, form);
9361
- });
9362
- this.emitFormValidity();
9363
- }
9364
- onPixKeyTypeChange(item, index) {
9365
- const form = this.formGroupByRow[index];
9366
- this.onChangePixKeyType(item, form);
9367
- this.addExistentHistoricData[index].pixKey = '';
9368
- setTimeout(() => {
9369
- if (this.dataListPix.editingCell) {
9370
- this.dataListPix.editingCell = null;
9371
- }
9226
+ isNotAllowMessage() {
9227
+ this.messageService.add({
9228
+ severity: "error",
9229
+ summary: this.translateService.instant("hcm.payroll.error"),
9230
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9372
9231
  });
9373
- this.cd.detectChanges();
9374
- }
9375
- onPixKeyTypeClear(index) {
9376
- const form = this.formGroupByRow[index];
9377
- this.onClearPixKeyType(form);
9378
9232
  }
9379
9233
  deleteAnnuityItem(index) {
9380
9234
  let newlist = [...this.getHistoricalPixAccountList()];
@@ -9408,6 +9262,10 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9408
9262
  $event["dateChange"] = this.dateChange;
9409
9263
  newDataList.push($event);
9410
9264
  }
9265
+ if (this.formComponent) {
9266
+ this.formComponent.permitsEditBankAccountForm = false;
9267
+ this.cd.detectChanges();
9268
+ }
9411
9269
  this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9412
9270
  this.verifyTotalPercentage();
9413
9271
  this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
@@ -9436,23 +9294,6 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9436
9294
  this.msgTotalLimitByPercentage = null;
9437
9295
  }
9438
9296
  }
9439
- onSyncValue(field, index) {
9440
- if (this.formGroupByRow &&
9441
- this.formGroupByRow[index] &&
9442
- this.formGroupByRow[index].get(field)) {
9443
- const control = this.formGroupByRow[index].get(field);
9444
- const value = control.value;
9445
- this.addExistentHistoricData[index][field] = value;
9446
- control.markAsDirty();
9447
- control.markAsTouched();
9448
- control.updateValueAndValidity();
9449
- const currentList = this.addExistentHistoricData.map((item, i) => {
9450
- return i === index ? 0 : item.percentage;
9451
- });
9452
- this.validatePercentageValid(currentList, this.formGroupByRow[index]);
9453
- this.emitFormValidity();
9454
- }
9455
- }
9456
9297
  get scopedActions() {
9457
9298
  return this.actions.bind(this);
9458
9299
  }
@@ -9489,15 +9330,12 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent extends
9489
9330
  get visible() {
9490
9331
  return this._visible;
9491
9332
  }
9492
- set paramsForm(value) {
9493
- this._paramsForm = value;
9494
- }
9495
- set defaultCpfNumber(value) {
9496
- this._defaultCpfNumber = value;
9497
- }
9498
9333
  set visible(value) {
9499
9334
  this._visible = value;
9500
9335
  this.visibleChange.emit(this.visible);
9336
+ if (!value) {
9337
+ this.pixAccountItemInput = {};
9338
+ }
9501
9339
  }
9502
9340
  close() {
9503
9341
  this.visible = false;
@@ -9531,15 +9369,14 @@ HistoricalPixAccountComponent.ctorParameters = () => [
9531
9369
  { type: TranslateService },
9532
9370
  { type: ChangeDetectorRef },
9533
9371
  { type: FormBuilder },
9534
- { type: SharedStateService },
9535
- { type: HistoricalPixAccountService }
9372
+ { type: MessageService }
9536
9373
  ];
9537
9374
  __decorate([
9538
9375
  ViewChild(CustomFieldsComponent$1, { static: false })
9539
9376
  ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
9540
9377
  __decorate([
9541
- ViewChild('dataListPix', { static: false })
9542
- ], HistoricalPixAccountComponent.prototype, "dataListPix", void 0);
9378
+ ViewChild(HistoricalPixAccountFormComponent, { static: false })
9379
+ ], HistoricalPixAccountComponent.prototype, "formComponent", void 0);
9543
9380
  __decorate([
9544
9381
  Input()
9545
9382
  ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
@@ -9581,22 +9418,19 @@ __decorate([
9581
9418
  ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
9582
9419
  __decorate([
9583
9420
  Input()
9584
- ], HistoricalPixAccountComponent.prototype, "permission", void 0);
9585
- __decorate([
9586
- Input()
9587
- ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
9421
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
9588
9422
  __decorate([
9589
9423
  Input()
9590
- ], HistoricalPixAccountComponent.prototype, "addExistentHistoricData", void 0);
9424
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
9591
9425
  __decorate([
9592
9426
  Input()
9593
- ], HistoricalPixAccountComponent.prototype, "getListPixAccount", void 0);
9427
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
9594
9428
  __decorate([
9595
9429
  Input()
9596
- ], HistoricalPixAccountComponent.prototype, "isEditModeForSave", void 0);
9430
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
9597
9431
  __decorate([
9598
9432
  Input()
9599
- ], HistoricalPixAccountComponent.prototype, "showField", void 0);
9433
+ ], HistoricalPixAccountComponent.prototype, "showButtonEdit", void 0);
9600
9434
  __decorate([
9601
9435
  Output()
9602
9436
  ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
@@ -9606,12 +9440,6 @@ __decorate([
9606
9440
  __decorate([
9607
9441
  Output()
9608
9442
  ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
9609
- __decorate([
9610
- Output()
9611
- ], HistoricalPixAccountComponent.prototype, "isValidChangeForm", void 0);
9612
- __decorate([
9613
- Output()
9614
- ], HistoricalPixAccountComponent.prototype, "reloadOnlyOnEdit", void 0);
9615
9443
  __decorate([
9616
9444
  Input()
9617
9445
  ], HistoricalPixAccountComponent.prototype, "dateChange", null);
@@ -9624,215 +9452,29 @@ __decorate([
9624
9452
  __decorate([
9625
9453
  Input()
9626
9454
  ], HistoricalPixAccountComponent.prototype, "visible", null);
9627
- __decorate([
9628
- Input()
9629
- ], HistoricalPixAccountComponent.prototype, "paramsForm", null);
9630
- __decorate([
9631
- Input()
9632
- ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", null);
9633
9455
  HistoricalPixAccountComponent = __decorate([
9634
9456
  Component({
9635
9457
  // tslint:disable-next-line:component-selector
9636
9458
  selector: "c-historical-pix-account",
9637
- 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 (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 <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of cols\">\n {{ col.label }}\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-rowIndex=\"rowIndex\">\n <ng-container *ngIf=\"formGroupByRow[rowIndex]\" [formGroup]=\"formGroupByRow[rowIndex]\">\n <tr>\n <!-- Tipo de Chave -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.pixKeyType\" pEditableColumnField=\"pixKeyType\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <div style=\"width: 100%; position: relative;\">\n <p-autoComplete\n [suggestions]=\"suggestions\"\n (completeMethod)=\"filterPixKeyType($event)\"\n formControlName=\"pixKeyType\"\n [dropdown]=\"true\"\n (onSelect)=\"onPixKeyTypeChange($event, rowIndex)\"\n (onClear)=\"onPixKeyTypeClear(rowIndex)\"\n (ngModelChange)=\"onSyncValue('pixKeyType', rowIndex)\"\n field=\"value\"\n placeholder=\"{{'hcm.payroll.select' | translate}}\"\n appendTo=\"body\"\n [panelStyle]=\"{ maxWidth: '300px', width: '100%' }\"\n [inputStyle]=\"{ width: '100%' }\"\n ></p-autoComplete>\n\n <s-control-errors [control]=\"formGroupByRow[rowIndex]?.get('pixKeyType')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n pixKeyTypeBankAccountDuplicate: 'hcm.payroll.historical_pix_key_type_bank_account_duplicate' | translate\n }\">\n </s-control-errors>\n </div>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ item.pixKeyType?.value }}\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Chave Pix -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.pixKey\" pEditableColumnField=\"pixKey\"\n [ngClass]=\"{'required': item.pixKeyType.key !== 'BANK_ACCOUNT',\n 'disabled': item.pixKeyType && item.pixKeyType.key === 'BANK_ACCOUNT'\n }\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <ng-container [ngSwitch]=\"item.pixKeyType.key\">\n <input *ngSwitchCase=\"'TELEPHONE'\"\n only-number\n pInputText\n type=\"text\"\n formControlName=\"pixKey\"\n (keyup)=\"phoneMask($event)\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n maxlength=\"15\"\n placeholder=\"(__) ____-____\" />\n\n <input *ngSwitchCase=\"'CPF'\"\n type=\"text\"\n pInputText\n formControlName=\"pixKey\"\n maxlength=\"14\"\n placeholder=\"___.___.___-__\"\n (input)=\"onPixKeyInput($event, rowIndex)\"\n (blur)=\"onBlurPixCpfAndCnpj(rowIndex)\"\n (keyup)=\"cpfMask($event)\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\" />\n\n <input *ngSwitchCase=\"'CNPJ'\"\n type=\"text\"\n pInputText\n formControlName=\"pixKey\"\n maxlength=\"18\"\n placeholder=\"___.___.___/____-__\"\n (input)=\"onPixKeyInput($event, rowIndex)\"\n (blur)=\"onBlurPixCpfAndCnpj(rowIndex)\"\n (keyup)=\"cnpjMask($event)\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\" />\n\n <input *ngSwitchCase=\"'EMAIL'\"\n pInputText\n type=\"email\"\n formControlName=\"pixKey\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n placeholder=\"{{ 'hcm.payroll.employees_addition_email' | translate }}\" />\n\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\"\n pInputText\n formControlName=\"pixKey\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n [disabled]=\"true\" />\n\n <input *ngSwitchDefault\n pInputText\n type=\"text\"\n formControlName=\"pixKey\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n maxlength=\"100\" />\n </ng-container>\n\n <s-control-errors *ngIf=\"isShowPixKeyFieldValidatorMessage\"\n [control]=\"formGroupByRow[rowIndex]?.get('pixKey')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n invalidPhoneNumber: 'hcm.payroll.employees_addition_invalid_phone_number' | translate: { value: formGroupByRow[rowIndex]?.get('pixKey').value },\n invalidEmail: 'hcm.payroll.employees_addition_email_invalid' | translate,\n cpfNotValid: 'hcm.payroll.employees_addition_cpf_error' | translate,\n cnpjNotValid: 'hcm.payroll.employees_addition_cnpj_error' | translate\n }\">\n </s-control-errors>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ getFormattedPixKey(item.pixKeyType?.key, item.pixKey) }}\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Percentual -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.percentage\" pEditableColumnField=\"percentage\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <input\n pInputText type=\"number\"\n formControlName=\"percentage\"\n (ngModelChange)=\"onSyncValue('percentage', rowIndex)\"\n >\n <s-control-errors\n [control]=\"formGroupByRow[rowIndex]?.get('percentage')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n maxlength: 'hcm.payroll.error_max_length' | translate: { value: '6' },\n max: 'hcm.payroll.error_max_value_number' | translate: { value: maxValuePercentage },\n min: 'hcm.payroll.error_min_value_number' | translate: { value: '0,01' }\n }\">\n </s-control-errors>\n </ng-template>\n <ng-template pTemplate=\"output\">\n {{ item.percentage?.toFixed(2).replace('.', ',') }}%\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Bot\u00E3o de excluir -->\n <td>\n <s-button\n id=\"btn-delete\"\n label=\"{{ 'hcm.payroll.delete' | translate }}\"\n priority=\"default\"\n (onClick)=\"deletePix(rowIndex)\">\n </s-button>\n </td>\n </tr>\n </ng-container>\n </ng-template>\n </p-table>\n</div>\n",
9459
+ 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 && !isViewMode\">\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 [permitsEditBankAccountForm]=\"permitsEditBankAccount\"\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 *ngIf=\"!isViewMode\" [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=\"!isViewMode\" 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 && !isViewMode\">\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",
9638
9460
  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}"]
9639
9461
  })
9640
9462
  ], HistoricalPixAccountComponent);
9641
9463
 
9642
- let HistoricalPixAccountFormComponent = class HistoricalPixAccountFormComponent extends HistoricakPixAccountBase {
9643
- constructor(formBuilder, cd, sharedStateService) {
9644
- super(formBuilder);
9645
- this.cd = cd;
9646
- this.sharedStateService = sharedStateService;
9647
- this.withSideBar = true;
9648
- this.isEditMode = false;
9649
- this.showField = false;
9650
- this.visibleChange = new EventEmitter();
9651
- this.pixAccountItemToList = new EventEmitter();
9652
- this.ngUnsubscribe = new Subject();
9653
- this.labelBtnAdd = "hcm.payroll.employees_add";
9654
- this.visibleBtnSave = true;
9655
- this.isView = false;
9656
- this.isShowPixKeyFieldValidatorMessage = false;
9657
- this.hideFields = this.sharedStateService.hideField$;
9658
- this.registerSubjects();
9659
- }
9660
- ngOnInit() { }
9661
- ngAfterViewInit() {
9662
- this.cd.detectChanges();
9663
- }
9664
- ngOnDestroy() {
9665
- this.ngUnsubscribe.next(true);
9666
- this.ngUnsubscribe.unsubscribe();
9667
- }
9668
- registerSubjects() { }
9669
- get visible() {
9670
- return this._visible;
9671
- }
9672
- set visible(value) {
9673
- this._visible = value;
9674
- this.visibleChange.emit(this.visible);
9675
- }
9676
- set isEditAndViewValue(value) {
9677
- this.resetForm();
9678
- this.visibleBtnSave = true;
9679
- if (value && value.currentItem && Object.keys(value.currentItem).length) {
9680
- this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(Object.assign({}, value.currentItem)));
9681
- this.labelBtnAdd = "hcm.payroll.employees_update";
9682
- this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
9683
- if (!this.isView) {
9684
- this.configEnableFields(value && value["isEditMode"]);
9685
- }
9686
- else {
9687
- if (this.pixAccountFormGroup.get("pixKeyType").value) {
9688
- this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9689
- this.formatPixKeyTelephoneNumber();
9690
- }
9691
- }
9692
- }
9693
- else {
9694
- this.labelBtnAdd = "hcm.payroll.employees_add";
9695
- }
9696
- }
9697
- formatPixKeyTelephoneNumber() {
9698
- if (this.pixKeyType === "TELEPHONE") {
9699
- const pixKeyCtrl = this.pixAccountFormGroup.get("pixKey");
9700
- pixKeyCtrl.setValue(FormatUtilsService.getFormattedTelephoneNumber(pixKeyCtrl.value));
9701
- }
9702
- }
9703
- convertDTOToShowWithCustomFields(data) {
9704
- const obj = Object.assign({}, data);
9705
- obj["customFields"] = mountCustomToShow(obj["customFields"]);
9706
- return obj;
9707
- }
9708
- configEnableFields(isEditMode) {
9709
- this.visibleBtnSave = isEditMode;
9710
- if (this.pixAccountFormGroup.get("pixKeyType").value) {
9711
- this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9712
- this.setPixKeyValidators(isEditMode, this.pixAccountFormGroup);
9713
- this.formatPixKeyTelephoneNumber();
9714
- }
9715
- configEnabledFields(this.pixAccountFormGroup, isEditMode, [
9716
- "pixKeyType",
9717
- "pixKey",
9718
- "percentage",
9719
- "customFields"
9720
- ], []);
9721
- }
9722
- close() {
9723
- this.resetForm();
9724
- this.visible = false;
9725
- }
9726
- addItem() {
9727
- if (this.pixAccountFormGroup.valid) {
9728
- if (this.employeeId) {
9729
- this.pixAccountFormGroup.get("employee").setValue({
9730
- tableId: this.employeeId,
9731
- name: ""
9732
- });
9733
- }
9734
- this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
9735
- this.visible = false;
9736
- this.resetForm();
9737
- }
9738
- }
9739
- resetForm() {
9740
- this.pixAccountFormGroup.reset();
9741
- this.labelBtnAdd = "hcm.payroll.employees_add";
9742
- if (this.customFields && this.customFields.formGroup)
9743
- this.customFields.formGroup.reset();
9744
- }
9745
- get percentagePlaceholder() {
9746
- return `0${this.currency && this.currency.decimalSeparator}00`;
9747
- }
9748
- get optionsPercentage() {
9749
- return Object.assign({}, this.getOptions(), { precision: 2 });
9750
- }
9751
- getOptions() {
9752
- return {
9753
- prefix: "",
9754
- thousands: this.currency.thousandsSeparator,
9755
- decimal: this.currency.decimalSeparator
9756
- };
9757
- }
9758
- set getListPixAccount(pixAccountList) {
9759
- if (pixAccountList) {
9760
- this.setValidatorsAccordingList(pixAccountList, null, false);
9761
- }
9762
- else {
9763
- this.resetForm();
9764
- }
9765
- }
9766
- set isViewMode(condition) {
9767
- this.isView = !!(condition && !this.withSideBar);
9768
- this.configEnableFields(!this.isView);
9769
- if (!this.isView)
9770
- this.resetForm();
9771
- }
9772
- set paramsForm(value) {
9773
- this._paramsForm = value;
9464
+ let HistoricalPixAccountService = class HistoricalPixAccountService {
9465
+ constructor(http) {
9466
+ this.http = http;
9774
9467
  }
9775
- set defaultCpfNumber(value) {
9776
- this._defaultCpfNumber = value;
9468
+ query(path, body, service = ServiceType.PAYROLL) {
9469
+ return this.http.query(path, body, service);
9777
9470
  }
9778
9471
  };
9779
- HistoricalPixAccountFormComponent.ctorParameters = () => [
9780
- { type: FormBuilder },
9781
- { type: ChangeDetectorRef },
9782
- { type: SharedStateService }
9472
+ HistoricalPixAccountService.ctorParameters = () => [
9473
+ { type: HttpClientService }
9783
9474
  ];
9784
- __decorate([
9785
- ViewChild(CustomFieldsComponent$1, { static: true })
9786
- ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
9787
- __decorate([
9788
- Input()
9789
- ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
9790
- __decorate([
9791
- Input()
9792
- ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
9793
- __decorate([
9794
- Input()
9795
- ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
9796
- __decorate([
9797
- Input()
9798
- ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
9799
- __decorate([
9800
- Input()
9801
- ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
9802
- __decorate([
9803
- Input()
9804
- ], HistoricalPixAccountFormComponent.prototype, "showField", void 0);
9805
- __decorate([
9806
- Output()
9807
- ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
9808
- __decorate([
9809
- Output()
9810
- ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
9811
- __decorate([
9812
- Input()
9813
- ], HistoricalPixAccountFormComponent.prototype, "visible", null);
9814
- __decorate([
9815
- Input()
9816
- ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
9817
- __decorate([
9818
- Input()
9819
- ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
9820
- __decorate([
9821
- Input()
9822
- ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
9823
- __decorate([
9824
- Input()
9825
- ], HistoricalPixAccountFormComponent.prototype, "paramsForm", null);
9826
- __decorate([
9827
- Input()
9828
- ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", null);
9829
- HistoricalPixAccountFormComponent = __decorate([
9830
- Component({
9831
- selector: "pix-account",
9832
- 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",
9833
- 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}"]
9834
- })
9835
- ], HistoricalPixAccountFormComponent);
9475
+ HistoricalPixAccountService = __decorate([
9476
+ Injectable()
9477
+ ], HistoricalPixAccountService);
9836
9478
 
9837
9479
  let HistoricalPixAccountModule = class HistoricalPixAccountModule {
9838
9480
  };
@@ -9861,8 +9503,6 @@ HistoricalPixAccountModule = __decorate([
9861
9503
  CustomFieldsModule$1,
9862
9504
  PanelModule,
9863
9505
  InputMaskModule,
9864
- DropdownModule,
9865
- TabViewModule,
9866
9506
  ],
9867
9507
  declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
9868
9508
  providers: [HistoricalPixAccountService, ConfirmationService],
@@ -9901,7 +9541,7 @@ HistoricalPixAccountListService = __decorate([
9901
9541
 
9902
9542
  const moment$e = moment_;
9903
9543
  let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent {
9904
- constructor(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService, sharedStateService) {
9544
+ constructor(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService) {
9905
9545
  this.confirmationService = confirmationService;
9906
9546
  this.translateService = translateService;
9907
9547
  this.activatedRoute = activatedRoute;
@@ -9909,14 +9549,13 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9909
9549
  this.router = router;
9910
9550
  this.messageService = messageService;
9911
9551
  this.historicalPixAccountListService = historicalPixAccountListService;
9912
- this.sharedStateService = sharedStateService;
9913
9552
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
9914
9553
  this.keyPayload = "historicalEmployeePix";
9915
9554
  this.withSidebar = true;
9916
9555
  this.isOnlyView = new EventEmitter();
9917
9556
  this.isOnlyEdit = new EventEmitter();
9918
9557
  this.enableView = new EventEmitter();
9919
- this.isEditJudicialDependentPix = new EventEmitter();
9558
+ this.enableEdit = new EventEmitter();
9920
9559
  this.ngUnsubscribe = new Subject();
9921
9560
  this.loading = true;
9922
9561
  this.columns = [
@@ -9936,7 +9575,6 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9936
9575
  ngOnDestroy() {
9937
9576
  this.ngUnsubscribe.next();
9938
9577
  this.ngUnsubscribe.complete();
9939
- this.unsubscribe();
9940
9578
  }
9941
9579
  ngAfterViewInit() {
9942
9580
  this.cd.detectChanges();
@@ -9954,20 +9592,14 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9954
9592
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9955
9593
  command: () => {
9956
9594
  if (this.isAllowToViewHistorical) {
9957
- this.sharedStateService.setHideField(true);
9958
- this.sharedStateService.setShowButton(false);
9959
- this.sharedStateService.setShowEditMode(false);
9960
9595
  const dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, this.dateFormat).format("YYYY-MM-DD");
9961
9596
  if (this.withSidebar) {
9962
9597
  this.isOnlyView.emit(true);
9963
- this.isOnlyEdit.emit(false);
9964
- this.sharedStateService.setHideBtnAddForViewMode(true);
9965
9598
  this.router.navigate([`historical-pix-account/${dateChange}`], {
9966
9599
  relativeTo: this.activatedRoute,
9967
9600
  });
9968
9601
  }
9969
9602
  else {
9970
- this.sharedStateService.setSaveButton(false);
9971
9603
  this.enableView.emit(dateChange);
9972
9604
  }
9973
9605
  }
@@ -9980,25 +9612,16 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9980
9612
  label: this.translateService.instant("hcm.payroll.edit"),
9981
9613
  command: () => {
9982
9614
  if (this.isAllowToEditHistorical) {
9983
- this.sharedStateService.setHideField(true);
9984
- this.sharedStateService.setShowButton(false);
9985
- this.sharedStateService.setShowEditMode(true);
9986
9615
  const dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, this.dateFormat).format("YYYY-MM-DD");
9987
9616
  if (this.withSidebar) {
9988
9617
  this.isOnlyView.emit(false);
9989
9618
  this.isOnlyEdit.emit(true);
9990
- this.sharedStateService.setHideBtnAddForViewMode(false);
9991
9619
  this.router.navigate([`historical-pix-account/${dateChange}`], {
9992
9620
  relativeTo: this.activatedRoute,
9993
9621
  });
9994
- this.sharedStateService.setShouldReloadWindowOnlyEditMode(true);
9995
9622
  }
9996
9623
  else {
9997
- setTimeout(() => {
9998
- this.sharedStateService.triggerActiveValidatorsOnEditModalOpen();
9999
- });
10000
- this.sharedStateService.setSaveButton(true);
10001
- this.enableView.emit(dateChange);
9624
+ this.enableEdit.emit(dateChange);
10002
9625
  }
10003
9626
  }
10004
9627
  else {
@@ -10082,19 +9705,6 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
10082
9705
  this.lastRecord = payload[0];
10083
9706
  }
10084
9707
  }
10085
- unsubscribe() {
10086
- if (this._subscription) {
10087
- this._subscription.unsubscribe();
10088
- }
10089
- }
10090
- set hideFieldsOnAdd$(subject) {
10091
- this.unsubscribe();
10092
- if (subject) {
10093
- this._subscription = subject.subscribe((value) => {
10094
- this.sharedStateService.setHideField(value);
10095
- });
10096
- }
10097
- }
10098
9708
  get isAllowToAddHistorical() {
10099
9709
  return (this.permission["incluir"]);
10100
9710
  }
@@ -10124,8 +9734,7 @@ HistoricalPixAccountListComponent.ctorParameters = () => [
10124
9734
  { type: ChangeDetectorRef },
10125
9735
  { type: Router },
10126
9736
  { type: MessageService },
10127
- { type: HistoricalPixAccountListService },
10128
- { type: SharedStateService }
9737
+ { type: HistoricalPixAccountListService }
10129
9738
  ];
10130
9739
  __decorate([
10131
9740
  ViewChild(CustomFieldsComponent$1, { static: false })
@@ -10151,9 +9760,6 @@ __decorate([
10151
9760
  __decorate([
10152
9761
  Input()
10153
9762
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
10154
- __decorate([
10155
- Input()
10156
- ], HistoricalPixAccountListComponent.prototype, "hideField", void 0);
10157
9763
  __decorate([
10158
9764
  Output()
10159
9765
  ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
@@ -10165,10 +9771,7 @@ __decorate([
10165
9771
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
10166
9772
  __decorate([
10167
9773
  Output()
10168
- ], HistoricalPixAccountListComponent.prototype, "isEditJudicialDependentPix", void 0);
10169
- __decorate([
10170
- Input()
10171
- ], HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", null);
9774
+ ], HistoricalPixAccountListComponent.prototype, "enableEdit", void 0);
10172
9775
  __decorate([
10173
9776
  Input()
10174
9777
  ], HistoricalPixAccountListComponent.prototype, "reloadList", null);
@@ -10213,5 +9816,5 @@ HistoricalPixAccountListModule = __decorate([
10213
9816
  * Generated bundle index. Do not edit.
10214
9817
  */
10215
9818
 
10216
- 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 };
9819
+ 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 };
10217
9820
  //# sourceMappingURL=senior-gestao-pessoas-payroll-core.js.map