mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
several improvements
This commit is contained in:
@@ -88,7 +88,7 @@ import { PdfViewerModule } from 'ng2-pdf-viewer';
|
||||
MatSelectModule,
|
||||
MatDialogModule,
|
||||
//
|
||||
PdfViewerModule
|
||||
PdfViewerModule,
|
||||
],
|
||||
providers: [
|
||||
{ provide: MAT_DATE_LOCALE, useValue: 'pt' },
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<button hidden (click)="notImplemented()" full class="btn-cancel" shape="round" >Tirar Fotografia</button>
|
||||
<button hidden (click)="notImplemented()" class="btn-cancel" shape="round" >Digitalizar Documento</button>
|
||||
<button (click)="anexarFoto()" full class="btn-cancel" shape="round" >Anexar Fotografia</button>
|
||||
<button (click)="addPicture()" full class="btn-cancel" shape="round" >Anexar Fotografia</button>
|
||||
<button hidden (click)="addDocument()" class="btn-cancel" shape="round" >Documento</button>
|
||||
<button (click)="addDocGestaoDocumental()" class="btn-cancel" shape="round" >Anexar Documento (G.D.)</button>
|
||||
<div class="solid"></div>
|
||||
<button (click)="bookMeeting()" class="btn-cancel" shape="round" >Marcar reunião</button>
|
||||
<button (click)="bookMeeting()" class="btn-cancel" shape="round" >Novo Evento</button>
|
||||
<button (click)="close()" full class="btn-cancel mobile-only" shape="round" >Cancelar</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -68,8 +68,12 @@ export class ChatOptionsFeaturesPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
anexarFoto(){
|
||||
this.modalController.dismiss('picture');
|
||||
addDocument(){
|
||||
this.modalController.dismiss('add-document');
|
||||
}
|
||||
|
||||
addPicture(){
|
||||
this.modalController.dismiss('add-picture');
|
||||
}
|
||||
|
||||
addDocGestaoDocumental(){
|
||||
|
||||
@@ -8,4 +8,7 @@ export let FileType:
|
||||
"image/svg+xml" |
|
||||
"image/tiff" |
|
||||
"image/webp" |
|
||||
"image/x-icon"
|
||||
"image/x-icon" |
|
||||
".doc" |
|
||||
".docx" |
|
||||
".pdf"
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -4,6 +4,12 @@ import { FileToBase64Service } from '../file/file-to-base64.service';
|
||||
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
//Cordova
|
||||
import { Camera, CameraOptions } from '@ionic-native/camera/ngx';
|
||||
import { ChatService } from '../chat.service';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { SearchList } from 'src/app/models/search-document';
|
||||
import { ProcessesService } from '../processes.service';
|
||||
import { ToastService } from '../toast.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -12,12 +18,18 @@ export class FileService {
|
||||
|
||||
capturedImage:any;
|
||||
capturedImageTitle:any;
|
||||
documents:SearchList[] = [];
|
||||
showLoader: boolean;
|
||||
|
||||
constructor(
|
||||
private camera: Camera,
|
||||
private fileLoaderService: FileLoaderService,
|
||||
private fileToBase64Service: FileToBase64Service,
|
||||
private iab: InAppBrowser,
|
||||
private chatService: ChatService,
|
||||
private modalController: ModalController,
|
||||
private processesService: ProcessesService,
|
||||
private toastService: ToastService,
|
||||
) { }
|
||||
|
||||
takePicture() {
|
||||
@@ -71,6 +83,168 @@ export class FileService {
|
||||
};
|
||||
}
|
||||
|
||||
addCameraPictureToChat(roomId){
|
||||
let data = this.takePicture();
|
||||
if(data.name != null){
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": 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{
|
||||
this.toastService.badRequest("Não foi possível adicionar a fotografia!");
|
||||
}
|
||||
}
|
||||
|
||||
addPictureToChat(roomId:string) {
|
||||
const input = this.fileLoaderService.createInput({
|
||||
accept: ['image/apng', 'image/jpeg', 'image/png']
|
||||
})
|
||||
|
||||
input.onchange = async () => {
|
||||
|
||||
const file = this.fileLoaderService.getFirstFile(input)
|
||||
|
||||
console.log(file);
|
||||
const loader = this.toastService.loading();
|
||||
|
||||
const imageData = await this.fileToBase64Service.convert(file)
|
||||
this.capturedImage = imageData;
|
||||
this.capturedImageTitle = file.name;
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": roomId,
|
||||
"msg": "",
|
||||
"attachments": [{
|
||||
//"title": this.capturedImageTitle ,
|
||||
//"text": "description",
|
||||
"title_link_download": false,
|
||||
"image_url": this.capturedImage,
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
loader.remove();
|
||||
//console.log(res);
|
||||
},(error) => {
|
||||
loader.remove();
|
||||
});
|
||||
//console.log(this.capturedImage)
|
||||
};
|
||||
}
|
||||
|
||||
addDocumentToChat(roomId:string) {
|
||||
const input = this.fileLoaderService.createInput({
|
||||
accept: ['.doc', '.docx', '.pdf']
|
||||
})
|
||||
|
||||
input.onchange = async () => {
|
||||
const loader = this.toastService.loading();
|
||||
const file = this.fileLoaderService.getFirstFile(input)
|
||||
|
||||
console.log(file);
|
||||
|
||||
const imageData = await this.fileToBase64Service.convert(file)
|
||||
this.capturedImage = imageData;
|
||||
this.capturedImageTitle = file.name;
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": roomId,
|
||||
"msg": "",
|
||||
"attachments": [{
|
||||
"title": this.capturedImageTitle,
|
||||
"text": "",
|
||||
"title_link": this.capturedImage,
|
||||
"title_link_download": true,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
"message_link": this.capturedImage,
|
||||
}],
|
||||
"file":{
|
||||
"name": this.capturedImageTitle,
|
||||
"type": "application/pdf",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
loader.remove();
|
||||
//console.log(res);
|
||||
},(error) => {
|
||||
loader.remove();
|
||||
});
|
||||
//console.log(this.capturedImage)
|
||||
};
|
||||
}
|
||||
|
||||
async addDocGestaoDocumentalToChat(roomId:string){
|
||||
const modal = await this.modalController.create({
|
||||
component: SearchPage,
|
||||
cssClass: 'group-messages modal-desktop search-modal search-modal-to-desktop',
|
||||
componentProps: {
|
||||
type: 'AccoesPresidenciais & ArquivoDespachoElect',
|
||||
select: true,
|
||||
showSearchInput: true,
|
||||
}
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(async res=>{
|
||||
if(res){
|
||||
const loader = this.toastService.loading();
|
||||
const data = res.data;
|
||||
this.documents.push(data.selected);
|
||||
console.log(res.data.selected);
|
||||
console.log(res.data.selected.Id);
|
||||
console.log(res.data.selected.ApplicationType);
|
||||
|
||||
let url = await this.processesService.GetDocumentUrl(res.data.selected.Id, res.data.selected.ApplicationType).toPromise();
|
||||
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
console.log(url_no_options);
|
||||
console.log('Oie');
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": roomId,
|
||||
"msg": "",
|
||||
"attachments": [{
|
||||
"title": res.data.selected.Assunto,
|
||||
"text": res.data.selected.DocTypeDesc,
|
||||
"title_link": url_no_options,
|
||||
"title_link_download": true,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
"message_link": url_no_options,
|
||||
}]
|
||||
}
|
||||
}
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
loader.remove();
|
||||
console.log(res);
|
||||
},(error) => {
|
||||
loader.remove();
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
viewDocumentByUrl(url) {
|
||||
const browser = this.iab.create(url,"_blank");
|
||||
browser.show();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
@@ -12,15 +12,21 @@ import { SharedModule } from 'src/app/shared/shared.module';
|
||||
import { ChatPopoverPageModule } from '../../popover/chat-popover/chat-popover.module';
|
||||
import { NewEventPageModule } from '../../agenda/new-event/new-event.module';
|
||||
|
||||
import { PdfViewerModule } from 'ng2-pdf-viewer';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
IonicModule,
|
||||
PdfViewerModule,
|
||||
ChatPopoverPageModule,
|
||||
GroupMessagesPageRoutingModule,
|
||||
|
||||
|
||||
],
|
||||
exports: [GroupMessagesPage],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
declarations: [GroupMessagesPage]
|
||||
})
|
||||
export class GroupMessagesPageModule {}
|
||||
|
||||
@@ -16,7 +16,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>
|
||||
@@ -25,7 +25,6 @@
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
|
||||
<ion-content>
|
||||
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
|
||||
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
|
||||
@@ -38,6 +37,7 @@
|
||||
<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="title">
|
||||
@@ -49,15 +49,24 @@
|
||||
<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 *ngIf="file.thumb_url">
|
||||
<div>
|
||||
<div class="file d-flex">
|
||||
<ion-thumbnail slot="start">
|
||||
<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>
|
||||
|
||||
<!-- <pdf-viewer
|
||||
[src]="file.title_link"
|
||||
[render-text]="true"
|
||||
style="display: block;"
|
||||
original-size="true"
|
||||
show-all="true">
|
||||
</pdf-viewer> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
}
|
||||
.header-bottom{
|
||||
width: 95%;
|
||||
width: 98%;
|
||||
overflow: auto;
|
||||
|
||||
.header-bottom-icon{
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
}
|
||||
.header-bottom-contacts{
|
||||
width: calc(100% - 40px);
|
||||
font-size: 15px;
|
||||
color: #797979;
|
||||
white-space: nowrap;
|
||||
@@ -50,6 +51,12 @@
|
||||
float: left;
|
||||
padding: 5px;
|
||||
margin: 1px;
|
||||
|
||||
.contacts-list{
|
||||
white-space: nowrap;
|
||||
overflow: hidden !important;
|
||||
text-overflow: ellipsis !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,15 @@ import { SearchList } from 'src/app/models/search-document';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { FileService } from 'src/app/services/functions/file.service';
|
||||
|
||||
|
||||
/*
|
||||
import * as pdfjsLib from 'pdfjs-dist';
|
||||
if( pdfjsLib !== undefined ){
|
||||
console.log( "set worker...");
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = "https://npmcdn.com/pdfjs-dist@2.4.456/build/pdf.worker.js";
|
||||
}
|
||||
*/
|
||||
|
||||
@Component({
|
||||
selector: 'app-group-messages',
|
||||
templateUrl: './group-messages.page.html',
|
||||
@@ -56,6 +65,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
|
||||
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
|
||||
|
||||
pdfurl = "http://www.africau.edu/images/default/sample.pdf";
|
||||
|
||||
constructor(
|
||||
private menu: MenuController,
|
||||
private modalController: ModalController,
|
||||
@@ -74,6 +85,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
) {
|
||||
this.loggedUserChat = authService.ValidatedUserChat['data'];
|
||||
this.isGroupCreated = true;
|
||||
|
||||
}
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
//this.getRoomInfo();
|
||||
@@ -87,15 +99,54 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
console.log(this.roomId);
|
||||
this.setStatus('online');
|
||||
this.getChatMembers();
|
||||
|
||||
/* pdfjs.Lib.getDocument('sample.pdf').promise.then((doc)=>{
|
||||
console.log(doc);
|
||||
|
||||
}) */
|
||||
//this.loadPDF();
|
||||
}
|
||||
|
||||
/* loadPDF() {
|
||||
const loadingTask = pdfjsLib.getDocument( this.pdfurl );
|
||||
loadingTask.promise.then((pdf) => {
|
||||
console.log( "pdf: ", pdf );
|
||||
console.log('PDF loaded');
|
||||
|
||||
// Fetch the first page
|
||||
var pageNumber = 1;
|
||||
pdf.getPage(pageNumber).then(function(page) {
|
||||
console.log('Page loaded');
|
||||
|
||||
var scale = 1.5;
|
||||
var viewport = page.getViewport({scale: scale});
|
||||
|
||||
// Prepare canvas using PDF page dimensions
|
||||
var canvas: any = document.getElementById('pdf_canvas');
|
||||
var context = canvas.getContext('2d');
|
||||
canvas.height = viewport.height;
|
||||
canvas.width = viewport.width;
|
||||
|
||||
// Render PDF page into canvas context
|
||||
var renderContext = {
|
||||
canvasContext: context,
|
||||
viewport: viewport
|
||||
};
|
||||
var renderTask = page.render(renderContext);
|
||||
renderTask.promise.then(function () {
|
||||
console.log('Page rendered');
|
||||
});
|
||||
});
|
||||
});
|
||||
} */
|
||||
|
||||
setStatus(status:string){
|
||||
let body = {
|
||||
message: '',
|
||||
status: status,
|
||||
}
|
||||
this.chatService.setUserStatus(body).subscribe(res => {
|
||||
console.log(res);
|
||||
//console.log(res);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -132,10 +183,10 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
async getChatMembers(){
|
||||
//return await this.chatService.getMembers(roomId).toPromise();
|
||||
this.chatService.getAllUsers().subscribe(res=> {
|
||||
console.log(res);
|
||||
//console.log(res);
|
||||
|
||||
this.allUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username);
|
||||
console.log(this.allUsers);
|
||||
//console.log(this.allUsers);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -187,7 +238,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
//If group is private call getGroupMembers
|
||||
if(room.t === 'p'){
|
||||
this.chatService.getGroupMembers(this.roomId).subscribe(res=>{
|
||||
console.log(res);
|
||||
//console.log(res);
|
||||
this.members = res['members'];
|
||||
this.showLoader = false;
|
||||
});
|
||||
@@ -214,7 +265,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
console.log(res);
|
||||
let msgOnly = res['messages'].filter(data => data.t != 'au');
|
||||
this.messages = msgOnly.reverse();
|
||||
console.log(res);
|
||||
//console.log(res);
|
||||
|
||||
this.showLoader = false;
|
||||
});
|
||||
@@ -438,6 +489,49 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
};
|
||||
}
|
||||
|
||||
loadDocument() {
|
||||
const input = this.fileLoaderService.createInput({
|
||||
accept: ['.doc', '.docx', '.pdf']
|
||||
})
|
||||
|
||||
input.onchange = async () => {
|
||||
const file = this.fileLoaderService.getFirstFile(input)
|
||||
|
||||
console.log(file);
|
||||
|
||||
const imageData = await this.fileToBase64Service.convert(file)
|
||||
this.capturedImage = imageData;
|
||||
this.capturedImageTitle = file.name;
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": this.roomId,
|
||||
"msg": "",
|
||||
"attachments": [{
|
||||
"title": this.capturedImageTitle,
|
||||
"text": "",
|
||||
"title_link": this.capturedImage,
|
||||
"title_link_download": true,
|
||||
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
|
||||
"message_link": this.capturedImage,
|
||||
}],
|
||||
"file":{
|
||||
"name": this.capturedImageTitle,
|
||||
"type": "application/pdf",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.chatService.sendMessage(body).subscribe(res=> {
|
||||
//console.log(res);
|
||||
},(error) => {
|
||||
|
||||
});
|
||||
//console.log(this.capturedImage)
|
||||
};
|
||||
}
|
||||
|
||||
async addDocGestaoDocumental(){
|
||||
const modal = await this.modalController.create({
|
||||
component: SearchPage,
|
||||
@@ -529,7 +623,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then((res)=>{
|
||||
console.log(res['data']);
|
||||
//console.log(res['data']);
|
||||
if(res['data'] == 'meeting'){
|
||||
//this.closeAllDesktopComponents.emit();
|
||||
let data = {
|
||||
@@ -538,9 +632,12 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
}
|
||||
this.openNewEventPage.emit(data);
|
||||
}
|
||||
else if(res['data'] == 'picture'){
|
||||
else if(res['data'] == 'add-picture'){
|
||||
this.loadPicture();
|
||||
}
|
||||
else if(res['data'] == 'add-document'){
|
||||
this.loadDocument();
|
||||
}
|
||||
else if(res['data'] == 'documentoGestaoDocumental'){
|
||||
this.addDocGestaoDocumental();
|
||||
}
|
||||
@@ -565,13 +662,13 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
|
||||
console.log(this.messages);
|
||||
// Reconnect in one second
|
||||
if(this.route.url != "/home/chat"){
|
||||
console.log("Timer message stop")
|
||||
//console.log("Timer message stop")
|
||||
} else {
|
||||
if(document.querySelector('app-group-messages')){
|
||||
await new Promise(resolve => setTimeout(resolve,3000));
|
||||
await this.serverLongPull();
|
||||
this.getGroups.emit();
|
||||
console.log('Timer message running')
|
||||
//console.log('Timer message running')
|
||||
}
|
||||
else{
|
||||
|
||||
|
||||
@@ -39,6 +39,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>
|
||||
|
||||
@@ -13,6 +13,7 @@ import { ChatOptionsFeaturesPage } from 'src/app/modals/chat-options-features/ch
|
||||
import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
|
||||
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
|
||||
import { TimeService } from 'src/app/services/functions/time.service';
|
||||
import { FileService } from 'src/app/services/functions/file.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-messages',
|
||||
@@ -61,6 +62,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
private toastService: ToastService,
|
||||
private route: Router,
|
||||
private timeService: TimeService,
|
||||
private fileService: FileService,
|
||||
) {
|
||||
this.loggedUser = authService.ValidatedUserChat['data'];
|
||||
|
||||
@@ -191,6 +193,10 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
})
|
||||
}
|
||||
|
||||
viewDocument(url:string){
|
||||
this.fileService.viewDocumentByUrl(url);
|
||||
}
|
||||
|
||||
getChatMembers() {
|
||||
console.log(this.roomId);
|
||||
|
||||
@@ -350,6 +356,20 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
|
||||
}
|
||||
this.openNewEventPage.emit(data);
|
||||
}
|
||||
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.showLoader = false;
|
||||
//this.addDocGestaoDocumental();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
<button (click)="takePicture()" full class="btn-ok" shape="round" >Tirar Fotografia</button>
|
||||
<button hidden (click)="notImplemented()" class="btn-ok" shape="round" >Digitalizar Documento</button>
|
||||
<button (click)="anexarFoto()" full class="btn-ok" shape="round" >Anexar Fotografia</button>
|
||||
<button hidden (click)="getDoc()" class="btn-ok" shape="round" >Anexar Documento</button>
|
||||
<button (click)="addDocGestaoDocumental()" class="btn-ok" shape="round" >Anexar Documento (G.D.)</button>
|
||||
<div class="solid"></div>
|
||||
<button (click)="bookMeeting()" class="btn-ok" shape="round" >Marcar reunião</button>
|
||||
<button (click)="bookMeeting()" class="btn-ok" shape="round" >Novo Evento</button>
|
||||
<button (click)="close()" full class="btn-cancel" shape="round" >Cancelar</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -47,19 +47,28 @@ export class ChatOptionsPopoverPage implements OnInit {
|
||||
|
||||
takePicture(){
|
||||
if( window.innerWidth < 701){
|
||||
this.popoverController.dismiss('takePicture');
|
||||
this.popoverController.dismiss('take-picture');
|
||||
}
|
||||
else{
|
||||
this.modalController.dismiss('takePicture');
|
||||
this.modalController.dismiss('take-picture');
|
||||
}
|
||||
}
|
||||
|
||||
anexarFoto(){
|
||||
if( window.innerWidth < 701){
|
||||
this.popoverController.dismiss('loadPicture');
|
||||
this.popoverController.dismiss('add-picture');
|
||||
}
|
||||
else{
|
||||
this.modalController.dismiss('loadPicture');
|
||||
this.modalController.dismiss('add-picture');
|
||||
}
|
||||
}
|
||||
|
||||
addDocGestaoDocumental(){
|
||||
if( window.innerWidth < 701){
|
||||
this.popoverController.dismiss('documentoGestaoDocumental');
|
||||
}
|
||||
else{
|
||||
this.modalController.dismiss('documentoGestaoDocumental');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +106,7 @@ export class ChatOptionsPopoverPage implements OnInit {
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
async getDoc(){
|
||||
const modal = await this.modalController.create({
|
||||
component: SearchPage,
|
||||
|
||||
Reference in New Issue
Block a user