Merge branch 'developer' of https://bitbucket.org/equilibriumito/gabinete-digital into feature/autologinchat

This commit is contained in:
tiago.kayaya
2022-02-08 15:33:44 +01:00
51 changed files with 2060 additions and 1498 deletions
@@ -78,7 +78,7 @@
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments">
<div *ngIf="msg.file.type == 'application/img'" (click)="openPreview(msg)">
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image">
<img *ngIf="msg.file.image_url" src="{{msg.file.image_url}}" alt="image">
<ion-icon *ngIf="msg.file.image_url == null" name="download-outline"></ion-icon>
</div>
<div *ngIf="msg.file.type != 'application/img'">
@@ -97,7 +97,7 @@
<ion-label *ngIf="msg.file">
<span *ngIf="file.description">{{file.description}}</span>
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
<span *ngIf="msg.file.type != 'application/webtrix'">{{msg.file.type.replace('application/','').toUpperCase()}}</span>
<span *ngIf="msg.file.type != 'application/webtrix'">{{msg.displayType}}</span>
</ion-label>
</div>
</div>
@@ -222,7 +222,7 @@
<ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
<ion-icon name="image"></ion-icon>
</ion-fab-button>
<ion-fab-button title="Tirar Fotografia" class="hide-desktop" (click)="takePicture()" color="light">
<ion-fab-button title="Tirar Fotografia" (click)="takePicture()" color="light">
<ion-icon name="camera"></ion-icon>
</ion-fab-button>
<ion-fab-button title="Documento da Gestão Documental" (click)="addFileWebtrix()" color="light">
@@ -26,6 +26,12 @@ import { HttpEventType } from '@angular/common/http';
import { Storage } from '@ionic/storage';
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service';
import { MessageService } from 'src/app/services/chat/message.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { CameraService } from 'src/app/services/camera.service';
import { element } from 'protractor';
import { FileType } from 'src/app/models/fileType';
import { ToastService } from 'src/app/services/toast.service';
/*
import * as pdfjsLib from 'pdfjs-dist';
@@ -96,6 +102,10 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
public ThemeService: ThemeService,
private changeDetectorRef: ChangeDetectorRef,
private storage: Storage,
private AttachmentsService: AttachmentsService,
private CameraService: CameraService,
private toastService: ToastService,
) {
console.log('OnCONSTRUCTOR');
@@ -129,7 +139,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
setTimeout(() => {
this.getRoomInfo();
}, 1000);
this.setStatus('online');
this.getChatMembers();
//this.getMessageDB();
@@ -216,7 +225,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
ngOnDestroy() {
this.setStatus('away');
window.removeEventListener('scroll', this.scrollChangeCallback, true);
}
@@ -297,17 +305,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
}
loadGroupMessages(roomId) {
this.showLoader = true;
this.chatService.getPrivateGroupMessages(this.roomId).subscribe(res => {
console.log(res);
let msgOnly = res['messages'].filter(data => data.t != 'au');
this.showLoader = false;
});
}
sendMessage() {
this.wsChatMethodsService.getGroupRoom(this.roomId).send()
this.wsChatMethodsService.getGroupRoom(this.roomId).send({})
}
deleteMessage(msgId: string, room:any) {
@@ -388,10 +387,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
else {
this.roomName = res.data.name.split('-').join(' ');
console.log(this.roomName);
//this.getRoomInfo();
this.loadGroupMessages(this.roomId);
//this.modalController.dismiss();
};
});
@@ -423,7 +418,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
popover.onDidDismiss().then(res => {
console.log(res);
if (res.data) {
this.loadGroupMessages(this.roomId);
//this.getRoomInfo();
//this.modalController.dismiss();
};
@@ -464,89 +458,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
modal.onDidDismiss().then(() => {
//this.getRoomInfo();
this.loadGroupMessages(this.roomId)
});
}
loadPicture() {
const input = this.fileLoaderService.createInput({
accept: ['image/apng', 'image/jpeg', 'image/png']
})
input.onchange = async () => {
const file = this.fileLoaderService.getFirstFile(input)
console.log(file);
const imageData = await this.fileToBase64Service.convert(file)
this.capturedImage = imageData;
this.capturedImageTitle = file.name;
let body = {
"message":
{
"rid": this.roomId,
"msg": "",
"attachments": [{
//"title": this.capturedImageTitle ,
//"text": "description",
"title_link_download": false,
"image_url": this.capturedImage,
}]
}
}
this.chatService.sendMessage(body).subscribe(res => {
console.log(res);
}, (error) => {
});
//console.log(this.capturedImage)
};
}
loadDocument() {
const input = this.fileLoaderService.createInput({
accept: ['.doc', '.docx', '.pdf']
})
input.onchange = async () => {
const file = this.fileLoaderService.getFirstFile(input)
console.log(file);
const imageData = await this.fileToBase64Service.convert(file)
this.capturedImage = imageData;
this.capturedImageTitle = file.name;
let body = {
"message":
{
"rid": this.roomId,
"msg": "",
"attachments": [{
"title": this.capturedImageTitle,
"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,
}],
"file": {
"name": this.capturedImageTitle,
"type": "application/pdf",
}
}
}
this.chatService.sendMessage(body).subscribe(res => {
//console.log(res);
}, (error) => {
});
//console.log(this.capturedImage)
};
}
async addDocGestaoDocumental() {
const modal = await this.modalController.create({
@@ -563,36 +477,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
if (res) {
const data = res.data;
this.documents.push(data.selected);
console.log(res.data.selected);
console.log(res.data.selected.Id);
console.log(res.data.selected.ApplicationType);
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
let url_no_options: string = url.replace("webTRIX.Viewer", "webTRIX.Viewer.Branch1");
console.log(url_no_options);
//console.log('Oie');
let body = {
"message":
{
"rid": this.roomId,
"msg": "",
"attachments": [{
"title": res.data.selected.Assunto,
"text": res.data.selected.DocTypeDesc,
"title_link": url_no_options,
"title_link_download": true,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
"message_link": url_no_options,
}]
}
}
this.chatService.sendMessage(body).subscribe(res => {
console.log(res);
}, (error) => {
});
this.addFileWebtrix()
}
});
}
@@ -656,18 +542,119 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
await modal.present();
}
takePicture() {
this.fileService.addCameraPictureToChat(this.roomId);
async takePicture() {
const roomId = this.roomId
const image = await this.CameraService.takePicture();
await this.fileService.saveImage(image)
const lastphoto: any = await this.fileService.loadFiles();
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto);
const base64 = await fetch(capturedImage);
const blob = await base64.blob();
const formData = new FormData();
formData.append("blobFile", blob);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"guid": '',
"image_url": capturedImage
},
attachments: [{
"title": capturedImageTitle ,
"image_url": capturedImage,
"text": "description",
"title_link_download": false,
}],
temporaryData: formData
})
}
addImage() {
this.fileService.addPictureToChat(this.roomId);
async addImage() {
this.addFileToChat(['image/apng', 'image/jpeg', 'image/png'])
}
addFile() {
this.fileService.addDocumentToChat(this.roomId);
async addFile() {
this.addFileToChat(['.doc', '.docx', '.pdf'])
}
addFileWebtrix() {
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
async addFileWebtrix() {
const roomId = this.roomId
const modal = await this.modalController.create({
component: SearchPage,
cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop',
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
select: true,
showSearchInput: true,
}
});
await modal.present();
modal.onDidDismiss().then(async res=>{
const data = res.data;
if(data.selected) {
const loader = this.toastService.loading();
this.wsChatMethodsService.getDmRoom(roomId).send({
file:{
"name": res.data.selected.Assunto,
"type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType,
"DocId": res.data.selected.Id,
"Assunto": res.data.selected.Assunto,
},
attachments: [{
"title": res.data.selected.Assunto,
"description": res.data.selected.DocTypeDesc,
// "title_link": url_no_options,
"title_link_download": true,
//"thumb_url": "assets/images/webtrix-logo.png",
// "message_link": url_no_options,
"type": "webtrix",
//"thumb_url": "assets/images/webtrix-logo.png",
"text": res.data.selected.DocTypeDesc,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
temporaryData: res
})
loader.remove();
}
});
}
async addFileToChat(types: typeof FileType[] ) {
const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types);
const imageData = await this.fileToBase64Service.convert(file)
const formData = new FormData();
formData.append("blobFile", file);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"guid": '',
"image_url": imageData
},
temporaryData: formData,
attachments: [{
"title": file.name ,
"image_url": imageData,
"text": "description",
"title_link_download": false,
}]
})
}
bookMeeting() {
let data = {
roomId: this.roomId,
@@ -693,7 +680,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(5000)
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
@@ -711,10 +698,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
members: this.members,
}
});
await modal.present();
modal.onDidDismiss().then((res) => {
//console.log(res['data']);
modal.onDidDismiss().then( async (res) => {
console.log(res['data']);
const roomId = this.roomId;
if (res['data'] == 'meeting') {
//this.closeAllDesktopComponents.emit();
let data = {
@@ -724,73 +712,36 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
this.openNewEventPage.emit(data);
}
else if (res['data'] == 'take-picture') {
this.fileService.addCameraPictureToChat(this.roomId);
//this.loadPicture();
this.takePicture()
}
else if (res['data'] == 'add-picture') {
this.fileService.addPictureToChat(this.roomId);
//this.loadPicture();
this.addImage()
}
else if (res['data'] == 'add-document') {
this.loadDocument();
this.addFile()
}
else if (res['data'] == 'documentoGestaoDocumental') {
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
//this.addDocGestaoDocumental();
this.addFileWebtrix()
this.showLoader = false;
}
this.loadGroupMessages(this.roomId);
});
}
sliderOpts = {
zoom: false,
slidesPerView: 1.5,
spaceBetween: 20,
centeredSlides: true
};
zoomActive = false;
zoomScale = 1;
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
zoom: {
maxRatio: 5
},
on: {
zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale / 5;
this.changeDetectorRef.detectChanges();
}
}
}
async touchEnd(zoomslides: IonSlides, card) {
// Zoom back to normal
const slider = await zoomslides.getSwiper();
const zoom = slider.zoom;
zoom.out();
// Card back to normal
card.el.style['z-index'] = 9;
this.zoomActive = false;
this.changeDetectorRef.detectChanges();
}
touchStart(card) {
// Make card appear above backdrop
card.el.style['z-index'] = 11;
}
downloadFileMsg(msg: MessageService) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
if (msg.file.type == "application/img") {
this.fileService.downloadFile(msg.file.guid).subscribe(async (event) => {
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
@@ -48,11 +48,11 @@
</mat-menu>
</div>
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<ion-label>{{msg.u.name}} {{msg.offline}}</ion-label>
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
</div>
<div>
<ion-label>{{msg.msg}}</ion-label>
<ion-label>{{msg.msg}} {{msg.offline}}</ion-label>
{{last ? scrollToBottom() : ''}}
</div>
</div>
@@ -67,7 +67,7 @@
</mat-menu>
</div>
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<ion-label>{{msg.u.name}} </ion-label>
<span class="time">{{showDateDuration(msg.duration)}}</span>
</div>
<div>
@@ -97,7 +97,7 @@
<span *ngIf="file.description">{{file.description}}</span>
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
<span
*ngIf="msg.file.type != 'application/webtrix'">{{msg.file.type.replace('application/','').toUpperCase()}}</span>
*ngIf="msg.file.type != 'application/webtrix'">{{msg.displayType}}</span>
</ion-label>
</div>
</div>
+152 -116
View File
@@ -13,10 +13,9 @@ import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
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, HttpEventType, HttpHeaders } from '@angular/common/http';
import { HttpClient, HttpEventType } from '@angular/common/http';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { SqliteService } from 'src/app/services/sqlite.service';
import { StorageService } from 'src/app/services/storage.service';
@@ -26,7 +25,13 @@ import { Storage } from '@ionic/storage';
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service'
import { WsChatService } from 'src/app/services/chat/ws-chat.service'
import { MessageService } from 'src/app/services/chat/message.service';
import { element } from 'protractor';
import { AttachmentsService } from 'src/app/services/attachments.service';
import { CameraService } from 'src/app/services/camera.service';
import { FileType } from 'src/app/models/fileType';
import { SearchPage } from 'src/app/pages/search/search.page';
import { ProcessesService } from 'src/app/services/processes.service';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
const IMAGE_DIR = 'stored-images';
@Component({
@@ -92,7 +97,12 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private router: Router,
private storage: Storage,
public wsChatMethodsService: WsChatMethodsService,
public WsChatService: WsChatService
public WsChatService: WsChatService,
private AttachmentsService: AttachmentsService,
private CameraService: CameraService,
private processesService: ProcessesService,
private fileToBase64Service: FileToBase64Service,
) {
this.loggedUser = authService.ValidatedUserChat['data'];
@@ -104,6 +114,11 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
this.wsChatMethodsService.openRoom(this.roomId)
this.wsChatMethodsService.getDmRoom(this.roomId).uploadAttachment = async (formData) => {
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
}
setTimeout(() => {
this.scrollToBottomClicked()
}, 150)
@@ -113,7 +128,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
ngOnInit() {
this.scrollToBottom();
this.setStatus('online');
this.getChatMembers();
}
@@ -133,15 +149,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
});
}
setStatus(status: string) {
let body = {
message: '',
status: status,
}
this.chatService.setUserStatus(body).subscribe(res => {
console.log(res);
})
}
notImplemented() {
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
@@ -149,7 +156,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
load = () => {
this.checktimeOut = true;
this.serverLongPull();
this.getChatMembers();
}
@@ -204,7 +210,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
ngOnDestroy() {
this.checktimeOut = false;
this.setStatus('away');
window.removeEventListener('scroll', this.scrollChangeCallback, true);
}
@@ -241,7 +246,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
sendMessage() {
this.wsChatMethodsService.getDmRoom(this.roomId).send()
this.wsChatMethodsService.getDmRoom(this.roomId).send({})
}
deleteMessage(msgId: string, room:any) {
@@ -250,7 +255,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
async viewDocument(msg: any, url?: string) {
if (msg.file.type == "application/img") {
let response: any = await this.fileService.getFile(msg.file.guid).toPromise();
let response: any = await this.AttachmentsService.getFile(msg.file.guid).toPromise();
console.log(response);
alert(response);
@@ -266,7 +271,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
//fullUrl = "http://www.africau.edu/images/default/sample.pdf";
this.frameUrl = fullUrl;
//this.fileService.viewDocumentByUrl(fullUrl);
this.chatService.getDocumentDetails(fullUrl);
}
}
@@ -438,22 +443,118 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
takePicture() {
async takePicture() {
const roomId = this.roomId
this.fileService.addCameraPictureToChat(roomId);
const image = await this.CameraService.takePicture();
await this.fileService.saveImage(image)
const lastphoto: any = await this.fileService.loadFiles();
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto);
const base64 = await fetch(capturedImage);
const blob = await base64.blob();
const formData = new FormData();
formData.append("blobFile", blob);
console.log('formData', formData)
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"guid": '',
"image_url": capturedImage
},
temporaryData: formData,
attachments: [{
"title": capturedImageTitle ,
"image_url": capturedImage,
"text": "description",
"title_link_download": false,
}]
})
}
addImage() {
const roomId = this.roomId;
this.fileService.addPictureToChat(roomId);
//this.fileService.loadPicture();
//this.fileService.addPictureToChat(roomId);
async addImage() {
this.addFileToChat(['image/apng', 'image/jpeg', 'image/png'])
}
addFile() {
this.fileService.addDocumentToChat(this.roomId);
async addFile() {
this.addFileToChat(['.doc', '.docx', '.pdf'])
}
addFileWebtrix() {
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
async addFileWebtrix() {
const modal = await this.modalController.create({
component: SearchPage,
cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop',
componentProps: {
type: 'AccoesPresidenciais & ArquivoDespachoElect',
select: true,
showSearchInput: true,
}
});
await modal.present();
modal.onDidDismiss().then(async res=>{
const data = res.data;
const roomId = this.roomId
if(data.selected) {
const loader = this.toastService.loading();
this.wsChatMethodsService.getDmRoom(roomId).send({
file:{
"name": res.data.selected.Assunto,
"type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType,
"DocId": res.data.selected.Id,
"Assunto": res.data.selected.Assunto,
},
attachments: [{
"title": res.data.selected.Assunto,
"description": res.data.selected.DocTypeDesc,
"title_link_download": true,
"type": "webtrix",
"text": res.data.selected.DocTypeDesc,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
})
loader.remove();
}
});
}
async addFileToChat(types: typeof FileType[] ) {
const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types);
const imageData = await this.fileToBase64Service.convert(file)
const formData = new FormData();
formData.append("blobFile", file);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"guid": '',
"image_url": imageData, // GPR
},
attachments: [{
"title": file.name ,
"name": file.name ,
// "text": "description",
"image_url": imageData, // rocketchat
"title_link_download": false,
}],
temporaryData: formData
})
}
bookMeeting() {
let data = {
roomId: this.roomId,
@@ -463,7 +564,13 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
chatsend() {
}
async _openChatOptions() {
const roomId = this.roomId;
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
@@ -499,8 +606,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
});
await modal.present();
modal.onDidDismiss().then((res) => {
modal.onDidDismiss().then( async (res) => {
console.log(res['data']);
if (res['data'] == 'meeting') {
//this.closeAllDesktopComponents.emit();
let data = {
@@ -510,111 +619,38 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.openNewEventPage.emit(data);
}
else if (res['data'] == 'take-picture') {
this.fileService.addCameraPictureToChat(this.roomId);
//this.loadPicture();
this.takePicture()
}
else if (res['data'] == 'add-picture') {
this.fileService.addPictureToChat(this.roomId);
//this.loadPicture();
this.addImage()
}
else if (res['data'] == 'add-document') {
this.fileService.addDocumentToChat(this.roomId);
//this.loadDocument();
this.addFile()
}
else if (res['data'] == 'documentoGestaoDocumental') {
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
this.addFileWebtrix()
this.showLoader = false;
//this.addDocGestaoDocumental();
}
});
}
async serverLongPull() {
const roomId = this.roomId;
this.chatService.getRoomMessages(this.roomId).subscribe(async res => {
console.log('serverLongPull', res['success']);
if (res['success'] == true) {
// Show Error
//showMessage(response.statusText);
/* this.messages = res['messages'].reverse();
this.chatMessageStore.add(roomId, this.messages) */
console.log('MSG FROM ROCKET ', res['messages'].reverse())
/* this.transformData(res['messages'].reverse());
this.getMessageDB(); */
//console.log(this.messages);
// Reconnect in one second
if (this.route.url != "/home/chat") {
console.log("Timer message stop")
}
else {
if (document.querySelector('app-messages')) {
await new Promise(resolve => setTimeout(resolve, 5000));
// await this.serverLongPull();
this.getDirectMessages.emit();
console.log('Timer message running')
}
}
}
}, (error) => {
console.log(error);
});
}
sliderOpts = {
zoom: false,
slidesPerView: 1.5,
spaceBetween: 20,
centeredSlides: true
};
zoomActive = false;
zoomScale = 1;
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
zoom: {
maxRatio: 5
},
on: {
zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale / 5;
this.changeDetectorRef.detectChanges();
}
}
}
async touchEnd(zoomslides: IonSlides, card) {
// Zoom back to normal
const slider = await zoomslides.getSwiper();
const zoom = slider.zoom;
zoom.out();
// Card back to normal
card.el.style['z-index'] = 9;
this.zoomActive = false;
this.changeDetectorRef.detectChanges();
}
touchStart(card) {
// Make card appear above backdrop
card.el.style['z-index'] = 11;
}
downloadFileMsg(msg: MessageService) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
if (msg.file.type == "application/img") {
this.fileService.downloadFile(msg.file.guid).subscribe(async (event) => {
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
@@ -28,12 +28,12 @@
<div *ngSwitchCase="'MDGPR'" class="height-100">
<div *ngIf="eventaprovacaostore.listmd.length != 0">
<div *ngIf="eventsMDGPRList.length != 0">
<ion-list class="width-100" >
<div
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
*ngFor="let event of eventaprovacaostore.listmd"
*ngFor="let event of eventsMDGPRList"
(click)="goToEventDetail(event)"
>
<!-- (click)="openApproveModal(event)" -->
@@ -52,7 +52,7 @@
</ion-list>
</div>
<div *ngIf="eventaprovacaostore.listmd.length == 0" class="centered-div">
<div *ngIf="eventsMDGPRList.length == 0" class="centered-div">
<div *ngSwitchCase="'MDGPR'" >
<div class="d-flex height-90 align-center justify-content-center"
>
@@ -62,12 +62,12 @@
</div>
</div>
<div *ngSwitchCase="'PR'">
<div *ngIf="eventaprovacaostore.listpr.length != 0">
<div *ngIf="eventsPRList.length != 0">
<ion-list class="width-100" *ngSwitchCase="'PR'">
<div class="width-100" *ngIf="eventaprovacaostore.listpr">
<div class="width-100" *ngIf="eventsPRList">
<div
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
*ngFor="let event of eventaprovacaostore.listpr"
*ngFor="let event of eventsPRList"
(click)="goToEventDetail(event)"
>
<div class="item event-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
@@ -87,10 +87,10 @@
</div>
<div *ngIf="eventaprovacaostore.listpr.length == 0" class="centered-div d-flex height-90 align-center justify-content-center">
<div *ngIf="eventsPRList.length == 0" class="centered-div d-flex height-90 align-center justify-content-center">
<div *ngSwitchCase="'PR'" >
<div class="d-flex align-center justify-content-center"
*ngIf="eventaprovacaostore.listpr.length < 1">
*ngIf="eventsPRList.length < 1">
Lista vazia
</div>
</div>
@@ -8,6 +8,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
import { SortService } from 'src/app/services/functions/sort.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-events-to-approve',
@@ -33,6 +34,7 @@ export class EventsToApprovePage implements OnInit {
private router: Router,
private userAuth: AuthService,
private sortService: SortService,
private storage: Storage
)
{
this.loggeduser = userAuth.ValidatedUser;
@@ -63,25 +65,46 @@ export class EventsToApprovePage implements OnInit {
async LoadToApproveEvents() {
this.showLoader = true;
console.log(this.segment);
this.getFromDB();
if(this.segment == 'MDGPR'){
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
this.eventsMDGPRList = mdEventsOficial.concat(mdEventsPessoal);
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList)
console.log(this.sortService.sortArrayByDate(this.eventsMDGPRList));
this.eventaprovacaostore.resetmd(this.sortService.sortDate(this.eventsMDGPRList, 'CreateDate'));
this.storage.set('event-to-aproveMD',this.eventsMDGPRList).then(() => {
console.log(' EVENTMD TO APROVE SAVED')
})
//this.eventaprovacaostore.resetmd(this.sortService.sortDate(this.eventsMDGPRList, 'CreateDate'));
}
else if(this.segment == 'PR'){
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR', false).toPromise();
let prEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal PR', false).toPromise();
this.eventsPRList = prEventsOficial.concat(prEventsPessoal);
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList)
this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate'));
this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => {
console.log(' EVENTPR TO APROVE SAVED')
})
//this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate'));
}
this.showLoader = false;
}
getFromDB() {
this.storage.get('event-to-aproveMD').then((events) => {
this.eventsMDGPRList = events
})
this.storage.get('event-to-aprovePR').then((events) => {
this.eventsPRList = events
})
}
toDateString(e) {
return new Date(e).toDateString()
}
@@ -22,10 +22,10 @@
<div class="content width-100 overflow-y-auto height-100" >
<div >
<ion-list *ngIf="expedientegbstore.list.length >=0">
<ion-list *ngIf="taskslist.length >=0">
<div
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
*ngFor = "let task of expedientegbstore.list"
*ngFor = "let task of taskslist"
(click)="goToExpediente(task.SerialNumber)"
>
<div class="item width-100">
@@ -58,13 +58,13 @@
</div>
<div
*ngIf="!skeletonLoader && expedientegbstore.list.length == 0 && expedientegbstore.list.length == 0"
*ngIf="!skeletonLoader && taskslist.length == 0 && taskslist.length == 0"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
</div>
<div *ngIf="skeletonLoader && expedientegbstore.list.length == 0">
<div *ngIf="skeletonLoader && taskslist.length == 0">
<ion-list>
<ion-item>
@@ -6,6 +6,7 @@ import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { ThemeService } from 'src/app/services/theme.service'
import { SortService } from 'src/app/services/functions/sort.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-expedients',
@@ -13,27 +14,28 @@ import { SortService } from 'src/app/services/functions/sort.service';
styleUrls: ['./expedients.page.scss'],
})
export class ExpedientsPage implements OnInit {
segment:string;
segment: string;
taskslist = [];
serialNumber:string;
serialNumber: string;
@Input() profile:string;
@Input() profile: string;
skeletonLoader = true
expedientegbstore = ExpedienteGdStore
expedienteTaskPipe = new ExpedienteTaskPipe()
constructor(
private processes:ProcessesService,
private processes: ProcessesService,
private alertService: AlertService,
private router: Router,
public ThemeService: ThemeService,
private sortService: SortService,
) {
this.profile = 'mdgpr';
private storage: Storage
) {
this.profile = 'mdgpr';
}
}
ngOnInit() {
//Inicializar segment
@@ -43,11 +45,11 @@ export class ExpedientsPage implements OnInit {
this.router.events.forEach((event) => {
if (event instanceof NavigationStart &&
event.url.startsWith('/home/gabinete-digital?expedientes=true')) {
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.doRefresh()
} else {
this.LoadList()
}
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
this.doRefresh()
} else {
this.LoadList()
}
}
});
@@ -75,21 +77,35 @@ export class ExpedientsPage implements OnInit {
this.taskslist.push(task);
});
this.taskslist = this.sortService.sortDate(this.taskslist, 'CreateDate')
this.addProcessTODb(this.taskslist);
this.expedientegbstore.reset(this.taskslist);
}, (error) => {
this.getEventsFromLocalDb();
});
}
doRefresh() {
setTimeout(()=>{
this.LoadList();
}, 1000)
addProcessTODb(task) {
this.storage.set('gabinete-expediente', task).then(() => {
console.log('GABINETE EXPEDIENTE SAVED')
})
}
goToExpediente(serialNumber:any){
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
getEventsFromLocalDb() {
this.storage.get('gabinete-expediente').then((expediente) => {
this.taskslist = expediente
})
}
}
doRefresh() {
setTimeout(() => {
this.LoadList();
}, 1000)
}
goToExpediente(serialNumber: any) {
this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
}
}
@@ -20,7 +20,7 @@
</ion-refresher>
<app-task-list
[taskList] = pendentesstore.list
[taskList] = listToPresent
[skeletonLoader] = skeletonLoader
(viewTaskDetail)="viewTaskDetails($event)"
> </app-task-list>
@@ -8,6 +8,7 @@ import { PendentesStore } from 'src/app/store/pendestes-store.service';
import { LoginUserRespose } from 'src/app/models/user.model';
import { CustomTaskPipe } from 'src/app/pipes/custom-task.pipe';
import { SortService } from 'src/app/services/functions/sort.service';
import { Storage } from '@ionic/storage';
@Component({
selector: 'app-pendentes',
@@ -20,6 +21,7 @@ export class PendentesPage implements OnInit {
pendentesstore = PendentesStore;
customTaskPipe = new CustomTaskPipe()
loggeduser: LoginUserRespose;
listToPresent = [];
@Input() profile:string;
segment:string;
@@ -30,6 +32,7 @@ export class PendentesPage implements OnInit {
private authService: AuthService,
private router: Router,
private sortService: SortService,
private storage: Storage
) {
this.loggeduser = authService.ValidatedUser;
}
@@ -52,7 +55,7 @@ export class PendentesPage implements OnInit {
async LoadList(){
this.skeletonLoader = true;
this.processes.GetPendingTasks(false).subscribe(async res => {
let pendentes = await this.processes.GetPendingTasks(false).toPromise();
let pendentesList = [];
@@ -64,9 +67,24 @@ export class PendentesPage implements OnInit {
pendentesList = removeDuplicate( pendentesList)
pendentesList = this.sortService.sortDate(pendentesList, 'CreateDate')
this.listToPresent = pendentesList
this.pendentesstore.reset(pendentesList);
this.storage.set('pendente-list',pendentesList).then(() => {
console.log('Pendente list SAVED')
})
this.skeletonLoader = false;
}
}, (error) => {
if(error.status == 0){
this.getFromDb();
}
})
}
getFromDb() {
this.storage.get('pendente-list').then((pendentes) => {
this.listToPresent =pendentes
})
}
doRefresh() {
setTimeout(()=>{
@@ -8,7 +8,7 @@
<div class="buttons">
<button (click)="takePicture()" full class="btn-ok" shape="round" >Tirar Fotografia</button>
<button hidden (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button>
<button hidden (click)="anexarFoto()" full class="btn-ok" shape="round" >Anexar Fotografia</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>
<button (click)="bookMeeting()" class="btn-ok" shape="round" >Novo Evento</button>
+3 -1
View File
@@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { IonicImageLoaderModule } from 'ionic-image-loader-v5';
// import { HeaderPage } from './header/header.page';
// import { HeaderPrPage } from './header-pr/header-pr.page';
// import { BtnSeguintePage } from './btn-seguinte/btn-seguinte.page';
@@ -17,7 +18,8 @@ import { IonicModule } from '@ionic/angular';
imports: [
CommonModule,
FormsModule,
IonicModule
IonicModule,
IonicImageLoaderModule
],
exports: [
// HeaderPage,