@senior-gestao-pessoas/payroll-core 9.4.0-beccc0e0-72b8-4a99-8127-32ad8ca6ee41 → 9.4.0-db1d034b-8b09-472f-9726-7fd71af961f4

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 (39) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +921 -761
  2. package/bundles/senior-gestao-pessoas-payroll-core.umd.js.map +1 -1
  3. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js +16 -1
  4. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js.map +1 -1
  5. package/components/historical-pix-account/historical-pix-account-base.d.ts +25 -0
  6. package/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.d.ts +8 -40
  7. package/components/historical-pix-account/historical-pix-account.component.d.ts +23 -6
  8. package/components/historical-pix-account/historical-pix-account.service.d.ts +1 -0
  9. package/components/historical-pix-account-list/historical-pix-account-list.component.d.ts +9 -1
  10. package/components/shared/index.d.ts +1 -0
  11. package/components/shared/shared-state.service.d.ts +14 -0
  12. package/esm2015/components/historical-pix-account/historical-pix-account-base.js +150 -0
  13. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +29 -187
  14. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +79 -18
  15. package/esm2015/components/historical-pix-account/historical-pix-account.module.js +5 -1
  16. package/esm2015/components/historical-pix-account/historical-pix-account.service.js +8 -1
  17. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.component.js +38 -5
  18. package/esm2015/components/shared/index.js +2 -0
  19. package/esm2015/components/shared/shared-state.service.js +36 -0
  20. package/esm2015/public_api.js +2 -1
  21. package/esm2015/senior-gestao-pessoas-payroll-core.js +3 -2
  22. package/esm5/components/historical-pix-account/historical-pix-account-base.js +163 -0
  23. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +53 -201
  24. package/esm5/components/historical-pix-account/historical-pix-account.component.js +122 -48
  25. package/esm5/components/historical-pix-account/historical-pix-account.module.js +5 -1
  26. package/esm5/components/historical-pix-account/historical-pix-account.service.js +8 -1
  27. package/esm5/components/historical-pix-account-list/historical-pix-account-list.component.js +43 -5
  28. package/esm5/components/shared/index.js +2 -0
  29. package/esm5/components/shared/shared-state.service.js +37 -0
  30. package/esm5/public_api.js +2 -1
  31. package/esm5/senior-gestao-pessoas-payroll-core.js +3 -2
  32. package/fesm2015/senior-gestao-pessoas-payroll-core.js +576 -457
  33. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  34. package/fesm5/senior-gestao-pessoas-payroll-core.js +917 -758
  35. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  36. package/package.json +1 -1
  37. package/public_api.d.ts +1 -0
  38. package/senior-gestao-pessoas-payroll-core.d.ts +2 -1
  39. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('primeng/blockui'), require('primeng/progressspinner'), require('@angular/router'), require('@ngx-translate/core'), require('rxjs/operators'), require('primeng/breadcrumb'), require('@angular/common'), require('primeng/dropdown'), require('primeng/inputmask'), require('primeng/inputtext'), require('primeng/shared'), require('@seniorsistemas/angular-components'), require('moment'), require('rxjs'), require('primeng/tooltip'), require('primeng/table'), require('@angular/common/http'), require('primeng/api'), require('@senior-gestao-pessoas/angular-components'), require('ng2-img-cropper'), require('primeng/button'), require('primeng/dialog'), require('primeng/fileupload'), require('chance'), require('moment-business'), require('primeng/autocomplete'), require('primeng/splitbutton'), require('primeng/components/common/messageservice'), require('@seniorsistemas/senior-platform-data'), require('primeng/toast'), require('ng2-currency-mask'), require('primeng/fieldset'), require('primeng/panel'), require('primeng/confirmdialog')) :
