@senior-gestao-pessoas/payroll-core 9.0.0 → 9.1.0-5e184124-4e09-4f1a-9bdd-3cc4483b1cbf

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 +1015 -3
  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 +74 -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/input-rest-auto-complete-employee-model/input-rest-auto-complete-employee-model.component.d.ts +5 -1
  11. package/components/utils/format-utils/format-utils.service.d.ts +33 -0
  12. package/components/utils/generic-validators.d.ts +24 -0
  13. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +312 -0
  14. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +323 -0
  15. package/esm2015/components/historical-pix-account/historical-pix-account.module.js +58 -0
  16. package/esm2015/components/historical-pix-account/historical-pix-account.service.js +20 -0
  17. package/esm2015/components/historical-pix-account/index.js +4 -0
  18. package/esm2015/components/input-rest-auto-complete-employee-model/input-rest-auto-complete-employee-model.component.js +21 -4
  19. package/esm2015/components/utils/format-utils/format-utils.service.js +96 -0
  20. package/esm2015/components/utils/generic-validators.js +164 -0
  21. package/esm2015/public_api.js +2 -1
  22. package/esm2015/senior-gestao-pessoas-payroll-core.js +2 -1
  23. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +336 -0
  24. package/esm5/components/historical-pix-account/historical-pix-account.component.js +357 -0
  25. package/esm5/components/historical-pix-account/historical-pix-account.module.js +61 -0
  26. package/esm5/components/historical-pix-account/historical-pix-account.service.js +22 -0
  27. package/esm5/components/historical-pix-account/index.js +4 -0
  28. package/esm5/components/input-rest-auto-complete-employee-model/input-rest-auto-complete-employee-model.component.js +22 -4
  29. package/esm5/components/utils/format-utils/format-utils.service.js +100 -0
  30. package/esm5/components/utils/generic-validators.js +167 -0
  31. package/esm5/public_api.js +2 -1
  32. package/esm5/senior-gestao-pessoas-payroll-core.js +2 -1
  33. package/fesm2015/senior-gestao-pessoas-payroll-core.js +943 -4
  34. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  35. package/fesm5/senior-gestao-pessoas-payroll-core.js +1012 -4
  36. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -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
@@ -3530,8 +3530,9 @@
3530
3530
  }());
3531
3531
 
