mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserModule, HammerModule } from '@angular/platform-browser';
|
||||
import { RouteReuseStrategy } from '@angular/router';
|
||||
|
||||
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
|
||||
@@ -89,6 +89,7 @@ import { PdfViewerModule } from 'ng2-pdf-viewer';
|
||||
MatDialogModule,
|
||||
//
|
||||
PdfViewerModule,
|
||||
HammerModule,
|
||||
],
|
||||
providers: [
|
||||
{ provide: MAT_DATE_LOCALE, useValue: 'pt' },
|
||||
|
||||
@@ -10,6 +10,7 @@ import { MessagesPage } from './messages.page';
|
||||
import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { BtnModalDismissPage } from 'src/app/shared/btn-modal-dismiss/btn-modal-dismiss.page';
|
||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
|
||||
|
||||
@NgModule({
|
||||
@@ -18,7 +19,8 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
FontAwesomeModule,
|
||||
MessagesPageRoutingModule
|
||||
MessagesPageRoutingModule,
|
||||
MatMenuModule,
|
||||
],
|
||||
declarations: [MessagesPage]
|
||||
})
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
<ion-header class="ion-no-border">
|
||||
<ion-toolbar class="header-toolbar">
|
||||
<!-- <div #rectangle class="rectangle" (press)="handlePress()">
|
||||
Double click me to change the color
|
||||
</div> -->
|
||||
<div class="main-header">
|
||||
<div class="header-top">
|
||||
<div class="left">
|
||||
<button class="btn-no-color" (click)="close()">
|
||||
<ion-icon slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
|
||||
<!-- <ion-icon slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon> -->
|
||||
<fa-icon icon="chevron-left" class="header-top-btn"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
<div class="middle" *ngFor="let users of dmUsers">
|
||||
<ion-label class="title">{{users.name}}</ion-label>
|
||||
<span><ion-icon class="{{users.status}}" name="ellipse"></ion-icon></span>
|
||||
<div class="middle-container" *ngIf="!showMessageOptions">
|
||||
<div class="middle" *ngFor="let users of dmUsers">
|
||||
<ion-label class="title">{{users.name}}</ion-label>
|
||||
<span><ion-icon class="{{users.status}}" name="ellipse"></ion-icon></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="middle-container-options" *ngIf="showMessageOptions">
|
||||
<fa-icon (click)="deleteMessage(selectedMsgId)" icon="trash" class="middle-container-options-icons"></fa-icon>
|
||||
<!-- <ion-icon name="trash"></ion-icon> -->
|
||||
</div>
|
||||
<div hidden class="right">
|
||||
<button class="btn-no-color" (click)="openMessagesOptions()">
|
||||
@@ -30,47 +40,52 @@
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
|
||||
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||
<ion-refresher-content>
|
||||
</ion-refresher-content>
|
||||
</ion-refresher>
|
||||
<div class="messages" #scrollMe>
|
||||
<div *ngFor="let msg of chatMessageStore.message[roomId] ; let last = last" class='incoming-{{msg.u.username!=loggedUser.me.username}}'>
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<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>
|
||||
|
||||
<div (click)="handleClick()" class="messages" #scrollMe>
|
||||
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of chatMessageStore.message[roomId]; let last = last"
|
||||
[class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
|
||||
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}'>
|
||||
<div class="title">
|
||||
<ion-label>{{msg.u.name}}</ion-label>
|
||||
<span class="time">{{showDateDuration(msg._updatedAt)}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<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>
|
||||
<div class="file">
|
||||
<!-- <canvas id="pdf_canvas"></canvas> -->
|
||||
<ion-label class="file-details" *ngIf="msg.file">
|
||||
<span (click)="viewDocument(file.title_link)" class="file-title cursor-pointer">
|
||||
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
|
||||
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg"></ion-icon>
|
||||
{{file.title}}
|
||||
</span>
|
||||
</ion-label>
|
||||
</div>
|
||||
<div class="file-details-optional">
|
||||
<ion-label *ngIf="msg.file">
|
||||
<span *ngIf="file.description">{{file.description}}</span>
|
||||
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"> • </span>
|
||||
<span *ngIf="msg.file.type != 'application/webtrix'">{{msg.file.type.replace('application/','').toUpperCase()}}</span>
|
||||
</ion-label>
|
||||
<div>
|
||||
<div class="file">
|
||||
<!-- <canvas id="pdf_canvas"></canvas> -->
|
||||
<ion-label class="file-details" *ngIf="msg.file">
|
||||
<span (click)="viewDocument(file.title_link)" class="file-title cursor-pointer">
|
||||
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
|
||||
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
|
||||
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg"></ion-icon>
|
||||
{{file.title}}
|
||||
</span>
|
||||
</ion-label>
|
||||
</div>
|
||||
<div class="file-details-optional">
|
||||
<ion-label *ngIf="msg.file">
|
||||
<span *ngIf="file.description">{{file.description}}</span>
|
||||
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"> • </span>
|
||||
<span *ngIf="msg.file.type != 'application/webtrix'">{{msg.file.type.replace('application/','').toUpperCase()}}</span>
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,20 +20,49 @@
|
||||
overflow: auto;
|
||||
padding: 0 !important;
|
||||
background: #fff;
|
||||
|
||||
.left{
|
||||
width: 37px;
|
||||
width: fit-content;
|
||||
float: left;
|
||||
font-size: 35px;
|
||||
//font-size: 35px;
|
||||
overflow: hidden;
|
||||
|
||||
.header-top-btn{
|
||||
background: transparent;
|
||||
font-size: 25px !important;
|
||||
font-weight: 100 !important;
|
||||
/* color: #0782c9; */
|
||||
color: #42b9fe;
|
||||
}
|
||||
}
|
||||
.middle{
|
||||
|
||||
.middle-container{
|
||||
overflow: auto;
|
||||
height: auto;
|
||||
|
||||
.middle{
|
||||
padding: 0!important;
|
||||
float: left;
|
||||
width:calc(100% - 77px);
|
||||
margin: 0px 0 0 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.middle-container-options{
|
||||
padding: 0!important;
|
||||
float: left;
|
||||
width:calc(100% - 77px);
|
||||
margin: 2.5px 0 0 5px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: calc(100% - 25px);
|
||||
text-align: right;
|
||||
|
||||
/* ion-icon{
|
||||
font-size: 25px;
|
||||
} */
|
||||
.middle-container-options-icons{
|
||||
color: #0782c9;
|
||||
font-size: 23px;
|
||||
}
|
||||
}
|
||||
.right{
|
||||
padding: 0!important;
|
||||
@@ -118,6 +147,17 @@
|
||||
word-wrap: break-word;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
.messages-list-item-wrapper{
|
||||
overflow: auto;
|
||||
}
|
||||
.messages-list-item-wrapper-active{
|
||||
background: #e6f6ff75 !important;
|
||||
}
|
||||
|
||||
.message-container{
|
||||
//border: 1px solid red;
|
||||
}
|
||||
|
||||
|
||||
.incoming-true, .incoming-false{
|
||||
width: 305px;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AfterViewChecked, AfterViewInit, Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router'
|
||||
import { ModalController, NavParams, PopoverController } from '@ionic/angular';
|
||||
import { GestureController, Gesture, ModalController, NavParams, PopoverController } from '@ionic/angular';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { ContactsPage } from 'src/app/pages/chat/messages/contacts/contacts.page';
|
||||
@@ -17,6 +17,7 @@ import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
|
||||
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-messages',
|
||||
templateUrl: './messages.page.html',
|
||||
@@ -26,6 +27,8 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
showLoader: boolean;
|
||||
|
||||
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
|
||||
/* @ViewChild('messageContainer') messageContainer: ElementRef; */
|
||||
@ViewChild('rectangle') private rectangle: ElementRef;
|
||||
|
||||
loggedUser: any;
|
||||
|
||||
@@ -47,6 +50,15 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
startPosition: number;
|
||||
scrollToBottomBtn = false;
|
||||
attendees: EventPerson[] = [];
|
||||
longPressActive = false;
|
||||
|
||||
|
||||
private backgrounds: string[] = ['rgba(0, 0, 255, 0.5)', 'rgba(0, 255, 0.5)', 'rgba(255, 0, 0, 0.5)', 'rgba(255, 255, 0, 0.5)', 'rgba(255, 0, 255, 0.5)', 'rgba(0, 255, 255, 0.5)'];
|
||||
private currentColor: string = 'rgba(0, 0, 255, 0.5)';
|
||||
private lastOnStart: number = 0;
|
||||
private DOUBLE_CLICK_THRESHOLD: number = 500;
|
||||
showMessageOptions = false;
|
||||
selectedMsgId:string;
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
@@ -59,6 +71,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private route: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private fileService: FileService,
|
||||
private gestureController: GestureController,
|
||||
) {
|
||||
/* this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].SerialNumber) {
|
||||
@@ -84,6 +97,105 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.el.scrollTop = this.el.scrollHeight - this.el.scrollTop; */
|
||||
|
||||
this.setStatus('online');
|
||||
//this.onPressingMessage();
|
||||
|
||||
/* setInterval(()=>{
|
||||
const gesture = this.gestureController.create({
|
||||
el: this.rectangle.nativeElement,
|
||||
gestureName:'my-gesture',
|
||||
onMove: (detail) => { this.onMove(detail); }
|
||||
})
|
||||
|
||||
gesture.enable();
|
||||
}, 9000); */
|
||||
|
||||
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.scrollChangeCallback = () => this.onContentScrolled(event);
|
||||
window.addEventListener('scroll', this.scrollChangeCallback, true);
|
||||
|
||||
const gesture = this.gestureController.create({
|
||||
el: this.rectangle.nativeElement,
|
||||
gestureName:'long-press',
|
||||
onStart: () => { alert('OP') },
|
||||
/* onMove () => {
|
||||
console.log('Move');
|
||||
}, */
|
||||
onEnd: () => {
|
||||
console.log('ENNNNNDS');
|
||||
},
|
||||
})
|
||||
|
||||
gesture.enable();
|
||||
}
|
||||
|
||||
handlePress(id?:string){
|
||||
this.selectedMsgId = id;
|
||||
this.showMessageOptions = true;
|
||||
/* if(!this.showMessageOptions){
|
||||
this.showMessageOptions = true;
|
||||
}
|
||||
else{
|
||||
this.showMessageOptions = false;
|
||||
} */
|
||||
}
|
||||
|
||||
handleClick(){
|
||||
this.showMessageOptions = false;
|
||||
this.selectedMsgId = "";
|
||||
}
|
||||
|
||||
private onStart() {
|
||||
alert('OP');
|
||||
const now = Date.now();
|
||||
|
||||
if (Math.abs(now - this.lastOnStart) <= this.DOUBLE_CLICK_THRESHOLD) {
|
||||
this.rectangle.nativeElement.style.setProperty('background', this.getRandomBackground());
|
||||
this.lastOnStart = 0;
|
||||
} else {
|
||||
this.lastOnStart = now;
|
||||
}
|
||||
}
|
||||
|
||||
private getRandomBackground() {
|
||||
const options = this.backgrounds.filter(bg => bg !== this.currentColor);
|
||||
this.currentColor = options[Math.floor(Math.random() * options.length)];
|
||||
|
||||
return this.currentColor;
|
||||
}
|
||||
|
||||
/* onPressingMessage(){
|
||||
const gesture = this.gestureController.create({
|
||||
el: this.messageContainer.nativeElement,
|
||||
gestureName: 'long-press',
|
||||
onStart: ev =>{
|
||||
this.longPressActive = true;
|
||||
console.log('Pressing');
|
||||
},
|
||||
onEnd: ev => {
|
||||
this.longPressActive = false;
|
||||
console.log('Stop pressing');
|
||||
}
|
||||
});
|
||||
gesture.enable(true);
|
||||
} */
|
||||
|
||||
deleteMessage(msgId:string){
|
||||
let body = {
|
||||
"roomId": this.roomId,
|
||||
"msgId": msgId,
|
||||
"asUser": false,
|
||||
}
|
||||
if(msgId){
|
||||
this.alertService.confirmDeleteMessage(body);
|
||||
}
|
||||
else{
|
||||
this.toastService.badRequest('Não foi possível apagar');
|
||||
}
|
||||
this.showMessageOptions = false;
|
||||
this.selectedMsgId = "";
|
||||
}
|
||||
|
||||
setStatus(status:string){
|
||||
@@ -129,10 +241,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
} catch(err) { }
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.scrollChangeCallback = () => this.onContentScrolled(event);
|
||||
window.addEventListener('scroll', this.scrollChangeCallback, true);
|
||||
}
|
||||
|
||||
|
||||
onContentScrolled(e) {
|
||||
this.startPosition = e.srcElement.scrollTop;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AfterViewChecked, AfterViewInit, Component, ElementRef, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core';
|
||||
import { AnimationController, ModalController, PopoverController } from '@ionic/angular';
|
||||
import { AnimationController, GestureController, ModalController, PopoverController } from '@ionic/angular';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
@@ -24,6 +24,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
showLoader: boolean;
|
||||
|
||||
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
|
||||
@ViewChild('message-item') messageContainer: ElementRef;
|
||||
|
||||
loggedUser: any;
|
||||
|
||||
@@ -52,6 +53,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
startPosition: number;
|
||||
mesageItemDropdownOptions: boolean = false;
|
||||
scrollToBottomBtn = false;
|
||||
longPressActive = false;
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
@@ -65,6 +67,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
private route: Router,
|
||||
private timeService: TimeService,
|
||||
private fileService: FileService,
|
||||
private gestureController: GestureController,
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
|
||||
@@ -89,6 +92,21 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
this.setStatus('online');
|
||||
}
|
||||
|
||||
onPressingMessage(){
|
||||
const gesture = this.gestureController.create({
|
||||
el: this.messageContainer.nativeElement,
|
||||
gestureName: 'long-press',
|
||||
onStart: ev =>{
|
||||
this.longPressActive = true;
|
||||
console.log('Pressing');
|
||||
},
|
||||
onEnd: ev => {
|
||||
this.longPressActive = false;
|
||||
console.log('Stop pressing');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setStatus(status:string){
|
||||
let body = {
|
||||
message: '',
|
||||
|
||||
Reference in New Issue
Block a user