continue work on opening chat from expediente

This commit is contained in:
tiago.kayaya
2021-12-10 10:32:49 +01:00
parent 89c3db663b
commit 3b34057559
10 changed files with 144 additions and 37 deletions
+39 -1
View File
@@ -5,6 +5,7 @@ import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-d
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
import { ThemeService } from 'src/app/services/theme.service'
import { ChatService } from 'src/app/services/chat.service';
import { ProcessesService } from 'src/app/services/processes.service';
@Component({
selector: 'app-new-group',
@@ -19,6 +20,7 @@ export class NewGroupPage implements OnInit {
selectedDuration = ['','',''];
thedate:any;
groupName:string;
documents:any;
constructor(
private pickerController: PickerController,
@@ -27,15 +29,18 @@ export class NewGroupPage implements OnInit {
private navParams: NavParams,
public ThemeService: ThemeService,
private chatService: ChatService,
private processesService: ProcessesService,
)
{
this.isGroupCreated = false;
this.groupName = this.navParams.get('name');
this.documents = this.navParams.get('documents');
}
ngOnInit() {
console.log(this.documents);
}
_ionChange(event){
this.showDuration = event.detail.checked;
@@ -73,6 +78,39 @@ export class NewGroupPage implements OnInit {
this.isGroupCreated = true;
this.addContacts(res['group']);
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();
});
}
});
}