Skip to content

Commit

Permalink
fix: displaying of adequate PIA data on the preview page
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-atnos committed Sep 5, 2024
1 parent f373e49 commit 1d996c0
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions src/app/modules/pia/preview/preview.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Output,
EventEmitter
} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { PiaService } from 'src/app/services/pia.service';
import { AppDataService } from 'src/app/services/app-data.service';
import { TranslateService } from '@ngx-translate/core';
Expand Down Expand Up @@ -43,6 +44,7 @@ export class PreviewComponent implements OnInit, AfterViewChecked {
public download = false;

constructor(
private route: ActivatedRoute,
public authService: AuthService,
public actionPlanService: ActionPlanService,
private translateService: TranslateService,
Expand All @@ -59,22 +61,29 @@ export class PreviewComponent implements OnInit, AfterViewChecked {
this.content = [];
this.dataNav = this.appDataService.dataNav;

this.showPia();
this.piaService
.find(parseInt(this.route.snapshot.params.id))
.then(async (pia: Pia) => {
this.pia = pia;
this.actionPlanService.data = this.dataNav;
this.actionPlanService.pia = this.pia;
this.showPia();

if (this.pia.is_archive === 1) {
this.fromArchives = true;
}
if (this.pia.is_archive === 1) {
this.fromArchives = true;
}

// Load PIA's revisions
const revision = new Revision();
this.revisionService.findAllByPia(this.pia.id).then(resp => {
this.revisions = resp;
});
// Load PIA's revisions
const revision = new Revision();
this.revisionService.findAllByPia(this.pia.id).then(resp => {
this.revisions = resp;
});

if (this.pia.structure_data) {
this.appDataService.dataNav = this.pia.structure_data;
}
this.data = this.appDataService.dataNav;
if (this.pia.structure_data) {
this.appDataService.dataNav = this.pia.structure_data;
}
this.data = this.appDataService.dataNav;
});
}

ngAfterViewChecked(): void {
Expand Down Expand Up @@ -121,8 +130,6 @@ export class PreviewComponent implements OnInit, AfterViewChecked {
*/
async showPia(): Promise<void> {
this.prepareDpoData();
this.actionPlanService.data = this.dataNav;
this.actionPlanService.pia = this.pia;
this.actionPlanService.listActionPlan();
this.getJsonInfo();
}
Expand Down

0 comments on commit 1d996c0

Please sign in to comment.