@senior-gestao-pessoas/payroll-core 9.1.0 → 9.2.0-f1576e5d-10f9-432e-b073-1aa58ae3cbc8

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 (40) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +1050 -0
  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/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.d.ts +77 -0
  6. package/components/historical-pix-account/historical-pix-account.component.d.ts +75 -0
  7. package/components/historical-pix-account/historical-pix-account.module.d.ts +2 -0
  8. package/components/historical-pix-account/historical-pix-account.service.d.ts +8 -0
  9. package/components/historical-pix-account/index.d.ts +3 -0
  10. package/components/utils/format-utils/format-utils.service.d.ts +33 -0
  11. package/components/utils/generic-validators.d.ts +24 -0
  12. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +360 -0
  13. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +327 -0
  14. package/esm2015/components/historical-pix-account/historical-pix-account.module.js +58 -0
  15. package/esm2015/components/historical-pix-account/historical-pix-account.service.js +20 -0
  16. package/esm2015/components/historical-pix-account/index.js +4 -0
  17. package/esm2015/components/utils/format-utils/format-utils.service.js +96 -0
  18. package/esm2015/components/utils/generic-validators.js +164 -0
  19. package/esm2015/public_api.js +2 -1
  20. package/esm2015/senior-gestao-pessoas-payroll-core.js +2 -1
  21. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +385 -0
  22. package/esm5/components/historical-pix-account/historical-pix-account.component.js +361 -0
  23. package/esm5/components/historical-pix-account/historical-pix-account.module.js +61 -0
  24. package/esm5/components/historical-pix-account/historical-pix-account.service.js +22 -0
  25. package/esm5/components/historical-pix-account/index.js +4 -0
  26. package/esm5/components/utils/format-utils/format-utils.service.js +100 -0
  27. package/esm5/components/utils/generic-validators.js +167 -0
  28. package/esm5/public_api.js +2 -1
  29. package/esm5/senior-gestao-pessoas-payroll-core.js +2 -1
  30. package/fesm2015/senior-gestao-pessoas-payroll-core.js +978 -1
  31. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  32. package/fesm5/senior-gestao-pessoas-payroll-core.js +1047 -1
  33. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  34. package/locale/en-US.json +33 -1
  35. package/locale/es-ES.json +33 -1
  36. package/locale/pt-BR.json +33 -1
  37. package/package.json +1 -1
  38. package/public_api.d.ts +1 -0
  39. package/senior-gestao-pessoas-payroll-core.d.ts +1 -0
  40. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
@@ -8425,6 +8425,983 @@ FromToModule = __decorate([
8425
8425
  })
8426
8426
  ], FromToModule);
8427
8427
 
