@senior-gestao-pessoas/payroll-core 9.1.0 → 9.2.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 (40) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +1025 -0
  2. package/bundles/senior-gestao-pessoas-payroll-core.umd.js.map +1 -1
  3. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js +1 -1
  4. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js.map +1 -1
  5. package/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.d.ts +75 -0
  6. package/components/historical-pix-account/historical-pix-account.component.d.ts +74 -0
  7. package/components/historical-pix-account/historical-pix-account.module.d.ts +2 -0
  8. package/components/historical-pix-account/historical-pix-account.service.d.ts +8 -0
  9. package/components/historical-pix-account/index.d.ts +3 -0
  10. package/components/utils/format-utils/format-utils.service.d.ts +33 -0
  11. package/components/utils/generic-validators.d.ts +24 -0
  12. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +340 -0
  13. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +323 -0
  14. package/esm2015/components/historical-pix-account/historical-pix-account.module.js +58 -0
  15. package/esm2015/components/historical-pix-account/historical-pix-account.service.js +20 -0
  16. package/esm2015/components/historical-pix-account/index.js +4 -0
  17. package/esm2015/components/utils/format-utils/format-utils.service.js +96 -0
  18. package/esm2015/components/utils/generic-validators.js +164 -0
  19. package/esm2015/public_api.js +2 -1
  20. package/esm2015/senior-gestao-pessoas-payroll-core.js +2 -1
  21. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +364 -0
  22. package/esm5/components/historical-pix-account/historical-pix-account.component.js +357 -0
  23. package/esm5/components/historical-pix-account/historical-pix-account.module.js +61 -0
  24. package/esm5/components/historical-pix-account/historical-pix-account.service.js +22 -0
  25. package/esm5/components/historical-pix-account/index.js +4 -0
  26. package/esm5/components/utils/format-utils/format-utils.service.js +100 -0
  27. package/esm5/components/utils/generic-validators.js +167 -0
  28. package/esm5/public_api.js +2 -1
  29. package/esm5/senior-gestao-pessoas-payroll-core.js +2 -1
  30. package/fesm2015/senior-gestao-pessoas-payroll-core.js +954 -1
  31. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  32. package/fesm5/senior-gestao-pessoas-payroll-core.js +1022 -1
  33. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  34. package/locale/en-US.json +26 -1
  35. package/locale/es-ES.json +26 -1
  36. package/locale/pt-BR.json +26 -1
  37. package/package.json +1 -1
  38. package/public_api.d.ts +1 -0
  39. package/senior-gestao-pessoas-payroll-core.d.ts +1 -0
  40. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
@@ -9322,6 +9322,1027 @@
9322
9322
  return FromToModule;
9323
9323
  }());
9324
9324
 
