@senior-gestao-pessoas/payroll-core 9.4.0-f9d3c09b-0079-4f7c-94cf-dd79338e7089 → 9.5.0-d4960af2-4da8-48bf-aac1-4d553cb625ef

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 (42) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +1192 -778
  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 +27 -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 +38 -8
  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 +10 -1
  10. package/components/shared/index.d.ts +1 -0
  11. package/components/shared/shared-state.service.d.ts +14 -0
  12. package/components/utils/format-utils/format-utils.service.d.ts +30 -3
  13. package/esm2015/components/historical-pix-account/historical-pix-account-base.js +173 -0
  14. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +29 -187
  15. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +223 -20
  16. package/esm2015/components/historical-pix-account/historical-pix-account.module.js +5 -1
  17. package/esm2015/components/historical-pix-account/historical-pix-account.service.js +8 -1
  18. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.component.js +42 -4
  19. package/esm2015/components/shared/index.js +2 -0
  20. package/esm2015/components/shared/shared-state.service.js +36 -0
  21. package/esm2015/components/utils/format-utils/format-utils.service.js +88 -5
  22. package/esm2015/public_api.js +2 -1
  23. package/esm2015/senior-gestao-pessoas-payroll-core.js +3 -2
  24. package/esm5/components/historical-pix-account/historical-pix-account-base.js +186 -0
  25. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +53 -201
  26. package/esm5/components/historical-pix-account/historical-pix-account.component.js +265 -49
  27. package/esm5/components/historical-pix-account/historical-pix-account.module.js +5 -1
  28. package/esm5/components/historical-pix-account/historical-pix-account.service.js +8 -1
  29. package/esm5/components/historical-pix-account-list/historical-pix-account-list.component.js +47 -4
  30. package/esm5/components/shared/index.js +2 -0
  31. package/esm5/components/shared/shared-state.service.js +37 -0
  32. package/esm5/components/utils/format-utils/format-utils.service.js +88 -5
  33. package/esm5/public_api.js +2 -1
  34. package/esm5/senior-gestao-pessoas-payroll-core.js +3 -2
  35. package/fesm2015/senior-gestao-pessoas-payroll-core.js +851 -478
  36. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  37. package/fesm5/senior-gestao-pessoas-payroll-core.js +1188 -775
  38. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  39. package/package.json +2 -32
  40. package/public_api.d.ts +1 -0
  41. package/senior-gestao-pessoas-payroll-core.d.ts +2 -1
  42. 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
 
@@ -9339,6 +9339,25 @@
9339
9339
  }
9340
9340
  return null;
9341
9341
  };
9342
+ /**
9343
+ * Retorna o CPF formatado
9344
+ * @param cpf CPF
9345
+ */
9346
+ FormatUtilsService.getFormattedCpfEdited = function (cpf) {
9347
+ if (!cpf)
9348
+ return '';
9349
+ cpf = cpf.replace(/\D/g, '').slice(0, 11);
9350
+ if (cpf.length > 9) {
9351
+ cpf = cpf.replace(/^(\d{3})(\d{3})(\d{3})(\d{2})$/, "$1.$2.$3-$4");
9352
+ }
9353
+ else if (cpf.length > 6) {
9354
+ cpf = cpf.replace(/^(\d{3})(\d{3})(\d{0,3})$/, "$1.$2.$3");
9355
+ }
9356
+ else if (cpf.length > 3) {
9357
+ cpf = cpf.replace(/^(\d{3})(\d{0,3})$/, "$1.$2");
9358
+ }
9359
+ return cpf;
9360
+ };
9342
9361
  /**
9343
9362
  * Retorna o CNPJ formatado
9344
9363
  * @param cnpj CNPJ
@@ -9354,6 +9373,28 @@
9354
9373
  }
9355
9374
  return null;
9356
9375
  };
9376
+ /**
9377
+ * Retorna o CNPJ formatado
9378
+ * @param cnpj CNPJ
9379
+ */
9380
+ FormatUtilsService.getFormattedCnpjEdited = function (cnpj) {
9381
+ if (!cnpj)
9382
+ return '';
9383
+ cnpj = cnpj.replace(/\D/g, '').slice(0, 14);
9384
+ if (cnpj.length > 12) {
9385
+ cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5");
9386
+ }
9387
+ else if (cnpj.length > 8) {
9388
+ cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{3})(\d{0,4})$/, "$1.$2.$3/$4");
9389
+ }
9390
+ else if (cnpj.length > 5) {
9391
+ cnpj = cnpj.replace(/^(\d{2})(\d{3})(\d{0,3})$/, "$1.$2.$3");
9392
+ }
9393
+ else if (cnpj.length > 2) {
9394
+ cnpj = cnpj.replace(/^(\d{2})(\d{0,3})$/, "$1.$2");
9395
+ }
9396
+ return cnpj;
9397
+ };
9357
9398
  /**
9358
9399
  * Retorna a mascara do CPF/CNPJ
9359
9400
  * @param key Valores possíveis são CPF ou CNPJ
@@ -9368,6 +9409,24 @@
9368
9409
  return "";
9369
9410
  }
9370
9411
  };
9412
+ /**
9413
+ * Método para formatar o número de inscrição do cliente.
9414
+ * @param subscriptionNumber
9415
+ * @param pixKeyType
9416
+ * @returns
9417
+ */
9418
+ FormatUtilsService.getFormattedSubscriptionNumber = function (subscriptionNumber, pixKeyType) {
9419
+ if (!subscriptionNumber || !pixKeyType)
9420
+ return subscriptionNumber;
9421
+ switch (pixKeyType) {
9422
+ case 'CNPJ':
9423
+ return this.getFormattedCnpjEdited(subscriptionNumber);
9424
+ case 'CPF':
9425
+ return this.getFormattedCpfEdited(subscriptionNumber);
9426
+ default:
9427
+ return subscriptionNumber;
9428
+ }
9429
+ };
9371
9430
  /**
9372
9431
  * Metódo para formatar o número de telefone.
9373
9432
  * @param telephoneNumber String contendo o número de telefone.
@@ -9399,6 +9458,13 @@
9399
9458
  }
9400
9459
  return tel;
9401
9460
  };
9461
+ /**
9462
+ * Metódo para formatar a porcentagem para 2 casas decimais.
9463
+ * @param value Número a ser formatado.
9464
+ */
9465
+ FormatUtilsService.getFormattedPercentage = function (value) {
9466
+ return parseFloat(value).toFixed(2).replace('.', ',') + '%';
9467
+ };
9402
9468
  /**
9403
9469
  * Metódo para formatar o número de telefone de um campo Input.
9404
9470
  * @param event Evento do Input do campo de telefone.
@@ -9412,640 +9478,1106 @@
9412
9478
  event.target.value = FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9413
9479
  };
9414
9480
  /**
9415
- * Metódo para formatar a porcentagem para 2 casas decimais.
9416
- * @param value Número a ser formatado.
9481
+ * Formata o campo de input de CPF em tempo real.
9482
+ * @param event Evento do input
9417
9483
  */
9418
- FormatUtilsService.getFormattedPercentage = function (value) {
9419
- return parseFloat(value).toFixed(2).replace('.', ',') + '%';
9484
+ FormatUtilsService.formatCpfInputEvent = function (event) {
9485
+ var cpf = event.target.value;
9486
+ // Permite apagar nos pontos sensíveis
9487
+ if (event.keyCode === 8 && (cpf.length === 4 || cpf.length === 8 || cpf.length === 12)) {
9488
+ return;
9489
+ }
9490
+ event.target.value = FormatUtilsService.getFormattedCpfEdited(cpf);
9491
+ };
9492
+ /**
9493
+ * Formata o campo de input de CNPJ em tempo real.
9494
+ * @param event Evento do input
9495
+ */
9496
+ FormatUtilsService.formatCnpjInputEvent = function (event) {
9497
+ var cnpj = event.target.value;
9498
+ // Permite apagar nos pontos sensíveis
9499
+ if (event.keyCode === 8 && (cnpj.length === 3 || cnpj.length === 7 || cnpj.length === 11 || cnpj.length === 16)) {
9500
+ return;
9501
+ }
9502
+ event.target.value = FormatUtilsService.getFormattedCnpjEdited(cnpj);
9420
9503
  };
9421
9504
  return FormatUtilsService;
9422
9505
  }());
