2021-08-18 16:40:58 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
|
|
import { ModalController, NavParams, PopoverController } from '@ionic/angular';
|
|
|
|
|
import { EventPerson } from 'src/app/models/eventperson.model';
|
2021-08-20 12:02:27 +01:00
|
|
|
import { SearchList } from 'src/app/models/search-document';
|
2021-08-18 16:40:58 +01:00
|
|
|
import { NewEventPage } from 'src/app/pages/agenda/new-event/new-event.page';
|
|
|
|
|
import { SearchPage } from 'src/app/pages/search/search.page';
|
|
|
|
|
import { AlertService } from 'src/app/services/alert.service';
|
2021-09-13 12:37:58 +01:00
|
|
|
import { ChatService } from 'src/app/services/chat.service';
|
|
|
|
|
import { FileLoaderService } from 'src/app/services/file/file-loader.service';
|
|
|
|
|
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
|
2021-08-18 16:40:58 +01:00
|
|
|
import { environment } from 'src/environments/environment';
|
2021-10-25 15:31:43 +01:00
|
|
|
import { ThemeService } from 'src/app/services/theme.service'
|
2022-06-08 11:56:56 +01:00
|
|
|
import { HttpErrorResponse } from '@angular/common/http';
|
2021-08-18 16:40:58 +01:00
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
|
selector: 'app-chat-options-features',
|
|
|
|
|
templateUrl: './chat-options-features.page.html',
|
|
|
|
|
styleUrls: ['./chat-options-features.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class ChatOptionsFeaturesPage implements OnInit {
|
|
|
|
|
|
2021-08-20 12:02:27 +01:00
|
|
|
documents:SearchList[] = [];
|
2021-08-18 16:40:58 +01:00
|
|
|
members: any;
|
|
|
|
|
attendees: EventPerson[] = [];
|
|
|
|
|
|
2021-09-13 12:37:58 +01:00
|
|
|
capturedImage:any;
|
|
|
|
|
capturedImageTitle:any;
|
|
|
|
|
|
2021-08-18 16:40:58 +01:00
|
|
|
constructor(
|
|
|
|
|
private popoverController: PopoverController,
|
|
|
|
|
private modalController: ModalController,
|
|
|
|
|
private alertService: AlertService,
|
|
|
|
|
private navParams: NavParams,
|
2021-09-13 12:37:58 +01:00
|
|
|
private fileLoaderService: FileLoaderService,
|
|
|
|
|
private fileToBase64Service: FileToBase64Service,
|
|
|
|
|
private chatService: ChatService,
|
2021-10-25 15:43:53 +01:00
|
|
|
public ThemeService: ThemeService
|
2021-08-18 16:40:58 +01:00
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
this.members = this.navParams.get('members');
|
|
|
|
|
this.attendees = this.members.map((val)=>{
|
|
|
|
|
return {
|
|
|
|
|
Name: val.name,
|
|
|
|
|
EmailAddress: val.username+"@"+environment.domain,
|
|
|
|
|
IsRequired: "true",
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
2022-06-10 09:42:41 +01:00
|
|
|
this.chatService.refreshtoken();
|
2021-08-18 16:40:58 +01:00
|
|
|
}
|
|
|
|
|
|
2022-05-30 15:52:20 +01:00
|
|
|
notImplemented() {
|
2021-08-18 16:40:58 +01:00
|
|
|
this.alertService.presentAlert('Funcionalidade em desenvolvimento');
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-30 15:52:20 +01:00
|
|
|
close() {
|
|
|
|
|
if( window.innerWidth < 701) {
|
2021-08-18 16:40:58 +01:00
|
|
|
this.popoverController.dismiss();
|
|
|
|
|
}
|
2022-05-30 15:52:20 +01:00
|
|
|
else {
|
2021-08-18 16:40:58 +01:00
|
|
|
this.modalController.dismiss();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
attachDocument(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-21 14:05:59 +01:00
|
|
|
addDocument(){
|
|
|
|
|
this.modalController.dismiss('add-document');
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-23 12:13:20 +01:00
|
|
|
takePicture(){
|
|
|
|
|
if( window.innerWidth < 701){
|
|
|
|
|
this.popoverController.dismiss('take-picture');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.modalController.dismiss('take-picture');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-21 14:05:59 +01:00
|
|
|
addPicture(){
|
|
|
|
|
this.modalController.dismiss('add-picture');
|
2021-09-13 12:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
2021-09-14 15:57:24 +01:00
|
|
|
addDocGestaoDocumental(){
|
|
|
|
|
this.modalController.dismiss('documentoGestaoDocumental');
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-13 12:37:58 +01:00
|
|
|
laodPicture() {
|
|
|
|
|
const input = this.fileLoaderService.createInput({
|
|
|
|
|
accept: ['image/apng', 'image/jpeg', 'image/png']
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
input.onchange = async () => {
|
|
|
|
|
const file = this.fileLoaderService.getFirstFile(input)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const imageData = await this.fileToBase64Service.convert(file)
|
|
|
|
|
this.capturedImage = imageData;
|
|
|
|
|
this.capturedImageTitle = file.name;
|
|
|
|
|
|
|
|
|
|
let body = {
|
|
|
|
|
"message":
|
|
|
|
|
{
|
|
|
|
|
"rid": "J5WDHyrYWHQrybbno",
|
|
|
|
|
"msg": "this.message",
|
|
|
|
|
"attachments": [{
|
|
|
|
|
"title": this.capturedImageTitle ,
|
|
|
|
|
"text": "description",
|
|
|
|
|
"title_link_download": false,
|
|
|
|
|
"image_url": this.capturedImage,
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.chatService.sendMessage(body).subscribe(res=> {
|
2022-04-28 09:32:27 +01:00
|
|
|
//
|
2021-09-13 12:37:58 +01:00
|
|
|
});
|
2022-04-28 09:32:27 +01:00
|
|
|
//
|
2021-09-13 12:37:58 +01:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sendMessage(){
|
|
|
|
|
let body = {
|
|
|
|
|
"message":
|
|
|
|
|
{
|
|
|
|
|
"rid": "J5WDHyrYWHQrybbno",
|
|
|
|
|
"msg": "this.message",
|
|
|
|
|
/* "attachments": [{
|
|
|
|
|
"color": "#ff0000",
|
|
|
|
|
"text": "Yay for gruggy!",
|
|
|
|
|
"title": "Attachment Example",
|
|
|
|
|
"title_link": "https://youtube.com",
|
|
|
|
|
"title_link_download": false,
|
|
|
|
|
"image_url": "https://upload.wikimedia.org/wikipedia/commons/e/ee/Chain_link_icon.png",
|
|
|
|
|
}] */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.chatService.sendMessage(body).subscribe(res=> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-18 16:40:58 +01:00
|
|
|
/* getGroupContacts(room:any){
|
|
|
|
|
this.showLoader = true;
|
|
|
|
|
//If group is private call getGroupMembers
|
|
|
|
|
if(this.room.t === 'p'){
|
|
|
|
|
this.chatService.getGroupMembers(this.roomId).subscribe(res=>{
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-08-18 16:40:58 +01:00
|
|
|
this.members = res['members'];
|
|
|
|
|
this.showLoader = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
//Otherwise call getChannelMembers for públic groups
|
|
|
|
|
else{
|
|
|
|
|
this.chatService.getChannelMembers(this.roomId).subscribe(res=>{
|
2022-04-28 09:32:27 +01:00
|
|
|
|
2021-08-18 16:40:58 +01:00
|
|
|
this.members = res['members'];
|
|
|
|
|
this.showLoader = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
async getDoc(){
|
|
|
|
|
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((res)=>{
|
|
|
|
|
if(res){
|
|
|
|
|
const data = res.data;
|
|
|
|
|
this.documents.push(data.selected);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async bookMeeting() {
|
|
|
|
|
|
|
|
|
|
if( window.innerWidth <= 800){
|
|
|
|
|
this.popoverController.dismiss();
|
|
|
|
|
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){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
this.modalController.dismiss('meeting');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|