@senior-gestao-pessoas/payroll-core 9.3.0-dfe04f23-c797-41a3-b912-c4cf9ef516cd → 9.3.0-e7358b40-0308-4e65-bc8c-f57b969edb86

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,22 @@ 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();
8540
+ this.listFromApp = [];
8535
8541
  this.visibleChange = new EventEmitter();
8536
8542
  this.ngUnsubscribe = new Subject();
8537
8543
  this.orderBy = {
@@ -8564,26 +8570,51 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8564
8570
  visible: this.isEditMode,
8565
8571
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
8566
8572
  command: () => {
8567
- rowData["index"] = key;
8568
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: false };
8569
- this.visible = true;
8573
+ if (this.isAllowToViewHistorical) {
8574
+ rowData["index"] = key;
8575
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: false };
8576
+ this.visible = true;
8577
+ }
8578
+ else {
8579
+ this.isOnlyView.emit(true);
8580
+ }
8570
8581
  },
8571
8582
  },
8572
8583
  {
8573
8584
  visible: !!(!this.isEditMode && this.withSideBar),
8574
8585
  label: this.translateService.instant("hcm.payroll.edit"),
8575
8586
  command: () => {
8576
- rowData["index"] = key;
8577
- this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8578
- this.visible = true;
8587
+ if (this.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.listFromApp.length == 0) {
8595
+ console.log('ENTER IN EDIT');
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.listFromApp.length == 0) {
8614
+ this.loading = true;
8615
+ this.deleteAnnuityItem(key);
8616
+ }
8617
+ }
8587
8618
  },
8588
8619
  },
8589
8620
  ];
@@ -8593,6 +8624,13 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8593
8624
  ngOnInit() {
8594
8625
  this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
8595
8626
  }
8627
+ ngOnChanges(changes) {
8628
+ if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
8629
+ console.log('changes', changes['listDataReciever'].currentValue);
8630
+ this.listFromApp = changes['listDataReciever'].currentValue;
8631
+ console.log('listFromApp', this.listFromApp);
8632
+ }
8633
+ }
8596
8634
  createFormGroup() {
8597
8635
  this.historicalPixAccountList = this.formBuilder.group({
8598
8636
  historicalPixAccountList: this.formBuilder.control(null),
@@ -8648,6 +8686,13 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8648
8686
  this.pixAccountItemInput = {};
8649
8687
  this.visible = true;
8650
8688
  }
8689
+ isNotAllowMessage() {
8690
+ this.messageService.add({
8691
+ severity: "error",
8692
+ summary: this.translateService.instant("hcm.payroll.error"),
8693
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
8694
+ });
8695
+ }
8651
8696
  deleteAnnuityItem(index) {
8652
8697
  let newlist = [...this.getHistoricalPixAccountList()];
8653
8698
  newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
@@ -8763,11 +8808,24 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8763
8808
  getFormattedPercentage(value) {
8764
8809
  return FormatUtilsService.getFormattedPercentage(value);
8765
8810
  }
8811
+ get isAllowToAddHistorical() {
8812
+ return (this.permission["incluir"]);
8813
+ }
8814
+ get isAllowToDeleteHistorical() {
8815
+ return (this.permission["excluir"]);
8816
+ }
8817
+ get isAllowToEditHistorical() {
8818
+ return (this.permission["editar"]);
8819
+ }
8820
+ get isAllowToViewHistorical() {
8821
+ return (this.permission["visualizar"]);
8822
+ }
8766
8823
  };
8767
8824
  HistoricalPixAccountComponent.ctorParameters = () => [
8768
8825
  { type: TranslateService },
8769
8826
  { type: ChangeDetectorRef },
8770
- { type: FormBuilder }
8827
+ { type: FormBuilder },
8828
+ { type: MessageService }
8771
8829
  ];
8772
8830
  __decorate([
8773
8831
  ViewChild(CustomFieldsComponent$1, { static: false })
@@ -8817,6 +8875,21 @@ __decorate([
8817
8875
  __decorate([
8818
8876
  Input()
8819
8877
  ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
8878
+ __decorate([
8879
+ Input()
8880
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
8881
+ __decorate([
8882
+ Input()
8883
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
8884
+ __decorate([
8885
+ Output()
8886
+ ], HistoricalPixAccountComponent.prototype, "isOnlyView", void 0);
8887
+ __decorate([
8888
+ Output()
8889
+ ], HistoricalPixAccountComponent.prototype, "isOnlyEdit", void 0);
8890
+ __decorate([
8891
+ Output()
8892
+ ], HistoricalPixAccountComponent.prototype, "isOnlyDelete", void 0);
8820
8893
  __decorate([
8821
8894
  Input()
8822
8895
  ], HistoricalPixAccountComponent.prototype, "dateChange", null);
@@ -9445,6 +9518,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9445
9518
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
9446
9519
  this.keyPayload = "historicalEmployeePix";
9447
9520
  this.withSidebar = true;
9521
+ this.isOnlyView = new EventEmitter();
9448
9522
  this.enableView = new EventEmitter();
9449
9523
  this.ngUnsubscribe = new Subject();
9450
9524
  this.loading = true;
@@ -9512,19 +9586,18 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9512
9586
  command: () => {
9513
9587
  if (this.isAllowToViewHistorical) {
9514
9588
  const dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, this.dateFormat).format("YYYY-MM-DD");
9515
- if (this.withSidebar)
9589
+ if (this.withSidebar) {
9590
+ this.isOnlyView.emit(true);
9516
9591
  this.router.navigate([`historical-pix-account/${dateChange}`], {
9517
9592
  relativeTo: this.activatedRoute,
9518
9593
  });
9519
- else
9594
+ }
9595
+ else {
9520
9596
  this.enableView.emit(dateChange);
9597
+ }
9521
9598
  }
9522
9599
  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
- });
9600
+ this.isNotAllowMessage();
9528
9601
  }
9529
9602
  },
9530
9603
  },
@@ -9535,11 +9608,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9535
9608
  this.delete(rowData.id, rowData.dateChange);
9536
9609
  }
9537
9610
  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
- });
9611
+ this.isNotAllowMessage();
9543
9612
  }
9544
9613
  },
9545
9614
  },
@@ -9596,6 +9665,13 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9596
9665
  });
9597
9666
  }
9598
9667
  }
9668
+ isNotAllowMessage() {
9669
+ this.messageService.add({
9670
+ severity: "error",
9671
+ summary: this.translateService.instant("hcm.payroll.error"),
9672
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9673
+ });
9674
+ }
9599
9675
  onGridLoad(payload) {
9600
9676
  if (payload && payload.length) {
9601
9677
  this.lastRecord = payload[0];
@@ -9653,6 +9729,9 @@ __decorate([
9653
9729
  __decorate([
9654
9730
  Input()
9655
9731
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
9732
+ __decorate([
9733
+ Output()
9734
+ ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
9656
9735
  __decorate([
9657
9736
  Output()
9658
9737
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);