@senior-gestao-pessoas/payroll-core 9.3.0-dfe04f23-c797-41a3-b912-c4cf9ef516cd → 9.3.0-ed0a821c-6503-4447-b346-cf05b6d53b8f

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.
@@ -8522,10 +8522,11 @@ class FormatUtilsService {
8522
8522
  }
8523
8523
 
8524
8524
  let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8525
- constructor(translateService, cd, formBuilder) {
8525
+ constructor(translateService, cd, formBuilder, messageService) {
8526
8526
  this.translateService = translateService;
8527
8527
  this.cd = cd;
8528
8528
  this.formBuilder = formBuilder;
8529
+ this.messageService = messageService;
8529
8530
  this.recordByRow = 1;
8530
8531
  this.showDateChange = false;
8531
8532
  this.isEditMode = false;
@@ -8564,26 +8565,41 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8564
8565
  visible: this.isEditMode,
8565
8566
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
8566
8567
  command: () => {
8567
- rowData["index"] = key;
8568
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: false };
8569
- this.visible = true;
8568
+ if (this.isAllowToViewHistorical) {
8569
+ rowData["index"] = key;
8570
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: false };
8571
+ this.visible = true;
8572
+ }
8573
+ else {
8574
+ this.isNotAllowMessage();
8575
+ }
8570
8576
  },
8571
8577
  },
8572
8578
  {
8573
8579
  visible: !!(!this.isEditMode && this.withSideBar),
8574
8580
  label: this.translateService.instant("hcm.payroll.edit"),
8575
8581
  command: () => {
8576
- rowData["index"] = key;
8577
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8578
- this.visible = true;
8582
+ if (this.isAllowToEditHistorical) {
8583
+ rowData["index"] = key;
8584
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8585
+ this.visible = true;
8586
+ }
8587
+ else {
8588
+ this.isNotAllowMessage();
8589
+ }
8579
8590
  },
8580
8591
  },
8581
8592
  {
8582
8593
  visible: !this.isEditMode,
8583
8594
  label: this.translateService.instant("hcm.payroll.delete"),
8584
8595
  command: () => {
8585
- this.loading = true;
8586
- this.deleteAnnuityItem(key);
8596
+ if (this.isAllowToDeleteHistorical) {
8597
+ this.loading = true;
8598
+ this.deleteAnnuityItem(key);
8599
+ }
8600
+ else {
8601
+ this.isNotAllowMessage();
8602
+ }
8587
8603
  },
8588
8604
  },
8589
8605
  ];
@@ -8648,6 +8664,13 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8648
8664
  this.pixAccountItemInput = {};
8649
8665
  this.visible = true;
8650
8666
  }
8667
+ isNotAllowMessage() {
8668
+ return this.messageService.add({
8669
+ severity: "error",
8670
+ summary: this.translateService.instant("hcm.payroll.error"),
8671
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
8672
+ });
8673
+ }
8651
8674
  deleteAnnuityItem(index) {
8652
8675
  let newlist = [...this.getHistoricalPixAccountList()];
8653
8676
  newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
@@ -8763,11 +8786,24 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8763
8786
  getFormattedPercentage(value) {
8764
8787
  return FormatUtilsService.getFormattedPercentage(value);
8765
8788
  }
8789
+ get isAllowToAddHistorical() {
8790
+ return (this.permission["incluir"]);
8791
+ }
8792
+ get isAllowToDeleteHistorical() {
8793
+ return (this.permission["excluir"]);
8794
+ }
8795
+ get isAllowToEditHistorical() {
8796
+ return (this.permission["editar"]);
8797
+ }
8798
+ get isAllowToViewHistorical() {
8799
+ return (this.permission["visualizar"]);
8800
+ }
8766
8801
  };
8767
8802
  HistoricalPixAccountComponent.ctorParameters = () => [
8768
8803
  { type: TranslateService },
8769
8804
  { type: ChangeDetectorRef },
8770
- { type: FormBuilder }
8805
+ { type: FormBuilder },
8806
+ { type: MessageService }
8771
8807
  ];
8772
8808
  __decorate([
8773
8809
  ViewChild(CustomFieldsComponent$1, { static: false })
@@ -8817,6 +8853,9 @@ __decorate([
8817
8853
  __decorate([
8818
8854
  Input()
8819
8855
  ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
8856
+ __decorate([
8857
+ Input()
8858
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
8820
8859
  __decorate([
8821
8860
  Input()
8822
8861
  ], HistoricalPixAccountComponent.prototype, "dateChange", null);
@@ -9445,6 +9484,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9445
9484
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
9446
9485
  this.keyPayload = "historicalEmployeePix";
9447
9486
  this.withSidebar = true;
9487
+ this.isOnlyView = new EventEmitter();
9448
9488
  this.enableView = new EventEmitter();
9449
9489
  this.ngUnsubscribe = new Subject();
9450
9490
  this.loading = true;
@@ -9512,19 +9552,18 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9512
9552
  command: () => {
9513
9553
  if (this.isAllowToViewHistorical) {
9514
9554
  const dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, this.dateFormat).format("YYYY-MM-DD");
9515
- if (this.withSidebar)
9555
+ if (this.withSidebar) {
9556
+ this.isOnlyView.emit(true);
9516
9557
  this.router.navigate([`historical-pix-account/${dateChange}`], {
9517
9558
  relativeTo: this.activatedRoute,
9518
9559
  });
9519
- else
9560
+ }
9561
+ else {
9520
9562
  this.enableView.emit(dateChange);
9563
+ }
9521
9564
  }
9522
9565
  else {
9523
- this.messageService.add({
9524
- severity: "error",
9525
- summary: this.translateService.instant("hcm.payroll.error"),
9526
- detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9527
- });
9566
+ this.isNotAllowMessage();
9528
9567
  }
9529
9568
  },
9530
9569
  },
@@ -9535,11 +9574,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9535
9574
  this.delete(rowData.id, rowData.dateChange);
9536
9575
  }
9537
9576
  else {
9538
- this.messageService.add({
9539
- severity: "error",
9540
- summary: this.translateService.instant("hcm.payroll.error"),
9541
- detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9542
- });
9577
+ this.isNotAllowMessage();
9543
9578
  }
9544
9579
  },
9545
9580
  },
@@ -9596,6 +9631,13 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9596
9631
  });
9597
9632
  }
9598
9633
  }
9634
+ isNotAllowMessage() {
9635
+ this.messageService.add({
9636
+ severity: "error",
9637
+ summary: this.translateService.instant("hcm.payroll.error"),
9638
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9639
+ });
9640
+ }
9599
9641
  onGridLoad(payload) {
9600
9642
  if (payload && payload.length) {
9601
9643
  this.lastRecord = payload[0];
@@ -9653,6 +9695,9 @@ __decorate([
9653
9695
  __decorate([
9654
9696
  Input()
9655
9697
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
9698
+ __decorate([
9699
+ Output()
9700
+ ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
9656
9701
  __decorate([
9657
9702
  Output()
9658
9703
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);