mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
several improvements
This commit is contained in:
@@ -280,8 +280,6 @@ hideRefreshButton(){
|
||||
}
|
||||
|
||||
openGroupMessagesPage(rid) {
|
||||
console.log(rid);
|
||||
|
||||
if( window.innerWidth < 701){
|
||||
this.openGroupMessagesModal(rid);
|
||||
}
|
||||
@@ -386,27 +384,27 @@ 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();
|
||||
return dateB - dateA;
|
||||
});
|
||||
console.log(this.userDirectMessages);
|
||||
//console.log(this.userDirectMessages);
|
||||
|
||||
if(this.route.url != "/home/chat"){
|
||||
console.log("Timer message stop")
|
||||
//console.log("Timer message stop")
|
||||
}
|
||||
else {
|
||||
console.log('TIMER');
|
||||
//console.log('TIMER');
|
||||
//Check if modal is opened
|
||||
if(this.segment == "Contactos" && this.showMessages != true){
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
await this.getDirectMessages();
|
||||
console.log('Timer contactos list running')
|
||||
//console.log('Timer contactos list running')
|
||||
}
|
||||
else{
|
||||
console.log('No timer!');
|
||||
//console.log('No timer!');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -445,7 +443,7 @@ hideRefreshButton(){
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
return dateB - dateA;
|
||||
});
|
||||
console.log(this.allGroups);
|
||||
//console.log(this.allGroups);
|
||||
/* }); */
|
||||
if(this.route.url != "/home/chat"){
|
||||
console.log("Timer message stop")
|
||||
@@ -455,7 +453,7 @@ hideRefreshButton(){
|
||||
if(this.segment == "Grupos" && this.showGroupMessages != true){
|
||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||
await this.getGroups();
|
||||
console.log('Timer groups list running')
|
||||
//console.log('Timer groups list running')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<ion-icon src="assets/icon/icons-user.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="header-bottom-contacts">
|
||||
<ion-label *ngFor="let member of members" >
|
||||
<ion-label class="contacts-list" *ngFor="let member of members" >
|
||||
{{member.name}},
|
||||
</ion-label>
|
||||
</div>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
}
|
||||
.header-bottom-contacts{
|
||||
width: 275px;
|
||||
width: calc(100% - 40px);
|
||||
font-size: 15px;
|
||||
color: #797979;
|
||||
white-space: nowrap;
|
||||
@@ -55,6 +55,12 @@
|
||||
float: left;
|
||||
padding: 5px;
|
||||
margin: 1px;
|
||||
|
||||
.contacts-list{
|
||||
white-space: nowrap;
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@ import { FileLoaderService } from 'src/app/services/file/file-loader.service';
|
||||
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
|
||||
import { FileService } from 'src/app/services/functions/file.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { NewEventPage } from '../../agenda/new-event/new-event.page';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-messages',
|
||||
@@ -45,6 +48,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
capturedImage:any;
|
||||
capturedImageTitle:any;
|
||||
attendees: EventPerson[] = [];
|
||||
|
||||
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
|
||||
|
||||
@@ -320,6 +324,34 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.fileService.viewDocumentByUrl(url);
|
||||
}
|
||||
|
||||
async bookMeeting() {
|
||||
this.attendees = this.members.map((val)=>{
|
||||
return {
|
||||
Name: val.name,
|
||||
EmailAddress: val.username+"@"+environment.domain,
|
||||
IsRequired: "true",
|
||||
}
|
||||
});
|
||||
console.log(this.attendees);
|
||||
this.popoverController.dismiss();
|
||||
if( window.innerWidth <= 1024){
|
||||
const modal = await this.modalController.create({
|
||||
component: NewEventPage,
|
||||
componentProps:{
|
||||
attendees: this.attendees,
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((data) => {
|
||||
if(data){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async openChatOptions(ev?: any) {
|
||||
console.log(this.members);
|
||||
|
||||
@@ -336,33 +368,26 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
});
|
||||
await popover.present();
|
||||
await popover.onDidDismiss().then((res)=>{
|
||||
if(res['data'] == "loadPicture"){
|
||||
this.loadPicture();
|
||||
console.log(res['data']);
|
||||
if(res['data'] == 'meeting'){
|
||||
this.bookMeeting();
|
||||
}
|
||||
else if(res['data'] == "takePicture"){
|
||||
let data = this.fileService.takePicture();
|
||||
if(data.name != null){
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId,
|
||||
"msg": "",
|
||||
"attachments": [{
|
||||
"title": data.name,
|
||||
"title_link_download": false,
|
||||
"image_url": data.image,
|
||||
}]
|
||||
}
|
||||
}
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
console.log(res);
|
||||
},(error) => {
|
||||
else if(res['data'] == 'take-picture'){
|
||||
this.fileService.addCameraPictureToChat(this.roomId);
|
||||
//this.loadPicture();
|
||||
}
|
||||
else if(res['data'] == 'add-picture'){
|
||||
this.fileService.addPictureToChat(this.roomId);
|
||||
//this.loadPicture();
|
||||
}
|
||||
else if(res['data'] == 'add-document'){
|
||||
this.fileService.addDocumentToChat(this.roomId);
|
||||
//this.loadDocument();
|
||||
}
|
||||
else if(res['data'] == 'documentoGestaoDocumental'){
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.toastService.badRequest("Não foi possível adicionar a fotografia!");
|
||||
}
|
||||
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
|
||||
//this.addDocGestaoDocumental();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -43,6 +43,23 @@
|
||||
</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 d-flex">
|
||||
<ion-thumbnail *ngIf="file.thumb_url" slot="start">
|
||||
<img src="{{file.thumb_url}}" alt="image">
|
||||
</ion-thumbnail>
|
||||
<!-- <canvas id="pdf_canvas"></canvas> -->
|
||||
<ion-label class="file-details">
|
||||
<h3 (click)="viewDocument(file.title_link)" class="file-title cursor-pointer">{{file.title}}</h3>
|
||||
<p *ngIf="file.text">{{file.text}}</p>
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{last ? scrollToBottom() : ''}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,16 +2,20 @@ import { AfterViewChecked, AfterViewInit, Component, ElementRef, OnDestroy, OnIn
|
||||
import {ActivatedRoute, Router} from '@angular/router'
|
||||
import { 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';
|
||||
import { AlertService } from 'src/app/services/alert.service';
|
||||
import { AuthService } from 'src/app/services/auth.service';
|
||||
import { ChatService } from 'src/app/services/chat.service';
|
||||
import { FileService } from 'src/app/services/functions/file.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { NewEventPage } from 'src/app/shared/agenda/new-event/new-event.page';
|
||||
import { ChatOptionsPopoverPage } from 'src/app/shared/popover/chat-options-popover/chat-options-popover.page';
|
||||
import { MessagesOptionsPage } from 'src/app/shared/popover/messages-options/messages-options.page';
|
||||
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',
|
||||
@@ -41,6 +45,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private scrollChangeCallback: () => void;
|
||||
currentPosition: any;
|
||||
startPosition: number;
|
||||
attendees: EventPerson[] = [];
|
||||
|
||||
constructor(
|
||||
public popoverController: PopoverController,
|
||||
@@ -52,6 +57,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
private toastService: ToastService,
|
||||
private route: Router,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private fileService: FileService,
|
||||
) {
|
||||
/* this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].SerialNumber) {
|
||||
@@ -157,7 +163,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
loadMessages() {
|
||||
this.showLoader = true;
|
||||
const roomId = this.roomId
|
||||
const roomId = this.roomId;
|
||||
|
||||
this.chatService.getRoomMessages(this.roomId).subscribe(res => {
|
||||
/* console.log(res); */
|
||||
@@ -167,6 +173,11 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.showLoader = false;
|
||||
})
|
||||
}
|
||||
|
||||
viewDocument(url:string){
|
||||
this.fileService.viewDocumentByUrl(url);
|
||||
}
|
||||
|
||||
getChatMembers() {
|
||||
this.showLoader = true;
|
||||
this.chatService.getMembers(this.roomId).subscribe(res=> {
|
||||
@@ -241,6 +252,34 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async bookMeeting() {
|
||||
this.attendees = this.members.map((val)=>{
|
||||
return {
|
||||
Name: val.name,
|
||||
EmailAddress: val.username+"@"+environment.domain,
|
||||
IsRequired: "true",
|
||||
}
|
||||
});
|
||||
console.log(this.attendees);
|
||||
this.popoverController.dismiss();
|
||||
if( window.innerWidth <= 1024){
|
||||
const modal = await this.modalController.create({
|
||||
component: NewEventPage,
|
||||
componentProps:{
|
||||
attendees: this.attendees,
|
||||
},
|
||||
cssClass: 'modal modal-desktop',
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((data) => {
|
||||
if(data){
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async openChatOptions(ev?: any) {
|
||||
console.log(this.members);
|
||||
|
||||
@@ -255,7 +294,31 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
},
|
||||
translucent: true
|
||||
});
|
||||
return await popover.present();
|
||||
await popover.present();
|
||||
popover.onDidDismiss().then((res)=>{
|
||||
console.log(res['data']);
|
||||
if(res['data'] == 'meeting'){
|
||||
this.bookMeeting();
|
||||
}
|
||||
else if(res['data'] == 'take-picture'){
|
||||
this.fileService.addCameraPictureToChat(this.roomId);
|
||||
//this.loadPicture();
|
||||
}
|
||||
else if(res['data'] == 'add-picture'){
|
||||
this.fileService.addPictureToChat(this.roomId);
|
||||
//this.loadPicture();
|
||||
}
|
||||
else if(res['data'] == 'add-document'){
|
||||
this.fileService.addDocumentToChat(this.roomId);
|
||||
//this.loadDocument();
|
||||
}
|
||||
else if(res['data'] == 'documentoGestaoDocumental'){
|
||||
|
||||
this.fileService.addDocGestaoDocumentalToChat(this.roomId);
|
||||
//this.addDocGestaoDocumental();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
async serverLongPull() {
|
||||
|
||||
Reference in New Issue
Block a user