3532
3532
  var InputRestAutoCompleteEmployeeModelComponent = /** @class */ (function () {
3533
- function InputRestAutoCompleteEmployeeModelComponent(service) {
3533
+ function InputRestAutoCompleteEmployeeModelComponent(service, activatedRoute) {
3534
3534
  this.service = service;
3535
+ this.activatedRoute = activatedRoute;
3535
3536
  this.forceSelection = true;
3536
3537
  this.keyName = 'name';
3537
3538
  this.onBlur = new core.EventEmitter();
@@ -3539,8 +3540,14 @@
3539
3540
  this.onClear = new core.EventEmitter();
3540
3541
  this.modelChange = new core.EventEmitter();
3541
3542
  this.suggestions = [];
3543
+ this.ngUnsubscribe = new rxjs.Subject();
3542
3544
  }
3543
- InputRestAutoCompleteEmployeeModelComponent.prototype.ngOnInit = function () { };
3545
+ InputRestAutoCompleteEmployeeModelComponent.prototype.ngOnInit = function () {
3546
+ var _this = this;
3547
+ this.activatedRoute.data.pipe(operators.takeUntil(this.ngUnsubscribe)).subscribe(function (data) {
3548
+ _this.useWorkflow = !!(data && data.useWorkflow);
3549
+ });
3550
+ };
3544
3551
  InputRestAutoCompleteEmployeeModelComponent.prototype.filterQuery = function (event) {
3545
3552
  var _this = this;
3546
3553
  var query = event.query;
@@ -3600,6 +3607,13 @@
3600
3607
  if (this.employeeType) {
3601
3608
  returnFilter['employeeType'] = this.employeeType;
3602
3609
  }
3610
+ /**
3611
+ * If para uso do BPO
3612
+ * Serve para tirar os colaboradores demitidos do dropbox do autocomplete
3613
+ */
3614
+ if (this.useWorkflow) {
3615
+ returnFilter['timeTrackingResumeType'] = { key: "FIRED" };
3616
+ }
3603
3617
  return returnFilter;
3604
3618
  };
3605
3619
  /**
@@ -3628,7 +3642,8 @@
3628
3642
  configurable: true
3629
3643
  });
3630
3644
  InputRestAutoCompleteEmployeeModelComponent.ctorParameters = function () { return [
3631
- { type: InputRestAutoCompleteEmployeeModelService }
3645
+ { type: InputRestAutoCompleteEmployeeModelService },
3646
+ { type: router.ActivatedRoute }
3632
3647
  ]; };
3633
3648
  __decorate([
3634
3649
  core.Input()
@@ -9307,6 +9322,999 @@
9307
9322
  return FromToModule;
9308
9323
  }());
9309
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.getFormattedCpfTelephoneNumber = 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 <td [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <span *ngSwitchCase=\"'TELEPHONE'\">{{ getFormattedCpfTelephoneNumber(rowData?.pixKey) }}</span>\n <span *ngSwitchCase=\"'CPF'\">{{ getFormattedCpf(rowData?.pixKey) }}</span>\n <span *ngSwitchCase=\"'CNPJ'\">{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n <span *ngSwitchDefault>{{ rowData?.pixKey }}</span>\n </ng-container>\n\n </td>\n <td [pTooltip]=\"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
+ HistoricalPixAccountFormComponent.prototype.getBankTableId = function () {
10073
+ return this.pixAccountFormGroup.controls.bank.value
10074
+ ? "'" + this.pixAccountFormGroup.controls.bank.value.tableId + "'"
10075
+ : null;
10076
+ };
10077
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "percentagePlaceholder", {
10078
+ get: function () {
10079
+ return "0" + (this.currency && this.currency.decimalSeparator) + "00";
10080
+ },
10081
+ enumerable: true,
10082
+ configurable: true
10083
+ });
10084
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "optionsPercentage", {
10085
+ get: function () {
10086
+ return __assign({}, this.getOptions(), { precision: 2 });
10087
+ },
10088
+ enumerable: true,
10089
+ configurable: true
10090
+ });
10091
+ HistoricalPixAccountFormComponent.prototype.getOptions = function () {
10092
+ return {
10093
+ prefix: "",
10094
+ thousands: this.currency.thousandsSeparator,
10095
+ decimal: this.currency.decimalSeparator,
10096
+ };
10097
+ };
10098
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "getListPixAccount", {
10099
+ /**
10100
+ * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
10101
+ * @param pixAccountList
10102
+ */
10103
+ set: function (pixAccountList) {
10104
+ if (pixAccountList) {
10105
+ this.setValidatorsAccordingList(pixAccountList);
10106
+ }
10107
+ else {
10108
+ this.resetForm();
10109
+ }
10110
+ },
10111
+ enumerable: true,
10112
+ configurable: true
10113
+ });
10114
+ /**
10115
+ * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
10116
+ * a validação dos campos "percentage" e "pixAccount".
10117
+ * 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
10118
+ * no array de comparação dos validators.
10119
+ * @param pixAccountList
10120
+ * @param index
10121
+ */
10122
+ HistoricalPixAccountFormComponent.prototype.setValidatorsAccordingList = function (pixAccountList, index) {
10123
+ if (index === void 0) { index = null; }
10124
+ this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
10125
+ var percentageIncluded = [];
10126
+ if (this.pixAccountList && this.pixAccountList.length) {
10127
+ this.pixAccountList.filter(function (field, key) {
10128
+ if (field["percentage"] && key != index) {
10129
+ percentageIncluded.push(field["percentage"]);
10130
+ }
10131
+ });
10132
+ }
10133
+ this.setPixKeyValidators();
10134
+ this.validatePercentageValid(percentageIncluded);
10135
+ };
10136
+ /**
10137
+ * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
10138
+ */
10139
+ HistoricalPixAccountFormComponent.prototype.setPixKeyValidators = function () {
10140
+ var genericPixKey = this.pixAccountFormGroup.get("pixKey");
10141
+ if (this.pixKeyType) {
10142
+ switch (this.pixKeyType) {
10143
+ case "TELEPHONE":
10144
+ genericPixKey.setValidators(forms.Validators.compose([
10145
+ forms.Validators.required, GenericValidator.isValidPhoneNumber,
10146
+ ]));
10147
+ break;
10148
+ case "EMAIL":
10149
+ genericPixKey.setValidators(forms.Validators.compose([
10150
+ forms.Validators.required, GenericValidator.isValidEmail,
10151
+ ]));
10152
+ break;
10153
+ case "CPF":
10154
+ genericPixKey.setValidators(forms.Validators.compose([
10155
+ forms.Validators.required, GenericValidator.isValidCpf,
10156
+ ]));
10157
+ break;
10158
+ case "CNPJ":
10159
+ genericPixKey.setValidators(forms.Validators.compose([
10160
+ forms.Validators.required, GenericValidator.isValidCnpj,
10161
+ ]));
10162
+ break;
10163
+ case "RANDOM_KEY":
10164
+ genericPixKey.setValidators(forms.Validators.required);
10165
+ break;
10166
+ default:
10167
+ genericPixKey.setValidators(null);
10168
+ break;
10169
+ }
10170
+ genericPixKey.enable();
10171
+ genericPixKey.updateValueAndValidity();
10172
+ }
10173
+ };
10174
+ /**
10175
+ * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
10176
+ * 100% na validação do campo "percentage" como um novo maxValue;
10177
+ * @param listValue
10178
+ */
10179
+ HistoricalPixAccountFormComponent.prototype.validatePercentageValid = function (listValue) {
10180
+ var percentage = this.pixAccountFormGroup.get("percentage");
10181
+ this.maxValuePercentage = listValue
10182
+ .reduce(function (currentValue, total) { return currentValue - total; }, 100.00);
10183
+ percentage
10184
+ .setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10185
+ forms.Validators.max(this.maxValuePercentage),
10186
+ ])));
10187
+ percentage.updateValueAndValidity();
10188
+ };
10189
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10190
+ set: function (condition) {
10191
+ this.isView = !!(condition && !this.withSideBar);
10192
+ this.configEnableFields(!this.isView);
10193
+ if (!this.isView)
10194
+ this.resetForm();
10195
+ },
10196
+ enumerable: true,
10197
+ configurable: true
10198
+ });
10199
+ HistoricalPixAccountFormComponent.prototype.phoneMask = function (event) {
10200
+ FormatUtilsService.formatTelephoneInputEvent(event);
10201
+ };
10202
+ HistoricalPixAccountFormComponent.prototype.setDefaultCpfPixKey = function () {
10203
+ var sheetDocument = this.paramsForm.get("sheetDocument");
10204
+ if (sheetDocument) {
10205
+ var cpf = sheetDocument.get("cpfNumber").value;
10206
+ if (cpf) {
10207
+ this.pixAccountFormGroup.get("pixKey").setValue(cpf);
10208
+ }
10209
+ }
10210
+ };
10211
+ HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10212
+ { type: forms.FormBuilder },
10213
+ { type: core.ChangeDetectorRef }
10214
+ ]; };
10215
+ __decorate([
10216
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: true })
10217
+ ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
10218
+ __decorate([
10219
+ core.Input()
10220
+ ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
10221
+ __decorate([
10222
+ core.Input()
10223
+ ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
10224
+ __decorate([
10225
+ core.Input()
10226
+ ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
10227
+ __decorate([
10228
+ core.Input()
10229
+ ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
10230
+ __decorate([
10231
+ core.Input()
10232
+ ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
10233
+ __decorate([
10234
+ core.Input()
10235
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
10236
+ __decorate([
10237
+ core.Output()
10238
+ ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
10239
+ __decorate([
10240
+ core.Output()
10241
+ ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
10242
+ __decorate([
10243
+ core.Input()
10244
+ ], HistoricalPixAccountFormComponent.prototype, "visible", null);
10245
+ __decorate([
10246
+ core.Input()
10247
+ ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
10248
+ __decorate([
10249
+ core.Input()
10250
+ ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
10251
+ __decorate([
10252
+ core.Input()
10253
+ ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
10254
+ HistoricalPixAccountFormComponent = __decorate([
10255
+ core.Component({
10256
+ selector: "pix-account",
10257
+ 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]=\"{ required: 'hcm.payroll.required' | translate }\">\n </s-control-errors>\n </div>\n <!--Chave Pix-->\n <div class=\"ui-md-6 ui-sm-12 required\">\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=\"'RANDOM_KEY'\"\n pInputText id=\"ta-pixKey\" name=\"pixKey\" formControlName=\"pixKey\"/>\n <input *ngSwitchDefault disabled\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",
10258
+ 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}"]
10259
+ })
10260
+ ], HistoricalPixAccountFormComponent);
10261
+ return HistoricalPixAccountFormComponent;
10262
+ }());
10263
+
10264
+ var HistoricalPixAccountService = /** @class */ (function () {
10265
+ function HistoricalPixAccountService(http) {
10266
+ this.http = http;
10267
+ }
10268
+ HistoricalPixAccountService.prototype.query = function (path, body, service) {
10269
+ if (service === void 0) { service = exports.ServiceType.PAYROLL; }
10270
+ return this.http.query(path, body, service);
10271
+ };
10272
+ HistoricalPixAccountService.ctorParameters = function () { return [
10273
+ { type: HttpClientService }
10274
+ ]; };
10275
+ HistoricalPixAccountService = __decorate([
10276
+ core.Injectable()
10277
+ ], HistoricalPixAccountService);
10278
+ return HistoricalPixAccountService;
10279
+ }());
10280
+
10281
+ var HistoricalPixAccountModule = /** @class */ (function () {
10282
+ function HistoricalPixAccountModule() {
10283
+ }
10284
+ HistoricalPixAccountModule = __decorate([
10285
+ core.NgModule({
10286
+ imports: [
10287
+ common.CommonModule,
10288
+ forms.FormsModule,
10289
+ http.HttpClientModule,
10290
+ autocomplete.AutoCompleteModule,
10291
+ SharedModule,
10292
+ forms.ReactiveFormsModule,
10293
+ table.TableModule,
10294
+ angularComponents.ButtonModule,
10295
+ tooltip.TooltipModule,
10296
+ angularComponents.LoadingStateModule,
10297
+ angularComponents.SidebarModule,
10298
+ InputDateModule,
10299
+ angularComponents.ControlErrorsModule,
10300
+ InputRestAutoCompleteEnumModule,
10301
+ ng2CurrencyMask.CurrencyMaskModule,
10302
+ InputRestAutoCompleteModule,
10303
+ inputtext.InputTextModule,
10304
+ CoreDirectives,
10305
+ fieldset.FieldsetModule,
10306
+ angularComponents.CustomFieldsModule,
10307
+ panel.PanelModule,
10308
+ inputmask.InputMaskModule,
10309
+ ],
10310
+ declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
10311
+ providers: [HistoricalPixAccountService, api.ConfirmationService],
10312
+ exports: [HistoricalPixAccountComponent],
10313
+ })
10314
+ ], HistoricalPixAccountModule);
10315
+ return HistoricalPixAccountModule;
10316
+ }());
10317
+
9310
10318
  exports.AdmissionDraftSummaryComponent = AdmissionDraftSummaryComponent;
9311
10319
  exports.AdmissionDraftSummaryModule = AdmissionDraftSummaryModule;
9312
10320
  exports.AdmissionDraftSummaryService = AdmissionDraftSummaryService;
@@ -9347,6 +10355,9 @@
9347
10355
  exports.HistoricalBankAccountListService = HistoricalBankAccountListService;
9348
10356
  exports.HistoricalBankAccountModule = HistoricalBankAccountModule;
9349
10357
  exports.HistoricalBankAccountService = HistoricalBankAccountService;
10358
+ exports.HistoricalPixAccountComponent = HistoricalPixAccountComponent;
10359
+ exports.HistoricalPixAccountModule = HistoricalPixAccountModule;
10360
+ exports.HistoricalPixAccountService = HistoricalPixAccountService;
9350
10361
  exports.HttpClientService = HttpClientService;
9351
10362
  exports.ImageCropComponent = ImageCropComponent;
9352
10363
  exports.ImageCropModule = ImageCropModule;
@@ -9477,6 +10488,7 @@
9477
10488
  exports.ɵo = AutocompleteService;
9478
10489
  exports.ɵp = LookupService$1;
9479
10490
  exports.ɵq = HistoricalBankAccountFormComponent;
10491
+ exports.ɵr = HistoricalPixAccountFormComponent;
9480
10492
 
9481
10493
  Object.defineProperty(exports, '__esModule', { value: true });
9482
10494