mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
replicate download file from chat conversation mobile and web
This commit is contained in:
@@ -195,6 +195,10 @@ const routes = [
|
||||
{
|
||||
path: 'document-viewer',
|
||||
loadChildren: () => import('./modals/document-viewer/document-viewer.module').then( m => m.DocumentViewerPageModule)
|
||||
},
|
||||
{
|
||||
path: 'view-document',
|
||||
loadChildren: () => import('./modals/view-document/view-document.module').then( m => m.ViewDocumentPageModule)
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { Routes, RouterModule } from '@angular/router';
|
||||
|
||||
import { ViewDocumentPage } from './view-document.page';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ViewDocumentPage
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class ViewDocumentPageRoutingModule {}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { ViewDocumentPageRoutingModule } from './view-document-routing.module';
|
||||
|
||||
import { ViewDocumentPage } from './view-document.page';
|
||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
FontAwesomeModule,
|
||||
ViewDocumentPageRoutingModule
|
||||
],
|
||||
declarations: [ViewDocumentPage]
|
||||
})
|
||||
export class ViewDocumentPageModule {}
|
||||
@@ -0,0 +1,25 @@
|
||||
<ion-header class="ion-no-border">
|
||||
<ion-toolbar class="d-flex">
|
||||
<div class="d-flex align-items-center px-20 pt-20 font-25">
|
||||
<div class="left cursor-pointer" (click)="close()">
|
||||
<!-- <ion-icon class="font-35" src="assets/images/icons-arrow-arrow-left.svg"></ion-icon> -->
|
||||
<fa-icon icon="chevron-left" class="menu-icon"></fa-icon>
|
||||
</div>
|
||||
|
||||
<div class="middle">
|
||||
{{file.title}}
|
||||
</div>
|
||||
|
||||
<div class="right cursor-pointer">
|
||||
<fa-icon icon="ellipsis-v" class="menu-icon"></fa-icon>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content class="pt-10 height-100">
|
||||
<div class="height-100">
|
||||
<iframe id="iframe" [src]="trustedUrl" height="100%" width="100%" title="Iframe Example"></iframe>
|
||||
</div>
|
||||
</ion-content>
|
||||
@@ -0,0 +1,11 @@
|
||||
.left{
|
||||
float: left;
|
||||
}
|
||||
.middle{
|
||||
float: left;
|
||||
padding-left: 5px !important;
|
||||
}
|
||||
.right{
|
||||
float: right;
|
||||
margin-left: auto;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { IonicModule } from '@ionic/angular';
|
||||
|
||||
import { ViewDocumentPage } from './view-document.page';
|
||||
|
||||
describe('ViewDocumentPage', () => {
|
||||
let component: ViewDocumentPage;
|
||||
let fixture: ComponentFixture<ViewDocumentPage>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewDocumentPage ],
|
||||
imports: [IonicModule.forRoot()]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ViewDocumentPage);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { ModalController, NavParams } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-document',
|
||||
templateUrl: './view-document.page.html',
|
||||
styleUrls: ['./view-document.page.scss'],
|
||||
})
|
||||
export class ViewDocumentPage implements OnInit {
|
||||
|
||||
url: string;
|
||||
a:string = "https://equilibrium.dyndns.info/FileShare/pdfjs/web/viewer.html?file=";
|
||||
viewerUrl: string;
|
||||
trustedUrl: any;
|
||||
file:any;
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
private navParams: NavParams,
|
||||
private sanitazer: DomSanitizer,
|
||||
) {
|
||||
|
||||
this.file = this.navParams.get('file');
|
||||
this.url = this.file.title_link;
|
||||
console.log(this.url);
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.viewerUrl = this.url.replace("webTRIX.Viewer.Branch1/pdfjs/web/viewpdf.aspx?file=/webTRIX.Viewer.Branch1/arq/637690403731947760.pdf&i", "FileShare/pdfjs/web/viewer.html?file");
|
||||
this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(this.viewerUrl);
|
||||
console.log(this.trustedUrl);
|
||||
}
|
||||
|
||||
close() {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,6 +45,7 @@ ion-content{
|
||||
|
||||
.aside-wrapper{
|
||||
margin: 0 !important;
|
||||
overflow: auto;
|
||||
|
||||
.title-content{
|
||||
padding: 30px 20px 0 20px !important;
|
||||
@@ -52,6 +53,7 @@ ion-content{
|
||||
|
||||
.aside{
|
||||
padding: 0 !important;
|
||||
overflow: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,10 +66,11 @@
|
||||
<div>
|
||||
<div class="file">
|
||||
<!-- <canvas id="pdf_canvas"></canvas> -->
|
||||
<div class="file-details add-ellipsis" *ngIf="msg.file">
|
||||
<span (click)="viewDocument(file.title_link)" class="cursor-pointer">
|
||||
<div (click)="viewDocument(file)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
||||
<span *ngIf="msg.file.type">
|
||||
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" icon="file-word" class="excel-icon"></fa-icon>
|
||||
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg"></ion-icon>
|
||||
</span>
|
||||
<ion-label class="file-title">{{file.title}}</ion-label>
|
||||
|
||||
@@ -18,6 +18,7 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { NewEventPage } from '../../agenda/new-event/new-event.page';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-messages',
|
||||
@@ -364,8 +365,28 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
};
|
||||
}
|
||||
|
||||
viewDocument(url:string){
|
||||
this.fileService.viewDocumentByUrl(url);
|
||||
viewDocument(file:any){
|
||||
if(file.type == "file"){
|
||||
let fullUrl = "https://www.tabularium.pt" + file.title_link;
|
||||
this.fileService.viewDocumentByUrl(fullUrl);
|
||||
}
|
||||
else{
|
||||
this.fileService.viewDocumentByUrl(file.title_link);
|
||||
//this.openViewDocumentModal(file);
|
||||
}
|
||||
}
|
||||
|
||||
async openViewDocumentModal(file:any){
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
componentProps: {
|
||||
file: file,
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async bookMeeting() {
|
||||
|
||||
@@ -64,10 +64,11 @@
|
||||
<div>
|
||||
<div class="file">
|
||||
<!-- <canvas id="pdf_canvas"></canvas> -->
|
||||
<div class="file-details add-ellipsis" *ngIf="msg.file">
|
||||
<span (click)="viewDocument(file.title_link)" class="cursor-pointer">
|
||||
<div (click)="viewDocument(file)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
||||
<span *ngIf="msg.file.type">
|
||||
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" icon="file-word" class="excel-icon"></fa-icon>
|
||||
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg"></ion-icon>
|
||||
</span>
|
||||
<ion-label class="file-title">{{file.title}}</ion-label>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { AfterViewChecked, AfterViewInit, Component, ElementRef, OnDestroy, OnIn
|
||||
import {ActivatedRoute, Router} from '@angular/router'
|
||||
import { GestureController, Gesture, ModalController, NavParams, PopoverController } from '@ionic/angular';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { ContactsPage } from 'src/app/pages/chat/messages/contacts/contacts.page';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
@@ -273,8 +274,28 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
})
|
||||
}
|
||||
|
||||
viewDocument(url:string){
|
||||
this.fileService.viewDocumentByUrl(url);
|
||||
viewDocument(file:any){
|
||||
if(file.type == "file"){
|
||||
let fullUrl = "https://www.tabularium.pt" + file.title_link;
|
||||
this.fileService.viewDocumentByUrl(fullUrl);
|
||||
}
|
||||
else{
|
||||
this.fileService.viewDocumentByUrl(file.title_link);
|
||||
//this.openViewDocumentModal(file);
|
||||
}
|
||||
}
|
||||
|
||||
async openViewDocumentModal(file:any){
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
componentProps: {
|
||||
file: file,
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
getChatMembers() {
|
||||
|
||||
@@ -174,8 +174,8 @@ export class FileService {
|
||||
"text": "",
|
||||
"title_link": this.capturedImage,
|
||||
"title_link_download": true,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
"message_link": this.capturedImage,
|
||||
"type": "file"
|
||||
}],
|
||||
"file":{
|
||||
"name": this.capturedImageTitle,
|
||||
@@ -233,6 +233,7 @@ export class FileService {
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
"message_link": url_no_options,
|
||||
"type": "webtrix"
|
||||
}],
|
||||
"file":{
|
||||
"name": res.data.selected.Assunto,
|
||||
@@ -252,7 +253,7 @@ export class FileService {
|
||||
}
|
||||
|
||||
viewDocumentByUrl(url) {
|
||||
const browser = this.iab.create(url,"_parent");
|
||||
const browser = this.iab.create(url,"_blank");
|
||||
browser.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,10 +59,11 @@
|
||||
<div>
|
||||
<div class="file">
|
||||
<!-- <canvas id="pdf_canvas"></canvas> -->
|
||||
<div class="file-details add-ellipsis" *ngIf="msg.file">
|
||||
<span (click)="viewDocument(file.title_link)" class="cursor-pointer">
|
||||
<div (click)="viewDocument(file)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
||||
<span *ngIf="msg.file.type">
|
||||
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'" icon="file-word" class="excel-icon"></fa-icon>
|
||||
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg"></ion-icon>
|
||||
</span>
|
||||
<ion-label class="file-title">{{file.title}}</ion-label>
|
||||
|
||||
@@ -17,6 +17,7 @@ import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { SearchList } from 'src/app/models/search-document';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { FileService } from 'src/app/services/functions/file.service';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
|
||||
/*
|
||||
@@ -607,8 +608,28 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
});
|
||||
}
|
||||
|
||||
viewDocument(url:string){
|
||||
this.fileService.viewDocumentByUrl(url);
|
||||
viewDocument(file:any){
|
||||
if(file.type == "file"){
|
||||
let fullUrl = "https://www.tabularium.pt" + file.title_link;
|
||||
this.fileService.viewDocumentByUrl(fullUrl);
|
||||
}
|
||||
else{
|
||||
this.fileService.viewDocumentByUrl(file.title_link);
|
||||
//this.openViewDocumentModal(file);
|
||||
}
|
||||
}
|
||||
|
||||
async openViewDocumentModal(file:any){
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
componentProps: {
|
||||
file: file,
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async _openChatOptions() {
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<div>
|
||||
<div class="file">
|
||||
<!-- <canvas id="pdf_canvas"></canvas> -->
|
||||
<div (click)="viewDocument(file.title_link, msg.file.type)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
||||
<div (click)="viewDocument(file)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
|
||||
<span *ngIf="msg.file.type">
|
||||
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
|
||||
|
||||
@@ -15,6 +15,7 @@ import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
|
||||
import { TimeService } from 'src/app/services/functions/time.service';
|
||||
import { FileService } from 'src/app/services/functions/file.service';
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
@Component({
|
||||
selector: 'app-messages',
|
||||
@@ -241,14 +242,28 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
})
|
||||
}
|
||||
|
||||
viewDocument(url:string, documentType?:string){
|
||||
if(documentType == "application/webtrix"){
|
||||
this.fileService.viewDocumentByUrl(url);
|
||||
}
|
||||
else{
|
||||
let fullUrl = "https://www.tabularium.pt" + url;
|
||||
viewDocument(file:any){
|
||||
if(file.type == "file"){
|
||||
let fullUrl = "https://www.tabularium.pt" + file.title_link;
|
||||
this.fileService.viewDocumentByUrl(fullUrl);
|
||||
}
|
||||
else{
|
||||
this.fileService.viewDocumentByUrl(file.title_link);
|
||||
//this.openViewDocumentModal(file);
|
||||
}
|
||||
}
|
||||
|
||||
async openViewDocumentModal(file:any){
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
componentProps: {
|
||||
file: file,
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
getChatMembers() {
|
||||
|
||||
@@ -1175,6 +1175,10 @@ ngx-mat-datetime-content{
|
||||
.powerpoint-icon{
|
||||
color: #d24726;
|
||||
}
|
||||
.menu-icon{
|
||||
color: #42b9fe;
|
||||
padding: 0 5px 0 5px;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 665px) {
|
||||
.loading-blocker {
|
||||
|
||||
Reference in New Issue
Block a user