Files
doneit-web/src/app/modals/document-detail/document-detail.page.ts
T
2021-04-30 14:12:45 +01:00

74 lines
2.2 KiB
TypeScript

import { Component, OnInit } from '@angular/core';
import { MenuController, ModalController, NavParams } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
@Component({
selector: 'app-document-detail',
templateUrl: './document-detail.page.html',
styleUrls: ['./document-detail.page.scss'],
})
export class DocumentDetailPage implements OnInit {
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
customDate:any;
docId: string;
applicationId:string;
LoadedDocument:any = null;
constructor(
private navParams: NavParams,
private modalController: ModalController,
private alertService: AlertService,
private processes: ProcessesService,
private menu: MenuController,
private iab: InAppBrowser,
) {
this.docId = this.navParams.get('docId');
this.applicationId = this.navParams.get('applicationId');
}
ngOnInit() {
this.LoadDocumentDetails();
}
async LoadDocumentDetails() {
this.processes.GetDocumentDetails(this.docId, this.applicationId).subscribe(res=>{
this.LoadedDocument = res;
this.LoadedDocument.Subject = this.LoadedDocument.Assunto
let thedate = new Date(this.LoadedDocument.DateDispatch);
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
});
}
viewDocument() {
this.processes.GetDocumentUrl(this.docId, '8').subscribe(res=>{
console.log(res);
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
});
}
openMenu() {
this.menu.open();
this.modalController.dismiss();
}
close(){
this.modalController.dismiss();
}
notImplemented(){
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
}
}