9423
9506
 
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();
9507
+ var SharedStateService = /** @class */ (function () {
9508
+ function SharedStateService() {
9509
+ this.hideFieldSubject = new rxjs.BehaviorSubject(true);
9510
+ this.hideField$ = this.hideFieldSubject.asObservable();
9511
+ this.showButtonSubject = new rxjs.BehaviorSubject(true);
9512
+ this.showButton$ = this.showButtonSubject.asObservable();
9513
+ this.saveButtonSubject = new rxjs.BehaviorSubject(true);
9514
+ this.saveButton$ = this.saveButtonSubject.asObservable();
9515
+ this.showEditMode = new rxjs.BehaviorSubject(true);
9516
+ this.showEditMode$ = this.showEditMode.asObservable();
9524
9517
  }
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
- }
9518
+ SharedStateService.prototype.setHideField = function (value) {
9519
+ this.hideFieldSubject.next(value);
9532
9520
  };
9533
- HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9534
- this.historicalPixAccountList = this.formBuilder.group({
9535
- historicalPixAccountList: this.formBuilder.control(null),
9536
- });
9521
+ SharedStateService.prototype.setShowButton = function (value) {
9522
+ this.showButtonSubject.next(value);
9537
9523
  };
9538
- HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
9539
- this.ngUnsubscribe.next();
9540
- this.ngUnsubscribe.complete();
9524
+ SharedStateService.prototype.setSaveButton = function (value) {
9525
+ this.saveButtonSubject.next(value);
9541
9526
  };
9542
- HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9543
- this.cd.detectChanges();
9527
+ SharedStateService.prototype.setShowEditMode = function (value) {
9528
+ this.showEditMode.next(value);
9544
9529
  };
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
- }
9530
+ SharedStateService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function SharedStateService_Factory() { return new SharedStateService(); }, token: SharedStateService, providedIn: "root" });
9531
+ SharedStateService = __decorate([
9532
+ core.Injectable({
9533
+ providedIn: 'root',
9534
+ })
9535
+ ], SharedStateService);
9536
+ return SharedStateService;
9537
+ }());
9538
+
9539
+ var GenericValidator = /** @class */ (function () {
9540
+ function GenericValidator() {
9541
+ }
9542
+ /**
9543
+ * Valida o CEI (Cadastro específico de INSS) digitado.
9544
+ */
9545
+ GenericValidator.isValidCei = function (control) {
9546
+ var cei = control.value;
9547
+ if (!cei)
9548
+ return null;
9549
+ else if (cei.length != 11)
9550
+ return null;
9551
+ var multiplicadorBase = "3298765432";
9552
+ var total = 0;
9553
+ var resto = 0;
9554
+ var multiplicando = 0;
9555
+ var multiplicador = 0;
9556
+ if (cei.length !== 11 ||
9557
+ cei === "00000000000" ||
9558
+ cei === "11111111111" ||
9559
+ cei === "22222222222" ||
9560
+ cei === "33333333333" ||
9561
+ cei === "44444444444" ||
9562
+ cei === "55555555555" ||
9563
+ cei === "66666666666" ||
9564
+ cei === "77777777777" ||
9565
+ cei === "88888888888" ||
9566
+ cei === "99999999999")
9567
+ return { invalidCei: true };
9565
9568
  else {
9566
- this.listDataNoPage = [];
9567
- }
9568
- if (this.isEditMode || arrList && arrList.length === 1) {
9569
- this.refreshCssInIE11();
9569
+ for (var i = 0; i < 10; i++) {
9570
+ multiplicando = parseInt(cei.substring(i, i + 1), 10);
9571
+ multiplicador = parseInt(multiplicadorBase.substring(i, i + 1), 10);
9572
+ total += multiplicando * multiplicador;
9573
+ }
9574
+ resto = 11 - (total % 11);
9575
+ resto = resto === 10 || resto === 11 ? 0 : resto;
9576
+ var digito = parseInt("" + cei.charAt(10), 10);
9577
+ return resto === digito ? null : { invalidCei: true };
9570
9578
  }
9571
- this.loading = false;
9572
9579
  };
9573
9580
  /**
9574
- * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
9581
+ * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9575
9582
  */
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);
9583
- }
9584
- };
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);
9583
+ GenericValidator.isValidCpf = function (control) {
9584
+ var cpf = control.value;
9585
+ if (cpf) {
9586
+ var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9587
+ equalDigits = 1;
9588
+ if (cpf.length < 11) {
9589
+ return null;
9590
+ }
9591
+ for (i = 0; i < cpf.length - 1; i++) {
9592
+ if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9593
+ equalDigits = 0;
9594
+ break;
9595
+ }
9596
+ }
9597
+ if (!equalDigits) {
9598
+ numbers = cpf.substring(0, 9);
9599
+ digits = cpf.substring(9);
9600
+ sum = 0;
9601
+ for (i = 10; i > 1; i--) {
9602
+ sum += numbers.charAt(10 - i) * i;
9603
+ }
9604
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9605
+ if (result !== Number(digits.charAt(0))) {
9606
+ return { cpfNotValid: true };
9607
+ }
9608
+ numbers = cpf.substring(0, 10);
9609
+ sum = 0;
9610
+ for (i = 11; i > 1; i--) {
9611
+ sum += numbers.charAt(11 - i) * i;
9612
+ }
9613
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9614
+ if (result !== Number(digits.charAt(1))) {
9615
+ return { cpfNotValid: true };
9616
+ }
9617
+ return null;
9618
+ }
9619
+ else {
9620
+ return { cpfNotValid: true };
9624
9621
  }
9625
- $event["dateChange"] = this.dateChange;
9626
- newDataList.push($event);
9627
9622
  }