9325
+ var FormatUtilsService = /** @class */ (function () {
9326
+ function FormatUtilsService() {
9327
+ }
9328
+ /**
9329
+ * Retorna o CPF formatado
9330
+ * @param cpf CPF
9331
+ */
9332
+ FormatUtilsService.getFormattedCpf = function (cpf) {
9333
+ if (cpf) {
9334
+ return cpf
9335
+ .replace(/\D/g, "")
9336
+ .replace(/(\d{3})(\d)/, "$1.$2")
9337
+ .replace(/(\d{3})(\d)/, "$1.$2")
9338
+ .replace(/(\d{3})(\d)/, "$1-$2");
9339
+ }
9340
+ return null;
9341
+ };
9342
+ /**
9343
+ * Retorna o CNPJ formatado
9344
+ * @param cnpj CNPJ
9345
+ */
9346
+ FormatUtilsService.getFormattedCnpj = function (cnpj) {
9347
+ if (cnpj) {
9348
+ return cnpj
9349
+ .replace(/\D/g, "")
9350
+ .replace(/(\d{2})(\d)/, "$1.$2")
9351
+ .replace(/(\d{3})(\d)/, "$1.$2")
9352
+ .replace(/(\d{3})(\d)/, "$1/$2")
9353
+ .replace(/(\d{4})(\d)/, "$1-$2");
9354
+ }
9355
+ return null;
9356
+ };
9357
+ /**
9358
+ * Retorna a mascara do CPF/CNPJ
9359
+ * @param key Valores possíveis são CPF ou CNPJ
9360
+ */
9361
+ FormatUtilsService.getCpfCnpjMask = function (key) {
9362
+ switch (key) {
9363
+ case "CPF":
9364
+ return "999.999.999-99";
9365
+ case "CNPJ":
9366
+ return "99.999.999/9999-99";
9367
+ default:
9368
+ return "";
9369
+ }
9370
+ };
9371
+ /**
9372
+ * Metódo para formatar o número de telefone.
9373
+ * @param telephoneNumber String contendo o número de telefone.
9374
+ * @returns String formatada com o número de telefone.
9375
+ */
9376
+ FormatUtilsService.getFormattedTelephoneNumber = function (telephoneNumber) {
9377
+ var tel = telephoneNumber.replace(/\D/g, '');
9378
+ tel = tel.replace(/^0/, '');
9379
+ if (tel.length > 10) {
9380
+ // ########## -> (##) #####-####
9381
+ tel = tel.replace(/^(\d{2})?(\d{5})?(\d{4}).*/, '($1) $2-$3');
9382
+ }
9383
+ else if (tel.length > 9) {
9384
+ // AA######### -> (AA) ####-####
9385
+ tel = tel.replace(/^(\d{2})?(\d{4})?(\d{4}).*/, '($1) $2-$3');
9386
+ }
9387
+ else if (tel.length > 5) {
9388
+ // ####### -> (##) ####-#
9389
+ tel = tel.replace(/^(\d{2})?(\d{4})?(\d{0,4}).*/, '($1) $2-$3');
9390
+ }
9391
+ else if (tel.length > 1) {
9392
+ // #### -> (##) ##
9393
+ tel = tel.replace(/^(\d{2})?(\d{0,5}).*/, '($1) $2');
9394
+ }
9395
+ else {
9396
+ if (tel !== '') {
9397
+ tel = tel.replace(/^(\d*)/, '($1');
9398
+ }
9399
+ }
9400
+ return tel;
9401
+ };
9402
+ /**
9403
+ * Metódo para formatar o número de telefone de um campo Input.
9404
+ * @param event Evento do Input do campo de telefone.
9405
+ */
9406
+ FormatUtilsService.formatTelephoneInputEvent = function (event) {
9407
+ var telephoneNumber = event.target.value;
9408
+ // Permite Backspace para usuário remover ")" e "-"
9409
+ if (event.keyCode === 8 && (telephoneNumber.length === 9 || telephoneNumber.length === 4 || telephoneNumber.length === 3)) {
9410
+ return;
9411
+ }
9412
+ event.target.value = FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9413
+ };
9414
+ /**
9415
+ * Metódo para formatar a porcentagem para 2 casas decimais.
9416
+ * @param value Número a ser formatado.
9417
+ */
9418
+ FormatUtilsService.getFormattedPercentage = function (value) {
9419
+ return parseFloat(value).toFixed(2).replace('.', ',') + '%';
9420
+ };
9421
+ return FormatUtilsService;
9422
+ }());
9423
+
9424
+ var HistoricalPixAccountComponent = /** @class */ (function () {
9425
+ function HistoricalPixAccountComponent(translateService, cd, formBuilder) {
9426
+ var _this = this;
9427
+ this.translateService = translateService;
9428
+ this.cd = cd;
9429
+ this.formBuilder = formBuilder;
9430
+ this.recordByRow = 1;
9431
+ this.showDateChange = false;
9432
+ this.isEditMode = false;
9433
+ this.isViewMode = false;
9434
+ this.withSideBar = true;
9435
+ this.visibleChange = new core.EventEmitter();
9436
+ this.ngUnsubscribe = new rxjs.Subject();
9437
+ this.orderBy = {
9438
+ field: "dateChange",
9439
+ direction: exports.DirectionEnumeration.DESC,
9440
+ };
9441
+ this.pixAccountItemInput = {};
9442
+ this.totalRecords = 0;
9443
+ this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9444
+ this.loading = true;
9445
+ this.listData = [];
9446
+ this.listDataNoPage = [];
9447
+ this.cols = [
9448
+ {
9449
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9450
+ field: "pixKeyType",
9451
+ },
9452
+ {
9453
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9454
+ field: "pixKey",
9455
+ },
9456
+ {
9457
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9458
+ field: "percentage",
9459
+ },
9460
+ ];
9461
+ this.actions = function (rowData, key) {
9462
+ if (rowData === void 0) { rowData = {}; }
9463
+ return [
9464
+ {
9465
+ visible: _this.isEditMode,
9466
+ label: _this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9467
+ command: function () {
9468
+ rowData["index"] = key;
9469
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: false };
9470
+ _this.visible = true;
9471
+ },
9472
+ },
9473
+ {
9474
+ visible: !!(!_this.isEditMode && _this.withSideBar),
9475
+ label: _this.translateService.instant("hcm.payroll.edit"),
9476
+ command: function () {
9477
+ rowData["index"] = key;
9478
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
9479
+ _this.visible = true;
9480
+ },
9481
+ },
9482
+ {
9483
+ visible: !_this.isEditMode,
9484
+ label: _this.translateService.instant("hcm.payroll.delete"),
9485
+ command: function () {
9486
+ _this.loading = true;
9487
+ _this.deleteAnnuityItem(key);
9488
+ },
9489
+ },
9490
+ ];
9491
+ };
9492
+ this.createFormGroup();
9493
+ }
9494
+ HistoricalPixAccountComponent.prototype.ngOnInit = function () {
9495
+ this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9496
+ };
9497
+ HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9498
+ this.historicalPixAccountList = this.formBuilder.group({
9499
+ historicalPixAccountList: this.formBuilder.control(null),
9500
+ });
9501
+ };
9502
+ HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
9503
+ this.ngUnsubscribe.next();
9504
+ this.ngUnsubscribe.complete();
9505
+ };
9506
+ HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9507
+ this.cd.detectChanges();
9508
+ };
9509
+ HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
9510
+ var _this = this;
9511
+ var first = event && event.first ? event.first : 0;
9512
+ var rows = event && event.rows ? event.rows : this.recordByRow;
9513
+ var arrList = this.getHistoricalPixAccountList();
9514
+ this.listData = [];
9515
+ this.totalRecords = null;
9516
+ if (event && event.multiSortMeta && event.multiSortMeta.length) {
9517
+ event.multiSortMeta.map(function (value) {
9518
+ _this.orderBy.field = value.field;
9519
+ _this.orderBy.direction = value.order === 1 ? exports.DirectionEnumeration.ASC : exports.DirectionEnumeration.DESC;
9520
+ });
9521
+ }
9522
+ if (arrList && arrList.length) {
9523
+ this.totalRecords = arrList.length;
9524
+ this.listData = arrList;
9525
+ this.listDataNoPage = __spread(arrList);
9526
+ this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9527
+ this.listData = this.listData.slice(first, (first + rows));
9528
+ }
9529
+ else {
9530
+ this.listDataNoPage = [];
9531
+ }
9532
+ if (this.isEditMode || arrList && arrList.length === 1) {
9533
+ this.refreshCssInIE11();
9534
+ }
9535
+ this.loading = false;
9536
+ };
9537
+ /**
9538
+ * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
9539
+ */
9540
+ HistoricalPixAccountComponent.prototype.refreshCssInIE11 = function () {
9541
+ if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
9542
+ setTimeout(function () {
9543
+ var row = document.getElementsByClassName("row0");
9544
+ if (row && row[0])
9545
+ row[0].className = 'refresh';
9546
+ }, 1);
9547
+ }
9548
+ };
9549
+ HistoricalPixAccountComponent.prototype.add = function () {
9550
+ this.pixAccountItemInput = {};
9551
+ this.visible = true;
9552
+ };
9553
+ HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
9554
+ var newlist = __spread(this.getHistoricalPixAccountList());
9555
+ newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9556
+ delete newlist[index];
9557
+ newlist = newlist.filter(function (val) { return val; });
9558
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
9559
+ this.verifyTotalPercentage();
9560
+ this.onLazyLoad();
9561
+ };
9562
+ HistoricalPixAccountComponent.prototype.getHistoricalPixAccountList = function () {
9563
+ if (this.historicalPixAccountList.get("historicalPixAccountList") &&
9564
+ this.historicalPixAccountList.get("historicalPixAccountList").value &&
9565
+ this.historicalPixAccountList.get("historicalPixAccountList").value.length)
9566
+ return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
9567
+ else
9568
+ return [];
9569
+ };
9570
+ HistoricalPixAccountComponent.prototype.addItemInList = function ($event) {
9571
+ var index = $event && $event.index >= 0 ? $event.index : null;
9572
+ var newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9573
+ if (index != null) {
9574
+ newDataList[index] = $event;
9575
+ delete $event.index;
9576
+ }
9577
+ else {
9578
+ if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
9579
+ var customValue = mountCustomToSave($event["customFields"]);
9580
+ $event["customFields"] = __spread(customValue);
9581
+ }
9582
+ $event["dateChange"] = this.dateChange;
9583
+ newDataList.push($event);
9584
+ }
9585
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9586
+ this.verifyTotalPercentage();
9587
+ this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
9588
+ };
9589
+ HistoricalPixAccountComponent.prototype.getNumberPageByIndex = function (index, list) {
9590
+ if (index) {
9591
+ var total = list.length;
9592
+ var sub = this.recordByRow - 1;
9593
+ return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
9594
+ }
9595
+ return null;
9596
+ };
9597
+ HistoricalPixAccountComponent.prototype.verifyTotalPercentage = function () {
9598
+ var list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9599
+ var arrayPercentage = [];
9600
+ if (!list.length)
9601
+ return this.msgTotalLimitByPercentage = null;
9602
+ list.filter(function (item) { return arrayPercentage.push(item && item["percentage"]); });
9603
+ var sumPercentage = arrayPercentage.reduce(function (total, percentage) {
9604
+ return total + percentage;
9605
+ }, 0);
9606
+ if (sumPercentage === 100) {
9607
+ this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
9608
+ }
9609
+ else {
9610
+ this.msgTotalLimitByPercentage = null;
9611
+ }
9612
+ };
9613
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
9614
+ get: function () {
9615
+ return this.actions.bind(this);
9616
+ },
9617
+ enumerable: true,
9618
+ configurable: true
9619
+ });
9620
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
9621
+ get: function () {
9622
+ return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
9623
+ },
9624
+ enumerable: true,
9625
+ configurable: true
9626
+ });
9627
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "getTooltipAndDisableButtonAdd", {
9628
+ get: function () {
9629
+ return this.dateChange ? null : this.msgTooltipAdd;
9630
+ },
9631
+ enumerable: true,
9632
+ configurable: true
9633
+ });
9634
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "dateChange", {
9635
+ get: function () {
9636
+ return this._dateChange;
9637
+ },
9638
+ set: function (value) {
9639
+ var _this = this;
9640
+ this._dateChange = value;
9641
+ if (this._dateChange) {
9642
+ this.listData.filter(function (row) { return row["dateChange"] = _this._dateChange; });
9643
+ }
9644
+ },
9645
+ enumerable: true,
9646
+ configurable: true
9647
+ });
9648
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
9649
+ get: function () {
9650
+ return this._displayDateChange;
9651
+ },
9652
+ set: function (value) {
9653
+ var _this = this;
9654
+ this._displayDateChange = value;
9655
+ if (this._displayDateChange) {
9656
+ this.listData.filter(function (row) { return row["displayDateChange"] = _this._displayDateChange; });
9657
+ }
9658
+ },
9659
+ enumerable: true,
9660
+ configurable: true
9661
+ });
9662
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "addListData", {
9663
+ set: function (list) {
9664
+ this.loading = true;
9665
+ this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
9666
+ this.verifyTotalPercentage();
9667
+ this.onLazyLoad();
9668
+ },
9669
+ enumerable: true,
9670
+ configurable: true
9671
+ });
9672
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
9673
+ get: function () {
9674
+ return this._visible;
9675
+ },
9676
+ set: function (value) {
9677
+ this._visible = value;
9678
+ this.visibleChange.emit(this.visible);
9679
+ },
9680
+ enumerable: true,
9681
+ configurable: true
9682
+ });
9683
+ HistoricalPixAccountComponent.prototype.close = function () {
9684
+ this.visible = false;
9685
+ };
9686
+ HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
9687
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9688
+ };
9689
+ HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
9690
+ return FormatUtilsService.getFormattedCpf(cpf);
9691
+ };
9692
+ HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
9693
+ return FormatUtilsService.getFormattedCnpj(cnpj);
9694
+ };
9695
+ HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
9696
+ return FormatUtilsService.getFormattedPercentage(value);
9697
+ };
9698
+ HistoricalPixAccountComponent.ctorParameters = function () { return [
9699
+ { type: core$1.TranslateService },
9700
+ { type: core.ChangeDetectorRef },
9701
+ { type: forms.FormBuilder }
9702
+ ]; };
9703
+ __decorate([
9704
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
9705
+ ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
9706
+ __decorate([
9707
+ core.Input()
9708
+ ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
9709
+ __decorate([
9710
+ core.Input()
9711
+ ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
9712
+ __decorate([
9713
+ core.Input()
9714
+ ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
9715
+ __decorate([
9716
+ core.Input()
9717
+ ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
9718
+ __decorate([
9719
+ core.Input()
9720
+ ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
9721
+ __decorate([
9722
+ core.Input()
9723
+ ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
9724
+ __decorate([
9725
+ core.Input()
9726
+ ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
9727
+ __decorate([
9728
+ core.Input()
9729
+ ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
9730
+ __decorate([
9731
+ core.Input()
9732
+ ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
9733
+ __decorate([
9734
+ core.Input()
9735
+ ], HistoricalPixAccountComponent.prototype, "currency", void 0);
9736
+ __decorate([
9737
+ core.Input()
9738
+ ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9739
+ __decorate([
9740
+ core.Input()
9741
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
9742
+ __decorate([
9743
+ core.Input()
9744
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
9745
+ __decorate([
9746
+ core.Input()
9747
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
9748
+ __decorate([
9749
+ core.Input()
9750
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
9751
+ __decorate([
9752
+ core.Input()
9753
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
9754
+ __decorate([
9755
+ core.Input()
9756
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
9757
+ __decorate([
9758
+ core.Input()
9759
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
9760
+ HistoricalPixAccountComponent = __decorate([
9761
+ core.Component({
9762
+ // tslint:disable-next-line:component-selector
9763
+ selector: "c-historical-pix-account",
9764
+ 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)\"></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)\"></pix-account>\n</div>\n\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"actions(rowData, key).length > 1\" [label]=\"actionLabel\"\n priority=\"default\" [model]=\"scopedActions(rowData, key)\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n\n <s-button id=\"table-admission-btn-action-{{key}}\"\n *ngIf=\"actions(rowData, key).length <= 1\"\n [label]=\"scopedActions(rowData, key)[0].label\"\n priority=\"default\"\n (click)=\"scopedActions(rowData, key)[0].command()\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length +2\">\n {{'hcm.payroll.admission_empty_message'|translate}}\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span *ngIf=\"totalRecords\">{{recordsMessage}}</span>\n </ng-template>\n </p-table>\n</div>\n",
9765
+ 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}"]
9766
+ })
9767
+ ], HistoricalPixAccountComponent);
9768
+ return HistoricalPixAccountComponent;
9769
+ }());
9770
+
9771
+ var GenericValidator = /** @class */ (function () {
9772
+ function GenericValidator() {
9773
+ }
9774
+ /**
9775
+ * Valida o CEI (Cadastro específico de INSS) digitado.
9776
+ */
9777
+ GenericValidator.isValidCei = function (control) {
9778
+ var cei = control.value;
9779
+ if (!cei)
9780
+ return null;
9781
+ else if (cei.length != 11)
9782
+ return null;
9783
+ var multiplicadorBase = "3298765432";
9784
+ var total = 0;
9785
+ var resto = 0;
9786
+ var multiplicando = 0;
9787
+ var multiplicador = 0;
9788
+ if (cei.length !== 11 ||
9789
+ cei === "00000000000" ||
9790
+ cei === "11111111111" ||
9791
+ cei === "22222222222" ||
9792
+ cei === "33333333333" ||
9793
+ cei === "44444444444" ||
9794
+ cei === "55555555555" ||
9795
+ cei === "66666666666" ||
9796
+ cei === "77777777777" ||
9797
+ cei === "88888888888" ||
9798
+ cei === "99999999999")
9799
+ return { invalidCei: true };
9800
+ else {
9801
+ for (var i = 0; i < 10; i++) {
9802
+ multiplicando = parseInt(cei.substring(i, i + 1), 10);
9803
+ multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
9804
+ total += multiplicando * multiplicador;
9805
+ }
9806
+ resto = 11 - (total % 11);
9807
+ resto = resto === 10 || resto === 11 ? 0 : resto;
9808
+ var digito = parseInt("" + cei.charAt(10), 10);
9809
+ return resto === digito ? null : { invalidCei: true };
9810
+ }
9811
+ };
9812
+ /**
9813
+ * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9814
+ */
9815
+ GenericValidator.isValidCpf = function (control) {
9816
+ var cpf = control.value;
9817
+ if (cpf) {
9818
+ var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9819
+ equalDigits = 1;
9820
+ if (cpf.length < 11) {
9821
+ return null;
9822
+ }
9823
+ for (i = 0; i < cpf.length - 1; i++) {
9824
+ if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9825
+ equalDigits = 0;
9826
+ break;
9827
+ }
9828
+ }
9829
+ if (!equalDigits) {
9830
+ numbers = cpf.substring(0, 9);
9831
+ digits = cpf.substring(9);
9832
+ sum = 0;
9833
+ for (i = 10; i > 1; i--) {
9834
+ sum += numbers.charAt(10 - i) * i;
9835
+ }
9836
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9837
+ if (result !== Number(digits.charAt(0))) {
9838
+ return { cpfNotValid: true };
9839
+ }
9840
+ numbers = cpf.substring(0, 10);
9841
+ sum = 0;
9842
+ for (i = 11; i > 1; i--) {
9843
+ sum += numbers.charAt(11 - i) * i;
9844
+ }
9845
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9846
+ if (result !== Number(digits.charAt(1))) {
9847
+ return { cpfNotValid: true };
9848
+ }
9849
+ return null;
9850
+ }
9851
+ else {
9852
+ return { cpfNotValid: true };
9853
+ }
9854
+ }
9855
+ return null;
9856
+ };
9857
+ /**
9858
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9859
+ */
9860
+ GenericValidator.isValidCnpj = function (control) {
9861
+ var cnpj = control.value;
9862
+ if (cnpj) {
9863
+ var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9864
+ cnpj = cnpj.replace(/[^\d]+/g, '');
9865
+ if (cnpj.length !== 14) {
9866
+ return null;
9867
+ }
9868
+ // Elimina CNPJs invalidos conhecidos
9869
+ if (cnpj === '00000000000000' ||
9870
+ cnpj === '11111111111111' ||
9871
+ cnpj === '22222222222222' ||
9872
+ cnpj === '33333333333333' ||
9873
+ cnpj === '44444444444444' ||
9874
+ cnpj === '55555555555555' ||
9875
+ cnpj === '66666666666666' ||
9876
+ cnpj === '77777777777777' ||
9877
+ cnpj === '88888888888888' ||
9878
+ cnpj === '99999999999999') {
9879
+ return { cnpjNotValid: true };
9880
+ }
9881
+ // Valida DVs
9882
+ size = cnpj.length - 2;
9883
+ numbers = cnpj.substring(0, size);
9884
+ digits = cnpj.substring(size);
9885
+ sum = 0;
9886
+ pos = size - 7;
9887
+ for (var i = size; i >= 1; i--) {
9888
+ sum += numbers.charAt(size - i) * pos--;
9889
+ if (pos < 2) {
9890
+ pos = 9;
9891
+ }
9892
+ }
9893
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9894
+ if (result !== Number(digits.charAt(0))) {
9895
+ return { cnpjNotValid: true };
9896
+ }
9897
+ size = size + 1;
9898
+ numbers = cnpj.substring(0, size);
9899
+ sum = 0;
9900
+ pos = size - 7;
9901
+ for (var i = size; i >= 1; i--) {
9902
+ sum += numbers.charAt(size - i) * pos--;
9903
+ if (pos < 2) {
9904
+ pos = 9;
9905
+ }
9906
+ }
9907
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9908
+ if (result !== Number(digits.charAt(1))) {
9909
+ return { cnpjNotValid: true };
9910
+ }
9911
+ return null;
9912
+ }
9913
+ return null;
9914
+ };
9915
+ /**
9916
+ * Válida o número de telefone da chave PIX.
9917
+ */
9918
+ GenericValidator.isValidPhoneNumber = function (control) {
9919
+ var cellPhoneKey = control.value || '';
9920
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9921
+ var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9922
+ var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9923
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9924
+ };
9925
+ /**
9926
+ * Valida o email da chave PIX.
9927
+ */
9928
+ GenericValidator.isValidEmail = function (control) {
9929
+ var emailKey = control.value;
9930
+ var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9931
+ var isValidEmail = regexValidEmail.test(emailKey);
9932
+ return isValidEmail ? null : { invalidEmail: true };
9933
+ };
9934
+ return GenericValidator;
9935
+ }());
9936
+
9937
+ var HistoricalPixAccountFormComponent = /** @class */ (function () {
9938
+ function HistoricalPixAccountFormComponent(formBuilder, cd) {
9939
+ this.formBuilder = formBuilder;
9940
+ this.cd = cd;
9941
+ this.withSideBar = true;
9942
+ this.isEditMode = false;
9943
+ this.paramsForm = new forms.FormGroup({});
9944
+ this.visibleChange = new core.EventEmitter();
9945
+ this.pixAccountItemToList = new core.EventEmitter();
9946
+ this.ngUnsubscribe = new rxjs.Subject();
9947
+ this.initialValidatorOfPercentage = [forms.Validators.required, forms.Validators.min(0.01)];
9948
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9949
+ this.maxValuePercentage = 100.00;
9950
+ this.visibleBtnSave = true;
9951
+ this.isView = false;
9952
+ this.isShowPixKeyFieldValidatorMessage = false;
9953
+ this.createFormGroup();
9954
+ this.registerSubjects();
9955
+ }
9956
+ HistoricalPixAccountFormComponent.prototype.ngOnInit = function () {
9957
+ };
9958
+ HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
9959
+ this.cd.detectChanges();
9960
+ };
9961
+ HistoricalPixAccountFormComponent.prototype.ngOnDestroy = function () {
9962
+ this.ngUnsubscribe.next(true);
9963
+ this.ngUnsubscribe.unsubscribe();
9964
+ };
9965
+ HistoricalPixAccountFormComponent.prototype.registerSubjects = function () {
9966
+ };
9967
+ HistoricalPixAccountFormComponent.prototype.createFormGroup = function () {
9968
+ this.pixAccountFormGroup = this.formBuilder.group({
9969
+ id: this.formBuilder.control(null),
9970
+ index: this.formBuilder.control(null),
9971
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9972
+ dateChange: this.formBuilder.control(null),
9973
+ pixKeyType: this.formBuilder.control(null, forms.Validators.required),
9974
+ pixKey: this.formBuilder.control(null),
9975
+ percentage: this.formBuilder.control(null, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9976
+ forms.Validators.max(this.maxValuePercentage),
9977
+ ]))),
9978
+ customFields: this.formBuilder.control(null),
9979
+ });
9980
+ };
9981
+ HistoricalPixAccountFormComponent.prototype.onChangePixKeyType = function (item) {
9982
+ if (item.key) {
9983
+ this.pixKeyType = item.key;
9984
+ this.isShowPixKeyFieldValidatorMessage = true;
9985
+ this.pixAccountFormGroup.get("pixKey").reset();
9986
+ this.setPixKeyValidators();
9987
+ if (item.key === "CPF") {
9988
+ this.setDefaultCpfPixKey();
9989
+ }
9990
+ }
9991
+ };
9992
+ HistoricalPixAccountFormComponent.prototype.onClearPixKeyType = function () {
9993
+ this.isShowPixKeyFieldValidatorMessage = false;
9994
+ this.pixAccountFormGroup.get("pixKey").reset();
9995
+ };
9996
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
9997
+ get: function () {
9998
+ return this._visible;
9999
+ },
10000
+ set: function (value) {
10001
+ this._visible = value;
10002
+ this.visibleChange.emit(this.visible);
10003
+ },
10004
+ enumerable: true,
10005
+ configurable: true
10006
+ });
10007
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", {
10008
+ set: function (value) {
10009
+ this.resetForm();
10010
+ this.visibleBtnSave = true;
10011
+ if (value && value.currentItem && Object.keys(value.currentItem).length) {
10012
+ this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(__assign({}, value.currentItem)));
10013
+ this.labelBtnAdd = "hcm.payroll.employees_update";
10014
+ this.setValidatorsAccordingList(value.listData, value.currentItem["index"]);
10015
+ if (!this.isView) {
10016
+ this.configEnableFields(value && value["isEditMode"]);
10017
+ }
10018
+ }
10019
+ else {
10020
+ this.labelBtnAdd = "hcm.payroll.employees_add";
10021
+ }
10022
+ },
10023
+ enumerable: true,
10024
+ configurable: true
10025
+ });
10026
+ HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
10027
+ var obj = __assign({}, data);
10028
+ obj["customFields"] = mountCustomToShow(obj["customFields"]);
10029
+ return obj;
10030
+ };
10031
+ HistoricalPixAccountFormComponent.prototype.configEnableFields = function (isEditMode) {
10032
+ this.visibleBtnSave = isEditMode;
10033
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
10034
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
10035
+ this.setPixKeyValidators();
10036
+ if (this.pixKeyType === "TELEPHONE") {
10037
+ this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
10038
+ }
10039
+ }
10040
+ configEnabledFields(this.pixAccountFormGroup, isEditMode, [
10041
+ "pixKeyType",
10042
+ "pixKey",
10043
+ "percentage",
10044
+ "customFields",
10045
+ ], []);
10046
+ };
10047
+ HistoricalPixAccountFormComponent.prototype.close = function () {
10048
+ this.resetForm();
10049
+ this.visible = false;
10050
+ };
10051
+ HistoricalPixAccountFormComponent.prototype.addItem = function () {
10052
+ this.pixAccountFormGroup.updateValueAndValidity();
10053
+ verifyValidationsForm.call(this.pixAccountFormGroup);
10054
+ if (this.pixAccountFormGroup.valid) {
10055
+ if (this.employeeId) {
10056
+ this.pixAccountFormGroup.get("employee").setValue({
10057
+ tableId: this.employeeId,
10058
+ name: "",
10059
+ });
10060
+ }
10061
+ this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
10062
+ this.visible = false;
10063
+ this.resetForm();
10064
+ }
10065
+ };
10066
+ HistoricalPixAccountFormComponent.prototype.resetForm = function () {
10067
+ this.pixAccountFormGroup.reset();
10068
+ this.labelBtnAdd = "hcm.payroll.employees_add";
10069
+ if (this.customFields && this.customFields.formGroup)
10070
+ this.customFields.formGroup.reset();
10071
+ };
10072
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "percentagePlaceholder", {
10073
+ get: function () {
10074
+ return "0" + (this.currency && this.currency.decimalSeparator) + "00";
10075
+ },
10076
+ enumerable: true,
10077
+ configurable: true
10078
+ });
10079
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "optionsPercentage", {
10080
+ get: function () {
10081
+ return __assign({}, this.getOptions(), { precision: 2 });
10082
+ },
10083
+ enumerable: true,
10084
+ configurable: true
10085
+ });
10086
+ HistoricalPixAccountFormComponent.prototype.getOptions = function () {
10087
+ return {
10088
+ prefix: "",
10089
+ thousands: this.currency.thousandsSeparator,
10090
+ decimal: this.currency.decimalSeparator,
10091
+ };
10092
+ };
10093
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "getListPixAccount", {
10094
+ /**
10095
+ * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
10096
+ * @param pixAccountList
10097
+ */
10098
+ set: function (pixAccountList) {
10099
+ if (pixAccountList) {
10100
+ this.setValidatorsAccordingList(pixAccountList);
10101
+ }
10102
+ else {
10103
+ this.resetForm();
10104
+ }
10105
+ },
10106
+ enumerable: true,
10107
+ configurable: true
10108
+ });
10109
+ /**
10110
+ * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
10111
+ * a validação dos campos "percentage" e "pixAccount".
10112
+ * 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
10113
+ * no array de comparação dos validators.
10114
+ * @param pixAccountList
10115
+ * @param index
10116
+ */
10117
+ HistoricalPixAccountFormComponent.prototype.setValidatorsAccordingList = function (pixAccountList, index) {
10118
+ if (index === void 0) { index = null; }
10119
+ this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
10120
+ var percentageIncluded = [];
10121
+ if (this.pixAccountList && this.pixAccountList.length) {
10122
+ this.pixAccountList.filter(function (field, key) {
10123
+ if (field["percentage"] && key != index) {
10124
+ percentageIncluded.push(field["percentage"]);
10125
+ }
10126
+ });
10127
+ }
10128
+ this.beforeSetPixKeyTypeValidator();
10129
+ this.setPixKeyValidators();
10130
+ this.validatePercentageValid(percentageIncluded);
10131
+ };
10132
+ /**
10133
+ * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
10134
+ */
10135
+ HistoricalPixAccountFormComponent.prototype.setPixKeyValidators = function () {
10136
+ var genericPixKey = this.pixAccountFormGroup.get("pixKey");
10137
+ if (this.pixKeyType) {
10138
+ switch (this.pixKeyType) {
10139
+ case "TELEPHONE":
10140
+ genericPixKey.setValidators(forms.Validators.compose([
10141
+ forms.Validators.required, GenericValidator.isValidPhoneNumber,
10142
+ ]));
10143
+ break;
10144
+ case "EMAIL":
10145
+ genericPixKey.setValidators(forms.Validators.compose([
10146
+ forms.Validators.required, GenericValidator.isValidEmail,
10147
+ ]));
10148
+ break;
10149
+ case "CPF":
10150
+ genericPixKey.setValidators(forms.Validators.compose([
10151
+ forms.Validators.required, GenericValidator.isValidCpf,
10152
+ ]));
10153
+ break;
10154
+ case "CNPJ":
10155
+ genericPixKey.setValidators(forms.Validators.compose([
10156
+ forms.Validators.required, GenericValidator.isValidCnpj,
10157
+ ]));
10158
+ break;
10159
+ case "RANDOM_KEY":
10160
+ genericPixKey.setValidators(forms.Validators.required);
10161
+ break;
10162
+ default:
10163
+ genericPixKey.setValidators(null);
10164
+ break;
10165
+ }
10166
+ genericPixKey.enable();
10167
+ genericPixKey.updateValueAndValidity();
10168
+ }
10169
+ };
10170
+ /**
10171
+ * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
10172
+ * 100% na validação do campo "percentage" como um novo maxValue;
10173
+ * @param listValue
10174
+ */
10175
+ HistoricalPixAccountFormComponent.prototype.validatePercentageValid = function (listValue) {
10176
+ var percentage = this.pixAccountFormGroup.get("percentage");
10177
+ this.maxValuePercentage = listValue
10178
+ .reduce(function (currentValue, total) { return currentValue - total; }, 100.00);
10179
+ percentage
10180
+ .setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10181
+ forms.Validators.max(this.maxValuePercentage),
10182
+ ])));
10183
+ percentage.updateValueAndValidity();
10184
+ };
10185
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10186
+ set: function (condition) {
10187
+ this.isView = !!(condition && !this.withSideBar);
10188
+ this.configEnableFields(!this.isView);
10189
+ if (!this.isView)
10190
+ this.resetForm();
10191
+ },
10192
+ enumerable: true,
10193
+ configurable: true
10194
+ });
10195
+ HistoricalPixAccountFormComponent.prototype.phoneMask = function (event) {
10196
+ FormatUtilsService.formatTelephoneInputEvent(event);
10197
+ };
10198
+ HistoricalPixAccountFormComponent.prototype.setDefaultCpfPixKey = function () {
10199
+ var sheetDocument = this.paramsForm.get("sheetDocument");
10200
+ if (sheetDocument) {
10201
+ var cpf = sheetDocument.get("cpfNumber").value;
10202
+ if (cpf) {
10203
+ this.pixAccountFormGroup.get("pixKey").setValue(cpf);
10204
+ }
10205
+ }
10206
+ };
10207
+ HistoricalPixAccountFormComponent.prototype.beforeSetPixKeyTypeValidator = function () {
10208
+ var pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
10209
+ if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
10210
+ pixKeyType
10211
+ .setValidators(forms.Validators.compose([
10212
+ forms.Validators.required,
10213
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
10214
+ ]));
10215
+ }
10216
+ else {
10217
+ pixKeyType.setValidators(forms.Validators.required);
10218
+ }
10219
+ };
10220
+ HistoricalPixAccountFormComponent.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
10221
+ return function (control) {
10222
+ var value = control && control.value;
10223
+ var condition = false;
10224
+ listCompare.filter(function (field) {
10225
+ if (value) {
10226
+ if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
10227
+ return condition = true;
10228
+ }
10229
+ }
10230
+ });
10231
+ if (condition) {
10232
+ return { pixKeyTypeBankAccountDuplicate: true };
10233
+ }
10234
+ else {
10235
+ return null;
10236
+ }
10237
+ };
10238
+ };
10239
+ HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10240
+ { type: forms.FormBuilder },
10241
+ { type: core.ChangeDetectorRef }
10242
+ ]; };
10243
+ __decorate([
10244
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: true })
10245
+ ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
10246
+ __decorate([
10247
+ core.Input()
10248
+ ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
10249
+ __decorate([
10250
+ core.Input()
10251
+ ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
10252
+ __decorate([
10253
+ core.Input()
10254
+ ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
10255
+ __decorate([
10256
+ core.Input()
10257
+ ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
10258
+ __decorate([
10259
+ core.Input()
10260
+ ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
10261
+ __decorate([
10262
+ core.Input()
10263
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
10264
+ __decorate([
10265
+ core.Output()
10266
+ ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
10267
+ __decorate([
10268
+ core.Output()
10269
+ ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
10270
+ __decorate([
10271
+ core.Input()
10272
+ ], HistoricalPixAccountFormComponent.prototype, "visible", null);
10273
+ __decorate([
10274
+ core.Input()
10275
+ ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
10276
+ __decorate([
10277
+ core.Input()
10278
+ ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
10279
+ __decorate([
10280
+ core.Input()
10281
+ ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
10282
+ HistoricalPixAccountFormComponent = __decorate([
10283
+ core.Component({
10284
+ selector: "pix-account",
10285
+ template: "<div id=\"main\">\n <form [formGroup]=\"pixAccountFormGroup\" autocomplete=\"off\">\n <div class=\"ui-fluid\">\n <div class=\"ui-g\">\n <!-- Tipo de chave -->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label>{{'hcm.payroll.employees_addition_pix_key_type'|translate}}</label>\n <input-rest-auto-complete-enum [dropdown]=\"true\" server=\"payroll\"\n enumeration=\"PixKeyType\"\n placeholder=\"{{'hcm.payroll.select' | translate}}\"\n name=\"pixKeyType\" [form]=\"pixAccountFormGroup\"\n (onSelect)=\"onChangePixKeyType($event)\"\n (onClear)=\"onClearPixKeyType()\"\n id=\"ta-pixKeyType\"></input-rest-auto-complete-enum>\n <s-control-errors [control]=\"pixAccountFormGroup.get('pixKeyType')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n pixKeyTypeBankAccountDuplicate: 'hcm.payroll.historical_pix_key_type_bank_account_duplicate' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Chave Pix-->\n <div class=\"ui-md-6 ui-sm-12\" [ngClass]=\"{'required': pixKeyType !== 'BANK_ACCOUNT'}\">\n <label>{{'hcm.payroll.employees_addition_pix_key' | translate}}</label>\n <ng-container [ngSwitch]=\"pixKeyType\">\n <input *ngSwitchCase=\"'TELEPHONE'\" only-number\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n (keyup)=\"phoneMask($event)\" maxlength=\"15\"\n placeholder=\"(__) ____-____\">\n <p-inputMask *ngSwitchCase=\"'CPF'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"___.___.___-__\"\n mask=\"999.999.999-99\" [unmask]=\"true\"></p-inputMask>\n <p-inputMask *ngSwitchCase=\"'CNPJ'\"\n id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"__.___.___/____-__\"\n mask=\"99.999.999/9999-99\" [unmask]=\"true\"></p-inputMask>\n <input *ngSwitchCase=\"'EMAIL'\"\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"\n placeholder=\"{{'hcm.payroll.employees_addition_email'|translate}}\"/>\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\" disabled\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"/>\n <input *ngSwitchDefault\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"/>\n </ng-container>\n <s-control-errors *ngIf=\"isShowPixKeyFieldValidatorMessage\" id=\"er-pix-key\"\n [control]=\"pixAccountFormGroup.get('pixKey')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n invalidPhoneNumber: 'hcm.payroll.employees_addition_invalid_phone_number' | translate: { value: pixAccountFormGroup.get('pixKey').value },\n invalidEmail: 'hcm.payroll.employees_addition_email_invalid' | translate,\n cpfNotValid: 'hcm.payroll.employees_addition_cpf_error' | translate,\n cnpjNotValid: 'hcm.payroll.employees_addition_cnpj_error' | translate\n }\">\n </s-control-errors>\n </div>\n <!--Percentual-->\n <div class=\"ui-md-6 ui-sm-12 required\">\n <label id=\"lb-percentage\"\n for=\"ff-percentage\">{{ 'hcm.payroll.historical_bank_account_label_percentage' | translate }}</label>\n <div class=\"ui-inputgroup\">\n <span class=\"ui-inputgroup-addon\">%</span>\n <input pInputText id=\"ff-percentage\" name=\"percentage\"\n formControlName=\"percentage\"\n currencyMask\n [options]=\"optionsPercentage\"\n [placeholder]=\"percentagePlaceholder\"/>\n </div>\n <s-control-errors [control]=\"pixAccountFormGroup.get('percentage')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n maxlength: 'hcm.payroll.error_max_length' | translate: { value: '6' },\n max: 'hcm.payroll.error_max_value_number' | translate: { value: maxValuePercentage },\n min: 'hcm.payroll.error_min_value_number' | translate: { value: '0,01' }\n }\">\n </s-control-errors>\n </div>\n <div class=\"ui-g-12\">\n <p-fieldset\n legend=\"{{ 'hcm.payroll.custom_fields' | translate }}\"\n [attr.data-hidden]=\"!customFields || !customFields.fields.length\"\n >\n <s-custom-fields\n domain=\"hcm\"\n service=\"{{customService}}\"\n entity=\"{{customEntity}}\"\n formControlName=\"customFields\"\n [invalidErrorLabel]=\"'hcm.payroll.employees_invalid_field' | translate\"\n >\n </s-custom-fields>\n </p-fieldset>\n </div>\n </div>\n </div>\n </form>\n\n <div [ngClass]=\"withSideBar ? 'footer' : 'footer-s-border'\">\n <div class=\"form-group\">\n <s-button id=\"btn-save\" label=\"{{ labelBtnAdd | translate}}\" priority=\"primary\"\n (onClick)=\"addItem()\" *ngIf=\"visibleBtnSave && !this.isView\"></s-button>\n <s-button *ngIf=\"withSideBar\" id=\"btn-close\" label=\"{{'hcm.payroll.cancel'|translate}}\" priority=\"secondary\"\n priority=\"link\" (onClick)=\"close()\"></s-button>\n </div>\n </div>\n</div>\n",
10286
+ 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}"]
10287
+ })
10288
+ ], HistoricalPixAccountFormComponent);
10289
+ return HistoricalPixAccountFormComponent;
10290
+ }());
10291
+
10292
+ var HistoricalPixAccountService = /** @class */ (function () {
10293
+ function HistoricalPixAccountService(http) {
10294
+ this.http = http;
10295
+ }
10296
+ HistoricalPixAccountService.prototype.query = function (path, body, service) {
10297
+ if (service === void 0) { service = exports.ServiceType.PAYROLL; }
10298
+ return this.http.query(path, body, service);
10299
+ };
10300
+ HistoricalPixAccountService.ctorParameters = function () { return [
10301
+ { type: HttpClientService }
10302
+ ]; };
10303
+ HistoricalPixAccountService = __decorate([
10304
+ core.Injectable()
10305
+ ], HistoricalPixAccountService);
10306
+ return HistoricalPixAccountService;
10307
+ }());
10308
+
10309
+ var HistoricalPixAccountModule = /** @class */ (function () {
10310
+ function HistoricalPixAccountModule() {
10311
+ }
10312
+ HistoricalPixAccountModule = __decorate([
10313
+ core.NgModule({
10314
+ imports: [
10315
+ common.CommonModule,
10316
+ forms.FormsModule,
10317
+ http.HttpClientModule,
10318
+ autocomplete.AutoCompleteModule,
10319
+ SharedModule,
10320
+ forms.ReactiveFormsModule,
10321
+ table.TableModule,
10322
+ angularComponents.ButtonModule,
10323
+ tooltip.TooltipModule,
10324
+ angularComponents.LoadingStateModule,
10325
+ angularComponents.SidebarModule,
10326
+ InputDateModule,
10327
+ angularComponents.ControlErrorsModule,
10328
+ InputRestAutoCompleteEnumModule,
10329
+ ng2CurrencyMask.CurrencyMaskModule,
10330
+ InputRestAutoCompleteModule,
10331
+ inputtext.InputTextModule,
10332
+ CoreDirectives,
10333
+ fieldset.FieldsetModule,
10334
+ angularComponents.CustomFieldsModule,
10335
+ panel.PanelModule,
10336
+ inputmask.InputMaskModule,
10337
+ ],
10338
+ declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
10339
+ providers: [HistoricalPixAccountService, api.ConfirmationService],
10340
+ exports: [HistoricalPixAccountComponent],
10341
+ })
10342
+ ], HistoricalPixAccountModule);
10343
+ return HistoricalPixAccountModule;
10344
+ }());
10345
+
9325
10346
  exports.AdmissionDraftSummaryComponent = AdmissionDraftSummaryComponent;
9326
10347
  exports.AdmissionDraftSummaryModule = AdmissionDraftSummaryModule;
9327
10348
  exports.AdmissionDraftSummaryService = AdmissionDraftSummaryService;
@@ -9362,6 +10383,9 @@
9362
10383
  exports.HistoricalBankAccountListService = HistoricalBankAccountListService;
9363
10384
  exports.HistoricalBankAccountModule = HistoricalBankAccountModule;
9364
10385
  exports.HistoricalBankAccountService = HistoricalBankAccountService;
10386
+ exports.HistoricalPixAccountComponent = HistoricalPixAccountComponent;
10387
+ exports.HistoricalPixAccountModule = HistoricalPixAccountModule;
10388
+ exports.HistoricalPixAccountService = HistoricalPixAccountService;
9365
10389
  exports.HttpClientService = HttpClientService;
9366
10390
  exports.ImageCropComponent = ImageCropComponent;
9367
10391
  exports.ImageCropModule = ImageCropModule;
@@ -9492,6 +10516,7 @@
9492
10516
  exports.ɵo = AutocompleteService;
9493
10517
  exports.ɵp = LookupService$1;
9494
10518
  exports.ɵq = HistoricalBankAccountFormComponent;
10519
+ exports.ɵr = HistoricalPixAccountFormComponent;
9495
10520
 
9496
10521
  Object.defineProperty(exports, '__esModule', { value: true });
9497
10522