@senior-gestao-pessoas/payroll-core 9.5.0 → 9.6.0

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 (19) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +857 -815
  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 +4 -2
  6. package/components/historical-pix-account/historical-pix-account.component.d.ts +5 -1
  7. package/components/historical-pix-account-list/historical-pix-account-list.component.d.ts +1 -0
  8. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +18 -3
  9. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +30 -7
  10. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.component.js +6 -2
  11. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +19 -3
  12. package/esm5/components/historical-pix-account/historical-pix-account.component.js +30 -7
  13. package/esm5/components/historical-pix-account-list/historical-pix-account-list.component.js +6 -2
  14. package/fesm2015/senior-gestao-pessoas-payroll-core.js +732 -691
  15. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  16. package/fesm5/senior-gestao-pessoas-payroll-core.js +857 -815
  17. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  18. package/package.json +1 -1
  19. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
@@ -9421,443 +9421,6 @@
9421
9421
  return FormatUtilsService;
9422
9422
  }());
9423
9423
 
9424
- var HistoricalPixAccountComponent = /** @class */ (function () {
9425
- function HistoricalPixAccountComponent(translateService, cd, formBuilder, messageService) {
9426
- var _this = this;
9427
- this.translateService = translateService;
9428
- this.cd = cd;
9429
- this.formBuilder = formBuilder;
9430
- this.messageService = messageService;
9431
- this.recordByRow = 1;
9432
- this.showDateChange = false;
9433
- this.isEditMode = false;
9434
- this.isViewMode = false;
9435
- this.withSideBar = true;
9436
- this.defaultCpfNumber = null;
9437
- this.listDataReciever = [];
9438
- this.isViewModeActive = new core.EventEmitter();
9439
- this.isEditModeActive = new core.EventEmitter();
9440
- this.isDeleteModeActive = new core.EventEmitter();
9441
- this.listFromApp = [];
9442
- this.visibleChange = new core.EventEmitter();
9443
- this.ngUnsubscribe = new rxjs.Subject();
9444
- this.orderBy = {
9445
- field: "dateChange",
9446
- direction: exports.DirectionEnumeration.DESC,
9447
- };
9448
- this.pixAccountItemInput = {};
9449
- this.totalRecords = 0;
9450
- this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9451
- this.loading = true;
9452
- this.listData = [];
9453
- this.listDataNoPage = [];
9454
- this.cols = [
9455
- {
9456
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9457
- field: "pixKeyType",
9458
- },
9459
- {
9460
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9461
- field: "pixKey",
9462
- },
9463
- {
9464
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9465
- field: "percentage",
9466
- },
9467
- ];
9468
- this.actions = function (rowData, key) {
9469
- if (rowData === void 0) { rowData = {}; }
9470
- return [
9471
- {
9472
- visible: _this.isEditMode,
9473
- label: _this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9474
- command: function () {
9475
- if (_this.isAllowToViewHistorical) {
9476
- rowData["index"] = key;
9477
- _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: false };
9478
- _this.visible = true;
9479
- }
9480
- else {
9481
- _this.isViewModeActive.emit(true);
9482
- }
9483
- },
9484
- },
9485
- {
9486
- visible: !!(!_this.isEditMode && _this.withSideBar),
9487
- label: _this.translateService.instant("hcm.payroll.edit"),
9488
- command: function () {
9489
- if (_this.isAllowToEditHistorical) {
9490
- rowData["index"] = key;
9491
- _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
9492
- _this.visible = true;
9493
- }
9494
- else {
9495
- _this.isEditModeActive.emit(true);
9496
- if (_this.listFromApp.length == 0) {
9497
- rowData["index"] = key;
9498
- _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
9499
- _this.visible = true;
9500
- }
9501
- }
9502
- },
9503
- },
9504
- {
9505
- visible: !_this.isEditMode,
9506
- label: _this.translateService.instant("hcm.payroll.delete"),
9507
- command: function () {
9508
- if (_this.isAllowToDeleteHistorical) {
9509
- _this.loading = true;
9510
- _this.deleteAnnuityItem(key);
9511
- }
9512
- else {
9513
- _this.isDeleteModeActive.emit(true);
9514
- if (_this.listFromApp.length == 0) {
9515
- _this.loading = true;
9516
- _this.deleteAnnuityItem(key);
9517
- }
9518
- }
9519
- },
9520
- },
9521
- ];
9522
- };
9523
- this.createFormGroup();
9524
- }
9525
- HistoricalPixAccountComponent.prototype.ngOnInit = function () {
9526
- this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9527
- };
9528
- HistoricalPixAccountComponent.prototype.ngOnChanges = function (changes) {
9529
- if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
9530
- this.listFromApp = changes['listDataReciever'].currentValue;
9531
- }
9532
- };
9533
- HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9534
- this.historicalPixAccountList = this.formBuilder.group({
9535
- historicalPixAccountList: this.formBuilder.control(null),
9536
- });
9537
- };
9538
- HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
9539
- this.ngUnsubscribe.next();
9540
- this.ngUnsubscribe.complete();
9541
- };
9542
- HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9543
- this.cd.detectChanges();
9544
- };
9545
- HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
9546
- var _this = this;
9547
- var first = event && event.first ? event.first : 0;
9548
- var rows = event && event.rows ? event.rows : this.recordByRow;
9549
- var arrList = this.getHistoricalPixAccountList();
9550
- this.listData = [];
9551
- this.totalRecords = null;
9552
- if (event && event.multiSortMeta && event.multiSortMeta.length) {
9553
- event.multiSortMeta.map(function (value) {
9554
- _this.orderBy.field = value.field;
9555
- _this.orderBy.direction = value.order === 1 ? exports.DirectionEnumeration.ASC : exports.DirectionEnumeration.DESC;
9556
- });
9557
- }
9558
- if (arrList && arrList.length) {
9559
- this.totalRecords = arrList.length;
9560
- this.listData = arrList;
9561
- this.listDataNoPage = __spread(arrList);
9562
- this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9563
- this.listData = this.listData.slice(first, (first + rows));
9564
- }
9565
- else {
9566
- this.listDataNoPage = [];
9567
- }
9568
- if (this.isEditMode || arrList && arrList.length === 1) {
9569
- this.refreshCssInIE11();
9570
- }
9571
- this.loading = false;
9572
- };
9573
- /**
9574
- * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
9575
- */
9576
- HistoricalPixAccountComponent.prototype.refreshCssInIE11 = function () {
9577
- if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
9578
- setTimeout(function () {
9579
- var row = document.getElementsByClassName("row0");
9580
- if (row && row[0])
9581
- row[0].className = 'refresh';
9582
- }, 1);
9583
- }
9584
- };
9585
- HistoricalPixAccountComponent.prototype.add = function () {
9586
- this.pixAccountItemInput = {};
9587
- this.visible = true;
9588
- };
9589
- HistoricalPixAccountComponent.prototype.isNotAllowMessage = function () {
9590
- this.messageService.add({
9591
- severity: "error",
9592
- summary: this.translateService.instant("hcm.payroll.error"),
9593
- detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9594
- });
9595
- };
9596
- HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
9597
- var newlist = __spread(this.getHistoricalPixAccountList());
9598
- newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9599
- delete newlist[index];
9600
- newlist = newlist.filter(function (val) { return val; });
9601
- this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
9602
- this.verifyTotalPercentage();
9603
- this.onLazyLoad();
9604
- };
9605
- HistoricalPixAccountComponent.prototype.getHistoricalPixAccountList = function () {
9606
- if (this.historicalPixAccountList.get("historicalPixAccountList") &&
9607
- this.historicalPixAccountList.get("historicalPixAccountList").value &&
9608
- this.historicalPixAccountList.get("historicalPixAccountList").value.length)
9609
- return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
9610
- else
9611
- return [];
9612
- };
9613
- HistoricalPixAccountComponent.prototype.addItemInList = function ($event) {
9614
- var index = $event && $event.index >= 0 ? $event.index : null;
9615
- var newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9616
- if (index != null) {
9617
- newDataList[index] = $event;
9618
- delete $event.index;
9619
- }
9620
- else {
9621
- if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
9622
- var customValue = mountCustomToSave($event["customFields"]);
9623
- $event["customFields"] = __spread(customValue);
9624
- }
9625
- $event["dateChange"] = this.dateChange;
9626
- newDataList.push($event);
9627
- }
9628
- this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9629
- this.verifyTotalPercentage();
9630
- this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
9631
- };
9632
- HistoricalPixAccountComponent.prototype.getNumberPageByIndex = function (index, list) {
9633
- if (index) {
9634
- var total = list.length;
9635
- var sub = this.recordByRow - 1;
9636
- return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
9637
- }
9638
- return null;
9639
- };
9640
- HistoricalPixAccountComponent.prototype.verifyTotalPercentage = function () {
9641
- var list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9642
- var arrayPercentage = [];
9643
- if (!list.length)
9644
- return this.msgTotalLimitByPercentage = null;
9645
- list.filter(function (item) { return arrayPercentage.push(item && item["percentage"]); });
9646
- var sumPercentage = arrayPercentage.reduce(function (total, percentage) {
9647
- return total + percentage;
9648
- }, 0);
9649
- if (sumPercentage === 100) {
9650
- this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
9651
- }
9652
- else {
9653
- this.msgTotalLimitByPercentage = null;
9654
- }
9655
- };
9656
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
9657
- get: function () {
9658
- return this.actions.bind(this);
9659
- },
9660
- enumerable: true,
9661
- configurable: true
9662
- });
9663
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
9664
- get: function () {
9665
- return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
9666
- },
9667
- enumerable: true,
9668
- configurable: true
9669
- });
9670
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "getTooltipAndDisableButtonAdd", {
9671
- get: function () {
9672
- return this.dateChange ? null : this.msgTooltipAdd;
9673
- },
9674
- enumerable: true,
9675
- configurable: true
9676
- });
9677
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "dateChange", {
9678
- get: function () {
9679
- return this._dateChange;
9680
- },
9681
- set: function (value) {
9682
- var _this = this;
9683
- this._dateChange = value;
9684
- if (this._dateChange) {
9685
- this.listData.filter(function (row) { return row["dateChange"] = _this._dateChange; });
9686
- }
9687
- },
9688
- enumerable: true,
9689
- configurable: true
9690
- });
9691
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
9692
- get: function () {
9693
- return this._displayDateChange;
9694
- },
9695
- set: function (value) {
9696
- var _this = this;
9697
- this._displayDateChange = value;
9698
- if (this._displayDateChange) {
9699
- this.listData.filter(function (row) { return row["displayDateChange"] = _this._displayDateChange; });
9700
- }
9701
- },
9702
- enumerable: true,
9703
- configurable: true
9704
- });
9705
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "addListData", {
9706
- set: function (list) {
9707
- this.loading = true;
9708
- this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
9709
- this.verifyTotalPercentage();
9710
- this.onLazyLoad();
9711
- },
9712
- enumerable: true,
9713
- configurable: true
9714
- });
9715
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
9716
- get: function () {
9717
- return this._visible;
9718
- },
9719
- set: function (value) {
9720
- this._visible = value;
9721
- this.visibleChange.emit(this.visible);
9722
- },
9723
- enumerable: true,
9724
- configurable: true
9725
- });
9726
- HistoricalPixAccountComponent.prototype.close = function () {
9727
- this.visible = false;
9728
- };
9729
- HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
9730
- return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9731
- };
9732
- HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
9733
- return FormatUtilsService.getFormattedCpf(cpf);
9734
- };
9735
- HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
9736
- return FormatUtilsService.getFormattedCnpj(cnpj);
9737
- };
9738
- HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
9739
- return FormatUtilsService.getFormattedPercentage(value);
9740
- };
9741
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
9742
- get: function () {
9743
- return (this.permission["incluir"]);
9744
- },
9745
- enumerable: true,
9746
- configurable: true
9747
- });
9748
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToDeleteHistorical", {
9749
- get: function () {
9750
- return (this.permission["excluir"]);
9751
- },
9752
- enumerable: true,
9753
- configurable: true
9754
- });
9755
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToEditHistorical", {
9756
- get: function () {
9757
- return (this.permission["editar"]);
9758
- },
9759
- enumerable: true,
9760
- configurable: true
9761
- });
9762
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToViewHistorical", {
9763
- get: function () {
9764
- return (this.permission["visualizar"]);
9765
- },
9766
- enumerable: true,
9767
- configurable: true
9768
- });
9769
- HistoricalPixAccountComponent.ctorParameters = function () { return [
9770
- { type: core$1.TranslateService },
9771
- { type: core.ChangeDetectorRef },
9772
- { type: forms.FormBuilder },
9773
- { type: api.MessageService }
9774
- ]; };
9775
- __decorate([
9776
- core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
9777
- ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
9778
- __decorate([
9779
- core.Input()
9780
- ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
9781
- __decorate([
9782
- core.Input()
9783
- ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
9784
- __decorate([
9785
- core.Input()
9786
- ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
9787
- __decorate([
9788
- core.Input()
9789
- ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
9790
- __decorate([
9791
- core.Input()
9792
- ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
9793
- __decorate([
9794
- core.Input()
9795
- ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
9796
- __decorate([
9797
- core.Input()
9798
- ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
9799
- __decorate([
9800
- core.Input()
9801
- ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
9802
- __decorate([
9803
- core.Input()
9804
- ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
9805
- __decorate([
9806
- core.Input()
9807
- ], HistoricalPixAccountComponent.prototype, "currency", void 0);
9808
- __decorate([
9809
- core.Input()
9810
- ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9811
- __decorate([
9812
- core.Input()
9813
- ], HistoricalPixAccountComponent.prototype, "customService", void 0);
9814
- __decorate([
9815
- core.Input()
9816
- ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
9817
- __decorate([
9818
- core.Input()
9819
- ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
9820
- __decorate([
9821
- core.Input()
9822
- ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
9823
- __decorate([
9824
- core.Input()
9825
- ], HistoricalPixAccountComponent.prototype, "permission", void 0);
9826
- __decorate([
9827
- core.Input()
9828
- ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
9829
- __decorate([
9830
- core.Output()
9831
- ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
9832
- __decorate([
9833
- core.Output()
9834
- ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
9835
- __decorate([
9836
- core.Output()
9837
- ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
9838
- __decorate([
9839
- core.Input()
9840
- ], HistoricalPixAccountComponent.prototype, "dateChange", null);
9841
- __decorate([
9842
- core.Input()
9843
- ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
9844
- __decorate([
9845
- core.Input()
9846
- ], HistoricalPixAccountComponent.prototype, "addListData", null);
9847
- __decorate([
9848
- core.Input()
9849
- ], HistoricalPixAccountComponent.prototype, "visible", null);
9850
- HistoricalPixAccountComponent = __decorate([
9851
- core.Component({
9852
- // tslint:disable-next-line:component-selector
9853
- selector: "c-historical-pix-account",
9854
- template: "<s-sidebar *ngIf=\"withSideBar\" [visible]=\"visible\" (visibleChange)=\"close()\"\n header=\"{{'hcm.payroll.historical_pix_account_title_form'|translate}}\">\n<pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</s-sidebar>\n\n<div *ngIf=\"!withSideBar\">\n <pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [withSideBar]=\"false\"\n [isViewMode]=\"isViewMode\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</div>\n\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"!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",
9855
- styles: [".refresh{width:100%!important}#table-annuity .col-default-s{width:10%}#table-annuity .col-default-m{width:12%}#table-annuity .col-default-l{width:16%}#table-annuity .col-action{width:10%}#table-annuity .icon-warning{text-align:center!important;color:#ff6d00c7!important}@media screen and (max-width:612px){#table-annuity .col-default-1,#table-annuity .col-default-2{width:16%}#table-annuity .col-default-3{width:26%}#table-annuity .col-icon{width:10%}#table-annuity .col-action{width:27%}}#main{display:-webkit-box;display:flex;height:100%;width:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}#main form{height:100%}#main .footer{border-top:1px solid #ccc;padding-top:15px;margin-top:15px;flex-shrink:0;margin-bottom:-18px}#main .footer-s-border{padding-left:7px;flex-shrink:0;margin-bottom:-18px}"]
9856
- })
9857
- ], HistoricalPixAccountComponent);
9858
- return HistoricalPixAccountComponent;
9859
- }());
9860
-
9861
9424
  var GenericValidator = /** @class */ (function () {
9862
9425
  function GenericValidator() {
9863
9426
  }
@@ -9916,489 +9479,964 @@
9916
9479
  break;
9917
9480
  }
9918
9481
  }
9919
- if (!equalDigits) {
9920
- numbers = cpf.substring(0, 9);
9921
- digits = cpf.substring(9);
9922
- sum = 0;
9923
- for (i = 10; i > 1; i--) {
9924
- sum += numbers.charAt(10 - i) * i;
9925
- }
9926
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9927
- if (result !== Number(digits.charAt(0))) {
9928
- return { cpfNotValid: true };
9929
- }
9930
- numbers = cpf.substring(0, 10);
9931
- sum = 0;
9932
- for (i = 11; i > 1; i--) {
9933
- sum += numbers.charAt(11 - i) * i;
9482
+ if (!equalDigits) {
9483
+ numbers = cpf.substring(0, 9);
9484
+ digits = cpf.substring(9);
9485
+ sum = 0;
9486
+ for (i = 10; i > 1; i--) {
9487
+ sum += numbers.charAt(10 - i) * i;
9488
+ }
9489
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9490
+ if (result !== Number(digits.charAt(0))) {
9491
+ return { cpfNotValid: true };
9492
+ }
9493
+ numbers = cpf.substring(0, 10);
9494
+ sum = 0;
9495
+ for (i = 11; i > 1; i--) {
9496
+ sum += numbers.charAt(11 - i) * i;
9497
+ }
9498
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9499
+ if (result !== Number(digits.charAt(1))) {
9500
+ return { cpfNotValid: true };
9501
+ }
9502
+ return null;
9503
+ }
9504
+ else {
9505
+ return { cpfNotValid: true };
9506
+ }
9507
+ }
9508
+ return null;
9509
+ };
9510
+ /**
9511
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9512
+ */
9513
+ GenericValidator.isValidCnpj = function (control) {
9514
+ var cnpj = control.value;
9515
+ if (cnpj) {
9516
+ var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9517
+ cnpj = cnpj.replace(/[^\d]+/g, '');
9518
+ if (cnpj.length !== 14) {
9519
+ return null;
9520
+ }
9521
+ // Elimina CNPJs invalidos conhecidos
9522
+ if (cnpj === '00000000000000' ||
9523
+ cnpj === '11111111111111' ||
9524
+ cnpj === '22222222222222' ||
9525
+ cnpj === '33333333333333' ||
9526
+ cnpj === '44444444444444' ||
9527
+ cnpj === '55555555555555' ||
9528
+ cnpj === '66666666666666' ||
9529
+ cnpj === '77777777777777' ||
9530
+ cnpj === '88888888888888' ||
9531
+ cnpj === '99999999999999') {
9532
+ return { cnpjNotValid: true };
9533
+ }
9534
+ // Valida DVs
9535
+ size = cnpj.length - 2;
9536
+ numbers = cnpj.substring(0, size);
9537
+ digits = cnpj.substring(size);
9538
+ sum = 0;
9539
+ pos = size - 7;
9540
+ for (var i = size; i >= 1; i--) {
9541
+ sum += numbers.charAt(size - i) * pos--;
9542
+ if (pos < 2) {
9543
+ pos = 9;
9544
+ }
9545
+ }
9546
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9547
+ if (result !== Number(digits.charAt(0))) {
9548
+ return { cnpjNotValid: true };
9549
+ }
9550
+ size = size + 1;
9551
+ numbers = cnpj.substring(0, size);
9552
+ sum = 0;
9553
+ pos = size - 7;
9554
+ for (var i = size; i >= 1; i--) {
9555
+ sum += numbers.charAt(size - i) * pos--;
9556
+ if (pos < 2) {
9557
+ pos = 9;
9558
+ }
9559
+ }
9560
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9561
+ if (result !== Number(digits.charAt(1))) {
9562
+ return { cnpjNotValid: true };
9563
+ }
9564
+ return null;
9565
+ }
9566
+ return null;
9567
+ };
9568
+ /**
9569
+ * Válida o número de telefone da chave PIX.
9570
+ */
9571
+ GenericValidator.isValidPhoneNumber = function (control) {
9572
+ var cellPhoneKey = control.value || '';
9573
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9574
+ var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9575
+ var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9576
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9577
+ };
9578
+ /**
9579
+ * Valida o email da chave PIX.
9580
+ */
9581
+ GenericValidator.isValidEmail = function (control) {
9582
+ var emailKey = control.value;
9583
+ var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9584
+ var isValidEmail = regexValidEmail.test(emailKey);
9585
+ return isValidEmail ? null : { invalidEmail: true };
9586
+ };
9587
+ return GenericValidator;
9588
+ }());
9589
+
9590
+ var HistoricalPixAccountFormComponent = /** @class */ (function () {
9591
+ function HistoricalPixAccountFormComponent(formBuilder, cd) {
9592
+ this.formBuilder = formBuilder;
9593
+ this.cd = cd;
9594
+ this.withSideBar = true;
9595
+ this.isEditMode = false;
9596
+ this.paramsForm = new forms.FormGroup({});
9597
+ this.defaultCpfNumber = null;
9598
+ this.permitsEditBankAccountForm = false;
9599
+ this.visibleChange = new core.EventEmitter();
9600
+ this.pixAccountItemToList = new core.EventEmitter();
9601
+ this.ngUnsubscribe = new rxjs.Subject();
9602
+ this.initialValidatorOfPercentage = [forms.Validators.required, forms.Validators.min(0.01)];
9603
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9604
+ this.maxValuePercentage = 100.00;
9605
+ this.visibleBtnSave = true;
9606
+ this.isView = false;
9607
+ this.isShowPixKeyFieldValidatorMessage = false;
9608
+ this.createFormGroup();
9609
+ this.registerSubjects();
9610
+ }
9611
+ HistoricalPixAccountFormComponent.prototype.ngOnInit = function () {
9612
+ };
9613
+ HistoricalPixAccountFormComponent.prototype.ngDoCheck = function () {
9614
+ if (this.pixAccountFormGroup && this.pixKeyType === "BANK_ACCOUNT") {
9615
+ var pixKeyControl = this.pixAccountFormGroup.get("pixKey");
9616
+ if (pixKeyControl && !pixKeyControl.disabled) {
9617
+ pixKeyControl.disable();
9618
+ }
9619
+ }
9620
+ };
9621
+ HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
9622
+ this.cd.detectChanges();
9623
+ };
9624
+ HistoricalPixAccountFormComponent.prototype.ngOnDestroy = function () {
9625
+ this.ngUnsubscribe.next(true);
9626
+ this.ngUnsubscribe.unsubscribe();
9627
+ };
9628
+ HistoricalPixAccountFormComponent.prototype.registerSubjects = function () {
9629
+ };
9630
+ HistoricalPixAccountFormComponent.prototype.createFormGroup = function () {
9631
+ this.pixAccountFormGroup = this.formBuilder.group({
9632
+ id: this.formBuilder.control(null),
9633
+ index: this.formBuilder.control(null),
9634
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9635
+ dateChange: this.formBuilder.control(null),
9636
+ pixKeyType: this.formBuilder.control(null, forms.Validators.required),
9637
+ pixKey: this.formBuilder.control(null),
9638
+ percentage: this.formBuilder.control(null, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9639
+ forms.Validators.max(this.maxValuePercentage),
9640
+ ]))),
9641
+ externalId: this.formBuilder.control(null),
9642
+ customFields: this.formBuilder.control(null),
9643
+ });
9644
+ };
9645
+ HistoricalPixAccountFormComponent.prototype.onChangePixKeyType = function (item) {
9646
+ if (item.key) {
9647
+ this.pixKeyType = item.key;
9648
+ this.isShowPixKeyFieldValidatorMessage = true;
9649
+ this.pixAccountFormGroup.get("pixKey").reset();
9650
+ this.setPixKeyValidators(true);
9651
+ if (item.key === "CPF") {
9652
+ this.setDefaultCpfPixKey();
9653
+ }
9654
+ }
9655
+ };
9656
+ HistoricalPixAccountFormComponent.prototype.onClearPixKeyType = function () {
9657
+ this.isShowPixKeyFieldValidatorMessage = false;
9658
+ this.pixAccountFormGroup.get("pixKey").reset();
9659
+ };
9660
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
9661
+ get: function () {
9662
+ return this._visible;
9663
+ },
9664
+ set: function (value) {
9665
+ this._visible = value;
9666
+ this.visibleChange.emit(this.visible);
9667
+ },
9668
+ enumerable: true,
9669
+ configurable: true
9670
+ });
9671
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", {
9672
+ set: function (value) {
9673
+ this.resetForm();
9674
+ this.visibleBtnSave = true;
9675
+ if (value && value.permitsEditBankAccount) {
9676
+ this.permitsEditBankAccountForm = true;
9677
+ }
9678
+ if (value && value.currentItem && Object.keys(value.currentItem).length) {
9679
+ this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(__assign({}, value.currentItem)));
9680
+ this.labelBtnAdd = "hcm.payroll.employees_update";
9681
+ this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
9682
+ if (!this.isView) {
9683
+ this.configEnableFields(value && value["isEditMode"]);
9934
9684
  }
9935
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9936
- if (result !== Number(digits.charAt(1))) {
9937
- return { cpfNotValid: true };
9685
+ else {
9686
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
9687
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9688
+ this.formatPixKeyTelephoneNumber();
9689
+ }
9938
9690
  }
9939
- return null;
9940
9691
  }
9941
9692
  else {
9942
- return { cpfNotValid: true };
9693
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9943
9694
  }
9695
+ },
9696
+ enumerable: true,
9697
+ configurable: true
9698
+ });
9699
+ HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
9700
+ if (this.pixKeyType === "TELEPHONE") {
9701
+ this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
9944
9702
  }
9945
- return null;
9946
9703
  };
9947
- /**
9948
- * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9949
- */
9950
- GenericValidator.isValidCnpj = function (control) {
9951
- var cnpj = control.value;
9952
- if (cnpj) {
9953
- var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9954
- cnpj = cnpj.replace(/[^\d]+/g, '');
9955
- if (cnpj.length !== 14) {
9956
- return null;
9704
+ HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
9705
+ var obj = __assign({}, data);
9706
+ obj["customFields"] = mountCustomToShow(obj["customFields"]);
9707
+ return obj;
9708
+ };
9709
+ HistoricalPixAccountFormComponent.prototype.configEnableFields = function (isEditMode) {
9710
+ this.visibleBtnSave = isEditMode;
9711
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
9712
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9713
+ this.setPixKeyValidators(isEditMode);
9714
+ this.formatPixKeyTelephoneNumber();
9715
+ }
9716
+ configEnabledFields(this.pixAccountFormGroup, isEditMode, [
9717
+ "pixKeyType",
9718
+ "pixKey",
9719
+ "percentage",
9720
+ "customFields",
9721
+ ], []);
9722
+ };
9723
+ HistoricalPixAccountFormComponent.prototype.close = function () {
9724
+ this.resetForm();
9725
+ this.visible = false;
9726
+ };
9727
+ HistoricalPixAccountFormComponent.prototype.addItem = function () {
9728
+ this.pixAccountFormGroup.updateValueAndValidity();
9729
+ verifyValidationsForm.call(this.pixAccountFormGroup);
9730
+ if (this.pixAccountFormGroup.valid) {
9731
+ if (this.employeeId) {
9732
+ this.pixAccountFormGroup.get("employee").setValue({
9733
+ tableId: this.employeeId,
9734
+ name: "",
9735
+ });
9957
9736
  }
9958
- // Elimina CNPJs invalidos conhecidos
9959
- if (cnpj === '00000000000000' ||
9960
- cnpj === '11111111111111' ||
9961
- cnpj === '22222222222222' ||
9962
- cnpj === '33333333333333' ||
9963
- cnpj === '44444444444444' ||
9964
- cnpj === '55555555555555' ||
9965
- cnpj === '66666666666666' ||
9966
- cnpj === '77777777777777' ||
9967
- cnpj === '88888888888888' ||
9968
- cnpj === '99999999999999') {
9969
- return { cnpjNotValid: true };
9737
+ this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
9738
+ this.visible = false;
9739
+ this.resetForm();
9740
+ }
9741
+ };
9742
+ HistoricalPixAccountFormComponent.prototype.resetForm = function () {
9743
+ this.pixAccountFormGroup.reset();
9744
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9745
+ if (this.customFields && this.customFields.formGroup)
9746
+ this.customFields.formGroup.reset();
9747
+ };
9748
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "percentagePlaceholder", {
9749
+ get: function () {
9750
+ return "0" + (this.currency && this.currency.decimalSeparator) + "00";
9751
+ },
9752
+ enumerable: true,
9753
+ configurable: true
9754
+ });
9755
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "optionsPercentage", {
9756
+ get: function () {
9757
+ return __assign({}, this.getOptions(), { precision: 2 });
9758
+ },
9759
+ enumerable: true,
9760
+ configurable: true
9761
+ });
9762
+ HistoricalPixAccountFormComponent.prototype.getOptions = function () {
9763
+ return {
9764
+ prefix: "",
9765
+ thousands: this.currency.thousandsSeparator,
9766
+ decimal: this.currency.decimalSeparator,
9767
+ };
9768
+ };
9769
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "getListPixAccount", {
9770
+ /**
9771
+ * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
9772
+ * @param pixAccountList
9773
+ */
9774
+ set: function (pixAccountList) {
9775
+ if (pixAccountList) {
9776
+ this.setValidatorsAccordingList(pixAccountList, null, false);
9970
9777
  }
9971
- // Valida DVs
9972
- size = cnpj.length - 2;
9973
- numbers = cnpj.substring(0, size);
9974
- digits = cnpj.substring(size);
9975
- sum = 0;
9976
- pos = size - 7;
9977
- for (var i = size; i >= 1; i--) {
9978
- sum += numbers.charAt(size - i) * pos--;
9979
- if (pos < 2) {
9980
- pos = 9;
9778
+ else {
9779
+ this.resetForm();
9780
+ }
9781
+ },
9782
+ enumerable: true,
9783
+ configurable: true
9784
+ });
9785
+ /**
9786
+ * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
9787
+ * a validação dos campos "percentage" e "pixAccount".
9788
+ * 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
9789
+ * no array de comparação dos validators.
9790
+ * @param pixAccountList
9791
+ * @param index
9792
+ */
9793
+ HistoricalPixAccountFormComponent.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode) {
9794
+ if (index === void 0) { index = null; }
9795
+ if (isEditMode === void 0) { isEditMode = true; }
9796
+ this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
9797
+ var percentageIncluded = [];
9798
+ if (this.pixAccountList && this.pixAccountList.length) {
9799
+ this.pixAccountList.filter(function (field, key) {
9800
+ if (field["percentage"] && key != index) {
9801
+ percentageIncluded.push(field["percentage"]);
9981
9802
  }
9803
+ });
9804
+ }
9805
+ this.beforeSetPixKeyTypeValidator();
9806
+ this.setPixKeyValidators(isEditMode);
9807
+ this.validatePercentageValid(percentageIncluded);
9808
+ };
9809
+ /**
9810
+ * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
9811
+ */
9812
+ HistoricalPixAccountFormComponent.prototype.setPixKeyValidators = function (isEditMode) {
9813
+ var genericPixKey = this.pixAccountFormGroup.get("pixKey");
9814
+ if (this.pixKeyType) {
9815
+ switch (this.pixKeyType) {
9816
+ case "TELEPHONE":
9817
+ genericPixKey.setValidators(forms.Validators.compose([
9818
+ forms.Validators.required, GenericValidator.isValidPhoneNumber,
9819
+ ]));
9820
+ break;
9821
+ case "EMAIL":
9822
+ genericPixKey.setValidators(forms.Validators.compose([
9823
+ forms.Validators.required, GenericValidator.isValidEmail,
9824
+ ]));
9825
+ break;
9826
+ case "CPF":
9827
+ genericPixKey.setValidators(forms.Validators.compose([
9828
+ forms.Validators.required, GenericValidator.isValidCpf,
9829
+ ]));
9830
+ break;
9831
+ case "CNPJ":
9832
+ genericPixKey.setValidators(forms.Validators.compose([
9833
+ forms.Validators.required, GenericValidator.isValidCnpj,
9834
+ ]));
9835
+ break;
9836
+ case "RANDOM_KEY":
9837
+ genericPixKey.setValidators(forms.Validators.required);
9838
+ break;
9839
+ default:
9840
+ genericPixKey.setValidators(null);
9841
+ break;
9982
9842
  }
9983
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9984
- if (result !== Number(digits.charAt(0))) {
9985
- return { cnpjNotValid: true };
9843
+ if (isEditMode) {
9844
+ genericPixKey.enable();
9986
9845
  }
9987
- size = size + 1;
9988
- numbers = cnpj.substring(0, size);
9989
- sum = 0;
9990
- pos = size - 7;
9991
- for (var i = size; i >= 1; i--) {
9992
- sum += numbers.charAt(size - i) * pos--;
9993
- if (pos < 2) {
9994
- pos = 9;
9846
+ genericPixKey.updateValueAndValidity();
9847
+ }
9848
+ };
9849
+ /**
9850
+ * Este método calcula as parcentagens que foram inseridas, e seta a diferença para chegar em
9851
+ * 100% na validação do campo "percentage" como um novo maxValue;
9852
+ * @param listValue
9853
+ */
9854
+ HistoricalPixAccountFormComponent.prototype.validatePercentageValid = function (listValue) {
9855
+ var percentage = this.pixAccountFormGroup.get("percentage");
9856
+ this.maxValuePercentage = listValue
9857
+ .reduce(function (currentValue, total) { return currentValue - total; }, 100.00);
9858
+ percentage
9859
+ .setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9860
+ forms.Validators.max(this.maxValuePercentage),
9861
+ ])));
9862
+ percentage.updateValueAndValidity();
9863
+ };
9864
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
9865
+ set: function (condition) {
9866
+ this.isView = !!(condition && !this.withSideBar);
9867
+ this.configEnableFields(!this.isView);
9868
+ if (!this.isView)
9869
+ this.resetForm();
9870
+ },
9871
+ enumerable: true,
9872
+ configurable: true
9873
+ });
9874
+ HistoricalPixAccountFormComponent.prototype.phoneMask = function (event) {
9875
+ FormatUtilsService.formatTelephoneInputEvent(event);
9876
+ };
9877
+ HistoricalPixAccountFormComponent.prototype.setDefaultCpfPixKey = function () {
9878
+ if (this.defaultCpfNumber) {
9879
+ this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
9880
+ }
9881
+ else {
9882
+ var sheetDocument = this.paramsForm.get("sheetDocument");
9883
+ if (sheetDocument) {
9884
+ var cpf = sheetDocument.get("cpfNumber").value;
9885
+ if (cpf) {
9886
+ this.pixAccountFormGroup.get("pixKey").setValue(cpf);
9995
9887
  }
9996
9888
  }
9997
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9998
- if (result !== Number(digits.charAt(1))) {
9999
- return { cnpjNotValid: true };
10000
- }
10001
- return null;
10002
9889
  }
10003
- return null;
10004
9890
  };
10005
- /**
10006
- * Válida o número de telefone da chave PIX.
10007
- */
10008
- GenericValidator.isValidPhoneNumber = function (control) {
10009
- var cellPhoneKey = control.value || '';
10010
- cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
10011
- var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
10012
- var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
10013
- return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9891
+ HistoricalPixAccountFormComponent.prototype.beforeSetPixKeyTypeValidator = function () {
9892
+ var pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
9893
+ if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
9894
+ pixKeyType
9895
+ .setValidators(forms.Validators.compose([
9896
+ forms.Validators.required,
9897
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
9898
+ ]));
9899
+ }
9900
+ else {
9901
+ pixKeyType.setValidators(forms.Validators.required);
9902
+ }
10014
9903
  };
10015
- /**
10016
- * Valida o email da chave PIX.
10017
- */
10018
- GenericValidator.isValidEmail = function (control) {
10019
- var emailKey = control.value;
10020
- var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
10021
- var isValidEmail = regexValidEmail.test(emailKey);
10022
- return isValidEmail ? null : { invalidEmail: true };
9904
+ HistoricalPixAccountFormComponent.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
9905
+ var _this = this;
9906
+ return function (control) {
9907
+ var value = control && control.value;
9908
+ var condition = false;
9909
+ listCompare.filter(function (field) {
9910
+ if (value) {
9911
+ if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
9912
+ return condition = true;
9913
+ }
9914
+ }
9915
+ });
9916
+ if (condition && !_this.permitsEditBankAccountForm) {
9917
+ return { pixKeyTypeBankAccountDuplicate: true };
9918
+ }
9919
+ else {
9920
+ return null;
9921
+ }
9922
+ };
10023
9923
  };
10024
- return GenericValidator;
9924
+ HistoricalPixAccountFormComponent.ctorParameters = function () { return [
9925
+ { type: forms.FormBuilder },
9926
+ { type: core.ChangeDetectorRef }
9927
+ ]; };
9928
+ __decorate([
9929
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: true })
9930
+ ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
9931
+ __decorate([
9932
+ core.Input()
9933
+ ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
9934
+ __decorate([
9935
+ core.Input()
9936
+ ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
9937
+ __decorate([
9938
+ core.Input()
9939
+ ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
9940
+ __decorate([
9941
+ core.Input()
9942
+ ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
9943
+ __decorate([
9944
+ core.Input()
9945
+ ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
9946
+ __decorate([
9947
+ core.Input()
9948
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
9949
+ __decorate([
9950
+ core.Input()
9951
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
9952
+ __decorate([
9953
+ core.Input()
9954
+ ], HistoricalPixAccountFormComponent.prototype, "permitsEditBankAccountForm", void 0);
9955
+ __decorate([
9956
+ core.Output()
9957
+ ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
9958
+ __decorate([
9959
+ core.Output()
9960
+ ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
9961
+ __decorate([
9962
+ core.Input()
9963
+ ], HistoricalPixAccountFormComponent.prototype, "visible", null);
9964
+ __decorate([
9965
+ core.Input()
9966
+ ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
9967
+ __decorate([
9968
+ core.Input()
9969
+ ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
9970
+ __decorate([
9971
+ core.Input()
9972
+ ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
9973
+ HistoricalPixAccountFormComponent = __decorate([
9974
+ core.Component({
9975
+ selector: "pix-account",
9976
+ 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",
9977
+ 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}"]
9978
+ })
9979
+ ], HistoricalPixAccountFormComponent);
9980
+ return HistoricalPixAccountFormComponent;
10025
9981
  }());
10026
9982
 
10027
- var HistoricalPixAccountFormComponent = /** @class */ (function () {
10028
- function HistoricalPixAccountFormComponent(formBuilder, cd) {
10029
- this.formBuilder = formBuilder;
9983
+ var HistoricalPixAccountComponent = /** @class */ (function () {
9984
+ function HistoricalPixAccountComponent(translateService, cd, formBuilder, messageService) {
9985
+ var _this = this;
9986
+ this.translateService = translateService;
10030
9987
  this.cd = cd;
10031
- this.withSideBar = true;
9988
+ this.formBuilder = formBuilder;
9989
+ this.messageService = messageService;
9990
+ this.recordByRow = 1;
9991
+ this.showDateChange = false;
10032
9992
  this.isEditMode = false;
10033
- this.paramsForm = new forms.FormGroup({});
9993
+ this.isViewMode = false;
9994
+ this.withSideBar = true;
10034
9995
  this.defaultCpfNumber = null;
9996
+ this.listDataReciever = [];
9997
+ this.showButtonEdit = false;
9998
+ this.isViewModeActive = new core.EventEmitter();
9999
+ this.isEditModeActive = new core.EventEmitter();
10000
+ this.isDeleteModeActive = new core.EventEmitter();
10001
+ this.listFromApp = [];
10035
10002
  this.visibleChange = new core.EventEmitter();
10036
- this.pixAccountItemToList = new core.EventEmitter();
10037
10003
  this.ngUnsubscribe = new rxjs.Subject();
10038
- this.initialValidatorOfPercentage = [forms.Validators.required, forms.Validators.min(0.01)];
10039
- this.labelBtnAdd = "hcm.payroll.employees_add";
10040
- this.maxValuePercentage = 100.00;
10041
- this.visibleBtnSave = true;
10042
- this.isView = false;
10043
- this.isShowPixKeyFieldValidatorMessage = false;
10004
+ this.orderBy = {
10005
+ field: "dateChange",
10006
+ direction: exports.DirectionEnumeration.DESC,
10007
+ };
10008
+ this.pixAccountItemInput = {};
10009
+ this.totalRecords = 0;
10010
+ this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
10011
+ this.loading = true;
10012
+ this.listData = [];
10013
+ this.listDataNoPage = [];
10014
+ this.permitsEditBankAccount = false;
10015
+ this.cols = [
10016
+ {
10017
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
10018
+ field: "pixKeyType",
10019
+ },
10020
+ {
10021
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
10022
+ field: "pixKey",
10023
+ },
10024
+ {
10025
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
10026
+ field: "percentage",
10027
+ },
10028
+ ];
10029
+ this.actions = function (rowData, key) {
10030
+ if (rowData === void 0) { rowData = {}; }
10031
+ return [
10032
+ {
10033
+ visible: _this.isEditMode,
10034
+ label: _this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
10035
+ command: function () {
10036
+ if (_this.isAllowToViewHistorical) {
10037
+ rowData["index"] = key;
10038
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: false };
10039
+ _this.visible = true;
10040
+ }
10041
+ else {
10042
+ _this.isViewModeActive.emit(true);
10043
+ }
10044
+ },
10045
+ },
10046
+ {
10047
+ visible: !!((!_this.isEditMode && _this.withSideBar) || _this.showButtonEdit),
10048
+ label: _this.translateService.instant("hcm.payroll.edit"),
10049
+ command: function () {
10050
+ _this.permitsEditBankAccount = true;
10051
+ if (_this.isAllowToEditHistorical) {
10052
+ rowData["index"] = key;
10053
+ _this.pixAccountItemInput = {
10054
+ currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true, permitsEditBankAccount: true
10055
+ };
10056
+ _this.visible = true;
10057
+ }
10058
+ else {
10059
+ _this.isEditModeActive.emit(true);
10060
+ if (_this.listFromApp.length == 0) {
10061
+ rowData["index"] = key;
10062
+ _this.pixAccountItemInput = {
10063
+ currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true, permitsEditBankAccount: true
10064
+ };
10065
+ }
10066
+ }
10067
+ },
10068
+ },
10069
+ {
10070
+ visible: !_this.isEditMode,
10071
+ label: _this.translateService.instant("hcm.payroll.delete"),
10072
+ command: function () {
10073
+ if (_this.isAllowToDeleteHistorical) {
10074
+ _this.loading = true;
10075
+ _this.deleteAnnuityItem(key);
10076
+ }
10077
+ else {
10078
+ _this.isDeleteModeActive.emit(true);
10079
+ if (_this.listFromApp.length == 0) {
10080
+ _this.loading = true;
10081
+ _this.deleteAnnuityItem(key);
10082
+ }
10083
+ }
10084
+ },
10085
+ },
10086
+ ];
10087
+ };
10044
10088
  this.createFormGroup();
10045
- this.registerSubjects();
10046
10089
  }
10047
- HistoricalPixAccountFormComponent.prototype.ngOnInit = function () {
10090
+ HistoricalPixAccountComponent.prototype.ngOnInit = function () {
10091
+ this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
10048
10092
  };
10049
- HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
10093
+ HistoricalPixAccountComponent.prototype.ngOnChanges = function (changes) {
10094
+ if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
10095
+ this.listFromApp = changes['listDataReciever'].currentValue;
10096
+ }
10097
+ if (changes['showButtonEdit'] && changes['showButtonEdit'].currentValue) {
10098
+ this.permitsEditBankAccount = changes['showButtonEdit'].currentValue;
10099
+ }
10100
+ };
10101
+ HistoricalPixAccountComponent.prototype.createFormGroup = function () {
10102
+ this.historicalPixAccountList = this.formBuilder.group({
10103
+ historicalPixAccountList: this.formBuilder.control(null),
10104
+ });
10105
+ };
10106
+ HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
10107
+ this.ngUnsubscribe.next();
10108
+ this.ngUnsubscribe.complete();
10109
+ };
10110
+ HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
10050
10111
  this.cd.detectChanges();
10051
10112
  };
10052
- HistoricalPixAccountFormComponent.prototype.ngOnDestroy = function () {
10053
- this.ngUnsubscribe.next(true);
10054
- this.ngUnsubscribe.unsubscribe();
10113
+ HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
10114
+ var _this = this;
10115
+ var first = event && event.first ? event.first : 0;
10116
+ var rows = event && event.rows ? event.rows : this.recordByRow;
10117
+ var arrList = this.getHistoricalPixAccountList();
10118
+ this.listData = [];
10119
+ this.totalRecords = null;
10120
+ if (event && event.multiSortMeta && event.multiSortMeta.length) {
10121
+ event.multiSortMeta.map(function (value) {
10122
+ _this.orderBy.field = value.field;
10123
+ _this.orderBy.direction = value.order === 1 ? exports.DirectionEnumeration.ASC : exports.DirectionEnumeration.DESC;
10124
+ });
10125
+ }
10126
+ if (arrList && arrList.length) {
10127
+ this.totalRecords = arrList.length;
10128
+ this.listData = arrList;
10129
+ this.listDataNoPage = __spread(arrList);
10130
+ this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
10131
+ this.listData = this.listData.slice(first, (first + rows));
10132
+ }
10133
+ else {
10134
+ this.listDataNoPage = [];
10135
+ }
10136
+ if (this.isEditMode || arrList && arrList.length === 1) {
10137
+ this.refreshCssInIE11();
10138
+ }
10139
+ this.loading = false;
10140
+ };
10141
+ /**
10142
+ * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
10143
+ */
10144
+ HistoricalPixAccountComponent.prototype.refreshCssInIE11 = function () {
10145
+ if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
10146
+ setTimeout(function () {
10147
+ var row = document.getElementsByClassName("row0");
10148
+ if (row && row[0])
10149
+ row[0].className = 'refresh';
10150
+ }, 1);
10151
+ }
10055
10152
  };
10056
- HistoricalPixAccountFormComponent.prototype.registerSubjects = function () {
10153
+ HistoricalPixAccountComponent.prototype.add = function () {
10154
+ this.pixAccountItemInput = {};
10155
+ this.visible = true;
10057
10156
  };
10058
- HistoricalPixAccountFormComponent.prototype.createFormGroup = function () {
10059
- this.pixAccountFormGroup = this.formBuilder.group({
10060
- id: this.formBuilder.control(null),
10061
- index: this.formBuilder.control(null),
10062
- employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
10063
- dateChange: this.formBuilder.control(null),
10064
- pixKeyType: this.formBuilder.control(null, forms.Validators.required),
10065
- pixKey: this.formBuilder.control(null),
10066
- percentage: this.formBuilder.control(null, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10067
- forms.Validators.max(this.maxValuePercentage),
10068
- ]))),
10069
- externalId: this.formBuilder.control(null),
10070
- customFields: this.formBuilder.control(null),
10157
+ HistoricalPixAccountComponent.prototype.isNotAllowMessage = function () {
10158
+ this.messageService.add({
10159
+ severity: "error",
10160
+ summary: this.translateService.instant("hcm.payroll.error"),
10161
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
10071
10162
  });
10072
10163
  };
10073
- HistoricalPixAccountFormComponent.prototype.onChangePixKeyType = function (item) {
10074
- if (item.key) {
10075
- this.pixKeyType = item.key;
10076
- this.isShowPixKeyFieldValidatorMessage = true;
10077
- this.pixAccountFormGroup.get("pixKey").reset();
10078
- this.setPixKeyValidators(true);
10079
- if (item.key === "CPF") {
10080
- this.setDefaultCpfPixKey();
10164
+ HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
10165
+ var newlist = __spread(this.getHistoricalPixAccountList());
10166
+ newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
10167
+ delete newlist[index];
10168
+ newlist = newlist.filter(function (val) { return val; });
10169
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
10170
+ this.verifyTotalPercentage();
10171
+ this.onLazyLoad();
10172
+ };
10173
+ HistoricalPixAccountComponent.prototype.getHistoricalPixAccountList = function () {
10174
+ if (this.historicalPixAccountList.get("historicalPixAccountList") &&
10175
+ this.historicalPixAccountList.get("historicalPixAccountList").value &&
10176
+ this.historicalPixAccountList.get("historicalPixAccountList").value.length)
10177
+ return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
10178
+ else
10179
+ return [];
10180
+ };
10181
+ HistoricalPixAccountComponent.prototype.addItemInList = function ($event) {
10182
+ var index = $event && $event.index >= 0 ? $event.index : null;
10183
+ var newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
10184
+ if (index != null) {
10185
+ newDataList[index] = $event;
10186
+ delete $event.index;
10187
+ }
10188
+ else {
10189
+ if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
10190
+ var customValue = mountCustomToSave($event["customFields"]);
10191
+ $event["customFields"] = __spread(customValue);
10081
10192
  }
10193
+ $event["dateChange"] = this.dateChange;
10194
+ newDataList.push($event);
10195
+ }
10196
+ if (this.formComponent) {
10197
+ this.formComponent.permitsEditBankAccountForm = false;
10198
+ this.cd.detectChanges();
10082
10199
  }
10200
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
10201
+ this.verifyTotalPercentage();
10202
+ this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
10083
10203
  };
10084
- HistoricalPixAccountFormComponent.prototype.onClearPixKeyType = function () {
10085
- this.isShowPixKeyFieldValidatorMessage = false;
10086
- this.pixAccountFormGroup.get("pixKey").reset();
10204
+ HistoricalPixAccountComponent.prototype.getNumberPageByIndex = function (index, list) {
10205
+ if (index) {
10206
+ var total = list.length;
10207
+ var sub = this.recordByRow - 1;
10208
+ return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
10209
+ }
10210
+ return null;
10087
10211
  };
10088
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
10212
+ HistoricalPixAccountComponent.prototype.verifyTotalPercentage = function () {
10213
+ var list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
10214
+ var arrayPercentage = [];
10215
+ if (!list.length)
10216
+ return this.msgTotalLimitByPercentage = null;
10217
+ list.filter(function (item) { return arrayPercentage.push(item && item["percentage"]); });
10218
+ var sumPercentage = arrayPercentage.reduce(function (total, percentage) {
10219
+ return total + percentage;
10220
+ }, 0);
10221
+ if (sumPercentage === 100) {
10222
+ this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
10223
+ }
10224
+ else {
10225
+ this.msgTotalLimitByPercentage = null;
10226
+ }
10227
+ };
10228
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
10089
10229
  get: function () {
10090
- return this._visible;
10230
+ return this.actions.bind(this);
10231
+ },
10232
+ enumerable: true,
10233
+ configurable: true
10234
+ });
10235
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
10236
+ get: function () {
10237
+ return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
10238
+ },
10239
+ enumerable: true,
10240
+ configurable: true
10241
+ });
10242
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "getTooltipAndDisableButtonAdd", {
10243
+ get: function () {
10244
+ return this.dateChange ? null : this.msgTooltipAdd;
10245
+ },
10246
+ enumerable: true,
10247
+ configurable: true
10248
+ });
10249
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "dateChange", {
10250
+ get: function () {
10251
+ return this._dateChange;
10091
10252
  },
10092
10253
  set: function (value) {
10093
- this._visible = value;
10094
- this.visibleChange.emit(this.visible);
10254
+ var _this = this;
10255
+ this._dateChange = value;
10256
+ if (this._dateChange) {
10257
+ this.listData.filter(function (row) { return row["dateChange"] = _this._dateChange; });
10258
+ }
10095
10259
  },
10096
10260
  enumerable: true,
10097
10261
  configurable: true
10098
10262
  });
10099
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", {
10263
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
10264
+ get: function () {
10265
+ return this._displayDateChange;
10266
+ },
10100
10267
  set: function (value) {
10101
- this.resetForm();
10102
- this.visibleBtnSave = true;
10103
- if (value && value.currentItem && Object.keys(value.currentItem).length) {
10104
- this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(__assign({}, value.currentItem)));
10105
- this.labelBtnAdd = "hcm.payroll.employees_update";
10106
- this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
10107
- if (!this.isView) {
10108
- this.configEnableFields(value && value["isEditMode"]);
10109
- }
10110
- else {
10111
- if (this.pixAccountFormGroup.get("pixKeyType").value) {
10112
- this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
10113
- this.formatPixKeyTelephoneNumber();
10114
- }
10115
- }
10268
+ var _this = this;
10269
+ this._displayDateChange = value;
10270
+ if (this._displayDateChange) {
10271
+ this.listData.filter(function (row) { return row["displayDateChange"] = _this._displayDateChange; });
10116
10272
  }
10117
- else {
10118
- this.labelBtnAdd = "hcm.payroll.employees_add";
10273
+ },
10274
+ enumerable: true,
10275
+ configurable: true
10276
+ });
10277
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "addListData", {
10278
+ set: function (list) {
10279
+ this.loading = true;
10280
+ this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
10281
+ this.verifyTotalPercentage();
10282
+ this.onLazyLoad();
10283
+ },
10284
+ enumerable: true,
10285
+ configurable: true
10286
+ });
10287
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
10288
+ get: function () {
10289
+ return this._visible;
10290
+ },
10291
+ set: function (value) {
10292
+ this._visible = value;
10293
+ this.visibleChange.emit(this.visible);
10294
+ if (!value) {
10295
+ this.pixAccountItemInput = {};
10119
10296
  }
10120
10297
  },
10121
10298
  enumerable: true,
10122
10299
  configurable: true
10123
10300
  });
10124
- HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
10125
- if (this.pixKeyType === "TELEPHONE") {
10126
- this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
10127
- }
10128
- };
10129
- HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
10130
- var obj = __assign({}, data);
10131
- obj["customFields"] = mountCustomToShow(obj["customFields"]);
10132
- return obj;
10133
- };
10134
- HistoricalPixAccountFormComponent.prototype.configEnableFields = function (isEditMode) {
10135
- this.visibleBtnSave = isEditMode;
10136
- if (this.pixAccountFormGroup.get("pixKeyType").value) {
10137
- this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
10138
- this.setPixKeyValidators(isEditMode);
10139
- this.formatPixKeyTelephoneNumber();
10140
- }
10141
- configEnabledFields(this.pixAccountFormGroup, isEditMode, [
10142
- "pixKeyType",
10143
- "pixKey",
10144
- "percentage",
10145
- "customFields",
10146
- ], []);
10147
- };
10148
- HistoricalPixAccountFormComponent.prototype.close = function () {
10149
- this.resetForm();
10301
+ HistoricalPixAccountComponent.prototype.close = function () {
10150
10302
  this.visible = false;
10151
10303
  };
10152
- HistoricalPixAccountFormComponent.prototype.addItem = function () {
10153
- this.pixAccountFormGroup.updateValueAndValidity();
10154
- verifyValidationsForm.call(this.pixAccountFormGroup);
10155
- if (this.pixAccountFormGroup.valid) {
10156
- if (this.employeeId) {
10157
- this.pixAccountFormGroup.get("employee").setValue({
10158
- tableId: this.employeeId,
10159
- name: "",
10160
- });
10161
- }
10162
- this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
10163
- this.visible = false;
10164
- this.resetForm();
10165
- }
10304
+ HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
10305
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
10166
10306
  };
10167
- HistoricalPixAccountFormComponent.prototype.resetForm = function () {
10168
- this.pixAccountFormGroup.reset();
10169
- this.labelBtnAdd = "hcm.payroll.employees_add";
10170
- if (this.customFields && this.customFields.formGroup)
10171
- this.customFields.formGroup.reset();
10307
+ HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
10308
+ return FormatUtilsService.getFormattedCpf(cpf);
10309
+ };
10310
+ HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
10311
+ return FormatUtilsService.getFormattedCnpj(cnpj);
10172
10312
  };
10173
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "percentagePlaceholder", {
10313
+ HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
10314
+ return FormatUtilsService.getFormattedPercentage(value);
10315
+ };
10316
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
10174
10317
  get: function () {
10175
- return "0" + (this.currency && this.currency.decimalSeparator) + "00";
10318
+ return (this.permission["incluir"]);
10176
10319
  },
10177
10320
  enumerable: true,
10178
10321
  configurable: true
10179
10322
  });
10180
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "optionsPercentage", {
10323
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToDeleteHistorical", {
10181
10324
  get: function () {
10182
- return __assign({}, this.getOptions(), { precision: 2 });
10325
+ return (this.permission["excluir"]);
10183
10326
  },
10184
10327
  enumerable: true,
10185
10328
  configurable: true
10186
10329
  });
10187
- HistoricalPixAccountFormComponent.prototype.getOptions = function () {
10188
- return {
10189
- prefix: "",
10190
- thousands: this.currency.thousandsSeparator,
10191
- decimal: this.currency.decimalSeparator,
10192
- };
10193
- };
10194
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "getListPixAccount", {
10195
- /**
10196
- * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
10197
- * @param pixAccountList
10198
- */
10199
- set: function (pixAccountList) {
10200
- if (pixAccountList) {
10201
- this.setValidatorsAccordingList(pixAccountList, null, false);
10202
- }
10203
- else {
10204
- this.resetForm();
10205
- }
10330
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToEditHistorical", {
10331
+ get: function () {
10332
+ return (this.permission["editar"]);
10206
10333
  },
10207
10334
  enumerable: true,
10208
10335
  configurable: true
10209
10336
  });
10210
- /**
10211
- * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
10212
- * a validação dos campos "percentage" e "pixAccount".
10213
- * Quando tem index significa que está em uma edição, os valores na posição do registro da edição (index) não serão adicionados
10214
- * no array de comparação dos validators.
10215
- * @param pixAccountList
10216
- * @param index
10217
- */
10218
- HistoricalPixAccountFormComponent.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode) {
10219
- if (index === void 0) { index = null; }
10220
- if (isEditMode === void 0) { isEditMode = true; }
10221
- this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
10222
- var percentageIncluded = [];
10223
- if (this.pixAccountList && this.pixAccountList.length) {
10224
- this.pixAccountList.filter(function (field, key) {
10225
- if (field["percentage"] && key != index) {
10226
- percentageIncluded.push(field["percentage"]);
10227
- }
10228
- });
10229
- }
10230
- this.beforeSetPixKeyTypeValidator();
10231
- this.setPixKeyValidators(isEditMode);
10232
- this.validatePercentageValid(percentageIncluded);
10233
- };
10234
- /**
10235
- * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
10236
- */
10237
- HistoricalPixAccountFormComponent.prototype.setPixKeyValidators = function (isEditMode) {
10238
- var genericPixKey = this.pixAccountFormGroup.get("pixKey");
10239
- if (this.pixKeyType) {
10240
- switch (this.pixKeyType) {
10241
- case "TELEPHONE":
10242
- genericPixKey.setValidators(forms.Validators.compose([
10243
- forms.Validators.required, GenericValidator.isValidPhoneNumber,
10244
- ]));
10245
- break;
10246
- case "EMAIL":
10247
- genericPixKey.setValidators(forms.Validators.compose([
10248
- forms.Validators.required, GenericValidator.isValidEmail,
10249
- ]));
10250
- break;
10251
- case "CPF":
10252
- genericPixKey.setValidators(forms.Validators.compose([
10253
- forms.Validators.required, GenericValidator.isValidCpf,
10254
- ]));
10255
- break;
10256
- case "CNPJ":
10257
- genericPixKey.setValidators(forms.Validators.compose([
10258
- forms.Validators.required, GenericValidator.isValidCnpj,
10259
- ]));
10260
- break;
10261
- case "RANDOM_KEY":
10262
- genericPixKey.setValidators(forms.Validators.required);
10263
- break;
10264
- default:
10265
- genericPixKey.setValidators(null);
10266
- break;
10267
- }
10268
- if (isEditMode) {
10269
- genericPixKey.enable();
10270
- }
10271
- genericPixKey.updateValueAndValidity();
10272
- }
10273
- };
10274
- /**
10275
- * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
10276
- * 100% na validação do campo "percentage" como um novo maxValue;
10277
- * @param listValue
10278
- */
10279
- HistoricalPixAccountFormComponent.prototype.validatePercentageValid = function (listValue) {
10280
- var percentage = this.pixAccountFormGroup.get("percentage");
10281
- this.maxValuePercentage = listValue
10282
- .reduce(function (currentValue, total) { return currentValue - total; }, 100.00);
10283
- percentage
10284
- .setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10285
- forms.Validators.max(this.maxValuePercentage),
10286
- ])));
10287
- percentage.updateValueAndValidity();
10288
- };
10289
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10290
- set: function (condition) {
10291
- this.isView = !!(condition && !this.withSideBar);
10292
- this.configEnableFields(!this.isView);
10293
- if (!this.isView)
10294
- this.resetForm();
10337
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToViewHistorical", {
10338
+ get: function () {
10339
+ return (this.permission["visualizar"]);
10295
10340
  },
10296
10341
  enumerable: true,
10297
10342
  configurable: true
10298
10343
  });
10299
- HistoricalPixAccountFormComponent.prototype.phoneMask = function (event) {
10300
- FormatUtilsService.formatTelephoneInputEvent(event);
10301
- };
10302
- HistoricalPixAccountFormComponent.prototype.setDefaultCpfPixKey = function () {
10303
- if (this.defaultCpfNumber) {
10304
- this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
10305
- }
10306
- else {
10307
- var sheetDocument = this.paramsForm.get("sheetDocument");
10308
- if (sheetDocument) {
10309
- var cpf = sheetDocument.get("cpfNumber").value;
10310
- if (cpf) {
10311
- this.pixAccountFormGroup.get("pixKey").setValue(cpf);
10312
- }
10313
- }
10314
- }
10315
- };
10316
- HistoricalPixAccountFormComponent.prototype.beforeSetPixKeyTypeValidator = function () {
10317
- var pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
10318
- if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
10319
- pixKeyType
10320
- .setValidators(forms.Validators.compose([
10321
- forms.Validators.required,
10322
- this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
10323
- ]));
10324
- }
10325
- else {
10326
- pixKeyType.setValidators(forms.Validators.required);
10327
- }
10328
- };
10329
- HistoricalPixAccountFormComponent.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
10330
- return function (control) {
10331
- var value = control && control.value;
10332
- var condition = false;
10333
- listCompare.filter(function (field) {
10334
- if (value) {
10335
- if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
10336
- return condition = true;
10337
- }
10338
- }
10339
- });
10340
- if (condition) {
10341
- return { pixKeyTypeBankAccountDuplicate: true };
10342
- }
10343
- else {
10344
- return null;
10345
- }
10346
- };
10347
- };
10348
- HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10344
+ HistoricalPixAccountComponent.ctorParameters = function () { return [
10345
+ { type: core$1.TranslateService },
10346
+ { type: core.ChangeDetectorRef },
10349
10347
  { type: forms.FormBuilder },
10350
- { type: core.ChangeDetectorRef }
10348
+ { type: api.MessageService }
10351
10349
  ]; };
10352
10350
  __decorate([
10353
- core.ViewChild(angularComponents.CustomFieldsComponent, { static: true })
10354
- ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
10351
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
10352
+ ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
10353
+ __decorate([
10354
+ core.ViewChild(HistoricalPixAccountFormComponent, { static: false })
10355
+ ], HistoricalPixAccountComponent.prototype, "formComponent", void 0);
10355
10356
  __decorate([
10356
10357
  core.Input()
10357
- ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
10358
+ ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
10358
10359
  __decorate([
10359
10360
  core.Input()
10360
- ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
10361
+ ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
10361
10362
  __decorate([
10362
10363
  core.Input()
10363
- ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
10364
+ ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
10364
10365
  __decorate([
10365
10366
  core.Input()
10366
- ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
10367
+ ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
10367
10368
  __decorate([
10368
10369
  core.Input()
10369
- ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
10370
+ ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
10370
10371
  __decorate([
10371
10372
  core.Input()
10372
- ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
10373
+ ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
10373
10374
  __decorate([
10374
10375
  core.Input()
10375
- ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
10376
+ ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
10377
+ __decorate([
10378
+ core.Input()
10379
+ ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
10380
+ __decorate([
10381
+ core.Input()
10382
+ ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
10383
+ __decorate([
10384
+ core.Input()
10385
+ ], HistoricalPixAccountComponent.prototype, "currency", void 0);
10386
+ __decorate([
10387
+ core.Input()
10388
+ ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
10389
+ __decorate([
10390
+ core.Input()
10391
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
10392
+ __decorate([
10393
+ core.Input()
10394
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
10395
+ __decorate([
10396
+ core.Input()
10397
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
10398
+ __decorate([
10399
+ core.Input()
10400
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
10401
+ __decorate([
10402
+ core.Input()
10403
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
10404
+ __decorate([
10405
+ core.Input()
10406
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
10407
+ __decorate([
10408
+ core.Input()
10409
+ ], HistoricalPixAccountComponent.prototype, "showButtonEdit", void 0);
10376
10410
  __decorate([
10377
10411
  core.Output()
10378
- ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
10412
+ ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
10379
10413
  __decorate([
10380
10414
  core.Output()
10381
- ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
10415
+ ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
10416
+ __decorate([
10417
+ core.Output()
10418
+ ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
10382
10419
  __decorate([
10383
10420
  core.Input()
10384
- ], HistoricalPixAccountFormComponent.prototype, "visible", null);
10421
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
10385
10422
  __decorate([
10386
10423
  core.Input()
10387
- ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
10424
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
10388
10425
  __decorate([
10389
10426
  core.Input()
10390
- ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
10427
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
10391
10428
  __decorate([
10392
10429
  core.Input()
10393
- ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
10394
- HistoricalPixAccountFormComponent = __decorate([
10430
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
10431
+ HistoricalPixAccountComponent = __decorate([
10395
10432
  core.Component({
10396
- selector: "pix-account",
10397
- template: "<div id=\"main\">\n <form [formGroup]=\"pixAccountFormGroup\" autocomplete=\"off\">\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <!-- Tipo de chave -->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label>{{'hcm.payroll.employees_addition_pix_key_type'|translate}}</label>\n <input-rest-auto-complete-enum [dropdown]=\"true\" server=\"payroll\"\n enumeration=\"PixKeyType\"\n placeholder=\"{{'hcm.payroll.select' | translate}}\"\n name=\"pixKeyType\" [form]=\"pixAccountFormGroup\"\n (onSelect)=\"onChangePixKeyType($event)\"\n (onClear)=\"onClearPixKeyType()\"\n id=\"ta-pixKeyType\"></input-rest-auto-complete-enum>\n <s-control-errors [control]=\"pixAccountFormGroup.get('pixKeyType')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n pixKeyTypeBankAccountDuplicate: 'hcm.payroll.historical_pix_key_type_bank_account_duplicate' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Chave Pix-->\n <div class=\"ui-md-6 ui-sm-12\" [ngClass]=\"{'required': pixKeyType !== 'BANK_ACCOUNT'}\">\n <label>{{'hcm.payroll.employees_addition_pix_key' | translate}}</label>\n <ng-container [ngSwitch]=\"pixKeyType\">\n <input *ngSwitchCase=\"'TELEPHONE'\" only-number\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n (keyup)=\"phoneMask($event)\" maxlength=\"15\"\n placeholder=\"(__) ____-____\">\n <p-inputMask *ngSwitchCase=\"'CPF'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"___.___.___-__\"\n mask=\"999.999.999-99\" [unmask]=\"true\"></p-inputMask>\n <p-inputMask *ngSwitchCase=\"'CNPJ'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"__.___.___/____-__\"\n mask=\"99.999.999/9999-99\" [unmask]=\"true\"></p-inputMask>\n <input *ngSwitchCase=\"'EMAIL'\"\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"{{'hcm.payroll.employees_addition_email'|translate}}\"/>\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\" disabled\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"/>\n <input *ngSwitchDefault\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\" maxlength=\"100\" />\n </ng-container>\n <s-control-errors *ngIf=\"isShowPixKeyFieldValidatorMessage\" id=\"er-pix-key\"\n [control]=\"pixAccountFormGroup.get('pixKey')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n invalidPhoneNumber: 'hcm.payroll.employees_addition_invalid_phone_number' | translate: { value: pixAccountFormGroup.get('pixKey').value },\n invalidEmail: 'hcm.payroll.employees_addition_email_invalid' | translate,\n cpfNotValid: 'hcm.payroll.employees_addition_cpf_error' | translate,\n cnpjNotValid: 'hcm.payroll.employees_addition_cnpj_error' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Percentual-->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label id=\"lb-percentage\"\n for=\"ff-percentage\">{{ 'hcm.payroll.historical_bank_account_label_percentage' | translate }}</label>\n <div class=\"ui-inputgroup\">\n <span class=\"ui-inputgroup-addon\">%</span>\n <input pInputText id=\"ff-percentage\" name=\"percentage\"\n formControlName=\"percentage\"\n currencyMask\n [options]=\"optionsPercentage\"\n [placeholder]=\"percentagePlaceholder\"/>\n </div>\n <s-control-errors [control]=\"pixAccountFormGroup.get('percentage')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n maxlength: 'hcm.payroll.error_max_length' | translate: { value: '6' },\n max: 'hcm.payroll.error_max_value_number' | translate: { value: maxValuePercentage },\n min: 'hcm.payroll.error_min_value_number' | translate: { value: '0,01' }\n }\">\n </s-control-errors>\n </div>\n <div class=\"ui-g-12\">\n <p-fieldset\n legend=\"{{ 'hcm.payroll.custom_fields' | translate }}\"\n [attr.data-hidden]=\"!customFields || !customFields.fields.length\"\n >\n <s-custom-fields\n domain=\"hcm\"\n service=\"{{customService}}\"\n entity=\"{{customEntity}}\"\n formControlName=\"customFields\"\n [invalidErrorLabel]=\"'hcm.payroll.employees_invalid_field' | translate\"\n >\n </s-custom-fields>\n </p-fieldset>\n </div>\n </div>\n </div>\n </form>\n\n <div [ngClass]=\"withSideBar ? 'footer' : 'footer-s-border'\">\n <div class=\"form-group\">\n <s-button id=\"btn-save\" label=\"{{ labelBtnAdd | translate}}\" priority=\"primary\"\n (onClick)=\"addItem()\" *ngIf=\"visibleBtnSave && !this.isView\"></s-button>\n <s-button *ngIf=\"withSideBar\" id=\"btn-close\" label=\"{{'hcm.payroll.cancel'|translate}}\" priority=\"secondary\"\n priority=\"link\" (onClick)=\"close()\"></s-button>\n </div>\n </div>\n</div>\n",
10433
+ // tslint:disable-next-line:component-selector
10434
+ selector: "c-historical-pix-account",
10435
+ 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",
10398
10436
  styles: [".refresh{width:100%!important}#table-annuity .col-default-s{width:10%}#table-annuity .col-default-m{width:12%}#table-annuity .col-default-l{width:16%}#table-annuity .col-action{width:10%}#table-annuity .icon-warning{text-align:center!important;color:#ff6d00c7!important}@media screen and (max-width:612px){#table-annuity .col-default-1,#table-annuity .col-default-2{width:16%}#table-annuity .col-default-3{width:26%}#table-annuity .col-icon{width:10%}#table-annuity .col-action{width:27%}}#main{display:-webkit-box;display:flex;height:100%;width:100%;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}#main form{height:100%}#main .footer{border-top:1px solid #ccc;padding-top:15px;margin-top:15px;flex-shrink:0;margin-bottom:-18px}#main .footer-s-border{padding-left:7px;flex-shrink:0;margin-bottom:-18px}"]
10399
10437
  })
10400
- ], HistoricalPixAccountFormComponent);
10401
- return HistoricalPixAccountFormComponent;
10438
+ ], HistoricalPixAccountComponent);
10439
+ return HistoricalPixAccountComponent;
10402
10440
  }());
10403
10441
 
10404
10442
  var HistoricalPixAccountService = /** @class */ (function () {
@@ -10502,6 +10540,7 @@
10502
10540
  this.isOnlyView = new core.EventEmitter();
10503
10541
  this.isOnlyEdit = new core.EventEmitter();
10504
10542
  this.enableView = new core.EventEmitter();
10543
+ this.enableEdit = new core.EventEmitter();
10505
10544
  this.ngUnsubscribe = new rxjs.Subject();
10506
10545
  this.loading = true;
10507
10546
  this.columns = [
@@ -10569,7 +10608,7 @@
10569
10608
  });
10570
10609
  }
10571
10610
  else {
10572
- _this.enableView.emit(dateChange);
10611
+ _this.enableEdit.emit(dateChange);
10573
10612
  }
10574
10613
  }
10575
10614
  else {
@@ -10741,6 +10780,9 @@
10741
10780
  __decorate([
10742
10781
  core.Output()
10743
10782
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
10783
+ __decorate([
10784
+ core.Output()
10785
+ ], HistoricalPixAccountListComponent.prototype, "enableEdit", void 0);
10744
10786
  __decorate([
10745
10787
  core.Input()
10746
10788
  ], HistoricalPixAccountListComponent.prototype, "reloadList", null);