9628
- this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9629
- this.verifyTotalPercentage();
9630
- this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
9623
+ return null;
9631
9624
  };
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;
9625
+ /**
9626
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9627
+ */
9628
+ GenericValidator.isValidCnpj = function (control) {
9629
+ var cnpj = control.value;
9630
+ if (cnpj) {
9631
+ var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9632
+ cnpj = cnpj.replace(/[^\d]+/g, '');
9633
+ if (cnpj.length !== 14) {
9634
+ return null;
9635
+ }
9636
+ // Elimina CNPJs invalidos conhecidos
9637
+ if (cnpj === '00000000000000' ||
9638
+ cnpj === '11111111111111' ||
9639
+ cnpj === '22222222222222' ||
9640
+ cnpj === '33333333333333' ||
9641
+ cnpj === '44444444444444' ||
9642
+ cnpj === '55555555555555' ||
9643
+ cnpj === '66666666666666' ||
9644
+ cnpj === '77777777777777' ||
9645
+ cnpj === '88888888888888' ||
9646
+ cnpj === '99999999999999') {
9647
+ return { cnpjNotValid: true };
9648
+ }
9649
+ // Valida DVs
9650
+ size = cnpj.length - 2;
9651
+ numbers = cnpj.substring(0, size);
9652
+ digits = cnpj.substring(size);
9653
+ sum = 0;
9654
+ pos = size - 7;
9655
+ for (var i = size; i >= 1; i--) {
9656
+ sum += numbers.charAt(size - i) * pos--;
9657
+ if (pos < 2) {
9658
+ pos = 9;
9659
+ }
9660
+ }
9661
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9662
+ if (result !== Number(digits.charAt(0))) {
9663
+ return { cnpjNotValid: true };
9664
+ }
9665
+ size = size + 1;
9666
+ numbers = cnpj.substring(0, size);
9667
+ sum = 0;
9668
+ pos = size - 7;
9669
+ for (var i = size; i >= 1; i--) {
9670
+ sum += numbers.charAt(size - i) * pos--;
9671
+ if (pos < 2) {
9672
+ pos = 9;
9673
+ }
9674
+ }
9675
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9676
+ if (result !== Number(digits.charAt(1))) {
9677
+ return { cnpjNotValid: true };
9678
+ }
9679
+ return null;
9637
9680
  }
9638
9681
  return null;
9639
9682
  };
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");
9683
+ /**
9684
+ * Válida o número de telefone da chave PIX.
9685
+ */
9686
+ GenericValidator.isValidPhoneNumber = function (control) {
9687
+ var cellPhoneKey = control.value || '';
9688
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9689
+ var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9690
+ var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9691
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9692
+ };
9693
+ /**
9694
+ * Valida o email da chave PIX.
9695
+ */
9696
+ GenericValidator.isValidEmail = function (control) {
9697
+ var emailKey = control.value;
9698
+ var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9699
+ var isValidEmail = regexValidEmail.test(emailKey);
9700
+ return isValidEmail ? null : { invalidEmail: true };
9701
+ };
9702
+ return GenericValidator;
9703
+ }());
9704
+
9705
+ var HistoricakPixAccountBase = /** @class */ (function () {
9706
+ function HistoricakPixAccountBase(formBuilder) {
9707
+ this._paramsForm = new forms.FormGroup({});
9708
+ this._defaultCpfNumber = null;
9709
+ this.initialValidatorOfPercentage = [forms.Validators.required, forms.Validators.min(0.01)];
9710
+ this.pixAccountList = [];
9711
+ this.maxValuePercentage = 100.0;
9712
+ this.isShowPixKeyFieldValidatorMessage = false;
9713
+ this.formBuilder = formBuilder;
9714
+ this.createFormGroupBase();
9715
+ }
9716
+ HistoricakPixAccountBase.prototype.phoneMask = function (event) {
9717
+ FormatUtilsService.formatTelephoneInputEvent(event);
9718
+ };
9719
+ HistoricakPixAccountBase.prototype.cpfMask = function (event) {
9720
+ FormatUtilsService.formatCpfInputEvent(event);
9721
+ };
9722
+ HistoricakPixAccountBase.prototype.cnpjMask = function (event) {
9723
+ FormatUtilsService.formatCnpjInputEvent(event);
9724
+ };
9725
+ HistoricakPixAccountBase.prototype.onChangePixKeyType = function (item, form) {
9726
+ if (!item || !item.key)
9727
+ return;
9728
+ this.pixKeyType = item.key;
9729
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9730
+ ? form
9731
+ : this.pixAccountFormGroup;
9732
+ this.isShowPixKeyFieldValidatorMessage = true;
9733
+ var pixKeyControl = targetForm.get("pixKey");
9734
+ if (pixKeyControl) {
9735
+ pixKeyControl.reset();
9736
+ }
9737
+ this.setPixKeyValidators(true, targetForm);
9738
+ if (item.key === "CPF") {
9739
+ this.setDefaultCpfPixKey(targetForm);
9740
+ }
9741
+ };
9742
+ HistoricakPixAccountBase.prototype.onClearPixKeyType = function (form) {
9743
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9744
+ ? form
9745
+ : this.pixAccountFormGroup;
9746
+ this.isShowPixKeyFieldValidatorMessage = false;
9747
+ if (targetForm.get("pixKey")) {
9748
+ targetForm.get("pixKey").reset();
9749
+ }
9750
+ };
9751
+ HistoricakPixAccountBase.prototype.setDefaultCpfPixKey = function (form) {
9752
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9753
+ ? form
9754
+ : this.pixAccountFormGroup;
9755
+ if (this._defaultCpfNumber) {
9756
+ if (targetForm.get("pixKey")) {
9757
+ targetForm.get("pixKey").setValue(this._defaultCpfNumber);
9758
+ }
9651
9759
  }
9652
9760
  else {
9653
- this.msgTotalLimitByPercentage = null;
9761
+ var sheetDocument = this._paramsForm.get("sheetDocument");
9762
+ if (sheetDocument && sheetDocument.get("cpfNumber")) {
9763
+ var cpf = sheetDocument.get("cpfNumber").value;
9764
+ if (cpf && targetForm.get("pixKey")) {
9765
+ targetForm.get("pixKey").setValue(cpf);
9766
+ }
9767
+ }
9654
9768
  }
9655
9769
  };
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; });
9770
+ HistoricakPixAccountBase.prototype.createFormGroupBase = function () {
9771
+ this.pixAccountFormGroup = this.formBuilder.group({
9772
+ id: this.formBuilder.control(null),
9773
+ index: this.formBuilder.control(null),
9774
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9775
+ dateChange: this.formBuilder.control(null),
9776
+ pixKeyType: this.formBuilder.control(null, forms.Validators.required),
9777
+ pixKey: this.formBuilder.control(null),
9778
+ percentage: this.formBuilder.control(null, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9779
+ forms.Validators.max(this.maxValuePercentage),
9780
+ ]))),
9781
+ externalId: this.formBuilder.control(null),
9782
+ customFields: this.formBuilder.control(null),
9783
+ });
9784
+ };
9785
+ HistoricakPixAccountBase.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode, form) {
9786
+ if (index === void 0) { index = null; }
9787
+ if (isEditMode === void 0) { isEditMode = true; }
9788
+ var targetForm = (typeof form !== 'undefined' && form !== null)
9789
+ ? form
9790
+ : this.pixAccountFormGroup;
9791
+ this.pixAccountList = (pixAccountList && pixAccountList.length > 0)
9792
+ ? [].concat(pixAccountList)
9793
+ : [];
9794
+ var percentageIncluded = [];
9795
+ for (var i = 0; i < this.pixAccountList.length; i++) {
9796
+ var field = this.pixAccountList[i];
9797
+ if (field && field.percentage && i !== index) {
9798
+ percentageIncluded.push(field.percentage);
9686
9799
  }
9687
- },
9688
- enumerable: true,
9689
- configurable: true
9690
- });
9691
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
9800
+ }
9801
+ this.beforeSetPixKeyTypeValidator(targetForm);
9802
+ this.setPixKeyValidators(isEditMode, targetForm);
9803
+ this.validatePercentageValid(percentageIncluded, targetForm);
9804
+ };
9805
+ HistoricakPixAccountBase.prototype.beforeSetPixKeyTypeValidator = function (form) {
9806
+ var control = form.get("pixKeyType");
9807
+ if (this.pixAccountList && this.pixAccountList.length) {
9808
+ control.setValidators(forms.Validators.compose([
9809
+ forms.Validators.required,
9810
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
9811
+ ]));
9812
+ }
9813
+ else {
9814
+ control.setValidators(forms.Validators.required);
9815
+ }
9816
+ control.updateValueAndValidity();
9817
+ };
9818
+ HistoricakPixAccountBase.prototype.setPixKeyValidators = function (isEditMode, form) {
9819
+ var pixKey = form.get("pixKey");
9820
+ switch (this.pixKeyType) {
9821
+ case "TELEPHONE":
9822
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidPhoneNumber]));
9823
+ break;
9824
+ case "EMAIL":
9825
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidEmail]));
9826
+ break;
9827
+ case "CPF":
9828
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidCpf]));
9829
+ break;
9830
+ case "CNPJ":
9831
+ pixKey.setValidators(forms.Validators.compose([forms.Validators.required, GenericValidator.isValidCnpj]));
9832
+ break;
9833
+ case "RANDOM_KEY":
9834
+ pixKey.setValidators(forms.Validators.required);
9835
+ break;
9836
+ default:
9837
+ pixKey.clearValidators();
9838
+ }
9839
+ if (isEditMode) {
9840
+ pixKey.enable();
9841
+ }
9842
+ pixKey.updateValueAndValidity();
9843
+ };
9844
+ HistoricakPixAccountBase.prototype.validatePercentageValid = function (listValue, form) {
9845
+ var percentage = form.get("percentage");
9846
+ this.maxValuePercentage = listValue.reduce(function (acc, val) { return acc - val; }, 100.0);
9847
+ percentage.setValidators(forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
9848
+ forms.Validators.max(this.maxValuePercentage),
9849
+ ])));
9850
+ percentage.updateValueAndValidity();
9851
+ };
9852
+ HistoricakPixAccountBase.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
9853
+ return function (control) {
9854
+ var value = control.value;
9855
+ var isDuplicate = listCompare.some(function (field) {
9856
+ return value &&
9857
+ field.pixKeyType.key === "BANK_ACCOUNT" &&
9858
+ value.key === "BANK_ACCOUNT";
9859
+ });
9860
+ return isDuplicate ? { pixKeyTypeBankAccountDuplicate: true } : null;
9861
+ };
9862
+ };
9863
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "paramsForm", {
9692
9864
  get: function () {
9693
- return this._displayDateChange;
9865
+ return this._paramsForm;
9694
9866
  },
9695
9867
  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();
9868
+ this._paramsForm = value;
9711
9869
  },
9712
9870
  enumerable: true,
9713
9871
  configurable: true
9714
9872
  });
9715
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
9873
+ Object.defineProperty(HistoricakPixAccountBase.prototype, "defaultCpfNumber", {
9716
9874
  get: function () {
9717
- return this._visible;
9875
+ return this._defaultCpfNumber;
9718
9876
  },
9719
9877
  set: function (value) {
9720
- this._visible = value;
9721
- this.visibleChange.emit(this.visible);
9878
+ this._defaultCpfNumber = value;
9722
9879
  },
9723
9880
  enumerable: true,
9724
9881
  configurable: true
9725
9882
  });
9726
- HistoricalPixAccountComponent.prototype.close = function () {
9727
- this.visible = false;
9728
- };
9729
- HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
9730
- return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9731
- };
9732
- HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
9733
- return FormatUtilsService.getFormattedCpf(cpf);
9734
- };
9735
- HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
9736
- return FormatUtilsService.getFormattedCnpj(cnpj);
9883
+ return HistoricakPixAccountBase;
9884
+ }());
9885
+
9886
+ var HistoricalPixAccountService = /** @class */ (function () {
9887
+ function HistoricalPixAccountService(http) {
9888
+ this.http = http;
9889
+ }
9890
+ HistoricalPixAccountService.prototype.query = function (path, body, service) {
9891
+ if (service === void 0) { service = exports.ServiceType.PAYROLL; }
9892
+ return this.http.query(path, body, service);
9737
9893
  };
9738
- HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
9739
- return FormatUtilsService.getFormattedPercentage(value);
9894
+ HistoricalPixAccountService.prototype.enumQuery = function () {
9895
+ var path = 'enumQuery';
9896
+ var body = {
9897
+ names: ['PixKeyType']
9898
+ };
9899
+ return this.http.query(path, body, exports.ServiceType.PAYROLL);
9740
9900
  };
9741
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
9742
- get: function () {
9743
- return (this.permission["incluir"]);
9744
- },
9745
- enumerable: true,
9746
- configurable: true
9747
- });
9748
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToDeleteHistorical", {
9749
- get: function () {
9750
- return (this.permission["excluir"]);
9751
- },
9752
- enumerable: true,
9753
- configurable: true
9754
- });
9755
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToEditHistorical", {
9756
- get: function () {
9757
- return (this.permission["editar"]);
9758
- },
9759
- enumerable: true,
9760
- configurable: true
9761
- });
9762
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToViewHistorical", {
9763
- get: function () {
9764
- return (this.permission["visualizar"]);
9765
- },
9766
- enumerable: true,
9767
- configurable: true
9768
- });
9769
- HistoricalPixAccountComponent.ctorParameters = function () { return [
9770
- { type: core$1.TranslateService },
9771
- { type: core.ChangeDetectorRef },
9772
- { type: forms.FormBuilder },
9773
- { type: api.MessageService }
9901
+ HistoricalPixAccountService.ctorParameters = function () { return [
9902
+ { type: HttpClientService }
9774
9903
  ]; };
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=\"actions(rowData, key).length > 1\" [label]=\"actionLabel\"\n priority=\"default\" [model]=\"scopedActions(rowData, key)\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n\n <s-button id=\"table-admission-btn-action-{{key}}\"\n *ngIf=\"actions(rowData, key).length <= 1\"\n [label]=\"scopedActions(rowData, key)[0].label\"\n priority=\"default\"\n (click)=\"scopedActions(rowData, key)[0].command()\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length +2\">\n {{'hcm.payroll.admission_empty_message'|translate}}\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span *ngIf=\"totalRecords\">{{recordsMessage}}</span>\n </ng-template>\n </p-table>\n</div>\n",
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;
9904
+ HistoricalPixAccountService = __decorate([
9905
+ core.Injectable()
9906
+ ], HistoricalPixAccountService);
9907
+ return HistoricalPixAccountService;
9859
9908
  }());
