@senior-gestao-pessoas/payroll-core 9.1.0 → 9.2.0-3e6bb128-20da-4dfb-a2a4-7802bd61be80

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 (52) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +1355 -0
  2. package/bundles/senior-gestao-pessoas-payroll-core.umd.js.map +1 -1
  3. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js +1 -1
  4. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js.map +1 -1
  5. package/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.d.ts +77 -0
  6. package/components/historical-pix-account/historical-pix-account.component.d.ts +75 -0
  7. package/components/historical-pix-account/historical-pix-account.module.d.ts +2 -0
  8. package/components/historical-pix-account/historical-pix-account.service.d.ts +8 -0
  9. package/components/historical-pix-account/index.d.ts +3 -0
  10. package/components/historical-pix-account-list/historical-pix-account-list.component.d.ts +50 -0
  11. package/components/historical-pix-account-list/historical-pix-account-list.module.d.ts +2 -0
  12. package/components/historical-pix-account-list/historical-pix-account-list.service.d.ts +9 -0
  13. package/components/historical-pix-account-list/index.d.ts +3 -0
  14. package/components/utils/format-utils/format-utils.service.d.ts +33 -0
  15. package/components/utils/generic-validators.d.ts +24 -0
  16. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +360 -0
  17. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +327 -0
  18. package/esm2015/components/historical-pix-account/historical-pix-account.module.js +58 -0
  19. package/esm2015/components/historical-pix-account/historical-pix-account.service.js +20 -0
  20. package/esm2015/components/historical-pix-account/index.js +4 -0
  21. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.component.js +237 -0
  22. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.module.js +39 -0
  23. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.service.js +35 -0
  24. package/esm2015/components/historical-pix-account-list/index.js +4 -0
  25. package/esm2015/components/utils/format-utils/format-utils.service.js +96 -0
  26. package/esm2015/components/utils/generic-validators.js +164 -0
  27. package/esm2015/public_api.js +3 -1
  28. package/esm2015/senior-gestao-pessoas-payroll-core.js +2 -1
  29. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +385 -0
  30. package/esm5/components/historical-pix-account/historical-pix-account.component.js +361 -0
  31. package/esm5/components/historical-pix-account/historical-pix-account.module.js +61 -0
  32. package/esm5/components/historical-pix-account/historical-pix-account.service.js +22 -0
  33. package/esm5/components/historical-pix-account/index.js +4 -0
  34. package/esm5/components/historical-pix-account-list/historical-pix-account-list.component.js +257 -0
  35. package/esm5/components/historical-pix-account-list/historical-pix-account-list.module.js +42 -0
  36. package/esm5/components/historical-pix-account-list/historical-pix-account-list.service.js +37 -0
  37. package/esm5/components/historical-pix-account-list/index.js +4 -0
  38. package/esm5/components/utils/format-utils/format-utils.service.js +100 -0
  39. package/esm5/components/utils/generic-validators.js +167 -0
  40. package/esm5/public_api.js +3 -1
  41. package/esm5/senior-gestao-pessoas-payroll-core.js +2 -1
  42. package/fesm2015/senior-gestao-pessoas-payroll-core.js +1255 -1
  43. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  44. package/fesm5/senior-gestao-pessoas-payroll-core.js +1349 -1
  45. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  46. package/locale/en-US.json +33 -1
  47. package/locale/es-ES.json +33 -1
  48. package/locale/pt-BR.json +33 -1
  49. package/package.json +1 -1
  50. package/public_api.d.ts +2 -0
  51. package/senior-gestao-pessoas-payroll-core.d.ts +1 -0
  52. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
