This commit is contained in:
Peter Maquiran
2022-05-27 13:36:37 +01:00
parent 304975d823
commit ce7cee0876
25 changed files with 131 additions and 234 deletions
@@ -359,7 +359,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}
async getChatMembers() {
//return await this.chatService.getMembers(roomId).toPromise();
this.chatService.getAllUsers().subscribe(res => {
//
+1 -12
View File
@@ -606,17 +606,6 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
/* const popover = await this.popoverController.create({
component: MessagesOptionsPage,
componentProps: {
roomId: this.dm._id,
},
cssClass: 'messages-options',
event: ev,
translucent: true,
});
return await popover.present(); */
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
@@ -631,7 +620,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
async takePictureMobile() {
console.log('take picture')
const roomId = this.roomId
const file = await Camera.getPhoto({
+51 -57
View File
@@ -1,15 +1,13 @@
import { analyzeAndValidateNgModules } from '@angular/compiler';
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
import { NavigationStart, Router } from '@angular/router';
import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
import { WsChatMethodsService } from 'src/app/services/chat/ws-chat-methods.service';
import { DataService } from 'src/app/services/data.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
import { SessionStore } from 'src/app/store/session.service';
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
import { ToastService } from 'src/app/services/toast.service';
@Component({
selector: 'app-new-group',
@@ -25,7 +23,6 @@ export class NewGroupPage implements OnInit{
_day:any;
selectedDuration = ['','',''];
countDownTime:any;
//groupName:string;
task:any;
documents: any;
loggedUserChat: any;
@@ -41,11 +38,11 @@ export class NewGroupPage implements OnInit{
private router: Router,
public wsChatMethodsService: WsChatMethodsService,
private authService: AuthService,
private toastService: ToastService,
)
{
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.isGroupCreated = false;
//this.groupName = this.navParams.get('name');
}
ngOnInit() {
@@ -85,7 +82,7 @@ export class NewGroupPage implements OnInit{
this.addGroupMessage.emit();
}
async createGroup(){
async createGroup() {
let name = this.groupName.split(' ').join('-');
//Take out all special characters in string
@@ -94,44 +91,61 @@ export class NewGroupPage implements OnInit{
let customFields = {}
let res:any;
if(this.thedate){
if(this.thedate) {
let customFields = {
"countDownDate":this.thedate
}
res = await this.wsChatMethodsService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
res = await this.wsChatMethodsService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
}
else{
else {
res = await this.wsChatMethodsService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
}
// FsId
// DocId
if(res?.result?.rid) {
this.addGroupMessage.emit(res.result.rid);
await this.wsChatMethodsService.getAllRooms();
setTimeout(()=> {
this.documents.forEach(element => {
this.wsChatMethodsService.getGroupRoom(res.result.rid).send({
file: {
"name": element.Assunto,
"type": "application/webtrix",
"ApplicationId": element.ApplicationId,
"DocId": element.DocId,
"Assunto": element.Assunto,
},
temporaryData: {
data: {
selected: {
Id: element.DocId,
ApplicationType: element.ApplicationId
}
}
},
attachments: [{
"title": element.Assunto,
"description": element.Assunto,
"title_link_download": true,
"type": "webtrix",
"text": element.Assunto,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
})
});
}, 500)
} else {
this.toastService._badRequest('Existe um grupo com este nome!');
}
this.wsChatMethodsService.subscribeToRoomUpdate(res.result.rid, res.result);
console.log(res.result.rid)
console.log(this.documents)
this.addGroupMessage.emit(res.result.rid);
this.documents.forEach(element => {
this.wsChatMethodsService.getGroupRoom(res.result.rid).send({
file: {
"name": element.Assunto,
"type": "application/webtrix",
"ApplicationId": element.ApplicationId,
"DocId": element.DocId,
"Assunto": element.Assunto,
},
temporaryData: res,
attachments: [{
"title": element.Assunto,
"description": element.Assunto,
"title_link_download": true,
"type": "webtrix",
"text": element.Assunto,
"thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
}],
})
});
this.wsChatMethodsService.getAllRooms()
}
async addContacts(){
@@ -177,28 +191,8 @@ export class NewGroupPage implements OnInit{
cssClass: 'btn-cancel',
handler:(value:any)=>{
let now = new Date();
this.thedate = new Date(now.getFullYear(), now.getMonth(), now.getDate() + value.days.value, now.getHours() + value.hours.value, now.getMinutes() + value.minutes.value, now.getSeconds(), now.getMilliseconds());
/* let timer = setInterval(() =>{
let difference = this.thedate.getTime() - new Date().getTime();
this._day = Math.floor(difference/(1000*60*60*24));
let c_day = Math.floor(difference/(1000*60*60*24));
let c_hours = Math.floor((difference % (1000*60*60*24)) / (1000*60*60));
let c_minutes = Math.floor((difference % (1000*60*60)) / (1000*60));
let c_seconds = Math.floor((difference % (1000*60)) / 1000);
this.countDownTime = c_day + ":" + c_hours + ":" + c_minutes + ":" + c_seconds ;
if(difference < 0){
clearInterval(timer);
this.countDownTime = "Expired";
}
}) */
this.selectedDuration = [
value.days.value,
@@ -297,7 +291,7 @@ export class NewGroupPage implements OnInit{
]
});
await picker.present();
picker.onDidDismiss().then(async data =>{
picker.onDidDismiss().then(async data => {
let day = await picker.getColumn('days');
let hour = await picker.getColumn('hours');
let minutes = await picker.getColumn('minutes');