9860
9909
 
9861
- var GenericValidator = /** @class */ (function () {
9862
- function GenericValidator() {
9910
+ var HistoricalPixAccountComponent = /** @class */ (function (_super) {
9911
+ __extends(HistoricalPixAccountComponent, _super);
9912
+ function HistoricalPixAccountComponent(translateService, cd, formBuilder, sharedStateService, service) {
9913
+ var _this = _super.call(this, formBuilder) || this;
9914
+ _this.translateService = translateService;
9915
+ _this.cd = cd;
9916
+ _this.sharedStateService = sharedStateService;
9917
+ _this.service = service;
9918
+ _this.recordByRow = 1;
9919
+ _this.showDateChange = false;
9920
+ _this.isEditMode = false;
9921
+ _this.isViewMode = false;
9922
+ _this.withSideBar = true;
9923
+ _this.listDataReciever = [];
9924
+ _this.addExistentHistoricData = [];
9925
+ _this.getListPixAccount = [];
9926
+ _this.isEditModeForSave = false;
9927
+ _this.isViewModeActive = new core.EventEmitter();
9928
+ _this.isEditModeActive = new core.EventEmitter();
9929
+ _this.isDeleteModeActive = new core.EventEmitter();
9930
+ _this.isValidChangeForm = new core.EventEmitter();
9931
+ _this.listFromApp = [];
9932
+ _this.visibleChange = new core.EventEmitter();
9933
+ _this.ngUnsubscribe = new rxjs.Subject();
9934
+ _this.orderBy = {
9935
+ field: "dateChange",
9936
+ direction: exports.DirectionEnumeration.DESC,
9937
+ };
9938
+ _this.pixAccountItemInput = {};
9939
+ _this.totalRecords = 0;
9940
+ _this.actionLabel = _this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9941
+ _this.loading = true;
9942
+ _this.listData = [];
9943
+ _this.listDataNoPage = [];
9944
+ _this.showButtonView = true;
9945
+ _this.showEditMode = false;
9946
+ _this.hasRecordsPix = true;
9947
+ _this.maxValuePercentage = 100.00;
9948
+ _this.hideFields = _this.sharedStateService.hideField$;
9949
+ _this.suggestions = [];
9950
+ _this.formGroupByRow = {};
9951
+ _this.cols = [
9952
+ {
9953
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9954
+ field: "pixKeyType",
9955
+ orderBy: 'pixKeyType.key',
9956
+ },
9957
+ {
9958
+ label: _this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9959
+ field: "pixKey",
9960
+ orderBy: 'pixKey',
9961
+ },
9962
+ {
9963
+ label: _this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9964
+ field: "percentage",
9965
+ orderBy: 'percentage',
9966
+ },
9967
+ {
9968
+ label: _this.translateService.instant("hcm.payroll.movimentation_generic_action"),
9969
+ field: "actions",
9970
+ orderBy: null,
9971
+ }
9972
+ ];
9973
+ _this.actions = function (rowData, key) {
9974
+ if (rowData === void 0) { rowData = {}; }
9975
+ return [
9976
+ {
9977
+ visible: _this.isEditMode,
9978
+ label: _this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9979
+ command: function () {
9980
+ if (_this.isAllowToViewHistorical) {
9981
+ rowData["index"] = key;
9982
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: false };
9983
+ _this.visible = true;
9984
+ }
9985
+ else {
9986
+ _this.isViewModeActive.emit(true);
9987
+ }
9988
+ },
9989
+ },
9990
+ {
9991
+ visible: !!(!_this.isEditMode && _this.withSideBar),
9992
+ label: _this.translateService.instant("hcm.payroll.edit"),
9993
+ command: function () {
9994
+ if (_this.isAllowToEditHistorical) {
9995
+ rowData["index"] = key;
9996
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
9997
+ _this.visible = true;
9998
+ }
9999
+ else {
10000
+ _this.isEditModeActive.emit(true);
10001
+ if (_this.listFromApp.length == 0) {
10002
+ rowData["index"] = key;
10003
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
10004
+ _this.visible = true;
10005
+ }
10006
+ }
10007
+ },
10008
+ },
10009
+ {
10010
+ visible: !_this.isEditMode || _this.showEditMode,
10011
+ label: _this.translateService.instant("hcm.payroll.delete"),
10012
+ command: function () {
10013
+ if (_this.isAllowToDeleteHistorical) {
10014
+ _this.loading = true;
10015
+ _this.deleteAnnuityItem(key);
10016
+ }
10017
+ else {
10018
+ _this.isDeleteModeActive.emit(true);
10019
+ if (_this.listFromApp.length == 0) {
10020
+ _this.loading = true;
10021
+ _this.deleteAnnuityItem(key);
10022
+ }
10023
+ }
10024
+ },
10025
+ },
10026
+ ];
10027
+ };
10028
+ _this.createFormGroup();
10029
+ return _this;
9863
10030
  }
10031
+ HistoricalPixAccountComponent.prototype.ngOnInit = function () {
10032
+ var _this = this;
10033
+ this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
10034
+ this.sharedStateService.showButton$.subscribe(function (value) {
10035
+ _this.showButtonView = value;
10036
+ });
10037
+ this.sharedStateService.showEditMode$.subscribe(function (value) {
10038
+ _this.showEditMode = value;
10039
+ _this.isEditModeForSave = value;
10040
+ });
10041
+ };
10042
+ HistoricalPixAccountComponent.prototype.ngOnChanges = function (changes) {
10043
+ if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
10044
+ this.listFromApp = changes['listDataReciever'].currentValue;
10045
+ }
10046
+ if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
10047
+ this.getHistoricalPixAccountList();
10048
+ }
10049
+ if (changes['addExistentHistoricData'] && changes['addExistentHistoricData'].currentValue) {
10050
+ var newData = changes['addExistentHistoricData'].currentValue;
10051
+ this.rebuildFormGroupMap(newData);
10052
+ }
10053
+ };
10054
+ HistoricalPixAccountComponent.prototype.createFormGroup = function () {
10055
+ this.historicalPixAccountList = this.formBuilder.group({
10056
+ historicalPixAccountList: this.formBuilder.control(null),
10057
+ });
10058
+ };
10059
+ HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
10060
+ this.ngUnsubscribe.next();
10061
+ this.ngUnsubscribe.complete();
10062
+ };
10063
+ HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
10064
+ this.cd.detectChanges();
10065
+ };
10066
+ HistoricalPixAccountComponent.prototype.emitFormValidity = function () {
10067
+ var allValid = Object.values(this.formGroupByRow).every(function (fg) {
10068
+ fg.updateValueAndValidity();
10069
+ return fg.valid;
10070
+ });
10071
+ this.isValidChangeForm.emit(allValid);
10072
+ };
10073
+ HistoricalPixAccountComponent.prototype.filterPixKeyType = function (event) {
10074
+ var _this = this;
10075
+ var query = event.query;
10076
+ this.service.enumQuery().subscribe(function (response) {
10077
+ var pixKeyTypeEnum = response.results.find(function (result) { return result.enumName === 'PixKeyType'; });
10078
+ if (pixKeyTypeEnum) {
10079
+ _this.suggestions = pixKeyTypeEnum.items.filter(function (item) {
10080
+ return item.value.toLowerCase().includes(query.toLowerCase());
10081
+ });
10082
+ }
10083
+ else {
10084
+ _this.suggestions = [];
10085
+ }
10086
+ });
10087
+ };
10088
+ HistoricalPixAccountComponent.prototype.createPixRowFormGroup = function () {
10089
+ return this.formBuilder.group({
10090
+ pixKeyType: [null, forms.Validators.required],
10091
+ pixKey: [null],
10092
+ percentage: [0, forms.Validators.compose(__spread(this.initialValidatorOfPercentage, [
10093
+ forms.Validators.max(this.maxValuePercentage),
10094
+ ]))]
10095
+ });
10096
+ };
10097
+ HistoricalPixAccountComponent.prototype.onPixKeyInput = function (event, index) {
10098
+ var inputValue = event.target.value;
10099
+ var inputRawValue = inputValue.replace(/\D/g, '');
10100
+ var form = this.formGroupByRow[index];
10101
+ var pixKeyControl = form.get('pixKey');
10102
+ if (pixKeyControl) {
10103
+ pixKeyControl.setValue(inputRawValue, { emitEvent: false });
10104
+ pixKeyControl.markAsDirty();
10105
+ pixKeyControl.updateValueAndValidity();
10106
+ }
10107
+ this.setPixKeyValidators(true, form);
10108
+ this.emitFormValidity();
10109
+ };
10110
+ HistoricalPixAccountComponent.prototype.onBlurPixCpfAndCnpj = function (index) {
10111
+ var form = this.formGroupByRow[index];
10112
+ var pixKeyControl = form.get('pixKey');
10113
+ var pixKeyTypeControl = form.get('pixKeyType');
10114
+ if (!pixKeyControl || !pixKeyTypeControl)
10115
+ return;
10116
+ var currentValue = pixKeyControl.value;
10117
+ var pixKeyType = pixKeyTypeControl.value.key;
10118
+ var rawValue = (currentValue || '').replace(/\D/g, '');
10119
+ pixKeyControl.setValue(rawValue, { emitEvent: false });
10120
+ if (pixKeyControl.valid) {
10121
+ form.patchValue({
10122
+ pixKeyFormatted: FormatUtilsService.getFormattedSubscriptionNumber(rawValue, pixKeyType)
10123
+ });
10124
+ }
10125
+ this.emitFormValidity();
10126
+ };
10127
+ HistoricalPixAccountComponent.prototype.getFormattedPixKey = function (type, value) {
10128
+ return FormatUtilsService.getFormattedSubscriptionNumber(value, type);
10129
+ };
10130
+ HistoricalPixAccountComponent.prototype.syncPixDataToParentForm = function () {
10131
+ if (!this.isEditModeForSave)
10132
+ return;
10133
+ var values = Object.values(this.formGroupByRow).map(function (fg) {
10134
+ var value = fg.getRawValue();
10135
+ var pixKeyType = value.pixKeyType.key;
10136
+ if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ') {
10137
+ value.pixKey = (value.pixKey || '').replace(/[.\-\/]/g, '');
10138
+ }
10139
+ else if (pixKeyType === 'TELEPHONE') {
10140
+ value.pixKey = (value.pixKey || '').replace(/[()\s\-]/g, '');
10141
+ }
10142
+ return value;
10143
+ });
10144
+ this.formGroup
10145
+ .get(this.fieldFormGroup)
10146
+ .get('historicalPixAccountList')
10147
+ .setValue(values);
10148
+ this.emitFormValidity();
10149
+ };
10150
+ HistoricalPixAccountComponent.prototype.syncResetPixFormToParent = function () {
10151
+ this.formGroupByRow = {};
10152
+ this.historicalPixAccountList.reset();
10153
+ this.historicalPixAccountList.get('historicalPixAccountList').setValue([]);
10154
+ if (this.addExistentHistoricData.length) {
10155
+ this.rebuildFormGroupMap(this.addExistentHistoricData);
10156
+ }
10157
+ };
10158
+ HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
10159
+ var _this = this;
10160
+ var first = event && event.first ? event.first : 0;
10161
+ var rows = event && event.rows ? event.rows : this.recordByRow;
10162
+ var arrList = this.getHistoricalPixAccountList();
10163
+ this.listData = [];
10164
+ this.totalRecords = null;
10165
+ if (event && event.multiSortMeta && event.multiSortMeta.length) {
10166
+ event.multiSortMeta.map(function (value) {
10167
+ _this.orderBy.field = value.field;
10168
+ _this.orderBy.direction = value.order === 1 ? exports.DirectionEnumeration.ASC : exports.DirectionEnumeration.DESC;
10169
+ });
10170
+ }
10171
+ if (arrList && arrList.length) {
10172
+ this.totalRecords = arrList.length;
10173
+ this.listData = arrList;
10174
+ this.listDataNoPage = __spread(arrList);
10175
+ this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
10176
+ this.listData = this.listData.slice(first, (first + rows));
10177
+ }
10178
+ else {
10179
+ this.listDataNoPage = [];
10180
+ }
10181
+ if (this.isEditMode || arrList && arrList.length === 1) {
10182
+ this.refreshCssInIE11();
10183
+ }
10184
+ this.loading = false;
10185
+ this.cd.detectChanges();
10186
+ };
9864
10187
  /**
9865
- * Valida o CEI (Cadastro específico de INSS) digitado.
10188
+ * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
9866
10189
  */
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 };
10190
+ HistoricalPixAccountComponent.prototype.refreshCssInIE11 = function () {
10191
+ if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
10192
+ setTimeout(function () {
10193
+ var row = document.getElementsByClassName("row0");
10194
+ if (row && row[0])
10195
+ row[0].className = 'refresh';
10196
+ }, 1);
10197
+ }
10198
+ };
10199
+ HistoricalPixAccountComponent.prototype.add = function () {
10200
+ this.pixAccountItemInput = {};
10201
+ this.visible = true;
10202
+ };
10203
+ HistoricalPixAccountComponent.prototype.addPix = function () {
10204
+ var newItem = {
10205
+ pixKeyType: {},
10206
+ pixKey: '',
10207
+ percentage: 0
10208
+ };
10209
+ var index = this.addExistentHistoricData.length;
10210
+ this.addExistentHistoricData = __spread(this.addExistentHistoricData, [
10211
+ newItem
10212
+ ]);
10213
+ this.formGroupByRow[index] = this.createPixRowFormGroup();
10214
+ this.setValidatorsAccordingList(this.addExistentHistoricData, index, true);
10215
+ this.emitFormValidity();
10216
+ };
10217
+ HistoricalPixAccountComponent.prototype.deletePix = function (index) {
10218
+ this.addExistentHistoricData = this.addExistentHistoricData.filter(function (_, i) { return i !== index; });
10219
+ this.rebuildFormGroupMap(this.addExistentHistoricData);
10220
+ this.emitFormValidity();
10221
+ };
10222
+ HistoricalPixAccountComponent.prototype.rebuildFormGroupMap = function (data) {
10223
+ var _this = this;
10224
+ this.formGroupByRow = {};
10225
+ data.forEach(function (item, index) {
10226
+ var form = _this.createPixRowFormGroup();
10227
+ var pixKeyType = item.pixKeyType.key;
10228
+ var pixKeyRaw = item.pixKey;
10229
+ if (pixKeyType === 'CPF' || pixKeyType === 'CNPJ') {
10230
+ item.pixKey = FormatUtilsService.getFormattedSubscriptionNumber(pixKeyRaw, pixKeyType);
10231
+ }
10232
+ if (pixKeyType === 'TELEPHONE') {
10233
+ item.pixKey = FormatUtilsService.getFormattedTelephoneNumber(pixKeyRaw);
10234
+ }
10235
+ form.patchValue(item);
10236
+ _this.formGroupByRow[index] = form;
10237
+ _this.setValidatorsAccordingList(data, index, _this.isEditMode);
10238
+ });
10239
+ this.emitFormValidity();
10240
+ };
10241
+ HistoricalPixAccountComponent.prototype.onPixKeyTypeChange = function (item, index) {
10242
+ var _this = this;
10243
+ var form = this.formGroupByRow[index];
10244
+ this.onChangePixKeyType(item, form);
10245
+ this.addExistentHistoricData[index].pixKey = '';
10246
+ setTimeout(function () {
10247
+ if (_this.dataListPix.editingCell) {
10248
+ _this.dataListPix.editingCell = null;
10249
+ }
10250
+ });
10251
+ this.cd.detectChanges();
10252
+ };
10253
+ HistoricalPixAccountComponent.prototype.onPixKeyTypeClear = function (index) {
10254
+ var form = this.formGroupByRow[index];
10255
+ this.onClearPixKeyType(form);
10256
+ };
10257
+ HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
10258
+ var newlist = __spread(this.getHistoricalPixAccountList());
10259
+ newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
10260
+ delete newlist[index];
10261
+ newlist = newlist.filter(function (val) { return val; });
10262
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
10263
+ this.verifyTotalPercentage();
10264
+ this.onLazyLoad();
10265
+ };
10266
+ HistoricalPixAccountComponent.prototype.getHistoricalPixAccountList = function () {
10267
+ if (this.historicalPixAccountList.get("historicalPixAccountList") &&
10268
+ this.historicalPixAccountList.get("historicalPixAccountList").value &&
10269
+ this.historicalPixAccountList.get("historicalPixAccountList").value.length)
10270
+ return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
10271
+ else
10272
+ return [];
10273
+ };
10274
+ HistoricalPixAccountComponent.prototype.addItemInList = function ($event) {
10275
+ var index = $event && $event.index >= 0 ? $event.index : null;
10276
+ var newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
10277
+ if (index != null) {
10278
+ newDataList[index] = $event;
10279
+ delete $event.index;
10280
+ }
10281
+ else {
10282
+ if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
10283
+ var customValue = mountCustomToSave($event["customFields"]);
10284
+ $event["customFields"] = __spread(customValue);
10285
+ }
10286
+ $event["dateChange"] = this.dateChange;
10287
+ newDataList.push($event);
10288
+ }
10289
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
10290
+ this.verifyTotalPercentage();
10291
+ this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
10292
+ };
10293
+ HistoricalPixAccountComponent.prototype.getNumberPageByIndex = function (index, list) {
10294
+ if (index) {
10295
+ var total = list.length;
10296
+ var sub = this.recordByRow - 1;
10297
+ return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
10298
+ }
10299
+ return null;
10300
+ };
10301
+ HistoricalPixAccountComponent.prototype.verifyTotalPercentage = function () {
10302
+ var list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
10303
+ var arrayPercentage = [];
10304
+ if (!list.length)
10305
+ return this.msgTotalLimitByPercentage = null;
10306
+ list.filter(function (item) { return arrayPercentage.push(item && item["percentage"]); });
10307
+ var sumPercentage = arrayPercentage.reduce(function (total, percentage) {
10308
+ return total + percentage;
10309
+ }, 0);
10310
+ if (sumPercentage === 100) {
10311
+ this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
10312
+ }
9890
10313
  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 };
