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

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