3
- typeof define === 'function' && define.amd ? define('@senior-gestao-pessoas/payroll-core', ['exports', '@angular/core', '@angular/forms', 'primeng/blockui', 'primeng/progressspinner', '@angular/router', '@ngx-translate/core', 'rxjs/operators', 'primeng/breadcrumb', '@angular/common', 'primeng/dropdown', 'primeng/inputmask', 'primeng/inputtext', 'primeng/shared', '@seniorsistemas/angular-components', 'moment', 'rxjs', 'primeng/tooltip', 'primeng/table', '@angular/common/http', 'primeng/api', '@senior-gestao-pessoas/angular-components', 'ng2-img-cropper', 'primeng/button', 'primeng/dialog', 'primeng/fileupload', 'chance', 'moment-business', 'primeng/autocomplete', 'primeng/splitbutton', 'primeng/components/common/messageservice', '@seniorsistemas/senior-platform-data', 'primeng/toast', 'ng2-currency-mask', 'primeng/fieldset', 'primeng/panel', 'primeng/confirmdialog'], factory) :
4
- (global = global || self, factory((global['senior-gestao-pessoas'] = global['senior-gestao-pessoas'] || {}, global['senior-gestao-pessoas']['payroll-core'] = {}), global.ng.core, global.ng.forms, global.blockui, global.progressspinner, global.ng.router, global.core$1, global.rxjs.operators, global.breadcrumb, global.ng.common, global.dropdown, global.inputmask, global.inputtext, global.shared, global.angularComponents, global.moment_, global.rxjs, global.tooltip, global.table, global.ng.common.http, global.api, global.angularComponents$1, global.ng2ImgCropper, global.button, global.dialog, global.fileupload, global.chance, global.business, global.autocomplete, global.splitbutton, global.messageservice, global.seniorPlatformData, global.toast, global.ng2CurrencyMask, global.fieldset, global.panel, global.confirmdialog));
5
- }(this, (function (exports, core, forms, blockui, progressspinner, router, core$1, operators, breadcrumb, common, dropdown, inputmask, inputtext, shared, angularComponents, moment_, rxjs, tooltip, table, http, api, angularComponents$1, ng2ImgCropper, button, dialog, fileupload, chance, business, autocomplete, splitbutton, messageservice, seniorPlatformData, toast, ng2CurrencyMask, fieldset, panel, confirmdialog) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/forms'), require('primeng/blockui'), require('primeng/progressspinner'), require('@angular/router'), require('@ngx-translate/core'), require('rxjs/operators'), require('primeng/breadcrumb'), require('@angular/common'), require('primeng/dropdown'), require('primeng/inputmask'), require('primeng/inputtext'), require('primeng/shared'), require('@seniorsistemas/angular-components'), require('moment'), require('rxjs'), require('primeng/tooltip'), require('primeng/table'), require('@angular/common/http'), require('primeng/api'), require('@senior-gestao-pessoas/angular-components'), require('ng2-img-cropper'), require('primeng/button'), require('primeng/dialog'), require('primeng/fileupload'), require('chance'), require('moment-business'), require('primeng/autocomplete'), require('primeng/splitbutton'), require('primeng/components/common/messageservice'), require('@seniorsistemas/senior-platform-data'), require('primeng/toast'), require('ng2-currency-mask'), require('primeng/fieldset'), require('primeng/panel'), require('primeng/confirmdialog'), require('primeng/tabview')) :
3
+ typeof define === 'function' && define.amd ? define('@senior-gestao-pessoas/payroll-core', ['exports', '@angular/core', '@angular/forms', 'primeng/blockui', 'primeng/progressspinner', '@angular/router', '@ngx-translate/core', 'rxjs/operators', 'primeng/breadcrumb', '@angular/common', 'primeng/dropdown', 'primeng/inputmask', 'primeng/inputtext', 'primeng/shared', '@seniorsistemas/angular-components', 'moment', 'rxjs', 'primeng/tooltip', 'primeng/table', '@angular/common/http', 'primeng/api', '@senior-gestao-pessoas/angular-components', 'ng2-img-cropper', 'primeng/button', 'primeng/dialog', 'primeng/fileupload', 'chance', 'moment-business', 'primeng/autocomplete', 'primeng/splitbutton', 'primeng/components/common/messageservice', '@seniorsistemas/senior-platform-data', 'primeng/toast', 'ng2-currency-mask', 'primeng/fieldset', 'primeng/panel', 'primeng/confirmdialog', 'primeng/tabview'], factory) :
4
+ (global = global || self, factory((global['senior-gestao-pessoas'] = global['senior-gestao-pessoas'] || {}, global['senior-gestao-pessoas']['payroll-core'] = {}), global.ng.core, global.ng.forms, global.blockui, global.progressspinner, global.ng.router, global.core$1, global.rxjs.operators, global.breadcrumb, global.ng.common, global.dropdown, global.inputmask, global.inputtext, global.shared, global.angularComponents, global.moment_, global.rxjs, global.tooltip, global.table, global.ng.common.http, global.api, global.angularComponents$1, global.ng2ImgCropper, global.button, global.dialog, global.fileupload, global.chance, global.business, global.autocomplete, global.splitbutton, global.messageservice, global.seniorPlatformData, global.toast, global.ng2CurrencyMask, global.fieldset, global.panel, global.confirmdialog, global.tabview));
5
+ }(this, (function (exports, core, forms, blockui, progressspinner, router, core$1, operators, breadcrumb, common, dropdown, inputmask, inputtext, shared, angularComponents, moment_, rxjs, tooltip, table, http, api, angularComponents$1, ng2ImgCropper, button, dialog, fileupload, chance, business, autocomplete, splitbutton, messageservice, seniorPlatformData, toast, ng2CurrencyMask, fieldset, panel, confirmdialog, tabview) { 'use strict';
6
6
 
7
7
  business = business && business.hasOwnProperty('default') ? business['default'] : business;
8
8
 
@@ -9421,631 +9421,914 @@
9421
9421
  return FormatUtilsService;
9422
9422
  }());
9423
9423
 
9424
- var HistoricalPixAccountComponent = /** @class */ (function () {
9425
- function HistoricalPixAccountComponent(translateService, cd, formBuilder, messageService) {
9426
- var _this = this;
9427
- this.translateService = translateService;
9428
- this.cd = cd;
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();
9424
+ var SharedStateService = /** @class */ (function () {
9425
+ function SharedStateService() {
9426
+ this.hideFieldSubject = new rxjs.BehaviorSubject(true);
9427
+ this.hideField$ = this.hideFieldSubject.asObservable();
9428
+ this.showButtonSubject = new rxjs.BehaviorSubject(true);
9429
+ this.showButton$ = this.showButtonSubject.asObservable();
9430
+ this.saveButtonSubject = new rxjs.BehaviorSubject(true);
9431
+ this.saveButton$ = this.saveButtonSubject.asObservable();
9432
+ this.showEditMode = new rxjs.BehaviorSubject(true);
9433
+ this.showEditMode$ = this.showEditMode.asObservable();
9524
9434
  }
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
- }
9435
+ SharedStateService.prototype.setHideField = function (value) {
9436
+ this.hideFieldSubject.next(value);
9532
9437
  };
9533
- HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9534
- this.historicalPixAccountList = this.formBuilder.group({
9535
- historicalPixAccountList: this.formBuilder.control(null),
9536
- });
9438
+ SharedStateService.prototype.setShowButton = function (value) {
9439
+ this.showButtonSubject.next(value);
9537
9440
  };
9538
- HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
9539
- this.ngUnsubscribe.next();
9540
- this.ngUnsubscribe.complete();
9441
+ SharedStateService.prototype.setSaveButton = function (value) {
9442
+ this.saveButtonSubject.next(value);
9541
9443
  };
9542
- HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9543
- this.cd.detectChanges();
9444
+ SharedStateService.prototype.setShowEditMode = function (value) {
9445
+ this.showEditMode.next(value);
9544
9446
  };
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
- }
9447
+ SharedStateService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function SharedStateService_Factory() { return new SharedStateService(); }, token: SharedStateService, providedIn: "root" });
9448
+ SharedStateService = __decorate([
9449
+ core.Injectable({
9450
+ providedIn: 'root',
9451
+ })
9452
+ ], SharedStateService);
9453
+ return SharedStateService;
9454
+ }());
9455
+
9456
+ var GenericValidator = /** @class */ (function () {
9457
+ function GenericValidator() {
9458
+ }
9459
+ /**
9460
+ * Valida o CEI (Cadastro específico de INSS) digitado.
9461
+ */
9462
+ GenericValidator.isValidCei = function (control) {
9463
+ var cei = control.value;
9464
+ if (!cei)
9465
+ return null;
9466
+ else if (cei.length != 11)
9467
+ return null;
9468
+ var multiplicadorBase = "3298765432";
9469
+ var total = 0;
9470
+ var resto = 0;
9471
+ var multiplicando = 0;
9472
+ var multiplicador = 0;
9473
+ if (cei.length !== 11 ||
9474
+ cei === "00000000000" ||
9475
+ cei === "11111111111" ||
9476
+ cei === "22222222222" ||
9477
+ cei === "33333333333" ||
9478
+ cei === "44444444444" ||
9479
+ cei === "55555555555" ||
9480
+ cei === "66666666666" ||
9481
+ cei === "77777777777" ||
9482
+ cei === "88888888888" ||
9483
+ cei === "99999999999")
9484
+ return { invalidCei: true };
9565
9485
  else {
9566
- this.listDataNoPage = [];
9567
- }
9568
- if (this.isEditMode || arrList && arrList.length === 1) {
9569
- this.refreshCssInIE11();
9486
+ for (var i = 0; i < 10; i++) {
9487
+ multiplicando = parseInt(cei.substring(i, i + 1), 10);
9488
+ multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
9489
+ total += multiplicando * multiplicador;
9490
+ }
9491
+ resto = 11 - (total % 11);
9492
+ resto = resto === 10 || resto === 11 ? 0 : resto;
9493
+ var digito = parseInt("" + cei.charAt(10), 10);
9494
+ return resto === digito ? null : { invalidCei: true };
9570
9495
  }
9571
- this.loading = false;
9572
9496
  };
9573
9497
  /**
9574
- * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
9498
+ * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9575
9499
  */
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);
9500
+ GenericValidator.isValidCpf = function (control) {
9501
+ var cpf = control.value;
9502
+ if (cpf) {
9503
+ var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9504
+ equalDigits = 1;
9505
+ if (cpf.length < 11) {
9506
+ return null;
9507
+ }
9508
+ for (i = 0; i < cpf.length - 1; i++) {
9509
+ if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9510
+ equalDigits = 0;
9511
+ break;
9512
+ }
9513
+ }
9514
+ if (!equalDigits) {
9515
+ numbers = cpf.substring(0, 9);
9516
+ digits = cpf.substring(9);
9517
+ sum = 0;
9518
+ for (i = 10; i > 1; i--) {
9519
+ sum += numbers.charAt(10 - i) * i;
9520
+ }
9521
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9522
+ if (result !== Number(digits.charAt(0))) {
9523
+ return { cpfNotValid: true };
9524
+ }
9525
+ numbers = cpf.substring(0, 10);
9526
+ sum = 0;
9527
+ for (i = 11; i > 1; i--) {
9528
+ sum += numbers.charAt(11 - i) * i;
9529
+ }
9530
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9531
+ if (result !== Number(digits.charAt(1))) {
9532
+ return { cpfNotValid: true };
9533
+ }
9534
+ return null;
9535
+ }
9536
+ else {
9537
+ return { cpfNotValid: true };
9538
+ }
9583
9539
  }
9540
+ return null;
9584
9541
  };
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);
9542
+ /**
9543
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9544
+ */
9545
+ GenericValidator.isValidCnpj = function (control) {
9546
+ var cnpj = control.value;
9547
+ if (cnpj) {
9548
+ var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9549
+ cnpj = cnpj.replace(/[^\d]+/g, '');
9550
+ if (cnpj.length !== 14) {
9551
+ return null;
9624
9552
  }
9625
- $event["dateChange"] = this.dateChange;
9626
- newDataList.push($event);
9553
+ // Elimina CNPJs invalidos conhecidos
9554
+ if (cnpj === '00000000000000' ||
9555
+ cnpj === '11111111111111' ||
9556
+ cnpj === '22222222222222' ||
9557
+ cnpj === '33333333333333' ||
9558
+ cnpj === '44444444444444' ||
9559
+ cnpj === '55555555555555' ||
9560
+ cnpj === '66666666666666' ||
9561
+ cnpj === '77777777777777' ||
9562
+ cnpj === '88888888888888' ||
9563
+ cnpj === '99999999999999') {
9564
+ return { cnpjNotValid: true };
9565
+ }
9566
+ // Valida DVs
9567
+ size = cnpj.length - 2;
9568
+ numbers = cnpj.substring(0, size);
9569
+ digits = cnpj.substring(size);
9570
+ sum = 0;
9571
+ pos = size - 7;
9572
+ for (var i = size; i >= 1; i--) {
9573
+ sum += numbers.charAt(size - i) * pos--;
9574
+ if (pos < 2) {
9575
+ pos = 9;
9576
+ }
9577
+ }
9578
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9579
+ if (result !== Number(digits.charAt(0))) {
9580
+ return { cnpjNotValid: true };
9581
+ }
9582
+ size = size + 1;
9583
+ numbers = cnpj.substring(0, size);
9584
+ sum = 0;
9585
+ pos = size - 7;
9586
+ for (var i = size; i >= 1; i--) {
9587
+ sum += numbers.charAt(size - i) * pos--;
9588
+ if (pos < 2) {
9589
+ pos = 9;
9590
+ }
9591
+ }
9592
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9593
+ if (result !== Number(digits.charAt(1))) {
9594
+ return { cnpjNotValid: true };
9595
+ }
9596
+ return null;
9627
9597
  }
9628
- this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9629
- this.verifyTotalPercentage();
9630
- this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
9598
+ return null;
9631
9599
  };
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;
9600
+ /**
9601
+ * Válida o número de telefone da chave PIX.
9602
+ */
9603
+ GenericValidator.isValidPhoneNumber = function (control) {
9604
+ var cellPhoneKey = control.value || '';
9605
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9606
+ var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9607
+ var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9608
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9609
+ };
9610
+ /**
9611
+ * Valida o email da chave PIX.
9612
+ */
9613
+ GenericValidator.isValidEmail = function (control) {
9614
+ var emailKey = control.value;
9615
+ var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9616
+ var isValidEmail = regexValidEmail.test(emailKey);
9617
+ return isValidEmail ? null : { invalidEmail: true };
9618
+ };
9619
+ return GenericValidator;
9620
+ }());
9621
+
9622
+ var HistoricakPixAccountBase = /** @class */ (function () {
9623
+ function HistoricakPixAccountBase(formBuilder) {
9624
+ this._paramsForm = new forms.FormGroup({});
9625
+ this._defaultCpfNumber = null;
9626
+ this.initialValidatorOfPercentage = [forms.Validators.required, forms.Validators.min(0.01)];
9627
+ this.pixAccountList = [];
9628
+ this.maxValuePercentage = 100.00;
9629
+ this.isShowPixKeyFieldValidatorMessage = false;
9630
+ this.formBuilder = formBuilder;
9631
+ this.createFormGroupBase();
9632
+ }
9633
+ HistoricakPixAccountBase.prototype.phoneMask = function (event) {
9634
+ console.log("phoneMaskEvent", event);
9635
+ FormatUtilsService.formatTelephoneInputEvent(event);
9636
+ };
9637
+ HistoricakPixAccountBase.prototype.onChangePixKeyType = function (item) {
9638
+ console.log("onChangePixKeyType", item);
9639
+ if (item.key) {
9640
+ this.pixKeyType = item.key;
9641
+ this.isShowPixKeyFieldValidatorMessage = true;
9642
+ this.pixAccountFormGroup.get("pixKey").reset();
9643
+ this.setPixKeyValidators(true);
9644
+ if (item.key === "CPF") {
9645
+ this.setDefaultCpfPixKey();
9646
+ }
9637
9647
  }
9638
- return null;
9639
9648
  };
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");
9649
+ HistoricakPixAccountBase.prototype.onClearPixKeyType = function () {
9650
+ this.isShowPixKeyFieldValidatorMessage = false;
9651
+ this.pixAccountFormGroup.get("pixKey").reset();
9652
+ };
9653
+ HistoricakPixAccountBase.prototype.setDefaultCpfPixKey = function () {
9654
+ if (this._defaultCpfNumber) {
9655
+ this.pixAccountFormGroup.get("pixKey").setValue(this._defaultCpfNumber);
9651
9656
  }
9652
9657
  else {
9653
- this.msgTotalLimitByPercentage = null;
9658
+ var sheetDocument = this._paramsForm.get("sheetDocument");
9659
+ if (sheetDocument) {
9660
+ var cpf = sheetDocument.get("cpfNumber").value;
9661
+ if (cpf) {
9662
+ this.pixAccountFormGroup.get("pixKey").setValue(cpf);
9663
+ }
9664
+ }
9654
9665
  }
9655
9666
  };
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", {
9678
- get: function () {
9679
- return this._dateChange;
9680
- },
9681
- 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; });
9667
+ HistoricakPixAccountBase.prototype.createFormGroupBase = function () {
9668
+ this.pixAccountFormGroup = this.formBuilder.group({
9669
+ id: this.formBuilder.control(null),
9670
+ index: this.formBuilder.control(null),
9671
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9672
+ dateChange: this.formBuilder.control(null),
9673
+ pixKeyType: this.formBuilder.control(null, forms.Validators.required),
9674
+ pixKey: this.formBuilder.control(null),
9675
+ percentage: this.formBuilder.control(null, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9676
+ forms.Validators.max(this.maxValuePercentage),
9677
+ ]))),
9678
+ externalId: this.formBuilder.control(null),
9679
+ customFields: this.formBuilder.control(null),
9680
+ });
9681
+ };
9682
+ HistoricakPixAccountBase.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode) {
9683
+ if (index === void 0) { index = null; }
9684
+ if (isEditMode === void 0) { isEditMode = true; }
9685
+ console.log("setValidatorsAccordingList", pixAccountList, index, isEditMode);
9686
+ this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
9687
+ var percentageIncluded = [];
9688
+ this.pixAccountList.forEach(function (field, key) {
9689
+ if (field["percentage"] && key !== index) {
9690
+ percentageIncluded.push(field["percentage"]);
9686
9691
  }
9687
- },
9688
- enumerable: true,
9689
- configurable: true
9690
- });
9691
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
9692
+ });
9693
+ this.beforeSetPixKeyTypeValidator();
9694
+ this.setPixKeyValidators(isEditMode);
9695
+ this.validatePercentageValid(percentageIncluded);
9696
+ };
9697
+ HistoricakPixAccountBase.prototype.beforeSetPixKeyTypeValidator = function () {
9698
+ var pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
9699
+ console.log("beforeSetPixKeyTypeValidator", this.pixAccountList, pixKeyType);
9700
+ if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
9701
+ pixKeyType.setValidators(forms.Validators.compose([
9702
+ forms.Validators.required,
9703
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
9704
+ ]));
9705
+ }
9706
+ else {
9707
+ pixKeyType.setValidators(forms.Validators.required);
9708
+ }
9709
+ };
9710
+ HistoricakPixAccountBase.prototype.setPixKeyValidators = function (isEditMode) {
9711
+ var pixKey = this.pixAccountFormGroup.get("pixKey");
9712
+ console.log("setPixKeyValidators", this.pixKeyType, isEditMode);
9713
+ if (this.pixKeyType) {
9714
+ switch (this.pixKeyType) {
9715
+ case "TELEPHONE":
9716
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidPhoneNumber]));
9717
+ break;
9718
+ case "EMAIL":
9719
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidEmail]));
9720
+ break;
9721
+ case "CPF":
9722
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidCpf]));
9723
+ break;
9724
+ case "CNPJ":
9725
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidCnpj]));
9726
+ break;
9727
+ case "RANDOM_KEY":
9728
+ pixKey.setValidators(forms.Validators.required);
9729
+ break;
9730
+ default:
9731
+ pixKey.setValidators(null);
9732
+ }
9733
+ if (isEditMode) {
9734
+ pixKey.enable();
9735
+ }
9736
+ pixKey.updateValueAndValidity();
9737
+ }
9738
+ };
9739
+ HistoricakPixAccountBase.prototype.validatePercentageValid = function (listValue) {
9740
+ var percentage = this.pixAccountFormGroup.get("percentage");
9741
+ this.maxValuePercentage = listValue.reduce(function (acc, val) { return acc - val; }, 100.00);
9742
+ console.log("validatePercentageValid", this.maxValuePercentage);
9743
+ percentage.setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9744
+ forms.Validators.max(this.maxValuePercentage),
9745
+ ])));
9746
+ percentage.updateValueAndValidity();
9747
+ };
9748
+ HistoricakPixAccountBase.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
9749
+ return function (control) {
9750
+ var value = control && control.value;
9751
+ var isDuplicate = listCompare.some(function (field) {
9752
+ return value && field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === 'BANK_ACCOUNT';
9753
+ });
9754
+ return isDuplicate ? { pixKeyTypeBankAccountDuplicate: true } : null;
9755
+ };
9756
+ };
9757
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "paramsForm", {
9692
9758
  get: function () {
9693
- return this._displayDateChange;
9759
+ return this._paramsForm;
9694
9760
  },
9695
9761
  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; });
