@senior-gestao-pessoas/payroll-core 9.5.0 → 9.6.0

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 (19) hide show
  1. package/bundles/senior-gestao-pessoas-payroll-core.umd.js +857 -815
  2. package/bundles/senior-gestao-pessoas-payroll-core.umd.js.map +1 -1
  3. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js +1 -1
  4. package/bundles/senior-gestao-pessoas-payroll-core.umd.min.js.map +1 -1
  5. package/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.d.ts +4 -2
  6. package/components/historical-pix-account/historical-pix-account.component.d.ts +5 -1
  7. package/components/historical-pix-account-list/historical-pix-account-list.component.d.ts +1 -0
  8. package/esm2015/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +18 -3
  9. package/esm2015/components/historical-pix-account/historical-pix-account.component.js +30 -7
  10. package/esm2015/components/historical-pix-account-list/historical-pix-account-list.component.js +6 -2
  11. package/esm5/components/historical-pix-account/historical-pix-account-form/historical-pix-account-form.component.js +19 -3
  12. package/esm5/components/historical-pix-account/historical-pix-account.component.js +30 -7
  13. package/esm5/components/historical-pix-account-list/historical-pix-account-list.component.js +6 -2
  14. package/fesm2015/senior-gestao-pessoas-payroll-core.js +732 -691
  15. package/fesm2015/senior-gestao-pessoas-payroll-core.js.map +1 -1
  16. package/fesm5/senior-gestao-pessoas-payroll-core.js +857 -815
  17. package/fesm5/senior-gestao-pessoas-payroll-core.js.map +1 -1
  18. package/package.json +1 -1
  19. package/senior-gestao-pessoas-payroll-core.metadata.json +1 -1
@@ -9255,443 +9255,6 @@ var FormatUtilsService = /** @class */ (function () {
9255
9255
  return FormatUtilsService;
9256
9256
  }());
9257
9257
 
