2020-08-24 23:41:15 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
|
import { AttachmentsService } from 'src/app/services/attachments.service';
|
|
|
|
|
import { Attachment } from 'src/app/models/attachment.model';
|
2020-08-25 14:08:13 +01:00
|
|
|
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
2020-09-08 09:40:25 +01:00
|
|
|
import { ModalController, NavParams } from '@ionic/angular';
|
2020-08-24 23:41:15 +01:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-attachments',
|
|
|
|
|
templateUrl: './attachments.page.html',
|
|
|
|
|
styleUrls: ['./attachments.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class AttachmentsPage implements OnInit {
|
|
|
|
|
|
|
|
|
|
loadedEventAttachments: Attachment[];
|
2020-08-27 12:36:09 +01:00
|
|
|
pageId: string;
|
2020-08-24 23:41:15 +01:00
|
|
|
|
2020-09-07 17:17:09 +01:00
|
|
|
constructor(
|
|
|
|
|
private attachamentsService: AttachmentsService,
|
|
|
|
|
private iab: InAppBrowser,
|
2020-09-08 09:40:25 +01:00
|
|
|
private modalCtrl: ModalController,
|
|
|
|
|
private navParams: NavParams) { }
|
2020-08-24 23:41:15 +01:00
|
|
|
|
|
|
|
|
ngOnInit() {
|
2020-09-08 09:40:25 +01:00
|
|
|
this.loadAttachments(this.navParams.get('eventId'));
|
2020-08-24 23:41:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loadAttachments(eventid:string)
|
|
|
|
|
{
|
2020-11-25 11:25:08 +01:00
|
|
|
this.attachamentsService.getAttachmentsById(eventid).subscribe(attachments => {
|
2020-08-24 23:41:15 +01:00
|
|
|
this.loadedEventAttachments = attachments;
|
2020-08-27 12:36:09 +01:00
|
|
|
this.pageId = eventid;
|
2020-08-24 23:41:15 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-27 15:59:51 +01:00
|
|
|
async viewDocument(documenturl:string)
|
2020-08-25 14:08:13 +01:00
|
|
|
{
|
2020-08-28 12:53:37 +01:00
|
|
|
const url: string = documenturl.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
2020-08-28 12:43:19 +01:00
|
|
|
const browser = this.iab.create(url,"_blank");
|
2020-08-25 14:08:13 +01:00
|
|
|
browser.show();
|
|
|
|
|
}
|
2020-09-08 09:40:25 +01:00
|
|
|
close(){
|
|
|
|
|
this.modalCtrl.dismiss(null);
|
2020-08-27 12:36:09 +01:00
|
|
|
}
|
|
|
|
|
|
2020-09-07 17:17:09 +01:00
|
|
|
|
2020-08-24 23:41:15 +01:00
|
|
|
}
|