9700
- }
9701
- },
9702
- enumerable: true,
9703
- configurable: true
9704
- });
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();
9762
+ this._paramsForm = value;
9711
9763
  },
9712
9764
  enumerable: true,
9713
9765
  configurable: true
9714
9766
  });
9715
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
9767
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "defaultCpfNumber", {
9716
9768
  get: function () {
9717
- return this._visible;
9769
+ return this._defaultCpfNumber;
9718
9770
  },
9719
9771
  set: function (value) {
9720
- this._visible = value;
9721
- this.visibleChange.emit(this.visible);
9772
+ this._defaultCpfNumber = value;
9722
9773
  },
9723
9774
  enumerable: true,
9724
9775
  configurable: true
9725
9776
  });
9726
- HistoricalPixAccountComponent.prototype.close = function () {
9727
- this.visible = false;
9777
+ return HistoricakPixAccountBase;
9778
+ }());
9779
+
9780
+ var HistoricalPixAccountService = /** @class */ (function () {
9781
+ function HistoricalPixAccountService(http) {
9782
+ this.http = http;
9783
+ }
9784
+ HistoricalPixAccountService.prototype.query = function (path, body, service) {
9785
+ if (service === void 0) { service = exports.ServiceType.PAYROLL; }
9786
+ return this.http.query(path, body, service);
9728
9787
  };
9729
- HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
9730
- return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9788
+ HistoricalPixAccountService.prototype.enumQuery = function () {
9789
+ var path = 'enumQuery';
9790
+ var body = {
9791
+ names: ['PixKeyType']
9792
+ };
9793
+ return this.http.query(path, body, exports.ServiceType.PAYROLL);
9731
9794
  };
9732
- HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
9733
- return FormatUtilsService.getFormattedCpf(cpf);
9795
+ HistoricalPixAccountService.ctorParameters = function () { return [
9796
+ { type: HttpClientService }
9797
+ ]; };
9798
+ HistoricalPixAccountService = __decorate([
9799
+ core.Injectable()
9800
+ ], HistoricalPixAccountService);
9801
+ return HistoricalPixAccountService;
9802
+ }());
9803
+
9804
+ var HistoricalPixAccountComponent = /** @class */ (function (_super) {
9805
+ __extends(HistoricalPixAccountComponent, _super);
9806
+ function HistoricalPixAccountComponent(translateService, cd, formBuilder, messageService, sharedStateService, service) {
9807
+ var _this = _super.call(this, formBuilder) || this;
9808
+ _this.translateService = translateService;
9809
+ _this.cd = cd;
9810
+ _this.messageService = messageService;
9811
+ _this.sharedStateService = sharedStateService;
9812
+ _this.service = service;
9813
+ _this.recordByRow = 1;
9814
+ _this.showDateChange = false;
9815
+ _this.isEditMode = false;
9816
+ _this.isViewMode = false;
9817
+ _this.withSideBar = true;
9818
+ _this.listDataReciever = [];
9819
+ _this.addExistentHistoricData = [];
9820
+ _this.getListPixAccount = [];
9821
+ _this.isViewModeActive = new core.EventEmitter();
9822
+ _this.isEditModeActive = new core.EventEmitter();
9823
+ _this.isDeleteModeActive = new core.EventEmitter();
9824
+ _this.listFromApp = [];
9825
+ _this.visibleChange = new core.EventEmitter();
9826
+ _this.ngUnsubscribe = new rxjs.Subject();
9827
+ _this.orderBy = {
9828
+ field: "dateChange",
9829
+ direction: exports.DirectionEnumeration.DESC,
9830
+ };
9831
+ _this.pixAccountItemInput = {};
9832
+ _this.totalRecords = 0;
9833
+ _this.actionLabel = _this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9834
+ _this.loading = true;
9835
+ _this.listData = [];
9836
+ _this.listDataNoPage = [];
9837
+ _this.showButtonView = true;
9838
+ _this.showEditMode = false;
9839
+ _this.activeIndex = 0;
9840
+ _this.hasRecordsPix = true;
9841
+ _this.firstPix = 0;
9842
+ _this.maxValuePercentage = 100.00;
9843
+ _this.hideFields = _this.sharedStateService.hideField$;
9844
+ _this.suggestions = [];
9845
+ _this.cols = [
9846
+ {
9847
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9848
+ field: "pixKeyType",
9849
+ orderBy: 'pixKeyType.key',
9850
+ },
9851
+ {
9852
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9853
+ field: "pixKey",
9854
+ orderBy: 'pixKey',
9855
+ },
9856
+ {
9857
+ label: _this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9858
+ field: "percentage",
9859
+ orderBy: 'percentage',
9860
+ },
9861
+ {
9862
+ label: _this.translateService.instant("hcm.payroll.movimentation_generic_action"),
9863
+ field: "actions",
9864
+ orderBy: null,
9865
+ }
9866
+ ];
9867
+ _this.actions = function (rowData, key) {
9868
+ if (rowData === void 0) { rowData = {}; }
9869
+ return [
9870
+ {
9871
+ visible: _this.isEditMode,
9872
+ label: _this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9873
+ command: function () {
9874
+ if (_this.isAllowToViewHistorical) {
9875
+ rowData["index"] = key;
9876
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: false };
9877
+ _this.visible = true;
9878
+ }
9879
+ else {
9880
+ _this.isViewModeActive.emit(true);
9881
+ }
9882
+ },
9883
+ },
9884
+ {
9885
+ visible: !!(!_this.isEditMode && _this.withSideBar),
9886
+ label: _this.translateService.instant("hcm.payroll.edit"),
9887
+ command: function () {
9888
+ if (_this.isAllowToEditHistorical) {
9889
+ rowData["index"] = key;
9890
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
9891
+ _this.visible = true;
9892
+ }
9893
+ else {
9894
+ _this.isEditModeActive.emit(true);
9895
+ if (_this.listFromApp.length == 0) {
9896
+ rowData["index"] = key;
9897
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
9898
+ _this.visible = true;
9899
+ }
9900
+ }
9901
+ },
9902
+ },
9903
+ {
9904
+ visible: !_this.isEditMode || _this.showEditMode,
9905
+ label: _this.translateService.instant("hcm.payroll.delete"),
9906
+ command: function () {
9907
+ if (_this.isAllowToDeleteHistorical) {
9908
+ _this.loading = true;
9909
+ _this.deleteAnnuityItem(key);
9910
+ }
9911
+ else {
9912
+ _this.isDeleteModeActive.emit(true);
9913
+ if (_this.listFromApp.length == 0) {
9914
+ _this.loading = true;
9915
+ _this.deleteAnnuityItem(key);
9916
+ }
9917
+ }
9918
+ },
9919
+ },
9920
+ ];
9921
+ };
9922
+ _this.createFormGroup();
9923
+ return _this;
9924
+ }
9925
+ HistoricalPixAccountComponent.prototype.ngOnInit = function () {
9926
+ var _this = this;
9927
+ this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9928
+ this.sharedStateService.showButton$.subscribe(function (value) {
9929
+ _this.showButtonView = value;
9930
+ });
9931
+ this.sharedStateService.showEditMode$.subscribe(function (value) {
9932
+ _this.showEditMode = value;
9933
+ });
9734
9934
  };
9735
- HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
9736
- return FormatUtilsService.getFormattedCnpj(cnpj);
9935
+ HistoricalPixAccountComponent.prototype.ngOnChanges = function (changes) {
9936
+ if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
9937
+ this.listFromApp = changes['listDataReciever'].currentValue;
9938
+ }
9939
+ if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
9940
+ this.getHistoricalPixAccountList();
9941
+ }
9737
9942
  };
