@senior-gestao-pessoas/payroll-core 9.5.0 → 9.6.0-feature-hcmgdp-11604-e0af4f68

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 (22) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +853 -808
  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 -1
  4. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js.map +1 -1
  5. package/components/employee-summary/employee-summary.service.d.ts +1 -0
  6. package/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.d.ts +4 -2
  7. package/components/historical-pix-account/historical-pix-account.component.d.ts +5 -1
  8. package/components/historical-pix-account-list/historical-pix-account-list.component.d.ts +1 -0
  9. package/esm2015/components/employee-summary/employee-summary.service.js +4 -1
  10. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +18 -3
  11. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +30 -7
  12. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.component.js +6 -2
  13. package/esm5/components/employee-summary/employee-summary.service.js +4 -1
  14. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +19 -3
  15. package/esm5/components/historical-pix-account/historical-pix-account.component.js +30 -7
  16. package/esm5/components/historical-pix-account-list/historical-pix-account-list.component.js +6 -2
  17. package/fesm2015/senior-gestao-pessoas-payroll-core.js +808 -764
  18. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  19. package/fesm5/senior-gestao-pessoas-payroll-core.js +853 -808
  20. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  21. package/package.json +1 -1
  22. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
@@ -1039,6 +1039,9 @@ let EmployeeSummaryService = class EmployeeSummaryService {
1039
1039
  findEmployeeAutoComplete(path, terms) {
1040
1040
  return this.http.post(`hcm/payroll/queries/${path}`, { valueSearch: terms });
1041
1041
  }
1042
+ getEmployeeDocuments(path, employeeId) {
1043
+ return this.http.post(`hcm/payroll/queries/${path}`, { employeeId: employeeId });
1044
+ }
1042
1045
  blobServiceRequestAccess(path, body) {
1043
1046
  return this.http.post(`hcm/payroll/actions/${path}`, body);
1044
1047
  }
@@ -8521,267 +8524,240 @@ class FormatUtilsService {
8521
8524
  }
8522
8525
  }
8523
8526
 
