mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { AttachmentsService } from 'src/app/services/attachments.service';
|
|
import { Attachment } from 'src/app/models/attachment.model';
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
|
|
|
@Component({
|
|
selector: 'app-attachments',
|
|
templateUrl: './attachments.page.html',
|
|
styleUrls: ['./attachments.page.scss'],
|
|
})
|
|
export class AttachmentsPage implements OnInit {
|
|
|
|
loadedEventAttachments: Attachment[];
|
|
pageId: string;
|
|
|
|
constructor(private attachamentsService: AttachmentsService, private activatedRoute: ActivatedRoute, private iab: InAppBrowser, private route: Router) { }
|
|
|
|
ngOnInit() {
|
|
/* Emit new data when something changes */
|
|
this.activatedRoute.paramMap.subscribe(paramMap =>{
|
|
if(!paramMap.has('eventId')){
|
|
//Redirect
|
|
return;
|
|
}
|
|
this.loadAttachments(paramMap.get('eventId'));
|
|
});
|
|
}
|
|
|
|
loadAttachments(eventid:string)
|
|
{
|
|
this.attachamentsService.getEventAttachments(eventid).subscribe(attachments => {
|
|
this.loadedEventAttachments = attachments;
|
|
this.pageId = eventid;
|
|
console.log(this.pageId);
|
|
});
|
|
}
|
|
|
|
viewDocument(documenturl:string)
|
|
{
|
|
const browser = this.iab.create(documenturl);
|
|
browser.show();
|
|
}
|
|
|
|
navigateBack(){
|
|
this.route.navigate(['/home/events',this.pageId]);
|
|
}
|
|
|
|
}
|