mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -384,7 +384,7 @@ hideRefreshButton(){
|
||||
this.chatService.getAllDirectMessages().subscribe(async (res:any)=>{
|
||||
|
||||
if(res != 200){
|
||||
console.log(res.ims);
|
||||
//console.log(res.ims);
|
||||
this.userDirectMessages = res.ims.sort((a,b)=>{
|
||||
var dateA = new Date(a._updatedAt).getTime();
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
Parecer
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="deferimento">
|
||||
Defereimento
|
||||
Deferimento
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
</ion-toolbar>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AlertController, AnimationController } from '@ionic/angular';
|
||||
import { ChatService } from './chat.service';
|
||||
import { ToastService } from './toast.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -9,6 +11,8 @@ export class AlertService {
|
||||
constructor(
|
||||
public alertController: AlertController,
|
||||
private animationController: AnimationController,
|
||||
private chatService: ChatService,
|
||||
private toastService: ToastService,
|
||||
) { }
|
||||
|
||||
async presentAlert(message:string) {
|
||||
@@ -30,10 +34,37 @@ export class AlertService {
|
||||
});
|
||||
|
||||
await alert.present();
|
||||
|
||||
|
||||
setTimeout(()=>{
|
||||
alert.dismiss();
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
async confirmDeleteMessage(body:any) {
|
||||
const alert = await this.alertController.create({
|
||||
cssClass: 'my-custom-class',
|
||||
header: 'Apagar a mensagem?',
|
||||
buttons: [
|
||||
{
|
||||
text: 'Cancelar',
|
||||
role: 'cancel',
|
||||
cssClass: 'secondary',
|
||||
handler: () => {
|
||||
//console.log('Confirm Cancel');
|
||||
}
|
||||
}, {
|
||||
text: 'Apagar',
|
||||
handler: () => {
|
||||
const loader = this.toastService.loading();
|
||||
this.chatService.deleteMessage(body).subscribe(res=>{
|
||||
loader.remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ export class ChatService {
|
||||
getAllChannels(){
|
||||
return this.http.get(environment.apiChatUrl+'channels.list', this.options);
|
||||
}
|
||||
|
||||
getAllUserChannels(){
|
||||
return this.http.get(environment.apiChatUrl+'channels.list.joined', this.options);
|
||||
}
|
||||
@@ -59,6 +60,7 @@ export class ChatService {
|
||||
getAllRooms(){
|
||||
return this.http.get(environment.apiChatUrl+'rooms.get', this.options);
|
||||
}
|
||||
|
||||
getRoomInfo(roomId:any){
|
||||
let params = new HttpParams();
|
||||
params = params.set("roomId", roomId);
|
||||
@@ -110,6 +112,14 @@ export class ChatService {
|
||||
}
|
||||
return this.http.post(environment.apiChatUrl+'chat.sendMessage', body, opts);
|
||||
}
|
||||
|
||||
deleteMessage(body:any){
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
return this.http.post(environment.apiChatUrl+'chat.delete', body, opts);
|
||||
}
|
||||
|
||||
leaveRoom(body:any){
|
||||
let opts = {
|
||||
headers: this.headers,
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ChatPopoverPageModule } from '../../popover/chat-popover/chat-popover.m
|
||||
import { NewEventPageModule } from '../../agenda/new-event/new-event.module';
|
||||
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
import {MatMenuModule} from '@angular/material/menu';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -23,6 +24,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
PdfViewerModule,
|
||||
ChatPopoverPageModule,
|
||||
GroupMessagesPageRoutingModule,
|
||||
MatMenuModule
|
||||
//
|
||||
],
|
||||
exports: [GroupMessagesPage],
|
||||
|
||||
@@ -32,14 +32,20 @@
|
||||
</ion-refresher-content>
|
||||
</ion-refresher>
|
||||
|
||||
<div class="messages overflow-y-auto" #scrollMe>
|
||||
<div class="messages" #scrollMe>
|
||||
<div class="welcome-text">
|
||||
<ion-label> Esta conversa passou a grupo</ion-label><br />
|
||||
<ion-label>A conversa original mantêm-se como chat individual</ion-label>
|
||||
</div>
|
||||
|
||||
<div class="container-width-100" *ngFor="let msg of messages; let last = last" #scrollMe>
|
||||
<div *ngIf="msg.t != 'r' && msg.t != 'ul' && msg.t != 'ru'" class='incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45'>
|
||||
<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>
|
||||
<mat-menu #beforeMenu="matMenu" xPosition="before">
|
||||
<button (click)="deleteMessage(msg._id)" class="menuButton">Apagar mensagem</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
|
||||
|
||||
@@ -131,8 +131,18 @@
|
||||
.messages{
|
||||
font-size: 13px;
|
||||
font-family: Roboto;
|
||||
overflow: auto;
|
||||
|
||||
//set scroll do bottom
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
word-wrap: break-word;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
.incoming-true, .incoming-false{
|
||||
padding: 15px 20px;
|
||||
|
||||
@@ -319,6 +319,16 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
});
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
deleteMessage(msgId:string){
|
||||
let body = {
|
||||
"roomId": this.roomId,
|
||||
"msgId": msgId,
|
||||
"asUser": false,
|
||||
}
|
||||
this.alertService.confirmDeleteMessage(body);
|
||||
}
|
||||
|
||||
async openGroupMessagesOptions() {
|
||||
|
||||
const enterAnimation = (baseEl: any) => {
|
||||
|
||||
@@ -9,6 +9,8 @@ import { MessagesPageRoutingModule } from './messages-routing.module';
|
||||
import { MessagesPage } from './messages.page';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import {MatMenuModule} from '@angular/material/menu';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@@ -16,7 +18,10 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
FontAwesomeModule,
|
||||
MessagesPageRoutingModule
|
||||
MessagesPageRoutingModule,
|
||||
MatButtonModule,
|
||||
MatMenuModule
|
||||
|
||||
],
|
||||
exports: [MessagesPage],
|
||||
declarations: [MessagesPage]
|
||||
|
||||
@@ -34,14 +34,10 @@
|
||||
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of chatMessageStore.message[roomId]; let last = last">
|
||||
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45'>
|
||||
<div class="message-item-options d-flex justify-content-end">
|
||||
<fa-icon (click)="mesageItemDropdownOptions=true" icon="chevron-down" class="message-options-icon"></fa-icon>
|
||||
<!-- <div class="mesage-item-dropdown-options" *ngIf="mesageItemDropdownOptions">
|
||||
<ion-label>Apagar mensagem</ion-label>
|
||||
</div> -->
|
||||
<ion-select hidden class="message-options-icon" interface="popover">
|
||||
<ion-select-option value="nes">Apagar mensagem</ion-select-option>
|
||||
</ion-select>
|
||||
|
||||
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
|
||||
<mat-menu #beforeMenu="matMenu" xPosition="before">
|
||||
<button (click)="deleteMessage(msg._id)" class="menuButton">Apagar mensagem</button>
|
||||
</mat-menu>
|
||||
</div>
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
|
||||
@@ -192,6 +192,18 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
this.message = "";
|
||||
}
|
||||
|
||||
deleteMessage(msgId:string){
|
||||
let body = {
|
||||
"roomId": this.roomId,
|
||||
"msgId": msgId,
|
||||
"asUser": false,
|
||||
}
|
||||
this.alertService.confirmDeleteMessage(body);
|
||||
/* this.chatService.deleteMessage(body).subscribe(res=>{
|
||||
console.log(res);
|
||||
}); */
|
||||
}
|
||||
|
||||
loadMessages(){
|
||||
//this.showLoader = true;
|
||||
const roomId = this.roomId
|
||||
@@ -400,17 +412,17 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
const roomId = this.roomId;
|
||||
|
||||
this.chatService.getRoomMessages(this.roomId).subscribe(async res => {
|
||||
console.log(res['success']);
|
||||
//console.log(res['success']);
|
||||
|
||||
|
||||
if (res['success'] == true) {
|
||||
// Show Error
|
||||
//showMessage(response.statusText);
|
||||
//this.loadMessages()
|
||||
this.loadMessages()
|
||||
this.messages = res['messages'].reverse();
|
||||
this.chatMessageStore.add(roomId, this.messages)
|
||||
|
||||
console.log(this.messages);
|
||||
//console.log(this.messages);
|
||||
// Reconnect in one second
|
||||
if(this.route.url != "/home/chat"){
|
||||
console.log("Timer message stop")
|
||||
|
||||
+13
-11
@@ -1080,16 +1080,7 @@ ngx-mat-datetime-content{
|
||||
display: none;
|
||||
padding-left: 10px;
|
||||
padding-right: 0px;
|
||||
position: absolute;
|
||||
//background-color: red;
|
||||
|
||||
//box-shadow: rgba(0, 30, 0, 0.15) 1.95px 1.95px 2.6px;
|
||||
}
|
||||
.mesage-item-dropdown-options{
|
||||
display: none;
|
||||
margin-top: 15px;
|
||||
position: absolute;
|
||||
border: 1px solid red;
|
||||
position: absolute !important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1112,6 +1103,17 @@ ngx-mat-datetime-content{
|
||||
}
|
||||
}
|
||||
|
||||
.menuButton{
|
||||
font-size: 14px;
|
||||
width: 100%;
|
||||
background: none;
|
||||
padding: 10px 5px 10px 5px;
|
||||
}
|
||||
.menuButton:hover{
|
||||
background: #e6f6ff75;
|
||||
//font-weight: 400;
|
||||
}
|
||||
|
||||
.message-attachments{
|
||||
border-radius: 5px;
|
||||
background-color: #42b9fe13;
|
||||
@@ -1203,7 +1205,7 @@ ngx-mat-datetime-content{
|
||||
.calendar-pr-event-type-Oficial{
|
||||
border-right: 3px solid #99e47b !important;
|
||||
}
|
||||
|
||||
|
||||
.calendar-pr-event-type-Pessoal{
|
||||
border-bottom: 3px solid #958bfc !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user