8524
- let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8525
- constructor(translateService, cd, formBuilder, messageService) {
8526
- this.translateService = translateService;
8527
- this.cd = cd;
8528
- this.formBuilder = formBuilder;
8529
- this.messageService = messageService;
8530
- this.recordByRow = 1;
8531
- this.showDateChange = false;
8532
- this.isEditMode = false;
8533
- this.isViewMode = false;
8534
- this.withSideBar = true;
8535
- this.defaultCpfNumber = null;
8536
- this.listDataReciever = [];
8537
- this.isViewModeActive = new EventEmitter();
8538
- this.isEditModeActive = new EventEmitter();
8539
- this.isDeleteModeActive = new EventEmitter();
8540
- this.listFromApp = [];
8541
- this.visibleChange = new EventEmitter();
8542
- this.ngUnsubscribe = new Subject();
8543
- this.orderBy = {
8544
- field: "dateChange",
8545
- direction: DirectionEnumeration.DESC,
8546
- };
8547
- this.pixAccountItemInput = {};
8548
- this.totalRecords = 0;
8549
- this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
8550
- this.loading = true;
8551
- this.listData = [];
8552
- this.listDataNoPage = [];
8553
- this.cols = [
8554
- {
8555
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
8556
- field: "pixKeyType",
8557
- },
8558
- {
8559
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
8560
- field: "pixKey",
8561
- },
8562
- {
8563
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
8564
- field: "percentage",
8565
- },
8566
- ];
8567
- this.actions = (rowData = {}, key) => {
8568
- return [
8569
- {
8570
- visible: this.isEditMode,
8571
- label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
8572
- command: () => {
8573
- if (this.isAllowToViewHistorical) {
8574
- rowData["index"] = key;
8575
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: false };
8576
- this.visible = true;
8577
- }
8578
- else {
8579
- this.isViewModeActive.emit(true);
8580
- }
8581
- },
8582
- },
8583
- {
8584
- visible: !!(!this.isEditMode && this.withSideBar),
8585
- label: this.translateService.instant("hcm.payroll.edit"),
8586
- command: () => {
8587
- if (this.isAllowToEditHistorical) {
8588
- rowData["index"] = key;
8589
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8590
- this.visible = true;
8591
- }
8592
- else {
8593
- this.isEditModeActive.emit(true);
8594
- if (this.listFromApp.length == 0) {
8595
- rowData["index"] = key;
8596
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8597
- this.visible = true;
8598
- }
8599
- }
8600
- },
8601
- },
8602
- {
8603
- visible: !this.isEditMode,
8604
- label: this.translateService.instant("hcm.payroll.delete"),
8605
- command: () => {
8606
- if (this.isAllowToDeleteHistorical) {
8607
- this.loading = true;
8608
- this.deleteAnnuityItem(key);
8609
- }
8610
- else {
8611
- this.isDeleteModeActive.emit(true);
8612
- if (this.listFromApp.length == 0) {
8613
- this.loading = true;
8614
- this.deleteAnnuityItem(key);
8615
- }
8616
- }
8617
- },
8618
- },
8619
- ];
8620
- };
8621
- this.createFormGroup();
8622
- }
8623
- ngOnInit() {
8624
- this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
8625
- }
8626
- ngOnChanges(changes) {
8627
- if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
8628
- this.listFromApp = changes['listDataReciever'].currentValue;
8629
- }
8630
- }
8631
- createFormGroup() {
8632
- this.historicalPixAccountList = this.formBuilder.group({
8633
- historicalPixAccountList: this.formBuilder.control(null),
8634
- });
8635
- }
8636
- ngOnDestroy() {
8637
- this.ngUnsubscribe.next();
8638
- this.ngUnsubscribe.complete();
8639
- }
8640
- ngAfterViewInit() {
8641
- this.cd.detectChanges();
8642
- }
8643
- onLazyLoad(event) {
8644
- const first = event && event.first ? event.first : 0;
8645
- const rows = event && event.rows ? event.rows : this.recordByRow;
8646
- const arrList = this.getHistoricalPixAccountList();
8647
- this.listData = [];
8648
- this.totalRecords = null;
8649
- if (event && event.multiSortMeta && event.multiSortMeta.length) {
8650
- event.multiSortMeta.map((value) => {
8651
- this.orderBy.field = value.field;
8652
- this.orderBy.direction = value.order === 1 ? DirectionEnumeration.ASC : DirectionEnumeration.DESC;
8653
- });
8654
- }
8655
- if (arrList && arrList.length) {
8656
- this.totalRecords = arrList.length;
8657
- this.listData = arrList;
8658
- this.listDataNoPage = [...arrList];
8659
- this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
8660
- this.listData = this.listData.slice(first, (first + rows));
8661
- }
8527
+ class GenericValidator {
8528
+ constructor() { }
8529
+ /**
8530
+ * Valida o CEI (Cadastro específico de INSS) digitado.
8531
+ */
8532
+ static isValidCei(control) {
8533
+ const cei = control.value;
8534
+ if (!cei)
8535
+ return null;
8536
+ else if (cei.length != 11)
8537
+ return null;
8538
+ const multiplicadorBase = "3298765432";
8539
+ let total = 0;
8540
+ let resto = 0;
8541
+ let multiplicando = 0;
8542
+ let multiplicador = 0;
8543
+ if (cei.length !== 11 ||
8544
+ cei === "00000000000" ||
8545
+ cei === "11111111111" ||
8546
+ cei === "22222222222" ||
8547
+ cei === "33333333333" ||
8548
+ cei === "44444444444" ||
8549
+ cei === "55555555555" ||
8550
+ cei === "66666666666" ||
8551
+ cei === "77777777777" ||
8552
+ cei === "88888888888" ||
8553
+ cei === "99999999999")
8554
+ return { invalidCei: true };
8662
8555
  else {
8663
- this.listDataNoPage = [];
8664
- }
8665
- if (this.isEditMode || arrList && arrList.length === 1) {
8666
- this.refreshCssInIE11();
8556
+ for (let i = 0; i < 10; i++) {
8557
+ multiplicando = parseInt(cei.substring(i, i + 1), 10);
8558
+ multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
8559
+ total += multiplicando * multiplicador;
8560
+ }
8561
+ resto = 11 - (total % 11);
8562
+ resto = resto === 10 || resto === 11 ? 0 : resto;
8563
+ const digito = parseInt("" + cei.charAt(10), 10);
8564
+ return resto === digito ? null : { invalidCei: true };
8667
8565
  }
8668
- this.loading = false;
8669
8566
  }
8670
8567
  /**
8671
- * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
8568
+ * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
8672
8569
  */
8673
- refreshCssInIE11() {
8674
- if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
8675
- setTimeout(() => {
8676
- const row = document.getElementsByClassName("row0");
8677
- if (row && row[0])
8678
- row[0].className = 'refresh';
8679
- }, 1);
8570
+ static isValidCpf(control) {
8571
+ const cpf = control.value;
8572
+ if (cpf) {
8573
+ let numbers, digits, sum, i, result, equalDigits;
8574
+ equalDigits = 1;
8575
+ if (cpf.length < 11) {
8576
+ return null;
8577
+ }
8578
+ for (i = 0; i < cpf.length - 1; i++) {
8579
+ if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
8580
+ equalDigits = 0;
8581
+ break;
8582
+ }
8583
+ }
8584
+ if (!equalDigits) {
8585
+ numbers = cpf.substring(0, 9);
8586
+ digits = cpf.substring(9);
8587
+ sum = 0;
8588
+ for (i = 10; i > 1; i--) {
8589
+ sum += numbers.charAt(10 - i) * i;
8590
+ }
8591
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8592
+ if (result !== Number(digits.charAt(0))) {
8593
+ return { cpfNotValid: true };
8594
+ }
8595
+ numbers = cpf.substring(0, 10);
8596
+ sum = 0;
8597
+ for (i = 11; i > 1; i--) {
8598
+ sum += numbers.charAt(11 - i) * i;
8599
+ }
8600
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8601
+ if (result !== Number(digits.charAt(1))) {
8602
+ return { cpfNotValid: true };
8603
+ }
8604
+ return null;
8605
+ }
8606
+ else {
8607
+ return { cpfNotValid: true };
8608
+ }
8680
8609
  }
8610
+ return null;
8681
8611
  }
8682
- add() {
8683
- this.pixAccountItemInput = {};
8684
- this.visible = true;
8685
- }
8686
- isNotAllowMessage() {
8687
- this.messageService.add({
8688
- severity: "error",
8689
- summary: this.translateService.instant("hcm.payroll.error"),
8690
- detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
8691
- });
8692
- }
8693
- deleteAnnuityItem(index) {
8694
- let newlist = [...this.getHistoricalPixAccountList()];
8695
- newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
8696
- delete newlist[index];
8697
- newlist = newlist.filter(val => val);
8698
- this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
8699
- this.verifyTotalPercentage();
8700
- this.onLazyLoad();
8701
- }
8702
- getHistoricalPixAccountList() {
8703
- if (this.historicalPixAccountList.get("historicalPixAccountList") &&
8704
- this.historicalPixAccountList.get("historicalPixAccountList").value &&
8705
- this.historicalPixAccountList.get("historicalPixAccountList").value.length)
8706
- return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
8707
- else
8708
- return [];
8709
- }
8710
- addItemInList($event) {
8711
- const index = $event && $event.index >= 0 ? $event.index : null;
8712
- const newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
8713
- if (index != null) {
8714
- newDataList[index] = $event;
8715
- delete $event.index;
8716
- }
8717
- else {
8718
- if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
8719
- const customValue = mountCustomToSave($event["customFields"]);
8720
- $event["customFields"] = [...customValue];
8612
+ /**
8613
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
8614
+ */
8615
+ static isValidCnpj(control) {
8616
+ let cnpj = control.value;
8617
+ if (cnpj) {
8618
+ let size, numbers, digits, sum, pos, result;
8619
+ cnpj = cnpj.replace(/[^\d]+/g, '');
8620
+ if (cnpj.length !== 14) {
8621
+ return null;
8721
8622
  }
8722
- $event["dateChange"] = this.dateChange;
8723
- newDataList.push($event);
8724
- }
8725
- this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
8726
- this.verifyTotalPercentage();
8727
- this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
8728
- }
8729
- getNumberPageByIndex(index, list) {
8730
- if (index) {
8731
- const total = list.length;
8732
- const sub = this.recordByRow - 1;
8733
- return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
8623
+ // Elimina CNPJs invalidos conhecidos
8624
+ if (cnpj === '00000000000000' ||
8625
+ cnpj === '11111111111111' ||
8626
+ cnpj === '22222222222222' ||
8627
+ cnpj === '33333333333333' ||
8628
+ cnpj === '44444444444444' ||
8629
+ cnpj === '55555555555555' ||
8630
+ cnpj === '66666666666666' ||
8631
+ cnpj === '77777777777777' ||
8632
+ cnpj === '88888888888888' ||
8633
+ cnpj === '99999999999999') {
8634
+ return { cnpjNotValid: true };
8635
+ }
8636
+ // Valida DVs
8637
+ size = cnpj.length - 2;
8638
+ numbers = cnpj.substring(0, size);
8639
+ digits = cnpj.substring(size);
8640
+ sum = 0;
8641
+ pos = size - 7;
8642
+ for (let i = size; i >= 1; i--) {
8643
+ sum += numbers.charAt(size - i) * pos--;
8644
+ if (pos < 2) {
8645
+ pos = 9;
8646
+ }
8647
+ }
8648
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8649
+ if (result !== Number(digits.charAt(0))) {
8650
+ return { cnpjNotValid: true };
8651
+ }
8652
+ size = size + 1;
8653
+ numbers = cnpj.substring(0, size);
8654
+ sum = 0;
8655
+ pos = size - 7;
8656
+ for (let i = size; i >= 1; i--) {
8657
+ sum += numbers.charAt(size - i) * pos--;
8658
+ if (pos < 2) {
8659
+ pos = 9;
8660
+ }
8661
+ }
8662
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8663
+ if (result !== Number(digits.charAt(1))) {
8664
+ return { cnpjNotValid: true };
8665
+ }
8666
+ return null;
8734
8667
  }
8735
8668
  return null;
8736
8669
  }
8737
- verifyTotalPercentage() {
8738
- const list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
8739
- const arrayPercentage = [];
8740
- if (!list.length)
8741
- return this.msgTotalLimitByPercentage = null;
8742
- list.filter((item) => arrayPercentage.push(item && item["percentage"]));
8743
- const sumPercentage = arrayPercentage.reduce((total, percentage) => {
8744
- return total + percentage;
8745
- }, 0);
8746
- if (sumPercentage === 100) {
8747
- this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
8748
- }
8749
- else {
8750
- this.msgTotalLimitByPercentage = null;
8751
- }
8752
- }
8753
- get scopedActions() {
8754
- return this.actions.bind(this);
8670
+ /**
8671
+ * Válida o número de telefone da chave PIX.
8672
+ */
8673
+ static isValidPhoneNumber(control) {
8674
+ let cellPhoneKey = control.value || '';
8675
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
8676
+ const regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
8677
+ const isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
8678
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
8755
8679
  }
8756
- get recordsMessage() {
8757
- return `${this.totalRecords || 0} ${this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers")}`;
8680
+ /**
8681
+ * Valida o email da chave PIX.
8682
+ */
8683
+ static isValidEmail(control) {
8684
+ const emailKey = control.value;
8685
+ const regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
8686
+ const isValidEmail = regexValidEmail.test(emailKey);
8687
+ return isValidEmail ? null : { invalidEmail: true };
8758
8688
  }
8759
- get getTooltipAndDisableButtonAdd() {
8760
- return this.dateChange ? null : this.msgTooltipAdd;
8689
+ }
8690
+
8691
+ let HistoricalPixAccountFormComponent = class HistoricalPixAccountFormComponent {
8692
+ constructor(formBuilder, cd) {
8693
+ this.formBuilder = formBuilder;
8694
+ this.cd = cd;
8695
+ this.withSideBar = true;
8696
+ this.isEditMode = false;
8697
+ this.paramsForm = new FormGroup({});
8698
+ this.defaultCpfNumber = null;
8699
+ this.permitsEditBankAccountForm = false;
8700
+ this.visibleChange = new EventEmitter();
8701
+ this.pixAccountItemToList = new EventEmitter();
8702
+ this.ngUnsubscribe = new Subject();
8703
+ this.initialValidatorOfPercentage = [Validators.required, Validators.min(0.01)];
8704
+ this.labelBtnAdd = "hcm.payroll.employees_add";
8705
+ this.maxValuePercentage = 100.00;
8706
+ this.visibleBtnSave = true;
8707
+ this.isView = false;
8708
+ this.isShowPixKeyFieldValidatorMessage = false;
8709
+ this.createFormGroup();
8710
+ this.registerSubjects();
8761
8711
  }
8762
- get dateChange() {
8763
- return this._dateChange;
8712
+ ngOnInit() {
8764
8713
  }
8765
- set dateChange(value) {
8766
- this._dateChange = value;
8767
- if (this._dateChange) {
8768
- this.listData.filter((row) => row["dateChange"] = this._dateChange);
8714
+ ngDoCheck() {
8715
+ if (this.pixAccountFormGroup && this.pixKeyType === "BANK_ACCOUNT") {
8716
+ const pixKeyControl = this.pixAccountFormGroup.get("pixKey");
8717
+ if (pixKeyControl && !pixKeyControl.disabled) {
8718
+ pixKeyControl.disable();
8719
+ }
8769
8720
  }
8770
8721
  }
8771
- get displayDateChange() {
8772
- return this._displayDateChange;
8722
+ ngAfterViewInit() {
8723
+ this.cd.detectChanges();
8773
8724
  }
8774
- set displayDateChange(value) {
8775
- this._displayDateChange = value;
8776
- if (this._displayDateChange) {
8777
- this.listData.filter((row) => row["displayDateChange"] = this._displayDateChange);
8725
+ ngOnDestroy() {
8726
+ this.ngUnsubscribe.next(true);
8727
+ this.ngUnsubscribe.unsubscribe();
8728
+ }
8729
+ registerSubjects() {
8730
+ }
8731
+ createFormGroup() {
8732
+ this.pixAccountFormGroup = this.formBuilder.group({
8733
+ id: this.formBuilder.control(null),
8734
+ index: this.formBuilder.control(null),
8735
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
8736
+ dateChange: this.formBuilder.control(null),
8737
+ pixKeyType: this.formBuilder.control(null, Validators.required),
8738
+ pixKey: this.formBuilder.control(null),
8739
+ percentage: this.formBuilder.control(null, Validators.compose([
8740
+ ...this.initialValidatorOfPercentage,
8741
+ Validators.max(this.maxValuePercentage),
8742
+ ])),
8743
+ externalId: this.formBuilder.control(null),
8744
+ customFields: this.formBuilder.control(null),
8745
+ });
8746
+ }
8747
+ onChangePixKeyType(item) {
8748
+ if (item.key) {
8749
+ this.pixKeyType = item.key;
8750
+ this.isShowPixKeyFieldValidatorMessage = true;
8751
+ this.pixAccountFormGroup.get("pixKey").reset();
8752
+ this.setPixKeyValidators(true);
8753
+ if (item.key === "CPF") {
8754
+ this.setDefaultCpfPixKey();
8755
+ }
8778
8756
  }
8779
8757
  }
8780
- set addListData(list) {
8781
- this.loading = true;
8782
- this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
8783
- this.verifyTotalPercentage();
8784
- this.onLazyLoad();
8758
+ onClearPixKeyType() {
8759
+ this.isShowPixKeyFieldValidatorMessage = false;
8760
+ this.pixAccountFormGroup.get("pixKey").reset();
8785
8761
  }
8786
8762
  get visible() {
8787
8763
  return this._visible;
@@ -8790,639 +8766,703 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8790
8766
  this._visible = value;
8791
8767
  this.visibleChange.emit(this.visible);
8792
8768
  }
8793
- close() {
8794
- this.visible = false;
8795
- }
8796
- getFormattedTelephoneNumber(telephoneNumber) {
8797
- return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
8798
- }
8799
- getFormattedCpf(cpf) {
8800
- return FormatUtilsService.getFormattedCpf(cpf);
8801
- }
8802
- getFormattedCnpj(cnpj) {
8803
- return FormatUtilsService.getFormattedCnpj(cnpj);
8769
+ set isEditAndViewValue(value) {
8770
+ this.resetForm();
8771
+ this.visibleBtnSave = true;
8772
+ if (value && value.permitsEditBankAccount) {
8773
+ this.permitsEditBankAccountForm = true;
8774
+ }
8775
+ if (value && value.currentItem && Object.keys(value.currentItem).length) {
8776
+ this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(Object.assign({}, value.currentItem)));
8777
+ this.labelBtnAdd = "hcm.payroll.employees_update";
8778
+ this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
8779
+ if (!this.isView) {
8780
+ this.configEnableFields(value && value["isEditMode"]);
8781
+ }
8782
+ else {
8783
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
8784
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
8785
+ this.formatPixKeyTelephoneNumber();
8786
+ }
8787
+ }
8788
+ }
8789
+ else {
8790
+ this.labelBtnAdd = "hcm.payroll.employees_add";
8791
+ }
8804
8792
  }
8805
- getFormattedPercentage(value) {
8806
- return FormatUtilsService.getFormattedPercentage(value);
8793
+ formatPixKeyTelephoneNumber() {
8794
+ if (this.pixKeyType === "TELEPHONE") {
8795
+ this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
8796
+ }
8807
8797
  }
8808
- get isAllowToAddHistorical() {
8809
- return (this.permission["incluir"]);
8798
+ convertDTOToShowWithCustomFields(data) {
8799
+ const obj = Object.assign({}, data);
8800
+ obj["customFields"] = mountCustomToShow(obj["customFields"]);
8801
+ return obj;
8810
8802
  }
8811
- get isAllowToDeleteHistorical() {
8812
- return (this.permission["excluir"]);
8803
+ configEnableFields(isEditMode) {
8804
+ this.visibleBtnSave = isEditMode;
8805
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
8806
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
8807
+ this.setPixKeyValidators(isEditMode);
8808
+ this.formatPixKeyTelephoneNumber();
8809
+ }
8810
+ configEnabledFields(this.pixAccountFormGroup, isEditMode, [
8811
+ "pixKeyType",
8812
+ "pixKey",
8813
+ "percentage",
8814
+ "customFields",
8815
+ ], []);
8813
8816
  }
8814
- get isAllowToEditHistorical() {
8815
- return (this.permission["editar"]);
8817
+ close() {
8818
+ this.resetForm();
8819
+ this.visible = false;
8816
8820
  }
8817
- get isAllowToViewHistorical() {
8818
- return (this.permission["visualizar"]);
8821
+ addItem() {
8822
+ this.pixAccountFormGroup.updateValueAndValidity();
8823
+ verifyValidationsForm.call(this.pixAccountFormGroup);
8824
+ if (this.pixAccountFormGroup.valid) {
8825
+ if (this.employeeId) {
8826
+ this.pixAccountFormGroup.get("employee").setValue({
8827
+ tableId: this.employeeId,
8828
+ name: "",
8829
+ });
8830
+ }
8831
+ this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
8832
+ this.visible = false;
8833
+ this.resetForm();
8834
+ }
8835
+ }
8836
+ resetForm() {
8837
+ this.pixAccountFormGroup.reset();
8838
+ this.labelBtnAdd = "hcm.payroll.employees_add";
8839
+ if (this.customFields && this.customFields.formGroup)
8840
+ this.customFields.formGroup.reset();
8841
+ }
8842
+ get percentagePlaceholder() {
8843
+ return `0${this.currency && this.currency.decimalSeparator}00`;
8844
+ }
8845
+ get optionsPercentage() {
8846
+ return Object.assign({}, this.getOptions(), { precision: 2 });
8847
+ }
8848
+ getOptions() {
8849
+ return {
8850
+ prefix: "",
8851
+ thousands: this.currency.thousandsSeparator,
8852
+ decimal: this.currency.decimalSeparator,
8853
+ };
8854
+ }
8855
+ /**
8856
+ * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
8857
+ * @param pixAccountList
8858
+ */
8859
+ set getListPixAccount(pixAccountList) {
8860
+ if (pixAccountList) {
8861
+ this.setValidatorsAccordingList(pixAccountList, null, false);
8862
+ }
8863
+ else {
8864
+ this.resetForm();
8865
+ }
8866
+ }
8867
+ /**
8868
+ * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
8869
+ * a validação dos campos "percentage" e "pixAccount".
8870
+ * 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
8871
+ * no array de comparação dos validators.
8872
+ * @param pixAccountList
8873
+ * @param index
8874
+ */
8875
+ setValidatorsAccordingList(pixAccountList, index = null, isEditMode = true) {
8876
+ this.pixAccountList = pixAccountList && pixAccountList.length ? [...pixAccountList] : [];
8877
+ const percentageIncluded = [];
8878
+ if (this.pixAccountList && this.pixAccountList.length) {
8879
+ this.pixAccountList.filter((field, key) => {
8880
+ if (field["percentage"] && key != index) {
8881
+ percentageIncluded.push(field["percentage"]);
8882
+ }
8883
+ });
8884
+ }
8885
+ this.beforeSetPixKeyTypeValidator();
8886
+ this.setPixKeyValidators(isEditMode);
8887
+ this.validatePercentageValid(percentageIncluded);
8888
+ }
8889
+ /**
8890
+ * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
8891
+ */
8892
+ setPixKeyValidators(isEditMode) {
8893
+ const genericPixKey = this.pixAccountFormGroup.get("pixKey");
8894
+ if (this.pixKeyType) {
8895
+ switch (this.pixKeyType) {
8896
+ case "TELEPHONE":
8897
+ genericPixKey.setValidators(Validators.compose([
8898
+ Validators.required, GenericValidator.isValidPhoneNumber,
8899
+ ]));
8900
+ break;
8901
+ case "EMAIL":
8902
+ genericPixKey.setValidators(Validators.compose([
8903
+ Validators.required, GenericValidator.isValidEmail,
8904
+ ]));
8905
+ break;
8906
+ case "CPF":
8907
+ genericPixKey.setValidators(Validators.compose([
8908
+ Validators.required, GenericValidator.isValidCpf,
8909
+ ]));
8910
+ break;
8911
+ case "CNPJ":
8912
+ genericPixKey.setValidators(Validators.compose([
8913
+ Validators.required, GenericValidator.isValidCnpj,
8914
+ ]));
8915
+ break;
8916
+ case "RANDOM_KEY":
8917
+ genericPixKey.setValidators(Validators.required);
8918
+ break;
8919
+ default:
8920
+ genericPixKey.setValidators(null);
8921
+ break;
8922
+ }
8923
+ if (isEditMode) {
8924
+ genericPixKey.enable();
8925
+ }
8926
+ genericPixKey.updateValueAndValidity();
8927
+ }
8928
+ }
8929
+ /**
8930
+ * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
8931
+ * 100% na validação do campo "percentage" como um novo maxValue;
8932
+ * @param listValue
8933
+ */
8934
+ validatePercentageValid(listValue) {
8935
+ const percentage = this.pixAccountFormGroup.get("percentage");
8936
+ this.maxValuePercentage = listValue
8937
+ .reduce((currentValue, total) => currentValue - total, 100.00);
8938
+ percentage
8939
+ .setValidators(Validators.compose([
8940
+ ...this.initialValidatorOfPercentage,
8941
+ Validators.max(this.maxValuePercentage),
8942
+ ]));
8943
+ percentage.updateValueAndValidity();
8944
+ }
8945
+ set isViewMode(condition) {
8946
+ this.isView = !!(condition && !this.withSideBar);
8947
+ this.configEnableFields(!this.isView);
8948
+ if (!this.isView)
8949
+ this.resetForm();
8950
+ }
8951
+ phoneMask(event) {
8952
+ FormatUtilsService.formatTelephoneInputEvent(event);
8953
+ }
8954
+ setDefaultCpfPixKey() {
8955
+ if (this.defaultCpfNumber) {
8956
+ this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
8957
+ }
8958
+ else {
8959
+ const sheetDocument = this.paramsForm.get("sheetDocument");
8960
+ if (sheetDocument) {
8961
+ const cpf = sheetDocument.get("cpfNumber").value;
8962
+ if (cpf) {
8963
+ this.pixAccountFormGroup.get("pixKey").setValue(cpf);
8964
+ }
8965
+ }
8966
+ }
8967
+ }
8968
+ beforeSetPixKeyTypeValidator() {
8969
+ const pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
8970
+ if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
8971
+ pixKeyType
8972
+ .setValidators(Validators.compose([
8973
+ Validators.required,
8974
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
8975
+ ]));
8976
+ }
8977
+ else {
8978
+ pixKeyType.setValidators(Validators.required);
8979
+ }
8980
+ }
8981
+ validateDuplicatePixKeyTypeBankAccount(listCompare) {
8982
+ return (control) => {
8983
+ const value = control && control.value;
8984
+ let condition = false;
8985
+ listCompare.filter((field) => {
8986
+ if (value) {
8987
+ if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
8988
+ return condition = true;
8989
+ }
8990
+ }
8991
+ });
8992
+ if (condition && !this.permitsEditBankAccountForm) {
8993
+ return { pixKeyTypeBankAccountDuplicate: true };
8994
+ }
8995
+ else {
8996
+ return null;
8997
+ }
8998
+ };
8819
8999
  }
8820
9000
  };
8821
- HistoricalPixAccountComponent.ctorParameters = () => [
8822
- { type: TranslateService },
8823
- { type: ChangeDetectorRef },
9001
+ HistoricalPixAccountFormComponent.ctorParameters = () => [
8824
9002
  { type: FormBuilder },
8825
- { type: MessageService }
9003
+ { type: ChangeDetectorRef }
8826
9004
  ];
8827
9005
  __decorate([
8828
- ViewChild(CustomFieldsComponent$1, { static: false })
8829
- ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
8830
- __decorate([
8831
- Input()
8832
- ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
8833
- __decorate([
8834
- Input()
8835
- ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
8836
- __decorate([
8837
- Input()
8838
- ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
8839
- __decorate([
8840
- Input()
8841
- ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
8842
- __decorate([
8843
- Input()
8844
- ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
8845
- __decorate([
8846
- Input()
8847
- ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
8848
- __decorate([
8849
- Input()
8850
- ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
8851
- __decorate([
8852
- Input()
8853
- ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
8854
- __decorate([
8855
- Input()
8856
- ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
9006
+ ViewChild(CustomFieldsComponent$1, { static: true })
9007
+ ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
8857
9008
  __decorate([
8858
9009
  Input()
8859
- ], HistoricalPixAccountComponent.prototype, "currency", void 0);
9010
+ ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
8860
9011
  __decorate([
8861
9012
  Input()
8862
- ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9013
+ ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
8863
9014
  __decorate([
8864
9015
  Input()
8865
- ], HistoricalPixAccountComponent.prototype, "customService", void 0);
9016
+ ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
8866
9017
  __decorate([
8867
9018
  Input()
8868
- ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
9019
+ ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
8869
9020
  __decorate([
8870
9021
  Input()
8871
- ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
9022
+ ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
8872
9023
  __decorate([
8873
9024
  Input()
8874
- ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
9025
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
8875
9026
  __decorate([
8876
9027
  Input()
8877
- ], HistoricalPixAccountComponent.prototype, "permission", void 0);
9028
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
8878
9029
  __decorate([
8879
9030
  Input()
8880
- ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
8881
- __decorate([
8882
- Output()
8883
- ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
9031
+ ], HistoricalPixAccountFormComponent.prototype, "permitsEditBankAccountForm", void 0);
8884
9032
  __decorate([
8885
9033
  Output()
8886
- ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
9034
+ ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
8887
9035
  __decorate([
8888
9036
  Output()
8889
- ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
9037
+ ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
8890
9038
  __decorate([
8891
9039
  Input()
8892
- ], HistoricalPixAccountComponent.prototype, "dateChange", null);
9040
+ ], HistoricalPixAccountFormComponent.prototype, "visible", null);
8893
9041
  __decorate([
8894
9042
  Input()
8895
- ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
9043
+ ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
8896
9044
  __decorate([
8897
9045
  Input()
8898
- ], HistoricalPixAccountComponent.prototype, "addListData", null);
9046
+ ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
8899
9047
  __decorate([
8900
9048
  Input()
8901
- ], HistoricalPixAccountComponent.prototype, "visible", null);
8902
- HistoricalPixAccountComponent = __decorate([
9049
+ ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
9050
+ HistoricalPixAccountFormComponent = __decorate([
8903
9051
  Component({
8904
- // tslint:disable-next-line:component-selector
8905
- selector: "c-historical-pix-account",
8906
- template: "<s-sidebar *ngIf=\"withSideBar\" [visible]=\"visible\" (visibleChange)=\"close()\"\n header=\"{{'hcm.payroll.historical_pix_account_title_form'|translate}}\">\n<pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</s-sidebar>\n\n<div *ngIf=\"!withSideBar\">\n <pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [withSideBar]=\"false\"\n [isViewMode]=\"isViewMode\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</div>\n\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"!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",
9052
+ selector: "pix-account",
9053
+ 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",
8907
9054
  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}"]
8908
9055
  })
8909
- ], HistoricalPixAccountComponent);
9056
+ ], HistoricalPixAccountFormComponent);
8910
9057
 
8911
- class GenericValidator {
8912
- constructor() { }
8913
- /**
8914
- * Valida o CEI (Cadastro específico de INSS) digitado.
8915
- */
8916
- static isValidCei(control) {
8917
- const cei = control.value;
8918
- if (!cei)
8919
- return null;
8920
- else if (cei.length != 11)
8921
- return null;
8922
- const multiplicadorBase = "3298765432";
8923
- let total = 0;
8924
- let resto = 0;
8925
- let multiplicando = 0;
8926
- let multiplicador = 0;
8927
- if (cei.length !== 11 ||
8928
- cei === "00000000000" ||
8929
- cei === "11111111111" ||
8930
- cei === "22222222222" ||
8931
- cei === "33333333333" ||
8932
- cei === "44444444444" ||
8933
- cei === "55555555555" ||
8934
- cei === "66666666666" ||
8935
- cei === "77777777777" ||
8936
- cei === "88888888888" ||
8937
- cei === "99999999999")
8938
- return { invalidCei: true };
8939
- else {
8940
- for (let i = 0; i < 10; i++) {
8941
- multiplicando = parseInt(cei.substring(i, i + 1), 10);
8942
- multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
8943
- total += multiplicando * multiplicador;
8944
- }
8945
- resto = 11 - (total % 11);
8946
- resto = resto === 10 || resto === 11 ? 0 : resto;
8947
- const digito = parseInt("" + cei.charAt(10), 10);
8948
- return resto === digito ? null : { invalidCei: true };
8949
- }
8950
- }
8951
- /**
8952
- * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
8953
- */
8954
- static isValidCpf(control) {
8955
- const cpf = control.value;
8956
- if (cpf) {
8957
- let numbers, digits, sum, i, result, equalDigits;
8958
- equalDigits = 1;
8959
- if (cpf.length < 11) {
8960
- return null;
8961
- }
8962
- for (i = 0; i < cpf.length - 1; i++) {
8963
- if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
8964
- equalDigits = 0;
8965
- break;
8966
- }
8967
- }
8968
- if (!equalDigits) {
8969
- numbers = cpf.substring(0, 9);
8970
- digits = cpf.substring(9);
8971
- sum = 0;
8972
- for (i = 10; i > 1; i--) {
8973
- sum += numbers.charAt(10 - i) * i;
8974
- }
8975
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8976
- if (result !== Number(digits.charAt(0))) {
8977
- return { cpfNotValid: true };
8978
- }
8979
- numbers = cpf.substring(0, 10);
8980
- sum = 0;
8981
- for (i = 11; i > 1; i--) {
8982
- sum += numbers.charAt(11 - i) * i;
8983
- }
8984
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8985
- if (result !== Number(digits.charAt(1))) {
8986
- return { cpfNotValid: true };
8987
- }
8988
- return null;
8989
- }
8990
- else {
8991
- return { cpfNotValid: true };
8992
- }
8993
- }
8994
- return null;
8995
- }
8996
- /**
8997
- * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
8998
- */
8999
- static isValidCnpj(control) {
9000
- let cnpj = control.value;
9001
- if (cnpj) {
9002
- let size, numbers, digits, sum, pos, result;
9003
- cnpj = cnpj.replace(/[^\d]+/g, '');
9004
- if (cnpj.length !== 14) {
9005
- return null;
9006
- }
9007
- // Elimina CNPJs invalidos conhecidos
9008
- if (cnpj === '00000000000000' ||
9009
- cnpj === '11111111111111' ||
9010
- cnpj === '22222222222222' ||
9011
- cnpj === '33333333333333' ||
9012
- cnpj === '44444444444444' ||
9013
- cnpj === '55555555555555' ||
9014
- cnpj === '66666666666666' ||
9015
- cnpj === '77777777777777' ||
9016
- cnpj === '88888888888888' ||
9017
- cnpj === '99999999999999') {
9018
- return { cnpjNotValid: true };
9019
- }
9020
- // Valida DVs
9021
- size = cnpj.length - 2;
9022
- numbers = cnpj.substring(0, size);
9023
- digits = cnpj.substring(size);
9024
- sum = 0;
9025
- pos = size - 7;
9026
- for (let i = size; i >= 1; i--) {
9027
- sum += numbers.charAt(size - i) * pos--;
9028
- if (pos < 2) {
9029
- pos = 9;
9030
- }
9031
- }
9032
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9033
- if (result !== Number(digits.charAt(0))) {
9034
- return { cnpjNotValid: true };
9035
- }
9036
- size = size + 1;
9037
- numbers = cnpj.substring(0, size);
9038
- sum = 0;
9039
- pos = size - 7;
9040
- for (let i = size; i >= 1; i--) {
9041
- sum += numbers.charAt(size - i) * pos--;
9042
- if (pos < 2) {
9043
- pos = 9;
9044
- }
9045
- }
9046
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9047
- if (result !== Number(digits.charAt(1))) {
9048
- return { cnpjNotValid: true };
9049
- }
9050
- return null;
9051
- }
9052
- return null;
9053
- }
9054
- /**
9055
- * Válida o número de telefone da chave PIX.
9056
- */
9057
- static isValidPhoneNumber(control) {
9058
- let cellPhoneKey = control.value || '';
9059
- cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9060
- const regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9061
- const isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9062
- return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9063
- }
9064
- /**
9065
- * Valida o email da chave PIX.
9066
- */
9067
- static isValidEmail(control) {
9068
- const emailKey = control.value;
9069
- const regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9070
- const isValidEmail = regexValidEmail.test(emailKey);
9071
- return isValidEmail ? null : { invalidEmail: true };
9072
- }
9073
- }
9074
-
9075
- let HistoricalPixAccountFormComponent = class HistoricalPixAccountFormComponent {
9076
- constructor(formBuilder, cd) {
9077
- this.formBuilder = formBuilder;
9058
+ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
9059
+ constructor(translateService, cd, formBuilder, messageService) {
9060
+ this.translateService = translateService;
9078
9061
  this.cd = cd;
9079
- this.withSideBar = true;
9062
+ this.formBuilder = formBuilder;
9063
+ this.messageService = messageService;
9064
+ this.recordByRow = 1;
9065
+ this.showDateChange = false;
9080
9066
  this.isEditMode = false;
9081
- this.paramsForm = new FormGroup({});
9067
+ this.isViewMode = false;
9068
+ this.withSideBar = true;
9082
9069
  this.defaultCpfNumber = null;
9070
+ this.listDataReciever = [];
9071
+ this.showButtonEdit = false;
9072
+ this.isViewModeActive = new EventEmitter();
9073
+ this.isEditModeActive = new EventEmitter();
9074
+ this.isDeleteModeActive = new EventEmitter();
9075
+ this.listFromApp = [];
9083
9076
  this.visibleChange = new EventEmitter();
9084
- this.pixAccountItemToList = new EventEmitter();
9085
9077
  this.ngUnsubscribe = new Subject();
9086
- this.initialValidatorOfPercentage = [Validators.required, Validators.min(0.01)];
9087
- this.labelBtnAdd = "hcm.payroll.employees_add";
9088
- this.maxValuePercentage = 100.00;
9089
- this.visibleBtnSave = true;
9090
- this.isView = false;
9091
- this.isShowPixKeyFieldValidatorMessage = false;
9078
+ this.orderBy = {
9079
+ field: "dateChange",
9080
+ direction: DirectionEnumeration.DESC,
9081
+ };
9082
+ this.pixAccountItemInput = {};
9083
+ this.totalRecords = 0;
9084
+ this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9085
+ this.loading = true;
9086
+ this.listData = [];
9087
+ this.listDataNoPage = [];
9088
+ this.permitsEditBankAccount = false;
9089
+ this.cols = [
9090
+ {
9091
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9092
+ field: "pixKeyType",
9093
+ },
9094
+ {
9095
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9096
+ field: "pixKey",
9097
+ },
9098
+ {
9099
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9100
+ field: "percentage",
9101
+ },
9102
+ ];
9103
+ this.actions = (rowData = {}, key) => {
9104
+ return [
9105
+ {
9106
+ visible: this.isEditMode,
9107
+ label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9108
+ command: () => {
9109
+ if (this.isAllowToViewHistorical) {
9110
+ rowData["index"] = key;
9111
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: false };
9112
+ this.visible = true;
9113
+ }
9114
+ else {
9115
+ this.isViewModeActive.emit(true);
9116
+ }
9117
+ },
9118
+ },
9119
+ {
9120
+ visible: !!((!this.isEditMode && this.withSideBar) || this.showButtonEdit),
9121
+ label: this.translateService.instant("hcm.payroll.edit"),
9122
+ command: () => {
9123
+ this.permitsEditBankAccount = true;
9124
+ if (this.isAllowToEditHistorical) {
9125
+ rowData["index"] = key;
9126
+ this.pixAccountItemInput = {
9127
+ currentItem: rowData, listData: this.listDataNoPage, isEditMode: true, permitsEditBankAccount: true
9128
+ };
9129
+ this.visible = true;
9130
+ }
9131
+ else {
9132
+ this.isEditModeActive.emit(true);
9133
+ if (this.listFromApp.length == 0) {
9134
+ rowData["index"] = key;
9135
+ this.pixAccountItemInput = {
9136
+ currentItem: rowData, listData: this.listDataNoPage, isEditMode: true, permitsEditBankAccount: true
9137
+ };
9138
+ }
9139
+ }
9140
+ },
9141
+ },
9142
+ {
9143
+ visible: !this.isEditMode,
9144
+ label: this.translateService.instant("hcm.payroll.delete"),
9145
+ command: () => {
9146
+ if (this.isAllowToDeleteHistorical) {
9147
+ this.loading = true;
9148
+ this.deleteAnnuityItem(key);
9149
+ }
9150
+ else {
9151
+ this.isDeleteModeActive.emit(true);
9152
+ if (this.listFromApp.length == 0) {
9153
+ this.loading = true;
9154
+ this.deleteAnnuityItem(key);
9155
+ }
9156
+ }
9157
+ },
9158
+ },
9159
+ ];
9160
+ };
9092
9161
  this.createFormGroup();
9093
- this.registerSubjects();
9094
9162
  }
9095
9163
  ngOnInit() {
9164
+ this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9096
9165
  }
9097
- ngAfterViewInit() {
9098
- this.cd.detectChanges();
9099
- }
9100
- ngOnDestroy() {
9101
- this.ngUnsubscribe.next(true);
9102
- this.ngUnsubscribe.unsubscribe();
9103
- }
9104
- registerSubjects() {
9105
- }
9106
- createFormGroup() {
9107
- this.pixAccountFormGroup = this.formBuilder.group({
9108
- id: this.formBuilder.control(null),
9109
- index: this.formBuilder.control(null),
9110
- employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9111
- dateChange: this.formBuilder.control(null),
9112
- pixKeyType: this.formBuilder.control(null, Validators.required),
9113
- pixKey: this.formBuilder.control(null),
9114
- percentage: this.formBuilder.control(null, Validators.compose([
9115
- ...this.initialValidatorOfPercentage,
9116
- Validators.max(this.maxValuePercentage),
9117
- ])),
9118
- externalId: this.formBuilder.control(null),
9119
- customFields: this.formBuilder.control(null),
9120
- });
9121
- }
9122
- onChangePixKeyType(item) {
9123
- if (item.key) {
9124
- this.pixKeyType = item.key;
9125
- this.isShowPixKeyFieldValidatorMessage = true;
9126
- this.pixAccountFormGroup.get("pixKey").reset();
9127
- this.setPixKeyValidators(true);
9128
- if (item.key === "CPF") {
9129
- this.setDefaultCpfPixKey();
9130
- }
9131
- }
9132
- }
9133
- onClearPixKeyType() {
9134
- this.isShowPixKeyFieldValidatorMessage = false;
9135
- this.pixAccountFormGroup.get("pixKey").reset();
9136
- }
9137
- get visible() {
9138
- return this._visible;
9139
- }
9140
- set visible(value) {
9141
- this._visible = value;
9142
- this.visibleChange.emit(this.visible);
9143
- }
9144
- set isEditAndViewValue(value) {
9145
- this.resetForm();
9146
- this.visibleBtnSave = true;
9147
- if (value && value.currentItem && Object.keys(value.currentItem).length) {
9148
- this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(Object.assign({}, value.currentItem)));
9149
- this.labelBtnAdd = "hcm.payroll.employees_update";
9150
- this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
9151
- if (!this.isView) {
9152
- this.configEnableFields(value && value["isEditMode"]);
9153
- }
9154
- else {
9155
- if (this.pixAccountFormGroup.get("pixKeyType").value) {
9156
- this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9157
- this.formatPixKeyTelephoneNumber();
9158
- }
9159
- }
9160
- }
9161
- else {
9162
- this.labelBtnAdd = "hcm.payroll.employees_add";
9166
+ ngOnChanges(changes) {
9167
+ if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
9168
+ this.listFromApp = changes['listDataReciever'].currentValue;
9163
9169
  }
9164
- }
9165
- formatPixKeyTelephoneNumber() {
9166
- if (this.pixKeyType === "TELEPHONE") {
9167
- this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
9170
+ if (changes['showButtonEdit'] && changes['showButtonEdit'].currentValue) {
9171
+ this.permitsEditBankAccount = changes['showButtonEdit'].currentValue;
9168
9172
  }
9169
9173
  }
9170
- convertDTOToShowWithCustomFields(data) {
9171
- const obj = Object.assign({}, data);
9172
- obj["customFields"] = mountCustomToShow(obj["customFields"]);
9173
- return obj;
9174
+ createFormGroup() {
9175
+ this.historicalPixAccountList = this.formBuilder.group({
9176
+ historicalPixAccountList: this.formBuilder.control(null),
9177
+ });
9174
9178
  }
9175
- configEnableFields(isEditMode) {
9176
- this.visibleBtnSave = isEditMode;
9177
- if (this.pixAccountFormGroup.get("pixKeyType").value) {
9178
- this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9179
- this.setPixKeyValidators(isEditMode);
9180
- this.formatPixKeyTelephoneNumber();
9181
- }
9182
- configEnabledFields(this.pixAccountFormGroup, isEditMode, [
9183
- "pixKeyType",
9184
- "pixKey",
9185
- "percentage",
9186
- "customFields",
9187
- ], []);
9179
+ ngOnDestroy() {
9180
+ this.ngUnsubscribe.next();
9181
+ this.ngUnsubscribe.complete();
9188
9182
  }
9189
- close() {
9190
- this.resetForm();
9191
- this.visible = false;
9183
+ ngAfterViewInit() {
9184
+ this.cd.detectChanges();
9192
9185
  }
9193
- addItem() {
9194
- this.pixAccountFormGroup.updateValueAndValidity();
9195
- verifyValidationsForm.call(this.pixAccountFormGroup);
9196
- if (this.pixAccountFormGroup.valid) {
9197
- if (this.employeeId) {
9198
- this.pixAccountFormGroup.get("employee").setValue({
9199
- tableId: this.employeeId,
9200
- name: "",
9201
- });
9202
- }
9203
- this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
9204
- this.visible = false;
9205
- this.resetForm();
9186
+ onLazyLoad(event) {
9187
+ const first = event && event.first ? event.first : 0;
9188
+ const rows = event && event.rows ? event.rows : this.recordByRow;
9189
+ const arrList = this.getHistoricalPixAccountList();
9190
+ this.listData = [];
9191
+ this.totalRecords = null;
9192
+ if (event && event.multiSortMeta && event.multiSortMeta.length) {
9193
+ event.multiSortMeta.map((value) => {
9194
+ this.orderBy.field = value.field;
9195
+ this.orderBy.direction = value.order === 1 ? DirectionEnumeration.ASC : DirectionEnumeration.DESC;
9196
+ });
9206
9197
  }
9207
- }
9208
- resetForm() {
9209
- this.pixAccountFormGroup.reset();
9210
- this.labelBtnAdd = "hcm.payroll.employees_add";
9211
- if (this.customFields && this.customFields.formGroup)
9212
- this.customFields.formGroup.reset();
9213
- }
9214
- get percentagePlaceholder() {
9215
- return `0${this.currency && this.currency.decimalSeparator}00`;
9216
- }
9217
- get optionsPercentage() {
9218
- return Object.assign({}, this.getOptions(), { precision: 2 });
9219
- }
9220
- getOptions() {
9221
- return {
9222
- prefix: "",
9223
- thousands: this.currency.thousandsSeparator,
9224
- decimal: this.currency.decimalSeparator,
9225
- };
9226
- }
9227
- /**
9228
- * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
9229
- * @param pixAccountList
9230
- */
9231
- set getListPixAccount(pixAccountList) {
9232
- if (pixAccountList) {
9233
- this.setValidatorsAccordingList(pixAccountList, null, false);
9198
+ if (arrList && arrList.length) {
9199
+ this.totalRecords = arrList.length;
9200
+ this.listData = arrList;
9201
+ this.listDataNoPage = [...arrList];
9202
+ this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9203
+ this.listData = this.listData.slice(first, (first + rows));
9234
9204
  }
9235
9205
  else {
9236
- this.resetForm();
9237
- }
9238
- }
9239
- /**
9240
- * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
9241
- * a validação dos campos "percentage" e "pixAccount".
9242
- * 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
9243
- * no array de comparação dos validators.
9244
- * @param pixAccountList
9245
- * @param index
9246
- */
9247
- setValidatorsAccordingList(pixAccountList, index = null, isEditMode = true) {
9248
- this.pixAccountList = pixAccountList && pixAccountList.length ? [...pixAccountList] : [];
9249
- const percentageIncluded = [];
9250
- if (this.pixAccountList && this.pixAccountList.length) {
9251
- this.pixAccountList.filter((field, key) => {
9252
- if (field["percentage"] && key != index) {
9253
- percentageIncluded.push(field["percentage"]);
9254
- }
9255
- });
9206
+ this.listDataNoPage = [];
9256
9207
  }
9257
- this.beforeSetPixKeyTypeValidator();
9258
- this.setPixKeyValidators(isEditMode);
9259
- this.validatePercentageValid(percentageIncluded);
9260
- }
9261
- /**
9262
- * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
9263
- */
9264
- setPixKeyValidators(isEditMode) {
9265
- const genericPixKey = this.pixAccountFormGroup.get("pixKey");
9266
- if (this.pixKeyType) {
9267
- switch (this.pixKeyType) {
9268
- case "TELEPHONE":
9269
- genericPixKey.setValidators(Validators.compose([
9270
- Validators.required, GenericValidator.isValidPhoneNumber,
9271
- ]));
9272
- break;
9273
- case "EMAIL":
9274
- genericPixKey.setValidators(Validators.compose([
9275
- Validators.required, GenericValidator.isValidEmail,
9276
- ]));
9277
- break;
9278
- case "CPF":
9279
- genericPixKey.setValidators(Validators.compose([
9280
- Validators.required, GenericValidator.isValidCpf,
9281
- ]));
9282
- break;
9283
- case "CNPJ":
9284
- genericPixKey.setValidators(Validators.compose([
9285
- Validators.required, GenericValidator.isValidCnpj,
9286
- ]));
9287
- break;
9288
- case "RANDOM_KEY":
9289
- genericPixKey.setValidators(Validators.required);
9290
- break;
9291
- default:
9292
- genericPixKey.setValidators(null);
9293
- break;
9294
- }
9295
- if (isEditMode) {
9296
- genericPixKey.enable();
9297
- }
9298
- genericPixKey.updateValueAndValidity();
9208
+ if (this.isEditMode || arrList && arrList.length === 1) {
9209
+ this.refreshCssInIE11();
9299
9210
  }
9211
+ this.loading = false;
9300
9212
  }
9301
9213
  /**
9302
- * Este método calcula as parcentagens que foram inseridas, e seta a diferença para chegar em
9303
- * 100% na validação do campo "percentage" como um novo maxValue;
9304
- * @param listValue
9214
+ * Um Bug de CSS que acontece nas linhas da tabela, que resolve atualizando qualquer parte do CSS da pagina.
9305
9215
  */
9306
- validatePercentageValid(listValue) {
9307
- const percentage = this.pixAccountFormGroup.get("percentage");
9308
- this.maxValuePercentage = listValue
9309
- .reduce((currentValue, total) => currentValue - total, 100.00);
9310
- percentage
9311
- .setValidators(Validators.compose([
9312
- ...this.initialValidatorOfPercentage,
9313
- Validators.max(this.maxValuePercentage),
9314
- ]));
9315
- percentage.updateValueAndValidity();
9216
+ refreshCssInIE11() {
9217
+ if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
9218
+ setTimeout(() => {
9219
+ const row = document.getElementsByClassName("row0");
9220
+ if (row && row[0])
9221
+ row[0].className = 'refresh';
9222
+ }, 1);
9223
+ }
9316
9224
  }
9317
- set isViewMode(condition) {
9318
- this.isView = !!(condition && !this.withSideBar);
9319
- this.configEnableFields(!this.isView);
9320
- if (!this.isView)
9321
- this.resetForm();
9225
+ add() {
9226
+ this.pixAccountItemInput = {};
9227
+ this.visible = true;
9322
9228
  }
9323
- phoneMask(event) {
9324
- FormatUtilsService.formatTelephoneInputEvent(event);
9229
+ isNotAllowMessage() {
9230
+ this.messageService.add({
9231
+ severity: "error",
9232
+ summary: this.translateService.instant("hcm.payroll.error"),
9233
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9234
+ });
9325
9235
  }
9326
- setDefaultCpfPixKey() {
9327
- if (this.defaultCpfNumber) {
9328
- this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
9236
+ deleteAnnuityItem(index) {
9237
+ let newlist = [...this.getHistoricalPixAccountList()];
9238
+ newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9239
+ delete newlist[index];
9240
+ newlist = newlist.filter(val => val);
9241
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
9242
+ this.verifyTotalPercentage();
9243
+ this.onLazyLoad();
9244
+ }
9245
+ getHistoricalPixAccountList() {
9246
+ if (this.historicalPixAccountList.get("historicalPixAccountList") &&
9247
+ this.historicalPixAccountList.get("historicalPixAccountList").value &&
9248
+ this.historicalPixAccountList.get("historicalPixAccountList").value.length)
9249
+ return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
9250
+ else
9251
+ return [];
9252
+ }
9253
+ addItemInList($event) {
9254
+ const index = $event && $event.index >= 0 ? $event.index : null;
9255
+ const newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9256
+ if (index != null) {
9257
+ newDataList[index] = $event;
9258
+ delete $event.index;
9329
9259
  }
9330
9260
  else {
9331
- const sheetDocument = this.paramsForm.get("sheetDocument");
9332
- if (sheetDocument) {
9333
- const cpf = sheetDocument.get("cpfNumber").value;
9334
- if (cpf) {
9335
- this.pixAccountFormGroup.get("pixKey").setValue(cpf);
9336
- }
9261
+ if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
9262
+ const customValue = mountCustomToSave($event["customFields"]);
9263
+ $event["customFields"] = [...customValue];
9337
9264
  }
9265
+ $event["dateChange"] = this.dateChange;
9266
+ newDataList.push($event);
9338
9267
  }
9268
+ if (this.formComponent) {
9269
+ this.formComponent.permitsEditBankAccountForm = false;
9270
+ this.cd.detectChanges();
9271
+ }
9272
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9273
+ this.verifyTotalPercentage();
9274
+ this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
9339
9275
  }
9340
- beforeSetPixKeyTypeValidator() {
9341
- const pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
9342
- if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
9343
- pixKeyType
9344
- .setValidators(Validators.compose([
9345
- Validators.required,
9346
- this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
9347
- ]));
9276
+ getNumberPageByIndex(index, list) {
9277
+ if (index) {
9278
+ const total = list.length;
9279
+ const sub = this.recordByRow - 1;
9280
+ return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
9281
+ }
9282
+ return null;
9283
+ }
9284
+ verifyTotalPercentage() {
9285
+ const list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9286
+ const arrayPercentage = [];
9287
+ if (!list.length)
9288
+ return this.msgTotalLimitByPercentage = null;
9289
+ list.filter((item) => arrayPercentage.push(item && item["percentage"]));
9290
+ const sumPercentage = arrayPercentage.reduce((total, percentage) => {
9291
+ return total + percentage;
9292
+ }, 0);
9293
+ if (sumPercentage === 100) {
9294
+ this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
9348
9295
  }
9349
9296
  else {
9350
- pixKeyType.setValidators(Validators.required);
9297
+ this.msgTotalLimitByPercentage = null;
9351
9298
  }
9352
9299
  }
9353
- validateDuplicatePixKeyTypeBankAccount(listCompare) {
9354
- return (control) => {
9355
- const value = control && control.value;
9356
- let condition = false;
9357
- listCompare.filter((field) => {
9358
- if (value) {
9359
- if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
9360
- return condition = true;
9361
- }
9362
- }
9363
- });
9364
- if (condition) {
9365
- return { pixKeyTypeBankAccountDuplicate: true };
9366
- }
9367
- else {
9368
- return null;
9369
- }
9370
- };
9300
+ get scopedActions() {
9301
+ return this.actions.bind(this);
9302
+ }
9303
+ get recordsMessage() {
9304
+ return `${this.totalRecords || 0} ${this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers")}`;
9305
+ }
9306
+ get getTooltipAndDisableButtonAdd() {
9307
+ return this.dateChange ? null : this.msgTooltipAdd;
9308
+ }
9309
+ get dateChange() {
9310
+ return this._dateChange;
9311
+ }
9312
+ set dateChange(value) {
9313
+ this._dateChange = value;
9314
+ if (this._dateChange) {
9315
+ this.listData.filter((row) => row["dateChange"] = this._dateChange);
9316
+ }
9317
+ }
9318
+ get displayDateChange() {
9319
+ return this._displayDateChange;
9320
+ }
9321
+ set displayDateChange(value) {
9322
+ this._displayDateChange = value;
9323
+ if (this._displayDateChange) {
9324
+ this.listData.filter((row) => row["displayDateChange"] = this._displayDateChange);
9325
+ }
9326
+ }
9327
+ set addListData(list) {
9328
+ this.loading = true;
9329
+ this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
9330
+ this.verifyTotalPercentage();
9331
+ this.onLazyLoad();
9332
+ }
9333
+ get visible() {
9334
+ return this._visible;
9335
+ }
9336
+ set visible(value) {
9337
+ this._visible = value;
9338
+ this.visibleChange.emit(this.visible);
9339
+ if (!value) {
9340
+ this.pixAccountItemInput = {};
9341
+ }
9342
+ }
9343
+ close() {
9344
+ this.visible = false;
9345
+ }
9346
+ getFormattedTelephoneNumber(telephoneNumber) {
9347
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9348
+ }
9349
+ getFormattedCpf(cpf) {
9350
+ return FormatUtilsService.getFormattedCpf(cpf);
9351
+ }
9352
+ getFormattedCnpj(cnpj) {
9353
+ return FormatUtilsService.getFormattedCnpj(cnpj);
9354
+ }
9355
+ getFormattedPercentage(value) {
9356
+ return FormatUtilsService.getFormattedPercentage(value);
9357
+ }
9358
+ get isAllowToAddHistorical() {
9359
+ return (this.permission["incluir"]);
9360
+ }
9361
+ get isAllowToDeleteHistorical() {
9362
+ return (this.permission["excluir"]);
9363
+ }
9364
+ get isAllowToEditHistorical() {
9365
+ return (this.permission["editar"]);
9366
+ }
9367
+ get isAllowToViewHistorical() {
9368
+ return (this.permission["visualizar"]);
9371
9369
  }
9372
9370
  };
9373
- HistoricalPixAccountFormComponent.ctorParameters = () => [
9371
+ HistoricalPixAccountComponent.ctorParameters = () => [
9372
+ { type: TranslateService },
9373
+ { type: ChangeDetectorRef },
9374
9374
  { type: FormBuilder },
9375
- { type: ChangeDetectorRef }
9375
+ { type: MessageService }
9376
9376
  ];
9377
9377
  __decorate([
9378
- ViewChild(CustomFieldsComponent$1, { static: true })
9379
- ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
9378
+ ViewChild(CustomFieldsComponent$1, { static: false })
9379
+ ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
9380
+ __decorate([
9381
+ ViewChild(HistoricalPixAccountFormComponent, { static: false })
9382
+ ], HistoricalPixAccountComponent.prototype, "formComponent", void 0);
9380
9383
  __decorate([
9381
9384
  Input()
9382
- ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
9385
+ ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
9383
9386
  __decorate([
9384
9387
  Input()
9385
- ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
9388
+ ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
9386
9389
  __decorate([
9387
9390
  Input()
9388
- ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
9391
+ ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
9389
9392
  __decorate([
9390
9393
  Input()
9391
- ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
9394
+ ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
9392
9395
  __decorate([
9393
9396
  Input()
9394
- ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
9397
+ ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
9395
9398
  __decorate([
9396
9399
  Input()
9397
- ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
9400
+ ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
9398
9401
  __decorate([
9399
9402
  Input()
9400
- ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
9403
+ ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
9404
+ __decorate([
9405
+ Input()
9406
+ ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
9407
+ __decorate([
9408
+ Input()
9409
+ ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
9410
+ __decorate([
9411
+ Input()
9412
+ ], HistoricalPixAccountComponent.prototype, "currency", void 0);
9413
+ __decorate([
9414
+ Input()
9415
+ ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9416
+ __decorate([
9417
+ Input()
9418
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
9419
+ __decorate([
9420
+ Input()
9421
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
9422
+ __decorate([
9423
+ Input()
9424
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
9425
+ __decorate([
9426
+ Input()
9427
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
9428
+ __decorate([
9429
+ Input()
9430
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
9431
+ __decorate([
9432
+ Input()
9433
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
9434
+ __decorate([
9435
+ Input()
9436
+ ], HistoricalPixAccountComponent.prototype, "showButtonEdit", void 0);
9401
9437
  __decorate([
9402
9438
  Output()
9403
- ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
9439
+ ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
9404
9440
  __decorate([
9405
9441
  Output()
9406
- ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
9442
+ ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
9443
+ __decorate([
9444
+ Output()
9445
+ ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
9407
9446
  __decorate([
9408
9447
  Input()
9409
- ], HistoricalPixAccountFormComponent.prototype, "visible", null);
9448
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
9410
9449
  __decorate([
9411
9450
  Input()
9412
- ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
9451
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
9413
9452
  __decorate([
9414
9453
  Input()
9415
- ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
9454
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
9416
9455
  __decorate([
9417
9456
  Input()
9418
- ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
9419
- HistoricalPixAccountFormComponent = __decorate([
9457
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
9458
+ HistoricalPixAccountComponent = __decorate([
9420
9459
  Component({
9421
- selector: "pix-account",
9422
- 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",
9460
+ // tslint:disable-next-line:component-selector
9461
+ selector: "c-historical-pix-account",
9462
+ 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",
9423
9463
  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}"]
9424
9464
  })
9425
- ], HistoricalPixAccountFormComponent);
9465
+ ], HistoricalPixAccountComponent);
9426
9466
 
9427
9467
  let HistoricalPixAccountService = class HistoricalPixAccountService {
9428
9468
  constructor(http) {
@@ -9518,6 +9558,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9518
9558
  this.isOnlyView = new EventEmitter();
9519
9559
  this.isOnlyEdit = new EventEmitter();
9520
9560
  this.enableView = new EventEmitter();
9561
+ this.enableEdit = new EventEmitter();
9521
9562
  this.ngUnsubscribe = new Subject();
9522
9563
  this.loading = true;
9523
9564
  this.columns = [
@@ -9583,7 +9624,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9583
9624
  });
9584
9625
  }
9585
9626
  else {
9586
- this.enableView.emit(dateChange);
9627
+ this.enableEdit.emit(dateChange);
9587
9628
  }
9588
9629
  }
9589
9630
  else {
@@ -9731,6 +9772,9 @@ __decorate([
9731
9772
  __decorate([
9732
9773
  Output()
9733
9774
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
9775
+ __decorate([
9776
+ Output()
9777
+ ], HistoricalPixAccountListComponent.prototype, "enableEdit", void 0);
9734
9778
  __decorate([
9735
9779
  Input()
9736
9780
  ], HistoricalPixAccountListComponent.prototype, "reloadList", null);