@senior-gestao-pessoas/payroll-core 9.5.0 → 9.6.0-feature-hcmgdp-11604-e0af4f68

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