mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
upload file on chat its done
This commit is contained in:
@@ -820,9 +820,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
console.error(error);
|
||||
})));
|
||||
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||
|
||||
|
||||
const fileBase64 = await this._getBase64(file)
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('blobFile', blob);
|
||||
@@ -841,7 +838,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}],
|
||||
temporaryData: formData,
|
||||
attachmentsModelData: {
|
||||
fileBase64: fileBase64
|
||||
fileBase64: encodedData
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1084,7 +1081,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
async openFile(pdfString, filename, type) {
|
||||
const blob = this.b64toBlob(pdfString, 'application/pdf')
|
||||
const blob = this.b64toBlob(pdfString, type)
|
||||
let pathFile = ''
|
||||
const fileName = filename
|
||||
const contentFile = blob
|
||||
@@ -1097,7 +1094,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
await Filesystem.writeFile({
|
||||
path: fileName,
|
||||
data: pdfString,
|
||||
directory: Directory.Documents,
|
||||
directory: Directory.Data,
|
||||
}).then((dir) => {
|
||||
console.log('DIR ', dir)
|
||||
this.fileOpener
|
||||
|
||||
@@ -829,24 +829,32 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
console.log(file)
|
||||
|
||||
|
||||
/* const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||
|
||||
const fileBase64 = await this._getBase64(file)
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('blobFile', blob);
|
||||
console.log('add file', fileBase64) */
|
||||
|
||||
|
||||
|
||||
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
|
||||
console.log('TYPE',file.type)
|
||||
|
||||
const encodedData = 'data:application/pdf;base64,'+btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
|
||||
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
|
||||
console.error(error);
|
||||
})));
|
||||
console.log(encodedData)
|
||||
const blob = this.fileService.base64toBlob(encodedData, file.type)
|
||||
console.log('BLOB BLOB',blob)
|
||||
/* const fileBase64 = await this._getBase64(file)
|
||||
console.log('BASE&$',fileBase64) */
|
||||
|
||||
|
||||
/* const formData = new FormData();
|
||||
console.log('add file', formData)
|
||||
formData.append('blobFile', blob); */
|
||||
let ob = {'blobFile': blob}
|
||||
const formData = new FormData();
|
||||
formData.append('blobFile', blob);
|
||||
/* console.log('add file', fileBase64) */
|
||||
|
||||
this.ChatSystemService.getDmRoom(roomId).send({
|
||||
file: {
|
||||
@@ -859,7 +867,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
// "text": "description",
|
||||
"title_link_download": false,
|
||||
}],
|
||||
temporaryData: ob,
|
||||
temporaryData: formData,
|
||||
attachmentsModelData: {
|
||||
fileBase64: encodedData,
|
||||
}
|
||||
|
||||
@@ -272,9 +272,9 @@
|
||||
<!-- <ion-fab-button *ngIf="p.userPermission([p.permissionList.Agenda.access])" title="Nova Reunião" (click)="bookMeeting()" color="light">
|
||||
<ion-icon name="calendar"></ion-icon>
|
||||
</ion-fab-button> -->
|
||||
<!-- <ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
|
||||
<ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
|
||||
<ion-icon name="document"></ion-icon>
|
||||
</ion-fab-button> -->
|
||||
</ion-fab-button>
|
||||
<ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
|
||||
<ion-icon name="image"></ion-icon>
|
||||
</ion-fab-button>
|
||||
|
||||
@@ -252,9 +252,9 @@
|
||||
<!-- <ion-fab-button *ngIf="p.userPermission([p.permissionList.Agenda.access])" title="Nova Reunião" (click)="bookMeeting()" color="light">
|
||||
<ion-icon name="calendar"></ion-icon>
|
||||
</ion-fab-button> -->
|
||||
<!-- <ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
|
||||
<ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
|
||||
<ion-icon name="document"></ion-icon>
|
||||
</ion-fab-button> -->
|
||||
</ion-fab-button>
|
||||
<ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
|
||||
<ion-icon name="image"></ion-icon>
|
||||
</ion-fab-button>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<button (click)="takePicture()" full class="btn-ok" shape="round" >Tirar Fotografia</button>
|
||||
<!-- <button (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button> -->
|
||||
<button (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button>
|
||||
<button (click)="anexarFoto()" full class="btn-ok" shape="round" >Anexar Fotografia</button>
|
||||
<button (click)="addDocGestaoDocumental()" class="btn-ok" shape="round" >Gestão Documental</button>
|
||||
<div class="solid"></div>
|
||||
|
||||
Reference in New Issue
Block a user