@@ -9322,6 +9322,1354 @@
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.defaultCpfNumber = null;
9436
+ this.visibleChange = new core.EventEmitter();
9437
+ this.ngUnsubscribe = new rxjs.Subject();
9438
+ this.orderBy = {
9439
+ field: "dateChange",
9440
+ direction: exports.DirectionEnumeration.DESC,
9441
+ };
9442
+ this.pixAccountItemInput = {};
9443
+ this.totalRecords = 0;
9444
+ this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9445
+ this.loading = true;
9446
+ this.listData = [];
9447
+ this.listDataNoPage = [];
9448
+ this.cols = [
9449
+ {
9450
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9451
+ field: "pixKeyType",
9452
+ },
9453
+ {
9454
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9455
+ field: "pixKey",
9456
+ },
9457
+ {
9458
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9459
+ field: "percentage",
9460
+ },
9461
+ ];
9462
+ this.actions = function (rowData, key) {
9463
+ if (rowData === void 0) { rowData = {}; }
9464
+ return [
9465
+ {
9466
+ visible: _this.isEditMode,
9467
+ label: _this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9468
+ command: function () {
9469
+ rowData["index"] = key;
9470
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: false };
9471
+ _this.visible = true;
9472
+ },
9473
+ },
9474
+ {
9475
+ visible: !!(!_this.isEditMode && _this.withSideBar),
9476
+ label: _this.translateService.instant("hcm.payroll.edit"),
9477
+ command: function () {
9478
+ rowData["index"] = key;
9479
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
9480
+ _this.visible = true;
9481
+ },
9482
+ },
9483
+ {
9484
+ visible: !_this.isEditMode,
9485
+ label: _this.translateService.instant("hcm.payroll.delete"),
9486
+ command: function () {
9487
+ _this.loading = true;
9488
+ _this.deleteAnnuityItem(key);
9489
+ },
9490
+ },
9491
+ ];
9492
+ };
9493
+ this.createFormGroup();
9494
+ }
9495
+ HistoricalPixAccountComponent.prototype.ngOnInit = function () {
9496
+ this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9497
+ };
9498
+ HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9499
+ this.historicalPixAccountList = this.formBuilder.group({
9500
+ historicalPixAccountList: this.formBuilder.control(null),
9501
+ });
9502
+ };
9503
+ HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
9504
+ this.ngUnsubscribe.next();
9505
+ this.ngUnsubscribe.complete();
9506
+ };
9507
+ HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9508
+ this.cd.detectChanges();
9509
+ };
9510
+ HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
9511
+ var _this = this;
9512
+ var first = event && event.first ? event.first : 0;
9513
+ var rows = event && event.rows ? event.rows : this.recordByRow;
9514
+ var arrList = this.getHistoricalPixAccountList();
9515
+ this.listData = [];
9516
+ this.totalRecords = null;
9517
+ if (event && event.multiSortMeta && event.multiSortMeta.length) {
9518
+ event.multiSortMeta.map(function (value) {
9519
+ _this.orderBy.field = value.field;
9520
+ _this.orderBy.direction = value.order === 1 ? exports.DirectionEnumeration.ASC : exports.DirectionEnumeration.DESC;
9521
+ });
9522
+ }
9523
+ if (arrList && arrList.length) {
9524
+ this.totalRecords = arrList.length;
9525
+ this.listData = arrList;
9526
+ this.listDataNoPage = __spread(arrList);
9527
+ this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9528
+ this.listData = this.listData.slice(first, (first + rows));
9529
+ }
9530
+ else {
9531
+ this.listDataNoPage = [];
9532
+ }
9533
+ if (this.isEditMode || arrList && arrList.length === 1) {
9534
+ this.refreshCssInIE11();
9535
+ }
9536
+ this.loading = false;
9537
+ };
9538
+ /**
9539
+ * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
9540
+ */
9541
+ HistoricalPixAccountComponent.prototype.refreshCssInIE11 = function () {
9542
+ if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
9543
+ setTimeout(function () {
9544
+ var row = document.getElementsByClassName("row0");
9545
+ if (row && row[0])
9546
+ row[0].className = 'refresh';
9547
+ }, 1);
9548
+ }
9549
+ };
9550
+ HistoricalPixAccountComponent.prototype.add = function () {
9551
+ this.pixAccountItemInput = {};
9552
+ this.visible = true;
9553
+ };
9554
+ HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
9555
+ var newlist = __spread(this.getHistoricalPixAccountList());
9556
+ newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9557
+ delete newlist[index];
9558
+ newlist = newlist.filter(function (val) { return val; });
9559
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
9560
+ this.verifyTotalPercentage();
9561
+ this.onLazyLoad();
9562
+ };
9563
+ HistoricalPixAccountComponent.prototype.getHistoricalPixAccountList = function () {
9564
+ if (this.historicalPixAccountList.get("historicalPixAccountList") &&
9565
+ this.historicalPixAccountList.get("historicalPixAccountList").value &&
9566
+ this.historicalPixAccountList.get("historicalPixAccountList").value.length)
9567
+ return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
9568
+ else
9569
+ return [];
9570
+ };
9571
+ HistoricalPixAccountComponent.prototype.addItemInList = function ($event) {
9572
+ var index = $event && $event.index >= 0 ? $event.index : null;
9573
+ var newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9574
+ if (index != null) {
9575
+ newDataList[index] = $event;
9576
+ delete $event.index;
9577
+ }
9578
+ else {
9579
+ if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
9580
+ var customValue = mountCustomToSave($event["customFields"]);
9581
+ $event["customFields"] = __spread(customValue);
9582
+ }
9583
+ $event["dateChange"] = this.dateChange;
9584
+ newDataList.push($event);
9585
+ }
9586
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9587
+ this.verifyTotalPercentage();
9588
+ this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
9589
+ };
9590
+ HistoricalPixAccountComponent.prototype.getNumberPageByIndex = function (index, list) {
9591
+ if (index) {
9592
+ var total = list.length;
9593
+ var sub = this.recordByRow - 1;
9594
+ return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
9595
+ }
9596
+ return null;
9597
+ };
9598
+ HistoricalPixAccountComponent.prototype.verifyTotalPercentage = function () {
9599
+ var list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9600
+ var arrayPercentage = [];
9601
+ if (!list.length)
9602
+ return this.msgTotalLimitByPercentage = null;
9603
+ list.filter(function (item) { return arrayPercentage.push(item && item["percentage"]); });
9604
+ var sumPercentage = arrayPercentage.reduce(function (total, percentage) {
9605
+ return total + percentage;
9606
+ }, 0);
9607
+ if (sumPercentage === 100) {
9608
+ this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
9609
+ }
9610
+ else {
9611
+ this.msgTotalLimitByPercentage = null;
9612
+ }
9613
+ };
9614
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
9615
+ get: function () {
9616
+ return this.actions.bind(this);
9617
+ },
9618
+ enumerable: true,
9619
+ configurable: true
9620
+ });
9621
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
9622
+ get: function () {
9623
+ return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
9624
+ },
9625
+ enumerable: true,
9626
+ configurable: true
9627
+ });
9628
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "getTooltipAndDisableButtonAdd", {
9629
+ get: function () {
9630
+ return this.dateChange ? null : this.msgTooltipAdd;
9631
+ },
9632
+ enumerable: true,
9633
+ configurable: true
9634
+ });
9635
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "dateChange", {
9636
+ get: function () {
9637
+ return this._dateChange;
9638
+ },
9639
+ set: function (value) {
9640
+ var _this = this;
9641
+ this._dateChange = value;
9642
+ if (this._dateChange) {
9643
+ this.listData.filter(function (row) { return row["dateChange"] = _this._dateChange; });
9644
+ }
9645
+ },
9646
+ enumerable: true,
9647
+ configurable: true
9648
+ });
9649
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
9650
+ get: function () {
9651
+ return this._displayDateChange;
9652
+ },
9653
+ set: function (value) {
9654
+ var _this = this;
9655
+ this._displayDateChange = value;
9656
+ if (this._displayDateChange) {
9657
+ this.listData.filter(function (row) { return row["displayDateChange"] = _this._displayDateChange; });
9658
+ }
9659
+ },
9660
+ enumerable: true,
9661
+ configurable: true
9662
+ });
9663
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "addListData", {
9664
+ set: function (list) {
9665
+ this.loading = true;
9666
+ this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
9667
+ this.verifyTotalPercentage();
9668
+ this.onLazyLoad();
9669
+ },
9670
+ enumerable: true,
9671
+ configurable: true
9672
+ });
9673
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
9674
+ get: function () {
9675
+ return this._visible;
9676
+ },
9677
+ set: function (value) {
9678
+ this._visible = value;
9679
+ this.visibleChange.emit(this.visible);
9680
+ },
9681
+ enumerable: true,
9682
+ configurable: true
9683
+ });
9684
+ HistoricalPixAccountComponent.prototype.close = function () {
9685
+ this.visible = false;
9686
+ };
9687
+ HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
9688
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9689
+ };
9690
+ HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
9691
+ return FormatUtilsService.getFormattedCpf(cpf);
9692
+ };
9693
+ HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
9694
+ return FormatUtilsService.getFormattedCnpj(cnpj);
9695
+ };
9696
+ HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
9697
+ return FormatUtilsService.getFormattedPercentage(value);
9698
+ };
9699
+ HistoricalPixAccountComponent.ctorParameters = function () { return [
9700
+ { type: core$1.TranslateService },
9701
+ { type: core.ChangeDetectorRef },
9702
+ { type: forms.FormBuilder }
9703
+ ]; };
9704
+ __decorate([
9705
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
9706
+ ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
9707
+ __decorate([
9708
+ core.Input()
9709
+ ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
9710
+ __decorate([
9711
+ core.Input()
9712
+ ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
9713
+ __decorate([
9714
+ core.Input()
9715
+ ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
9716
+ __decorate([
9717
+ core.Input()
9718
+ ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
9719
+ __decorate([
9720
+ core.Input()
9721
+ ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
9722
+ __decorate([
9723
+ core.Input()
9724
+ ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
9725
+ __decorate([
9726
+ core.Input()
9727
+ ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
9728
+ __decorate([
9729
+ core.Input()
9730
+ ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
9731
+ __decorate([
9732
+ core.Input()
9733
+ ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
9734
+ __decorate([
9735
+ core.Input()
9736
+ ], HistoricalPixAccountComponent.prototype, "currency", void 0);
9737
+ __decorate([
9738
+ core.Input()
9739
+ ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9740
+ __decorate([
9741
+ core.Input()
9742
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
9743
+ __decorate([
9744
+ core.Input()
9745
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
9746
+ __decorate([
9747
+ core.Input()
9748
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
9749
+ __decorate([
9750
+ core.Input()
9751
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
9752
+ __decorate([
9753
+ core.Input()
9754
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
9755
+ __decorate([
9756
+ core.Input()
9757
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
9758
+ __decorate([
9759
+ core.Input()
9760
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
9761
+ __decorate([
9762
+ core.Input()
9763
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
9764
+ HistoricalPixAccountComponent = __decorate([
9765
+ core.Component({
9766
+ // tslint:disable-next-line:component-selector
9767
+ selector: "c-historical-pix-account",
9768
+ template: "<s-sidebar *ngIf=\"withSideBar\" [visible]=\"visible\" (visibleChange)=\"close()\"\n header=\"{{'hcm.payroll.historical_pix_account_title_form'|translate}}\">\n<pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</s-sidebar>\n\n<div *ngIf=\"!withSideBar\">\n <pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [withSideBar]=\"false\"\n [isViewMode]=\"isViewMode\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</div>\n\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"actions(rowData, key).length > 1\" [label]=\"actionLabel\"\n priority=\"default\" [model]=\"scopedActions(rowData, key)\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n\n <s-button id=\"table-admission-btn-action-{{key}}\"\n *ngIf=\"actions(rowData, key).length <= 1\"\n [label]=\"scopedActions(rowData, key)[0].label\"\n priority=\"default\"\n (click)=\"scopedActions(rowData, key)[0].command()\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length +2\">\n {{'hcm.payroll.admission_empty_message'|translate}}\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span *ngIf=\"totalRecords\">{{recordsMessage}}</span>\n </ng-template>\n </p-table>\n</div>\n",
9769
+ 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}"]
9770
+ })
9771
+ ], HistoricalPixAccountComponent);
9772
+ return HistoricalPixAccountComponent;
9773
+ }());
9774
+
9775
+ var GenericValidator = /** @class */ (function () {
9776
+ function GenericValidator() {
9777
+ }
9778
+ /**
9779
+ * Valida o CEI (Cadastro específico de INSS) digitado.
9780
+ */
9781
+ GenericValidator.isValidCei = function (control) {
9782
+ var cei = control.value;
9783
+ if (!cei)
9784
+ return null;
9785
+ else if (cei.length != 11)
9786
+ return null;
9787
+ var multiplicadorBase = "3298765432";
9788
+ var total = 0;
9789
+ var resto = 0;
9790
+ var multiplicando = 0;
9791
+ var multiplicador = 0;
9792
+ if (cei.length !== 11 ||
9793
+ cei === "00000000000" ||
9794
+ cei === "11111111111" ||
9795
+ cei === "22222222222" ||
9796
+ cei === "33333333333" ||
9797
+ cei === "44444444444" ||
9798
+ cei === "55555555555" ||
9799
+ cei === "66666666666" ||
9800
+ cei === "77777777777" ||
9801
+ cei === "88888888888" ||
9802
+ cei === "99999999999")
9803
+ return { invalidCei: true };
9804
+ else {
9805
+ for (var i = 0; i < 10; i++) {
9806
+ multiplicando = parseInt(cei.substring(i, i + 1), 10);
9807
+ multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
9808
+ total += multiplicando * multiplicador;
9809
+ }
9810
+ resto = 11 - (total % 11);
9811
+ resto = resto === 10 || resto === 11 ? 0 : resto;
9812
+ var digito = parseInt("" + cei.charAt(10), 10);
9813
+ return resto === digito ? null : { invalidCei: true };
9814
+ }
9815
+ };
9816
+ /**
9817
+ * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9818
+ */
9819
+ GenericValidator.isValidCpf = function (control) {
9820
+ var cpf = control.value;
9821
+ if (cpf) {
9822
+ var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9823
+ equalDigits = 1;
9824
+ if (cpf.length < 11) {
9825
+ return null;
9826
+ }
9827
+ for (i = 0; i < cpf.length - 1; i++) {
9828
+ if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9829
+ equalDigits = 0;
9830
+ break;
9831
+ }
9832
+ }
9833
+ if (!equalDigits) {
9834
+ numbers = cpf.substring(0, 9);
9835
+ digits = cpf.substring(9);
9836
+ sum = 0;
9837
+ for (i = 10; i > 1; i--) {
9838
+ sum += numbers.charAt(10 - i) * i;
9839
+ }
9840
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9841
+ if (result !== Number(digits.charAt(0))) {
9842
+ return { cpfNotValid: true };
9843
+ }
9844
+ numbers = cpf.substring(0, 10);
9845
+ sum = 0;
9846
+ for (i = 11; i > 1; i--) {
9847
+ sum += numbers.charAt(11 - i) * i;
9848
+ }
9849
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9850
+ if (result !== Number(digits.charAt(1))) {
9851
+ return { cpfNotValid: true };
9852
+ }
9853
+ return null;
9854
+ }
9855
+ else {
9856
+ return { cpfNotValid: true };
9857
+ }
9858
+ }
9859
+ return null;
9860
+ };
9861
+ /**
9862
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9863
+ */
9864
+ GenericValidator.isValidCnpj = function (control) {
9865
+ var cnpj = control.value;
9866
+ if (cnpj) {
9867
+ var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9868
+ cnpj = cnpj.replace(/[^\d]+/g, '');
9869
+ if (cnpj.length !== 14) {
9870
+ return null;
9871
+ }
9872
+ // Elimina CNPJs invalidos conhecidos
9873
+ if (cnpj === '00000000000000' ||
9874
+ cnpj === '11111111111111' ||
9875
+ cnpj === '22222222222222' ||
9876
+ cnpj === '33333333333333' ||
9877
+ cnpj === '44444444444444' ||
9878
+ cnpj === '55555555555555' ||
9879
+ cnpj === '66666666666666' ||
9880
+ cnpj === '77777777777777' ||
9881
+ cnpj === '88888888888888' ||
9882
+ cnpj === '99999999999999') {
9883
+ return { cnpjNotValid: true };
9884
+ }
9885
+ // Valida DVs
9886
+ size = cnpj.length - 2;
9887
+ numbers = cnpj.substring(0, size);
9888
+ digits = cnpj.substring(size);
9889
+ sum = 0;
9890
+ pos = size - 7;
9891
+ for (var i = size; i >= 1; i--) {
9892
+ sum += numbers.charAt(size - i) * pos--;
9893
+ if (pos < 2) {
9894
+ pos = 9;
9895
+ }
9896
+ }
9897
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9898
+ if (result !== Number(digits.charAt(0))) {
9899
+ return { cnpjNotValid: true };
9900
+ }
9901
+ size = size + 1;
9902
+ numbers = cnpj.substring(0, size);
9903
+ sum = 0;
9904
+ pos = size - 7;
9905
+ for (var i = size; i >= 1; i--) {
9906
+ sum += numbers.charAt(size - i) * pos--;
9907
+ if (pos < 2) {
9908
+ pos = 9;
9909
+ }
9910
+ }
9911
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9912
+ if (result !== Number(digits.charAt(1))) {
9913
+ return { cnpjNotValid: true };
9914
+ }
9915
+ return null;
9916
+ }
9917
+ return null;
9918
+ };
9919
+ /**
9920
+ * Válida o número de telefone da chave PIX.
9921
+ */
9922
+ GenericValidator.isValidPhoneNumber = function (control) {
9923
+ var cellPhoneKey = control.value || '';
9924
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9925
+ var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9926
+ var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9927
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9928
+ };
9929
+ /**
9930
+ * Valida o email da chave PIX.
9931
+ */
9932
+ GenericValidator.isValidEmail = function (control) {
9933
+ var emailKey = control.value;
9934
+ var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9935
+ var isValidEmail = regexValidEmail.test(emailKey);
9936
+ return isValidEmail ? null : { invalidEmail: true };
9937
+ };
9938
+ return GenericValidator;
9939
+ }());
9940
+
9941
+ var HistoricalPixAccountFormComponent = /** @class */ (function () {
9942
+ function HistoricalPixAccountFormComponent(formBuilder, cd) {
9943
+ this.formBuilder = formBuilder;
9944
+ this.cd = cd;
9945
+ this.withSideBar = true;
9946
+ this.isEditMode = false;
9947
+ this.paramsForm = new forms.FormGroup({});
9948
+ this.defaultCpfNumber = null;
9949
+ this.visibleChange = new core.EventEmitter();
9950
+ this.pixAccountItemToList = new core.EventEmitter();
9951
+ this.ngUnsubscribe = new rxjs.Subject();
9952
+ this.initialValidatorOfPercentage = [forms.Validators.required, forms.Validators.min(0.01)];
9953
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9954
+ this.maxValuePercentage = 100.00;
9955
+ this.visibleBtnSave = true;
9956
+ this.isView = false;
9957
+ this.isShowPixKeyFieldValidatorMessage = false;
9958
+ this.createFormGroup();
9959
+ this.registerSubjects();
9960
+ }
9961
+ HistoricalPixAccountFormComponent.prototype.ngOnInit = function () {
9962
+ };
9963
+ HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
9964
+ this.cd.detectChanges();
9965
+ };
9966
+ HistoricalPixAccountFormComponent.prototype.ngOnDestroy = function () {
9967
+ this.ngUnsubscribe.next(true);
9968
+ this.ngUnsubscribe.unsubscribe();
9969
+ };
9970
+ HistoricalPixAccountFormComponent.prototype.registerSubjects = function () {
9971
+ };
9972
+ HistoricalPixAccountFormComponent.prototype.createFormGroup = function () {
9973
+ this.pixAccountFormGroup = this.formBuilder.group({
9974
+ id: this.formBuilder.control(null),
9975
+ index: this.formBuilder.control(null),
9976
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9977
+ dateChange: this.formBuilder.control(null),
9978
+ pixKeyType: this.formBuilder.control(null, forms.Validators.required),
9979
+ pixKey: this.formBuilder.control(null),
9980
+ percentage: this.formBuilder.control(null, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9981
+ forms.Validators.max(this.maxValuePercentage),
9982
+ ]))),
9983
+ customFields: this.formBuilder.control(null),
9984
+ });
9985
+ };
9986
+ HistoricalPixAccountFormComponent.prototype.onChangePixKeyType = function (item) {
9987
+ if (item.key) {
9988
+ this.pixKeyType = item.key;
9989
+ this.isShowPixKeyFieldValidatorMessage = true;
9990
+ this.pixAccountFormGroup.get("pixKey").reset();
9991
+ this.setPixKeyValidators(true);
9992
+ if (item.key === "CPF") {
9993
+ this.setDefaultCpfPixKey();
9994
+ }
9995
+ }
9996
+ };
9997
+ HistoricalPixAccountFormComponent.prototype.onClearPixKeyType = function () {
9998
+ this.isShowPixKeyFieldValidatorMessage = false;
9999
+ this.pixAccountFormGroup.get("pixKey").reset();
10000
+ };
10001
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
10002
+ get: function () {
10003
+ return this._visible;
10004
+ },
10005
+ set: function (value) {
10006
+ this._visible = value;
10007
+ this.visibleChange.emit(this.visible);
10008
+ },
10009
+ enumerable: true,
10010
+ configurable: true
10011
+ });
10012
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", {
10013
+ set: function (value) {
10014
+ this.resetForm();
10015
+ this.visibleBtnSave = true;
10016
+ if (value && value.currentItem && Object.keys(value.currentItem).length) {
10017
+ this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(__assign({}, value.currentItem)));
10018
+ this.labelBtnAdd = "hcm.payroll.employees_update";
10019
+ this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
10020
+ if (!this.isView) {
10021
+ this.configEnableFields(value && value["isEditMode"]);
10022
+ }
10023
+ else {
10024
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
10025
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
10026
+ this.formatPixKeyTelephoneNumber();
10027
+ }
10028
+ }
10029
+ }
10030
+ else {
10031
+ this.labelBtnAdd = "hcm.payroll.employees_add";
10032
+ }
10033
+ },
10034
+ enumerable: true,
10035
+ configurable: true
10036
+ });
10037
+ HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
10038
+ if (this.pixKeyType === "TELEPHONE") {
10039
+ this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
10040
+ }
10041
+ };
10042
+ HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
10043
+ var obj = __assign({}, data);
10044
+ obj["customFields"] = mountCustomToShow(obj["customFields"]);
10045
+ return obj;
10046
+ };
10047
+ HistoricalPixAccountFormComponent.prototype.configEnableFields = function (isEditMode) {
10048
+ this.visibleBtnSave = isEditMode;
10049
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
10050
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
10051
+ this.setPixKeyValidators(isEditMode);
10052
+ this.formatPixKeyTelephoneNumber();
10053
+ }
10054
+ configEnabledFields(this.pixAccountFormGroup, isEditMode, [
10055
+ "pixKeyType",
10056
+ "pixKey",
10057
+ "percentage",
10058
+ "customFields",
10059
+ ], []);
10060
+ };
10061
+ HistoricalPixAccountFormComponent.prototype.close = function () {
10062
+ this.resetForm();
10063
+ this.visible = false;
10064
+ };
10065
+ HistoricalPixAccountFormComponent.prototype.addItem = function () {
10066
+ this.pixAccountFormGroup.updateValueAndValidity();
10067
+ verifyValidationsForm.call(this.pixAccountFormGroup);
10068
+ if (this.pixAccountFormGroup.valid) {
10069
+ if (this.employeeId) {
10070
+ this.pixAccountFormGroup.get("employee").setValue({
10071
+ tableId: this.employeeId,
10072
+ name: "",
10073
+ });
10074
+ }
10075
+ this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
10076
+ this.visible = false;
10077
+ this.resetForm();
10078
+ }
10079
+ };
10080
+ HistoricalPixAccountFormComponent.prototype.resetForm = function () {
10081
+ this.pixAccountFormGroup.reset();
10082
+ this.labelBtnAdd = "hcm.payroll.employees_add";
10083
+ if (this.customFields && this.customFields.formGroup)
10084
+ this.customFields.formGroup.reset();
10085
+ };
10086
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "percentagePlaceholder", {
10087
+ get: function () {
10088
+ return "0" + (this.currency && this.currency.decimalSeparator) + "00";
10089
+ },
10090
+ enumerable: true,
10091
+ configurable: true
10092
+ });
10093
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "optionsPercentage", {
10094
+ get: function () {
10095
+ return __assign({}, this.getOptions(), { precision: 2 });
10096
+ },
10097
+ enumerable: true,
10098
+ configurable: true
10099
+ });
10100
+ HistoricalPixAccountFormComponent.prototype.getOptions = function () {
10101
+ return {
10102
+ prefix: "",
10103
+ thousands: this.currency.thousandsSeparator,
10104
+ decimal: this.currency.decimalSeparator,
10105
+ };
10106
+ };
10107
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "getListPixAccount", {
10108
+ /**
10109
+ * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
10110
+ * @param pixAccountList
10111
+ */
10112
+ set: function (pixAccountList) {
10113
+ if (pixAccountList) {
10114
+ this.setValidatorsAccordingList(pixAccountList, null, false);
10115
+ }
10116
+ else {
10117
+ this.resetForm();
10118
+ }
10119
+ },
10120
+ enumerable: true,
10121
+ configurable: true
10122
+ });
10123
+ /**
10124
+ * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
10125
+ * a validação dos campos "percentage" e "pixAccount".
10126
+ * 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
10127
+ * no array de comparação dos validators.
10128
+ * @param pixAccountList
10129
+ * @param index
10130
+ */
10131
+ HistoricalPixAccountFormComponent.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode) {
10132
+ if (index === void 0) { index = null; }
10133
+ if (isEditMode === void 0) { isEditMode = true; }
10134
+ this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
10135
+ var percentageIncluded = [];
10136
+ if (this.pixAccountList && this.pixAccountList.length) {
10137
+ this.pixAccountList.filter(function (field, key) {
10138
+ if (field["percentage"] && key != index) {
10139
+ percentageIncluded.push(field["percentage"]);
10140
+ }
10141
+ });
10142
+ }
10143
+ this.beforeSetPixKeyTypeValidator();
10144
+ this.setPixKeyValidators(isEditMode);
10145
+ this.validatePercentageValid(percentageIncluded);
10146
+ };
10147
+ /**
10148
+ * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
10149
+ */
10150
+ HistoricalPixAccountFormComponent.prototype.setPixKeyValidators = function (isEditMode) {
10151
+ var genericPixKey = this.pixAccountFormGroup.get("pixKey");
10152
+ if (this.pixKeyType) {
10153
+ switch (this.pixKeyType) {
10154
+ case "TELEPHONE":
10155
+ genericPixKey.setValidators(forms.Validators.compose([
10156
+ forms.Validators.required, GenericValidator.isValidPhoneNumber,
10157
+ ]));
10158
+ break;
10159
+ case "EMAIL":
10160
+ genericPixKey.setValidators(forms.Validators.compose([
10161
+ forms.Validators.required, GenericValidator.isValidEmail,
10162
+ ]));
10163
+ break;
10164
+ case "CPF":
10165
+ genericPixKey.setValidators(forms.Validators.compose([
10166
+ forms.Validators.required, GenericValidator.isValidCpf,
10167
+ ]));
10168
+ break;
10169
+ case "CNPJ":
10170
+ genericPixKey.setValidators(forms.Validators.compose([
10171
+ forms.Validators.required, GenericValidator.isValidCnpj,
10172
+ ]));
10173
+ break;
10174
+ case "RANDOM_KEY":
10175
+ genericPixKey.setValidators(forms.Validators.required);
10176
+ break;
10177
+ default:
10178
+ genericPixKey.setValidators(null);
10179
+ break;
10180
+ }
10181
+ if (isEditMode) {
10182
+ genericPixKey.enable();
10183
+ }
10184
+ genericPixKey.updateValueAndValidity();
10185
+ }
10186
+ };
10187
+ /**
10188
+ * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
10189
+ * 100% na validação do campo "percentage" como um novo maxValue;
10190
+ * @param listValue
10191
+ */
10192
+ HistoricalPixAccountFormComponent.prototype.validatePercentageValid = function (listValue) {
10193
+ var percentage = this.pixAccountFormGroup.get("percentage");
10194
+ this.maxValuePercentage = listValue
10195
+ .reduce(function (currentValue, total) { return currentValue - total; }, 100.00);
10196
+ percentage
10197
+ .setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10198
+ forms.Validators.max(this.maxValuePercentage),
10199
+ ])));
10200
+ percentage.updateValueAndValidity();
10201
+ };
10202
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10203
+ set: function (condition) {
10204
+ this.isView = !!(condition && !this.withSideBar);
10205
+ this.configEnableFields(!this.isView);
10206
+ if (!this.isView)
10207
+ this.resetForm();
10208
+ },
10209
+ enumerable: true,
10210
+ configurable: true
10211
+ });
10212
+ HistoricalPixAccountFormComponent.prototype.phoneMask = function (event) {
10213
+ FormatUtilsService.formatTelephoneInputEvent(event);
10214
+ };
10215
+ HistoricalPixAccountFormComponent.prototype.setDefaultCpfPixKey = function () {
10216
+ if (this.defaultCpfNumber) {
10217
+ this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
10218
+ }
10219
+ else {
10220
+ var sheetDocument = this.paramsForm.get("sheetDocument");
10221
+ if (sheetDocument) {
10222
+ var cpf = sheetDocument.get("cpfNumber").value;
10223
+ if (cpf) {
10224
+ this.pixAccountFormGroup.get("pixKey").setValue(cpf);
10225
+ }
10226
+ }
10227
+ }
10228
+ };
10229
+ HistoricalPixAccountFormComponent.prototype.beforeSetPixKeyTypeValidator = function () {
10230
+ var pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
10231
+ if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
10232
+ pixKeyType
10233
+ .setValidators(forms.Validators.compose([
10234
+ forms.Validators.required,
10235
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
10236
+ ]));
10237
+ }
10238
+ else {
10239
+ pixKeyType.setValidators(forms.Validators.required);
10240
+ }
10241
+ };
10242
+ HistoricalPixAccountFormComponent.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
10243
+ return function (control) {
10244
+ var value = control && control.value;
10245
+ var condition = false;
10246
+ listCompare.filter(function (field) {
10247
+ if (value) {
10248
+ if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
10249
+ return condition = true;
10250
+ }
10251
+ }
10252
+ });
10253
+ if (condition) {
10254
+ return { pixKeyTypeBankAccountDuplicate: true };
10255
+ }
10256
+ else {
10257
+ return null;
10258
+ }
10259
+ };
10260
+ };
10261
+ HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10262
+ { type: forms.FormBuilder },
10263
+ { type: core.ChangeDetectorRef }
10264
+ ]; };
10265
+ __decorate([
10266
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: true })
10267
+ ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
10268
+ __decorate([
10269
+ core.Input()
10270
+ ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
10271
+ __decorate([
10272
+ core.Input()
10273
+ ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
10274
+ __decorate([
10275
+ core.Input()
10276
+ ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
10277
+ __decorate([
10278
+ core.Input()
10279
+ ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
10280
+ __decorate([
10281
+ core.Input()
10282
+ ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
10283
+ __decorate([
10284
+ core.Input()
10285
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
10286
+ __decorate([
10287
+ core.Input()
10288
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
10289
+ __decorate([
10290
+ core.Output()
10291
+ ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
10292
+ __decorate([
10293
+ core.Output()
10294
+ ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
10295
+ __decorate([
10296
+ core.Input()
10297
+ ], HistoricalPixAccountFormComponent.prototype, "visible", null);
10298
+ __decorate([
10299
+ core.Input()
10300
+ ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
10301
+ __decorate([
10302
+ core.Input()
10303
+ ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
10304
+ __decorate([
10305
+ core.Input()
10306
+ ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
10307
+ HistoricalPixAccountFormComponent = __decorate([
10308
+ core.Component({
10309
+ selector: "pix-account",
10310
+ 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",
10311
+ 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}"]
10312
+ })
10313
+ ], HistoricalPixAccountFormComponent);
10314
+ return HistoricalPixAccountFormComponent;
10315
+ }());
10316
+
10317
+ var HistoricalPixAccountService = /** @class */ (function () {
10318
+ function HistoricalPixAccountService(http) {
10319
+ this.http = http;
10320
+ }
10321
+ HistoricalPixAccountService.prototype.query = function (path, body, service) {
10322
+ if (service === void 0) { service = exports.ServiceType.PAYROLL; }
10323
+ return this.http.query(path, body, service);
10324
+ };
10325
+ HistoricalPixAccountService.ctorParameters = function () { return [
10326
+ { type: HttpClientService }
10327
+ ]; };
10328
+ HistoricalPixAccountService = __decorate([
10329
+ core.Injectable()
10330
+ ], HistoricalPixAccountService);
10331
+ return HistoricalPixAccountService;
10332
+ }());
10333
+
10334
+ var HistoricalPixAccountModule = /** @class */ (function () {
10335
+ function HistoricalPixAccountModule() {
10336
+ }
10337
+ HistoricalPixAccountModule = __decorate([
10338
+ core.NgModule({
10339
+ imports: [
10340
+ common.CommonModule,
10341
+ forms.FormsModule,
10342
+ http.HttpClientModule,
10343
+ autocomplete.AutoCompleteModule,
10344
+ SharedModule,
10345
+ forms.ReactiveFormsModule,
10346
+ table.TableModule,
10347
+ angularComponents.ButtonModule,
10348
+ tooltip.TooltipModule,
10349
+ angularComponents.LoadingStateModule,
10350
+ angularComponents.SidebarModule,
10351
+ InputDateModule,
10352
+ angularComponents.ControlErrorsModule,
10353
+ InputRestAutoCompleteEnumModule,
10354
+ ng2CurrencyMask.CurrencyMaskModule,
10355
+ InputRestAutoCompleteModule,
10356
+ inputtext.InputTextModule,
10357
+ CoreDirectives,
10358
+ fieldset.FieldsetModule,
10359
+ angularComponents.CustomFieldsModule,
10360
+ panel.PanelModule,
10361
+ inputmask.InputMaskModule,
10362
+ ],
10363
+ declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
10364
+ providers: [HistoricalPixAccountService, api.ConfirmationService],
10365
+ exports: [HistoricalPixAccountComponent],
10366
+ })
10367
+ ], HistoricalPixAccountModule);
10368
+ return HistoricalPixAccountModule;
10369
+ }());
10370
+
10371
+ var HistoricalPixAccountListService = /** @class */ (function () {
10372
+ function HistoricalPixAccountListService(http, httpClient) {
10373
+ this.http = http;
10374
+ this.httpClient = httpClient;
10375
+ }
10376
+ HistoricalPixAccountListService.prototype.remove = function (id, dateWhen, service, dependentId) {
10377
+ if (service === void 0) { service = exports.ServiceType.PAYROLL; }
10378
+ if (service === exports.ServiceType.DEPENDENT) {
10379
+ return this.httpClient
10380
+ .post("hcm/dependent/queries/historicalDependentJudicialPensionPixDelete", {
10381
+ dependentId: dependentId,
10382
+ dateWhen: dateWhen,
10383
+ });
10384
+ }
10385
+ else {
10386
+ return this.http.post("actions/historicalEmployeePixDelete", {
10387
+ employeeId: id,
10388
+ dateWhen: dateWhen
10389
+ });
10390
+ }
10391
+ };
10392
+ HistoricalPixAccountListService.ctorParameters = function () { return [
10393
+ { type: HttpClientService },
10394
+ { type: http.HttpClient }
10395
+ ]; };
10396
+ HistoricalPixAccountListService = __decorate([
10397
+ core.Injectable()
10398
+ ], HistoricalPixAccountListService);
10399
+ return HistoricalPixAccountListService;
10400
+ }());
10401
+
10402
+ var moment$e = moment_;
10403
+ var HistoricalPixAccountListComponent = /** @class */ (function () {
10404
+ function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService) {
10405
+ this.confirmationService = confirmationService;
10406
+ this.translateService = translateService;
10407
+ this.activatedRoute = activatedRoute;
10408
+ this.cd = cd;
10409
+ this.router = router;
10410
+ this.messageService = messageService;
10411
+ this.historicalPixAccountListService = historicalPixAccountListService;
10412
+ this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
10413
+ this.keyPayload = "historicalEmployeePix";
10414
+ this.withSidebar = true;
10415
+ this.enableView = new core.EventEmitter();
10416
+ this.ngUnsubscribe = new rxjs.Subject();
10417
+ this.loading = true;
10418
+ this.columns = [
10419
+ {
10420
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_date_change"),
10421
+ field: "dateChange",
10422
+ },
10423
+ {
10424
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_pix_key_type"),
10425
+ field: "pixKeyType.value",
10426
+ },
10427
+ {
10428
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_pix_key"),
10429
+ field: "pixKey",
10430
+ },
10431
+ {
10432
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
10433
+ field: "percentage",
10434
+ },
10435
+ {
10436
+ label: this.translateService.instant("hcm.payroll.employees_movimentation_historical_pix_account_label_qtd_account"),
10437
+ field: "numberOfPixAccount",
10438
+ },
10439
+ ];
10440
+ }
10441
+ HistoricalPixAccountListComponent.prototype.ngOnInit = function () {
10442
+ this.initParameters = { employeeId: this.employeeId, dependentId: this.dependentId };
10443
+ };
10444
+ HistoricalPixAccountListComponent.prototype.ngOnDestroy = function () {
10445
+ this.ngUnsubscribe.next();
10446
+ this.ngUnsubscribe.complete();
10447
+ };
10448
+ HistoricalPixAccountListComponent.prototype.ngAfterViewInit = function () {
10449
+ this.cd.detectChanges();
10450
+ };
10451
+ HistoricalPixAccountListComponent.prototype.onLazyLoad = function (payload) {
10452
+ var _this = this;
10453
+ payload.forEach(function (value) {
10454
+ value.dateChange = moment$e(value.dateChange).format(_this.dateFormat);
10455
+ value.pixKey = _this.formatPixKeyByType(value.pixKeyType, value.pixKey);
10456
+ value.percentage = FormatUtilsService.getFormattedPercentage(value.percentage);
10457
+ });
10458
+ this.onGridLoad(payload);
10459
+ this.loading = false;
10460
+ };
10461
+ HistoricalPixAccountListComponent.prototype.formatPixKeyByType = function (pixKeyType, pixKey) {
10462
+ var keyType = pixKeyType ? pixKeyType.key.toUpperCase() : "";
10463
+ if (keyType === "TELEPHONE") {
10464
+ return FormatUtilsService.getFormattedTelephoneNumber(pixKey);
10465
+ }
10466
+ else if (keyType === "CPF") {
10467
+ return FormatUtilsService.getFormattedCpf(pixKey);
10468
+ }
10469
+ else if (keyType === "CNPJ") {
10470
+ return FormatUtilsService.getFormattedCnpj(pixKey);
10471
+ }
10472
+ else {
10473
+ return pixKey;
10474
+ }
10475
+ };
10476
+ HistoricalPixAccountListComponent.prototype.getMenuActions = function (rowData) {
10477
+ var _this = this;
10478
+ return [
10479
+ {
10480
+ label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
10481
+ command: function () {
10482
+ var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
10483
+ if (_this.withSidebar)
10484
+ _this.router.navigate(["historical-pix-account/" + dateChange], {
10485
+ relativeTo: _this.activatedRoute,
10486
+ });
10487
+ else
10488
+ _this.enableView.emit(dateChange);
10489
+ },
10490
+ },
10491
+ {
10492
+ label: this.translateService.instant("hcm.payroll.delete"),
10493
+ command: function () {
10494
+ if (_this.isAllowToDeleteHistorical && rowData) {
10495
+ _this.delete(rowData.id, rowData.dateChange);
10496
+ }
10497
+ else {
10498
+ _this.messageService.add({
10499
+ severity: "error",
10500
+ summary: _this.translateService.instant("hcm.payroll.error"),
10501
+ detail: _this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
10502
+ });
10503
+ }
10504
+ },
10505
+ },
10506
+ ];
10507
+ };
10508
+ HistoricalPixAccountListComponent.prototype.delete = function (id, dateChange) {
10509
+ var _this = this;
10510
+ if (id === this.lastRecord.id) {
10511
+ var dateChangeToDto_1 = moment$e(dateChange, this.dateFormat).format("YYYY-MM-DD");
10512
+ this.confirmationService.confirm({
10513
+ message: this.translateService.instant("hcm.payroll.employees_movimentation_historical_pix_account_question_confirm_delete") + "?",
10514
+ accept: function () {
10515
+ _this.loading = true;
10516
+ var service = _this.withSidebar ? exports.ServiceType.PAYROLL : exports.ServiceType.DEPENDENT;
10517
+ _this.historicalPixAccountListService
10518
+ .remove(_this.employeeId, dateChangeToDto_1, service, _this.dependentId)
10519
+ .pipe(operators.takeUntil(_this.ngUnsubscribe))
10520
+ .subscribe(function () {
10521
+ _this.messageService.add({
10522
+ severity: "success",
10523
+ summary: _this.translateService.instant("hcm.payroll.success"),
10524
+ detail: _this.translateService.instant("hcm.payroll.employees_movimentation_historical_pix_account_remove"),
10525
+ });
10526
+ _this.parameters = (_this.parameters && __assign({}, _this.parameters)) || {};
10527
+ }, function () {
10528
+ _this.messageService.add({
10529
+ severity: "error",
10530
+ summary: _this.translateService.instant("hcm.payroll.error"),
10531
+ detail: _this.translateService.instant("hcm.payroll.employees_movimentation_historical_pix_account_error_remove"),
10532
+ });
10533
+ _this.loading = false;
10534
+ });
10535
+ },
10536
+ });
10537
+ }
10538
+ else {
10539
+ this.messageService.add({
10540
+ severity: "error",
10541
+ summary: this.translateService.instant("hcm.payroll.error"),
10542
+ detail: this.translateService.instant("hcm.payroll.not_allowed_delete_last"),
10543
+ });
10544
+ }
10545
+ };
10546
+ HistoricalPixAccountListComponent.prototype.add = function () {
10547
+ if (this.isAllowToAddHistorical) {
10548
+ this.router.navigate(["historical-pix-account-new"], {
10549
+ relativeTo: this.activatedRoute,
10550
+ });
10551
+ }
10552
+ else {
10553
+ this.messageService.add({
10554
+ severity: "error",
10555
+ summary: this.translateService.instant("hcm.payroll.error"),
10556
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
10557
+ });
10558
+ }
10559
+ };
10560
+ HistoricalPixAccountListComponent.prototype.onGridLoad = function (payload) {
10561
+ if (payload && payload.length) {
10562
+ this.lastRecord = payload[0];
10563
+ }
10564
+ };
10565
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToAddHistorical", {
10566
+ get: function () {
10567
+ return (this.permission["incluir"]);
10568
+ },
10569
+ enumerable: true,
10570
+ configurable: true
10571
+ });
10572
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToDeleteHistorical", {
10573
+ get: function () {
10574
+ return (this.permission["excluir"]);
10575
+ },
10576
+ enumerable: true,
10577
+ configurable: true
10578
+ });
10579
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "scopedActions", {
10580
+ get: function () {
10581
+ return this.getMenuActions.bind(this);
10582
+ },
10583
+ enumerable: true,
10584
+ configurable: true
10585
+ });
10586
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "reloadList", {
10587
+ set: function (condition) {
10588
+ if (condition) {
10589
+ this.loading = true;
10590
+ this.parameters = (this.parameters && __assign({}, this.parameters)) || {};
10591
+ }
10592
+ },
10593
+ enumerable: true,
10594
+ configurable: true
10595
+ });
10596
+ HistoricalPixAccountListComponent.ctorParameters = function () { return [
10597
+ { type: api.ConfirmationService },
10598
+ { type: core$1.TranslateService },
10599
+ { type: router.ActivatedRoute },
10600
+ { type: core.ChangeDetectorRef },
10601
+ { type: router.Router },
10602
+ { type: api.MessageService },
10603
+ { type: HistoricalPixAccountListService }
10604
+ ]; };
10605
+ __decorate([
10606
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
10607
+ ], HistoricalPixAccountListComponent.prototype, "customFields", void 0);
10608
+ __decorate([
10609
+ core.Input()
10610
+ ], HistoricalPixAccountListComponent.prototype, "permission", void 0);
10611
+ __decorate([
10612
+ core.Input()
10613
+ ], HistoricalPixAccountListComponent.prototype, "employeeId", void 0);
10614
+ __decorate([
10615
+ core.Input()
10616
+ ], HistoricalPixAccountListComponent.prototype, "dependentId", void 0);
10617
+ __decorate([
10618
+ core.Input()
10619
+ ], HistoricalPixAccountListComponent.prototype, "dateFormat", void 0);
10620
+ __decorate([
10621
+ core.Input()
10622
+ ], HistoricalPixAccountListComponent.prototype, "endPoint", void 0);
10623
+ __decorate([
10624
+ core.Input()
10625
+ ], HistoricalPixAccountListComponent.prototype, "keyPayload", void 0);
10626
+ __decorate([
10627
+ core.Input()
10628
+ ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
10629
+ __decorate([
10630
+ core.Output()
10631
+ ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
10632
+ __decorate([
10633
+ core.Input()
10634
+ ], HistoricalPixAccountListComponent.prototype, "reloadList", null);
10635
+ HistoricalPixAccountListComponent = __decorate([
10636
+ core.Component({
10637
+ // tslint:disable-next-line:component-selector
10638
+ selector: "c-historical-pix-account-list",
10639
+ template: "<div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <c-data-list-rest\n id=\"ta-historical-pix-account-list\"\n [columns]=\"columns\"\n actionLabel=\"{{ 'hcm.payroll.movimentation_generic_action' | translate }}\"\n emptyMessage=\"{{ 'hcm.payroll.admission_empty_message' | translate }}\"\n [endpoint]=\"endPoint\"\n singularMessageRecords=\"{{\n 'hcm.payroll.admission_register' | translate\n }}\"\n [actions]=\"scopedActions\"\n pluralMessageRecords=\"{{\n 'hcm.payroll.admission_registers' | translate\n }}\"\n [keyPayload]=\"keyPayload\"\n [lazy]=\"true\"\n (lazyLoad)=\"onLazyLoad($event)\"\n [(loading)]=\"loading\"\n [initParameters]=\"initParameters\"\n [parameters]=\"parameters\"\n [isSortable]=\"false\"\n ></c-data-list-rest>\n </div>\n</div>\n\n",
10640
+ styles: [""]
10641
+ })
10642
+ ], HistoricalPixAccountListComponent);
10643
+ return HistoricalPixAccountListComponent;
10644
+ }());
10645
+
10646
+ var HistoricalPixAccountListModule = /** @class */ (function () {
10647
+ function HistoricalPixAccountListModule() {
10648
+ }
10649
+ HistoricalPixAccountListModule = __decorate([
10650
+ core.NgModule({
10651
+ imports: [
10652
+ common.CommonModule,
10653
+ forms.FormsModule,
10654
+ http.HttpClientModule,
10655
+ autocomplete.AutoCompleteModule,
10656
+ SharedModule,
10657
+ forms.ReactiveFormsModule,
10658
+ table.TableModule,
10659
+ angularComponents.ButtonModule,
10660
+ tooltip.TooltipModule,
10661
+ angularComponents.LoadingStateModule,
10662
+ DataListRestModule,
10663
+ confirmdialog.ConfirmDialogModule,
10664
+ ],
10665
+ declarations: [HistoricalPixAccountListComponent],
10666
+ providers: [HistoricalPixAccountListService],
10667
+ exports: [HistoricalPixAccountListComponent],
10668
+ })
10669
+ ], HistoricalPixAccountListModule);
10670
+ return HistoricalPixAccountListModule;
10671
+ }());
10672
+
9325
10673
  exports.AdmissionDraftSummaryComponent = AdmissionDraftSummaryComponent;
9326
10674
  exports.AdmissionDraftSummaryModule = AdmissionDraftSummaryModule;
9327
10675
  exports.AdmissionDraftSummaryService = AdmissionDraftSummaryService;
@@ -9362,6 +10710,12 @@
9362
10710
  exports.HistoricalBankAccountListService = HistoricalBankAccountListService;
9363
10711
  exports.HistoricalBankAccountModule = HistoricalBankAccountModule;
9364
10712
  exports.HistoricalBankAccountService = HistoricalBankAccountService;
10713
+ exports.HistoricalPixAccountComponent = HistoricalPixAccountComponent;
10714
+ exports.HistoricalPixAccountListComponent = HistoricalPixAccountListComponent;
10715
+ exports.HistoricalPixAccountListModule = HistoricalPixAccountListModule;
10716
+ exports.HistoricalPixAccountListService = HistoricalPixAccountListService;
10717
+ exports.HistoricalPixAccountModule = HistoricalPixAccountModule;
10718
+ exports.HistoricalPixAccountService = HistoricalPixAccountService;
9365
10719
  exports.HttpClientService = HttpClientService;
9366
10720
  exports.ImageCropComponent = ImageCropComponent;
9367
10721
  exports.ImageCropModule = ImageCropModule;
@@ -9492,6 +10846,7 @@
9492
10846
  exports.ɵo = AutocompleteService;
9493
10847
  exports.ɵp = LookupService$1;
9494
10848
  exports.ɵq = HistoricalBankAccountFormComponent;
10849
+ exports.ɵr = HistoricalPixAccountFormComponent;
9495
10850
 
9496
10851
  Object.defineProperty(exports, '__esModule', { value: true });
9497
10852