9738
- HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
9739
- return FormatUtilsService.getFormattedPercentage(value);
9943
+ HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9944
+ this.historicalPixAccountList = this.formBuilder.group({
9945
+ historicalPixAccountList: this.formBuilder.control(null),
9946
+ });
9740
9947
  };
9741
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
9948
+ HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
9949
+ this.ngUnsubscribe.next();
9950
+ this.ngUnsubscribe.complete();
9951
+ };
9952
+ HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9953
+ this.cd.detectChanges();
9954
+ };
9955
+ HistoricalPixAccountComponent.prototype.filterPixKeyType = function (event) {
9956
+ var _this = this;
9957
+ var query = event.query;
9958
+ this.service.enumQuery().subscribe(function (response) {
9959
+ var pixKeyTypeEnum = response.results.find(function (result) { return result.enumName === 'PixKeyType'; });
9960
+ if (pixKeyTypeEnum) {
9961
+ _this.suggestions = pixKeyTypeEnum.items.filter(function (item) {
9962
+ return item.value.toLowerCase().includes(query.toLowerCase());
9963
+ });
9964
+ }
9965
+ else {
9966
+ _this.suggestions = [];
9967
+ }
9968
+ });
9969
+ };
9970
+ HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
9971
+ var _this = this;
9972
+ var first = event && event.first ? event.first : 0;
9973
+ var rows = event && event.rows ? event.rows : this.recordByRow;
9974
+ var arrList = this.getHistoricalPixAccountList();
9975
+ this.listData = [];
9976
+ this.totalRecords = null;
9977
+ if (event && event.multiSortMeta && event.multiSortMeta.length) {
9978
+ event.multiSortMeta.map(function (value) {
9979
+ _this.orderBy.field = value.field;
9980
+ _this.orderBy.direction = value.order === 1 ? exports.DirectionEnumeration.ASC : exports.DirectionEnumeration.DESC;
9981
+ });
9982
+ }
9983
+ if (arrList && arrList.length) {
9984
+ this.totalRecords = arrList.length;
9985
+ this.listData = arrList;
9986
+ this.listDataNoPage = __spread(arrList);
9987
+ this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9988
+ this.listData = this.listData.slice(first, (first + rows));
9989
+ }
9990
+ else {
9991
+ this.listDataNoPage = [];
9992
+ }
9993
+ if (this.isEditMode || arrList && arrList.length === 1) {
9994
+ this.refreshCssInIE11();
9995
+ }
9996
+ this.loading = false;
9997
+ };
9998
+ /**
9999
+ * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
10000
+ */
10001
+ HistoricalPixAccountComponent.prototype.refreshCssInIE11 = function () {
10002
+ if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
10003
+ setTimeout(function () {
10004
+ var row = document.getElementsByClassName("row0");
10005
+ if (row && row[0])
10006
+ row[0].className = 'refresh';
10007
+ }, 1);
10008
+ }
10009
+ };
10010
+ HistoricalPixAccountComponent.prototype.add = function () {
10011
+ this.pixAccountItemInput = {};
10012
+ this.visible = true;
10013
+ };
10014
+ HistoricalPixAccountComponent.prototype.addPix = function () {
10015
+ var newItem = {
10016
+ pixKeyType: {},
10017
+ pixKey: '',
10018
+ percentage: 0
10019
+ };
10020
+ this.addExistentHistoricData = __spread(this.addExistentHistoricData, [newItem]);
10021
+ };
10022
+ HistoricalPixAccountComponent.prototype.deletePix = function (index) {
10023
+ this.addExistentHistoricData = this.addExistentHistoricData.filter(function (_, i) { return i !== index; });
10024
+ };
10025
+ HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
10026
+ var newlist = __spread(this.getHistoricalPixAccountList());
10027
+ newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
10028
+ delete newlist[index];
10029
+ newlist = newlist.filter(function (val) { return val; });
10030
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
10031
+ this.verifyTotalPercentage();
10032
+ this.onLazyLoad();
10033
+ };
10034
+ HistoricalPixAccountComponent.prototype.getHistoricalPixAccountList = function () {
10035
+ if (this.historicalPixAccountList.get("historicalPixAccountList") &&
10036
+ this.historicalPixAccountList.get("historicalPixAccountList").value &&
10037
+ this.historicalPixAccountList.get("historicalPixAccountList").value.length)
10038
+ return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
10039
+ else
10040
+ return [];
10041
+ };
10042
+ HistoricalPixAccountComponent.prototype.addItemInList = function ($event) {
10043
+ var index = $event && $event.index >= 0 ? $event.index : null;
10044
+ var newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
10045
+ if (index != null) {
10046
+ newDataList[index] = $event;
10047
+ delete $event.index;
10048
+ }
10049
+ else {
10050
+ if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
10051
+ var customValue = mountCustomToSave($event["customFields"]);
10052
+ $event["customFields"] = __spread(customValue);
10053
+ }
10054
+ $event["dateChange"] = this.dateChange;
10055
+ newDataList.push($event);
10056
+ }
10057
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
10058
+ this.verifyTotalPercentage();
10059
+ this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
10060
+ };
10061
+ HistoricalPixAccountComponent.prototype.getNumberPageByIndex = function (index, list) {
10062
+ if (index) {
10063
+ var total = list.length;
10064
+ var sub = this.recordByRow - 1;
10065
+ return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
10066
+ }
10067
+ return null;
10068
+ };
10069
+ HistoricalPixAccountComponent.prototype.verifyTotalPercentage = function () {
10070
+ var list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
10071
+ var arrayPercentage = [];
10072
+ if (!list.length)
10073
+ return this.msgTotalLimitByPercentage = null;
10074
+ list.filter(function (item) { return arrayPercentage.push(item && item["percentage"]); });
10075
+ var sumPercentage = arrayPercentage.reduce(function (total, percentage) {
10076
+ return total + percentage;
10077
+ }, 0);
10078
+ if (sumPercentage === 100) {
10079
+ this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
10080
+ }
10081
+ else {
10082
+ this.msgTotalLimitByPercentage = null;
10083
+ }
10084
+ };
10085
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
9742
10086
  get: function () {
9743
- return (this.permission["incluir"]);
10087
+ return this.actions.bind(this);
9744
10088
  },