10314
+ this.msgTotalLimitByPercentage = null;
9900
10315
  }
9901
10316
  };
9902
- /**
9903
- * Valida se o CPF é valido. Deve-se ser informado o cpf sem máscara.
9904
- */
9905
- GenericValidator.isValidCpf = function (control) {
9906
- var cpf = control.value;
9907
- if (cpf) {
9908
- var numbers = void 0, digits = void 0, sum = void 0, i = void 0, result = void 0, equalDigits = void 0;
9909
- equalDigits = 1;
9910
- if (cpf.length < 11) {
9911
- return null;
9912
- }
9913
- for (i = 0; i < cpf.length - 1; i++) {
9914
- if (cpf.charAt(i) !== cpf.charAt(i + 1)) {
9915
- equalDigits = 0;
9916
- break;
9917
- }
9918
- }
9919
- if (!equalDigits) {
9920
- numbers = cpf.substring(0, 9);
9921
- digits = cpf.substring(9);
9922
- sum = 0;
9923
- for (i = 10; i > 1; i--) {
9924
- sum += numbers.charAt(10 - i) * i;
9925
- }
9926
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9927
- if (result !== Number(digits.charAt(0))) {
9928
- return { cpfNotValid: true };
9929
- }
9930
- numbers = cpf.substring(0, 10);
9931
- sum = 0;
9932
- for (i = 11; i > 1; i--) {
9933
- sum += numbers.charAt(11 - i) * i;
9934
- }
9935
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9936
- if (result !== Number(digits.charAt(1))) {
9937
- return { cpfNotValid: true };
9938
- }
9939
- return null;
9940
- }
9941
- else {
9942
- return { cpfNotValid: true };
9943
- }
10317
+ HistoricalPixAccountComponent.prototype.onSyncValue = function (field, index) {
10318
+ if (this.formGroupByRow &&
10319
+ this.formGroupByRow[index] &&
10320
+ this.formGroupByRow[index].get(field)) {
10321
+ var value = this.formGroupByRow[index].get(field).value;
10322
+ this.addExistentHistoricData[index][field] = value;
9944
10323
  }
9945
- return null;
10324
+ this.emitFormValidity();
9946
10325
  };
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
- }
10326
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
10327
+ get: function () {
10328
+ return this.actions.bind(this);
10329
+ },
10330
+ enumerable: true,
10331
+ configurable: true
10332
+ });
10333
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
10334
+ get: function () {
10335
+ return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
10336
+ },
10337
+ enumerable: true,
10338
+ configurable: true
10339
+ });
10340
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "getTooltipAndDisableButtonAdd", {
10341
+ get: function () {
10342
+ return this.dateChange ? null : this.msgTooltipAdd;
10343
+ },
10344
+ enumerable: true,
10345
+ configurable: true
10346
+ });
10347
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "dateChange", {
10348
+ get: function () {
10349
+ return this._dateChange;
10350
+ },
10351
+ set: function (value) {
10352
+ var _this = this;
10353
+ this._dateChange = value;
10354
+ if (this._dateChange) {
10355
+ this.listData.filter(function (row) { return row["dateChange"] = _this._dateChange; });
9996
10356
  }
9997
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9998
- if (result !== Number(digits.charAt(1))) {
9999
- return { cnpjNotValid: true };
10357
+ },
10358
+ enumerable: true,
10359
+ configurable: true
10360
+ });
10361
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
10362
+ get: function () {
10363
+ return this._displayDateChange;
10364
+ },
10365
+ set: function (value) {
10366
+ var _this = this;
10367
+ this._displayDateChange = value;
10368
+ if (this._displayDateChange) {
10369
+ this.listData.filter(function (row) { return row["displayDateChange"] = _this._displayDateChange; });
10000
10370
  }
10001
- return null;
10002
- }
10003
- return null;
10371
+ },
10372
+ enumerable: true,
10373
+ configurable: true
10374
+ });
10375
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "addListData", {
10376
+ set: function (list) {
10377
+ this.loading = true;
10378
+ this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
10379
+ this.verifyTotalPercentage();
10380
+ this.onLazyLoad();
10381
+ },
10382
+ enumerable: true,
10383
+ configurable: true
10384
+ });
10385
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
10386
+ get: function () {
10387
+ return this._visible;
10388
+ },
10389
+ set: function (value) {
10390
+ this._visible = value;
10391
+ this.visibleChange.emit(this.visible);
10392
+ },
10393
+ enumerable: true,
10394
+ configurable: true
10395
+ });
10396
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "paramsForm", {
10397
+ set: function (value) {
10398
+ this._paramsForm = value;
10399
+ },
10400
+ enumerable: true,
10401
+ configurable: true
10402
+ });
10403
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "defaultCpfNumber", {
10404
+ set: function (value) {
10405
+ this._defaultCpfNumber = value;
10406
+ },
10407
+ enumerable: true,
10408
+ configurable: true
10409
+ });
10410
+ HistoricalPixAccountComponent.prototype.close = function () {
10411
+ this.visible = false;
10004
10412
  };
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 };
10413
+ HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
10414
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
10014
10415
  };
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 };
10416
+ HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
10417
+ return FormatUtilsService.getFormattedCpf(cpf);
10023
10418
  };
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 () {
10419
+ HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
10420
+ return FormatUtilsService.getFormattedCnpj(cnpj);
10048
10421
  };
