diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index e4573a5ba..bb288f651 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -39,6 +39,10 @@ const routes: Routes = [
path: 'document-detail',
loadChildren: () => import('./modals/document-detail/document-detail.module').then( m => m.DocumentDetailPageModule)
},
+ {
+ path: 'edit-group',
+ loadChildren: () => import('./shared/chat/edit-group/edit-group.module').then( m => m.EditGroupPageModule)
+ },
/* {
path: 'chat',
diff --git a/src/app/home/home-routing.module.ts b/src/app/home/home-routing.module.ts
index 2cddad43e..8a8e01dc6 100644
--- a/src/app/home/home-routing.module.ts
+++ b/src/app/home/home-routing.module.ts
@@ -229,7 +229,7 @@ const routes: Routes = [
{
path:'',
loadChildren: ()=> import('../modals/document-detail/document-detail.module').then(m => m.DocumentDetailPageModule)
- }
+ },
]
},
]
diff --git a/src/app/pages/chat/chat.module.ts b/src/app/pages/chat/chat.module.ts
index fb3ceaaeb..52cbac45d 100644
--- a/src/app/pages/chat/chat.module.ts
+++ b/src/app/pages/chat/chat.module.ts
@@ -16,6 +16,7 @@ import { ContactsPage } from 'src/app/shared/chat/messages/contacts/contacts.pag
import { NewGroupPage } from 'src/app/shared/chat/new-group/new-group.page';
import { GroupContactsPage } from 'src/app/shared/chat/group-messages/group-contacts/group-contacts.page';
import { PipesModule } from 'src/app/pipes/pipes.module';
+import { EditGroupPage } from 'src/app/shared/chat/edit-group/edit-group.page';
@NgModule({
imports: [
@@ -33,6 +34,7 @@ import { PipesModule } from 'src/app/pipes/pipes.module';
ContactsPage,
GroupMessagesPage,
NewGroupPage,
+ EditGroupPage,
GroupContactsPage,
EmptyChatPage,
],
@@ -42,6 +44,7 @@ import { PipesModule } from 'src/app/pipes/pipes.module';
ContactsPage,
GroupMessagesPage,
NewGroupPage,
+ EditGroupPage,
GroupContactsPage,
EmptyChatPage,
]
diff --git a/src/app/pages/chat/chat.page.html b/src/app/pages/chat/chat.page.html
index a53954fc4..5fbd40203 100644
--- a/src/app/pages/chat/chat.page.html
+++ b/src/app/pages/chat/chat.page.html
@@ -98,6 +98,7 @@
+
diff --git a/src/app/pages/chat/chat.page.ts b/src/app/pages/chat/chat.page.ts
index f93e4b569..7d81992a7 100644
--- a/src/app/pages/chat/chat.page.ts
+++ b/src/app/pages/chat/chat.page.ts
@@ -20,6 +20,7 @@ import { NewGroupPage } from './new-group/new-group.page';
import { NewchatPage } from './newchat/newchat.page';
import { Storage } from '@ionic/storage';
import { AlertService } from 'src/app/services/alert.service';
+import { EditGroupPage } from 'src/app/shared/chat/edit-group/edit-group.page';
@Component({
selector: 'app-chat',
@@ -63,6 +64,7 @@ export class ChatPage implements OnInit {
showMessages=false;
showContacts=false;
showNewGroup=false;
+ showEditGroup=false;
showGroupMessages=false;
showGroupContacts=false;
emptyTextDescription = 'Sem conversa selecionada';
@@ -105,6 +107,7 @@ export class ChatPage implements OnInit {
this.showMessages=false;
this.showContacts=false;
this.showNewGroup=false;
+ this.showEditGroup=false;
this.showGroupMessages=false;
this.showEmptyComponent=false;
this.showGroupContacts=false;
@@ -154,6 +157,17 @@ export class ChatPage implements OnInit {
this.showNewGroup=true;
}
}
+
+ openEditGroupPage(rid) {
+ if( window.innerWidth <= 1024){
+ this.editGroup(rid);
+ }
+ else{
+ this.closeAllDesktopComponents();
+ this.showEditGroup=true;
+ }
+ }
+
openGroupMessagesPage(data) {
console.log('HERE');
@@ -263,6 +277,19 @@ export class ChatPage implements OnInit {
await modal.present();
modal.onDidDismiss();
}
+
+ async editGroup(roomId){
+ const modal = await this.modalController.create({
+ component: EditGroupPage,
+ cssClass: 'edit-group',
+ componentProps: {
+ roomId: roomId,
+ },
+ });
+ await modal.present();
+ modal.onDidDismiss();
+ }
+
async openMessagesModal(roomId:any){
this.closeAllDesktopComponents();
diff --git a/src/app/pages/chat/edit-group/edit-group.page.html b/src/app/pages/chat/edit-group/edit-group.page.html
index 70ef13159..ebba2fd89 100644
--- a/src/app/pages/chat/edit-group/edit-group.page.html
+++ b/src/app/pages/chat/edit-group/edit-group.page.html
@@ -3,7 +3,9 @@
-
+
Alterar assunto
diff --git a/src/app/pages/chat/edit-group/edit-group.page.ts b/src/app/pages/chat/edit-group/edit-group.page.ts
index c267038f5..4a9fd2a85 100644
--- a/src/app/pages/chat/edit-group/edit-group.page.ts
+++ b/src/app/pages/chat/edit-group/edit-group.page.ts
@@ -14,6 +14,7 @@ export class EditGroupPage implements OnInit {
selectedDuration = ['','',''];
groupName:string;
room:any;
+ roomId:string;
constructor(
private modalController: ModalController,
@@ -21,12 +22,19 @@ export class EditGroupPage implements OnInit {
private chatService: ChatService,
private navParams: NavParams,
) {
- this.room = this.navParams.get('room');
- this.groupName = this.room.name.split('-').join(' ');
+ this.roomId = this.navParams.get('roomId');
}
ngOnInit() {
- console.log(this.room);
+ this.getRoomInfo();
+ }
+
+ getRoomInfo(){
+ this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
+ this.room = room['room'];
+ console.log(this.room);
+ this.groupName = this.room.name.split('-').join(' ');
+ });
}
close(){
diff --git a/src/app/pages/chat/group-messages/group-messages.page.html b/src/app/pages/chat/group-messages/group-messages.page.html
index a42f3ea1f..e9dce4ed3 100644
--- a/src/app/pages/chat/group-messages/group-messages.page.html
+++ b/src/app/pages/chat/group-messages/group-messages.page.html
@@ -48,7 +48,7 @@
- Alterou o assunto de para "{{msg.msg.split('-').join(' ')}}"
+ Alterou o assunto para "{{msg.msg.split('-').join(' ')}}"
diff --git a/src/app/shared/chat/edit-group/edit-group-routing.module.ts b/src/app/shared/chat/edit-group/edit-group-routing.module.ts
new file mode 100644
index 000000000..bb3c59158
--- /dev/null
+++ b/src/app/shared/chat/edit-group/edit-group-routing.module.ts
@@ -0,0 +1,17 @@
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { EditGroupPage } from './edit-group.page';
+
+const routes: Routes = [
+ {
+ path: '',
+ component: EditGroupPage
+ }
+];
+
+@NgModule({
+ imports: [RouterModule.forChild(routes)],
+ exports: [RouterModule],
+})
+export class EditGroupPageRoutingModule {}
diff --git a/src/app/shared/chat/edit-group/edit-group.module.ts b/src/app/shared/chat/edit-group/edit-group.module.ts
new file mode 100644
index 000000000..debb5f06d
--- /dev/null
+++ b/src/app/shared/chat/edit-group/edit-group.module.ts
@@ -0,0 +1,22 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { FormsModule } from '@angular/forms';
+
+import { IonicModule } from '@ionic/angular';
+
+import { EditGroupPageRoutingModule } from './edit-group-routing.module';
+
+import { EditGroupPage } from './edit-group.page';
+import { SharedModule } from '../../shared.module';
+
+@NgModule({
+ imports: [
+ CommonModule,
+ FormsModule,
+ IonicModule,
+ SharedModule,
+ EditGroupPageRoutingModule
+ ],
+ declarations: [EditGroupPage]
+})
+export class EditGroupPageModule {}
diff --git a/src/app/shared/chat/edit-group/edit-group.page.html b/src/app/shared/chat/edit-group/edit-group.page.html
new file mode 100644
index 000000000..70ef13159
--- /dev/null
+++ b/src/app/shared/chat/edit-group/edit-group.page.html
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+ Grupo Ultra-secreto
+
+
+
+
+
+
+
diff --git a/src/app/shared/chat/edit-group/edit-group.page.scss b/src/app/shared/chat/edit-group/edit-group.page.scss
new file mode 100644
index 000000000..428f62e08
--- /dev/null
+++ b/src/app/shared/chat/edit-group/edit-group.page.scss
@@ -0,0 +1,151 @@
+ion-content{
+ --background:transparent;
+}
+.header-toolbar{
+ --background:transparent;
+ --opacity: 1;
+}
+.div-top-header{
+ width: 400px;
+ margin: 0 auto;
+ background-color: #0782c9;
+ overflow: auto;
+ padding-top: 15px;
+ border: 0!important;
+
+ .div-search{
+ font-size: 45px;
+ float: left;
+ margin: 0 0 0 10px
+ }
+ .div-logo{
+ background: transparent;
+ width: 140px;
+ margin: 5px 0 0px 71px;
+ float: left;
+ }
+ .div-logo img{
+ width: 100%;
+ }
+ .div-profile{
+ font-size: 45px;
+ float: right;
+ margin-right: 10px;
+ }
+
+ }
+ .main-header{
+ width: 100%; /* 400px */
+ height: 100%;
+ font-family: Roboto;
+ border-top-left-radius: 25px;
+ border-top-right-radius: 25px;
+ background-color: #fff;
+ overflow:hidden;
+ padding: 30px 20px 0px 20px;
+ color:#000;
+ transform: translate3d(0, 1px, 0);
+
+ .title-content{
+ width: 360px;
+ margin: 0px auto;
+ overflow: auto;
+ padding: 0 !important;
+ background: #fff;
+
+ .left{
+ width: 37px;
+ float: left;
+ font-size: 35px;
+ overflow: auto;
+ }
+ .middle{
+ padding: 0!important;
+ float: left;
+ width: 221px;
+ margin: 2.5px 0 0 5px;
+ }
+ .right{
+ padding: 0!important;
+ float: right;
+ font-size: 15px;
+ color: #0782c9;
+ margin: 8px 0 0 5px;
+ }
+ }
+
+ .title{
+ font-size: 25px;
+ }
+ .div-icon{
+ width: 40px;
+ float: right;
+ font-size: 35px;
+ overflow: auto;
+ padding: 1px;
+ }
+ .div-icon ion-icon{
+ float: right;
+ padding-left: 20px;
+ }
+
+
+ }
+ .main-content{
+ width: 100%; /* 400px */
+ height: 100%;
+ font-family: Roboto;
+ margin: 0 auto;
+ background-color: #fff;
+ overflow:auto;
+ padding: 15px 20px 0 20px;
+
+ .item-container{
+ width: 360px;
+ margin: 15px auto;
+ border: 1px solid #ebebeb;
+ border-radius: 5px;
+ padding-left: 10px;
+ }
+
+ .item-container-no-border{
+ display: flex;
+ width: 360px;
+ margin: 25px auto;
+ border-radius: 5px;
+ align-items: center;
+ }
+
+ .item-container-no-border ion-label{
+ padding-left: 10px;
+ font-size: 12px;
+ color: #000;
+ }
+ }
+
+ .container-div{
+ margin-bottom: 15px;
+ overflow: auto;
+
+ .ion-item-class-2{
+ width: 360px;
+ margin: 0px auto;
+
+ .ion-icon-class{
+ width: 45px;
+ height: 45px;
+ float: left;
+ padding: 10px;
+ font-size: 25px;
+ }
+ }
+ .ion-input-class{
+ width: 315px;
+ height: 45px;
+ border: 1px solid #ebebeb;
+ border-radius: 5px;
+ padding-left: 5px;
+ padding-right: 10px;
+ float: left;
+ }
+ }
diff --git a/src/app/shared/chat/edit-group/edit-group.page.spec.ts b/src/app/shared/chat/edit-group/edit-group.page.spec.ts
new file mode 100644
index 000000000..8a4b49569
--- /dev/null
+++ b/src/app/shared/chat/edit-group/edit-group.page.spec.ts
@@ -0,0 +1,24 @@
+import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
+import { IonicModule } from '@ionic/angular';
+
+import { EditGroupPage } from './edit-group.page';
+
+describe('EditGroupPage', () => {
+ let component: EditGroupPage;
+ let fixture: ComponentFixture;
+
+ beforeEach(waitForAsync(() => {
+ TestBed.configureTestingModule({
+ declarations: [ EditGroupPage ],
+ imports: [IonicModule.forRoot()]
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(EditGroupPage);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ }));
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/shared/chat/edit-group/edit-group.page.ts b/src/app/shared/chat/edit-group/edit-group.page.ts
new file mode 100644
index 000000000..328b6df18
--- /dev/null
+++ b/src/app/shared/chat/edit-group/edit-group.page.ts
@@ -0,0 +1,176 @@
+import { Component, Input, OnInit } from '@angular/core';
+import { ModalController, NavParams, PickerController } from '@ionic/angular';
+import { ChatService } from 'src/app/services/chat.service';
+
+@Component({
+ selector: 'app-edit-group',
+ templateUrl: './edit-group.page.html',
+ styleUrls: ['./edit-group.page.scss'],
+})
+export class EditGroupPage implements OnInit {
+ showLoader: boolean;
+ displayDuration: any;
+ showDuration: boolean;
+ selectedDuration = ['','',''];
+ groupName:string;
+ room:any;
+ @Input() roomId:string;
+
+ constructor(
+ private modalController: ModalController,
+ private pickerController: PickerController,
+ private chatService: ChatService,
+ private navParams: NavParams,
+ ) {
+ }
+
+ ngOnInit() {
+ this.getRoomInfo();
+ }
+
+ getRoomInfo(){
+ this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
+ this.room = room['room'];
+ console.log(this.room);
+ this.groupName = this.room.name.split('-').join(' ');
+ });
+ }
+
+ close(){
+ this.modalController.dismiss();
+ }
+
+ changeGroupName(){
+ if(this.groupName.trim().length > 1){
+ let name = this.groupName.split(' ').join('-');
+ let body = {
+ "roomId": this.room._id,
+ "name": name,
+ }
+ this.chatService.renameGroup(body).subscribe(res=>{
+ this.modalController.dismiss(res['group']);
+ });
+ }
+ else{
+ console.log("Invalid name!");
+ }
+ }
+ _ionChange(event){
+ this.showDuration = event.detail.checked;
+ }
+ async showPicker(){
+ const picker = await this.pickerController.create({
+ cssClass: '',
+ buttons: [
+ {
+ text: 'Cancelar', role: 'cancel', cssClass: 'btn-cancel'
+ },
+ {
+ text: 'Ok',
+ cssClass: 'btn-cancel',
+ handler:(value:any)=>{
+ console.log('button done pressed');
+ this.selectedDuration = [
+ value.days.value,
+ value.hours.value,
+ value.minutes.value,
+ ]
+ console.log(this.selectedDuration);
+ if(value.days.value != null && value.hours.value != null && value.minutes.value != null){
+ if(value.days.value > 0){
+ if(value.days.value == 1){
+ if(value.hours.value == 1){
+ this.displayDuration = value.days.value + " day " +
+ value.hours.value + " hora " +
+ value.minutes.value + " minutos";
+ }
+ else{
+ this.displayDuration = value.days.value + " days " +
+ value.hours.value + " horas " +
+ value.minutes.value + " minutos";
+ }
+ }
+ else{
+ if(value.hours.value == 1){
+ this.displayDuration = value.days.value + " days " +
+ value.hours.value + " hora " +
+ value.minutes.value + " minutos";
+ }
+ else{
+ this.displayDuration = value.days.value + " days " +
+ value.hours.value + " horas " +
+ value.minutes.value + " minutos";
+ }
+ }
+ }
+ else{
+ if(value.hours.value == 1){
+ this.displayDuration = value.hours.value + " hora " +
+ value.minutes.value + " minutos";
+ }
+ else{
+ this.displayDuration = value.hours.value + " horas " +
+ value.minutes.value + " minutos";
+ }
+ }
+ }
+ },
+ },
+ ],
+ columns: [
+ {
+ name: 'days',
+ prefix: 'Dias',
+ options: [
+ { text: '0', value: 0 },
+ { text: '1', value: 1 },
+ { text: '2', value: 2 },
+ { text: '3', value: 3 },
+ { text: '4', value: 4 },
+ ]
+ },
+ {
+ name: 'hours',
+ prefix: 'Horas',
+ options: [
+ { text: '0', value: 0 },
+ { text: '1', value: 1 },
+ { text: '2', value: 2 },
+ { text: '3', value: 3 },
+ { text: '4', value: 4 },
+ { text: '5', value: 5 },
+ { text: '6', value: 6 },
+ { text: '7', value: 7 },
+ { text: '8', value: 8 },
+ ]
+ },
+ {
+ name: 'minutes',
+ prefix: 'Minutos',
+ selectedIndex: 3,
+ options: [
+ { text: '0', value: 0 },
+ { text: '5', value: 5 },
+ { text: '10', value: 10 },
+ { text: '15', value: 15 },
+ { text: '20', value: 20 },
+ { text: '25', value: 25 },
+ { text: '30', value: 30 },
+ { text: '35', value: 35 },
+ { text: '45', value: 45 },
+ { text: '50', value: 50 },
+ { text: '55', value: 55 },
+ ]
+ }
+ ]
+ });
+ await picker.present();
+ picker.onDidDismiss().then(async data =>{
+ let day = await picker.getColumn('days');
+ let hour = await picker.getColumn('hours');
+ let minutes = await picker.getColumn('minutes');
+ });
+
+ }
+
+}
diff --git a/src/app/shared/popover/chat-popover/chat-popover.page.ts b/src/app/shared/popover/chat-popover/chat-popover.page.ts
index e44a2188c..0efa50774 100644
--- a/src/app/shared/popover/chat-popover/chat-popover.page.ts
+++ b/src/app/shared/popover/chat-popover/chat-popover.page.ts
@@ -52,8 +52,6 @@ export class ChatPopoverPage implements OnInit {
console.log(res);
});
}
-
-
});
this.popoverController.dismiss(true);
}
@@ -80,7 +78,7 @@ export class ChatPopoverPage implements OnInit {
const modal = await this.modalController.create({
component: EditGroupPage,
componentProps: {
- //room: this.room,
+ roomId: this.roomId,
},
cssClass: 'contacts',
backdropDismiss: false