Merge with developer branch

This commit is contained in:
Eudes Inácio
2021-12-17 10:48:36 +01:00
71 changed files with 864 additions and 417 deletions
@@ -44,7 +44,7 @@
<ion-label>A conversa original mantêm-se como chat individual</ion-label>
</div>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of messages; let last = last" (click)="openPreview(msg)">
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of messages; let last = last">
<div class="message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45" *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru'" >
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
@@ -60,7 +60,9 @@
<ion-label>{{msg.msg}}</ion-label>
<div *ngIf="msg.attachments" class="message-attachments">
<div *ngFor="let file of msg.attachments">
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image">
<div (click)="openPreview(msg)">
<img *ngIf="file.image_url" src="{{file.image_url}}" alt="image">
</div>
<div>
<div>
<div class="file">
@@ -144,30 +146,31 @@
<ion-fab-button (click)="bookMeeting()" color="light">
<ion-icon name="calendar"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="addFile()" color="light">
<!-- <ion-fab-button (click)="addFile()" color="light">
<ion-icon name="document"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="addImage()" color="light">
</ion-fab-button> -->
<!-- <ion-fab-button (click)="addImage()" color="light">
<ion-icon name="image"></ion-icon>
</ion-fab-button>
<ion-fab-button class="hide-desktop" (click)="takePicture()" color="light">
</ion-fab-button> -->
<!-- <ion-fab-button class="hide-desktop" (click)="takePicture()" color="light">
<ion-icon name="camera"></ion-icon>
</ion-fab-button>
</ion-fab-button> -->
<ion-fab-button (click)="addFileWebtrix()" color="light">
<ion-icon src="assets/icon/webtrix.svg"></ion-icon>
</ion-fab-button>
</ion-fab-list>
</ion-fab>
</div>
<div class="width-80">
<div class="width-100">
<ion-item class="ion-no-padding type-message" lines="none">
<ion-textarea clearOnEdit="true" placeholder="Escrever uma mensagem" class="message-input" rows="1" [(ngModel)]="message"></ion-textarea>
<ion-textarea (keyup.enter)="sendMessage()" clearOnEdit="true" placeholder="Escrever uma mensagem" class="message-input" rows="1" [(ngModel)]="message"></ion-textarea>
<button hidden class="btn-no-color">
<ion-icon slot="end" src="assets/icon/icons-chat-mic.svg"></ion-icon>
</button>
</ion-item>
</div>
<div>
<div class="btn-send">
<button *ngIf="message" class="btn-no-color" (click)="sendMessage()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
@@ -1,7 +1,4 @@
@import '~src/function.scss';
div{
overflow: auto;
}
.header-toolbar{
--background:transparent;
--opacity: 1;
@@ -200,44 +197,49 @@
}
}
ion-footer{
padding-top: 7.5px;
padding-bottom: 7.5px;
.container{
justify-content: center;
justify-content: space-evenly;
align-items: center;
ion-footer{
padding-top: 7.5px;
padding-bottom: 7.5px;
}
.container{
justify-content: center;
justify-content: space-evenly;
align-items: center;
margin: 0 !important;
padding: 0 !important;
}
.chat-icon-options{
display:block !important;
font-size: 35px;
float: right !important;
margin-top: 5px;
}
.chat-icon-options{
display:block !important;
font-size: 35px;
float: right !important;
margin-top: 5px;
}
.chat-icon-send{
font-size: 45px;
margin: 0 auto;
margin-top: 4px;
}
.chat-icon-send{
font-size: 45px;
margin: 0 auto;
margin-top: 4px;
}
.type-message{
display: flex;
border: 1px solid #ebebeb;
border-radius: 25px;
padding-left: 15px;
align-items: center;
overflow: auto;
.type-message{
display: flex;
border: 1px solid #ebebeb;
border-radius: 25px;
padding-left: 15px;
margin: 0 15px 0 75px;
align-items: center;
overflow: auto;
ion-textarea{
margin: 0 !important;
align-self: center;
}
}
ion-textarea{
min-height: 50px;
margin: 0 !important;
align-self: center;
overflow: auto;
}
}
.btn-send{
padding-right: 20px !important;
overflow: hidden;
}
}
}
@@ -20,6 +20,7 @@ import { FileService } from 'src/app/services/functions/file.service';
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 * as pdfjsLib from 'pdfjs-dist';
@@ -769,7 +770,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
}
sliderOpts = {
zoom: false,
slidesPerView: 1.5,
@@ -778,7 +779,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
};
zoomActive = false;
zoomScale = 1;
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
@@ -786,44 +787,44 @@ sliderZoomOpts = {
maxRatio: 5
},
on: {
zoomChange: (scale, imageEl, slideEl) => {
zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale/5;
this.changeDetectorRef.detectChanges();
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;
}
async openPreview(img) {
const modal = await this.modalController.create({
component: PreviewCameraPage,
cssClass: 'transparent-modal',
componentProps: {
image: img.attachments[0].image_url,
username: img.u.username,
_updatedAt: img._updatedAt
}
});
modal.present();
}
async openPreview(msg) {
const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
username: msg.u.name,
_updatedAt: msg._updatedAt,
}
});
modal.present();
}
}
@@ -49,7 +49,7 @@ export class ContactsPage implements OnInit {
}
openMessagesPage(username:string){
if( window.innerWidth <= 1024){
if( window.innerWidth < 701){
this.createRoom(username);
}
else{
@@ -117,29 +117,19 @@ export class ContactsPage implements OnInit {
this.chatService.createRoom(body).subscribe(res => {
console.log(res);
this.room = res['room'];
this.getDirectMessage(this.room._id);
this.openMessagesModal(this.room._id);
});
}
getDirectMessage(roomId:any){
console.log(roomId);
this.chatService.getAllDirectMessages().subscribe(res=>{
let result = res['ims'].filter(data => data._id == roomId);
this.dm = result[0];
console.log(this.dm);
this.openModal(this.dm);
});
}
async openModal(dm:any){
this.close();
console.log(dm);
async openMessagesModal(roomId: any) {
console.log(roomId);
const modal = await this.modalController.create({
component: MessagesPage,
cssClass: 'group-messages',
backdropDismiss: false,
cssClass: 'modal modal-desktop isMessagesChatOpened',
componentProps: {
dm: dm,
roomId: roomId,
},
});
await modal.present();
@@ -121,25 +121,25 @@
<ion-fab-button (click)="bookMeeting()" color="light">
<ion-icon name="calendar"></ion-icon>
</ion-fab-button>
<ion-fab-button hidden (click)="addFile()" color="light">
<!-- <ion-fab-button hidden (click)="addFile()" color="light">
<ion-icon name="document"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="addImage()" color="light">
</ion-fab-button> -->
<!-- <ion-fab-button (click)="addImage()" color="light">
<ion-icon name="image"></ion-icon>
</ion-fab-button>
<ion-fab-button (click)="takePicture()" color="light">
</ion-fab-button> -->
<!-- <ion-fab-button (click)="takePicture()" color="light">
<ion-icon name="camera"></ion-icon>
</ion-fab-button>
</ion-fab-button> -->
<ion-fab-button (click)="addFileWebtrix()" color="light">
<ion-icon src="assets/icon/webtrix.svg"></ion-icon>
</ion-fab-button>
</ion-fab-list>
</ion-fab>
</div>
<div class="width-80">
<div class="width-100">
<ion-item class="ion-no-padding type-message" lines="none">
<ion-textarea clearOnEdit="true" placeholder="Escrever uma mensagem" class="message-input" rows="1" [(ngModel)]="message"></ion-textarea>
<ion-textarea (keyup.enter)="sendMessage()" clearOnEdit="true" placeholder="Escrever uma mensagem" class="message-input" rows="1" [(ngModel)]="message"></ion-textarea>
<button hidden class="btn-no-color" (click)="notImplemented()">
<ion-icon slot="end" src="assets/icon/icons-chat-mic.svg"></ion-icon>
</button>
@@ -179,10 +179,11 @@
ion-footer{
padding-top: 7.5px;
padding-bottom: 7.5px;
.container{
justify-content: center;
justify-content: space-evenly;
align-items: center;
}
.chat-icon-options{
@@ -203,14 +204,15 @@
border: 1px solid #ebebeb;
border-radius: 25px;
padding-left: 15px;
margin: 0 15px 0 60px;
align-items: center;
overflow: auto;
ion-textarea{
margin: 0 !important;
align-self: center;
ion-textarea{
margin: 0 !important;
align-self: center;
}
}
}
}
@@ -735,7 +735,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
username: msg.u.username,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
});
@@ -1,8 +1,10 @@
import { analyzeAndValidateNgModules } from '@angular/compiler';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { NavigationStart, Router } from '@angular/router';
import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular';
import { ChatService } from 'src/app/services/chat.service';
import { DataService } from 'src/app/services/data.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
@@ -22,6 +24,7 @@ export class NewGroupPage implements OnInit{
countDownTime:any;
//groupName:string;
task:any;
documents: any;
@Input() groupName:string;
@Output() addGroupMessage:EventEmitter<any> = new EventEmitter<any>();
@@ -32,31 +35,42 @@ export class NewGroupPage implements OnInit{
private modalController: ModalController,
private chatService: ChatService,
private dataService:DataService,
private processesService: ProcessesService,
private router: Router,
)
{
this.isGroupCreated = false;
//this.groupName = this.navParams.get('name');
}
ngOnInit() {
if(this.dataService.get("newGroup")){
this.task = this.dataService.get("task");
this.groupName = this.task.Folio;
}
console.log(this.task);
this.router.events.forEach((event) => {
if (event instanceof NavigationStart && event.url.startsWith('/home/chat')) {
if (this.dataService.get("newGroup")) {
this.task = this.dataService.get("task");
this.groupName = this.task.Folio;
this.documents = this.dataService.get("documents");
}
}
else{
this.dataService.set("newGroup", false);
}
});
console.log(this.task);
}
/* ngOnDestroy(){
alert('Destroy')
this.dataService.set("newGroup", false);
this.dataService.set("task", null);
this.dataService.set("newGroupName", '');
} */
_ionChange(event){
console.log(event);
console.log(event.detail.checked);
this.showDuration = event.detail.checked;
this.showDuration = event.detail.checked;
if(event.detail.checked){
this.thedate = new Date();
@@ -74,6 +88,8 @@ export class NewGroupPage implements OnInit{
createGroup(){
let name = this.groupName.split(' ').join('-');
//Take out all special characters in string
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
let body = { "name":name, }
this.chatService.addGroup(body).subscribe(res=>{
console.log('group created');
@@ -90,6 +106,43 @@ export class NewGroupPage implements OnInit{
console.log(res);
});
}
if(this.documents.length > 0){
//If there is documents add
this.documents.forEach(async document => {
let url = await this.processesService.GetDocumentUrl(document.DocId, document.ApplicationId).toPromise();
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
let body = {
"message":
{
"rid": res['group']._id,
"msg": "",
"attachments": [{
"title": document.Assunto,
"description": document.DocTypeDesc,
"title_link": url_no_options,
"title_link_download": true,
//"thumb_url": "assets/images/webtrix-logo.png",
"message_link": url_no_options,
"type": "webtrix"
}],
"file":{
"name": document.Assunto,
"type": "application/webtrix",
"ApplicationId": document.ApplicationType,
"DocId": document.Id,
"Assunto": document.Assunto,
}
}
}
this.chatService.sendMessage(body).toPromise();
});
}
});
}