10422
+ HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
10423
+ return FormatUtilsService.getFormattedPercentage(value);
10424
+ };
10425
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
10426
+ get: function () {
10427
+ return (this.permission["incluir"]);
10428
+ },
10429
+ enumerable: true,
10430
+ configurable: true
10431
+ });
10432
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToDeleteHistorical", {
10433
+ get: function () {
10434
+ return (this.permission["excluir"]);
10435
+ },
10436
+ enumerable: true,
10437
+ configurable: true
10438
+ });
10439
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToEditHistorical", {
10440
+ get: function () {
10441
+ return (this.permission["editar"]);
10442
+ },
10443
+ enumerable: true,
10444
+ configurable: true
10445
+ });
10446
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToViewHistorical", {
10447
+ get: function () {
10448
+ return (this.permission["visualizar"]);
10449
+ },
10450
+ enumerable: true,
10451
+ configurable: true
10452
+ });
10453
+ HistoricalPixAccountComponent.ctorParameters = function () { return [
10454
+ { type: core$1.TranslateService },
10455
+ { type: core.ChangeDetectorRef },
10456
+ { type: forms.FormBuilder },
10457
+ { type: SharedStateService },
10458
+ { type: HistoricalPixAccountService }
10459
+ ]; };
10460
+ __decorate([
10461
+ core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
10462
+ ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
10463
+ __decorate([
10464
+ core.ViewChild('dataListPix', { static: false })
10465
+ ], HistoricalPixAccountComponent.prototype, "dataListPix", void 0);
10466
+ __decorate([
10467
+ core.Input()
10468
+ ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
10469
+ __decorate([
10470
+ core.Input()
10471
+ ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
10472
+ __decorate([
10473
+ core.Input()
10474
+ ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
10475
+ __decorate([
10476
+ core.Input()
10477
+ ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
10478
+ __decorate([
10479
+ core.Input()
10480
+ ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
10481
+ __decorate([
10482
+ core.Input()
10483
+ ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
10484
+ __decorate([
10485
+ core.Input()
10486
+ ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
10487
+ __decorate([
10488
+ core.Input()
10489
+ ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
10490
+ __decorate([
10491
+ core.Input()
10492
+ ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
10493
+ __decorate([
10494
+ core.Input()
10495
+ ], HistoricalPixAccountComponent.prototype, "currency", void 0);
10496
+ __decorate([
10497
+ core.Input()
10498
+ ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
10499
+ __decorate([
10500
+ core.Input()
10501
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
10502
+ __decorate([
10503
+ core.Input()
10504
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
10505
+ __decorate([
10506
+ core.Input()
10507
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
10508
+ __decorate([
10509
+ core.Input()
10510
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
10511
+ __decorate([
10512
+ core.Input()
10513
+ ], HistoricalPixAccountComponent.prototype, "addExistentHistoricData", void 0);
10514
+ __decorate([
10515
+ core.Input()
10516
+ ], HistoricalPixAccountComponent.prototype, "getListPixAccount", void 0);
10517
+ __decorate([
10518
+ core.Input()
10519
+ ], HistoricalPixAccountComponent.prototype, "isEditModeForSave", void 0);
10520
+ __decorate([
10521
+ core.Output()
10522
+ ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
10523
+ __decorate([
10524
+ core.Output()
10525
+ ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
10526
+ __decorate([
10527
+ core.Output()
10528
+ ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
10529
+ __decorate([
10530
+ core.Output()
10531
+ ], HistoricalPixAccountComponent.prototype, "isValidChangeForm", void 0);
10532
+ __decorate([
10533
+ core.Input()
10534
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
10535
+ __decorate([
10536
+ core.Input()
10537
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
10538
+ __decorate([
10539
+ core.Input()
10540
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
10541
+ __decorate([
10542
+ core.Input()
10543
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
10544
+ __decorate([
10545
+ core.Input()
10546
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", null);
10547
+ __decorate([
10548
+ core.Input()
10549
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", null);
10550
+ HistoricalPixAccountComponent = __decorate([
10551
+ core.Component({
10552
+ // tslint:disable-next-line:component-selector
10553
+ selector: "c-historical-pix-account",
10554
+ 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<!-- Template exlusivo para edi\u00E7\u00E3o de pix via modal-->\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 <ng-container *ngIf=\"formGroupByRow[rowIndex]\" [formGroup]=\"formGroupByRow[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 formControlName=\"pixKeyType\"\n [dropdown]=\"true\"\n (onSelect)=\"onPixKeyTypeChange($event, rowIndex)\"\n (onClear)=\"onPixKeyTypeClear(rowIndex)\"\n (ngModelChange)=\"onSyncValue('pixKeyType', rowIndex)\"\n field=\"value\"\n placeholder=\"Selecione o tipo de chave\"\n appendTo=\"body\"\n [panelStyle]=\"{ maxWidth: '300px', width: '100%' }\"\n [inputStyle]=\"{ width: '100%' }\"\n ></p-autoComplete>\n\n <s-control-errors [control]=\"formGroupByRow[rowIndex]?.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\"\n [pEditableColumn]=\"item.pixKey\" pEditableColumnField=\"pixKey\"\n [ngClass]=\"{'required': item.pixKeyType.key !== 'BANK_ACCOUNT',\n 'disabled': item.pixKeyType && item.pixKeyType.key === 'BANK_ACCOUNT'\n }\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <ng-container [ngSwitch]=\"item.pixKeyType.key\">\n <input *ngSwitchCase=\"'TELEPHONE'\"\n only-number\n pInputText\n type=\"text\"\n formControlName=\"pixKey\"\n (keyup)=\"phoneMask($event)\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n maxlength=\"15\"\n placeholder=\"(__) ____-____\" />\n\n <input *ngSwitchCase=\"'CPF'\"\n type=\"text\"\n pInputText\n formControlName=\"pixKey\"\n maxlength=\"14\"\n placeholder=\"___.___.___-__\"\n (input)=\"onPixKeyInput($event, rowIndex)\"\n (blur)=\"onBlurPixCpfAndCnpj(rowIndex)\"\n (keyup)=\"cpfMask($event)\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\" />\n\n <input *ngSwitchCase=\"'CNPJ'\"\n type=\"text\"\n pInputText\n formControlName=\"pixKey\"\n maxlength=\"18\"\n placeholder=\"___.___.___/____-__\"\n (input)=\"onPixKeyInput($event, rowIndex)\"\n (blur)=\"onBlurPixCpfAndCnpj(rowIndex)\"\n (keyup)=\"cnpjMask($event)\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\" />\n\n <input *ngSwitchCase=\"'EMAIL'\"\n pInputText\n type=\"email\"\n formControlName=\"pixKey\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n placeholder=\"{{ 'hcm.payroll.employees_addition_email' | translate }}\" />\n\n <input *ngSwitchCase=\"'BANK_ACCOUNT'\"\n pInputText\n formControlName=\"pixKey\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n [disabled]=\"true\" />\n\n <input *ngSwitchDefault\n pInputText\n type=\"text\"\n formControlName=\"pixKey\"\n (ngModelChange)=\"onSyncValue('pixKey', rowIndex)\"\n maxlength=\"100\" />\n </ng-container>\n\n <s-control-errors *ngIf=\"isShowPixKeyFieldValidatorMessage\"\n [control]=\"formGroupByRow[rowIndex]?.get('pixKey')\"\n [errorMessages]=\"{\n required: 'hcm.payroll.required' | translate,\n invalidPhoneNumber: 'hcm.payroll.employees_addition_invalid_phone_number' | translate: { value: formGroupByRow[rowIndex]?.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 <ng-template pTemplate=\"output\">\n {{ getFormattedPixKey(item.pixKeyType?.key, item.pixKey) }}\n </ng-template>\n </p-cellEditor>\n </td>\n\n <!-- Percentual -->\n <td class=\"ui-md-6 ui-sm-12 required\"\n [pEditableColumn]=\"item.percentage\" pEditableColumnField=\"percentage\">\n <p-cellEditor>\n <ng-template pTemplate=\"input\">\n <input\n pInputText type=\"number\"\n formControlName=\"percentage\"\n (ngModelChange)=\"onSyncValue('percentage', rowIndex)\"\n >\n <s-control-errors\n [control]=\"formGroupByRow[rowIndex]?.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-container>\n </ng-template>\n </p-table>\n</div>\n",
10555
+ 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}"]
10556
+ })
10557
+ ], HistoricalPixAccountComponent);
10558
+ return HistoricalPixAccountComponent;
10559
+ }(HistoricakPixAccountBase));
10560
+
10561
+ var HistoricalPixAccountFormComponent = /** @class */ (function (_super) {
10562
+ __extends(HistoricalPixAccountFormComponent, _super);
10563
+ function HistoricalPixAccountFormComponent(formBuilder, cd, sharedStateService) {
10564
+ var _this = _super.call(this, formBuilder) || this;
10565
+ _this.cd = cd;
10566
+ _this.sharedStateService = sharedStateService;
10567
+ _this.withSideBar = true;
10568
+ _this.isEditMode = false;
10569
+ _this.visibleChange = new core.EventEmitter();
10570
+ _this.pixAccountItemToList = new core.EventEmitter();
10571
+ _this.ngUnsubscribe = new rxjs.Subject();
10572
+ _this.labelBtnAdd = "hcm.payroll.employees_add";
10573
+ _this.visibleBtnSave = true;
10574
+ _this.isView = false;
10575
+ _this.isShowPixKeyFieldValidatorMessage = false;
10576
+ _this.hideFields = _this.sharedStateService.hideField$;
10577
+ _this.registerSubjects();
10578
+ return _this;
10579
+ }
10580
+ HistoricalPixAccountFormComponent.prototype.ngOnInit = function () { };
10049
10581
  HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
10050
10582
  this.cd.detectChanges();
10051
10583
  };
@@ -10053,38 +10585,7 @@
10053
10585
  this.ngUnsubscribe.next(true);
10054
10586
  this.ngUnsubscribe.unsubscribe();
10055
10587
  };
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
- };
10588
+ HistoricalPixAccountFormComponent.prototype.registerSubjects = function () { };
10088
10589
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
10089
10590
  get: function () {
10090
10591
  return this._visible;
@@ -10123,7 +10624,8 @@
10123
10624
  });
10124
10625
  HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
10125
10626
  if (this.pixKeyType === "TELEPHONE") {
10126
- this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
10627
+ var pixKeyCtrl = this.pixAccountFormGroup.get("pixKey");
10628
+ pixKeyCtrl.setValue(FormatUtilsService.getFormattedTelephoneNumber(pixKeyCtrl.value));
10127
10629
  }
10128
10630
  };
10129
10631
  HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
@@ -10135,14 +10637,14 @@
10135
10637
  this.visibleBtnSave = isEditMode;
10136
10638
  if (this.pixAccountFormGroup.get("pixKeyType").value) {
10137
10639
  this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
10138
- this.setPixKeyValidators(isEditMode);
10640
+ this.setPixKeyValidators(isEditMode, this.pixAccountFormGroup);
10139
10641
  this.formatPixKeyTelephoneNumber();
10140
10642
  }
10141
10643
  configEnabledFields(this.pixAccountFormGroup, isEditMode, [
10142
10644
  "pixKeyType",
10143
10645
  "pixKey",
10144
10646
  "percentage",
10145
- "customFields",
10647
+ "customFields"
10146
10648
  ], []);
10147
10649
  };
10148
10650
  HistoricalPixAccountFormComponent.prototype.close = function () {
@@ -10156,7 +10658,7 @@
10156
10658
  if (this.employeeId) {
10157
10659
  this.pixAccountFormGroup.get("employee").setValue({
10158
10660
  tableId: this.employeeId,
10159
- name: "",
10661
+ name: ""
10160
10662
  });
10161
10663
  }
10162
10664
  this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
@@ -10188,14 +10690,10 @@
10188
10690
  return {
10189
10691
  prefix: "",
10190
10692
  thousands: this.currency.thousandsSeparator,
10191
- decimal: this.currency.decimalSeparator,
10693
+ decimal: this.currency.decimalSeparator
10192
10694
  };
10193
10695
  };
10194
10696
  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
10697
  set: function (pixAccountList) {
10200
10698
  if (pixAccountList) {
10201
10699
  this.setValidatorsAccordingList(pixAccountList, null, false);
@@ -10207,85 +10705,6 @@
10207
10705
  enumerable: true,
10208
10706
  configurable: true
10209
10707
  });
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
10708
  Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10290
10709
  set: function (condition) {
10291
10710
  this.isView = !!(condition && !this.withSideBar);
@@ -10296,58 +10715,24 @@
10296
10715
  enumerable: true,
10297
10716
  configurable: true
10298
10717
  });
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
- };
10718
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "paramsForm", {
10719
+ set: function (value) {
10720
+ this._paramsForm = value;
10721
+ },
10722
+ enumerable: true,
10723
+ configurable: true
10724
+ });
10725
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", {
10726
+ set: function (value) {
10727
+ this._defaultCpfNumber = value;
10728
+ },
10729
+ enumerable: true,
10730
+ configurable: true
10731
+ });
10348
10732
  HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10349
10733
  { type: forms.FormBuilder },
10350
- { type: core.ChangeDetectorRef }
10734
+ { type: core.ChangeDetectorRef },
10735
+ { type: SharedStateService }
10351
10736
  ]; };
10352
10737
  __decorate([
10353
10738
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: true })
@@ -10367,12 +10752,6 @@
10367
10752
  __decorate([
10368
10753
  core.Input()
10369
10754
  ], 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
10755
  __decorate([
10377
10756
  core.Output()
10378
10757
  ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
@@ -10391,32 +10770,21 @@
10391
10770
  __decorate([
10392
10771
  core.Input()
10393
10772
  ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
10773
+ __decorate([
10774
+ core.Input()
10775
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", null);
10776
+ __decorate([
10777
+ core.Input()
10778
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", null);
10394
10779
  HistoricalPixAccountFormComponent = __decorate([
10395
10780
  core.Component({
10396
10781
  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",
10782
+ 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
10783
  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
10784
  })
10400
10785
  ], HistoricalPixAccountFormComponent);
10401
10786
  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
- }());
10787
+ }(HistoricakPixAccountBase));
10420
10788
 
10421
10789
  var HistoricalPixAccountModule = /** @class */ (function () {
10422
10790
  function HistoricalPixAccountModule() {
@@ -10446,6 +10814,8 @@
10446
10814
  angularComponents.CustomFieldsModule,
10447
10815
  panel.PanelModule,
10448
10816
  inputmask.InputMaskModule,
10817
+ dropdown.DropdownModule,
10818
+ tabview.TabViewModule,
10449
10819
  ],
10450
10820
  declarations: [HistoricalPixAccountComponent, HistoricalPixAccountFormComponent],
10451
10821
  providers: [HistoricalPixAccountService, api.ConfirmationService],
@@ -10488,7 +10858,7 @@
10488
10858
 
10489
10859
  var moment$e = moment_;
10490
10860
  var HistoricalPixAccountListComponent = /** @class */ (function () {
10491
- function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService) {
10861
+ function HistoricalPixAccountListComponent(confirmationService, translateService, activatedRoute, cd, router, messageService, historicalPixAccountListService, sharedStateService) {
10492
10862
  this.confirmationService = confirmationService;
10493
10863
  this.translateService = translateService;
10494
10864
  this.activatedRoute = activatedRoute;
@@ -10496,11 +10866,14 @@
10496
10866
  this.router = router;
10497
10867
  this.messageService = messageService;
10498
10868
  this.historicalPixAccountListService = historicalPixAccountListService;
10869
+ this.sharedStateService = sharedStateService;
10499
10870
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
10500
10871
  this.keyPayload = "historicalEmployeePix";
10501
10872
  this.withSidebar = true;
10502
10873
  this.isOnlyView = new core.EventEmitter();
10874
+ this.isOnlyEdit = new core.EventEmitter();
10503
10875
  this.enableView = new core.EventEmitter();
10876
+ this.isEditJudicialDependentPix = new core.EventEmitter();
10504
10877
  this.ngUnsubscribe = new rxjs.Subject();
10505
10878
  this.loading = true;
10506
10879
  this.columns = [
@@ -10520,6 +10893,7 @@
10520
10893
  HistoricalPixAccountListComponent.prototype.ngOnDestroy = function () {
10521
10894
  this.ngUnsubscribe.next();
10522
10895
  this.ngUnsubscribe.complete();
10896
+ this.unsubscribe();
10523
10897
  };
10524
10898
  HistoricalPixAccountListComponent.prototype.ngAfterViewInit = function () {
10525
10899
  this.cd.detectChanges();
@@ -10539,6 +10913,9 @@
10539
10913
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
10540
10914
  command: function () {
10541
10915
  if (_this.isAllowToViewHistorical) {
10916
+ _this.sharedStateService.setHideField(true);
10917
+ _this.sharedStateService.setShowButton(false);
10918
+ _this.sharedStateService.setShowEditMode(false);
10542
10919
  var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
10543
10920
  if (_this.withSidebar) {
10544
10921
  _this.isOnlyView.emit(true);
@@ -10547,6 +10924,7 @@
10547
10924
  });
10548
10925
  }
10549
10926
  else {
10927
+ _this.sharedStateService.setSaveButton(false);
10550
10928
  _this.enableView.emit(dateChange);
10551
10929
  }
10552
10930
  }
@@ -10559,14 +10937,17 @@
10559
10937
  label: this.translateService.instant("hcm.payroll.edit"),
10560
10938
  command: function () {
10561
10939
  if (_this.isAllowToEditHistorical) {
10940
+ _this.sharedStateService.setHideField(true);
10941
+ _this.sharedStateService.setShowButton(false);
10942
+ _this.sharedStateService.setShowEditMode(true);
10562
10943
  var dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, _this.dateFormat).format("YYYY-MM-DD");
10563
10944
  if (_this.withSidebar) {
10564
- _this.isOnlyView.emit(false);
10565
10945
  _this.router.navigate(["historical-pix-account/" + dateChange], {
10566
10946
  relativeTo: _this.activatedRoute,
10567
10947
  });
10568
10948
  }
10569
10949
  else {
10950
+ _this.sharedStateService.setSaveButton(true);
10570
10951
  _this.enableView.emit(dateChange);
10571
10952
  }
10572
10953
  }
@@ -10652,6 +11033,24 @@
10652
11033
  this.lastRecord = payload[0];
10653
11034
  }
10654
11035
  };
11036
+ HistoricalPixAccountListComponent.prototype.unsubscribe = function () {
11037
+ if (this._subscription) {
11038
+ this._subscription.unsubscribe();
11039
+ }
11040
+ };
11041
+ Object.defineProperty(HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", {
11042
+ set: function (subject) {
11043
+ var _this = this;
11044
+ this.unsubscribe();
11045
+ if (subject) {
11046
+ this._subscription = subject.subscribe(function (value) {
11047
+ _this.sharedStateService.setHideField(value);
11048
+ });
11049
+ }
11050
+ },
11051
+ enumerable: true,
11052
+ configurable: true
11053
+ });
10655
11054
  Object.defineProperty(HistoricalPixAccountListComponent.prototype, "isAllowToAddHistorical", {
10656
11055
  get: function () {
10657
11056
  return (this.permission["incluir"]);
@@ -10704,7 +11103,8 @@
10704
11103
  { type: core.ChangeDetectorRef },
10705
11104
  { type: router.Router },
10706
11105
  { type: api.MessageService },
10707
- { type: HistoricalPixAccountListService }
11106
+ { type: HistoricalPixAccountListService },
11107
+ { type: SharedStateService }
10708
11108
  ]; };
10709
11109
  __decorate([
10710
11110
  core.ViewChild(angularComponents.CustomFieldsComponent, { static: false })
@@ -10730,12 +11130,24 @@
10730
11130
  __decorate([
10731
11131
  core.Input()
10732
11132
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
11133
+ __decorate([
11134
+ core.Input()
11135
+ ], HistoricalPixAccountListComponent.prototype, "hideField", void 0);
10733
11136
  __decorate([
10734
11137
  core.Output()
10735
11138
  ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
11139
+ __decorate([
11140
+ core.Output()
11141
+ ], HistoricalPixAccountListComponent.prototype, "isOnlyEdit", void 0);
10736
11142
  __decorate([
10737
11143
  core.Output()
10738
11144
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
11145
+ __decorate([
11146
+ core.Output()
11147
+ ], HistoricalPixAccountListComponent.prototype, "isEditJudicialDependentPix", void 0);
11148
+ __decorate([
11149
+ core.Input()
11150
+ ], HistoricalPixAccountListComponent.prototype, "hideFieldsOnAdd$", null);
10739
11151
  __decorate([
10740
11152
  core.Input()
10741
11153
  ], HistoricalPixAccountListComponent.prototype, "reloadList", null);
@@ -10858,6 +11270,7 @@
10858
11270
  exports.PermissionService = PermissionService;
10859
11271
  exports.ReportService = ReportService;
10860
11272
  exports.ServicesModule = ServicesModule;
11273
+ exports.SharedStateService = SharedStateService;
10861
11274
  exports.SpinnerLoaderComponent = SpinnerLoaderComponent;
10862
11275
  exports.SpinnerLoaderModule = SpinnerLoaderModule;
10863
11276
  exports.StringMethods = StringMethods;
@@ -10953,7 +11366,8 @@
10953
11366
  exports.ɵo = AutocompleteService;
10954
11367
  exports.ɵp = LookupService$1;
10955
11368
  exports.ɵq = HistoricalBankAccountFormComponent;
10956
- exports.ɵr = HistoricalPixAccountFormComponent;
11369
+ exports.ɵr = HistoricakPixAccountBase;
11370
+ exports.ɵs = HistoricalPixAccountFormComponent;
10957
11371
 
10958
11372
  Object.defineProperty(exports, '__esModule', { value: true });
10959
11373