add timebomb to mobile view

This commit is contained in:
tiago.kayaya
2021-10-28 15:40:41 +01:00
parent 2b442e76db
commit bccb4ed0d5
12 changed files with 151 additions and 169 deletions
@@ -11,7 +11,11 @@
<div class="middle">
<ion-label class="title">Novo Grupo</ion-label>
</div>
<app-btn-seguinte *ngIf="groupName" (click)="addContacts()"></app-btn-seguinte>
<div *ngIf="groupName">
<button class="btn-no-color btn-criar" (click)="createGroup()">
<ion-label>Criar grupo</ion-label>
</button>
</div>
</div>
</div>
</ion-toolbar>
@@ -22,7 +26,7 @@
<div class="item-container">
<ion-input [(ngModel)]="groupName" placeholder="Título"></ion-input>
</div>
<div *ngIf="false" class="item-container-no-border">
<div class="item-container-no-border">
<ion-checkbox (ionChange)="_ionChange($event)" color="primary"></ion-checkbox>
<ion-label>Grupo Ultra-secreto</ion-label>
</div>
@@ -37,6 +41,6 @@
</div>
</div>
</div>
</div>
</div>
</ion-content>
@@ -32,7 +32,7 @@ ion-content{
float: right;
margin-right: 10px;
}
}
.main-header{
width: 100%; /* 400px */
@@ -45,7 +45,7 @@ ion-content{
padding: 30px 20px 0px 20px;
color:#000;
transform: translate3d(0, 1px, 0);
.title-content{
margin: 0px auto;
overflow: auto;
@@ -64,6 +64,13 @@ ion-content{
width: 221px;
margin: 2.5px 0 0 5px;
}
.btn-criar{
padding: 0!important;
float: right;
font-size: 15px;
color: var(--font-awesome);
margin: 8px 5px 0 5px;
}
.right{
padding: 0!important;
float: right;
@@ -87,8 +94,8 @@ ion-content{
float: right;
padding-left: 20px;
}
}
.main-content{
width: 100%; /* 400px */
+55 -19
View File
@@ -4,6 +4,7 @@ import { ModalController, NavParams, PickerController, PopoverController } from
import { GroupDurationPage } from 'src/app/shared/popover/group-duration/group-duration.page';
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';
@Component({
selector: 'app-new-group',
@@ -16,6 +17,7 @@ export class NewGroupPage implements OnInit {
displayDuration: any;
showDuration: boolean;
selectedDuration = ['','',''];
thedate:any;
groupName:string;
constructor(
@@ -23,9 +25,10 @@ export class NewGroupPage implements OnInit {
private popoverController: PopoverController,
private modalController: ModalController,
private navParams: NavParams,
public ThemeService: ThemeService
)
{
public ThemeService: ThemeService,
private chatService: ChatService,
)
{
this.isGroupCreated = false;
this.groupName = this.navParams.get('name');
}
@@ -35,24 +38,54 @@ export class NewGroupPage implements OnInit {
}
_ionChange(event){
this.showDuration = event.detail.checked;
if(event.detail.checked){
this.thedate = new Date();
}
else{
this.thedate = '';
}
}
close(){
this.modalController.dismiss();
}
async addContacts(){
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.addGroupMessage.emit(res['group']._id);
if(this.thedate){
let countDownBody = {
"roomId": res['group']._id,
"customFields":{"countDownDate":this.thedate}
}
this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{
console.log(res);
});
}
this.isGroupCreated = true;
this.addContacts(res['group']);
});
}
async addContacts(room){
this.close();
let name = this.groupName.split(' ').join('-');
console.log(name);
const modal = await this.modalController.create({
component: GroupContactsPage,
componentProps: {
isCreated:this.isGroupCreated,
name: name,
duration:'',
},
room: room,
},
cssClass: 'contacts',
backdropDismiss: false
});
@@ -60,7 +93,7 @@ export class NewGroupPage implements OnInit {
await modal.present();
modal.onDidDismiss();
}
async setDuration(ev: any) {
const popover = await this.popoverController.create({
component: GroupDurationPage,
@@ -75,14 +108,17 @@ export class NewGroupPage implements OnInit {
const picker = await this.pickerController.create({
cssClass: '',
buttons: [
{
{
text: 'Cancelar', role: 'cancel', cssClass: 'btn-cancel'
},
{
text: 'Ok',
{
text: 'Ok',
cssClass: 'btn-cancel',
handler:(value:any)=>{
console.log('button done pressed');
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());
this.selectedDuration = [
value.days.value,
value.hours.value,
@@ -93,24 +129,24 @@ export class NewGroupPage implements OnInit {
if(value.days.value > 0){
if(value.days.value == 1){
if(value.hours.value == 1){
this.displayDuration = value.days.value + " day " +
this.displayDuration = value.days.value + " day " +
value.hours.value + " hora " +
value.minutes.value + " minutos";
}
else{
this.displayDuration = value.days.value + " days " +
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 " +
this.displayDuration = value.days.value + " days " +
value.hours.value + " hora " +
value.minutes.value + " minutos";
}
else{
this.displayDuration = value.days.value + " days " +
this.displayDuration = value.days.value + " days " +
value.hours.value + " horas " +
value.minutes.value + " minutos";
}
@@ -126,7 +162,7 @@ export class NewGroupPage implements OnInit {
value.minutes.value + " minutos";
}
}
}
}
},
},
],
@@ -180,7 +216,7 @@ export class NewGroupPage implements OnInit {
await picker.present();
picker.onDidDismiss().then(async data =>{
let day = await picker.getColumn('days');
let hour = await picker.getColumn('hours');
let hour = await picker.getColumn('hours');
let minutes = await picker.getColumn('minutes');
});