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

This commit is contained in:
Eudes Inácio
2022-01-25 14:37:02 +01:00
16 changed files with 677 additions and 282 deletions
+4
View File
@@ -235,6 +235,9 @@ const routes = [
{ {
path: 'previewer', path: 'previewer',
loadChildren: () => import('./modals/previewer/previewer.module').then( m => m.PreviewerPageModule) loadChildren: () => import('./modals/previewer/previewer.module').then( m => m.PreviewerPageModule)
},
{
path: 'set-room-owner',
loadChildren: () => import('./modals/set-room-owner/set-room-owner.module').then( m => m.SetRoomOwnerPageModule) loadChildren: () => import('./modals/set-room-owner/set-room-owner.module').then( m => m.SetRoomOwnerPageModule)
} }
@@ -242,6 +245,7 @@ const routes = [
/* /*
path: 'chat', path: 'chat',
@@ -22,7 +22,7 @@
<!-- Add scrolls --> <!-- Add scrolls -->
<div class="d-flex flex-column height-100 overflow-y-auto"> <div class="d-flex flex-column height-100 overflow-y-auto">
<div class="container-div width-100">TT <div class="container-div width-100">
<div class="ion-item-class-2 width-100"> <div class="ion-item-class-2 width-100">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon class="icon-time" slot="start" name="time-outline"></ion-icon> <ion-icon class="icon-time" slot="start" name="time-outline"></ion-icon>
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SetRoomOwnerPage } from './set-room-owner.page';
const routes: Routes = [
{
path: '',
component: SetRoomOwnerPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class SetRoomOwnerPageRoutingModule {}
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { SetRoomOwnerPageRoutingModule } from './set-room-owner-routing.module';
import { SetRoomOwnerPage } from './set-room-owner.page';
import { PipesModule } from 'src/app/pipes/pipes.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PipesModule,
SetRoomOwnerPageRoutingModule
],
declarations: [SetRoomOwnerPage]
})
export class SetRoomOwnerPageModule {}
@@ -0,0 +1,44 @@
<ion-header class="ion-no-border">
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="title-content width-100">
<div class="back-icon">
<button class="btn-no-color cursor-pointer" (click)="close()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
</button>
</div>
<div class="div-title">
<ion-label class="title">Promover para Administrador</ion-label>
</div>
</div>
</div>
</ion-toolbar>
<ion-toolbar class="toolbar-search">
<div class="search">
<ion-searchbar debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div>
</ion-toolbar>
</ion-header>
<ion-content>
<div class="main-content">
<ion-virtual-scroll [items]="members | filter:textSearch: 'name'" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
</div>
<div *virtualItem="let user" class="item-checkbox">
<div class="cursor-pointer d-flex width-100" (click)="setRoomOwner(user)" (ionChange)="setRoomOwner(user)">
<p class="flex-1">{{user.name}}</p>
<ion-icon slot="end" class="{{user.status}}" name="ellipse"></ion-icon>
</div>
</div>
</ion-virtual-scroll>
</div>
</ion-content>
@@ -0,0 +1,164 @@
.header-toolbar{
--background:transparent;
--opacity: 1;
.main-header{
width: 100%; /* 400px */
height: 100%;
font-family: Roboto;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
background-color: #fff;
overflow:hidden;
padding: 30px 20px 0px 20px;
color:#000;
transform: translate3d(0, 1px, 0);
.div-icon{
width: 40px;
float: right;
font-size: 35px;
overflow: auto;
padding: 1px;
}
.div-icon ion-icon{
float: right;
padding-left: 20px;
}
.title-content{
margin: 0px auto;
overflow: auto;
padding: 0 !important;
}
.back-icon{
width: 37px;
float: left;
font-size: 35px;
overflow: auto;
}
.div-title{
width: calc(100% - 45px);
padding: 0!important;
float: left;
margin: 2.5px 0 0 5px;
}
.title{
font-size: 25px;
}
}
}
.toolbar-search{
--padding-top:0 !important;
--padding-bottom:0 !important;
--padding-start:0 !important;
--padding-end:0 !important;
.search{
border: 1px solid #ebebeb;
margin: 5px 20px 5px 20px;
border-radius: 5px;
}
.search ion-searchbar{
/* border: 1px solid green; */
width: 100%;
margin: 0 !important;
padding: 0 !important;
--border-radius: 5px;
--box-shadow: none;
overflow: auto;
--icon-color: var(--font-awesome);
}
}
ion-content{
--background:transparent;
}
.main-content{
width: 100%;
height: 100%;
font-family: Roboto;
margin: 0 auto;
background-color: #fff;
overflow:auto;
padding: 0 0 0 0;
.members-label{
margin: 10px 20px 10px 20px !important;
/* font-size: 15px; */
font-weight: bold;
}
.members-checkbox{
display: flex;
margin: 0px 20px 0px 20px !important;
overflow: auto;
align-items: center;
border-bottom: 1px solid #ebebeb;
}
.members-options{
margin: 0px 20px 0px 19px !important;
overflow: auto;
}
.item-divider{
background: #ebebeb;
font-size: 15px;
margin: 10px 0 10px 0;
padding:5px 0 5px 20px;
}
.item-checkbox{
display: flex;
margin: 10px 20px 10px 20px !important;
overflow: auto;
align-items: center;
overflow: auto;
}
.members-checkbox ion-checkbox{
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
.item-checkbox ion-checkbox{
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
.item-checkbox p, .members-checkbox p{
display: block;
margin: 0 !important;
padding-left: 10px;
font-size: 15px;
color: var(--title-text-color);
float: left;
}
.item-checkbox ion-icon, .members-checkbox ion-icon{
font-size: 10px;
float: left;
color:#99e47b;
margin-left: 10px;
}
.online{
color:#99e47b !important;
}
.offline{
color:#cbced1 !important;
}
.away{
color:#ffd21f !important;
}
.invisible{
color:#cbced1 !important;
}
.busy{
color:#f5455c !important;
}
}
@@ -0,0 +1,24 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { SetRoomOwnerPage } from './set-room-owner.page';
describe('SetRoomOwnerPage', () => {
let component: SetRoomOwnerPage;
let fixture: ComponentFixture<SetRoomOwnerPage>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ SetRoomOwnerPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(SetRoomOwnerPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,80 @@
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
import { ThemeService } from 'src/app/services/theme.service'
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-set-room-owner',
templateUrl: './set-room-owner.page.html',
styleUrls: ['./set-room-owner.page.scss'],
})
export class SetRoomOwnerPage implements OnInit {
textSearch:string = "";
room:any;
members:any;
constructor(
private modalController: ModalController,
private http: HttpClient,
private chatService: ChatService,
private authService: AuthService,
private navParams: NavParams,
public ThemeService: ThemeService,
private toastService: ToastService,
) {
this.room = this.navParams.get('room');
this.members = this.navParams.get('members');
}
ngOnInit() {
console.log(this.room);
}
async close(){
this.modalController.dismiss();
}
onChange(event){
this.textSearch = event.detail.value;
}
separateLetter(record, recordIndex, records){
if(recordIndex == 0){
return record.name[0];
}
let first_prev = records[recordIndex - 1].name[0];
let first_current = record.name[0];
if(first_prev != first_current){
return first_current;
}
return null;
}
setRoomOwner(user:any){
console.log(user);
console.log(this.room);
let body = {
"roomId": this.room._id,
"userId": user._id
}
this.chatService.addGroupOwner(body).subscribe((res)=>{
console.log(res);
this.close();
}, (error) => {
this.toastService._badRequest('Não foi possível completar a ação, por favor tente novamente.');
});
}
}
@@ -323,7 +323,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
sendMessage() { sendMessage() {
this.wsChatMethodsService.getDmRoom(this.roomId).send(this.message) this.wsChatMethodsService.getGroupRoom(this.roomId).send(this.message)
this.message = ""; this.message = "";
} }
+8
View File
@@ -273,6 +273,14 @@ export class ChatService {
return this.http.post(environment.apiChatUrl+'channels.kick', body, opts); return this.http.post(environment.apiChatUrl+'channels.kick', body, opts);
} }
addChannelOwner(body:any){
return this.http.post(environment.apiChatUrl+'channels.addOwner', body, this.options);
}
addGroupOwner(body:any){
return this.http.post(environment.apiChatUrl+'groups.addOwner', body, this.options);
}
deleteGroup(body:any){ deleteGroup(body:any){
return this.http.post(environment.apiChatUrl+'groups.delete', body, this.options); return this.http.post(environment.apiChatUrl+'groups.delete', body, this.options);
} }
-2
View File
@@ -277,8 +277,6 @@ export class WsChatService {
streamNotifyLogged() { streamNotifyLogged() {
alert('HERE')
const requestId = uuidv4() const requestId = uuidv4()
const message = { const message = {
@@ -159,7 +159,6 @@
<div> <div>
<div (click)="openPreview(msg)"> <div (click)="openPreview(msg)">
<!-- <img *ngIf="file.image_url" src="{{file.image_url}}" alt="image" (click)="imageSize(file.image_url)"> --> <!-- <img *ngIf="file.image_url" src="{{file.image_url}}" alt="image" (click)="imageSize(file.image_url)"> -->
TTTT
<img *ngIf="msg.file.image_url" src="{{msg.file.image_url}}" alt="image"> <img *ngIf="msg.file.image_url" src="{{msg.file.image_url}}" alt="image">
</div> </div>
</div> </div>
@@ -243,16 +242,16 @@
<ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light"> <ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light">
<ion-icon name="calendar"></ion-icon> <ion-icon name="calendar"></ion-icon>
</ion-fab-button> </ion-fab-button>
<ion-fab-button (click)="addFile()" color="light"> <ion-fab-button title="Adicionar Documento" (click)="addFile()" color="light">
<ion-icon name="document"></ion-icon> <ion-icon name="document"></ion-icon>
</ion-fab-button> </ion-fab-button>
<ion-fab-button (click)="addImage()" color="light"> <ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
<ion-icon name="image"></ion-icon> <ion-icon name="image"></ion-icon>
</ion-fab-button> </ion-fab-button>
<ion-fab-button class="hide-desktop" (click)="takePicture()" color="light"> <ion-fab-button title="Tirar Fotografia" class="hide-desktop" (click)="takePicture()" color="light">
<ion-icon name="camera"></ion-icon> <ion-icon name="camera"></ion-icon>
</ion-fab-button> </ion-fab-button>
<ion-fab-button (click)="addFileWebtrix()" color="light"> <ion-fab-button title="Documento da Gestão Documental" (click)="addFileWebtrix()" color="light">
<ion-icon src="assets/icon/webtrix.svg"></ion-icon> <ion-icon src="assets/icon/webtrix.svg"></ion-icon>
</ion-fab-button> </ion-fab-button>
</ion-fab-list> </ion-fab-list>
@@ -314,7 +314,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} }
sendMessage() { sendMessage() {
this.wsChatMethodsService.getDmRoom(this.roomId).send(this.message) this.wsChatMethodsService.getGroupRoom(this.roomId).send(this.message)
this.message = ""; this.message = "";
} }
@@ -371,6 +371,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
cssClass: 'model profile-modal search-submodal', cssClass: 'model profile-modal search-submodal',
componentProps: { componentProps: {
roomId: this.roomId, roomId: this.roomId,
members: this.members,
} }
}); });
await modal.present(); await modal.present();
@@ -187,16 +187,16 @@
<ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light"> <ion-fab-button title="Nova Reunião" (click)="bookMeeting()" color="light">
<ion-icon name="calendar"></ion-icon> <ion-icon name="calendar"></ion-icon>
</ion-fab-button> </ion-fab-button>
<ion-fab-button hidden (click)="addFile()" color="light"> <ion-fab-button title="Adicionar Documento" hidden (click)="addFile()" color="light">
<ion-icon name="document"></ion-icon> <ion-icon name="document"></ion-icon>
</ion-fab-button> </ion-fab-button>
<ion-fab-button (click)="addImage()" color="light"> <ion-fab-button title="Anexar Fotografia" (click)="addImage()" color="light">
<ion-icon name="image"></ion-icon> <ion-icon name="image"></ion-icon>
</ion-fab-button> </ion-fab-button>
<ion-fab-button (click)="takePicture()" color="light"> <ion-fab-button title="Tirar Fotografia" (click)="takePicture()" color="light">
<ion-icon name="camera"></ion-icon> <ion-icon name="camera"></ion-icon>
</ion-fab-button> </ion-fab-button>
<ion-fab-button (click)="addFileWebtrix()" color="light"> <ion-fab-button title="Documento da Gestão Documental" (click)="addFileWebtrix()" color="light">
<ion-icon src="assets/icon/webtrix.svg"></ion-icon> <ion-icon src="assets/icon/webtrix.svg"></ion-icon>
</ion-fab-button> </ion-fab-button>
</ion-fab-list> </ion-fab-list>
@@ -3,6 +3,7 @@ import { ModalController, NavParams, PopoverController } from '@ionic/angular';
import { ChatService } from 'src/app/services/chat.service'; import { ChatService } from 'src/app/services/chat.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { SetRoomOwnerPage } from 'src/app/modals/set-room-owner/set-room-owner.page';
@Component({ @Component({
@@ -13,6 +14,7 @@ import { ThemeService } from 'src/app/services/theme.service'
export class ChatPopoverPage implements OnInit { export class ChatPopoverPage implements OnInit {
roomId:string; roomId:string;
room: any; room: any;
members:any;
constructor( constructor(
private popoverController: PopoverController, private popoverController: PopoverController,
@@ -23,6 +25,7 @@ export class ChatPopoverPage implements OnInit {
public ThemeService: ThemeService public ThemeService: ThemeService
) { ) {
this.roomId = this.navParams.get('roomId'); this.roomId = this.navParams.get('roomId');
this.members = this.navParams.get('members');
} }
ngOnInit() { ngOnInit() {
@@ -42,6 +45,28 @@ export class ChatPopoverPage implements OnInit {
//Top menu options //Top menu options
//Close //Close
async setRoomOwner(){
let classs;
if (window.innerWidth <= 800) {
classs = 'modal modal-desktop'
} else {
classs = 'centered-rounded-modal'
}
const modal = await this.modalController.create({
component: SetRoomOwnerPage,
cssClass: classs,
backdropDismiss: true,
componentProps: {
room: this.room,
members: this.members,
}
});
await modal.present();
modal.onDidDismiss().then((res)=>{
});
}
leaveGroup(){ leaveGroup(){
console.log('leave'); console.log('leave');
@@ -57,11 +82,14 @@ export class ChatPopoverPage implements OnInit {
}, },
(e)=>{ (e)=>{
if(e.error.errorType = "error-you-are-last-owner"){ if(e.error.errorType = "error-you-are-last-owner"){
this.toastService.badRequest("Você é o último administrador do grupo. Por favor, defina o novo administrador antes de sair da grupo."); this.toastService._badRequest("Você é o último administrador do grupo. Por favor, defina o novo administrador antes de sair da grupo.");
this.close('cancel'); this.close('cancel');
this.setRoomOwner();
} }
else{ else{
this.toastService.badRequest("Não foi possível sair do grupo"); this.toastService._badRequest("Não foi possível sair do grupo");
this.close('cancel'); this.close('cancel');
} }
@@ -77,11 +105,11 @@ export class ChatPopoverPage implements OnInit {
}, },
(e)=>{ (e)=>{
if(e.error.errorType = "error-you-are-last-owner"){ if(e.error.errorType = "error-you-are-last-owner"){
this.toastService.badRequest("Você é o último administrador do grupo. Por favor, defina o novo administrador antes de sair da grupo."); this.toastService._badRequest("Você é o último administrador do grupo. Por favor, defina o novo administrador antes de sair da grupo.");
this.close('cancel'); this.close('cancel');
} }
else{ else{
this.toastService.badRequest("Não foi possível sair do grupo"); this.toastService._badRequest("Não foi possível sair do grupo");
this.close('cancel'); this.close('cancel');
} }
}, },
+6
View File
@@ -288,6 +288,12 @@ $app-theme: mat-light-theme(
padding: 25px; padding: 25px;
} */ } */
//MODALS //MODALS
.centered-rounded-modal {
--height: 100%;
--border-radius: 10px;
padding: 25px;
background: rgba(51, 51, 51, 0.3);
}
.add-note-modal, .add-note-modal,
.emend-message-modal { .emend-message-modal {
--height: 50%; --height: 50%;