8428
+ class FormatUtilsService {
8429
+ /**
8430
+ * Retorna o CPF formatado
8431
+ * @param cpf CPF
8432
+ */
8433
+ static getFormattedCpf(cpf) {
8434
+ if (cpf) {
8435
+ return cpf
8436
+ .replace(/\D/g, "")
8437
+ .replace(/(\d{3})(\d)/, "$1.$2")
8438
+ .replace(/(\d{3})(\d)/, "$1.$2")
8439
+ .replace(/(\d{3})(\d)/, "$1-$2");
8440
+ }
8441
+ return null;
8442
+ }
8443
+ /**
8444
+ * Retorna o CNPJ formatado
8445
+ * @param cnpj CNPJ
8446
+ */
8447
+ static getFormattedCnpj(cnpj) {
8448
+ if (cnpj) {
8449
+ return cnpj
8450
+ .replace(/\D/g, "")
8451
+ .replace(/(\d{2})(\d)/, "$1.$2")
8452
+ .replace(/(\d{3})(\d)/, "$1.$2")
8453
+ .replace(/(\d{3})(\d)/, "$1/$2")
8454
+ .replace(/(\d{4})(\d)/, "$1-$2");
8455
+ }
8456
+ return null;
8457
+ }
8458
+ /**
8459
+ * Retorna a mascara do CPF/CNPJ
8460
+ * @param key Valores possíveis são CPF ou CNPJ
8461
+ */
8462
+ static getCpfCnpjMask(key) {
8463
+ switch (key) {
8464
+ case "CPF":
8465
+ return "999.999.999-99";
8466
+ case "CNPJ":
8467
+ return "99.999.999/9999-99";
8468
+ default:
8469
+ return "";
8470
+ }
8471
+ }
8472
+ /**
8473
+ * Metódo para formatar o número de telefone.
8474
+ * @param telephoneNumber String contendo o número de telefone.
8475
+ * @returns String formatada com o número de telefone.
8476
+ */
8477
+ static getFormattedTelephoneNumber(telephoneNumber) {
8478
+ let tel = telephoneNumber.replace(/\D/g, '');
8479
+ tel = tel.replace(/^0/, '');
8480
+ if (tel.length > 10) {
8481
+ // ########## -> (##) #####-####
8482
+ tel = tel.replace(/^(\d{2})?(\d{5})?(\d{4}).*/, '($1) $2-$3');
8483
+ }
8484
+ else if (tel.length > 9) {
8485
+ // AA######### -> (AA) ####-####
8486
+ tel = tel.replace(/^(\d{2})?(\d{4})?(\d{4}).*/, '($1) $2-$3');
8487
+ }
8488
+ else if (tel.length > 5) {
8489
+ // ####### -> (##) ####-#
8490
+ tel = tel.replace(/^(\d{2})?(\d{4})?(\d{0,4}).*/, '($1) $2-$3');
8491
+ }
8492
+ else if (tel.length > 1) {
8493
+ // #### -> (##) ##
8494
+ tel = tel.replace(/^(\d{2})?(\d{0,5}).*/, '($1) $2');
8495
+ }
8496
+ else {
8497
+ if (tel !== '') {
8498
+ tel = tel.replace(/^(\d*)/, '($1');
8499
+ }
8500
+ }
8501
+ return tel;
8502
+ }
8503
+ /**
8504
+ * Metódo para formatar o número de telefone de um campo Input.
8505
+ * @param event Evento do Input do campo de telefone.
8506
+ */
8507
+ static formatTelephoneInputEvent(event) {
8508
+ let telephoneNumber = event.target.value;
8509
+ // Permite Backspace para usuário remover ")" e "-"
8510
+ if (event.keyCode === 8 && (telephoneNumber.length === 9 || telephoneNumber.length === 4 || telephoneNumber.length === 3)) {
8511
+ return;
8512
+ }
8513
+ event.target.value = FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
8514
+ }
8515
+ /**
8516
+ * Metódo para formatar a porcentagem para 2 casas decimais.
8517
+ * @param value Número a ser formatado.
8518
+ */
8519
+ static getFormattedPercentage(value) {
8520
+ return parseFloat(value).toFixed(2).replace('.', ',') + '%';
8521
+ }
8522
+ }
8523
+
8524
+ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8525
+ constructor(translateService, cd, formBuilder) {
8526
+ this.translateService = translateService;
8527
+ this.cd = cd;
8528
+ this.formBuilder = formBuilder;
8529
+ this.recordByRow = 1;
8530
+ this.showDateChange = false;
8531
+ this.isEditMode = false;
8532
+ this.isViewMode = false;
8533
+ this.withSideBar = true;
8534
+ this.defaultCpfNumber = null;
8535
+ this.visibleChange = new EventEmitter();
8536
+ this.ngUnsubscribe = new Subject();
8537
+ this.orderBy = {
8538
+ field: "dateChange",
8539
+ direction: DirectionEnumeration.DESC,
8540
+ };
8541
+ this.pixAccountItemInput = {};
8542
+ this.totalRecords = 0;
8543
+ this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
8544
+ this.loading = true;
8545
+ this.listData = [];
8546
+ this.listDataNoPage = [];
8547
+ this.cols = [
8548
+ {
8549
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
8550
+ field: "pixKeyType",
8551
+ },
8552
+ {
8553
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
8554
+ field: "pixKey",
8555
+ },
8556
+ {
8557
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
8558
+ field: "percentage",
8559
+ },
8560
+ ];
8561
+ this.actions = (rowData = {}, key) => {
8562
+ return [
8563
+ {
8564
+ visible: this.isEditMode,
8565
+ label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
8566
+ command: () => {
8567
+ rowData["index"] = key;
8568
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: false };
8569
+ this.visible = true;
8570
+ },
8571
+ },
8572
+ {
8573
+ visible: !!(!this.isEditMode && this.withSideBar),
8574
+ label: this.translateService.instant("hcm.payroll.edit"),
8575
+ command: () => {
8576
+ rowData["index"] = key;
8577
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8578
+ this.visible = true;
8579
+ },
8580
+ },
8581
+ {
8582
+ visible: !this.isEditMode,
8583
+ label: this.translateService.instant("hcm.payroll.delete"),
8584
+ command: () => {
8585
+ this.loading = true;
8586
+ this.deleteAnnuityItem(key);
8587
+ },
8588
+ },
8589
+ ];
8590
+ };
8591
+ this.createFormGroup();
8592
+ }
8593
+ ngOnInit() {
8594
+ this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
8595
+ }
8596
+ createFormGroup() {
8597
+ this.historicalPixAccountList = this.formBuilder.group({
8598
+ historicalPixAccountList: this.formBuilder.control(null),
8599
+ });
8600
+ }
8601
+ ngOnDestroy() {
8602
+ this.ngUnsubscribe.next();
8603
+ this.ngUnsubscribe.complete();
8604
+ }
8605
+ ngAfterViewInit() {
8606
+ this.cd.detectChanges();
8607
+ }
8608
+ onLazyLoad(event) {
8609
+ const first = event && event.first ? event.first : 0;
8610
+ const rows = event && event.rows ? event.rows : this.recordByRow;
8611
+ const arrList = this.getHistoricalPixAccountList();
8612
+ this.listData = [];
8613
+ this.totalRecords = null;
8614
+ if (event && event.multiSortMeta && event.multiSortMeta.length) {
8615
+ event.multiSortMeta.map((value) => {
8616
+ this.orderBy.field = value.field;
8617
+ this.orderBy.direction = value.order === 1 ? DirectionEnumeration.ASC : DirectionEnumeration.DESC;
8618
+ });
8619
+ }
8620
+ if (arrList && arrList.length) {
8621
+ this.totalRecords = arrList.length;
8622
+ this.listData = arrList;
8623
+ this.listDataNoPage = [...arrList];
8624
+ this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
8625
+ this.listData = this.listData.slice(first, (first + rows));
8626
+ }
8627
+ else {
8628
+ this.listDataNoPage = [];
8629
+ }
8630
+ if (this.isEditMode || arrList && arrList.length === 1) {
8631
+ this.refreshCssInIE11();
8632
+ }
8633
+ this.loading = false;
8634
+ }
8635
+ /**
8636
+ * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
8637
+ */
8638
+ refreshCssInIE11() {
8639
+ if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
8640
+ setTimeout(() => {
8641
+ const row = document.getElementsByClassName("row0");
8642
+ if (row && row[0])
8643
+ row[0].className = 'refresh';
8644
+ }, 1);
8645
+ }
8646
+ }
8647
+ add() {
8648
+ this.pixAccountItemInput = {};
8649
+ this.visible = true;
8650
+ }
8651
+ deleteAnnuityItem(index) {
8652
+ let newlist = [...this.getHistoricalPixAccountList()];
8653
+ newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
8654
+ delete newlist[index];
8655
+ newlist = newlist.filter(val => val);
8656
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
8657
+ this.verifyTotalPercentage();
8658
+ this.onLazyLoad();
8659
+ }
8660
+ getHistoricalPixAccountList() {
8661
+ if (this.historicalPixAccountList.get("historicalPixAccountList") &&
8662
+ this.historicalPixAccountList.get("historicalPixAccountList").value &&
8663
+ this.historicalPixAccountList.get("historicalPixAccountList").value.length)
8664
+ return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
8665
+ else
8666
+ return [];
8667
+ }
8668
+ addItemInList($event) {
8669
+ const index = $event && $event.index >= 0 ? $event.index : null;
8670
+ const newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
8671
+ if (index != null) {
8672
+ newDataList[index] = $event;
8673
+ delete $event.index;
8674
+ }
8675
+ else {
8676
+ if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
8677
+ const customValue = mountCustomToSave($event["customFields"]);
8678
+ $event["customFields"] = [...customValue];
8679
+ }
8680
+ $event["dateChange"] = this.dateChange;
8681
+ newDataList.push($event);
8682
+ }
8683
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
8684
+ this.verifyTotalPercentage();
8685
+ this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
8686
+ }
8687
+ getNumberPageByIndex(index, list) {
8688
+ if (index) {
8689
+ const total = list.length;
8690
+ const sub = this.recordByRow - 1;
8691
+ return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
8692
+ }
8693
+ return null;
8694
+ }
8695
+ verifyTotalPercentage() {
8696
+ const list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
8697
+ const arrayPercentage = [];
8698
+ if (!list.length)
8699
+ return this.msgTotalLimitByPercentage = null;
8700
+ list.filter((item) => arrayPercentage.push(item && item["percentage"]));
8701
+ const sumPercentage = arrayPercentage.reduce((total, percentage) => {
8702
+ return total + percentage;
8703
+ }, 0);
8704
+ if (sumPercentage === 100) {
8705
+ this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
8706
+ }
8707
+ else {
8708
+ this.msgTotalLimitByPercentage = null;
8709
+ }
8710
+ }
8711
+ get scopedActions() {
8712
+ return this.actions.bind(this);
8713
+ }
8714
+ get recordsMessage() {
8715
+ return `${this.totalRecords || 0} ${this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers")}`;
8716
+ }
8717
+ get getTooltipAndDisableButtonAdd() {
8718
+ return this.dateChange ? null : this.msgTooltipAdd;
8719
+ }
8720
+ get dateChange() {
8721
+ return this._dateChange;
8722
+ }
8723
+ set dateChange(value) {
8724
+ this._dateChange = value;
8725
+ if (this._dateChange) {
8726
+ this.listData.filter((row) => row["dateChange"] = this._dateChange);
8727
+ }
8728
+ }
8729
+ get displayDateChange() {
8730
+ return this._displayDateChange;
8731
+ }
8732
+ set displayDateChange(value) {
8733
+ this._displayDateChange = value;
8734
+ if (this._displayDateChange) {
8735
+ this.listData.filter((row) => row["displayDateChange"] = this._displayDateChange);
8736
+ }
8737
+ }
8738
+ set addListData(list) {
8739
+ this.loading = true;
8740
+ this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
8741
+ this.verifyTotalPercentage();
8742
+ this.onLazyLoad();
8743
+ }
8744
+ get visible() {
8745
+ return this._visible;
8746
+ }
8747
+ set visible(value) {
8748
+ this._visible = value;
8749
+ this.visibleChange.emit(this.visible);
8750
+ }
8751
+ close() {
8752
+ this.visible = false;
8753
+ }
8754
+ getFormattedTelephoneNumber(telephoneNumber) {
8755
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
8756
+ }
8757
+ getFormattedCpf(cpf) {
8758
+ return FormatUtilsService.getFormattedCpf(cpf);
8759
+ }
8760
+ getFormattedCnpj(cnpj) {
8761
+ return FormatUtilsService.getFormattedCnpj(cnpj);
8762
+ }
8763
+ getFormattedPercentage(value) {
8764
+ return FormatUtilsService.getFormattedPercentage(value);
8765
+ }
8766
+ };
8767
+ HistoricalPixAccountComponent.ctorParameters = () => [
8768
+ { type: TranslateService },
8769
+ { type: ChangeDetectorRef },
8770
+ { type: FormBuilder }
8771
+ ];
8772
+ __decorate([
8773
+ ViewChild(CustomFieldsComponent$1, { static: false })
8774
+ ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
8775
+ __decorate([
8776
+ Input()
8777
+ ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
8778
+ __decorate([
8779
+ Input()
8780
+ ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
8781
+ __decorate([
8782
+ Input()
8783
+ ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
8784
+ __decorate([
8785
+ Input()
8786
+ ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
8787
+ __decorate([
8788
+ Input()
8789
+ ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
8790
+ __decorate([
8791
+ Input()
8792
+ ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
8793
+ __decorate([
8794
+ Input()
8795
+ ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
8796
+ __decorate([
8797
+ Input()
8798
+ ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
8799
+ __decorate([
8800
+ Input()
8801
+ ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
8802
+ __decorate([
8803
+ Input()
8804
+ ], HistoricalPixAccountComponent.prototype, "currency", void 0);
8805
+ __decorate([
8806
+ Input()
8807
+ ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
8808
+ __decorate([
8809
+ Input()
8810
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
8811
+ __decorate([
8812
+ Input()
8813
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
8814
+ __decorate([
8815
+ Input()
8816
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
8817
+ __decorate([
8818
+ Input()
8819
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
8820
+ __decorate([
8821
+ Input()
8822
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
8823
+ __decorate([
8824
+ Input()
8825
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
8826
+ __decorate([
8827
+ Input()
8828
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
8829
+ __decorate([
8830
+ Input()
8831
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
8832
+ HistoricalPixAccountComponent = __decorate([
8833
+ Component({
8834
+ // tslint:disable-next-line:component-selector
8835
+ selector: "c-historical-pix-account",
8836
+ template: "<s-sidebar *ngIf=\"withSideBar\" [visible]=\"visible\" (visibleChange)=\"close()\"\n header=\"{{'hcm.payroll.historical_pix_account_title_form'|translate}}\">\n<pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</s-sidebar>\n\n<div *ngIf=\"!withSideBar\">\n <pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [withSideBar]=\"false\"\n [isViewMode]=\"isViewMode\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</div>\n\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"actions(rowData, key).length > 1\" [label]=\"actionLabel\"\n priority=\"default\" [model]=\"scopedActions(rowData, key)\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n\n <s-button id=\"table-admission-btn-action-{{key}}\"\n *ngIf=\"actions(rowData, key).length <= 1\"\n [label]=\"scopedActions(rowData, key)[0].label\"\n priority=\"default\"\n (click)=\"scopedActions(rowData, key)[0].command()\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length +2\">\n {{'hcm.payroll.admission_empty_message'|translate}}\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span *ngIf=\"totalRecords\">{{recordsMessage}}</span>\n </ng-template>\n </p-table>\n</div>\n",
8837
+ 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}"]
8838
+ })
8839
+ ], HistoricalPixAccountComponent);
8840
+
8841
+ class GenericValidator {
8842
+ constructor() { }
8843
+ /**
8844
+ * Valida o CEI (Cadastro específico de INSS) digitado.
8845
+ */
8846
+ static isValidCei(control) {
8847
+ const cei = control.value;
8848
+ if (!cei)
8849
+ return null;
8850
+ else if (cei.length != 11)
8851
+ return null;
8852
+ const multiplicadorBase = "3298765432";
8853
+ let total = 0;
8854
+ let resto = 0;
8855
+ let multiplicando = 0;
8856
+ let multiplicador = 0;
8857
+ if (cei.length !== 11 ||
8858
+ cei === "00000000000" ||
8859
+ cei === "11111111111" ||
8860
+ cei === "22222222222" ||
8861
+ cei === "33333333333" ||
8862
+ cei === "44444444444" ||
8863
+ cei === "55555555555" ||
8864
+ cei === "66666666666" ||
8865
+ cei === "77777777777" ||
8866
+ cei === "88888888888" ||
8867
+ cei === "99999999999")
8868
+ return { invalidCei: true };
8869
+ else {
8870
+ for (let i = 0; i < 10; i++) {
8871
+ multiplicando = parseInt(cei.substring(i, i + 1), 10);
8872
+ multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
8873
+ total += multiplicando * multiplicador;
8874
+ }
8875
+ resto = 11 - (total % 11);
8876
+ resto = resto === 10 || resto === 11 ? 0 : resto;
8877
+ const digito = parseInt("" + cei.charAt(10), 10);
8878
+ return resto === digito ? null : { invalidCei: true };
8879
+ }
8880
+ }
8881
+ /**
8882
+ * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
8883
+ */
8884
+ static isValidCpf(control) {
8885
+ const cpf = control.value;
8886
+ if (cpf) {
8887
+ let numbers, digits, sum, i, result, equalDigits;
8888
+ equalDigits = 1;
8889
+ if (cpf.length < 11) {
8890
+ return null;
8891
+ }
8892
+ for (i = 0; i < cpf.length - 1; i++) {
8893
+ if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
8894
+ equalDigits = 0;
8895
+ break;
8896
+ }
8897
+ }
8898
+ if (!equalDigits) {
8899
+ numbers = cpf.substring(0, 9);
8900
+ digits = cpf.substring(9);
8901
+ sum = 0;
8902
+ for (i = 10; i > 1; i--) {
8903
+ sum += numbers.charAt(10 - i) * i;
8904
+ }
8905
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8906
+ if (result !== Number(digits.charAt(0))) {
8907
+ return { cpfNotValid: true };
8908
+ }
8909
+ numbers = cpf.substring(0, 10);
8910
+ sum = 0;
8911
+ for (i = 11; i > 1; i--) {
8912
+ sum += numbers.charAt(11 - i) * i;
8913
+ }
8914
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8915
+ if (result !== Number(digits.charAt(1))) {
8916
+ return { cpfNotValid: true };
8917
+ }
8918
+ return null;
8919
+ }
8920
+ else {
8921
+ return { cpfNotValid: true };
8922
+ }
8923
+ }
8924
+ return null;
8925
+ }
8926
+ /**
8927
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
8928
+ */
8929
+ static isValidCnpj(control) {
8930
+ let cnpj = control.value;
8931
+ if (cnpj) {
8932
+ let size, numbers, digits, sum, pos, result;
8933
+ cnpj = cnpj.replace(/[^\d]+/g, '');
8934
+ if (cnpj.length !== 14) {
8935
+ return null;
8936
+ }
8937
+ // Elimina CNPJs invalidos conhecidos
8938
+ if (cnpj === '00000000000000' ||
8939
+ cnpj === '11111111111111' ||
8940
+ cnpj === '22222222222222' ||
8941
+ cnpj === '33333333333333' ||
8942
+ cnpj === '44444444444444' ||
8943
+ cnpj === '55555555555555' ||
8944
+ cnpj === '66666666666666' ||
8945
+ cnpj === '77777777777777' ||
8946
+ cnpj === '88888888888888' ||
8947
+ cnpj === '99999999999999') {
8948
+ return { cnpjNotValid: true };
8949
+ }
8950
+ // Valida DVs
8951
+ size = cnpj.length - 2;
8952
+ numbers = cnpj.substring(0, size);
8953
+ digits = cnpj.substring(size);
8954
+ sum = 0;
8955
+ pos = size - 7;
8956
+ for (let i = size; i >= 1; i--) {
8957
+ sum += numbers.charAt(size - i) * pos--;
8958
+ if (pos < 2) {
8959
+ pos = 9;
8960
+ }
8961
+ }
8962
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8963
+ if (result !== Number(digits.charAt(0))) {
8964
+ return { cnpjNotValid: true };
8965
+ }
8966
+ size = size + 1;
8967
+ numbers = cnpj.substring(0, size);
8968
+ sum = 0;
8969
+ pos = size - 7;
8970
+ for (let i = size; i >= 1; i--) {
8971
+ sum += numbers.charAt(size - i) * pos--;
8972
+ if (pos < 2) {
8973
+ pos = 9;
8974
+ }
8975
+ }
8976
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
8977
+ if (result !== Number(digits.charAt(1))) {
8978
+ return { cnpjNotValid: true };
8979
+ }
8980
+ return null;
8981
+ }
8982
+ return null;
8983
+ }
8984
+ /**
8985
+ * Válida o número de telefone da chave PIX.
8986
+ */
8987
+ static isValidPhoneNumber(control) {
8988
+ let cellPhoneKey = control.value || '';
8989
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
8990
+ const regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
8991
+ const isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
8992
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
8993
+ }
8994
+ /**
8995
+ * Valida o email da chave PIX.
8996
+ */
8997
+ static isValidEmail(control) {
8998
+ const emailKey = control.value;
8999
+ const regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9000
+ const isValidEmail = regexValidEmail.test(emailKey);
9001
+ return isValidEmail ? null : { invalidEmail: true };
9002
+ }
9003
+ }
9004
+
9005
+ let HistoricalPixAccountFormComponent = class HistoricalPixAccountFormComponent {
9006
+ constructor(formBuilder, cd) {
9007
+ this.formBuilder = formBuilder;
9008
+ this.cd = cd;
9009
+ this.withSideBar = true;
9010
+ this.isEditMode = false;
9011
+ this.paramsForm = new FormGroup({});
9012
+ this.defaultCpfNumber = null;
9013
+ this.visibleChange = new EventEmitter();
9014
+ this.pixAccountItemToList = new EventEmitter();
9015
+ this.ngUnsubscribe = new Subject();
9016
+ this.initialValidatorOfPercentage = [Validators.required, Validators.min(0.01)];
9017
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9018
+ this.maxValuePercentage = 100.00;
9019
+ this.visibleBtnSave = true;
9020
+ this.isView = false;
9021
+ this.isShowPixKeyFieldValidatorMessage = false;
9022
+ this.createFormGroup();
9023
+ this.registerSubjects();
9024
+ }
9025
+ ngOnInit() {
9026
+ }
9027
+ ngAfterViewInit() {
9028
+ this.cd.detectChanges();
9029
+ }
9030
+ ngOnDestroy() {
9031
+ this.ngUnsubscribe.next(true);
9032
+ this.ngUnsubscribe.unsubscribe();
9033
+ }
9034
+ registerSubjects() {
9035
+ }
9036
+ createFormGroup() {
9037
+ this.pixAccountFormGroup = this.formBuilder.group({
9038
+ id: this.formBuilder.control(null),
9039
+ index: this.formBuilder.control(null),
9040
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9041
+ dateChange: this.formBuilder.control(null),
9042
+ pixKeyType: this.formBuilder.control(null, Validators.required),
9043
+ pixKey: this.formBuilder.control(null),
9044
+ percentage: this.formBuilder.control(null, Validators.compose([
9045
+ ...this.initialValidatorOfPercentage,
9046
+ Validators.max(this.maxValuePercentage),
9047
+ ])),
9048
+ customFields: this.formBuilder.control(null),
9049
+ });
9050
+ }
9051
+ onChangePixKeyType(item) {
9052
+ if (item.key) {
9053
+ this.pixKeyType = item.key;
9054
+ this.isShowPixKeyFieldValidatorMessage = true;
9055
+ this.pixAccountFormGroup.get("pixKey").reset();
9056
+ this.setPixKeyValidators(true);
9057
+ if (item.key === "CPF") {
9058
+ this.setDefaultCpfPixKey();
9059
+ }
9060
+ }
9061
+ }
9062
+ onClearPixKeyType() {
9063
+ this.isShowPixKeyFieldValidatorMessage = false;
9064
+ this.pixAccountFormGroup.get("pixKey").reset();
9065
+ }
9066
+ get visible() {
9067
+ return this._visible;
9068
+ }
9069
+ set visible(value) {
9070
+ this._visible = value;
9071
+ this.visibleChange.emit(this.visible);
9072
+ }
9073
+ set isEditAndViewValue(value) {
9074
+ this.resetForm();
9075
+ this.visibleBtnSave = true;
9076
+ if (value && value.currentItem && Object.keys(value.currentItem).length) {
9077
+ this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(Object.assign({}, value.currentItem)));
9078
+ this.labelBtnAdd = "hcm.payroll.employees_update";
9079
+ this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
9080
+ if (!this.isView) {
9081
+ this.configEnableFields(value && value["isEditMode"]);
9082
+ }
9083
+ else {
9084
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
9085
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9086
+ this.formatPixKeyTelehponeNumber();
9087
+ }
9088
+ }
9089
+ }
9090
+ else {
9091
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9092
+ }
9093
+ }
9094
+ formatPixKeyTelehponeNumber() {
9095
+ if (this.pixKeyType === "TELEPHONE") {
9096
+ this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
9097
+ }
9098
+ }
9099
+ convertDTOToShowWithCustomFields(data) {
9100
+ const obj = Object.assign({}, data);
9101
+ obj["customFields"] = mountCustomToShow(obj["customFields"]);
9102
+ return obj;
9103
+ }
9104
+ configEnableFields(isEditMode) {
9105
+ this.visibleBtnSave = isEditMode;
9106
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
9107
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9108
+ this.setPixKeyValidators(isEditMode);
9109
+ this.formatPixKeyTelehponeNumber();
9110
+ }
9111
+ configEnabledFields(this.pixAccountFormGroup, isEditMode, [
9112
+ "pixKeyType",
9113
+ "pixKey",
9114
+ "percentage",
9115
+ "customFields",
9116
+ ], []);
9117
+ }
9118
+ close() {
9119
+ this.resetForm();
9120
+ this.visible = false;
9121
+ }
9122
+ addItem() {
9123
+ this.pixAccountFormGroup.updateValueAndValidity();
9124
+ verifyValidationsForm.call(this.pixAccountFormGroup);
9125
+ if (this.pixAccountFormGroup.valid) {
9126
+ if (this.employeeId) {
9127
+ this.pixAccountFormGroup.get("employee").setValue({
9128
+ tableId: this.employeeId,
9129
+ name: "",
9130
+ });
9131
+ }
9132
+ this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
9133
+ this.visible = false;
9134
+ this.resetForm();
9135
+ }
9136
+ }
9137
+ resetForm() {
9138
+ this.pixAccountFormGroup.reset();
9139
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9140
+ if (this.customFields && this.customFields.formGroup)
9141
+ this.customFields.formGroup.reset();
9142
+ }
9143
+ get percentagePlaceholder() {
9144
+ return `0${this.currency && this.currency.decimalSeparator}00`;
9145
+ }
9146
+ get optionsPercentage() {
9147
+ return Object.assign({}, this.getOptions(), { precision: 2 });
9148
+ }
9149
+ getOptions() {
9150
+ return {
9151
+ prefix: "",
9152
+ thousands: this.currency.thousandsSeparator,
9153
+ decimal: this.currency.decimalSeparator,
9154
+ };
9155
+ }
9156
+ /**
9157
+ * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
9158
+ * @param pixAccountList
9159
+ */
9160
+ set getListPixAccount(pixAccountList) {
9161
+ if (pixAccountList) {
9162
+ this.setValidatorsAccordingList(pixAccountList, null, false);
9163
+ }
9164
+ else {
9165
+ this.resetForm();
9166
+ }
9167
+ }
9168
+ /**
9169
+ * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
9170
+ * a validação dos campos "percentage" e "pixAccount".
9171
+ * 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
9172
+ * no array de comparação dos validators.
9173
+ * @param pixAccountList
9174
+ * @param index
9175
+ */
9176
+ setValidatorsAccordingList(pixAccountList, index = null, isEditMode = true) {
9177
+ this.pixAccountList = pixAccountList && pixAccountList.length ? [...pixAccountList] : [];
9178
+ const percentageIncluded = [];
9179
+ if (this.pixAccountList && this.pixAccountList.length) {
9180
+ this.pixAccountList.filter((field, key) => {
9181
+ if (field["percentage"] && key != index) {
9182
+ percentageIncluded.push(field["percentage"]);
9183
+ }
9184
+ });
9185
+ }
9186
+ this.beforeSetPixKeyTypeValidator();
9187
+ this.setPixKeyValidators(isEditMode);
9188
+ this.validatePercentageValid(percentageIncluded);
9189
+ }
9190
+ /**
9191
+ * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
9192
+ */
9193
+ setPixKeyValidators(isEditMode) {
9194
+ const genericPixKey = this.pixAccountFormGroup.get("pixKey");
9195
+ if (this.pixKeyType) {
9196
+ switch (this.pixKeyType) {
9197
+ case "TELEPHONE":
9198
+ genericPixKey.setValidators(Validators.compose([
9199
+ Validators.required, GenericValidator.isValidPhoneNumber,
9200
+ ]));
9201
+ break;
9202
+ case "EMAIL":
9203
+ genericPixKey.setValidators(Validators.compose([
9204
+ Validators.required, GenericValidator.isValidEmail,
9205
+ ]));
9206
+ break;
9207
+ case "CPF":
9208
+ genericPixKey.setValidators(Validators.compose([
9209
+ Validators.required, GenericValidator.isValidCpf,
9210
+ ]));
9211
+ break;
9212
+ case "CNPJ":
9213
+ genericPixKey.setValidators(Validators.compose([
9214
+ Validators.required, GenericValidator.isValidCnpj,
9215
+ ]));
9216
+ break;
9217
+ case "RANDOM_KEY":
9218
+ genericPixKey.setValidators(Validators.required);
9219
+ break;
9220
+ default:
9221
+ genericPixKey.setValidators(null);
9222
+ break;
9223
+ }
9224
+ if (isEditMode) {
9225
+ genericPixKey.enable();
9226
+ }
9227
+ genericPixKey.updateValueAndValidity();
9228
+ }
9229
+ }
9230
+ /**
9231
+ * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
9232
+ * 100% na validação do campo "percentage" como um novo maxValue;
9233
+ * @param listValue
9234
+ */
9235
+ validatePercentageValid(listValue) {
9236
+ const percentage = this.pixAccountFormGroup.get("percentage");
9237
+ this.maxValuePercentage = listValue
9238
+ .reduce((currentValue, total) => currentValue - total, 100.00);
9239
+ percentage
9240
+ .setValidators(Validators.compose([
9241
+ ...this.initialValidatorOfPercentage,
9242
+ Validators.max(this.maxValuePercentage),
9243
+ ]));
9244
+ percentage.updateValueAndValidity();
9245
+ }
9246
+ set isViewMode(condition) {
9247
+ this.isView = !!(condition && !this.withSideBar);
9248
+ this.configEnableFields(!this.isView);
9249
+ if (!this.isView)
9250
+ this.resetForm();
9251
+ }
9252
+ phoneMask(event) {
9253
+ FormatUtilsService.formatTelephoneInputEvent(event);
9254
+ }
9255
+ setDefaultCpfPixKey() {
9256
+ if (this.defaultCpfNumber) {
9257
+ this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
9258
+ }
9259
+ else {
9260
+ const sheetDocument = this.paramsForm.get("sheetDocument");
9261
+ if (sheetDocument) {
9262
+ const cpf = sheetDocument.get("cpfNumber").value;
9263
+ if (cpf) {
9264
+ this.pixAccountFormGroup.get("pixKey").setValue(cpf);
9265
+ }
9266
+ }
9267
+ }
9268
+ }
9269
+ beforeSetPixKeyTypeValidator() {
9270
+ const pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
9271
+ if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
9272
+ pixKeyType
9273
+ .setValidators(Validators.compose([
9274
+ Validators.required,
9275
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
9276
+ ]));
9277
+ }
9278
+ else {
9279
+ pixKeyType.setValidators(Validators.required);
9280
+ }
9281
+ }
9282
+ validateDuplicatePixKeyTypeBankAccount(listCompare) {
9283
+ return (control) => {
9284
+ const value = control && control.value;
9285
+ let condition = false;
9286
+ listCompare.filter((field) => {
9287
+ if (value) {
9288
+ if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
9289
+ return condition = true;
9290
+ }
9291
+ }
9292
+ });
9293
+ if (condition) {
9294
+ return { pixKeyTypeBankAccountDuplicate: true };
9295
+ }
9296
+ else {
9297
+ return null;
9298
+ }
9299
+ };
9300
+ }
9301
+ };
9302
+ HistoricalPixAccountFormComponent.ctorParameters = () => [
9303
+ { type: FormBuilder },
9304
+ { type: ChangeDetectorRef }
9305
+ ];
9306
+ __decorate([
9307
+ ViewChild(CustomFieldsComponent$1, { static: true })
9308
+ ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
9309
+ __decorate([
9310
+ Input()
9311
+ ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
9312
+ __decorate([
9313
+ Input()
9314
+ ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
9315
+ __decorate([
9316
+ Input()
9317
+ ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
9318
+ __decorate([
9319
+ Input()
9320
+ ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
9321
+ __decorate([
9322
+ Input()
9323
+ ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
9324
+ __decorate([
9325
+ Input()
9326
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
9327
+ __decorate([
9328
+ Input()
9329
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
9330
+ __decorate([
9331
+ Output()
9332
+ ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
9333
+ __decorate([
9334
+ Output()
9335
+ ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
9336
+ __decorate([
9337
+ Input()
9338
+ ], HistoricalPixAccountFormComponent.prototype, "visible", null);
9339
+ __decorate([
9340
+ Input()
9341
+ ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
9342
+ __decorate([
9343
+ Input()
9344
+ ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
9345
+ __decorate([
9346
+ Input()
9347
+ ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
9348
+ HistoricalPixAccountFormComponent = __decorate([
9349
+ Component({
9350
+ selector: "pix-account",
9351
+ 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\"/>\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",
9352
+ 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}"]
9353
+ })
9354
+ ], HistoricalPixAccountFormComponent);
9355
+
9356
+ let HistoricalPixAccountService = class HistoricalPixAccountService {
9357
+ constructor(http) {
9358
+ this.http = http;
9359
+ }
9360
+ query(path, body, service = ServiceType.PAYROLL) {
9361
+ return this.http.query(path, body, service);
9362
+ }
9363
+ };
9364
+ HistoricalPixAccountService.ctorParameters = () => [
9365
+ { type: HttpClientService }
9366
+ ];
9367
+ HistoricalPixAccountService = __decorate([
9368
+ Injectable()
9369
+ ], HistoricalPixAccountService);
9370
+
9371
+ let HistoricalPixAccountModule = class HistoricalPixAccountModule {
9372
+ };
9373
+ HistoricalPixAccountModule = __decorate([
9374
+ NgModule({
9375
+ imports: [
9376
+ CommonModule,
9377
+ FormsModule,
9378
+ HttpClientModule,
9379
+ AutoCompleteModule,
9380
+ SharedModule,
9381
+ ReactiveFormsModule,
9382
+ TableModule,
9383
+ ButtonModule,
9384
+ TooltipModule,
9385
+ LoadingStateModule,
9386
+ SidebarModule,
9387
+ InputDateModule,
9388
+ ControlErrorsModule,
9389
+ InputRestAutoCompleteEnumModule,
9390
+ CurrencyMaskModule,
9391
+ InputRestAutoCompleteModule,
9392
+ InputTextModule,
9393
+ CoreDirectives,
9394
+ FieldsetModule,
9395
+ CustomFieldsModule$1,
9396
+ PanelModule,
9397
+ InputMaskModule,
9398
+ ],
9399
+ declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
9400
+ providers: [HistoricalPixAccountService, ConfirmationService],
9401
+ exports: [HistoricalPixAccountComponent],
9402
+ })
9403
+ ], HistoricalPixAccountModule);
9404
+
8428
9405
  /*
8429
9406
  * Public API Surface of core
8430
9407
  */
@@ -8433,5 +9410,5 @@ FromToModule = __decorate([
8433
9410
  * Generated bundle index. Do not edit.
8434
9411
  */
8435
9412
 
8436
- 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, 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 };
9413
+ 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, 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 };
8437
9414
  //# sourceMappingURL=senior-gestao-pessoas-payroll-core.js.map