mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 13:55:51 +00:00
Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer
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);
|
||||||
})
|
})
|
||||||
|
|
||||||
}); */
|
}); */
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export class AuthService {
|
|||||||
//user: UserForm
|
//user: UserForm
|
||||||
async loginChat() {
|
async loginChat() {
|
||||||
|
|
||||||
const expirationMinutes = 60;
|
const expirationMinutes = 30;
|
||||||
let date = new Date().getTime();
|
let date = new Date().getTime();
|
||||||
let expirationDate = new Date(new Date().getTime() + expirationMinutes*60*1000);
|
let expirationDate = new Date(new Date().getTime() + expirationMinutes*60*1000);
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ export class AuthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.NfService.downloadFileMsg = async (message: MessageService, room?: RoomService) => {
|
this.NfService.downloadFileMsg = async (message: MessageService, room?: RoomService) => {
|
||||||
|
|
||||||
console.log('FILE TYPE', message.file.type)
|
console.log('FILE TYPE', message.file.type)
|
||||||
let downloadFile = "";
|
let downloadFile = "";
|
||||||
@@ -207,20 +207,20 @@ export class AuthService {
|
|||||||
const event: any = await this.AttachmentsService.downloadFile(message.file.guid).toPromise();
|
const event: any = await this.AttachmentsService.downloadFile(message.file.guid).toPromise();
|
||||||
|
|
||||||
console.log('FILE TYPE 22', message.file.guid)
|
console.log('FILE TYPE 22', message.file.guid)
|
||||||
|
|
||||||
if (event.type === HttpEventType.DownloadProgress) {
|
if (event.type === HttpEventType.DownloadProgress) {
|
||||||
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
|
||||||
console.log('FILE TYPE 33', message.file.type)
|
console.log('FILE TYPE 33', message.file.type)
|
||||||
return true
|
return true
|
||||||
} else if (event.type === HttpEventType.Response) {
|
} else if (event.type === HttpEventType.Response) {
|
||||||
downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
|
||||||
|
|
||||||
message.file = {
|
message.file = {
|
||||||
guid: message.file.guid,
|
guid: message.file.guid,
|
||||||
image_url: downloadFile,
|
image_url: downloadFile,
|
||||||
type: message.file.type
|
type: message.file.type
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.storage.set(message.file.guid, downloadFile).then(() => {
|
await this.storage.set(message.file.guid, downloadFile).then(() => {
|
||||||
console.log('IMAGE SAVED')
|
console.log('IMAGE SAVED')
|
||||||
});
|
});
|
||||||
@@ -228,10 +228,10 @@ export class AuthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}, 1)
|
}, 1)
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import { RoomService } from './room.service';
|
|||||||
})
|
})
|
||||||
export class NfService {
|
export class NfService {
|
||||||
|
|
||||||
beforeSendAttachment = async (message: MessageService, room?: RoomService): Promise<boolean> => new Promise ((resolve, reject)=> (resolve(true)))
|
beforeSendAttachment = async (message: MessageService, room?: RoomService): Promise<boolean> => new Promise ((resolve, reject)=> (resolve(true)));
|
||||||
downloadFileMsg = async (message: MessageService, room?: RoomService): Promise<boolean> => new Promise ((resolve, reject)=> (resolve(true)))
|
downloadFileMsg = async (message: MessageService, room?: RoomService): Promise<boolean> => new Promise ((resolve, reject)=> (resolve(true)));
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.getGroupRoom(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
|
||||||
|
|
||||||
@@ -572,7 +608,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
async addImage() {
|
async addImage() {
|
||||||
this.addFileToChat(['image/apng', 'image/jpeg', 'image/png'])
|
this.addFileToChatMobile(['image/apng', 'image/jpeg', 'image/png'])
|
||||||
}
|
}
|
||||||
|
|
||||||
async addFile() {
|
async addFile() {
|
||||||
@@ -624,7 +660,40 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
async addFileToChatMobile(types: typeof FileType[] ) {
|
||||||
|
const roomId = this.roomId
|
||||||
|
|
||||||
|
const file = await Camera.getPhoto({
|
||||||
|
quality: 90,
|
||||||
|
// allowEditing: true,
|
||||||
|
resultType: CameraResultType.Base64,
|
||||||
|
source: CameraSource.Photos
|
||||||
|
});
|
||||||
|
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.getGroupRoom(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 addFileToChat(types: typeof FileType[] ) {
|
async addFileToChat(types: typeof FileType[] ) {
|
||||||
|
|||||||
@@ -196,13 +196,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 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">
|
||||||
<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">
|
||||||
|
|||||||
@@ -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