2020-12-01 14:03:15 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2020-12-09 12:10:19 +01:00
|
|
|
import { ModalController, NavParams } from '@ionic/angular';
|
|
|
|
|
import { Publication } from 'src/app/models/publication';
|
|
|
|
|
import { PublicationFolder } from 'src/app/models/publicationfolder';
|
|
|
|
|
import { PublicationsService } from 'src/app/services/publications.service';
|
2020-12-01 17:22:45 +01:00
|
|
|
import { NewPublicationPage } from '../new-publication/new-publication.page';
|
2020-12-09 12:10:19 +01:00
|
|
|
import { PublicationDetailPage } from './publication-detail/publication-detail.page';
|
2020-12-01 14:03:15 +01:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-view-publications',
|
|
|
|
|
templateUrl: './view-publications.page.html',
|
|
|
|
|
styleUrls: ['./view-publications.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class ViewPublicationsPage implements OnInit {
|
2020-12-09 12:10:19 +01:00
|
|
|
publicationList: Publication[];
|
|
|
|
|
item: PublicationFolder;
|
2020-12-01 14:03:15 +01:00
|
|
|
|
2020-12-09 12:10:19 +01:00
|
|
|
constructor(
|
|
|
|
|
private modalController: ModalController,
|
|
|
|
|
private publications: PublicationsService,
|
|
|
|
|
private navParams: NavParams,
|
|
|
|
|
) {
|
|
|
|
|
this.item = this.navParams.get('item');
|
|
|
|
|
}
|
2020-12-01 14:03:15 +01:00
|
|
|
|
|
|
|
|
ngOnInit() {
|
2020-12-09 12:10:19 +01:00
|
|
|
this.getPublications()
|
|
|
|
|
/* console.log(this.item); */
|
|
|
|
|
}
|
|
|
|
|
close(){
|
|
|
|
|
this.modalController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
getPublications(){
|
|
|
|
|
/* console.log(this.item.ProcessId); */
|
|
|
|
|
|
|
|
|
|
this.publications.GetPublications(this.item.ProcessId).subscribe(res=>{
|
|
|
|
|
this.publicationList = new Array();
|
|
|
|
|
console.log(res);
|
|
|
|
|
res.forEach(element => {
|
2020-12-10 11:22:06 +01:00
|
|
|
let itemImage = {
|
|
|
|
|
title: 'Title',
|
|
|
|
|
url: "data:image/jpg;base64," + element.FileBase64,
|
|
|
|
|
format: 'png'
|
|
|
|
|
}
|
2020-12-09 12:10:19 +01:00
|
|
|
let item: Publication = {
|
|
|
|
|
"publicationId":element.DocumentId,
|
|
|
|
|
"processId":element.ProcessId,
|
|
|
|
|
"title":element.Title,
|
|
|
|
|
"description": element.Message,
|
|
|
|
|
"date": element.DatePublication,
|
2020-12-10 11:22:06 +01:00
|
|
|
/* image:itemImage, */
|
|
|
|
|
"imageUrl": "data:image/jpg;base64," + element.FileBase64,
|
|
|
|
|
"imageTitle": '',
|
|
|
|
|
"imageFormat": '',
|
2020-12-09 12:10:19 +01:00
|
|
|
}
|
|
|
|
|
this.publicationList.push(item);
|
|
|
|
|
});
|
|
|
|
|
console.log(this.publicationList);
|
|
|
|
|
});
|
2020-12-01 14:03:15 +01:00
|
|
|
}
|
|
|
|
|
|
2020-12-10 11:22:06 +01:00
|
|
|
async AddPublication(publicationType:any, folderId:string) {
|
2020-12-01 17:22:45 +01:00
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: NewPublicationPage,
|
|
|
|
|
componentProps:{
|
|
|
|
|
publicationType: publicationType,
|
2020-12-10 11:22:06 +01:00
|
|
|
folderId: folderId,
|
2020-12-01 17:22:45 +01:00
|
|
|
},
|
|
|
|
|
cssClass: 'new-publication',
|
|
|
|
|
backdropDismiss: false
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss();
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-09 12:10:19 +01:00
|
|
|
async viewPublicationDetail(processId:string, publicationId:string) {
|
|
|
|
|
const modal = await this.modalController.create({
|
|
|
|
|
component: PublicationDetailPage,
|
|
|
|
|
componentProps:{
|
|
|
|
|
publicationId: publicationId,
|
|
|
|
|
folderId: processId,
|
|
|
|
|
},
|
|
|
|
|
cssClass: 'publication-detail',
|
|
|
|
|
backdropDismiss: false
|
|
|
|
|
});
|
|
|
|
|
await modal.present();
|
|
|
|
|
modal.onDidDismiss();
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-01 14:03:15 +01:00
|
|
|
}
|