@senior-gestao-pessoas/payroll-core 9.3.0-784091e9-e857-4112-9344-e47026fdac80 → 9.3.0-7aaf9dac-728c-48d9-acf3-c7589164bebb

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,16 +8522,21 @@ 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;
8532
8533
  this.isViewMode = false;
8533
8534
  this.withSideBar = true;
8534
8535
  this.defaultCpfNumber = null;
8536
+ this.listDataReciever = [];
8537
+ this.isOnlyView = new EventEmitter();
8538
+ this.isOnlyEdit = new EventEmitter();
8539
+ this.isOnlyDelete = new EventEmitter();
8535
8540
  this.visibleChange = new EventEmitter();
8536
8541
  this.ngUnsubscribe = new Subject();
8537
8542
  this.orderBy = {
@@ -8564,26 +8569,52 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8564
8569
  visible: this.isEditMode,
8565
8570
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
8566
8571
  command: () => {
8567
- rowData["index"] = key;
8568
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: false };
8569
- this.visible = true;
8572
+ if (this.isAllowToViewHistorical) {
8573
+ rowData["index"] = key;
8574
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: false };
8575
+ this.visible = true;
8576
+ }
8577
+ else {
8578
+ this.isOnlyView.emit(true);
8579
+ }
8570
8580
  },
8571
8581
  },
8572
8582
  {
8573
8583
  visible: !!(!this.isEditMode && this.withSideBar),
8574
8584
  label: this.translateService.instant("hcm.payroll.edit"),
8575
8585
  command: () => {
8576
- rowData["index"] = key;
8577
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8578
- this.visible = true;
8586
+ if (this.isAllowToEditHistorical) {
8587
+ console.log("ENTER IN isAllowToEditHistorical");
8588
+ rowData["index"] = key;
8589
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8590
+ this.visible = true;
8591
+ }
8592
+ else {
8593
+ this.isOnlyEdit.emit(true);
8594
+ if (!this.listDataReciever) {
8595
+ console.log("ENTER IN listDataReciever");
8596
+ rowData["index"] = key;
8597
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8598
+ this.visible = true;
8599
+ }
8600
+ }
8579
8601
  },
8580
8602
  },
8581
8603
  {
8582
8604
  visible: !this.isEditMode,
8583
8605
  label: this.translateService.instant("hcm.payroll.delete"),
8584
8606
  command: () => {
8585
- this.loading = true;
8586
- this.deleteAnnuityItem(key);
8607
+ if (this.isAllowToDeleteHistorical) {
8608
+ this.loading = true;
8609
+ this.deleteAnnuityItem(key);
8610
+ }
8611
+ else {
8612
+ this.isOnlyDelete.emit(true);
8613
+ if (!this.listDataReciever) {
8614
+ this.loading = true;
8615
+ this.deleteAnnuityItem(key);
8616
+ }
8617
+ }
8587
8618
  },
8588
8619
  },
8589
8620
  ];
@@ -8648,6 +8679,13 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8648
8679
  this.pixAccountItemInput = {};
8649
8680
  this.visible = true;
8650
8681
  }
8682
+ isNotAllowMessage() {
8683
+ this.messageService.add({
8684
+ severity: "error",
8685
+ summary: this.translateService.instant("hcm.payroll.error"),
8686
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
8687
+ });
8688
+ }
8651
8689
  deleteAnnuityItem(index) {
8652
8690
  let newlist = [...this.getHistoricalPixAccountList()];
8653
8691
  newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
@@ -8763,11 +8801,24 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8763
8801
  getFormattedPercentage(value) {
8764
8802
  return FormatUtilsService.getFormattedPercentage(value);
8765
8803
  }
8804
+ get isAllowToAddHistorical() {
8805
+ return (this.permission["incluir"]);
8806
+ }
8807
+ get isAllowToDeleteHistorical() {
8808
+ return (this.permission["excluir"]);
8809
+ }
8810
+ get isAllowToEditHistorical() {
8811
+ return (this.permission["editar"]);
8812
+ }
8813
+ get isAllowToViewHistorical() {
8814
+ return (this.permission["visualizar"]);
8815
+ }
8766
8816
  };
