mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
add timebomb to mobile view
This commit is contained in:
@@ -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');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user