9745
10089
  enumerable: true,
9746
10090
  configurable: true
9747
10091
  });
9748
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToDeleteHistorical", {
10092
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
9749
10093
  get: function () {
9750
- return (this.permission["excluir"]);
10094
+ return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
9751
10095
  },
9752
10096
  enumerable: true,
9753
10097
  configurable: true
9754
10098
  });
9755
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToEditHistorical", {
10099
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "getTooltipAndDisableButtonAdd", {
9756
10100
  get: function () {
9757
- return (this.permission["editar"]);
10101
+ return this.dateChange ? null : this.msgTooltipAdd;
9758
10102
  },
9759
10103
  enumerable: true,
9760
10104
  configurable: true
9761
10105
  });
9762
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToViewHistorical", {
10106
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "dateChange", {
9763
10107
  get: function () {
9764
- return (this.permission["visualizar"]);
10108
+ return this._dateChange;
10109
+ },
10110
+ set: function (value) {
10111
+ var _this = this;
10112
+ this._dateChange = value;
10113
+ if (this._dateChange) {
10114
+ this.listData.filter(function (row) { return row["dateChange"] = _this._dateChange; });
10115
+ }
9765
10116
  },
9766
10117
  enumerable: true,
9767
10118
  configurable: true
9768
10119
  });
