mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
continue work on opening chat from expediente
This commit is contained in:
@@ -3,6 +3,7 @@ import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angu
|
||||
import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular';
|
||||
import { ChatService } from 'src/app/services/chat.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 { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
|
||||
|
||||
@@ -22,6 +23,7 @@ export class NewGroupPage implements OnInit{
|
||||
countDownTime:any;
|
||||
//groupName:string;
|
||||
task:any;
|
||||
documents: any;
|
||||
|
||||
@Input() groupName:string;
|
||||
@Output() addGroupMessage:EventEmitter<any> = new EventEmitter<any>();
|
||||
@@ -32,31 +34,37 @@ export class NewGroupPage implements OnInit{
|
||||
private modalController: ModalController,
|
||||
private chatService: ChatService,
|
||||
private dataService:DataService,
|
||||
private processesService: ProcessesService,
|
||||
)
|
||||
{
|
||||
this.isGroupCreated = false;
|
||||
//this.groupName = this.navParams.get('name');
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if(this.dataService.get("newGroup")){
|
||||
//alert(this.dataService.get("newGroup"))
|
||||
setTimeout(() => {
|
||||
//alert(this.dataService.get("newGroup"))
|
||||
}, 100)
|
||||
if(this.dataService.get("newGroup") == true){
|
||||
this.task = this.dataService.get("task");
|
||||
this.groupName = this.task.Folio;
|
||||
this.documents = this.dataService.get("documents");
|
||||
}
|
||||
console.log(this.task);
|
||||
|
||||
}
|
||||
|
||||
/* ngOnDestroy(){
|
||||
alert('Destroy')
|
||||
this.dataService.set("newGroup", false);
|
||||
this.dataService.set("task", null);
|
||||
this.dataService.set("newGroupName", '');
|
||||
} */
|
||||
|
||||
_ionChange(event){
|
||||
console.log(event);
|
||||
console.log(event.detail.checked);
|
||||
this.showDuration = event.detail.checked;
|
||||
this.showDuration = event.detail.checked;
|
||||
|
||||
if(event.detail.checked){
|
||||
this.thedate = new Date();
|
||||
@@ -90,6 +98,43 @@ export class NewGroupPage implements OnInit{
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
|
||||
if(this.documents.length > 0){
|
||||
//If there is documents add
|
||||
this.documents.forEach(async document => {
|
||||
|
||||
let url = await this.processesService.GetDocumentUrl(document.DocId, document.ApplicationId).toPromise();
|
||||
let url_no_options: string = url.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
|
||||
let body = {
|
||||
"message":
|
||||
{
|
||||
"rid": res['group']._id,
|
||||
"msg": "",
|
||||
"attachments": [{
|
||||
"title": document.Assunto,
|
||||
"description": document.DocTypeDesc,
|
||||
"title_link": url_no_options,
|
||||
"title_link_download": true,
|
||||
//"thumb_url": "assets/images/webtrix-logo.png",
|
||||
"message_link": url_no_options,
|
||||
"type": "webtrix"
|
||||
}],
|
||||
"file":{
|
||||
"name": document.Assunto,
|
||||
"type": "application/webtrix",
|
||||
"ApplicationId": document.ApplicationType,
|
||||
"DocId": document.Id,
|
||||
"Assunto": document.Assunto,
|
||||
}
|
||||
}
|
||||
}
|
||||
this.chatService.sendMessage(body).toPromise();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user