@senior-gestao-pessoas/payroll-core 9.5.0-feature-hcmgdp-11492-21838e72 → 9.5.0-feature-hcmgdp-11492-f438f1e4

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