8767
8817
  HistoricalPixAccountComponent.ctorParameters = () => [
8768
8818
  { type: TranslateService },
8769
8819
  { type: ChangeDetectorRef },
8770
- { type: FormBuilder }
8820
+ { type: FormBuilder },
8821
+ { type: MessageService }
8771
8822
  ];
8772
8823
  __decorate([
8773
8824
  ViewChild(CustomFieldsComponent$1, { static: false })
@@ -8817,6 +8868,21 @@ __decorate([
8817
8868
  __decorate([
8818
8869
  Input()
8819
8870
  ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
8871
+ __decorate([
8872
+ Input()
8873
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
8874
+ __decorate([
8875
+ Input()
8876
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
8877
+ __decorate([
8878
+ Output()
8879
+ ], HistoricalPixAccountComponent.prototype, "isOnlyView", void 0);
8880
+ __decorate([
8881
+ Output()
8882
+ ], HistoricalPixAccountComponent.prototype, "isOnlyEdit", void 0);
8883
+ __decorate([
8884
+ Output()
8885
+ ], HistoricalPixAccountComponent.prototype, "isOnlyDelete", void 0);
8820
8886
  __decorate([
8821
8887
  Input()
8822
8888
  ], HistoricalPixAccountComponent.prototype, "dateChange", null);
@@ -9445,6 +9511,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9445
9511
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
9446
9512
  this.keyPayload = "historicalEmployeePix";
9447
9513
  this.withSidebar = true;
9514
+ this.isOnlyView = new EventEmitter();
9448
9515
  this.enableView = new EventEmitter();
9449
9516
  this.ngUnsubscribe = new Subject();
9450
9517
  this.loading = true;
@@ -9510,13 +9577,21 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9510
9577
  {
9511
9578
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9512
9579
  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);
9580
+ if (this.isAllowToViewHistorical) {
9581
+ const dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, this.dateFormat).format("YYYY-MM-DD");
9582
+ if (this.withSidebar) {
9583
+ this.isOnlyView.emit(true);
9584
+ this.router.navigate([`historical-pix-account/${dateChange}`], {
9585
+ relativeTo: this.activatedRoute,
9586
+ });
9587
+ }
9588
+ else {
9589
+ this.enableView.emit(dateChange);
9590
+ }
9591
+ }
9592
+ else {
9593
+ this.isNotAllowMessage();
9594
+ }
9520
9595
  },
9521
9596
  },
9522
9597
  {
@@ -9526,11 +9601,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9526
9601
  this.delete(rowData.id, rowData.dateChange);
9527
9602
  }
9528
9603
  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
- });
9604
+ this.isNotAllowMessage();
9534
9605
  }
9535
9606
  },
9536
9607
  },
@@ -9587,6 +9658,13 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9587
9658
  });
9588
9659
  }
9589
9660
  }
9661
+ isNotAllowMessage() {
9662
+ this.messageService.add({
9663
+ severity: "error",
9664
+ summary: this.translateService.instant("hcm.payroll.error"),
9665
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9666
+ });
9667
+ }
9590
9668
  onGridLoad(payload) {
9591
9669
  if (payload && payload.length) {
9592
9670
  this.lastRecord = payload[0];
@@ -9598,6 +9676,9 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9598
9676
  get isAllowToDeleteHistorical() {
9599
9677
  return (this.permission["excluir"]);
9600
9678
  }
9679
+ get isAllowToViewHistorical() {
9680
+ return (this.permission["visualizar"]);
9681
+ }
9601
9682
  get scopedActions() {
9602
9683
  return this.getMenuActions.bind(this);
9603
9684
  }
@@ -9641,6 +9722,9 @@ __decorate([
9641
9722
  __decorate([
9642
9723
  Input()
9643
9724
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
9725
+ __decorate([
9726
+ Output()
9727
+ ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
9644
9728
  __decorate([
9645
9729
  Output()
9646
9730
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);