@senior-gestao-pessoas/payroll-core 9.3.0 → 9.4.0-a9314477-d301-4380-b67e-31e2d2abb4e5

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.isViewModeActive = new EventEmitter();
8538
+ this.isEditModeActive = new EventEmitter();
8539
+ this.isDeleteModeActive = new EventEmitter();
8540
+ this.listFromApp = [];
8535
8541
  this.visibleChange = new EventEmitter();
8536
8542
  this.ngUnsubscribe = new Subject();
8537
8543
  this.orderBy = {
@@ -8564,26 +8570,50 @@ 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.isViewModeActive.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.isEditModeActive.emit(true);
8594
+ if (this.listFromApp.length == 0) {
8595
+ rowData["index"] = key;
8596
+ this.pixAccountItemInput = { currentItem: rowData, listData: this.listDataNoPage, isEditMode: true };
8597
+ this.visible = true;
8598
+ }
8599
+ }
8579
8600
  },
8580
8601
  },
8581
8602
  {
8582
8603
  visible: !this.isEditMode,
8583
8604
  label: this.translateService.instant("hcm.payroll.delete"),
8584
8605
  command: () => {
8585
- this.loading = true;
8586
- this.deleteAnnuityItem(key);
8606
+ if (this.isAllowToDeleteHistorical) {
8607
+ this.loading = true;
8608
+ this.deleteAnnuityItem(key);
8609
+ }
8610
+ else {
8611
+ this.isDeleteModeActive.emit(true);
8612
+ if (this.listFromApp.length == 0) {
8613
+ this.loading = true;
8614
+ this.deleteAnnuityItem(key);
8615
+ }
8616
+ }
8587
8617
  },
8588
8618
  },
8589
8619
  ];
@@ -8593,6 +8623,11 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8593
8623
  ngOnInit() {
8594
8624
  this.formGroup.setControl(this.fieldFormGroup, this.historicalPixAccountList);
8595
8625
  }
8626
+ ngOnChanges(changes) {
8627
+ if (changes['listDataReciever'] && changes['listDataReciever'].currentValue) {
8628
+ this.listFromApp = changes['listDataReciever'].currentValue;
8629
+ }
8630
+ }
8596
8631
  createFormGroup() {
8597
8632
  this.historicalPixAccountList = this.formBuilder.group({
8598
8633
  historicalPixAccountList: this.formBuilder.control(null),
@@ -8648,6 +8683,13 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8648
8683
  this.pixAccountItemInput = {};
8649
8684
  this.visible = true;
8650
8685
  }
8686
+ isNotAllowMessage() {
8687
+ this.messageService.add({
8688
+ severity: "error",
8689
+ summary: this.translateService.instant("hcm.payroll.error"),
8690
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
8691
+ });
8692
+ }
8651
8693
  deleteAnnuityItem(index) {
8652
8694
  let newlist = [...this.getHistoricalPixAccountList()];
8653
8695
  newlist.sort(compareValues(this.orderBy.field, this.orderBy.direction));
@@ -8763,11 +8805,24 @@ let HistoricalPixAccountComponent = class HistoricalPixAccountComponent {
8763
8805
  getFormattedPercentage(value) {
8764
8806
  return FormatUtilsService.getFormattedPercentage(value);
8765
8807
  }
8808
+ get isAllowToAddHistorical() {
8809
+ return (this.permission["incluir"]);
8810
+ }
8811
+ get isAllowToDeleteHistorical() {
8812
+ return (this.permission["excluir"]);
8813
+ }
8814
+ get isAllowToEditHistorical() {
8815
+ return (this.permission["editar"]);
8816
+ }
8817
+ get isAllowToViewHistorical() {
8818
+ return (this.permission["visualizar"]);
8819
+ }
8766
8820
  };
8767
8821
  HistoricalPixAccountComponent.ctorParameters = () => [
8768
8822
  { type: TranslateService },
8769
8823
  { type: ChangeDetectorRef },
8770
- { type: FormBuilder }
8824
+ { type: FormBuilder },
8825
+ { type: MessageService }
8771
8826
  ];
8772
8827
  __decorate([
8773
8828
  ViewChild(CustomFieldsComponent$1, { static: false })
@@ -8817,6 +8872,21 @@ __decorate([
8817
8872
  __decorate([
8818
8873
  Input()
8819
8874
  ], HistoricalPixAccountComponent.prototype, "defaultCpfNumber", void 0);
8875
+ __decorate([
8876
+ Input()
8877
+ ], HistoricalPixAccountComponent.prototype, "permission", void 0);
8878
+ __decorate([
8879
+ Input()
8880
+ ], HistoricalPixAccountComponent.prototype, "listDataReciever", void 0);
8881
+ __decorate([
8882
+ Output()
8883
+ ], HistoricalPixAccountComponent.prototype, "isViewModeActive", void 0);
8884
+ __decorate([
8885
+ Output()
8886
+ ], HistoricalPixAccountComponent.prototype, "isEditModeActive", void 0);
8887
+ __decorate([
8888
+ Output()
8889
+ ], HistoricalPixAccountComponent.prototype, "isDeleteModeActive", void 0);
8820
8890
  __decorate([
8821
8891
  Input()
8822
8892
  ], HistoricalPixAccountComponent.prototype, "dateChange", null);
@@ -9045,6 +9115,7 @@ let HistoricalPixAccountFormComponent = class HistoricalPixAccountFormComponent
9045
9115
  ...this.initialValidatorOfPercentage,
9046
9116
  Validators.max(this.maxValuePercentage),
9047
9117
  ])),
9118
+ externalId: this.formBuilder.control(null),
9048
9119
  customFields: this.formBuilder.control(null),
9049
9120
  });
9050
9121
  }
@@ -9444,6 +9515,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9444
9515
  this.endPoint = "hcm/payroll/queries/historicalEmployeePixQuery";
9445
9516
  this.keyPayload = "historicalEmployeePix";
9446
9517
  this.withSidebar = true;
9518
+ this.isOnlyView = new EventEmitter();
9447
9519
  this.enableView = new EventEmitter();
9448
9520
  this.ngUnsubscribe = new Subject();
9449
9521
  this.loading = true;
@@ -9509,13 +9581,21 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9509
9581
  {
9510
9582
  label: this.translateService.instant("hcm.payroll.employees_image_cropper_view"),
9511
9583
  command: () => {
9512
- const dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, this.dateFormat).format("YYYY-MM-DD");
9513
- if (this.withSidebar)
9514
- this.router.navigate([`historical-pix-account/${dateChange}`], {
9515
- relativeTo: this.activatedRoute,
9516
- });
9517
- else
9518
- this.enableView.emit(dateChange);
9584
+ if (this.isAllowToViewHistorical) {
9585
+ const dateChange = rowData && rowData.dateChange && moment$e(rowData.dateChange, this.dateFormat).format("YYYY-MM-DD");
9586
+ if (this.withSidebar) {
9587
+ this.isOnlyView.emit(true);
9588
+ this.router.navigate([`historical-pix-account/${dateChange}`], {
9589
+ relativeTo: this.activatedRoute,
9590
+ });
9591
+ }
9592
+ else {
9593
+ this.enableView.emit(dateChange);
9594
+ }
9595
+ }
9596
+ else {
9597
+ this.isNotAllowMessage();
9598
+ }
9519
9599
  },
9520
9600
  },
