Merge branch 'develop' into bugfix/chat-create-event

This commit is contained in:
Peter Maquiran
2022-08-03 14:30:13 +01:00
39 changed files with 337 additions and 244 deletions
+2 -1
View File
@@ -45,7 +45,8 @@
</ion-buttons> </ion-buttons>
</div> </div>
<div class="line"></div> <div class="line"></div>
<ion-label (click)="asyncNotification()">{{notificationdata.length}} novas notificações</ion-label> <ion-label (click)="asyncNotification()" *ngIf="notificationdata">{{notificationdata.length}} novas notificações</ion-label>
<ion-label (click)="asyncNotification()" *ngIf="!notificationdata">0 novas notificações</ion-label>
</div> </div>
</ion-header> </ion-header>
+17 -13
View File
@@ -14,28 +14,32 @@
</div> </div>
</ion-header> </ion-header>
<ion-content fullscreen> <ion-content fullscreen>
<div class="media d-flex align-items-center justify-center"> <div *ngIf="view" class="media d-flex align-items-center justify-center">
<div class="media-content w-100 d-flex align-items-center justify-center"> <div class="media-content w-100 d-flex align-items-center justify-center">
<ion-slides style="width: 100%; height: 100%;" [options]="sliderOpts"> <ion-slides style="width: 100%; height: 100%;" [options]="sliderOpts">
<ion-slide> <ion-slide>
<div class="swiper-zoom-container"> <div class="swiper-zoom-container" >
<div> <div style="overflow: scroll; width: 100%; height:100%;">
<img src="{{image}}"> <img src="{{image}}">
</div> </div>
<!-- <div *ngIf="type == 'application/pdf'"> </div>
<iframe width="100%" height="100%" [src]="base64Sanitize" type="application/vnd.openxmlformats-officedocument.wordprocessingml.document"></iframe> -->
<div *ngIf="!view" class="swiper-zoom-container" >
<!-- <pdf-viewer [src]="image" <img src="{{image}}">
[render-text]="true"
[original-size]="false"
style="width: 400px; height: 500px"
></pdf-viewer> -->
<!-- </div> -->
</div> </div>
</ion-slide> </ion-slide>
</ion-slides> </ion-slides>
</div> </div>
</div> </div>
</ion-content> <ion-slides *ngIf="!view" style="width: 100%; height: 100%;" [options]="sliderOpts">
<ion-slide>
<div class="swiper-zoom-container" >
<img src="{{image}}">
</div>
</ion-slide>
</ion-slides>
</ion-content>
+10 -7
View File
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular'; import { ModalController, NavParams, Platform } from '@ionic/angular';
import { DomSanitizer} from '@angular/platform-browser'; import { DomSanitizer} from '@angular/platform-browser';
import { pdfDefaultOptions } from 'ngx-extended-pdf-viewer'; import { pdfDefaultOptions } from 'ngx-extended-pdf-viewer';
@@ -14,10 +14,10 @@ export class ViewMediaPage implements OnInit {
type: any; type: any;
name: string name: string
_updatedAt: string _updatedAt: string
view: boolean
sliderOpts = { sliderOpts = {
zoom: true, zoom: true
maxRation: 2
}; };
base64Sanitize:any = ""; base64Sanitize:any = "";
@@ -26,6 +26,7 @@ export class ViewMediaPage implements OnInit {
private modalController: ModalController, private modalController: ModalController,
private navParams:NavParams, private navParams:NavParams,
public sanitizer: DomSanitizer, public sanitizer: DomSanitizer,
private platform: Platform,
) { ) {
this.image = this.navParams.get('image') this.image = this.navParams.get('image')
@@ -38,6 +39,12 @@ export class ViewMediaPage implements OnInit {
ngOnInit() { ngOnInit() {
this.base64Sanitize = this.sanitizer.bypassSecurityTrustResourceUrl(this.image); this.base64Sanitize = this.sanitizer.bypassSecurityTrustResourceUrl(this.image);
if (this.platform.is('desktop')) {
this.view = true;
} else {
this.view = false;
}
} }
@@ -60,10 +67,6 @@ export class ViewMediaPage implements OnInit {
const blob = new Blob(byteArrays, { type: contentType }); const blob = new Blob(byteArrays, { type: contentType });
return blob; return blob;
}; };
close(){ close(){
this.modalController.dismiss() this.modalController.dismiss()
@@ -117,9 +117,9 @@
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom "> <div class="ion-input-class flex-grow-1 justify-center align-center material-inputs materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<mat-form-field class="date-hour-picker"> <mat-form-field appearance="none" class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="picker1" <input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date" placeholder="Data Inicio*"
[(ngModel)]="postEvent.StartDate" [(ngModel)]="postEvent.StartDate"
[disabled]="disabled" [disabled]="disabled"
[min]="currentDate" [min]="currentDate"
@@ -149,9 +149,9 @@
--> -->
<div (click)="openFim()" class="ion-input-class flex-grow-1 justify-center align-center materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom "> <div (click)="openFim()" class="ion-input-class flex-grow-1 justify-center align-center materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<mat-form-field class="date-hour-picker"> <mat-form-field appearance="none" class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="fim" <input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date" placeholder="Data de fim*"
[(ngModel)]="postEvent.EndDate" [(ngModel)]="postEvent.EndDate"
[disabled]="disabled" [disabled]="disabled"
[min]="currentDate" [min]="currentDate"
@@ -104,21 +104,6 @@ export class NewEventPage implements OnInit {
this.selectedDate = this.navParams.get('eventSelectedDate'); this.selectedDate = this.navParams.get('eventSelectedDate');
this.taskParticipants = this.navParams.get('attendees'); this.taskParticipants = this.navParams.get('attendees');
let now = new Date();
if(now.getMinutes() <= 30){
this.autoStartTime = new Date(now.setMinutes(30));
this.postEvent.StartDate = this.autoStartTime;
this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000);
this.postEvent.EndDate = this.autoEndTime;
}
else{
this.autoStartTime = new Date(now.setHours(now.getHours()+1));
this.autoStartTime = new Date(this.autoStartTime.setMinutes(0));
this.postEvent.StartDate = this.autoStartTime;
this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000);
this.postEvent.EndDate = this.autoEndTime;
}
} }
ngOnInit() { ngOnInit() {
+3 -1
View File
@@ -37,6 +37,7 @@
</ion-segment-button> </ion-segment-button>
</ion-segment> </ion-segment>
</ion-toolbar> </ion-toolbar>
<div class=" aside overflow-y-auto d-flex flex-wrap flex-grow-1"> <div class=" aside overflow-y-auto d-flex flex-wrap flex-grow-1">
<div class="width-100" [ngSwitch]="segment"> <div class="width-100" [ngSwitch]="segment">
<ion-list *ngSwitchCase="'Contactos'"> <ion-list *ngSwitchCase="'Contactos'">
@@ -133,12 +134,13 @@
<div *ngIf="group.lastMessage" class="item-description d-flex align-items-center" [class.item-description-active]="group.id ==idSelected"> <div *ngIf="group.lastMessage" class="item-description d-flex align-items-center" [class.item-description-active]="group.id ==idSelected">
<div class="item-message" *ngIf="group.otherUserType == false">{{group.lastMessage.u.name}}: {{group.lastMessage.msg}} </div> <div class="item-message" *ngIf="group.otherUserType == false">{{group.lastMessage.u.name}}: {{group.lastMessage.msg}} </div>
<div *ngIf="group.otherUserType == true">{{group.userThatIsTyping}} está escrever ...</div> <div *ngIf="group.otherUserType == true">{{group.userThatIsTyping}} está escrever ...</div>
<div class="item-files add-ellipsis" *ngIf="group.lastMessage.file"> <div class="item-files add-ellipsis" *ngIf="group.lastMessage.file">
<fa-icon *ngIf="group.lastMessage.file.type != 'application/meeting' && group.lastMessage.file.type != 'application/audio'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon> <fa-icon *ngIf="group.lastMessage.file.type != 'application/meeting' && group.lastMessage.file.type != 'application/audio'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon>
<fa-icon *ngIf="group.lastMessage.file.type == 'application/audio'" icon="file-audio" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon> <fa-icon *ngIf="group.lastMessage.file.type == 'application/audio'" icon="file-audio" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon>
<span *ngIf="group.lastMessage.file.type == 'application/audio'" class="item-files-title"> audio </span> <span *ngIf="group.lastMessage.file.type == 'application/audio'" class="item-files-title"> audio </span>
<fa-icon *ngIf="group.lastMessage.file.type == 'application/meeting'" icon="calendar-alt" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon> <fa-icon *ngIf="group.lastMessage.file.type == 'application/meeting'" icon="calendar-alt" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon>
<span *ngIf="group.lastMessage.file.type != 'application/audio'" class="item-files-title"> {{ group.lastMessage.attachments[0].title }}</span> <span *ngIf="group.lastMessage.file.type != 'application/audio' && group.lastMessage.attachments" class="item-files-title"> {{ group.lastMessage.attachments[0].title }}</span>
</div> </div>
<div class="item-files" *ngIf="group.attachments"> <div class="item-files" *ngIf="group.attachments">
<div *ngIf="group.value.lastMessage.attachments[0].image_url"> <div *ngIf="group.value.lastMessage.attachments[0].image_url">
+8 -4
View File
@@ -125,6 +125,8 @@ export class ChatPage implements OnInit {
this.showLoader = true; this.showLoader = true;
this.segment = 'Contactos'
} }
ngOnInit() { ngOnInit() {
@@ -320,7 +322,6 @@ export class ChatPage implements OnInit {
async setIntervenient(data) { async setIntervenient(data) {
this.taskParticipants = removeDuplicate(data) this.taskParticipants = removeDuplicate(data)
} }
async setIntervenientCC(data) { async setIntervenientCC(data) {
@@ -339,12 +340,11 @@ export class ChatPage implements OnInit {
} }
onSegmentChange() { onSegmentChange() {
//this.load(); this.wsChatMethodsService.getAllRooms();
} }
doRefresh(event) { doRefresh(event) {
setTimeout(() => { setTimeout(() => {
//this.load();
event.target.complete(); event.target.complete();
}, 1000); }, 1000);
} }
@@ -357,7 +357,6 @@ export class ChatPage implements OnInit {
}); });
} }
getDirectMessagesDB() { getDirectMessagesDB() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
this.storageservice.get("rooms").then((rooms) =>{ this.storageservice.get("rooms").then((rooms) =>{
@@ -560,6 +559,11 @@ export class ChatPage implements OnInit {
} }
roomDataFileType(roomData) {
return roomData?.lastMessage?.file?.type || null
}
async transformGroups(data) { async transformGroups(data) {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) { if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
let groupsArray = []; let groupsArray = [];
@@ -150,7 +150,6 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}) })
//this.loadFiles();
} }
setStatus(status: string) { setStatus(status: string) {
@@ -104,7 +104,6 @@ export class ContactsPage implements OnInit {
this.room = res['room']; this.room = res['room'];
await this.WsChatMethodsService.getAllRooms(); await this.WsChatMethodsService.getAllRooms();
this.getDirectMessage(this.room._id); this.getDirectMessage(this.room._id);
}); });
@@ -139,26 +138,10 @@ export class ContactsPage implements OnInit {
} }
async openMessages(username:string){ async openMessages(username:string){
/* this.close(); */
let dm:any; let dm:any;
//Create new room this.createRoom(username);
this.createRoom(username);
//Get direct messages (dm)
/* this.getDirectMessage(this.room._id); */
/* const modal = await this.modalController.create({
component: MessagesPage,
cssClass: 'group-messages',
backdropDismiss: false,
componentProps: {
dm: dm,
},
});
await modal.present();
modal.onDidDismiss(); */
} }
} }
+9 -2
View File
@@ -40,6 +40,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { File } from '@awesome-cordova-plugins/file/ngx'; import { File } from '@awesome-cordova-plugins/file/ngx';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx'; import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { Filesystem, Directory } from '@capacitor/filesystem';
const IMAGE_DIR = 'stored-images'; const IMAGE_DIR = 'stored-images';
@@ -125,7 +126,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private sqlservice: SqliteService, private sqlservice: SqliteService,
public wsChatMethodsService: WsChatMethodsService, public wsChatMethodsService: WsChatMethodsService,
private AttachmentsService: AttachmentsService, private AttachmentsService: AttachmentsService,
private CameraService: CameraService, private CameraService: CameraService,
private processesService: ProcessesService, private processesService: ProcessesService,
private storage: Storage, private storage: Storage,
@@ -149,7 +149,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
} }
this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({}) this.wsChatMethodsService.getDmRoom(this.roomId).loadHistory({})
this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
this.wsChatMethodsService.openRoom(this.roomId) this.wsChatMethodsService.openRoom(this.roomId)
@@ -162,6 +161,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
} }
ngOnInit() { ngOnInit() {
this.createDirectoryImage()
this.wsChatMethodsService.getAllRooms(); this.wsChatMethodsService.getAllRooms();
this.chatService.refreshtoken(); this.chatService.refreshtoken();
this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => { this.wsChatMethodsService.getUserOfRoom(this.roomId).then((value) => {
@@ -1075,6 +1075,13 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
// }); // });
// } // }
async createDirectoryImage() {
await Filesystem.mkdir({
path: IMAGE_DIR,
directory: Directory.Data,
recursive: true
});
}
} }
@@ -184,11 +184,14 @@ export class DiplomasGerarPage implements OnInit {
async sendExpedienteToPending() { async sendExpedienteToPending() {
const loader = this.toastService.loading()
this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res => { this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res => {
this.goBack(); this.goBack();
this.toastService.successMessage() this.toastService.successMessage()
loader.remove()
}, },
error => { error => {
loader.remove()
this.toastService.badRequest("Processo não enviado para despacho") this.toastService.badRequest("Processo não enviado para despacho")
}); });
@@ -324,12 +324,15 @@ export class ExpedienteDetailPage implements OnInit {
} }
sendExpedienteToPending() { sendExpedienteToPending() {
const loader = this.toastService.loading()
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => { this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
this.toastService._successMessage('Processo enviado para pendentes') this.toastService._successMessage('Processo enviado para pendentes')
this.goBack(); this.goBack();
loader.remove()
}, },
(error) => { (error) => {
loader.remove()
this.toastService._badRequest('Processo não enviado para pendentes') this.toastService._badRequest('Processo não enviado para pendentes')
}); });
} }
@@ -133,12 +133,15 @@ export class ExpedientePrPage implements OnInit {
} }
sendExpedienteToPending() { sendExpedienteToPending() {
const loader = this.toastService.loading()
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
this.toastService._successMessage('Processo enviado para pendentes') this.toastService._successMessage('Processo enviado para pendentes')
this.goBack(); this.goBack();
loader.remove()
}, },
(error)=>{ (error)=>{
loader.remove()
this.toastService._badRequest('Processo não enviado para pendentes') this.toastService._badRequest('Processo não enviado para pendentes')
}); });
} }
+13 -1
View File
@@ -13,7 +13,11 @@ import { ThemeService } from 'src/app/services/theme.service';
import { StorageService } from 'src/app/services/storage.service'; import { StorageService } from 'src/app/services/storage.service';
import { PermissionService } from 'src/app/services/permission.service'; import { PermissionService } from 'src/app/services/permission.service';
import { PermissionList } from 'src/app/models/permission/permissionList'; import { PermissionList } from 'src/app/models/permission/permissionList';
import { MessageModel, DeleteMessageModel } from '../../models/beast-orm' import { MessageModel, DeleteMessageModel } from '../../models/beast-orm';
import { WsChatService } from 'src/app/services/chat/ws-chat.service';
import { Storage } from '@ionic/storage';
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service';
import { ChatService } from 'src/app/services/chat.service';
@Component({ @Component({
selector: 'app-login', selector: 'app-login',
templateUrl: './login.page.html', templateUrl: './login.page.html',
@@ -46,6 +50,10 @@ export class LoginPage implements OnInit {
public ThemeService: ThemeService, public ThemeService: ThemeService,
private storageservice: StorageService, private storageservice: StorageService,
public p: PermissionService, public p: PermissionService,
private WsChatService: WsChatService,
private storage: Storage,
public WsChatMethodsService: WsChatMethodsService,
private ChatService: ChatService
) {} ) {}
ngOnInit() { ngOnInit() {
@@ -124,6 +132,7 @@ export class LoginPage implements OnInit {
await this.authService.loginChat(attempt.ChatData.data); await this.authService.loginChat(attempt.ChatData.data);
await this.authService.loginToChatWs(); await this.authService.loginToChatWs();
this.ChatService.setheader()
} }
@@ -134,7 +143,9 @@ export class LoginPage implements OnInit {
} else { } else {
this.WsChatService.logout();
this.clearStoreService.clear(); this.clearStoreService.clear();
this.WsChatMethodsService.clearChat();
SessionStore.delete(); SessionStore.delete();
window.localStorage.clear(); window.localStorage.clear();
await MessageModel.deleteAll() await MessageModel.deleteAll()
@@ -148,6 +159,7 @@ export class LoginPage implements OnInit {
if(attempt.ChatData) { if(attempt.ChatData) {
await this.authService.loginChat(attempt.ChatData.data); await this.authService.loginChat(attempt.ChatData.data);
await this.authService.loginToChatWs(); await this.authService.loginToChatWs();
this.ChatService.setheader()
} }
this.getToken(); this.getToken();
@@ -31,7 +31,7 @@
<ion-datetime <ion-datetime
[(ngModel)]="folder.DateBegin" [(ngModel)]="folder.DateBegin"
class="d-block d-md-none" class="d-block d-md-none"
placeholder="Início" placeholder="Data início*"
displayFormat="D MMM YYYY H:mm" displayFormat="D MMM YYYY H:mm"
minuteValues="0,5,10,15,20,25,30,35,40,45,50,55" minuteValues="0,5,10,15,20,25,30,35,40,45,50,55"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
@@ -41,7 +41,7 @@
<mat-form-field appearance="none" class="date-hour-picker d-none d-md-block"> <mat-form-field appearance="none" class="date-hour-picker d-none d-md-block">
<input matInput [ngxMatDatetimePicker]="picker1" <input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date" placeholder="Data inicio*"
[formControl]="dateControlStart" [formControl]="dateControlStart"
[min]="minDate" [min]="minDate"
[disabled]="disabled" [disabled]="disabled"
@@ -70,7 +70,7 @@
<ion-datetime <ion-datetime
class="d-block d-md-none" class="d-block d-md-none"
[(ngModel)]="folder.DateEnd" [(ngModel)]="folder.DateEnd"
placeholder="Fim" placeholder="Data de fim*"
displayFormat="D MMM YYYY H:mm" displayFormat="D MMM YYYY H:mm"
minuteValues="0,5,10,15,20,25,30,35,40,45,50,55" minuteValues="0,5,10,15,20,25,30,35,40,45,50,55"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
@@ -78,9 +78,9 @@
max="2025"> max="2025">
</ion-datetime> </ion-datetime>
<mat-form-field class="date-hour-picker d-none d-md-block"> <mat-form-field appearance="none" class="date-hour-picker d-none d-md-block">
<input matInput [ngxMatDatetimePicker]="fim" <input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date" placeholder="Data de fim*"
[formControl]="dateControlEnd" [formControl]="dateControlEnd"
[min]="endMinDate" [min]="endMinDate"
[disabled]="disabled" [disabled]="disabled"
@@ -75,14 +75,14 @@ export class NewActionPage implements OnInit {
this.dateControlStart = new FormControl(moment(new Date())); this.dateControlStart = new FormControl(moment(new Date()));
this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000))); this.dateControlEnd = new FormControl(moment(new Date(new Date().getTime() + 15 * 60000)));
this.folder.DateBegin = new Date().toISOString() // this.folder.DateBegin = new Date().toISOString()
this.folder.DateEnd = (new Date(new Date().getTime() + 15 * 60000)).toISOString() // this.folder.DateEnd = (new Date(new Date().getTime() + 15 * 60000)).toISOString()
} }
ngOnInit() { ngOnInit() {
this.segment = "Evento"; this.segment = "Evento";
this.setDefaultTime() // this.setDefaultTime()
} }
setDefaultTime() { setDefaultTime() {
+8 -2
View File
@@ -20,7 +20,7 @@ import { RoomService } from './chat/room.service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { InitialsService } from './functions/initials.service'; import { InitialsService } from './functions/initials.service';
import { PermissionService } from './permission.service'; import { PermissionService } from './permission.service';
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
@@ -48,7 +48,8 @@ export class AuthService {
private AttachmentsService: AttachmentsService, private AttachmentsService: AttachmentsService,
private storage: Storage, private storage: Storage,
private initialsService: InitialsService, private initialsService: InitialsService,
public p: PermissionService, ) { public p: PermissionService,
public WsChatMethodsService: WsChatMethodsService, ) {
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
@@ -201,6 +202,11 @@ export class AuthService {
this.WsChatService.setStatus('online') this.WsChatService.setStatus('online')
setTimeout(() => {
this.WsChatMethodsService.getAllRooms();
}, 200);
// alert('wsLogin') // alert('wsLogin')
}).catch((message) => { }).catch((message) => {
+31 -25
View File
@@ -1,14 +1,13 @@
import { HttpHeaders, HttpParams } from '@angular/common/http'; import { HttpHeaders, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { AuthService } from './auth.service';
import { HttpService } from './http.service'; import { HttpService } from './http.service';
import { StorageService } from './storage.service'; import { StorageService } from './storage.service';
import { HttpClient, HttpHeaderResponse } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { PermissionService } from './permission.service'; import { PermissionService } from './permission.service';
import { SessionStore } from '../store/session.service'; import { SessionStore } from '../store/session.service';
import { ChangeProfileService } from 'src/app/services/change-profile.service';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
@@ -24,19 +23,21 @@ export class ChatService {
constructor( constructor(
private http: HttpClient, private http: HttpClient,
private httpService: HttpService, private httpService: HttpService,
private authService: AuthService,
private storage: Storage, private storage: Storage,
private storageService: StorageService, private storageService: StorageService,
public p: PermissionService) { public p: PermissionService,
private changeProfileService: ChangeProfileService,) {
this.setheader() this.changeProfileService.registerCallback(() => {
this.setheader();
})
} }
getDocumentDetails(url: string) { getDocumentDetails(url: string) {
let headersc = new HttpHeaders(); let headersc = new HttpHeaders();
headersc = headersc.set('X-User-Id', this.loggedUserChat['data'].userId); headersc = headersc.set('X-User-Id', SessionStore.user.ChatData.data.userId);
headersc = headersc.set('X-Auth-Token', this.loggedUserChat['data'].authToken); headersc = headersc.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken);
headersc = headersc.set('Sec-Fetch-Dest', 'attachment'); headersc = headersc.set('Sec-Fetch-Dest', 'attachment');
headersc = headersc.set('Sec-Fetch-Mode', 'navigate'); headersc = headersc.set('Sec-Fetch-Mode', 'navigate');
headersc = headersc.set('Cookie', 'rc_uid=fsMwcNdufWvdnChj7'); headersc = headersc.set('Cookie', 'rc_uid=fsMwcNdufWvdnChj7');
@@ -342,7 +343,6 @@ export class ChatService {
setheader() { setheader() {
try { try {
if (this.p.userPermission(this.p.permissionList.Chat.access)) { if (this.p.userPermission(this.p.permissionList.Chat.access)) {
this.loggedUserChat = this.authService.ValidatedUserChat;
this.headers = new HttpHeaders(); this.headers = new HttpHeaders();
if (this.p.userPermission(this.p.permissionList.Chat.access)) { if (this.p.userPermission(this.p.permissionList.Chat.access)) {
@@ -360,24 +360,30 @@ export class ChatService {
} }
refreshtoken() { refreshtoken() {
this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
let options = { if(this.headers) {
headers: this.headers this.headers = this.headers.set('Authorization', SessionStore.user.BasicAuthKey);
}; let options = {
return this.http.get(environment.apiURL + 'UserAuthentication/RegenereChatToken', options).subscribe(async res => { headers: this.headers
let data = { };
status: res['status'], return this.http.get(environment.apiURL + 'UserAuthentication/RegenereChatToken', options).subscribe(async res => {
data: { let data = {
userId: res['data'].userId, status: res['status'],
authToken: res['data'].authToken data: {
userId: res['data'].userId,
authToken: res['data'].authToken
}
} }
} SessionStore.user.ChatData = data
SessionStore.user.ChatData = data SessionStore.save()
SessionStore.save() this.setheader()
// console.log(res)
// console.log(SessionStore.user.ChatData)
});
} else {
this.setheader() this.setheader()
// console.log(res) }
// console.log(SessionStore.user.ChatData)
});
} }
} }
+2 -2
View File
@@ -77,7 +77,7 @@ export class MessageService {
this.ts = ts this.ts = ts
this.u = u || { name: this.usernameToDisplayName(SessionStore.user.UserName), username: SessionStore.user.UserName, _id: ""} this.u = u || { name: this.usernameToDisplayName(SessionStore.user.UserName), username: SessionStore.user.UserName, _id: ""}
this.t = t this.t = t
this._id = _id this._id = _id || ""
this._updatedAt = _updatedAt || new Date().getTime() this._updatedAt = _updatedAt || new Date().getTime()
this.file = file this.file = file
this.temporaryData = temporaryData this.temporaryData = temporaryData
@@ -310,7 +310,7 @@ export class MessageService {
async addMessageDB() { async addMessageDB() {
if(!this.addToDb) { if(!this.addToDb) {
this.addToDb= true this.addToDb = true
const message = this.getChatObj() const message = this.getChatObj()
delete message.id delete message.id
+77 -26
View File
@@ -39,6 +39,7 @@ export class RoomService {
name = '' name = ''
_updatedAt = {} _updatedAt = {}
hasLoadHistory = false hasLoadHistory = false
hasLoadHistoryMessageRF = []
restoreFromOffline = false restoreFromOffline = false
duration = '' duration = ''
isTyping = false isTyping = false
@@ -179,7 +180,7 @@ export class RoomService {
if(difference < 0) { if(difference < 0) {
this.deleteRoom() this.deleteRoom();
} else { } else {
setTimeout(() => { setTimeout(() => {
@@ -236,18 +237,20 @@ export class RoomService {
let IncomingChatMessageArgs = IncomingChatMessage.fields.args[0] let IncomingChatMessageArgs = IncomingChatMessage.fields.args[0]
let ChatMessage : ChatMessageInterface = this.fix_updatedAt(IncomingChatMessageArgs) let ChatMessage : ChatMessageInterface = this.fix_updatedAt(IncomingChatMessageArgs)
if(!this.messagesLocalReference.includes(ChatMessage.localReference)) { const allMessageIds = this.messages.map((e)=> e._id);
if(!this.messagesLocalReference.includes(ChatMessage.localReference) && !allMessageIds.includes(ChatMessage?._id)) {
this.messagesLocalReference.push(ChatMessage.localReference); this.messagesLocalReference.push(ChatMessage.localReference);
const message = await this.prepareCreate({message: ChatMessage, save: true}) const message = await this.prepareCreate({message: ChatMessage, save: true});
message.messageSend = true message.messageSend = true
this.lastMessage = message this.lastMessage = message;
this.calDateDuration(ChatMessage._updatedAt) this.calDateDuration(ChatMessage._updatedAt);
if (message.t == 'r') { if (message.t == 'r') {
this.name = message.msg this.name = message.msg;
} }
if(this.isSenderIsNotMe(ChatMessage)) { if(this.isSenderIsNotMe(ChatMessage)) {
@@ -312,19 +315,17 @@ export class RoomService {
this.otherUserType = args[1] this.otherUserType = args[1]
this.readAllMessage() this.readAllMessage()
//
// alert(JSON.stringify(args))
} else if(args[0]?.method == 'viewMessage' || args[1]?.method == 'viewMessage') { } else if(args[0]?.method == 'viewMessage' || args[1]?.method == 'viewMessage') {
this.readAllMessage() this.readAllMessage()
} else if(args[0]?.method == 'deleteMessage' || args[1]?.method == 'deleteMessage') { } else if(args[0]?.method == 'deleteMessage' || args[1]?.method == 'deleteMessage') {
// alert('delete')
//
this.deleteMessage(args[1]?.method?._id) this.deleteMessage(args[1]?.method?._id)
} else { } else {
// alert('miss')
} }
@@ -468,7 +469,7 @@ export class RoomService {
deleteAll() { deleteAll() {
this.messages.forEach((message)=>{ this.messages.forEach((message) => {
if(message?._id) { if(message?._id) {
this.sendDeleteRequest(message._id) this.sendDeleteRequest(message._id)
} }
@@ -477,7 +478,7 @@ export class RoomService {
async delateMessageToSendToOthers(userId) { async delateMessageToSendToOthers(userId) {
const deleteMessage = await DeleteMessageModel.all() const deleteMessage = await DeleteMessageModel.all();
const toSend = deleteMessage.filter((DeleteMessage:string[])=> ! DeleteMessage.includes(userId)) const toSend = deleteMessage.filter((DeleteMessage:string[])=> ! DeleteMessage.includes(userId))
@@ -493,8 +494,8 @@ export class RoomService {
this.WsChatService.deleteMessage(msgId).then(async() => { this.WsChatService.deleteMessage(msgId).then(async() => {
message.delateRequest = true message.delateRequest = true
await message.save() await message.save();
this.deleteMessage(msgId) this.deleteMessage(msgId);
}) })
} else { } else {
@@ -516,7 +517,7 @@ export class RoomService {
*/ */
async send({file = null, attachments = null, temporaryData = {}}) { async send({file = null, attachments = null, temporaryData = {}}) {
const localReference = uuidv4() const localReference = uuidv4();
let offlineChatMessage = { let offlineChatMessage = {
rid: this.id, rid: this.id,
@@ -529,9 +530,9 @@ export class RoomService {
this.message= '' this.message= ''
this.messagesLocalReference.push(localReference)
const message: MessageService = await this.prepareCreate({message:offlineChatMessage, save: environment.chatOffline}) const message: MessageService = await this.prepareCreate({message:offlineChatMessage, save: environment.chatOffline})
this.messagesLocalReference.push(localReference)
await message.addMessageDB() await message.addMessageDB()
message.send() message.send()
@@ -547,7 +548,9 @@ export class RoomService {
this.sortRoomList() this.sortRoomList()
} }
if(this.hasLoadHistory == false) {
this.hasLoadHistoryMessageRF.push(localReference)
}
} }
@@ -679,17 +682,17 @@ export class RoomService {
} }
await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => { await this.WsChatService.loadHistory(this.id, limit).then( async (chatHistory:chatHistory) => {
// console.log('load history', chatHistory)
// //
const messagesId = this.messages.map((message)=> message._id) const messagesId = this.messages.map((message)=> message._id)
chatHistory.result.messages.reverse().forEach(async(message: any) => { await chatHistory.result.messages.reverse().forEach(async(message: any) => {
if (!messagesId.includes(message._id)) { if (!messagesId.includes(message._id)) {
const messagesToSave = await this.prepareMessageCreateIfNotExist_iD({message: message}); const messagesToSave = await this.prepareMessageCreateIfNotExist_iD({message: message});
if(messagesToSave) { if(messagesToSave) {
await messagesToSave.addMessageDB() messagesToSave.addMessageDB()
} }
} }
@@ -703,6 +706,28 @@ export class RoomService {
}, 50) }, 50)
this.hasLoadHistory = true this.hasLoadHistory = true
this.messageReorder();
}
async messageReorder() {
const reorderMessage: MessageService[] = this.messages.filter((message) =>
this.hasLoadHistoryMessageRF.includes(message?.localReference)
);
await this.messages.forEach( async (message, i) => {
if(this.hasLoadHistoryMessageRF.includes(message?.localReference)) {
this.messages.splice(i, 1)
}
})
this.hasLoadHistoryMessageRF = [];
reorderMessage.forEach((message) => {
this.messages.push(message)
});
} }
@@ -714,10 +739,10 @@ export class RoomService {
await this.messages.forEach( async (message, index) => { await this.messages.forEach( async (message, index) => {
if(message._id) { if(message._id) {
if(message.viewed.length == 0) { if(message.viewed.length == 0) {
this.messages[index].viewed = membersIds this.messages[index].viewed = membersIds;
this.messages[index].received = membersIds this.messages[index].received = membersIds;
await this.messages[index].save() await this.messages[index].save()
} }
@@ -797,7 +822,33 @@ export class RoomService {
wewMessage.setData(message) wewMessage.setData(message)
wewMessage.loadHistory = this.hasLoadHistory wewMessage.loadHistory = this.hasLoadHistory
this.messages.push(wewMessage)
let found;
if(wewMessage.localReference != null) {
found = this.messages.find((MessageService, index) => {
if ( MessageService.localReference == wewMessage.localReference ) {
return true
} else {
return false
}
})
} else {
found = this.messages.find((MessageService, index) => {
if ( MessageService._id == wewMessage._id) {
return true
} else {
return false
}
})
}
if (!found) {
this.messages.push(wewMessage)
return wewMessage
}
return wewMessage return wewMessage
} }
@@ -840,7 +891,7 @@ export class RoomService {
message = this.fix_updatedAt(message) message = this.fix_updatedAt(message)
const found = this.messages.find((MessageService, index) => { const found = this.messages.find((MessageService, index) => {
if (MessageService._id == message._id ) { if (MessageService._id == message._id) {
return true return true
} else { } else {
return false return false
@@ -14,7 +14,6 @@ import { SortService } from '../functions/sort.service';
import { chatUser } from 'src/app/models/chatMethod'; import { chatUser } from 'src/app/models/chatMethod';
import { NfService } from 'src/app/services/chat/nf.service' import { NfService } from 'src/app/services/chat/nf.service'
import { ChangeProfileService } from '../change-profile.service'; import { ChangeProfileService } from '../change-profile.service';
import { AuthService } from '../auth.service';
import { ChatStorageService } from './chat-storage.service'; import { ChatStorageService } from './chat-storage.service';
import { ChatMethodsService } from './chat-methods.service'; import { ChatMethodsService } from './chat-methods.service';
import { AESEncrypt } from '../aesencrypt.service' import { AESEncrypt } from '../aesencrypt.service'
@@ -41,7 +40,7 @@ export class WsChatMethodsService {
users: chatUser[] = [] users: chatUser[] = []
sessionStore = SessionStore sessionStore = SessionStore
loggedUser: any;
delete = [] delete = []
@@ -56,7 +55,6 @@ export class WsChatMethodsService {
private NfService: NfService, private NfService: NfService,
private changeProfileService: ChangeProfileService, private changeProfileService: ChangeProfileService,
private chatService: ChatService, private chatService: ChatService,
private authService: AuthService,
private ChatStorageService: ChatStorageService, private ChatStorageService: ChatStorageService,
private ChatMethodsService:ChatMethodsService, private ChatMethodsService:ChatMethodsService,
private AESEncrypt: AESEncrypt, private AESEncrypt: AESEncrypt,
@@ -64,7 +62,7 @@ export class WsChatMethodsService {
private NetworkServiceService: NetworkServiceService, private NetworkServiceService: NetworkServiceService,
) { ) {
this.loggedUser = authService.ValidatedUserChat['data'];
this.loadChat() this.loadChat()
@@ -93,13 +91,6 @@ export class WsChatMethodsService {
}) })
// on change profile remove a rooms
this.changeProfileService.registerCallback(() => {
this.clearChat()
this.ReLoadChat()
this.storage.remove('Rooms');
})
} }
private loadChat() { private loadChat() {
@@ -173,8 +164,10 @@ export class WsChatMethodsService {
async getAllRooms () { async getAllRooms () {
this.loadingWholeList = true this.loadingWholeList = true
const rooms = await this.WsChatService.getRooms(); const rooms = await this.WsChatService.getRooms();
try {
await this.storage.remove('Rooms');
} catch(e) {}
await this.storage.remove('Rooms');
await rooms.result.update.forEach( async (roomData: room, index) => { await rooms.result.update.forEach( async (roomData: room, index) => {
const roomId = this.getRoomId(roomData); const roomId = this.getRoomId(roomData);
+12 -2
View File
@@ -78,7 +78,6 @@ export class WsChatService {
// //
if(message.result) { if(message.result) {
if(message.result.token) { if(message.result.token) {
this.isLogin = true this.isLogin = true
this.loginResponse = message this.loginResponse = message
@@ -106,6 +105,7 @@ export class WsChatService {
getRooms(roomOlder = 1480377601) { getRooms(roomOlder = 1480377601) {
//const requestId = uuidv4() //const requestId = uuidv4()
const requestId = uuidv4() const requestId = uuidv4()
const message = { const message = {
@@ -121,7 +121,6 @@ export class WsChatService {
this.ws.registerCallback({type:'Onmessage', funx:(message)=>{ this.ws.registerCallback({type:'Onmessage', funx:(message)=>{
if(message.id == requestId) { // same request send if(message.id == requestId) { // same request send
resolve(message) resolve(message)
//
return true return true
} }
}}) }})
@@ -186,6 +185,7 @@ export class WsChatService {
logout() { logout() {
this.isLogin = false this.isLogin = false
this.ws.connected = false this.ws.connected = false
this.ws.disconnect()
} }
// send message to room // send message to room
@@ -749,6 +749,7 @@ export class WsChatService {
const data = JSON.parse(event.data) const data = JSON.parse(event.data)
// //
// console.log(data)
for (const [key, value] of Object.entries(this.wsCallbacks)) { for (const [key, value] of Object.entries(this.wsCallbacks)) {
if(value.type== 'Onmessage') { if(value.type== 'Onmessage') {
@@ -777,6 +778,15 @@ export class WsChatService {
onerror: (event: any) => { onerror: (event: any) => {
},
disconnect:() => {
if(this.socket) {
this.socket.onopen = (event: any) => {}
this.socket.onmessage = (event: any) => {}
this.socket.onclose = (event: any) => {}
this.socket.onerror = (event: any) => {}
this.socket.close()
}
} }
}} }}
@@ -123,9 +123,9 @@
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom "> <div class="ion-input-class flex-grow-1 justify-center align-center material-inputs materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<mat-form-field class="date-hour-picker"> <mat-form-field appearance="none" class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="picker1" <input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date" placeholder="Data Inicio*"
[(ngModel)]="postEvent.StartDate" [(ngModel)]="postEvent.StartDate"
[disabled]="disabled" [disabled]="disabled"
[min]="currentDate" [min]="currentDate"
@@ -155,9 +155,9 @@
--> -->
<div (click)="openFim()" class="ion-input-class flex-grow-1 justify-center align-center materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom "> <div (click)="openFim()" class="ion-input-class flex-grow-1 justify-center align-center materia-top" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<mat-form-field class="date-hour-picker"> <mat-form-field appearance="none" class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="fim" <input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date" placeholder="Data de fim*"
[(ngModel)]="postEvent.EndDate" [(ngModel)]="postEvent.EndDate"
[disabled]="disabled" [disabled]="disabled"
[min]="currentDate" [min]="currentDate"
@@ -133,22 +133,6 @@ export class NewEventPage implements OnInit {
this.loggeduser = userService.ValidatedUser; this.loggeduser = userService.ValidatedUser;
this.postEvent = new Event(); this.postEvent = new Event();
let now = new Date();
if(now.getMinutes() <= 30) {
this.autoStartTime = new Date(now.setMinutes(30));
this.postEvent.StartDate = this.autoStartTime;
this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000);
this.postEvent.EndDate = this.autoEndTime;
}
else {
this.autoStartTime = new Date(now.setHours(now.getHours()+1));
this.autoStartTime = new Date(this.autoStartTime.setMinutes(0));
this.postEvent.StartDate = this.autoStartTime;
this.autoEndTime = new Date(this.autoStartTime.getTime() + 30 * 60000);
this.postEvent.EndDate = this.autoEndTime;
}
} }
ngOnInit() { ngOnInit() {
+7 -19
View File
@@ -27,13 +27,11 @@ import { DocumentViewer, DocumentViewerOptions } from '@ionic-native/document-vi
import { VoiceRecorder, RecordingData, GenericResponse } from 'capacitor-voice-recorder'; import { VoiceRecorder, RecordingData, GenericResponse } from 'capacitor-voice-recorder';
import { Filesystem, Directory } from '@capacitor/filesystem'; import { Filesystem, Directory } from '@capacitor/filesystem';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { AlertController, Platform } from '@ionic/angular'; import { Platform } from '@ionic/angular';
import { File } from '@awesome-cordova-plugins/file/ngx'; import { File } from '@awesome-cordova-plugins/file/ngx';
import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx'; import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorResponse } from '@angular/common/http';
import { Howl } from 'howler'; import { Howl } from 'howler';
import { runInThisContext } from 'vm';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
@@ -49,8 +47,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
@ViewChild('scrollMe') private myScrollContainer: ElementRef; @ViewChild('scrollMe') private myScrollContainer: ElementRef;
@ViewChild('message-item') messageContainer: ElementRef; @ViewChild('message-item') messageContainer: ElementRef;
loggedUser: any;
messages: any; messages: any;
dm: any; dm: any;
userPresence = ''; userPresence = '';
@@ -126,7 +122,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private platform: Platform, private platform: Platform,
private fileOpener: FileOpener, private fileOpener: FileOpener,
) { ) {
this.loggedUser = authService.ValidatedUserChat['data'];
this.checkAudioPermission() this.checkAudioPermission()
} }
@@ -448,15 +443,15 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
} }
else { else {
var str = msg.attachments[0].image_url; // var str = msg.attachments[0].image_url;
str = str.substring(1, ((str.length) - 1)); // str = str.substring(1, ((str.length) - 1));
const encodedData = btoa(str); // const encodedData = btoa(str);
let file = this.base64toBlob(encodedData, 'application/pdf') // let file = this.base64toBlob(encodedData, 'application/pdf')
let fileURL = URL.createObjectURL(file) // let fileURL = URL.createObjectURL(file)
window.open(fileURL); // window.open(fileURL);
} }
} }
@@ -1028,7 +1023,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') { if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
this.downloadFileMsg(msg) this.downloadFileMsg(msg)
//this.testDownlod(msg)
} else { } else {
var str = msg.attachments[0].image_url; var str = msg.attachments[0].image_url;
@@ -1075,12 +1069,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
} }
testEditMessage(msg: MessageService) {
// msg.receptorReceive()
// alert('cool!')
}
start(track) { start(track) {
if(this.audioPlay){ if(this.audioPlay){
this.audioPlay.stop(); this.audioPlay.stop();
+60 -34
View File
@@ -59,7 +59,6 @@ export class NewGroupPage implements OnInit{
} }
}); });
} }
@@ -76,9 +75,8 @@ export class NewGroupPage implements OnInit{
} }
} }
close(){ close() {
//this.modalController.dismiss();
this.addGroupMessage.emit(); this.addGroupMessage.emit();
} }
@@ -91,6 +89,9 @@ export class NewGroupPage implements OnInit{
let customFields = {} let customFields = {}
let res:any; let res:any;
const loader = this.toastService.loading();
if(this.thedate) { if(this.thedate) {
let customFields = { let customFields = {
"countDownDate":this.thedate "countDownDate":this.thedate
@@ -102,6 +103,8 @@ export class NewGroupPage implements OnInit{
} }
loader.remove();
// FsId // FsId
// DocId // DocId
@@ -109,36 +112,17 @@ export class NewGroupPage implements OnInit{
this.addGroupMessage.emit(res.result.rid); this.addGroupMessage.emit(res.result.rid);
await this.wsChatMethodsService.getAllRooms(); await this.wsChatMethodsService.getAllRooms();
setTimeout(()=> { if(!this.wsChatMethodsService.getGroupRoom(res.result.rid)) {
this.documents.forEach(element => { this.createGroupWithAttachmentsCath(res)
this.wsChatMethodsService.getGroupRoom(res.result.rid).send({ } else {
file: { setTimeout(()=> {
"name": element.Assunto,
"type": "application/webtrix", this.createGroupWithAttachments(res)
"ApplicationId": element.ApplicationId,
"DocId": element.DocId, }, 500)
"Assunto": element.Assunto, }
},
temporaryData: {
data: {
selected: {
Id: element.DocId,
ApplicationType: element.ApplicationId
}
}
},
attachments: [{
"title": element.Assunto,
"description": element.Assunto,
"title_link_download": true,
"type": "webtrix",
"text": element.Assunto,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
})
});
}, 500)
} else { } else {
@@ -148,6 +132,48 @@ export class NewGroupPage implements OnInit{
} }
createGroupWithAttachmentsCath(res: any) {
if(!this.wsChatMethodsService.getGroupRoom(res.result.rid)) {
setTimeout(()=>{
this.createGroupWithAttachmentsCath(res)
}, 1500)
} else {
this.createGroupWithAttachments(res)
}
}
createGroupWithAttachments(res: any) {
this.wsChatMethodsService.getGroupRoom(res.result.rid).hasLoadHistory = true;
this.documents.forEach(element => {
this.wsChatMethodsService.getGroupRoom(res.result.rid).send({
file: {
"name": element.Assunto,
"type": "application/webtrix",
"ApplicationId": element.ApplicationId,
"DocId": element.DocId,
"Assunto": element.Assunto,
},
temporaryData: {
data: {
selected: {
Id: element.DocId,
ApplicationType: element.ApplicationId
}
}
},
attachments: [{
"title": element.Assunto,
"description": element.Assunto,
"title_link_download": true,
"type": "webtrix",
"text": element.Assunto,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
})
});
}
async addContacts(){ async addContacts(){
this.close(); this.close();
@@ -278,6 +278,12 @@ export class EditEventToApproveComponent implements OnInit {
} }
}) })
this.startDate = new Date(this.startDate);
this.startDate.setHours(this.startDate.getHours() + 1);
this.endDate = new Date(this.endDate);
this.endDate.setHours(this.endDate.getHours() + 1);
const event: EventToApproveEdit = { const event: EventToApproveEdit = {
SerialNumber: this.eventProcess.serialNumber, SerialNumber: this.eventProcess.serialNumber,
Body: this.eventProcess.workflowInstanceDataFields.Body, Body: this.eventProcess.workflowInstanceDataFields.Body,
@@ -304,9 +310,9 @@ export class EditEventToApproveComponent implements OnInit {
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{ this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
this.toastService.successMessage('Evento editado'); this.toastService._successMessage('Evento editado');
}, error =>{ }, error =>{
this.toastService.badRequest('Evento não editado'); this.toastService._badRequest('Evento não editado');
}) })
@@ -314,16 +320,16 @@ export class EditEventToApproveComponent implements OnInit {
if(document['action'] == 'add') { if(document['action'] == 'add') {
delete document.action delete document.action
this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{ this.attachmentsService.setEventAttachmentById(document).subscribe(()=>{
this.toastService.successMessage(); this.toastService._successMessage();
}, error =>{ }, error =>{
this.toastService.badRequest(); this.toastService._badRequest();
}); });
} else if(document['action'] == 'delete') { } else if(document['action'] == 'delete') {
delete document.action delete document.action
this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{ this.attachmentsService.deleteEventAttachmentById(document.Id).subscribe( res=>{
this.toastService.successMessage() this.toastService._successMessage()
}, error =>{ }, error =>{
this.toastService.badRequest() this.toastService._badRequest()
}) })
} }
@@ -2,7 +2,7 @@
<ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar> <ion-progress-bar type="indeterminate" *ngIf="skeletonLoader"></ion-progress-bar>
<div class="title"> <div class="title">
<div class="thetitle"><ion-label >Expediente</ion-label></div> <div class="thetitle"><ion-label >Expediente</ion-label></div>
<div class="theicon"> <div class="theicon" (click)="refreshing()">
<button title="Atualizar" class="btn-no-color" (click)="refreshing()"> <button title="Atualizar" class="btn-no-color" (click)="refreshing()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon> <ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button> </button>
@@ -84,6 +84,7 @@ export class ExpedientesPrPage implements OnInit {
} }
refreshing() { refreshing() {
setTimeout(() => { setTimeout(() => {
this.LoadList(); this.LoadList();
}, 1000); }, 1000);
@@ -95,6 +95,7 @@ export class ExpedientsPage implements OnInit {
} }
doRefresh() { doRefresh() {
setTimeout(() => { setTimeout(() => {
this.LoadList(); this.LoadList();
}, 1000) }, 1000)
@@ -72,14 +72,16 @@ export class DespachosOptionsPage implements OnInit {
}); });
} }
sendExpedienteToPending(){ sendExpedienteToPending() {
const loader = this.toastService.loading()
this.popoverController.dismiss(); this.popoverController.dismiss();
this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{ this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{
this.toastService._successMessage() this.toastService._successMessage()
loader.remove()
this.close(); this.close();
},()=>{ },()=>{
loader.remove()
this.toastService._badRequest('Processo não encontrado') this.toastService._badRequest('Processo não encontrado')
}); });
} }
@@ -98,11 +98,14 @@ export class DespachosPrOptionsPage implements OnInit {
} }
sendExpedienteToPending() { sendExpedienteToPending() {
const loader = this.toastService.loading()
this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{
this.toastService._successMessage() this.toastService._successMessage()
this.popoverController.dismiss('close') this.popoverController.dismiss('close')
loader.remove()
},()=>{ },()=>{
loader.remove()
this.toastService._badRequest('Processo não encontrado') this.toastService._badRequest('Processo não encontrado')
}); });
@@ -107,12 +107,14 @@ export class DiplomasGerarOptionsPage implements OnInit {
} }
async sendExpedienteToPending() { async sendExpedienteToPending() {
const loader = this.toastService.loading()
this.despachoService.sendExpedienteToPending(this.serialNumber).subscribe(res => { this.despachoService.sendExpedienteToPending(this.serialNumber).subscribe(res => {
this.goBack(); this.goBack();
this.toastService.successMessage() this.toastService.successMessage()
loader.remove()
}, },
error => { error => {
loader.remove()
this.toastService.badRequest("Processo não enviado para despacho") this.toastService.badRequest("Processo não enviado para despacho")
}); });
@@ -252,12 +252,14 @@ export class OptsExpedientePrPage implements OnInit {
sendExpedienteToPending(){ sendExpedienteToPending(){
this.popoverController.dismiss(); this.popoverController.dismiss();
const loader = this.toastService.loading()
this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{ this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{
loader.remove()
this.close(); this.close();
},()=>{ },()=>{
this.toastService._badRequest('Processo não encontrado') this.toastService._badRequest('Processo não encontrado')
loader.remove()
}); });
} }
@@ -81,11 +81,14 @@ export class RequestOptionsPage implements OnInit {
} }
sendExpedienteToPending() { sendExpedienteToPending() {
const loader = this.toastService.loading()
this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{ this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{
this.toastService._successMessage() this.toastService._successMessage()
this.close(); this.close();
loader.remove()
},()=>{ },()=>{
loader.remove()
this.toastService._badRequest('Processo não encontrado') this.toastService._badRequest('Processo não encontrado')
}); });
@@ -30,7 +30,7 @@
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div> </div>
<div class="ion-input-class flex-grow-1"> <div class="ion-input-class flex-grow-1">
<ion-datetime <!-- <ion-datetime
class="d-block d-md-none" class="d-block d-md-none"
[(ngModel)]="folder.DateBegin" [(ngModel)]="folder.DateBegin"
placeholder="Início" placeholder="Início"
@@ -38,12 +38,12 @@
minuteValues="0,5,10,15,20,25,30,35,40,45,50,55" minuteValues="0,5,10,15,20,25,30,35,40,45,50,55"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
max="2025"> max="2025">
</ion-datetime> </ion-datetime> -->
<mat-form-field appearance="none" class="width-100 date-hour-picker d-md-block"> <mat-form-field appearance="none" class="width-100 date-hour-picker d-md-block">
<input matInput [ngxMatDatetimePicker]="picker1" <input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date*" placeholder="Data inicio*"
[(ngModel)]="folder.DateBegin" [(ngModel)]="folder.DateBegin"
[disabled]="disabled" [disabled]="disabled"
[min]="currentDate" [min]="currentDate"
@@ -68,7 +68,7 @@
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div> </div>
<div class="ion-input-class d-flex flex-grow-1"> <div class="ion-input-class d-flex flex-grow-1">
<ion-datetime <!-- <ion-datetime
class="flex-grow-1 d-md-none" class="flex-grow-1 d-md-none"
[(ngModel)]="folder.DateEnd" [(ngModel)]="folder.DateEnd"
placeholder="Fim" placeholder="Fim"
@@ -76,16 +76,16 @@
minuteValues="0,5,10,15,20,25,30,35,40,45,50,55" minuteValues="0,5,10,15,20,25,30,35,40,45,50,55"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
max="2025"> max="2025">
</ion-datetime> </ion-datetime> -->
<mat-form-field appearance="none" class="width-100 date-hour-picker d-md-block"> <mat-form-field appearance="none" class="width-100 date-hour-picker d-md-block">
<input matInput [ngxMatDatetimePicker]="picker2" <input matInput [ngxMatDatetimePicker]="picker2"
placeholder="Choose a date*" placeholder="Data de fim*"
[(ngModel)]="folder.DateEnd" [(ngModel)]="folder.DateEnd"
[disabled]="disabled" [disabled]="disabled"
[min]="currentDate" [min]="currentDate"
> >
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker2"></mat-datepicker-toggle> <mat-datepicker-toggle id="new-fim" matSuffix [for]="picker2"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker2 <ngx-mat-datetime-picker #picker2
[showSpinners]="showSpinners" [showSpinners]="showSpinners"
[showSeconds]="showSeconds" [showSeconds]="showSeconds"
@@ -45,10 +45,10 @@ export class NewActionPage implements OnInit {
this.folder = new PublicationFolder(); this.folder = new PublicationFolder();
this.folder = Object.assign(this.folder, { /* this.folder = Object.assign(this.folder, {
DateBegin: new Date().toISOString(), DateBegin: new Date().toISOString(),
DateEnd: (new Date(new Date().getTime() + 15 * 60000)).toISOString(), DateEnd: (new Date(new Date().getTime() + 15 * 60000)).toISOString(),
}) }) */
} }
+2 -2
View File
@@ -3,8 +3,8 @@ export const environment = {
//apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', //apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/', apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
//apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', //apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
//apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', //apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
//apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', //apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',
apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/', apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket', apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
/* apiChatUrl: 'https://www.tabularium.pt/api/v1/', /* apiChatUrl: 'https://www.tabularium.pt/api/v1/',
+4 -4
View File
@@ -22,10 +22,10 @@
export const environment = { export const environment = {
production: false, production: false,
//apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/', //apiURL: 'https://gabinetedigital.dyndns.info/GabineteDigital.Services/V5/api/',
//apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/', apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V5/api/',
apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/', //apiURL: 'https://gdapi-dev.dyndns.info/GabineteDigital.Services/V5/api/',
//apiChatUrl: 'https://gabinetedigitalchat.dyndns.info/api/v1/', // apiChatUrl: 'http://192.168.0.29:3000/api/v1/',
//apiWsChatUrl: 'wss://gabinetedigitalchat.dyndns.info/websocket', // apiWsChatUrl: 'wss://192.168.0.29:3000/websocket',
apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/', apiChatUrl: 'https://gdchat-dev.dyndns.info/api/v1/',
apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket', apiWsChatUrl: 'wss://gdchat-dev.dyndns.info/websocket',
/* apiChatUrl: 'https://www.tabularium.pt/api/v1/', /* apiChatUrl: 'https://www.tabularium.pt/api/v1/',