This commit is contained in:
ivan gomes
2021-11-16 16:00:14 +01:00
parent 24c07e3dea
commit 0bc7bfa21d
501 changed files with 7317 additions and 4966 deletions
@@ -3,14 +3,15 @@
<div class="main-header">
<div class="title-content width-100">
<div class="back-icon">
<button class="btn-no-color" (click)="close()">
<ion-icon slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
<button class="btn-no-color cursor-pointer" (click)="close()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
</button>
</div>
<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>
@@ -68,7 +68,7 @@
--border-radius: 5px;
--box-shadow: none;
overflow: auto;
--icon-color:#0d89d1;
--icon-color: var(--font-awesome);
}
}
@@ -120,14 +120,14 @@
}
.members-checkbox ion-checkbox{
--border-color: #0d89d1;
--background-checked:#0d89d1;
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
.item-checkbox ion-checkbox{
--border-color: #0d89d1;
--background-checked:#0d89d1;
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
@@ -137,7 +137,7 @@
width: 330px;
padding-left: 10px;
font-size: 15px;
color: #0d89d1;
color: var(--title-text-color);
float: left;
}
.item-checkbox ion-icon, .members-checkbox ion-icon{
@@ -6,6 +6,7 @@ import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
import { NewGroupPage } from '../../new-group/new-group.page';
import { GroupMessagesPage } from '../group-messages.page';
import { ThemeService } from 'src/app/services/theme.service'
@Component({
selector: 'app-group-contacts',
@@ -37,6 +38,7 @@ export class GroupContactsPage implements OnInit {
private chatService: ChatService,
private authService: AuthService,
private navParams: NavParams,
public ThemeService: ThemeService
)
{
this.loggedUser = authService.ValidatedUserChat['data'];
@@ -57,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,
@@ -119,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];
@@ -133,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();
@@ -141,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;
}
@@ -192,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
@@ -6,7 +6,7 @@
<div class="left">
<button class="btn-no-color" (click)="close()">
<!-- <ion-icon slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon> -->
<fa-icon icon="chevron-left" class="header-top-btn"></fa-icon>
<fa-icon icon="chevron-left" class="header-top-btn font-awesome-1"></fa-icon>
</button>
</div>
<div class="middle-container" *ngIf="!showMessageOptions">
@@ -20,13 +20,14 @@
<div class="right">
<button class="btn-no-color" (click)="openOptions()">
<!-- <ion-icon src="assets/images/icons-menu.svg"></ion-icon> -->
<fa-icon icon="ellipsis-v" class="header-top-btn"></fa-icon>
<fa-icon icon="ellipsis-v" class="header-top-btn font-awesome-1"></fa-icon>
</button>
</div>
</div>
<div (click)="addContacts()" class="header-bottom">
<div class="header-bottom-icon">
<ion-icon src="assets/icon/icons-user.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/icon/icons-user.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/icon/theme/gov/icons-user.svg"></ion-icon>
</div>
<div class="header-bottom-contacts">
<ion-label class="contacts-list" *ngFor="let member of members" >
@@ -34,6 +35,10 @@
</ion-label>
</div>
</div>
<div *ngIf="roomCountDownDate" 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">{{roomCountDownDate}}</ion-label>
</div>
</div>
</ion-toolbar>
</ion-header>
@@ -124,7 +129,8 @@
<div class="container width-100 d-flex">
<div>
<button class="btn-no-color" (click)="openChatOptions()">
<ion-icon class="chat-icon-options" src="assets/images/icons-add-new-event.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-options" src="assets/images/icons-add.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-options" src="assets/images/theme/gov/icons-add.svg"></ion-icon>
</button>
</div>
<div class="message-box width-80">
@@ -137,10 +143,12 @@
</div>
<div>
<button *ngIf="message" class="btn-no-color" (click)="sendMessage()">
<ion-icon class="chat-icon-send" src="assets/icon/icons-chat-send.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send" src="assets/icon/icons-chat-send.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
</button>
<button *ngIf="!message" class="btn-no-color">
<ion-icon class="chat-icon-send" src="assets/icon/icons-chat-send.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-send.svg"></ion-icon>
</button>
</div>
</div>
@@ -133,7 +133,7 @@
display: flex;
width: fit-content;
height: auto;
background: #fef4c5;
background: var(--chat-alert-msg-color);
text-align: center;
font-size: 13px;
color: #262420;
@@ -202,11 +202,11 @@
}
.incoming-false{
margin: 10px 20px 10px 75px;
background: #e4f4fe;
background: var(--chat-incoming-msg-color);
float: right;
}
.title{
color: #0782c9;
color: var(--title-text-color);
font-weight: bold;
margin-bottom: 5px;
@@ -19,6 +19,7 @@ import { environment } from 'src/environments/environment';
import { NewEventPage } from '../../agenda/new-event/new-event.page';
import { EventPerson } from 'src/app/models/eventperson.model';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'
@Component({
selector: 'app-group-messages',
@@ -55,6 +56,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
longPressActive = false;
showMessageOptions = false;
selectedMsgId:string;
roomCountDownDate:any;
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
@@ -73,6 +75,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
private fileToBase64Service: FileToBase64Service,
private fileService: FileService,
private toastService: ToastService,
public ThemeService: ThemeService
) {
this.loggedUserChat = authService.ValidatedUserChat['data'];
this.isGroupCreated = true;
@@ -123,6 +126,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
ngAfterViewInit() {
this.scrollChangeCallback = () => this.onContentScrolled(event);
window.addEventListener('scroll', this.scrollChangeCallback, true);
this.roomCountDownDate = this.timeService.countDownDate(this.room.customFields.countDownDate, this.room._id);
}
handlePress(id?:string){
@@ -180,6 +184,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
this.room = room['room'];
this.roomName = this.room.name.split('-').join(' ');
if(this.room.customFields.countDownDate){
this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id);
}
this.getGroupContacts(this.room);
this.loadGroupMessages(this.room);
this.showLoader = false;
@@ -252,33 +259,10 @@ 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){
this.roomCountDownDate = this.timeService.countDownDate(date, roomId);
return this.timeService.countDownDateTimer(date, roomId);
}
addZero(i) {