add and view docments on chat solved

This commit is contained in:
Equilibrium ITO
2024-03-14 09:10:17 +01:00
parent 5b7224dbd6
commit 8cb9961bad
19 changed files with 230 additions and 25 deletions
@@ -80,7 +80,6 @@
</div>
</div>
<div *ngIf="msg.file && msg.delate == false">
<div (press)="handlePress(msg._id)"
class='message-container incoming-{{msg.u.username!=sessionStore.user.UserName}}'
+15 -2
View File
@@ -2,6 +2,7 @@ import { AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } fr
import { Router } from '@angular/router'
import { GestureController, ModalController, NavParams, PopoverController, Platform, AlertController } from '@ionic/angular';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ViewDocumentSecondOptionsPage} from 'src/app/modals/view-document-second-options/view-document-second-options.page';
import { EventPerson } from 'src/app/models/eventperson.model';
import { ExpedientTaskModalPageNavParamsTask } from 'src/app/models/ExpedientTaskModalPage';
import { ContactsPage } from 'src/app/pages/chat/messages/contacts/contacts.page';
@@ -1115,6 +1116,18 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
async openFile(pdfString, filename, type) {
console.log('url while open ',pdfString)
const modal = await this.modalController.create({
component: ViewDocumentSecondOptionsPage,
componentProps: {
fileUrl: pdfString,
filename: filename
},
cssClass: 'modal modal-desktop'
});
await modal.present();
/*
var blob = new Blob([pdfString], { type: 'application/pdf' });
console.log('blob blob', blob)
@@ -1152,7 +1165,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
.catch(e => console.error(e))
}).catch((error) => {
console.log('error writing the file', error)
});
}); */
}
removeTextBeforeSlash(inputString, controlString) {
@@ -1227,7 +1240,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
modal.present();
} else {
this.openFile(str, msg.attachments[0].title, msg.file.type);
this.openFile(msg.attachments[0].image_url, msg.attachments[0].title, msg.file.type);
}
}