This commit is contained in:
tiago.kayaya
2021-03-16 14:33:36 +01:00
parent 79310babc8
commit eccad1e333
15 changed files with 159 additions and 50 deletions
@@ -1,6 +1,7 @@
import { analyzeAndValidateNgModules } from '@angular/compiler';
import { Component, Input, OnInit } from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular';
import { ChatService } from 'src/app/services/chat.service';
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
import { GroupContactsPage } from '../group-messages/group-contacts/group-contacts.page';
@@ -18,11 +19,13 @@ export class NewGroupPage implements OnInit {
//groupName:string;
@Input() groupName:string;
@Output() closeAllDesktopComponent = new EventEmitter<any>();
constructor(
private pickerController: PickerController,
private popoverController: PopoverController,
private modalController: ModalController,
private chatService: ChatService,
//private navParams: NavParams,
)
{
@@ -37,7 +40,19 @@ export class NewGroupPage implements OnInit {
this.showDuration = event.detail.checked;
}
close(){
this.modalController.dismiss();
//this.modalController.dismiss();
console.log('close');
this.closeAllDesktopComponent.emit();
}
createGroup(){
let name = this.groupName.split(' ').join('-');
let body = { "name":name, }
this.chatService.addGroup(body).subscribe(res=>{
console.log('group created');
console.log(res['group']);
this.closeAllDesktopComponent.emit(res['group']._id);
});
}
async addContacts(){