@senior-gestao-pessoas/payroll-core 9.3.0-784091e9-e857-4112-9344-e47026fdac80 → 9.3.0-8393e941-0066-4d0d-be1f-6186195edc89

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
+ 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;
@@ -9510,13 +9550,22 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9510
9550
  {
9511
9551
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9512
9552
  command: () => {
9513
- const dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, this.dateFormat).format("YYYY-MM-DD");
9514
- if (this.withSidebar)
9515
- this.router.navigate([`historical-pix-account/${dateChange}`], {
9516
- relativeTo: this.activatedRoute,
9517
- });
9518
- else
9519
- this.enableView.emit(dateChange);
9553
+ console.log('COMMAND CALLED');
9554
+ if (this.isAllowToViewHistorical) {
9555
+ const dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, this.dateFormat).format("YYYY-MM-DD");
9556
+ if (this.withSidebar) {
9557
+ this.router.navigate([`historical-pix-account/${dateChange}`], {
9558
+ relativeTo: this.activatedRoute,
9559
+ });
9560
+ }
9561
+ else {
9562
+ this.isOnlyView.emit(true);
9563
+ this.enableView.emit(dateChange);
9564
+ }
9565
+ }
9566
+ else {
9567
+ this.isNotAllowMessage();
9568
+ }
9520
9569
  },
9521
9570
  },
9522
9571
  {
@@ -9526,11 +9575,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9526
9575
  this.delete(rowData.id, rowData.dateChange);
9527
9576
  }
9528
9577
  else {
9529
- this.messageService.add({
9530
- severity: "error",
9531
- summary: this.translateService.instant("hcm.payroll.error"),
9532
- detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9533
- });
9578
+ this.isNotAllowMessage();
9534
9579
  }
9535
9580
  },
9536
9581
  },
@@ -9587,6 +9632,13 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9587
9632
  });
9588
9633
  }
9589
9634
  }
9635
+ isNotAllowMessage() {
9636
+ this.messageService.add({
9637
+ severity: "error",
9638
+ summary: this.translateService.instant("hcm.payroll.error"),
9639
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9640
+ });
9641
+ }
9590
9642
  onGridLoad(payload) {
9591
9643
  if (payload && payload.length) {
9592
9644
  this.lastRecord = payload[0];
@@ -9598,6 +9650,9 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9598
9650
  get isAllowToDeleteHistorical() {
9599
9651
  return (this.permission["excluir"]);
9600
9652
  }
9653
+ get isAllowToViewHistorical() {
9654
+ return (this.permission["visualizar"]);
9655
+ }
9601
9656
  get scopedActions() {
9602
9657
  return this.getMenuActions.bind(this);
9603
9658
  }
@@ -9641,6 +9696,9 @@ __decorate([
9641
9696
  __decorate([
9642
9697
  Input()
9643
9698
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
9699
+ __decorate([
9700
+ Output()
9701
+ ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
9644
9702
  __decorate([
9645
9703
  Output()
9646
9704
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);