9521
9601
  {
@@ -9525,11 +9605,7 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9525
9605
  this.delete(rowData.id, rowData.dateChange);
9526
9606
  }
9527
9607
  else {
9528
- this.messageService.add({
9529
- severity: "error",
9530
- summary: this.translateService.instant("hcm.payroll.error"),
9531
- detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9532
- });
9608
+ this.isNotAllowMessage();
9533
9609
  }
9534
9610
  },
9535
9611
  },
@@ -9586,6 +9662,13 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9586
9662
  });
9587
9663
  }
9588
9664
  }
9665
+ isNotAllowMessage() {
9666
+ this.messageService.add({
9667
+ severity: "error",
9668
+ summary: this.translateService.instant("hcm.payroll.error"),
9669
+ detail: this.translateService.instant("hcm.payroll.permission_error_not_allowed"),
9670
+ });
9671
+ }
9589
9672
  onGridLoad(payload) {
9590
9673
  if (payload && payload.length) {
9591
9674
  this.lastRecord = payload[0];
@@ -9597,6 +9680,9 @@ let HistoricalPixAccountListComponent = class HistoricalPixAccountListComponent
9597
9680
  get isAllowToDeleteHistorical() {
9598
9681
  return (this.permission["excluir"]);
9599
9682
  }
9683
+ get isAllowToViewHistorical() {
9684
+ return (this.permission["visualizar"]);
9685
+ }
9600
9686
  get scopedActions() {
9601
9687
  return this.getMenuActions.bind(this);
9602
9688
  }
@@ -9640,6 +9726,9 @@ __decorate([
9640
9726
  __decorate([
9641
9727
  Input()
9642
9728
  ], HistoricalPixAccountListComponent.prototype, "withSidebar", void 0);
9729
+ __decorate([
9730
+ Output()
9731
+ ], HistoricalPixAccountListComponent.prototype, "isOnlyView", void 0);
9643
9732
  __decorate([
9644
9733
  Output()
9645
9734
  ], HistoricalPixAccountListComponent.prototype, "enableView", void 0);