9258
- var HistoricalPixAccountComponent = /** @class */ (function () {
9259
- function HistoricalPixAccountComponent(translateService, cd, formBuilder, messageService) {
9260
- var _this = this;
9261
- this.translateService = translateService;
9262
- this.cd = cd;
9263
- this.formBuilder = formBuilder;
9264
- this.messageService = messageService;
9265
- this.recordByRow = 1;
9266
- this.showDateChange = false;
9267
- this.isEditMode = false;
9268
- this.isViewMode = false;
9269
- this.withSideBar = true;
9270
- this.defaultCpfNumber = null;
9271
- this.listDataReciever = [];
9272
- this.isViewModeActive = new EventEmitter();
9273
- this.isEditModeActive = new EventEmitter();
9274
- this.isDeleteModeActive = new EventEmitter();
9275
- this.listFromApp = [];
9276
- this.visibleChange = new EventEmitter();
9277
- this.ngUnsubscribe = new Subject();
9278
- this.orderBy = {
9279
- field: "dateChange",
9280
- direction: DirectionEnumeration.DESC,
9281
- };
9282
- this.pixAccountItemInput = {};
9283
- this.totalRecords = 0;
9284
- this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9285
- this.loading = true;
9286
- this.listData = [];
9287
- this.listDataNoPage = [];
9288
- this.cols = [
9289
- {
9290
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9291
- field: "pixKeyType",
9292
- },
9293
- {
9294
- label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9295
- field: "pixKey",
9296
- },
9297
- {
9298
- label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9299
- field: "percentage",
9300
- },
9301
- ];
9302
- this.actions = function (rowData, key) {
9303
- if (rowData === void 0) { rowData = {}; }
9304
- return [
9305
- {
9306
- visible: _this.isEditMode,
9307
- label: _this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9308
- command: function () {
9309
- if (_this.isAllowToViewHistorical) {
9310
- rowData["index"] = key;
9311
- _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: false };
9312
- _this.visible = true;
9313
- }
9314
- else {
9315
- _this.isViewModeActive.emit(true);
9316
- }
9317
- },
9318
- },
9319
- {
9320
- visible: !!(!_this.isEditMode && _this.withSideBar),
9321
- label: _this.translateService.instant("hcm.payroll.edit"),
9322
- command: function () {
9323
- if (_this.isAllowToEditHistorical) {
9324
- rowData["index"] = key;
9325
- _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
9326
- _this.visible = true;
9327
- }
9328
- else {
9329
- _this.isEditModeActive.emit(true);
9330
- if (_this.listFromApp.length == 0) {
9331
- rowData["index"] = key;
9332
- _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true };
9333
- _this.visible = true;
9334
- }
9335
- }
9336
- },
9337
- },
9338
- {
9339
- visible: !_this.isEditMode,
9340
- label: _this.translateService.instant("hcm.payroll.delete"),
9341
- command: function () {
9342
- if (_this.isAllowToDeleteHistorical) {
9343
- _this.loading = true;
9344
- _this.deleteAnnuityItem(key);
9345
- }
9346
- else {
9347
- _this.isDeleteModeActive.emit(true);
9348
- if (_this.listFromApp.length == 0) {
9349
- _this.loading = true;
9350
- _this.deleteAnnuityItem(key);
9351
- }
9352
- }
9353
- },
9354
- },
9355
- ];
9356
- };
9357
- this.createFormGroup();
9358
- }
9359
- HistoricalPixAccountComponent.prototype.ngOnInit = function () {
9360
- this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9361
- };
9362
- HistoricalPixAccountComponent.prototype.ngOnChanges = function (changes) {
9363
- if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
9364
- this.listFromApp = changes['listDataReciever'].currentValue;
9365
- }
9366
- };
9367
- HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9368
- this.historicalPixAccountList = this.formBuilder.group({
9369
- historicalPixAccountList: this.formBuilder.control(null),
9370
- });
9371
- };
9372
- HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
9373
- this.ngUnsubscribe.next();
9374
- this.ngUnsubscribe.complete();
9375
- };
9376
- HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9377
- this.cd.detectChanges();
9378
- };
9379
- HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
9380
- var _this = this;
9381
- var first = event && event.first ? event.first : 0;
9382
- var rows = event && event.rows ? event.rows : this.recordByRow;
9383
- var arrList = this.getHistoricalPixAccountList();
9384
- this.listData = [];
9385
- this.totalRecords = null;
9386
- if (event && event.multiSortMeta && event.multiSortMeta.length) {
9387
- event.multiSortMeta.map(function (value) {
9388
- _this.orderBy.field = value.field;
9389
- _this.orderBy.direction = value.order === 1 ? DirectionEnumeration.ASC : DirectionEnumeration.DESC;
9390
- });
9391
- }
9392
- if (arrList && arrList.length) {
9393
- this.totalRecords = arrList.length;
9394
- this.listData = arrList;
9395
- this.listDataNoPage = __spread(arrList);
9396
- this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9397
- this.listData = this.listData.slice(first, (first + rows));
9398
- }
9399
- else {
9400
- this.listDataNoPage = [];
9401
- }
9402
- if (this.isEditMode || arrList && arrList.length === 1) {
9403
- this.refreshCssInIE11();
9404
- }
9405
- this.loading = false;
9406
- };
9407
- /**
9408
- * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
9409
- */
9410
- HistoricalPixAccountComponent.prototype.refreshCssInIE11 = function () {
9411
- if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
9412
- setTimeout(function () {
9413
- var row = document.getElementsByClassName("row0");
9414
- if (row && row[0])
9415
- row[0].className = 'refresh';
9416
- }, 1);
9417
- }
9418
- };
9419
- HistoricalPixAccountComponent.prototype.add = function () {
9420
- this.pixAccountItemInput = {};
9421
- this.visible = true;
9422
- };
9423
- HistoricalPixAccountComponent.prototype.isNotAllowMessage = function () {
9424
- this.messageService.add({
9425
- severity: "error",
9426
- summary: this.translateService.instant("hcm.payroll.error"),
9427
- detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9428
- });
9429
- };
9430
- HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
9431
- var newlist = __spread(this.getHistoricalPixAccountList());
9432
- newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9433
- delete newlist[index];
9434
- newlist = newlist.filter(function (val) { return val; });
9435
- this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
9436
- this.verifyTotalPercentage();
9437
- this.onLazyLoad();
9438
- };
9439
- HistoricalPixAccountComponent.prototype.getHistoricalPixAccountList = function () {
9440
- if (this.historicalPixAccountList.get("historicalPixAccountList") &&
9441
- this.historicalPixAccountList.get("historicalPixAccountList").value &&
9442
- this.historicalPixAccountList.get("historicalPixAccountList").value.length)
9443
- return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
9444
- else
9445
- return [];
9446
- };
9447
- HistoricalPixAccountComponent.prototype.addItemInList = function ($event) {
9448
- var index = $event && $event.index >= 0 ? $event.index : null;
9449
- var newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9450
- if (index != null) {
9451
- newDataList[index] = $event;
9452
- delete $event.index;
9453
- }
9454
- else {
9455
- if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
9456
- var customValue = mountCustomToSave($event["customFields"]);
9457
- $event["customFields"] = __spread(customValue);
9458
- }
9459
- $event["dateChange"] = this.dateChange;
9460
- newDataList.push($event);
9461
- }
9462
- this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
9463
- this.verifyTotalPercentage();
9464
- this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
9465
- };
9466
- HistoricalPixAccountComponent.prototype.getNumberPageByIndex = function (index, list) {
9467
- if (index) {
9468
- var total = list.length;
9469
- var sub = this.recordByRow - 1;
9470
- return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
9471
- }
9472
- return null;
9473
- };
9474
- HistoricalPixAccountComponent.prototype.verifyTotalPercentage = function () {
9475
- var list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
9476
- var arrayPercentage = [];
9477
- if (!list.length)
9478
- return this.msgTotalLimitByPercentage = null;
9479
- list.filter(function (item) { return arrayPercentage.push(item && item["percentage"]); });
9480
- var sumPercentage = arrayPercentage.reduce(function (total, percentage) {
9481
- return total + percentage;
9482
- }, 0);
9483
- if (sumPercentage === 100) {
9484
- this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
9485
- }
9486
- else {
9487
- this.msgTotalLimitByPercentage = null;
9488
- }
9489
- };
9490
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
9491
- get: function () {
9492
- return this.actions.bind(this);
9493
- },
9494
- enumerable: true,
9495
- configurable: true
9496
- });
9497
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
9498
- get: function () {
9499
- return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
9500
- },
9501
- enumerable: true,
9502
- configurable: true
9503
- });
9504
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "getTooltipAndDisableButtonAdd", {
9505
- get: function () {
9506
- return this.dateChange ? null : this.msgTooltipAdd;
9507
- },
9508
- enumerable: true,
9509
- configurable: true
9510
- });
9511
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "dateChange", {
9512
- get: function () {
9513
- return this._dateChange;
9514
- },
9515
- set: function (value) {
9516
- var _this = this;
9517
- this._dateChange = value;
9518
- if (this._dateChange) {
9519
- this.listData.filter(function (row) { return row["dateChange"] = _this._dateChange; });
9520
- }
9521
- },
9522
- enumerable: true,
9523
- configurable: true
9524
- });
9525
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
9526
- get: function () {
9527
- return this._displayDateChange;
9528
- },
9529
- set: function (value) {
9530
- var _this = this;
9531
- this._displayDateChange = value;
9532
- if (this._displayDateChange) {
9533
- this.listData.filter(function (row) { return row["displayDateChange"] = _this._displayDateChange; });
9534
- }
9535
- },
9536
- enumerable: true,
9537
- configurable: true
9538
- });
9539
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "addListData", {
9540
- set: function (list) {
9541
- this.loading = true;
9542
- this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
9543
- this.verifyTotalPercentage();
9544
- this.onLazyLoad();
9545
- },
9546
- enumerable: true,
9547
- configurable: true
9548
- });
9549
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
9550
- get: function () {
9551
- return this._visible;
9552
- },
9553
- set: function (value) {
9554
- this._visible = value;
9555
- this.visibleChange.emit(this.visible);
9556
- },
9557
- enumerable: true,
9558
- configurable: true
9559
- });
9560
- HistoricalPixAccountComponent.prototype.close = function () {
9561
- this.visible = false;
9562
- };
9563
- HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
9564
- return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
9565
- };
9566
- HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
9567
- return FormatUtilsService.getFormattedCpf(cpf);
9568
- };
9569
- HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
9570
- return FormatUtilsService.getFormattedCnpj(cnpj);
9571
- };
9572
- HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
9573
- return FormatUtilsService.getFormattedPercentage(value);
9574
- };
9575
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
9576
- get: function () {
9577
- return (this.permission["incluir"]);
9578
- },
9579
- enumerable: true,
9580
- configurable: true
9581
- });
9582
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToDeleteHistorical", {
9583
- get: function () {
9584
- return (this.permission["excluir"]);
9585
- },
9586
- enumerable: true,
9587
- configurable: true
9588
- });
9589
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToEditHistorical", {
9590
- get: function () {
9591
- return (this.permission["editar"]);
9592
- },
9593
- enumerable: true,
9594
- configurable: true
9595
- });
9596
- Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToViewHistorical", {
9597
- get: function () {
9598
- return (this.permission["visualizar"]);
9599
- },
9600
- enumerable: true,
9601
- configurable: true
9602
- });
9603
- HistoricalPixAccountComponent.ctorParameters = function () { return [
9604
- { type: TranslateService },
9605
- { type: ChangeDetectorRef },
9606
- { type: FormBuilder },
9607
- { type: MessageService }
9608
- ]; };
9609
- __decorate([
9610
- ViewChild(CustomFieldsComponent$1, { static: false })
9611
- ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
9612
- __decorate([
9613
- Input()
9614
- ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
9615
- __decorate([
9616
- Input()
9617
- ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
9618
- __decorate([
9619
- Input()
9620
- ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
9621
- __decorate([
9622
- Input()
9623
- ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
9624
- __decorate([
9625
- Input()
9626
- ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
9627
- __decorate([
9628
- Input()
9629
- ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
9630
- __decorate([
9631
- Input()
9632
- ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
9633
- __decorate([
9634
- Input()
9635
- ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
9636
- __decorate([
9637
- Input()
9638
- ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
9639
- __decorate([
9640
- Input()
9641
- ], HistoricalPixAccountComponent.prototype, "currency", void 0);
9642
- __decorate([
9643
- Input()
9644
- ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
9645
- __decorate([
9646
- Input()
9647
- ], HistoricalPixAccountComponent.prototype, "customService", void 0);
9648
- __decorate([
9649
- Input()
9650
- ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
9651
- __decorate([
9652
- Input()
9653
- ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
9654
- __decorate([
9655
- Input()
9656
- ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
9657
- __decorate([
9658
- Input()
9659
- ], HistoricalPixAccountComponent.prototype, "permission", void 0);
9660
- __decorate([
9661
- Input()
9662
- ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
9663
- __decorate([
9664
- Output()
9665
- ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
9666
- __decorate([
9667
- Output()
9668
- ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
9669
- __decorate([
9670
- Output()
9671
- ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
9672
- __decorate([
9673
- Input()
9674
- ], HistoricalPixAccountComponent.prototype, "dateChange", null);
9675
- __decorate([
9676
- Input()
9677
- ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
9678
- __decorate([
9679
- Input()
9680
- ], HistoricalPixAccountComponent.prototype, "addListData", null);
9681
- __decorate([
9682
- Input()
9683
- ], HistoricalPixAccountComponent.prototype, "visible", null);
9684
- HistoricalPixAccountComponent = __decorate([
9685
- Component({
9686
- // tslint:disable-next-line:component-selector
9687
- selector: "c-historical-pix-account",
9688
- template: "<s-sidebar *ngIf=\"withSideBar\" [visible]=\"visible\" (visibleChange)=\"close()\"\n header=\"{{'hcm.payroll.historical_pix_account_title_form'|translate}}\">\n<pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</s-sidebar>\n\n<div *ngIf=\"!withSideBar\">\n <pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [withSideBar]=\"false\"\n [isViewMode]=\"isViewMode\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</div>\n\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"!isViewMode && actions(rowData, key).length > 1\" [label]=\"actionLabel\"\n priority=\"default\" [model]=\"scopedActions(rowData, key)\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n\n <s-button id=\"table-admission-btn-action-{{key}}\"\n *ngIf=\"!isViewMode && actions(rowData, key).length <= 1\"\n [label]=\"scopedActions(rowData, key)[0].label\"\n priority=\"default\"\n (click)=\"scopedActions(rowData, key)[0].command()\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length +2\">\n {{'hcm.payroll.admission_empty_message'|translate}}\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span *ngIf=\"totalRecords\">{{recordsMessage}}</span>\n </ng-template>\n </p-table>\n</div>\n",
9689
- 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}"]
9690
- })
9691
- ], HistoricalPixAccountComponent);
9692
- return HistoricalPixAccountComponent;
9693
- }());
9694
-
9695
9258
  var GenericValidator = /** @class */ (function () {
9696
9259
  function GenericValidator() {
9697
9260
  }
@@ -9750,489 +9313,964 @@ var GenericValidator = /** @class */ (function () {
9750
9313
  break;
9751
9314
  }
9752
9315
  }
9753
- if (!equalDigits) {
9754
- numbers = cpf.substring(0, 9);
9755
- digits = cpf.substring(9);
9756
- sum = 0;
9757
- for (i = 10; i > 1; i--) {
9758
- sum += numbers.charAt(10 - i) * i;
9759
- }
9760
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9761
- if (result !== Number(digits.charAt(0))) {
9762
- return { cpfNotValid: true };
9763
- }
9764
- numbers = cpf.substring(0, 10);
9765
- sum = 0;
9766
- for (i = 11; i > 1; i--) {
9767
- sum += numbers.charAt(11 - i) * i;
9316
+ if (!equalDigits) {
9317
+ numbers = cpf.substring(0, 9);
9318
+ digits = cpf.substring(9);
9319
+ sum = 0;
9320
+ for (i = 10; i > 1; i--) {
9321
+ sum += numbers.charAt(10 - i) * i;
9322
+ }
9323
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9324
+ if (result !== Number(digits.charAt(0))) {
9325
+ return { cpfNotValid: true };
9326
+ }
9327
+ numbers = cpf.substring(0, 10);
9328
+ sum = 0;
9329
+ for (i = 11; i > 1; i--) {
9330
+ sum += numbers.charAt(11 - i) * i;
9331
+ }
9332
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9333
+ if (result !== Number(digits.charAt(1))) {
9334
+ return { cpfNotValid: true };
9335
+ }
9336
+ return null;
9337
+ }
9338
+ else {
9339
+ return { cpfNotValid: true };
9340
+ }
9341
+ }
9342
+ return null;
9343
+ };
9344
+ /**
9345
+ * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9346
+ */
9347
+ GenericValidator.isValidCnpj = function (control) {
9348
+ var cnpj = control.value;
9349
+ if (cnpj) {
9350
+ var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9351
+ cnpj = cnpj.replace(/[^\d]+/g, '');
9352
+ if (cnpj.length !== 14) {
9353
+ return null;
9354
+ }
9355
+ // Elimina CNPJs invalidos conhecidos
9356
+ if (cnpj === '00000000000000' ||
9357
+ cnpj === '11111111111111' ||
9358
+ cnpj === '22222222222222' ||
9359
+ cnpj === '33333333333333' ||
9360
+ cnpj === '44444444444444' ||
9361
+ cnpj === '55555555555555' ||
9362
+ cnpj === '66666666666666' ||
9363
+ cnpj === '77777777777777' ||
9364
+ cnpj === '88888888888888' ||
9365
+ cnpj === '99999999999999') {
9366
+ return { cnpjNotValid: true };
9367
+ }
9368
+ // Valida DVs
9369
+ size = cnpj.length - 2;
9370
+ numbers = cnpj.substring(0, size);
9371
+ digits = cnpj.substring(size);
9372
+ sum = 0;
9373
+ pos = size - 7;
9374
+ for (var i = size; i >= 1; i--) {
9375
+ sum += numbers.charAt(size - i) * pos--;
9376
+ if (pos < 2) {
9377
+ pos = 9;
9378
+ }
9379
+ }
9380
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9381
+ if (result !== Number(digits.charAt(0))) {
9382
+ return { cnpjNotValid: true };
9383
+ }
9384
+ size = size + 1;
9385
+ numbers = cnpj.substring(0, size);
9386
+ sum = 0;
9387
+ pos = size - 7;
9388
+ for (var i = size; i >= 1; i--) {
9389
+ sum += numbers.charAt(size - i) * pos--;
9390
+ if (pos < 2) {
9391
+ pos = 9;
9392
+ }
9393
+ }
9394
+ result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9395
+ if (result !== Number(digits.charAt(1))) {
9396
+ return { cnpjNotValid: true };
9397
+ }
9398
+ return null;
9399
+ }
9400
+ return null;
9401
+ };
9402
+ /**
9403
+ * Válida o número de telefone da chave PIX.
9404
+ */
9405
+ GenericValidator.isValidPhoneNumber = function (control) {
9406
+ var cellPhoneKey = control.value || '';
9407
+ cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9408
+ var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9409
+ var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9410
+ return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9411
+ };
9412
+ /**
9413
+ * Valida o email da chave PIX.
9414
+ */
9415
+ GenericValidator.isValidEmail = function (control) {
9416
+ var emailKey = control.value;
9417
+ var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9418
+ var isValidEmail = regexValidEmail.test(emailKey);
9419
+ return isValidEmail ? null : { invalidEmail: true };
9420
+ };
9421
+ return GenericValidator;
9422
+ }());
9423
+
9424
+ var HistoricalPixAccountFormComponent = /** @class */ (function () {
9425
+ function HistoricalPixAccountFormComponent(formBuilder, cd) {
9426
+ this.formBuilder = formBuilder;
9427
+ this.cd = cd;
9428
+ this.withSideBar = true;
9429
+ this.isEditMode = false;
9430
+ this.paramsForm = new FormGroup({});
9431
+ this.defaultCpfNumber = null;
9432
+ this.permitsEditBankAccountForm = false;
9433
+ this.visibleChange = new EventEmitter();
9434
+ this.pixAccountItemToList = new EventEmitter();
9435
+ this.ngUnsubscribe = new Subject();
9436
+ this.initialValidatorOfPercentage = [Validators.required, Validators.min(0.01)];
9437
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9438
+ this.maxValuePercentage = 100.00;
9439
+ this.visibleBtnSave = true;
9440
+ this.isView = false;
9441
+ this.isShowPixKeyFieldValidatorMessage = false;
9442
+ this.createFormGroup();
9443
+ this.registerSubjects();
9444
+ }
9445
+ HistoricalPixAccountFormComponent.prototype.ngOnInit = function () {
9446
+ };
9447
+ HistoricalPixAccountFormComponent.prototype.ngDoCheck = function () {
9448
+ if (this.pixAccountFormGroup && this.pixKeyType === "BANK_ACCOUNT") {
9449
+ var pixKeyControl = this.pixAccountFormGroup.get("pixKey");
9450
+ if (pixKeyControl && !pixKeyControl.disabled) {
9451
+ pixKeyControl.disable();
9452
+ }
9453
+ }
9454
+ };
9455
+ HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
9456
+ this.cd.detectChanges();
9457
+ };
9458
+ HistoricalPixAccountFormComponent.prototype.ngOnDestroy = function () {
9459
+ this.ngUnsubscribe.next(true);
9460
+ this.ngUnsubscribe.unsubscribe();
9461
+ };
9462
+ HistoricalPixAccountFormComponent.prototype.registerSubjects = function () {
9463
+ };
9464
+ HistoricalPixAccountFormComponent.prototype.createFormGroup = function () {
9465
+ this.pixAccountFormGroup = this.formBuilder.group({
9466
+ id: this.formBuilder.control(null),
9467
+ index: this.formBuilder.control(null),
9468
+ employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9469
+ dateChange: this.formBuilder.control(null),
9470
+ pixKeyType: this.formBuilder.control(null, Validators.required),
9471
+ pixKey: this.formBuilder.control(null),
9472
+ percentage: this.formBuilder.control(null, Validators.compose(__spread(this.initialValidatorOfPercentage, [
9473
+ Validators.max(this.maxValuePercentage),
9474
+ ]))),
9475
+ externalId: this.formBuilder.control(null),
9476
+ customFields: this.formBuilder.control(null),
9477
+ });
9478
+ };
9479
+ HistoricalPixAccountFormComponent.prototype.onChangePixKeyType = function (item) {
9480
+ if (item.key) {
9481
+ this.pixKeyType = item.key;
9482
+ this.isShowPixKeyFieldValidatorMessage = true;
9483
+ this.pixAccountFormGroup.get("pixKey").reset();
9484
+ this.setPixKeyValidators(true);
9485
+ if (item.key === "CPF") {
9486
+ this.setDefaultCpfPixKey();
9487
+ }
9488
+ }
9489
+ };
9490
+ HistoricalPixAccountFormComponent.prototype.onClearPixKeyType = function () {
9491
+ this.isShowPixKeyFieldValidatorMessage = false;
9492
+ this.pixAccountFormGroup.get("pixKey").reset();
9493
+ };
9494
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
9495
+ get: function () {
9496
+ return this._visible;
9497
+ },
9498
+ set: function (value) {
9499
+ this._visible = value;
9500
+ this.visibleChange.emit(this.visible);
9501
+ },
9502
+ enumerable: true,
9503
+ configurable: true
9504
+ });
9505
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", {
9506
+ set: function (value) {
9507
+ this.resetForm();
9508
+ this.visibleBtnSave = true;
9509
+ if (value && value.permitsEditBankAccount) {
9510
+ this.permitsEditBankAccountForm = true;
9511
+ }
9512
+ if (value && value.currentItem && Object.keys(value.currentItem).length) {
9513
+ this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(__assign({}, value.currentItem)));
9514
+ this.labelBtnAdd = "hcm.payroll.employees_update";
9515
+ this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
9516
+ if (!this.isView) {
9517
+ this.configEnableFields(value && value["isEditMode"]);
9768
9518
  }
9769
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9770
- if (result !== Number(digits.charAt(1))) {
9771
- return { cpfNotValid: true };
9519
+ else {
9520
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
9521
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9522
+ this.formatPixKeyTelephoneNumber();
9523
+ }
9772
9524
  }
9773
- return null;
9774
9525
  }
9775
9526
  else {
9776
- return { cpfNotValid: true };
9527
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9777
9528
  }
9529
+ },
9530
+ enumerable: true,
9531
+ configurable: true
9532
+ });
9533
+ HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
9534
+ if (this.pixKeyType === "TELEPHONE") {
9535
+ this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
9778
9536
  }
9779
- return null;
9780
9537
  };
9781
- /**
9782
- * Valida se o CNPJ é valido. Deve-se ser informado o cpf sem máscara.
9783
- */
9784
- GenericValidator.isValidCnpj = function (control) {
9785
- var cnpj = control.value;
9786
- if (cnpj) {
9787
- var size = void 0, numbers = void 0, digits = void 0, sum = void 0, pos = void 0, result = void 0;
9788
- cnpj = cnpj.replace(/[^\d]+/g, '');
9789
- if (cnpj.length !== 14) {
9790
- return null;
9538
+ HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
9539
+ var obj = __assign({}, data);
9540
+ obj["customFields"] = mountCustomToShow(obj["customFields"]);
9541
+ return obj;
9542
+ };
9543
+ HistoricalPixAccountFormComponent.prototype.configEnableFields = function (isEditMode) {
9544
+ this.visibleBtnSave = isEditMode;
9545
+ if (this.pixAccountFormGroup.get("pixKeyType").value) {
9546
+ this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9547
+ this.setPixKeyValidators(isEditMode);
9548
+ this.formatPixKeyTelephoneNumber();
9549
+ }
9550
+ configEnabledFields(this.pixAccountFormGroup, isEditMode, [
9551
+ "pixKeyType",
9552
+ "pixKey",
9553
+ "percentage",
9554
+ "customFields",
9555
+ ], []);
9556
+ };
9557
+ HistoricalPixAccountFormComponent.prototype.close = function () {
9558
+ this.resetForm();
9559
+ this.visible = false;
9560
+ };
9561
+ HistoricalPixAccountFormComponent.prototype.addItem = function () {
9562
+ this.pixAccountFormGroup.updateValueAndValidity();
9563
+ verifyValidationsForm.call(this.pixAccountFormGroup);
9564
+ if (this.pixAccountFormGroup.valid) {
9565
+ if (this.employeeId) {
9566
+ this.pixAccountFormGroup.get("employee").setValue({
9567
+ tableId: this.employeeId,
9568
+ name: "",
9569
+ });
9791
9570
  }
9792
- // Elimina CNPJs invalidos conhecidos
9793
- if (cnpj === '00000000000000' ||
9794
- cnpj === '11111111111111' ||
9795
- cnpj === '22222222222222' ||
9796
- cnpj === '33333333333333' ||
9797
- cnpj === '44444444444444' ||
9798
- cnpj === '55555555555555' ||
9799
- cnpj === '66666666666666' ||
9800
- cnpj === '77777777777777' ||
9801
- cnpj === '88888888888888' ||
9802
- cnpj === '99999999999999') {
9803
- return { cnpjNotValid: true };
9571
+ this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
9572
+ this.visible = false;
9573
+ this.resetForm();
9574
+ }
9575
+ };
9576
+ HistoricalPixAccountFormComponent.prototype.resetForm = function () {
9577
+ this.pixAccountFormGroup.reset();
9578
+ this.labelBtnAdd = "hcm.payroll.employees_add";
9579
+ if (this.customFields && this.customFields.formGroup)
9580
+ this.customFields.formGroup.reset();
9581
+ };
9582
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "percentagePlaceholder", {
9583
+ get: function () {
9584
+ return "0" + (this.currency && this.currency.decimalSeparator) + "00";
9585
+ },
9586
+ enumerable: true,
9587
+ configurable: true
9588
+ });
9589
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "optionsPercentage", {
9590
+ get: function () {
9591
+ return __assign({}, this.getOptions(), { precision: 2 });
9592
+ },
9593
+ enumerable: true,
9594
+ configurable: true
9595
+ });
9596
+ HistoricalPixAccountFormComponent.prototype.getOptions = function () {
9597
+ return {
9598
+ prefix: "",
9599
+ thousands: this.currency.thousandsSeparator,
9600
+ decimal: this.currency.decimalSeparator,
9601
+ };
9602
+ };
9603
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "getListPixAccount", {
9604
+ /**
9605
+ * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
9606
+ * @param pixAccountList
9607
+ */
9608
+ set: function (pixAccountList) {
9609
+ if (pixAccountList) {
9610
+ this.setValidatorsAccordingList(pixAccountList, null, false);
9804
9611
  }
9805
- // Valida DVs
9806
- size = cnpj.length - 2;
9807
- numbers = cnpj.substring(0, size);
9808
- digits = cnpj.substring(size);
9809
- sum = 0;
9810
- pos = size - 7;
9811
- for (var i = size; i >= 1; i--) {
9812
- sum += numbers.charAt(size - i) * pos--;
9813
- if (pos < 2) {
9814
- pos = 9;
9612
+ else {
9613
+ this.resetForm();
9614
+ }
9615
+ },
9616
+ enumerable: true,
9617
+ configurable: true
9618
+ });
9619
+ /**
9620
+ * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
9621
+ * a validação dos campos "percentage" e "pixAccount".
9622
+ * 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
9623
+ * no array de comparação dos validators.
9624
+ * @param pixAccountList
9625
+ * @param index
9626
+ */
9627
+ HistoricalPixAccountFormComponent.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode) {
9628
+ if (index === void 0) { index = null; }
9629
+ if (isEditMode === void 0) { isEditMode = true; }
9630
+ this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
9631
+ var percentageIncluded = [];
9632
+ if (this.pixAccountList && this.pixAccountList.length) {
9633
+ this.pixAccountList.filter(function (field, key) {
9634
+ if (field["percentage"] && key != index) {
9635
+ percentageIncluded.push(field["percentage"]);
9815
9636
  }
9637
+ });
9638
+ }
9639
+ this.beforeSetPixKeyTypeValidator();
9640
+ this.setPixKeyValidators(isEditMode);
9641
+ this.validatePercentageValid(percentageIncluded);
9642
+ };
9643
+ /**
9644
+ * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
9645
+ */
9646
+ HistoricalPixAccountFormComponent.prototype.setPixKeyValidators = function (isEditMode) {
9647
+ var genericPixKey = this.pixAccountFormGroup.get("pixKey");
9648
+ if (this.pixKeyType) {
9649
+ switch (this.pixKeyType) {
9650
+ case "TELEPHONE":
9651
+ genericPixKey.setValidators(Validators.compose([
9652
+ Validators.required, GenericValidator.isValidPhoneNumber,
9653
+ ]));
9654
+ break;
9655
+ case "EMAIL":
9656
+ genericPixKey.setValidators(Validators.compose([
9657
+ Validators.required, GenericValidator.isValidEmail,
9658
+ ]));
9659
+ break;
9660
+ case "CPF":
9661
+ genericPixKey.setValidators(Validators.compose([
9662
+ Validators.required, GenericValidator.isValidCpf,
9663
+ ]));
9664
+ break;
9665
+ case "CNPJ":
9666
+ genericPixKey.setValidators(Validators.compose([
9667
+ Validators.required, GenericValidator.isValidCnpj,
9668
+ ]));
9669
+ break;
9670
+ case "RANDOM_KEY":
9671
+ genericPixKey.setValidators(Validators.required);
9672
+ break;
9673
+ default:
9674
+ genericPixKey.setValidators(null);
9675
+ break;
9816
9676
  }
9817
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9818
- if (result !== Number(digits.charAt(0))) {
9819
- return { cnpjNotValid: true };
9677
+ if (isEditMode) {
9678
+ genericPixKey.enable();
9820
9679
  }
9821
- size = size + 1;
9822
- numbers = cnpj.substring(0, size);
9823
- sum = 0;
9824
- pos = size - 7;
9825
- for (var i = size; i >= 1; i--) {
9826
- sum += numbers.charAt(size - i) * pos--;
9827
- if (pos < 2) {
9828
- pos = 9;
9680
+ genericPixKey.updateValueAndValidity();
9681
+ }
9682
+ };
9683
+ /**
9684
+ * Este método calcula as parcentagens que foram inseridas, e seta a diferença para chegar em
9685
+ * 100% na validação do campo "percentage" como um novo maxValue;
9686
+ * @param listValue
9687
+ */
9688
+ HistoricalPixAccountFormComponent.prototype.validatePercentageValid = function (listValue) {
9689
+ var percentage = this.pixAccountFormGroup.get("percentage");
9690
+ this.maxValuePercentage = listValue
9691
+ .reduce(function (currentValue, total) { return currentValue - total; }, 100.00);
9692
+ percentage
9693
+ .setValidators(Validators.compose(__spread(this.initialValidatorOfPercentage, [
9694
+ Validators.max(this.maxValuePercentage),
9695
+ ])));
9696
+ percentage.updateValueAndValidity();
9697
+ };
9698
+ Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
9699
+ set: function (condition) {
9700
+ this.isView = !!(condition && !this.withSideBar);
9701
+ this.configEnableFields(!this.isView);
9702
+ if (!this.isView)
9703
+ this.resetForm();
9704
+ },
9705
+ enumerable: true,
9706
+ configurable: true
9707
+ });
9708
+ HistoricalPixAccountFormComponent.prototype.phoneMask = function (event) {
9709
+ FormatUtilsService.formatTelephoneInputEvent(event);
9710
+ };
9711
+ HistoricalPixAccountFormComponent.prototype.setDefaultCpfPixKey = function () {
9712
+ if (this.defaultCpfNumber) {
9713
+ this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
9714
+ }
9715
+ else {
9716
+ var sheetDocument = this.paramsForm.get("sheetDocument");
9717
+ if (sheetDocument) {
9718
+ var cpf = sheetDocument.get("cpfNumber").value;
9719
+ if (cpf) {
9720
+ this.pixAccountFormGroup.get("pixKey").setValue(cpf);
9829
9721
  }
9830
9722
  }
9831
- result = sum % 11 < 2 ? 0 : 11 - (sum % 11);
9832
- if (result !== Number(digits.charAt(1))) {
9833
- return { cnpjNotValid: true };
9834
- }
9835
- return null;
9836
9723
  }
9837
- return null;
9838
9724
  };
9839
- /**
9840
- * Válida o número de telefone da chave PIX.
9841
- */
9842
- GenericValidator.isValidPhoneNumber = function (control) {
9843
- var cellPhoneKey = control.value || '';
9844
- cellPhoneKey = cellPhoneKey.replace(/[\s()-]/g, '');
9845
- var regexNumberTelephone = /^[1-9][\d]{1,2}\d{8,10}$/;
9846
- var isValidNumberTelephone = regexNumberTelephone.test(cellPhoneKey);
9847
- return isValidNumberTelephone ? null : { invalidPhoneNumber: true };
9725
+ HistoricalPixAccountFormComponent.prototype.beforeSetPixKeyTypeValidator = function () {
9726
+ var pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
9727
+ if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
9728
+ pixKeyType
9729
+ .setValidators(Validators.compose([
9730
+ Validators.required,
9731
+ this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
9732
+ ]));
9733
+ }
9734
+ else {
9735
+ pixKeyType.setValidators(Validators.required);
9736
+ }
9848
9737
  };
9849
- /**
9850
- * Valida o email da chave PIX.
9851
- */
9852
- GenericValidator.isValidEmail = function (control) {
9853
- var emailKey = control.value;
9854
- var regexValidEmail = /^[\w-\.]+@[\w-]+(\.[\w-]{2,4}){1,2}$/;
9855
- var isValidEmail = regexValidEmail.test(emailKey);
9856
- return isValidEmail ? null : { invalidEmail: true };
9738
+ HistoricalPixAccountFormComponent.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
9739
+ var _this = this;
9740
+ return function (control) {
9741
+ var value = control && control.value;
9742
+ var condition = false;
9743
+ listCompare.filter(function (field) {
9744
+ if (value) {
9745
+ if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
9746
+ return condition = true;
9747
+ }
9748
+ }
9749
+ });
9750
+ if (condition && !_this.permitsEditBankAccountForm) {
9751
+ return { pixKeyTypeBankAccountDuplicate: true };
9752
+ }
9753
+ else {
9754
+ return null;
9755
+ }
9756
+ };
9857
9757
  };
9858
- return GenericValidator;
9758
+ HistoricalPixAccountFormComponent.ctorParameters = function () { return [
9759
+ { type: FormBuilder },
9760
+ { type: ChangeDetectorRef }
9761
+ ]; };
9762
+ __decorate([
9763
+ ViewChild(CustomFieldsComponent$1, { static: true })
9764
+ ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
9765
+ __decorate([
9766
+ Input()
9767
+ ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
9768
+ __decorate([
9769
+ Input()
9770
+ ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
9771
+ __decorate([
9772
+ Input()
9773
+ ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
9774
+ __decorate([
9775
+ Input()
9776
+ ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
9777
+ __decorate([
9778
+ Input()
9779
+ ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
9780
+ __decorate([
9781
+ Input()
9782
+ ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
9783
+ __decorate([
9784
+ Input()
9785
+ ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
9786
+ __decorate([
9787
+ Input()
9788
+ ], HistoricalPixAccountFormComponent.prototype, "permitsEditBankAccountForm", void 0);
9789
+ __decorate([
9790
+ Output()
9791
+ ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
9792
+ __decorate([
9793
+ Output()
9794
+ ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
9795
+ __decorate([
9796
+ Input()
9797
+ ], HistoricalPixAccountFormComponent.prototype, "visible", null);
9798
+ __decorate([
9799
+ Input()
9800
+ ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
9801
+ __decorate([
9802
+ Input()
9803
+ ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
9804
+ __decorate([
9805
+ Input()
9806
+ ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
9807
+ HistoricalPixAccountFormComponent = __decorate([
9808
+ Component({
9809
+ selector: "pix-account",
9810
+ 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",
9811
+ 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}"]
9812
+ })
9813
+ ], HistoricalPixAccountFormComponent);
9814
+ return HistoricalPixAccountFormComponent;
9859
9815
  }());
9860
9816
 
9861
- var HistoricalPixAccountFormComponent = /** @class */ (function () {
9862
- function HistoricalPixAccountFormComponent(formBuilder, cd) {
9863
- this.formBuilder = formBuilder;
9817
+ var HistoricalPixAccountComponent = /** @class */ (function () {
9818
+ function HistoricalPixAccountComponent(translateService, cd, formBuilder, messageService) {
9819
+ var _this = this;
9820
+ this.translateService = translateService;
9864
9821
  this.cd = cd;
9865
- this.withSideBar = true;
9822
+ this.formBuilder = formBuilder;
9823
+ this.messageService = messageService;
9824
+ this.recordByRow = 1;
9825
+ this.showDateChange = false;
9866
9826
  this.isEditMode = false;
9867
- this.paramsForm = new FormGroup({});
9827
+ this.isViewMode = false;
9828
+ this.withSideBar = true;
9868
9829
  this.defaultCpfNumber = null;
9830
+ this.listDataReciever = [];
9831
+ this.showButtonEdit = false;
9832
+ this.isViewModeActive = new EventEmitter();
9833
+ this.isEditModeActive = new EventEmitter();
9834
+ this.isDeleteModeActive = new EventEmitter();
9835
+ this.listFromApp = [];
9869
9836
  this.visibleChange = new EventEmitter();
9870
- this.pixAccountItemToList = new EventEmitter();
9871
9837
  this.ngUnsubscribe = new Subject();
9872
- this.initialValidatorOfPercentage = [Validators.required, Validators.min(0.01)];
9873
- this.labelBtnAdd = "hcm.payroll.employees_add";
9874
- this.maxValuePercentage = 100.00;
9875
- this.visibleBtnSave = true;
9876
- this.isView = false;
9877
- this.isShowPixKeyFieldValidatorMessage = false;
9838
+ this.orderBy = {
9839
+ field: "dateChange",
9840
+ direction: DirectionEnumeration.DESC,
9841
+ };
9842
+ this.pixAccountItemInput = {};
9843
+ this.totalRecords = 0;
9844
+ this.actionLabel = this.translateService.instant("hcm.payroll.entries_query_actions_total_title");
9845
+ this.loading = true;
9846
+ this.listData = [];
9847
+ this.listDataNoPage = [];
9848
+ this.permitsEditBankAccount = false;
9849
+ this.cols = [
9850
+ {
9851
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key_type"),
9852
+ field: "pixKeyType",
9853
+ },
9854
+ {
9855
+ label: this.translateService.instant("hcm.payroll.employees_addition_pix_key"),
9856
+ field: "pixKey",
9857
+ },
9858
+ {
9859
+ label: this.translateService.instant("hcm.payroll.historical_pix_account_label_percentage"),
9860
+ field: "percentage",
9861
+ },
9862
+ ];
9863
+ this.actions = function (rowData, key) {
9864
+ if (rowData === void 0) { rowData = {}; }
9865
+ return [
9866
+ {
9867
+ visible: _this.isEditMode,
9868
+ label: _this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9869
+ command: function () {
9870
+ if (_this.isAllowToViewHistorical) {
9871
+ rowData["index"] = key;
9872
+ _this.pixAccountItemInput = { currentItem: rowData, listData: _this.listDataNoPage, isEditMode: false };
9873
+ _this.visible = true;
9874
+ }
9875
+ else {
9876
+ _this.isViewModeActive.emit(true);
9877
+ }
9878
+ },
9879
+ },
9880
+ {
9881
+ visible: !!((!_this.isEditMode && _this.withSideBar) || _this.showButtonEdit),
9882
+ label: _this.translateService.instant("hcm.payroll.edit"),
9883
+ command: function () {
9884
+ _this.permitsEditBankAccount = true;
9885
+ if (_this.isAllowToEditHistorical) {
9886
+ rowData["index"] = key;
9887
+ _this.pixAccountItemInput = {
9888
+ currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true, permitsEditBankAccount: true
9889
+ };
9890
+ _this.visible = true;
9891
+ }
9892
+ else {
9893
+ _this.isEditModeActive.emit(true);
9894
+ if (_this.listFromApp.length == 0) {
9895
+ rowData["index"] = key;
9896
+ _this.pixAccountItemInput = {
9897
+ currentItem: rowData, listData: _this.listDataNoPage, isEditMode: true, permitsEditBankAccount: true
9898
+ };
9899
+ }
9900
+ }
9901
+ },
9902
+ },
9903
+ {
9904
+ visible: !_this.isEditMode,
9905
+ label: _this.translateService.instant("hcm.payroll.delete"),
9906
+ command: function () {
9907
+ if (_this.isAllowToDeleteHistorical) {
9908
+ _this.loading = true;
9909
+ _this.deleteAnnuityItem(key);
9910
+ }
9911
+ else {
9912
+ _this.isDeleteModeActive.emit(true);
9913
+ if (_this.listFromApp.length == 0) {
9914
+ _this.loading = true;
9915
+ _this.deleteAnnuityItem(key);
9916
+ }
9917
+ }
9918
+ },
9919
+ },
9920
+ ];
9921
+ };
9878
9922
  this.createFormGroup();
9879
- this.registerSubjects();
9880
9923
  }
9881
- HistoricalPixAccountFormComponent.prototype.ngOnInit = function () {
9924
+ HistoricalPixAccountComponent.prototype.ngOnInit = function () {
9925
+ this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
9882
9926
  };
9883
- HistoricalPixAccountFormComponent.prototype.ngAfterViewInit = function () {
9927
+ HistoricalPixAccountComponent.prototype.ngOnChanges = function (changes) {
9928
+ if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
9929
+ this.listFromApp = changes['listDataReciever'].currentValue;
9930
+ }
9931
+ if (changes['showButtonEdit'] && changes['showButtonEdit'].currentValue) {
9932
+ this.permitsEditBankAccount = changes['showButtonEdit'].currentValue;
9933
+ }
9934
+ };
9935
+ HistoricalPixAccountComponent.prototype.createFormGroup = function () {
9936
+ this.historicalPixAccountList = this.formBuilder.group({
9937
+ historicalPixAccountList: this.formBuilder.control(null),
9938
+ });
9939
+ };
9940
+ HistoricalPixAccountComponent.prototype.ngOnDestroy = function () {
9941
+ this.ngUnsubscribe.next();
9942
+ this.ngUnsubscribe.complete();
9943
+ };
9944
+ HistoricalPixAccountComponent.prototype.ngAfterViewInit = function () {
9884
9945
  this.cd.detectChanges();
9885
9946
  };
9886
- HistoricalPixAccountFormComponent.prototype.ngOnDestroy = function () {
9887
- this.ngUnsubscribe.next(true);
9888
- this.ngUnsubscribe.unsubscribe();
9947
+ HistoricalPixAccountComponent.prototype.onLazyLoad = function (event) {
9948
+ var _this = this;
9949
+ var first = event && event.first ? event.first : 0;
9950
+ var rows = event && event.rows ? event.rows : this.recordByRow;
9951
+ var arrList = this.getHistoricalPixAccountList();
9952
+ this.listData = [];
9953
+ this.totalRecords = null;
9954
+ if (event && event.multiSortMeta && event.multiSortMeta.length) {
9955
+ event.multiSortMeta.map(function (value) {
9956
+ _this.orderBy.field = value.field;
9957
+ _this.orderBy.direction = value.order === 1 ? DirectionEnumeration.ASC : DirectionEnumeration.DESC;
9958
+ });
9959
+ }
9960
+ if (arrList && arrList.length) {
9961
+ this.totalRecords = arrList.length;
9962
+ this.listData = arrList;
9963
+ this.listDataNoPage = __spread(arrList);
9964
+ this.listData.sort(compareValues(this.orderBy.field, this.orderBy.direction));
9965
+ this.listData = this.listData.slice(first, (first + rows));
9966
+ }
9967
+ else {
9968
+ this.listDataNoPage = [];
9969
+ }
9970
+ if (this.isEditMode || arrList && arrList.length === 1) {
9971
+ this.refreshCssInIE11();
9972
+ }
9973
+ this.loading = false;
9974
+ };
9975
+ /**
9976
+ * Um Bug de CSS que acontece nas linhas da tabela, que resolve só atualizando qualquer parte do CSS da pagina.
9977
+ */
9978
+ HistoricalPixAccountComponent.prototype.refreshCssInIE11 = function () {
9979
+ if (/msie\s|trident\/|edge\//i.test(window.navigator.userAgent)) {
9980
+ setTimeout(function () {
9981
+ var row = document.getElementsByClassName("row0");
9982
+ if (row && row[0])
9983
+ row[0].className = 'refresh';
9984
+ }, 1);
9985
+ }
9889
9986
  };
9890
- HistoricalPixAccountFormComponent.prototype.registerSubjects = function () {
9987
+ HistoricalPixAccountComponent.prototype.add = function () {
9988
+ this.pixAccountItemInput = {};
9989
+ this.visible = true;
9891
9990
  };
9892
- HistoricalPixAccountFormComponent.prototype.createFormGroup = function () {
9893
- this.pixAccountFormGroup = this.formBuilder.group({
9894
- id: this.formBuilder.control(null),
9895
- index: this.formBuilder.control(null),
9896
- employee: this.formBuilder.control({ value: { tableId: null }, disabled: true }),
9897
- dateChange: this.formBuilder.control(null),
9898
- pixKeyType: this.formBuilder.control(null, Validators.required),
9899
- pixKey: this.formBuilder.control(null),
9900
- percentage: this.formBuilder.control(null, Validators.compose(__spread(this.initialValidatorOfPercentage, [
9901
- Validators.max(this.maxValuePercentage),
9902
- ]))),
9903
- externalId: this.formBuilder.control(null),
9904
- customFields: this.formBuilder.control(null),
9991
+ HistoricalPixAccountComponent.prototype.isNotAllowMessage = function () {
9992
+ this.messageService.add({
9993
+ severity: "error",
9994
+ summary: this.translateService.instant("hcm.payroll.error"),
9995
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9905
9996
  });
9906
9997
  };
9907
- HistoricalPixAccountFormComponent.prototype.onChangePixKeyType = function (item) {
9908
- if (item.key) {
9909
- this.pixKeyType = item.key;
9910
- this.isShowPixKeyFieldValidatorMessage = true;
9911
- this.pixAccountFormGroup.get("pixKey").reset();
9912
- this.setPixKeyValidators(true);
9913
- if (item.key === "CPF") {
9914
- this.setDefaultCpfPixKey();
9998
+ HistoricalPixAccountComponent.prototype.deleteAnnuityItem = function (index) {
9999
+ var newlist = __spread(this.getHistoricalPixAccountList());
10000
+ newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
10001
+ delete newlist[index];
10002
+ newlist = newlist.filter(function (val) { return val; });
10003
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newlist);
10004
+ this.verifyTotalPercentage();
10005
+ this.onLazyLoad();
10006
+ };
10007
+ HistoricalPixAccountComponent.prototype.getHistoricalPixAccountList = function () {
10008
+ if (this.historicalPixAccountList.get("historicalPixAccountList") &&
10009
+ this.historicalPixAccountList.get("historicalPixAccountList").value &&
10010
+ this.historicalPixAccountList.get("historicalPixAccountList").value.length)
10011
+ return this.historicalPixAccountList.get("historicalPixAccountList") && this.historicalPixAccountList.get("historicalPixAccountList").value;
10012
+ else
10013
+ return [];
10014
+ };
10015
+ HistoricalPixAccountComponent.prototype.addItemInList = function ($event) {
10016
+ var index = $event && $event.index >= 0 ? $event.index : null;
10017
+ var newDataList = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
10018
+ if (index != null) {
10019
+ newDataList[index] = $event;
10020
+ delete $event.index;
10021
+ }
10022
+ else {
10023
+ if (isValid($event["customFields"]) && Object.keys($event["customFields"]).length) {
10024
+ var customValue = mountCustomToSave($event["customFields"]);
10025
+ $event["customFields"] = __spread(customValue);
9915
10026
  }
10027
+ $event["dateChange"] = this.dateChange;
10028
+ newDataList.push($event);
10029
+ }
10030
+ if (this.formComponent) {
10031
+ this.formComponent.permitsEditBankAccountForm = false;
10032
+ this.cd.detectChanges();
9916
10033
  }
10034
+ this.historicalPixAccountList.get("historicalPixAccountList").setValue(newDataList);
10035
+ this.verifyTotalPercentage();
10036
+ this.onLazyLoad({ first: this.getNumberPageByIndex(index, newDataList) });
9917
10037
  };
9918
- HistoricalPixAccountFormComponent.prototype.onClearPixKeyType = function () {
9919
- this.isShowPixKeyFieldValidatorMessage = false;
9920
- this.pixAccountFormGroup.get("pixKey").reset();
10038
+ HistoricalPixAccountComponent.prototype.getNumberPageByIndex = function (index, list) {
10039
+ if (index) {
10040
+ var total = list.length;
10041
+ var sub = this.recordByRow - 1;
10042
+ return Math.ceil(total / this.recordByRow) * this.recordByRow - sub - 1;
10043
+ }
10044
+ return null;
9921
10045
  };
9922
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "visible", {
10046
+ HistoricalPixAccountComponent.prototype.verifyTotalPercentage = function () {
10047
+ var list = this.getHistoricalPixAccountList() ? this.getHistoricalPixAccountList() : [];
10048
+ var arrayPercentage = [];
10049
+ if (!list.length)
10050
+ return this.msgTotalLimitByPercentage = null;
10051
+ list.filter(function (item) { return arrayPercentage.push(item && item["percentage"]); });
10052
+ var sumPercentage = arrayPercentage.reduce(function (total, percentage) {
10053
+ return total + percentage;
10054
+ }, 0);
10055
+ if (sumPercentage === 100) {
10056
+ this.msgTotalLimitByPercentage = this.translateService.instant("hcm.payroll.historical_pix_account_msg_limit_total_by_percentage");
10057
+ }
10058
+ else {
10059
+ this.msgTotalLimitByPercentage = null;
10060
+ }
10061
+ };
10062
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "scopedActions", {
9923
10063
  get: function () {
9924
- return this._visible;
10064
+ return this.actions.bind(this);
10065
+ },
10066
+ enumerable: true,
10067
+ configurable: true
10068
+ });
10069
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "recordsMessage", {
10070
+ get: function () {
10071
+ return (this.totalRecords || 0) + " " + (this.totalRecords === 1 ? this.translateService.instant("hcm.payroll.admission_register") : this.translateService.instant("hcm.payroll.admission_registers"));
10072
+ },
10073
+ enumerable: true,
10074
+ configurable: true
10075
+ });
10076
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "getTooltipAndDisableButtonAdd", {
10077
+ get: function () {
10078
+ return this.dateChange ? null : this.msgTooltipAdd;
10079
+ },
10080
+ enumerable: true,
10081
+ configurable: true
10082
+ });
10083
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "dateChange", {
10084
+ get: function () {
10085
+ return this._dateChange;
9925
10086
  },
9926
10087
  set: function (value) {
9927
- this._visible = value;
9928
- this.visibleChange.emit(this.visible);
10088
+ var _this = this;
10089
+ this._dateChange = value;
10090
+ if (this._dateChange) {
10091
+ this.listData.filter(function (row) { return row["dateChange"] = _this._dateChange; });
10092
+ }
9929
10093
  },
9930
10094
  enumerable: true,
9931
10095
  configurable: true
9932
10096
  });
9933
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", {
10097
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "displayDateChange", {
10098
+ get: function () {
10099
+ return this._displayDateChange;
10100
+ },
9934
10101
  set: function (value) {
9935
- this.resetForm();
9936
- this.visibleBtnSave = true;
9937
- if (value && value.currentItem && Object.keys(value.currentItem).length) {
9938
- this.pixAccountFormGroup.patchValue(this.convertDTOToShowWithCustomFields(__assign({}, value.currentItem)));
9939
- this.labelBtnAdd = "hcm.payroll.employees_update";
9940
- this.setValidatorsAccordingList(value.listData, value.currentItem["index"], value && value["isEditMode"]);
9941
- if (!this.isView) {
9942
- this.configEnableFields(value && value["isEditMode"]);
9943
- }
9944
- else {
9945
- if (this.pixAccountFormGroup.get("pixKeyType").value) {
9946
- this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9947
- this.formatPixKeyTelephoneNumber();
9948
- }
9949
- }
10102
+ var _this = this;
10103
+ this._displayDateChange = value;
10104
+ if (this._displayDateChange) {
10105
+ this.listData.filter(function (row) { return row["displayDateChange"] = _this._displayDateChange; });
9950
10106
  }
9951
- else {
9952
- this.labelBtnAdd = "hcm.payroll.employees_add";
10107
+ },
10108
+ enumerable: true,
10109
+ configurable: true
10110
+ });
10111
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "addListData", {
10112
+ set: function (list) {
10113
+ this.loading = true;
10114
+ this.historicalPixAccountList.get("historicalPixAccountList").patchValue(list);
10115
+ this.verifyTotalPercentage();
10116
+ this.onLazyLoad();
10117
+ },
10118
+ enumerable: true,
10119
+ configurable: true
10120
+ });
10121
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "visible", {
10122
+ get: function () {
10123
+ return this._visible;
10124
+ },
10125
+ set: function (value) {
10126
+ this._visible = value;
10127
+ this.visibleChange.emit(this.visible);
10128
+ if (!value) {
10129
+ this.pixAccountItemInput = {};
9953
10130
  }
9954
10131
  },
9955
10132
  enumerable: true,
9956
10133
  configurable: true
9957
10134
  });
9958
- HistoricalPixAccountFormComponent.prototype.formatPixKeyTelephoneNumber = function () {
9959
- if (this.pixKeyType === "TELEPHONE") {
9960
- this.pixAccountFormGroup.get("pixKey").setValue(FormatUtilsService.getFormattedTelephoneNumber(this.pixAccountFormGroup.get("pixKey").value));
9961
- }
9962
- };
9963
- HistoricalPixAccountFormComponent.prototype.convertDTOToShowWithCustomFields = function (data) {
9964
- var obj = __assign({}, data);
9965
- obj["customFields"] = mountCustomToShow(obj["customFields"]);
9966
- return obj;
9967
- };
9968
- HistoricalPixAccountFormComponent.prototype.configEnableFields = function (isEditMode) {
9969
- this.visibleBtnSave = isEditMode;
9970
- if (this.pixAccountFormGroup.get("pixKeyType").value) {
9971
- this.pixKeyType = this.pixAccountFormGroup.get("pixKeyType").value.key;
9972
- this.setPixKeyValidators(isEditMode);
9973
- this.formatPixKeyTelephoneNumber();
9974
- }
9975
- configEnabledFields(this.pixAccountFormGroup, isEditMode, [
9976
- "pixKeyType",
9977
- "pixKey",
9978
- "percentage",
9979
- "customFields",
9980
- ], []);
9981
- };
9982
- HistoricalPixAccountFormComponent.prototype.close = function () {
9983
- this.resetForm();
10135
+ HistoricalPixAccountComponent.prototype.close = function () {
9984
10136
  this.visible = false;
9985
10137
  };
9986
- HistoricalPixAccountFormComponent.prototype.addItem = function () {
9987
- this.pixAccountFormGroup.updateValueAndValidity();
9988
- verifyValidationsForm.call(this.pixAccountFormGroup);
9989
- if (this.pixAccountFormGroup.valid) {
9990
- if (this.employeeId) {
9991
- this.pixAccountFormGroup.get("employee").setValue({
9992
- tableId: this.employeeId,
9993
- name: "",
9994
- });
9995
- }
9996
- this.pixAccountItemToList.emit(this.pixAccountFormGroup.getRawValue());
9997
- this.visible = false;
9998
- this.resetForm();
9999
- }
10138
+ HistoricalPixAccountComponent.prototype.getFormattedTelephoneNumber = function (telephoneNumber) {
10139
+ return FormatUtilsService.getFormattedTelephoneNumber(telephoneNumber);
10000
10140
  };
10001
- HistoricalPixAccountFormComponent.prototype.resetForm = function () {
10002
- this.pixAccountFormGroup.reset();
10003
- this.labelBtnAdd = "hcm.payroll.employees_add";
10004
- if (this.customFields && this.customFields.formGroup)
10005
- this.customFields.formGroup.reset();
10141
+ HistoricalPixAccountComponent.prototype.getFormattedCpf = function (cpf) {
10142
+ return FormatUtilsService.getFormattedCpf(cpf);
10143
+ };
10144
+ HistoricalPixAccountComponent.prototype.getFormattedCnpj = function (cnpj) {
10145
+ return FormatUtilsService.getFormattedCnpj(cnpj);
10006
10146
  };
10007
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "percentagePlaceholder", {
10147
+ HistoricalPixAccountComponent.prototype.getFormattedPercentage = function (value) {
10148
+ return FormatUtilsService.getFormattedPercentage(value);
10149
+ };
10150
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToAddHistorical", {
10008
10151
  get: function () {
10009
- return "0" + (this.currency && this.currency.decimalSeparator) + "00";
10152
+ return (this.permission["incluir"]);
10010
10153
  },
10011
10154
  enumerable: true,
10012
10155
  configurable: true
10013
10156
  });
10014
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "optionsPercentage", {
10157
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToDeleteHistorical", {
10015
10158
  get: function () {
10016
- return __assign({}, this.getOptions(), { precision: 2 });
10159
+ return (this.permission["excluir"]);
10017
10160
  },
10018
10161
  enumerable: true,
10019
10162
  configurable: true
10020
10163
  });
10021
- HistoricalPixAccountFormComponent.prototype.getOptions = function () {
10022
- return {
10023
- prefix: "",
10024
- thousands: this.currency.thousandsSeparator,
10025
- decimal: this.currency.decimalSeparator,
10026
- };
10027
- };
10028
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "getListPixAccount", {
10029
- /**
10030
- * O Input que recebe a lista do component pai e chama o método de validação passando a lista recebida.
10031
- * @param pixAccountList
10032
- */
10033
- set: function (pixAccountList) {
10034
- if (pixAccountList) {
10035
- this.setValidatorsAccordingList(pixAccountList, null, false);
10036
- }
10037
- else {
10038
- this.resetForm();
10039
- }
10164
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToEditHistorical", {
10165
+ get: function () {
10166
+ return (this.permission["editar"]);
10040
10167
  },
10041
10168
  enumerable: true,
10042
10169
  configurable: true
10043
10170
  });
10044
- /**
10045
- * Recebe a lista de registros já inseridos na tabela adiciona em uma variável os valores que serão usados para
10046
- * a validação dos campos "percentage" e "pixAccount".
10047
- * 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
10048
- * no array de comparação dos validators.
10049
- * @param pixAccountList
10050
- * @param index
10051
- */
10052
- HistoricalPixAccountFormComponent.prototype.setValidatorsAccordingList = function (pixAccountList, index, isEditMode) {
10053
- if (index === void 0) { index = null; }
10054
- if (isEditMode === void 0) { isEditMode = true; }
10055
- this.pixAccountList = pixAccountList && pixAccountList.length ? __spread(pixAccountList) : [];
10056
- var percentageIncluded = [];
10057
- if (this.pixAccountList && this.pixAccountList.length) {
10058
- this.pixAccountList.filter(function (field, key) {
10059
- if (field["percentage"] && key != index) {
10060
- percentageIncluded.push(field["percentage"]);
10061
- }
10062
- });
10063
- }
10064
- this.beforeSetPixKeyTypeValidator();
10065
- this.setPixKeyValidators(isEditMode);
10066
- this.validatePercentageValid(percentageIncluded);
10067
- };
10068
- /**
10069
- * Antes de setar o validator prepara as variáveis necessária para que seja feita a validação do campo.
10070
- */
10071
- HistoricalPixAccountFormComponent.prototype.setPixKeyValidators = function (isEditMode) {
10072
- var genericPixKey = this.pixAccountFormGroup.get("pixKey");
10073
- if (this.pixKeyType) {
10074
- switch (this.pixKeyType) {
10075
- case "TELEPHONE":
10076
- genericPixKey.setValidators(Validators.compose([
10077
- Validators.required, GenericValidator.isValidPhoneNumber,
10078
- ]));
10079
- break;
10080
- case "EMAIL":
10081
- genericPixKey.setValidators(Validators.compose([
10082
- Validators.required, GenericValidator.isValidEmail,
10083
- ]));
10084
- break;
10085
- case "CPF":
10086
- genericPixKey.setValidators(Validators.compose([
10087
- Validators.required, GenericValidator.isValidCpf,
10088
- ]));
10089
- break;
10090
- case "CNPJ":
10091
- genericPixKey.setValidators(Validators.compose([
10092
- Validators.required, GenericValidator.isValidCnpj,
10093
- ]));
10094
- break;
10095
- case "RANDOM_KEY":
10096
- genericPixKey.setValidators(Validators.required);
10097
- break;
10098
- default:
10099
- genericPixKey.setValidators(null);
10100
- break;
10101
- }
10102
- if (isEditMode) {
10103
- genericPixKey.enable();
10104
- }
10105
- genericPixKey.updateValueAndValidity();
10106
- }
10107
- };
10108
- /**
10109
- * Este método calcula as parcentagens que já foram inseridas, e seta a diferença para chegar em
10110
- * 100% na validação do campo "percentage" como um novo maxValue;
10111
- * @param listValue
10112
- */
10113
- HistoricalPixAccountFormComponent.prototype.validatePercentageValid = function (listValue) {
10114
- var percentage = this.pixAccountFormGroup.get("percentage");
10115
- this.maxValuePercentage = listValue
10116
- .reduce(function (currentValue, total) { return currentValue - total; }, 100.00);
10117
- percentage
10118
- .setValidators(Validators.compose(__spread(this.initialValidatorOfPercentage, [
10119
- Validators.max(this.maxValuePercentage),
10120
- ])));
10121
- percentage.updateValueAndValidity();
10122
- };
10123
- Object.defineProperty(HistoricalPixAccountFormComponent.prototype, "isViewMode", {
10124
- set: function (condition) {
10125
- this.isView = !!(condition && !this.withSideBar);
10126
- this.configEnableFields(!this.isView);
10127
- if (!this.isView)
10128
- this.resetForm();
10171
+ Object.defineProperty(HistoricalPixAccountComponent.prototype, "isAllowToViewHistorical", {
10172
+ get: function () {
10173
+ return (this.permission["visualizar"]);
10129
10174
  },
10130
10175
  enumerable: true,
10131
10176
  configurable: true
10132
10177
  });
10133
- HistoricalPixAccountFormComponent.prototype.phoneMask = function (event) {
10134
- FormatUtilsService.formatTelephoneInputEvent(event);
10135
- };
10136
- HistoricalPixAccountFormComponent.prototype.setDefaultCpfPixKey = function () {
10137
- if (this.defaultCpfNumber) {
10138
- this.pixAccountFormGroup.get("pixKey").setValue(this.defaultCpfNumber);
10139
- }
10140
- else {
10141
- var sheetDocument = this.paramsForm.get("sheetDocument");
10142
- if (sheetDocument) {
10143
- var cpf = sheetDocument.get("cpfNumber").value;
10144
- if (cpf) {
10145
- this.pixAccountFormGroup.get("pixKey").setValue(cpf);
10146
- }
10147
- }
10148
- }
10149
- };
10150
- HistoricalPixAccountFormComponent.prototype.beforeSetPixKeyTypeValidator = function () {
10151
- var pixKeyType = this.pixAccountFormGroup.get("pixKeyType");
10152
- if (this.pixAccountList && this.pixAccountList.length && pixKeyType) {
10153
- pixKeyType
10154
- .setValidators(Validators.compose([
10155
- Validators.required,
10156
- this.validateDuplicatePixKeyTypeBankAccount(this.pixAccountList),
10157
- ]));
10158
- }
10159
- else {
10160
- pixKeyType.setValidators(Validators.required);
10161
- }
10162
- };
10163
- HistoricalPixAccountFormComponent.prototype.validateDuplicatePixKeyTypeBankAccount = function (listCompare) {
10164
- return function (control) {
10165
- var value = control && control.value;
10166
- var condition = false;
10167
- listCompare.filter(function (field) {
10168
- if (value) {
10169
- if (field["pixKeyType"].key === 'BANK_ACCOUNT' && value.key === field["pixKeyType"].key) {
10170
- return condition = true;
10171
- }
10172
- }
10173
- });
10174
- if (condition) {
10175
- return { pixKeyTypeBankAccountDuplicate: true };
10176
- }
10177
- else {
10178
- return null;
10179
- }
10180
- };
10181
- };
10182
- HistoricalPixAccountFormComponent.ctorParameters = function () { return [
10178
+ HistoricalPixAccountComponent.ctorParameters = function () { return [
10179
+ { type: TranslateService },
10180
+ { type: ChangeDetectorRef },
10183
10181
  { type: FormBuilder },
10184
- { type: ChangeDetectorRef }
10182
+ { type: MessageService }
10185
10183
  ]; };
10186
10184
  __decorate([
10187
- ViewChild(CustomFieldsComponent$1, { static: true })
10188
- ], HistoricalPixAccountFormComponent.prototype, "customFields", void 0);
10185
+ ViewChild(CustomFieldsComponent$1, { static: false })
10186
+ ], HistoricalPixAccountComponent.prototype, "customFields", void 0);
10187
+ __decorate([
10188
+ ViewChild(HistoricalPixAccountFormComponent, { static: false })
10189
+ ], HistoricalPixAccountComponent.prototype, "formComponent", void 0);
10189
10190
  __decorate([
10190
10191
  Input()
10191
- ], HistoricalPixAccountFormComponent.prototype, "currency", void 0);
10192
+ ], HistoricalPixAccountComponent.prototype, "formGroup", void 0);
10192
10193
  __decorate([
10193
10194
  Input()
10194
- ], HistoricalPixAccountFormComponent.prototype, "customEntity", void 0);
10195
+ ], HistoricalPixAccountComponent.prototype, "fieldFormGroup", void 0);
10195
10196
  __decorate([
10196
10197
  Input()
10197
- ], HistoricalPixAccountFormComponent.prototype, "customService", void 0);
10198
+ ], HistoricalPixAccountComponent.prototype, "_dateChange", void 0);
10198
10199
  __decorate([
10199
10200
  Input()
10200
- ], HistoricalPixAccountFormComponent.prototype, "withSideBar", void 0);
10201
+ ], HistoricalPixAccountComponent.prototype, "_displayDateChange", void 0);
10201
10202
  __decorate([
10202
10203
  Input()
10203
- ], HistoricalPixAccountFormComponent.prototype, "isEditMode", void 0);
10204
+ ], HistoricalPixAccountComponent.prototype, "recordByRow", void 0);
10204
10205
  __decorate([
10205
10206
  Input()
10206
- ], HistoricalPixAccountFormComponent.prototype, "paramsForm", void 0);
10207
+ ], HistoricalPixAccountComponent.prototype, "showDateChange", void 0);
10207
10208
  __decorate([
10208
10209
  Input()
10209
- ], HistoricalPixAccountFormComponent.prototype, "defaultCpfNumber", void 0);
10210
+ ], HistoricalPixAccountComponent.prototype, "msgTooltipAdd", void 0);
10211
+ __decorate([
10212
+ Input()
10213
+ ], HistoricalPixAccountComponent.prototype, "isEditMode", void 0);
10214
+ __decorate([
10215
+ Input()
10216
+ ], HistoricalPixAccountComponent.prototype, "isViewMode", void 0);
10217
+ __decorate([
10218
+ Input()
10219
+ ], HistoricalPixAccountComponent.prototype, "currency", void 0);
10220
+ __decorate([
10221
+ Input()
10222
+ ], HistoricalPixAccountComponent.prototype, "customEntity", void 0);
10223
+ __decorate([
10224
+ Input()
10225
+ ], HistoricalPixAccountComponent.prototype, "customService", void 0);
10226
+ __decorate([
10227
+ Input()
10228
+ ], HistoricalPixAccountComponent.prototype, "withSideBar", void 0);
10229
+ __decorate([
10230
+ Input()
10231
+ ], HistoricalPixAccountComponent.prototype, "paramsForm", void 0);
10232
+ __decorate([
10233
+ Input()
10234
+ ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
10235
+ __decorate([
10236
+ Input()
10237
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
10238
+ __decorate([
10239
+ Input()
10240
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
10241
+ __decorate([
10242
+ Input()
10243
+ ], HistoricalPixAccountComponent.prototype, "showButtonEdit", void 0);
10210
10244
  __decorate([
10211
10245
  Output()
10212
- ], HistoricalPixAccountFormComponent.prototype, "visibleChange", void 0);
10246
+ ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
10213
10247
  __decorate([
10214
10248
  Output()
10215
- ], HistoricalPixAccountFormComponent.prototype, "pixAccountItemToList", void 0);
10249
+ ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
10250
+ __decorate([
10251
+ Output()
10252
+ ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
10216
10253
  __decorate([
10217
10254
  Input()
10218
- ], HistoricalPixAccountFormComponent.prototype, "visible", null);
10255
+ ], HistoricalPixAccountComponent.prototype, "dateChange", null);
10219
10256
  __decorate([
10220
10257
  Input()
10221
- ], HistoricalPixAccountFormComponent.prototype, "isEditAndViewValue", null);
10258
+ ], HistoricalPixAccountComponent.prototype, "displayDateChange", null);
10222
10259
  __decorate([
10223
10260
  Input()
10224
- ], HistoricalPixAccountFormComponent.prototype, "getListPixAccount", null);
10261
+ ], HistoricalPixAccountComponent.prototype, "addListData", null);
10225
10262
  __decorate([
10226
10263
  Input()
10227
- ], HistoricalPixAccountFormComponent.prototype, "isViewMode", null);
10228
- HistoricalPixAccountFormComponent = __decorate([
10264
+ ], HistoricalPixAccountComponent.prototype, "visible", null);
10265
+ HistoricalPixAccountComponent = __decorate([
10229
10266
  Component({
10230
- selector: "pix-account",
10231
- 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",
10267
+ // tslint:disable-next-line:component-selector
10268
+ selector: "c-historical-pix-account",
10269
+ template: "<s-sidebar *ngIf=\"withSideBar\" [visible]=\"visible\" (visibleChange)=\"close()\"\n header=\"{{'hcm.payroll.historical_pix_account_title_form'|translate}}\">\n<pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [paramsForm]=\"paramsForm\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</s-sidebar>\n\n<div *ngIf=\"!withSideBar && !isViewMode\">\n <pix-account [(visible)]=\"visible\"\n [isEditAndViewValue]=\"pixAccountItemInput\"\n [currency]=\"currency\"\n [customEntity]=\"customEntity\"\n [customService]=\"customService\"\n [getListPixAccount]=\"listDataNoPage\"\n [withSideBar]=\"false\"\n [isViewMode]=\"isViewMode\"\n [paramsForm]=\"paramsForm\"\n [permitsEditBankAccountForm]=\"permitsEditBankAccount\"\n (pixAccountItemToList)=\"addItemInList($event)\"\n [defaultCpfNumber]=\"defaultCpfNumber\"></pix-account>\n</div>\n\n<div class=\"ui-g-1\" *ngIf=\"withSideBar && !isEditMode\">\n <div class=\"form-group \">\n <s-button id=\"ta-addPayAnnuity\"\n [disabled]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n (onClick)=\"add()\"\n [pTooltip]=\"getTooltipAndDisableButtonAdd || msgTotalLimitByPercentage\"\n tooltipPosition=\"top\"\n label=\"{{'hcm.payroll.historical_pix_account_add'|translate}}\"></s-button>\n </div>\n</div>\n<div class=\"ui-g-12\">\n <p-table\n id=\"table-annuity\"\n [value]=\"listData\"\n [columns]=\"cols\"\n (onLazyLoad)=\"onLazyLoad($event)\"\n [lazy]=\"true\"\n [scrollable]=\"true\"\n [paginator]=\"true\"\n [totalRecords]=\"totalRecords\"\n [sortMode]=\"'multiple'\"\n *sLoadingState=\"loading\"\n [rows]=\"recordByRow\"\n dataKey=\"id\">\n <ng-template pTemplate=\"colgroup\" let-coumns>\n <colgroup>\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-m'\">\n <col [ngClass]=\"'col-default-s'\">\n <col *ngIf=\"!isViewMode\" [ngClass]=\"'col-action'\">\n </colgroup>\n </ng-template>\n <ng-template pTemplate=\"header\" let-columns>\n <!-- Cabe\u00E7alhos quando da table \u00E9 permitido ordenar as colunas -->\n <tr>\n <!-- Cabe\u00E7alhos das colunas da tabela -->\n <th\n [pSortableColumn]=\"'pixKeyType'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\" id=\"table-0\">\n <span\n id=\"table-annuity-s-0\">{{ 'hcm.payroll.employees_addition_pix_key_type' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key_type' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'pixKey'\"\n [pTooltip]=\"'hcm.payroll.employees_addition_pix_key' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.employees_addition_pix_key' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.employees_addition_pix_key' | translate\"></p-sortIcon>\n </div>\n </th>\n\n <th\n [pSortableColumn]=\"'percentage'\"\n [pTooltip]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"\n tooltipPosition=\"top\"\n showDelay=\"500\"\n >\n <div class=\"senior-header\">\n <span>{{ 'hcm.payroll.historical_pix_account_label_percentage' | translate }}</span>\n <p-sortIcon class=\"p-sorticon-status\"\n [field]=\"'hcm.payroll.historical_pix_account_label_percentage' | translate\"></p-sortIcon>\n </div>\n </th>\n <!-- Cabe\u00E7alho da coluna de a\u00E7\u00F5es -->\n <th *ngIf=\"!isViewMode\" id=\"col-actions\"></th>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"body\" let-rowData let-key=\"rowIndex\">\n\n <tr [ngClass]=\"'row'+key\" [pSelectableRow]=\"rowData\">\n <td [pTooltip]=\"rowData?.pixKeyType.value\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKeyType.value }}</span>\n </td>\n\n <ng-container [ngSwitch]=\"rowData?.pixKeyType.key\">\n <td *ngSwitchCase=\"'TELEPHONE'\"\n [pTooltip]=\"getFormattedTelephoneNumber(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedTelephoneNumber(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CPF'\"\n [pTooltip]=\"getFormattedCpf(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCpf(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchCase=\"'CNPJ'\"\n [pTooltip]=\"getFormattedCnpj(rowData?.pixKey)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedCnpj(rowData?.pixKey) }}</span>\n </td>\n <td *ngSwitchDefault\n [pTooltip]=\"rowData?.pixKey\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ rowData?.pixKey }}</span>\n </td>\n </ng-container>\n <td [pTooltip]=\"getFormattedPercentage(rowData?.percentage)\" tooltipPosition=\"top\"\n showDelay=\"500\">\n <span>{{ getFormattedPercentage(rowData?.percentage) }}</span>\n </td>\n <td id=\"col-actions-{{key}}\" class=\"col-actions \"\n *ngIf=\"actions && actions(rowData, key)?.length && !isViewMode\">\n <s-button id=\"table-admission-btn-actions-{{key}}\"\n *ngIf=\"actions(rowData, key).length > 1\" [label]=\"actionLabel\"\n priority=\"default\" [model]=\"scopedActions(rowData, key)\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n\n <s-button id=\"table-admission-btn-action-{{key}}\"\n *ngIf=\"actions(rowData, key).length <= 1\"\n [label]=\"scopedActions(rowData, key)[0].label\"\n priority=\"default\"\n (click)=\"scopedActions(rowData, key)[0].command()\"\n [disabled]=\"false\" [auxiliary]=\"true\"></s-button>\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"emptymessage\" let-columns>\n <tr>\n <td [attr.colspan]=\"columns.length +2\">\n {{'hcm.payroll.admission_empty_message'|translate}}\n </td>\n </tr>\n </ng-template>\n <ng-template pTemplate=\"paginatorright\">\n <span *ngIf=\"totalRecords\">{{recordsMessage}}</span>\n </ng-template>\n </p-table>\n</div>\n",
10232
10270
  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}"]
10233
10271
  })
10234
- ], HistoricalPixAccountFormComponent);
10235
- return HistoricalPixAccountFormComponent;
10272
+ ], HistoricalPixAccountComponent);
10273
+ return HistoricalPixAccountComponent;
10236
10274
  }());
10237
10275
 
10238
10276
  var HistoricalPixAccountService = /** @class */ (function () {
@@ -10336,6 +10374,7 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10336
10374
  this.isOnlyView = new EventEmitter();
10337
10375
  this.isOnlyEdit = new EventEmitter();
10338
10376
  this.enableView = new EventEmitter();
10377
+ this.enableEdit = new EventEmitter();
10339
10378
  this.ngUnsubscribe = new Subject();
10340
10379
  this.loading = true;
10341
10380
  this.columns = [
@@ -10403,7 +10442,7 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10403
10442
  });
10404
10443
  }
10405
10444
  else {
10406
- _this.enableView.emit(dateChange);
10445
+ _this.enableEdit.emit(dateChange);
10407
10446
  }
10408
10447
  }
10409
10448
  else {
@@ -10575,6 +10614,9 @@ var HistoricalPixAccountListComponent = /** @class */ (function () {
10575
10614
  __decorate([
10576
10615
  Output()
10577
10616
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);
10617
+ __decorate([
10618
+ Output()
10619
+ ], HistoricalPixAccountListComponent.prototype, "enableEdit", void 0);
10578
10620
  __decorate([
10579
10621
  Input()
10580
10622
  ], HistoricalPixAccountListComponent.prototype, "reloadList", null);