mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add and takepicture bug solved on group chat
This commit is contained in:
@@ -161,7 +161,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
console.log('publications by ids', ress)
|
console.log('publications by ids', ress)
|
||||||
let item: Publication = this.publicationPipe.itemList(ress)
|
let item: Publication = this.publicationPipe.itemList(ress)
|
||||||
console.log('publications by ids 2', item)
|
console.log('publications by ids 2', item)
|
||||||
this.publicationList.push(ress);
|
this.publicationList.push(item);
|
||||||
})
|
})
|
||||||
|
|
||||||
}); */
|
}); */
|
||||||
|
|||||||
@@ -216,13 +216,13 @@
|
|||||||
<ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light">
|
<ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light">
|
||||||
<ion-icon name="calendar"></ion-icon>
|
<ion-icon name="calendar"></ion-icon>
|
||||||
</ion-fab-button>
|
</ion-fab-button>
|
||||||
<ion-fab-button hidden title="Adicionar Documento" (click)="addFile()" color="light">
|
<ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
|
||||||
<ion-icon name="document"></ion-icon>
|
<ion-icon name="document"></ion-icon>
|
||||||
</ion-fab-button>
|
</ion-fab-button>
|
||||||
<ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
|
<ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
|
||||||
<ion-icon name="image"></ion-icon>
|
<ion-icon name="image"></ion-icon>
|
||||||
</ion-fab-button>
|
</ion-fab-button>
|
||||||
<ion-fab-button title="Tirar Fotografia" (click)="takePicture()" color="light">
|
<ion-fab-button title="Tirar Fotografia" (click)="takePictureMobile()" color="light">
|
||||||
<ion-icon name="camera"></ion-icon>
|
<ion-icon name="camera"></ion-icon>
|
||||||
</ion-fab-button>
|
</ion-fab-button>
|
||||||
<ion-fab-button title="Documento da Gestão Documental" (click)="addFileWebtrix()" color="light">
|
<ion-fab-button title="Documento da Gestão Documental" (click)="addFileWebtrix()" color="light">
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import { CameraService } from 'src/app/services/camera.service';
|
|||||||
import { element } from 'protractor';
|
import { element } from 'protractor';
|
||||||
import { FileType } from 'src/app/models/fileType';
|
import { FileType } from 'src/app/models/fileType';
|
||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
import * as pdfjsLib from 'pdfjs-dist';
|
import * as pdfjsLib from 'pdfjs-dist';
|
||||||
@@ -542,6 +543,41 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
|||||||
await modal.present();
|
await modal.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async takePictureMobile() {
|
||||||
|
const roomId = this.roomId
|
||||||
|
|
||||||
|
const file = await Camera.getPhoto({
|
||||||
|
quality: 90,
|
||||||
|
// allowEditing: true,
|
||||||
|
resultType: CameraResultType.Base64,
|
||||||
|
source: CameraSource.Camera
|
||||||
|
});
|
||||||
|
console.log('ADDFILECHAT', file)
|
||||||
|
//const imageData = await this.fileToBase64Service.convert(file)
|
||||||
|
//console.log('ADDFILECHAT', imageData)
|
||||||
|
|
||||||
|
const response = await fetch('data:image/jpeg;base64,'+ file.base64String!);
|
||||||
|
const blob = await response.blob();
|
||||||
|
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("blobFile", blob);
|
||||||
|
|
||||||
|
this.wsChatMethodsService.getDmRoom(roomId).send({
|
||||||
|
file: {
|
||||||
|
"type": "application/img",
|
||||||
|
"guid": '',
|
||||||
|
},
|
||||||
|
temporaryData: formData,
|
||||||
|
attachments: [{
|
||||||
|
"title": file.path ,
|
||||||
|
"image_url": 'data:image/jpeg;base64,' +file.base64String,
|
||||||
|
"text": "description",
|
||||||
|
"title_link_download": false,
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
async takePicture() {
|
async takePicture() {
|
||||||
const roomId = this.roomId
|
const roomId = this.roomId
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@
|
|||||||
<ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light">
|
<ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light">
|
||||||
<ion-icon name="calendar"></ion-icon>
|
<ion-icon name="calendar"></ion-icon>
|
||||||
</ion-fab-button>
|
</ion-fab-button>
|
||||||
<ion-fab-button title="Adicionar Documento" hidden (click)="addFile()" color="light">
|
<ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
|
||||||
<ion-icon name="document"></ion-icon>
|
<ion-icon name="document"></ion-icon>
|
||||||
</ion-fab-button>
|
</ion-fab-button>
|
||||||
<ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
|
<ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<div class="main-container px-20">
|
<div class="main-container px-20">
|
||||||
<ion-list>
|
<ion-list>
|
||||||
<div class="post-item d-md-block mb-10 cursor-pointer"
|
<div class="post-item d-md-block mb-10 cursor-pointer"
|
||||||
*ngFor="let publication of publicationListStorage.documents[folderId]"
|
*ngFor="let publication of getpublication"
|
||||||
(click)="viewPublicationDetail(publication.DocumentId)">
|
(click)="viewPublicationDetail(publication.DocumentId)">
|
||||||
<div *ngIf="publication.FileBase64.length > 30" class="mb-10 post-img width-md-100">
|
<div *ngIf="publication.FileBase64.length > 30" class="mb-10 post-img width-md-100">
|
||||||
<img src="{{publication.FileBase64}}" alt="image">
|
<img src="{{publication.FileBase64}}" alt="image">
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import { PublicationPipe } from 'src/app/pipes/publication.pipe';
|
|||||||
import { ThemeService } from 'src/app/services/theme.service'
|
import { ThemeService } from 'src/app/services/theme.service'
|
||||||
import { ToastService } from 'src/app/services/toast.service';
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
import { EditActionPage } from 'src/app/pages/publications/edit-action/edit-action.page';
|
import { EditActionPage } from 'src/app/pages/publications/edit-action/edit-action.page';
|
||||||
|
import { Storage } from '@ionic/storage';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-view-publications',
|
selector: 'app-view-publications',
|
||||||
@@ -25,7 +26,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
|
|
||||||
publicationList: Publication[];
|
publicationList: Publication[];
|
||||||
item: PublicationFolder;
|
item: PublicationFolder;
|
||||||
|
getpublication = [];
|
||||||
error: any;
|
error: any;
|
||||||
|
|
||||||
@Input() folderId: string;
|
@Input() folderId: string;
|
||||||
@@ -50,6 +51,7 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
private publications: PublicationsService,
|
private publications: PublicationsService,
|
||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
private toastService: ToastService,
|
private toastService: ToastService,
|
||||||
|
private storage: Storage
|
||||||
) {
|
) {
|
||||||
this.item = new PublicationFolder();
|
this.item = new PublicationFolder();
|
||||||
}
|
}
|
||||||
@@ -72,10 +74,10 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
}
|
}
|
||||||
console.log('change view to ',this.folderId)
|
console.log('change view to ',this.folderId)
|
||||||
|
|
||||||
setTimeout(()=>{
|
//setTimeout(()=>{
|
||||||
this.getPublications();
|
this.getPublications();
|
||||||
this.getPublicationDetail();
|
this.getPublicationDetail();
|
||||||
}, 100)
|
//}, 100)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -99,11 +101,58 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getPublicationsIds() {
|
||||||
|
|
||||||
|
this.showLoader = true;
|
||||||
|
const folderId = this.folderId
|
||||||
|
this.getFromDB()
|
||||||
|
this.publications.GetPublicationsImages(this.folderId).subscribe(res => {
|
||||||
|
|
||||||
|
console.log('publications ids', res)
|
||||||
|
this.publicationList = new Array();
|
||||||
|
|
||||||
|
for(let i = 0; i < res.length; i++) {
|
||||||
|
this.publications.GetPublicationById(res[i]).subscribe(ress => {
|
||||||
|
console.log('publications by ids', ress)
|
||||||
|
let item: Publication = this.publicationPipe.itemList(ress)
|
||||||
|
console.log('publications by ids 2', item)
|
||||||
|
this.publicationList.push(item);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* res.forEach(element => {
|
||||||
|
console.log('publications elements', element)
|
||||||
|
this.publications.GetPublicationById(element).subscribe(ress => {
|
||||||
|
console.log('publications by ids', ress)
|
||||||
|
let item: Publication = this.publicationPipe.itemList(ress)
|
||||||
|
console.log('publications by ids 2', item)
|
||||||
|
this.publicationList.push(item);
|
||||||
|
})
|
||||||
|
|
||||||
|
}); */
|
||||||
|
console.log('PUBLICATIONS IMAGEs',this.publicationList)
|
||||||
|
this.storage.remove('view_publications');
|
||||||
|
this.storage.set('view_publications', this.publicationList);
|
||||||
|
console.log('PUBLICATIONS IMAGEs',this.publicationList)
|
||||||
|
|
||||||
|
this.publicationListStorage.add(folderId, this.publicationList)
|
||||||
|
this.getpublication = this.publicationList;
|
||||||
|
this.showLoader = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getFromDB() {
|
||||||
|
this.storage.get('view_publications').then((viewPublications) => {
|
||||||
|
this.getpublication = viewPublications;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
getPublications() {
|
getPublications() {
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
const folderId = this.folderId
|
const folderId = this.folderId
|
||||||
this.publicationList = new Array();
|
this.publicationList = new Array();
|
||||||
this.publications.GetPublications(folderId).subscribe(res=> {
|
this.getFromDB();
|
||||||
|
this.publications.GetPublications(folderId).subscribe(async res=> {
|
||||||
|
|
||||||
res.forEach(element => {
|
res.forEach(element => {
|
||||||
let item: Publication = this.publicationPipe.itemList(element)
|
let item: Publication = this.publicationPipe.itemList(element)
|
||||||
@@ -111,7 +160,9 @@ export class ViewPublicationsPage implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.publicationListStorage.add(folderId, this.publicationList)
|
this.publicationListStorage.add(folderId, this.publicationList)
|
||||||
|
await this.storage.remove('view_publications');
|
||||||
|
await this.storage.set('view_publications', this.publicationList);
|
||||||
|
//this.getFromDB();
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
},
|
},
|
||||||
(error)=>{
|
(error)=>{
|
||||||
|
|||||||
Reference in New Issue
Block a user