9769
- HistoricalPixAccountComponent.ctorParameters = function () { return [
9770
- { type: core$1.TranslateService },
9771
- { type: core.ChangeDetectorRef },
9772
- { type: forms.FormBuilder },
9773
- { type: api.MessageService }
9774
- ]; };
9775
- __decorate([
9776
- core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
9777
- ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
9778
- __decorate([
9779
- core.Input()
9780
- ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
9781
- __decorate([
9782
- core.Input()
9783
- ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
9784
- __decorate([
9785
- core.Input()
9786
- ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
9787
- __decorate([
9788
- core.Input()
9789
- ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
9790
- __decorate([
9791
- core.Input()
9792
- ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
9793
- __decorate([
9794
- core.Input()
9795
- ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
9796
- __decorate([
9797
- core.Input()
9798
- ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
9799
- __decorate([
9800
- core.Input()
9801
- ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
9802
- __decorate([
9803
- core.Input()
9804
- ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
9805
- __decorate([
9806
- core.Input()
9807
- ], HistoricalPixAccountComponent.prototype, "currency", void 0);
9808
- __decorate([
9809
- core.Input()
9810
- ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9811
- __decorate([
9812
- 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);
9844
- __decorate([
9845
- core.Input()
9846
- ], HistoricalPixAccountComponent.prototype, "addListData", null);
9847
- __decorate([
9848
- core.Input()
9849
- ], HistoricalPixAccountComponent.prototype, "visible", null);
9850
- HistoricalPixAccountComponent = __decorate([
9851
- 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",
9855
- 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
- })
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 };
10120
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
10121
+ get: function () {
10122
+ return this._displayDateChange;
10123
+ },
10124
+ set: function (value) {
10125
+ var _this = this;
10126
+ this._displayDateChange = value;
10127
+ if (this._displayDateChange) {
10128
+ this.listData.filter(function (row) { return row["displayDateChange"] = _this._displayDateChange; });
9943
10129
  }
9944
- }
9945
- return null;
10130
+ },
10131
+ enumerable: true,
10132
+ configurable: true
10133
+ });
10134
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "addListData", {
10135
+ set: function (list) {
10136
+ this.loading = true;
10137
+ this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
10138
+ this.verifyTotalPercentage();
10139
+ this.onLazyLoad();
10140
+ },
10141
+ enumerable: true,
10142
+ configurable: true
10143
+ });
10144
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
10145
+ get: function () {
10146
+ return this._visible;
10147
+ },
10148
+ set: function (value) {
10149
+ this._visible = value;
10150
+ this.visibleChange.emit(this.visible);
10151
+ },
10152
+ enumerable: true,
10153
+ configurable: true
10154
+ });
10155
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "paramsForm", {
10156
+ set: function (value) {
10157
+ this._paramsForm = value;
10158
+ },
10159
+ enumerable: true,
10160
+ configurable: true
10161
+ });
10162
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "defaultCpfNumber", {
10163
+ set: function (value) {
10164
+ this._defaultCpfNumber = value;
10165
+ },
10166
+ enumerable: true,
10167
+ configurable: true
10168
+ });
10169
+ HistoricalPixAccountComponent.prototype.close = function () {
10170
+ this.visible = false;
9946
10171
  };
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;
10172
+ HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
10173
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
10004
10174
  };
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 };
10175
+ HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
10176
+ return FormatUtilsService.getFormattedCpf(cpf);
10014
10177
  };
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 };
10178
+ HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
10179
+ return FormatUtilsService.getFormattedCnpj(cnpj);
10023
10180
  };
10024
- return GenericValidator;
10025
- }());
10026
-
10027
- var HistoricalPixAccountFormComponent = /** @class */ (function () {
10028
- function HistoricalPixAccountFormComponent(formBuilder, cd) {
10029
- this.formBuilder = formBuilder;
10030
- this.cd = cd;
10031
- this.withSideBar = true;
10032
- this.isEditMode = false;
10033
- this.paramsForm = new forms.FormGroup({});
10034
- this.defaultCpfNumber = null;
10035
- this.visibleChange = new core.EventEmitter();
10036
- this.pixAccountItemToList = new core.EventEmitter();
10037
- 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;
10044
- this.createFormGroup();
10045
- this.registerSubjects();
10046
- }
10047
- HistoricalPixAccountFormComponent.prototype.ngOnInit = function () {
10181
+ HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
10182
+ return FormatUtilsService.getFormattedPercentage(value);
10048
10183
  };
10184
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
10185
+ get: function () {
10186
+ return (this.permission["incluir"]);
10187
+ },
10188
+ enumerable: true,
10189
+ configurable: true
10190
+ });
10191
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToDeleteHistorical", {
10192
+ get: function () {
10193
+ return (this.permission["excluir"]);
10194
+ },
10195
+ enumerable: true,
10196
+ configurable: true
10197
+ });
10198
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToEditHistorical", {
10199
+ get: function () {
10200
+ return (this.permission["editar"]);
10201
+ },
10202
+ enumerable: true,
10203
+ configurable: true
10204
+ });
10205
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToViewHistorical", {
10206
+ get: function () {
10207
+ return (this.permission["visualizar"]);
10208
+ },
10209
+ enumerable: true,
10210
+ configurable: true
10211
+ });
10212
+ HistoricalPixAccountComponent.ctorParameters = function () { return [
10213
+ { type: core$1.TranslateService },
10214
+ { type: core.ChangeDetectorRef },
10215
+ { type: forms.FormBuilder },
10216
+ { type: api.MessageService },
10217
+ { type: SharedStateService },
10218
+ { type: HistoricalPixAccountService }
10219
+ ]; };
10220
+ __decorate([
10221
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
10222
+ ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
10223
+ __decorate([
10224
+ core.Input()
10225
+ ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
10226
+ __decorate([
10227
+ core.Input()
10228
+ ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
10229
+ __decorate([
10230
+ core.Input()
10231
+ ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
10232
+ __decorate([
10233
+ core.Input()
10234
+ ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
10235
+ __decorate([
10236
+ core.Input()
10237
+ ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
10238
+ __decorate([
10239
+ core.Input()
10240
+ ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
10241
+ __decorate([
10242
+ core.Input()
10243
+ ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
10244
+ __decorate([
10245
+ core.Input()
10246
+ ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
10247
+ __decorate([
10248
+ core.Input()
10249
+ ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
10250
+ __decorate([
10251
+ core.Input()
10252
+ ], HistoricalPixAccountComponent.prototype, "currency", void 0);
10253
+ __decorate([
10254
+ core.Input()
10255
+ ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
10256
+ __decorate([
10257
+ core.Input()
10258
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
10259
+ __decorate([
10260
+ core.Input()
10261
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
10262
+ __decorate([
10263
+ core.Input()
10264
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
10265
+ __decorate([
10266
+ core.Input()
10267
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
10268
+ __decorate([
10269
+ core.Input()
10270
+ ], HistoricalPixAccountComponent.prototype, "addExistentHistoricData", void 0);
10271
+ __decorate([
10272
+ core.Input()
10273
+ ], HistoricalPixAccountComponent.prototype, "getListPixAccount", void 0);
10274
+ __decorate([
10275
+ core.Output()
10276
+ ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
10277
+ __decorate([
10278
+ core.Output()
10279
+ ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
10280
+ __decorate([
10281
+ core.Output()
10282
+ ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
10283
+ __decorate([
10284
+ core.Input()
10285
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
10286
+ __decorate([
10287
+ core.Input()
10288
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
10289
+ __decorate([
10290
+ core.Input()
10291
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
10292
+ __decorate([
10293
+ core.Input()
10294
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
10295
+ __decorate([
10296
+ core.Input()
10297
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", null);
10298
+ __decorate([
10299
+ core.Input()
10300
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", null);
10301
+ HistoricalPixAccountComponent = __decorate([
10302
+ core.Component({
10303
+ // tslint:disable-next-line:component-selector
10304
+ selector: "c-historical-pix-account",
10305
+ 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 *ngIf=\"!showEditMode || !(hideFields | async)\" 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=\"showButtonView\" [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=\"showButtonView\" 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 && showButtonView\">\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\n<div *ngIf=\"showEditMode && (hideFields | async)\" class=\"ui-g-12\">\n <!-- Bot\u00E3o Adicionar -->\n <div class=\"ui-g\">\n <div class=\"ui-g-12\">\n <s-button id=\"btn-save\" label=\"Adicionar\" priority=\"primary\" (onClick)=\"addPix()\"></s-button>\n </div>\n </div>\n\n <!-- Tabela -->\n <p-table #dataListPix sortField=\"percentage\"\n [columns]=\"cols\"\n [value]=\"addExistentHistoricData\"\n [pageLinks]=\"3\"\n [paginator]=\"true\"\n [responsive]=\"true\"\n [rows]=\"10\"\n [resetPageOnSort]=\"false\"\n [tableStyle]=\"{'margin-top': '2rem'}\"\n [customSort]=\"true\">\n <ng-template pTemplate=\"header\" let-columns>\n <tr>\n <th *ngFor=\"let col of cols\" [pSortableColumn]=\"col.orderBy\">\n {{ col.label }}\n <p-sortIcon *ngIf=\"col.orderBy\" [field]=\"col.orderBy\"></p-sortIcon>\n </th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-item let-rowIndex=\"rowIndex\">\n <tr>\n <!-- Tipo de Chave -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.pixKeyType\" pEditableColumnField=\"pixKeyType\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <div style=\"width: 100%; position: relative;\">\n <p-autoComplete\n [suggestions]=\"suggestions\"\n (completeMethod)=\"filterPixKeyType($event)\"\n [(ngModel)]=\"item.pixKeyType\"\n [formControl]=\"pixAccountFormGroup.get('pixKeyType')\"\n [dropdown]=\"true\"\n field=\"value\"\n placeholder=\"Selecione o tipo de chave\"\n appendTo=\"body\"\n [panelStyle]=\"{ maxWidth: '300px', width: '100%' }\"\n [inputStyle]=\"{ width: '100%' }\"\n >\n </p-autoComplete>\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 </ng-template>\n <ng-template pTemplate=\"output\">\n {{ item.pixKeyType?.value }}\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Chave Pix -->\n <td class=\"ui-md-6 ui-sm-12 required\" [pEditableColumn]=\"item.pixKey\" pEditableColumnField=\"pixKey\"\n [ngClass]=\"{'required': item.pixKeyType.key !== 'BANK_ACCOUNT'}\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <ng-container [ngSwitch]=\"item.pixKeyType.key\">\n <!-- TELEPHONE -->\n <input *ngSwitchCase=\"'TELEPHONE'\"\n only-number\n pInputText\n type=\"text\"\n [(ngModel)]=\"item.pixKey\"\n [formControl]=\"pixAccountFormGroup.get('pixKey')\"\n (keyup)=\"phoneMask($event)\"\n maxlength=\"15\"\n placeholder=\"(__) ____-____\"/>\n\n <!-- CPF -->\n <p-inputMask *ngSwitchCase=\"'CPF'\"\n [(ngModel)]=\"item.pixKey\"\n [formControl]=\"pixAccountFormGroup.get('pixKey')\"\n placeholder=\"___.___.___-__\"\n mask=\"999.999.999-99\"\n [unmask]=\"true\">\n </p-inputMask>\n\n <!-- CNPJ -->\n <p-inputMask *ngSwitchCase=\"'CNPJ'\"\n [(ngModel)]=\"item.pixKey\"\n [formControl]=\"pixAccountFormGroup.get('pixKey')\"\n placeholder=\"__.___.___/____-__\"\n mask=\"99.999.999/9999-99\"\n [unmask]=\"true\">\n </p-inputMask>\n\n <!-- EMAIL -->\n <input *ngSwitchCase=\"'EMAIL'\"\n pInputText\n type=\"email\"\n [(ngModel)]=\"item.pixKey\"\n [formControl]=\"pixAccountFormGroup.get('pixKey')\"\n placeholder=\"{{'hcm.payroll.employees_addition_email' | translate}}\"/>\n\n <!-- BANK_ACCOUNT -->\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\"\n pInputText\n [(ngModel)]=\"item.pixKey\"\n [formControl]=\"pixAccountFormGroup.get('pixKey')\"\n [disabled]=\"true\"/>\n\n <!-- DEFAULT -->\n <input *ngSwitchDefault\n pInputText\n type=\"text\"\n [(ngModel)]=\"item.pixKey\"\n [formControl]=\"pixAccountFormGroup.get('pixKey')\"\n maxlength=\"100\"/>\n </ng-container>\n\n <!-- Error messages -->\n <s-control-errors *ngIf=\"isShowPixKeyFieldValidatorMessage\"\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 </ng-template>\n\n <ng-template pTemplate=\"output\">\n {{ item.pixKey }}\n </ng-template>\n </p-cellEditor>\n </td>\n\n\n <!-- Percentual -->\n <td class=\"ui-md-6 ui-sm-12 required\" [pEditableColumn]=\"item.percentage\" pEditableColumnField=\"percentage\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <input pInputText type=\"number\" [(ngModel)]=\"item.percentage\" [formControl]=\"pixAccountFormGroup.get('percentage')\">\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 </ng-template>\n <ng-template pTemplate=\"output\">\n {{ item.percentage }}%\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Bot\u00E3o de excluir -->\n <td>\n <s-button id=\"btn-delete\" label=\"Excluir\" priority=\"default\" (onClick)=\"deletePix(rowIndex)\"></s-button>\n </td>\n </tr>\n </ng-template>\n </p-table>\n</div>\n",
10306
+ 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}"]
10307
+ })
10308
+ ], HistoricalPixAccountComponent);
10309
+ return HistoricalPixAccountComponent;
10310
+ }(HistoricakPixAccountBase));
10311
+
10312
+ var HistoricalPixAccountFormComponent = /** @class */ (function (_super) {
10313
+ __extends(HistoricalPixAccountFormComponent, _super);
10314
+ function HistoricalPixAccountFormComponent(formBuilder, cd, sharedStateService) {
10315
+ var _this = _super.call(this, formBuilder) || this;
10316
+ _this.cd = cd;
10317
+ _this.sharedStateService = sharedStateService;
10318
+ _this.withSideBar = true;
10319
+ _this.isEditMode = false;
10320
+ _this.visibleChange = new core.EventEmitter();
10321
+ _this.pixAccountItemToList = new core.EventEmitter();
10322
+ _this.ngUnsubscribe = new rxjs.Subject();
10323
+ _this.labelBtnAdd = "hcm.payroll.employees_add";
10324
+ _this.visibleBtnSave = true;
10325
+ _this.isView = false;
10326
+ _this.isShowPixKeyFieldValidatorMessage = false;
10327
+ _this.hideFields = _this.sharedStateService.hideField$;
10328
+ _this.registerSubjects();
10329
+ return _this;
10330
+ }
10331
+ HistoricalPixAccountFormComponent.prototype.ngOnInit = function () { };
10049
10332
  HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
10050
10333
  this.cd.detectChanges();
10051
10334
  };
@@ -10053,38 +10336,7 @@
10053
10336
  this.ngUnsubscribe.next(true);
10054
10337
  this.ngUnsubscribe.unsubscribe();
10055
10338
  };
10056
- HistoricalPixAccountFormComponent.prototype.registerSubjects = function () {
10057
- };
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),
10071
- });
10072
- };
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();
10081
- }
10082
- }
10083
- };
10084
- HistoricalPixAccountFormComponent.prototype.onClearPixKeyType = function () {
10085
- this.isShowPixKeyFieldValidatorMessage = false;
10086
- this.pixAccountFormGroup.get("pixKey").reset();
10087
- };
10339
+ HistoricalPixAccountFormComponent.prototype.registerSubjects = function () { };
10088
10340
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
10089
10341
  get: function () {
10090
10342
  return this._visible;
@@ -10123,7 +10375,8 @@
10123
10375
  });
10124
10376
  HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
10125
10377
  if (this.pixKeyType === "TELEPHONE") {
10126
- this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
10378
+ var pixKeyCtrl = this.pixAccountFormGroup.get("pixKey");
10379
+ pixKeyCtrl.setValue(FormatUtilsService.getFormattedTelephoneNumber(pixKeyCtrl.value));
10127
10380
  }
10128
10381
  };
10129
10382
  HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
@@ -10142,7 +10395,7 @@
10142
10395
  "pixKeyType",
10143
10396
  "pixKey",
10144
10397
  "percentage",
10145
- "customFields",
10398
+ "customFields"
10146
10399
  ], []);
10147
10400
  };
10148
10401
  HistoricalPixAccountFormComponent.prototype.close = function () {
@@ -10156,7 +10409,7 @@
10156
10409
  if (this.employeeId) {
10157
10410
  this.pixAccountFormGroup.get("employee").setValue({
10158
10411
  tableId: this.employeeId,
10159
- name: "",
10412
+ name: ""
10160
10413
  });
10161
10414
  }
10162
10415
  this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
@@ -10188,14 +10441,10 @@
10188
10441
  return {
10189
10442
  prefix: "",
10190
10443
  thousands: this.currency.thousandsSeparator,
10191
- decimal: this.currency.decimalSeparator,
10444
+ decimal: this.currency.decimalSeparator
10192
10445
  };
10193
10446
  };
10194
10447
  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
10448
  set: function (pixAccountList) {
10200
10449
  if (pixAccountList) {
10201
10450
  this.setValidatorsAccordingList(pixAccountList, null, false);
@@ -10207,85 +10456,6 @@
10207
10456
  enumerable: true,
10208
10457
  configurable: true
10209
10458
  });
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
10459
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10290
10460
  set: function (condition) {
10291
10461
  this.isView = !!(condition && !this.withSideBar);
@@ -10296,58 +10466,24 @@
10296
10466
  enumerable: true,
10297
10467
  configurable: true
10298
10468
  });
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
- };
10469
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "paramsForm", {
10470
+ set: function (value) {
10471
+ this._paramsForm = value;
10472
+ },
10473
+ enumerable: true,
10474
+ configurable: true
10475
+ });
10476
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", {
10477
+ set: function (value) {
10478
+ this._defaultCpfNumber = value;
10479
+ },
10480
+ enumerable: true,
10481
+ configurable: true
10482
+ });
10348
10483
  HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10349
10484
  { type: forms.FormBuilder },
10350
- { type: core.ChangeDetectorRef }
10485
+ { type: core.ChangeDetectorRef },
10486
+ { type: SharedStateService }
10351
10487
  ]; };
10352
10488
  __decorate([
10353
10489
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: true })
@@ -10367,12 +10503,6 @@
10367
10503
  __decorate([
10368
10504
  core.Input()
10369
10505
  ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
10370
- __decorate([
10371
- core.Input()
10372
- ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
10373
- __decorate([
10374
- core.Input()
10375
- ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
10376
10506
  __decorate([
10377
10507
  core.Output()
10378
10508
  ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
@@ -10391,32 +10521,21 @@
10391
10521
  __decorate([
10392
10522
  core.Input()
10393
10523
  ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
10524
+ __decorate([
10525
+ core.Input()
10526
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", null);
10527
+ __decorate([
10528
+ core.Input()
10529
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", null);
10394
10530
  HistoricalPixAccountFormComponent = __decorate([
10395
10531
  core.Component({
10396
10532
  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",
10533
+ template: "<div id=\"main\">\n <form *ngIf=\"!(hideFields | async)\" [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",
10398
10534
  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
10535
  })
10400
10536
  ], HistoricalPixAccountFormComponent);
10401
10537
  return HistoricalPixAccountFormComponent;
10402
- }());
10403
-
10404
- var HistoricalPixAccountService = /** @class */ (function () {
10405
- function HistoricalPixAccountService(http) {
10406
- this.http = http;
10407
- }
10408
- HistoricalPixAccountService.prototype.query = function (path, body, service) {
10409
- if (service === void 0) { service = exports.ServiceType.PAYROLL; }
10410
- return this.http.query(path, body, service);
10411
- };
10412
- HistoricalPixAccountService.ctorParameters = function () { return [
10413
- { type: HttpClientService }
10414
- ]; };
10415
- HistoricalPixAccountService = __decorate([
10416
- core.Injectable()
10417
- ], HistoricalPixAccountService);
10418
- return HistoricalPixAccountService;
10419
- }());
10538
+ }(HistoricakPixAccountBase));
10420
10539
 
10421
10540
  var HistoricalPixAccountModule = /** @class */ (function () {
10422
10541
  function HistoricalPixAccountModule() {
@@ -10446,6 +10565,8 @@
10446
10565
  angularComponents.CustomFieldsModule,
10447
10566
  panel.PanelModule,
10448
10567
  inputmask.InputMaskModule,
10568
+ dropdown.DropdownModule,
10569
+ tabview.TabViewModule,
10449
10570
  ],
10450
10571
  declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
10451
10572
  providers: [HistoricalPixAccountService, api.ConfirmationService],
@@ -10488,7 +10609,7 @@
10488
10609
 
10489
10610
  var moment$e = moment_;
10490
10611
  var HistoricalPixAccountListComponent = /** @class */ (function () {
10491
- function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService) {
10612
+ function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService, sharedStateService) {
10492
10613
  this.confirmationService = confirmationService;
10493
10614
  this.translateService = translateService;
10494
10615
  this.activatedRoute = activatedRoute;
@@ -10496,12 +10617,14 @@
10496
10617
  this.router = router;
10497
10618
  this.messageService = messageService;
10498
10619
  this.historicalPixAccountListService = historicalPixAccountListService;
10620
+ this.sharedStateService = sharedStateService;
10499
10621
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
10500
10622
  this.keyPayload = "historicalEmployeePix";
10501
10623
  this.withSidebar = true;
10502
10624
  this.isOnlyView = new core.EventEmitter();
10503
10625
  this.isOnlyEdit = new core.EventEmitter();
10504
10626
  this.enableView = new core.EventEmitter();
10627
+ this.isEditJudicialDependentPix = new core.EventEmitter();
10505
10628
  this.ngUnsubscribe = new rxjs.Subject();
10506
10629
  this.loading = true;
10507
10630
  this.columns = [
@@ -10521,6 +10644,7 @@
10521
10644
  HistoricalPixAccountListComponent.prototype.ngOnDestroy = function () {
10522
10645
  this.ngUnsubscribe.next();
10523
10646
  this.ngUnsubscribe.complete();
10647
+ this.unsubscribe();
10524
10648
  };
10525
10649
  HistoricalPixAccountListComponent.prototype.ngAfterViewInit = function () {
10526
10650
  this.cd.detectChanges();
@@ -10540,6 +10664,9 @@
10540
10664
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
10541
10665
  command: function () {
10542
10666
  if (_this.isAllowToViewHistorical) {
10667
+ _this.sharedStateService.setHideField(true);
10668
+ _this.sharedStateService.setShowButton(false);
10669
+ _this.sharedStateService.setShowEditMode(false);
10543
10670
  var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
10544
10671
  if (_this.withSidebar) {
10545
10672
  _this.isOnlyView.emit(true);
@@ -10548,6 +10675,7 @@
10548
10675
  });
10549
10676
  }
10550
10677
  else {
10678
+ _this.sharedStateService.setSaveButton(false);
10551
10679
  _this.enableView.emit(dateChange);
10552
10680
  }
10553
10681
  }
@@ -10560,15 +10688,17 @@
10560
10688
  label: this.translateService.instant("hcm.payroll.edit"),
10561
10689
  command: function () {
10562
10690
  if (_this.isAllowToEditHistorical) {
10691
+ _this.sharedStateService.setHideField(true);
10692
+ _this.sharedStateService.setShowButton(false);
10693
+ _this.sharedStateService.setShowEditMode(true);
10563
10694
  var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
10564
10695
  if (_this.withSidebar) {
10565
- _this.isOnlyView.emit(false);
10566
- _this.isOnlyEdit.emit(true);
10567
10696
  _this.router.navigate(["historical-pix-account/" + dateChange], {
10568
10697
  relativeTo: _this.activatedRoute,
10569
10698
  });
10570
10699
  }
10571
10700
  else {
10701
+ _this.sharedStateService.setSaveButton(true);
10572
10702
  _this.enableView.emit(dateChange);
10573
10703
  }
10574
10704
  }
@@ -10654,6 +10784,24 @@
10654
10784
  this.lastRecord = payload[0];
10655
10785
  }
10656
10786
  };
10787
+ HistoricalPixAccountListComponent.prototype.unsubscribe = function () {
10788
+ if (this._subscription) {
10789
+ this._subscription.unsubscribe();
10790
+ }
10791
+ };
10792
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", {
10793
+ set: function (subject) {
10794
+ var _this = this;
10795
+ this.unsubscribe();
10796
+ if (subject) {
10797
+ this._subscription = subject.subscribe(function (value) {
10798
+ _this.sharedStateService.setHideField(value);
10799
+ });
10800
+ }
10801
+ },
10802
+ enumerable: true,
10803
+ configurable: true
10804
+ });
10657
10805
  Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToAddHistorical", {
10658
10806
  get: function () {
10659
10807
  return (this.permission["incluir"]);
@@ -10706,7 +10854,8 @@
10706
10854
  { type: core.ChangeDetectorRef },
10707
10855
  { type: router.Router },
10708
10856
  { type: api.MessageService },
10709
- { type: HistoricalPixAccountListService }
10857
+ { type: HistoricalPixAccountListService },
10858
+ { type: SharedStateService }
10710
10859
  ]; };
10711
10860
  __decorate([
10712
10861
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
@@ -10732,6 +10881,9 @@
10732
10881
  __decorate([
10733
10882
  core.Input()
10734
10883
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
10884
+ __decorate([
10885
+ core.Input()
10886
+ ], HistoricalPixAccountListComponent.prototype, "hideField", void 0);
10735
10887
  __decorate([
10736
10888
  core.Output()
10737
10889
  ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
@@ -10741,6 +10893,12 @@
10741
10893
  __decorate([
10742
10894
  core.Output()
10743
10895
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
10896
+ __decorate([
10897
+ core.Output()
10898
+ ], HistoricalPixAccountListComponent.prototype, "isEditJudicialDependentPix", void 0);
10899
+ __decorate([
10900
+ core.Input()
10901
+ ], HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", null);
10744
10902
  __decorate([
10745
10903
  core.Input()
10746
10904
  ], HistoricalPixAccountListComponent.prototype, "reloadList", null);
@@ -10863,6 +11021,7 @@
10863
11021
  exports.PermissionService = PermissionService;
10864
11022
  exports.ReportService = ReportService;
10865
11023
  exports.ServicesModule = ServicesModule;
11024
+ exports.SharedStateService = SharedStateService;
10866
11025
  exports.SpinnerLoaderComponent = SpinnerLoaderComponent;
10867
11026
  exports.SpinnerLoaderModule = SpinnerLoaderModule;
10868
11027
  exports.StringMethods = StringMethods;
@@ -10958,7 +11117,8 @@
10958
11117
  exports.ɵo = AutocompleteService;
10959
11118
  exports.ɵp = LookupService$1;
10960
11119
  exports.ɵq = HistoricalBankAccountFormComponent;
10961
- exports.ɵr = HistoricalPixAccountFormComponent;
11120
+ exports.ɵr = HistoricakPixAccountBase;
11121
+ exports.ɵs = HistoricalPixAccountFormComponent;
10962
11122
 
10963
11123
  Object.defineProperty(exports, '__esModule', { value: true });
10964
11124