mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
add timebomb to mobile view
This commit is contained in:
@@ -379,7 +379,7 @@ hideRefreshButton(){
|
||||
async getDirectMessages(event?){
|
||||
|
||||
this.chatService.getAllDirectMessages().subscribe(async (res:any)=>{
|
||||
console.log(res.ims);
|
||||
//console.log(res.ims);
|
||||
|
||||
if(res != 200){
|
||||
//console.log(res.ims);
|
||||
@@ -433,7 +433,7 @@ hideRefreshButton(){
|
||||
|
||||
async getGroups(event?){
|
||||
this.result = this.chatService.getAllPrivateGroups().subscribe(async (res:any)=>{
|
||||
console.log(res);
|
||||
//console.log(res);
|
||||
if(res.groups != 200){
|
||||
|
||||
this.privateGroups = res.groups;
|
||||
@@ -445,7 +445,7 @@ hideRefreshButton(){
|
||||
var dateB = new Date(b._updatedAt).getTime();
|
||||
return dateB - dateA;
|
||||
});
|
||||
console.log(this.allGroups);
|
||||
//console.log(this.allGroups);
|
||||
/* }); */
|
||||
if(this.route.url != "/home/chat"){
|
||||
console.log("Timer message stop")
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<div class="div-title">
|
||||
<ion-label class="title">Contactos</ion-label>
|
||||
</div>
|
||||
<app-btn-seguinte (click)="createGroup()"></app-btn-seguinte>
|
||||
<app-btn-seguinte (click)="updateGroup()"></app-btn-seguinte>
|
||||
</div>
|
||||
</div>
|
||||
</ion-toolbar>
|
||||
|
||||
@@ -59,42 +59,6 @@ export class GroupContactsPage implements OnInit {
|
||||
console.log(this.isGroupCreated);
|
||||
}
|
||||
|
||||
deleteMember(data:any){
|
||||
let body = {
|
||||
"roomId": this.room._id,
|
||||
"userId": data._id,
|
||||
}
|
||||
console.log(body);
|
||||
if(this.room.t == "p"){
|
||||
this.chatService.removeGroupMember(body).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.getMembers();
|
||||
});
|
||||
}
|
||||
else if(this.room.t == "c"){
|
||||
this.chatService.removeChannelMember(body).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.getMembers();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
getMembers(){
|
||||
if(this.room.t == "p"){
|
||||
this.chatService.getGroupMembers(this.room._id).subscribe(res=>{
|
||||
this.members = res['members'];
|
||||
this.loadUsers();
|
||||
});
|
||||
}
|
||||
else if(this.room.t == "c"){
|
||||
this.chatService.getChannelMembers(this.room._id).subscribe(res=>{
|
||||
this.members = res['members'];
|
||||
this.loadUsers();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
loadUsers(){
|
||||
this.options = {
|
||||
headers: this.headers,
|
||||
@@ -121,6 +85,21 @@ export class GroupContactsPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
getMembers(){
|
||||
if(this.room.t == "p"){
|
||||
this.chatService.getGroupMembers(this.room._id).subscribe(res=>{
|
||||
this.members = res['members'];
|
||||
this.loadUsers();
|
||||
});
|
||||
}
|
||||
else if(this.room.t == "c"){
|
||||
this.chatService.getChannelMembers(this.room._id).subscribe(res=>{
|
||||
this.members = res['members'];
|
||||
this.loadUsers();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
separateLetter(record, recordIndex, records){
|
||||
if(recordIndex == 0){
|
||||
return record.name[0];
|
||||
@@ -135,6 +114,27 @@ export class GroupContactsPage implements OnInit {
|
||||
return null;
|
||||
}
|
||||
|
||||
deleteMember(data:any){
|
||||
let body = {
|
||||
"roomId": this.room._id,
|
||||
"userId": data._id,
|
||||
}
|
||||
console.log(body);
|
||||
if(this.room.t == "p"){
|
||||
this.chatService.removeGroupMember(body).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.getMembers();
|
||||
});
|
||||
}
|
||||
else if(this.room.t == "c"){
|
||||
this.chatService.removeChannelMember(body).subscribe(res=>{
|
||||
console.log(res);
|
||||
this.getMembers();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
doRefresh(ev){
|
||||
this.loadUsers();
|
||||
this.getMembers();
|
||||
@@ -143,26 +143,8 @@ export class GroupContactsPage implements OnInit {
|
||||
|
||||
async close(){
|
||||
this.modalController.dismiss();
|
||||
if(this.isGroupCreated){
|
||||
console.log('go to conversa');
|
||||
}
|
||||
else{
|
||||
this.modalController.dismiss();
|
||||
console.log('go to new group page');
|
||||
const modal = await this.modalController.create({
|
||||
component: NewGroupPage,
|
||||
componentProps: {
|
||||
name:this.groupName,
|
||||
duration:'',
|
||||
},
|
||||
cssClass: 'new-group',
|
||||
backdropDismiss: false,
|
||||
});
|
||||
await modal.present();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
onChange(event){
|
||||
this.textSearch = event.detail.value;
|
||||
}
|
||||
@@ -194,50 +176,21 @@ export class GroupContactsPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
createGroup(){
|
||||
if(!this.isGroupCreated){
|
||||
/* this.close(); */
|
||||
let body = { "name":this.groupName, }
|
||||
this.chatService.addGroup(body).subscribe(res=>{
|
||||
console.log('group created');
|
||||
console.log(res['group']);
|
||||
this.addContacts(res['group']);
|
||||
this.openGroupMessages(res['group']);
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else{
|
||||
updateGroup(){
|
||||
this.chatService.getRoomInfo(this.room._id).subscribe(room=>{
|
||||
this.room = room['room'];
|
||||
this.addContacts(this.room);
|
||||
this.close();
|
||||
/* this.openGroupMessages(this.room); */
|
||||
/* this.chatService.getGroupInfo(this.room._id).subscribe(res=>{
|
||||
console.log(res);
|
||||
|
||||
this.addContacts(res['group']);
|
||||
this.openGroupMessages(res['group']);
|
||||
}) */
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async newGroup(){
|
||||
this.close();
|
||||
const modal = await this.modalController.create({
|
||||
component: NewGroupPage,
|
||||
cssClass: 'new-group',
|
||||
backdropDismiss: false,
|
||||
this.openGroupMessages(room['room']._id);
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async openGroupMessages(room:any){
|
||||
async openGroupMessages(roomId:any){
|
||||
this.close();
|
||||
console.log(roomId);
|
||||
const modal = await this.modalController.create({
|
||||
component: GroupMessagesPage,
|
||||
componentProps: {
|
||||
room: room,
|
||||
roomId: roomId,
|
||||
},
|
||||
cssClass: 'group-messages',
|
||||
backdropDismiss: false
|
||||
|
||||
@@ -35,6 +35,10 @@
|
||||
</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="room.customFields.countDownDate" class="d-flex align-items-center yellow-orange pl-10">
|
||||
<i class="far fa-clock font-15"></i>
|
||||
<ion-label class="font-15 pl-10" color="warning">{{countDownDate(room.customFields.countDownDate, room._id)}}</ion-label>
|
||||
</div>
|
||||
</div>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
@@ -254,33 +254,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
showDateDuration(start:any){
|
||||
return this.timeService.showDateDuration(start);
|
||||
/* let end;
|
||||
end = new Date();
|
||||
start = new Date(start);
|
||||
let customizedDate;
|
||||
|
||||
const totalSeconds = Math.floor((end - (start))/1000);;
|
||||
const totalMinutes = Math.floor(totalSeconds/60);
|
||||
const totalHours = Math.floor(totalMinutes/60);
|
||||
const totalDays = Math.floor(totalHours/24);
|
||||
|
||||
const hours = totalHours - ( totalDays * 24 );
|
||||
const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 );
|
||||
const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 );
|
||||
|
||||
if(totalDays == 0){
|
||||
if(start.getDate() == new Date().getDate()){
|
||||
let time = start.getHours() + ":" + this.addZero(start.getUTCMinutes());
|
||||
return time;
|
||||
}
|
||||
else{
|
||||
return 'Ontem';
|
||||
}
|
||||
}
|
||||
else{
|
||||
let date = start.getDate() + "/" + (start.getMonth()+1) + "/" + start.getFullYear();
|
||||
return date;
|
||||
} */
|
||||
}
|
||||
countDownDate(date:any, roomId:string){
|
||||
return this.timeService.countDownDate(date, roomId);
|
||||
}
|
||||
|
||||
addZero(i) {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ export class TimeService {
|
||||
|
||||
countDownDate(date:any, roomId:string){
|
||||
/* let timer = setInterval(() =>{ */
|
||||
console.log('Show TIMER');
|
||||
let difference = new Date(date).getTime() - new Date().getTime();
|
||||
let c_day = Math.floor(difference/(1000*60*60*24));
|
||||
let c_hours = Math.floor((difference % (1000*60*60*24)) / (1000*60*60));
|
||||
|
||||
@@ -21,12 +21,12 @@
|
||||
<ion-input [(ngModel)]="groupName" placeholder="Título"></ion-input>
|
||||
</div>
|
||||
|
||||
<div *ngIf="true" 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>
|
||||
<!-- *ngIf="showDuration" -->
|
||||
<div class="container-div">
|
||||
|
||||
<div *ngIf="showDuration" class="container-div">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-duration.svg"></ion-icon>
|
||||
@@ -36,11 +36,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ion-label>{{displayDuration}}</ion-label>
|
||||
<br />
|
||||
<ion-label>{{thedate}}</ion-label>
|
||||
<br />
|
||||
<ion-label>{{countDownTime}}</ion-label>
|
||||
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
@@ -42,12 +42,16 @@ export class NewGroupPage implements OnInit {
|
||||
_ionChange(event){
|
||||
console.log(event);
|
||||
console.log(event.detail.checked);
|
||||
this.showDuration = event.detail.checked;
|
||||
|
||||
this.showDuration = event.detail.checked;
|
||||
//this.thedate = new Date(2021, 10, 1, 10, 33, 30, 0);
|
||||
this.thedate = new Date();
|
||||
|
||||
if(event.detail.checked){
|
||||
this.thedate = new Date();
|
||||
}
|
||||
else{
|
||||
this.thedate = '';
|
||||
}
|
||||
}
|
||||
|
||||
close(){
|
||||
//this.modalController.dismiss();
|
||||
console.log('close');
|
||||
@@ -63,13 +67,15 @@ export class NewGroupPage implements OnInit {
|
||||
|
||||
this.addGroupMessage.emit(res['group']._id);
|
||||
|
||||
let countDownBody = {
|
||||
"roomId": res['group']._id,
|
||||
"customFields":{"countDownDate":this.thedate}
|
||||
if(this.thedate){
|
||||
let countDownBody = {
|
||||
"roomId": res['group']._id,
|
||||
"customFields":{"countDownDate":this.thedate}
|
||||
}
|
||||
this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{
|
||||
console.log(res);
|
||||
});
|
||||
}
|
||||
this.chatService.setGroupCustomFields(countDownBody).subscribe(res=>{
|
||||
console.log(res);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -627,6 +627,9 @@ body {
|
||||
--indicator-color: transparent !important;
|
||||
--indicator-color-checked: transparent !important;
|
||||
}
|
||||
.yellow-orange{
|
||||
color: #ffb703 !important;
|
||||
}
|
||||
|
||||
.tribunal {
|
||||
--ion-color-primary: #000;
|
||||
|
||||
Reference in New Issue
Block a user