@senior-gestao-pessoas/payroll-core 9.5.0-feature-hcmgdp-11492-21838e72 → 9.5.0-feature-hcmgdp-11492-f438f1e4

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