fix change folder path

This commit is contained in:
Peter Maquiran
2024-08-16 14:21:01 +01:00
parent bec5104ac8
commit 6072a2456b
114 changed files with 419 additions and 540 deletions
-37
View File
@@ -1,37 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ChatPage } from './chat.page';
import { GroupMessagesPage } from './group-messages/group-messages.page';
import { MessagesPage } from './messages/messages.page';
const routes: Routes = [
{
path: '',
component: ChatPage,
},
{
path: 'new-group',
loadChildren: () => import('./new-group/new-group.module').then( m => m.NewGroupPageModule)
},
{
path: 'group-messages',
loadChildren: () => import('./group-messages/group-messages.module').then( m => m.GroupMessagesPageModule)
},
{
path: 'messages',
outlet:'message',
loadChildren: () => import('./messages/messages.module').then( m => m.MessagesPageModule)
},
{
path: 'edit-group',
loadChildren: () => import('./edit-group/edit-group.module').then( m => m.EditGroupPageModule)
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ChatPageRoutingModule {}
-51
View File
@@ -1,51 +0,0 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ChatPageRoutingModule } from './chat-routing.module';
import { ChatPage } from './chat.page';
import { RouterModule } from '@angular/router';
import { PipesModule } from 'src/app/pipes/pipes.module';
import { ContactsPageModule } from 'src/app/shared/chat/messages/contacts/contacts.module';
import { GroupMessagesPageModule } from 'src/app/shared/chat/group-messages/group-messages.module';
import { NewGroupPageModule } from 'src/app/shared/chat/new-group/new-group.module';
import { EditGroupPageModule } from 'src/app/shared/chat/edit-group/edit-group.module';
import { GroupContactsPageModule } from 'src/app/shared/chat/group-messages/group-contacts/group-contacts.module';
import { MessagesPageModule } from 'src/app/shared/chat/messages/messages.module';
import { EmptyChatPageModule } from 'src/app/shared/chat/empty-chat/empty-chat.module';
import { NewEventPageModule } from 'src/app/shared/agenda/new-event/new-event.module';
import { AttendeeModalPageModule } from 'src/app/shared/event/attendee-modal/attendee-modal.module';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { ImageCropperModule } from 'ngx-image-cropper';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
FontAwesomeModule,
PipesModule,
ChatPageRoutingModule,
RouterModule,
MessagesPageModule,
ContactsPageModule,
GroupMessagesPageModule,
NewGroupPageModule,
EditGroupPageModule,
GroupContactsPageModule,
EmptyChatPageModule,
NewEventPageModule,
ImageCropperModule,
AttendeeModalPageModule,
],
declarations: [
ChatPage
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
entryComponents: []
})
export class ChatPageModule {}
-188
View File
@@ -1,188 +0,0 @@
<ion-content class="height-100 container-wrapper">
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-content d-flex height-100 border-t-radius viewport-font-size">
<!-- Aside left -->
<div class="aside-wrapper d-flex flex-column flex-grow-1">
<!-- <p class="text-center mt-0 aside-title px-20">Chat</p> -->
<!-- <ion-progress-bar type="indeterminate" ></ion-progress-bar> -->
<div class="title-content">
<div class="div-title">
<ion-label class="title font-25-em">Chat</ion-label>
</div>
<div class="div-icon">
<button title="Nova Conversa Individual" class="btn-no-color" (click)="openContactsPage()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src="assets/images/icons-chat-new-conversation.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src="assets/images/theme/gov/icons-chat-new-conversation.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " slot="end" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-chat-new-conversation.svg"></ion-icon>
</button>
<button title="Novo Grupo" class="btn-no-color" (click)="openNewGroupPage()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="end" src="assets/images/icons-chat-new-group.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src="assets/images/theme/gov/icons-chat-new-group.svg" ></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " slot="end" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-chat-new-group.svg" ></ion-icon>
</button>
</div>
</div>
<!-- <ion-toolbar [class.block-button]="showNewEvent || showNewGroup || showContacts">
<ion-segment [(ngModel)]="segment" (ionChange)="onSegmentChange()">
<ion-segment-button value="Contactos" class="font-14-em">
Conversas
</ion-segment-button>
<ion-segment-button value="Grupos" class="font-14-em">
Grupos
</ion-segment-button>
</ion-segment>
</ion-toolbar> -->
<div class=" aside overflow-y-auto d-flex flex-wrap flex-grow-1">
<div class="width-100" [ngSwitch]="segment">
<ion-list *ngSwitchCase="'Contactos'">
<ion-item-sliding>
<div class="item item-hover width-100 d-flex ion-no-padding ion-no-margin"
*ngFor="let room of (items$ | async)"
[class.item-active]="room.id == idSelected">
<div class="item-icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && room.id != idSelected " class="icon" slot="start" src="assets/images/theme/gov/icons-chat-chat-40.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && room.id == idSelected " class="icon" slot="start" src="assets/images/theme/gov/icons-chat-chat-40-hover.svg"></ion-icon>
</div>
<div
(click)="openMessagesPage(room.id)"
class="item-content flex-grow-1 cursor-pointer"><!-- (click)="openMessages(dm)" -->
<div class="item-title-time">
<div class="item-title" [class.item-title-active]="room.id == idSelected">
<ion-label >
<span >
<div >
<div class="font-15-em" [class.bold-message]="true">
{{room.roomName}}
</div>
</div>
</span>
</ion-label>
</div>
<!-- <div class="item-date font-13-em" [class.item-date-active]="room.id == idSelected">{{room.duration}}</div> -->
</div>
<!-- <div *ngIf="room.lastMessage" class="item-description d-flex align-items-center" [class.item-description-active]="room.id ==idSelected">
<div class="item-message font-13-em add-ellipsis white-space-nowrap" *ngIf="room.otherUserType == false"> {{room.lastMessage.msg}} </div>
<div class="font-13-em" *ngIf="room.otherUserType == true">está escrever ...</div>
</div> -->
</div>
</div>
</ion-item-sliding>
</ion-list>
<ion-list *ngSwitchCase="'Grupos'">
<ion-item-sliding>
<div class="item item-hover width-100 d-flex ion-no-padding ion-no-margin"
*ngFor="let room of (items$ | async)"
[class.item-active]="room.id == idSelected">
<div class="item-icon">
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && room.id != idSelected " class="icon" slot="start" src="assets/images/theme/gov/icons-chat-chat-40.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && room.id == idSelected " class="icon" slot="start" src="assets/images/theme/gov/icons-chat-chat-40-hover.svg"></ion-icon>
</div>
<div
(click)="openMessagesPage(room.id)"
class="item-content flex-grow-1 cursor-pointer"><!-- (click)="openMessages(dm)" -->
<div class="item-title-time">
<div class="item-title" [class.item-title-active]="room.id == idSelected">
<ion-label >
<span >
<div >
<div class="font-15-em" [class.bold-message]="true">
{{room.roomName}}
</div>
</div>
</span>
</ion-label>
</div>
<!-- <div class="item-date font-13-em" [class.item-date-active]="room.id == idSelected">{{room.duration}}</div> -->
</div>
<!-- <div *ngIf="room.lastMessage" class="item-description d-flex align-items-center" [class.item-description-active]="room.id ==idSelected">
<div class="item-message font-13-em add-ellipsis white-space-nowrap" *ngIf="room.otherUserType == false"> {{room.lastMessage.msg}} </div>
<div class="font-13-em" *ngIf="room.otherUserType == true">está escrever ...</div>
</div> -->
</div>
</div>
</ion-item-sliding>
</ion-list>
</div>
<!-- <button (click)="sendMsg()" style="height: 41px;">Send message</button> -->
</div>
</div>
<!-- Aside right -->
<div class="aside-content d-none flex-column height-100">
<app-empty-chat [texto]="emptyTextDescription"
class="height-100 flex-column"
[style.display]="showEmptyComponent && !showContacts && !showNewGroup && !showEditGroup && !showGroupContacts && !showGroupMessages && !showNewEvent ? 'flex' : 'none'"
#messagecontainer>
</app-empty-chat>
<app-messages class=" height-100 flex-column"
*ngIf="showMessages"
[style.display]="showMessages ? 'flex' : 'none'"
(closeAllDesktopComponents)="closeAllDesktopComponents()"
(showEmptyContainer)="showEmptyContainer()"
(showEmptyContainer)="showEmptyContainer()"
(openNewEventPage)="openNewEventPage($event)"
(openGroupContacts)="openGroupContactsPage($event)"
(openEditGroupPage)="openEditGroupPage($event)"
[style.display]="showMessages ? 'flex' : 'none'"
[roomId]="roomId"
[showMessages]="showMessages" #messagecontainer>
</app-messages>
<app-contacts
(openMessage)="openMessagesPage($event)"
(backToChat)="backToChat($event)"
(emptyTextDescriptionOpen)="emptyTextDescriptionOpen()"
(closeAllDesktopComponents)="closeAllDesktopComponents()"
*ngIf="showContacts"
[roomId]="roomId"
[style.display]="showContacts ? 'flex' : 'none'"
class=" height-100 flex-column">
</app-contacts>
<app-new-group
(addGroupMessage)="openGroupContactsPage($event)"
[roomId]="roomId"
(backToChat)="backToChat($event)"
(closeAllDesktopComponents)="closeAllDesktopComponents()"
(openGroupContacts)="openGroupContactsPage($event)"
(openEditGroupPage)="openEditGroupPage($event)"
*ngIf="showNewGroup"
class=" height-100 flex-column d-flex">
</app-new-group>
<app-edit-group [roomId]="roomId"
(closeAllDesktopComponents)="closeAllDesktopComponents()"
(openGroupMessage)="openGroupMessagesPage($event)"
*ngIf="showEditGroup"
[style.display]="showEditGroup ? 'flex' : 'none'"
class="height-100 flex-column">
</app-edit-group>
<app-group-contacts
(openGroupMessage)="openGroupMessagesPage($event)"
*ngIf="showGroupContacts"
[style.display]="showGroupContacts ? 'flex' : 'none'"
[roomId]="groupRoomId" class=" height-100 flex-column"
(backToChat)="backToChat($event)"
>
</app-group-contacts>
</div>
</div>
</ion-content>
-189
View File
@@ -1,189 +0,0 @@
@import '~src/function.scss';
ion-content{
--background: transparent;
}
:host{
// background: #0782c9;
}
.title-content{
width: 100%;
margin-bottom: 15px;
padding: 0 !important;
background: #fff;
.div-title{
padding: 0!important;
float: left;
}
.div-icon{
display: flex;
width: fit-content;
float: right;
font-size: em(35);
overflow: auto;
padding: 1px;
justify-content: flex-end;
}
.div-icon ion-icon{
float: right;
padding-left: 20px;
}
}
.main-content{
font-family: Roboto;
margin: 0 auto;
background-color: #fff;
overflow: auto;
.aside-wrapper{
margin: 0 !important;
overflow: auto;
.title-content{
padding: 30px 20px 0 20px !important;
}
.aside{
padding: 0 !important;
overflow: auto;
}
}
.iconschatnew-group{
width: rem(30);
height: 30px;
object-fit: contain;
margin: 0 5px 0 5px;
}
.iconschatnew-conversation{
width: rem(30);
height: 30px;
object-fit: contain;
margin: 0 5px 0 5px;
}
}
.item{
width: 100%;
border-bottom: 1px solid #ebebeb;
padding: 0px 20px 0 20px !important;
overflow: hidden;
display: flex;
.item-icon{
width: em(40);
float: left;
.icon{
margin-top: 10px;
font-size: em(40);
}
}
.item-content{
//width: 317px;
float:right;
width: 88%;
}
.item-title-time{
width: 100%;
overflow: auto;
margin-top: 10px;
display: flex;
justify-content: space-between;
}
.item-title{
float: left;
color: var(--title-text-color);
}
.item-title-active{
color: #fff;
}
.item-date{
float: right;
color: #797979;
text-align: right;
}
.item-date-active{
color: #fff;
}
.item-description{
color: #000;
overflow: auto;
.item-message{
float: left;
padding-right: 5px;
}
.item-files{
float: left;
overflow: auto;
.item-files-title{
width: 100%;
}
}
}
.item-description-active{
color: #fff;
}
}
.item-active{
color: #fff !important;
background-color: var(--gabinete-active-hove-background) !important;
}
@media only screen and (min-width: 701px) {
.main-content{
.aside-wrapper{
width: 35%;
border-right: 1px solid #d8d8d8;
.aside-title{
font-size: em(25);
}
}
/* .aside{
width: 340px;
} */
.aside-content{
width: 65%;
display: flex !important;
background-color: white;
}
.item{
.item-icon{
width: 10%;
margin-right: 10px !important;
}
.item-content{
width: 90%;
}
}
}
}
.highlight {
color: #fff !important;
background-color: #42b9fe !important;
}
.bold-message {
font-weight: bold;
}
.block-button {
pointer-events: none;
opacity: 0.2;
}
-24
View File
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ChatPage } from './chat.page';
describe('ChatPage', () => {
let component: ChatPage;
let fixture: ComponentFixture<ChatPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ChatPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ChatPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
-556
View File
@@ -1,556 +0,0 @@
import { HttpHeaders, HttpParams } from '@angular/common/http';
import {
Component,
OnInit,
ViewChild,
ViewContainerRef,
Output,
} from '@angular/core';
import { ModalController } from '@ionic/angular';
import { ChatService } from 'src/app/services/chat.service';
import { GroupMessagesPage } from './group-messages/group-messages.page';
import { ContactsPage } from './messages/contacts/contacts.page';
import { MessagesPage } from './messages/messages.page';
import { NewGroupPage } from './new-group/new-group.page';
import { EditGroupPage } from 'src/app/shared/chat/edit-group/edit-group.page';
import { Observable, Subject } from "rxjs/Rx";
import { Router, NavigationEnd } from '@angular/router';
import { EventPerson } from 'src/app/models/eventperson.model';
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { environment } from 'src/environments/environment';
import { TimeService } from 'src/app/services/functions/time.service';
import { ThemeService } from 'src/app/services/theme.service'
import { DataService } from 'src/app/services/data.service';
import { RouteService } from 'src/app/services/route.service';
import { RoomRemoteDataSourceState } from 'src/app/module/chat/data/data-source/room/room-memory-data-source';
import { RoomListOutPutDTO } from 'src/app/module/chat/data/dto/room/roomListOutputDTO';
import { RoomRepositoryService } from 'src/app/module/chat/data/repository/room-repository.service'
import { Observable as DexieObservable } from 'Dexie';
import { Logger } from 'src/app/services/logger/main/service';
@Component({
selector: 'app-chat',
templateUrl: './chat.page.html',
styleUrls: ['./chat.page.scss'],
})
export class ChatPage implements OnInit {
showLoader: boolean;
headers: HttpHeaders;
options: any;
X_User_Id: any;
X_Auth_Token: any;
loggedUser: any;
segment: string = 'Grupos'
allGroups: any[];
privateGroups: any[];
userConnectedList: any[];
userRooms: any[];
userChannels: any[];
userDirectMessages: any[];
result: any;
dmUsers: any[] = [];
idSelected: string;
desktopComponent: any = {
showMessages: false,
showGroupMessages: false,
}
@ViewChild('messagecontainer', { read: ViewContainerRef }) entry: ViewContainerRef;
componentRef: any;
roomId: any;
task: any;
groupRoomId: any;
showEmptyComponent = true;
showMessages = false;
showContacts = false;
showNewGroup = false;
showEditGroup = false;
showGroupMessages = false;
showGroupContacts = false;
showNewEvent = false;
showAttendees = false;
emptyTextDescription = 'Sem conversa selecionada';
@Output() getRoomInfo;
subject: any;
public messages: Subject<any>;
message = {
"msg": "connect",
"version": "1",
"support": ["1"]
};
loggedUserChat: any;
hideRefreshBtn = true;
taskParticipants: any = [];
taskParticipantsCc: any = [];
adding: "intervenient" | "CC" = "intervenient";
profile: 'mdgpr' | 'pr';
eventSelectedDate: Date = new Date();
contacts: EventPerson[];
showEventEditOrOpen: "edit" | "add" | "" | "eventoToApprove" = ""
socket: WebSocket;
receivedData: any;
routerSubscription
count$: Observable<RoomRemoteDataSourceState>;
items$!: DexieObservable<RoomListOutPutDTO[]>;
constructor(
private chatService: ChatService,
private modalController: ModalController,
private timeService: TimeService,
public ThemeService: ThemeService,
private dataService: DataService,
private router: Router,
public RouteService: RouteService,
private RoomRepositoryService: RoomRepositoryService,
) {
this.headers = new HttpHeaders();
window.onresize = (event) => {
if (window.innerWidth > 701) {
this.modalController.dismiss();
}
};
this.showLoader = true;
this.segment = 'Grupos'
}
// Fetch all items using useLiveQuery
ngOnInit() {
this.items$ = this.RoomRepositoryService.getItemsLive()
this.RoomRepositoryService.list();
this.hideRefreshButton();
this.router.events.forEach((event) => {
if (event instanceof NavigationEnd && event.url == '/home/chat' ||
event instanceof NavigationEnd && event.url == "/home/chat?gbCreateGroup=true") {
this.checkCreateGroup();
}
});
this.routerSubscription = this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd && event.url.startsWith('/home/chat')) {
this.routeCheck()
this.RoomRepositoryService.list();
}
});
}
ngOnDestroy() {
// this.setStatus('offline');
this.routerSubscription?.unsubscribe();
}
firstEnter = true
routeCheck() {
const urlParams = new URLSearchParams(window.location.search);
const roomId = urlParams.get('roomId');
if (roomId) {
if (this.firstEnter) {
this.firstEnter = false
let delay = this.RouteService.liveHistory.find((item) => {
return ['/home/publications', '/home/agenda', '/home/gabinete', '/home/events'].filter(x => {
return item.includes(x)
}).length >= 1
})
if (!delay) {
console.log("delay")
setTimeout(() => {
this.openChat(roomId)
}, 2000)
} else {
console.log("no dalay")
this.openChat(roomId)
}
} else {
this.openChat(roomId)
}
}
}
openFailed = 0
openChat(roomId) {
// const room = this.ChatSystemService.getRoomById(roomId);
if (roomId) {
//this.openFailed = 0
//if (room.isGroup) {
// this.segment = 'Grupos'
// this.openGroupMessagesPage(roomId)
//} else {
// this.segment = 'Contactos'
this.openMessagesPage(roomId)
//}
} else {
if (this.openFailed <= 3) {
this.openFailed++
setTimeout(() => {
this.openChat(roomId)
}, 1000)
} else {
this.openFailed = 0
}
}
}
checkCreateGroup() {
if (this.dataService.get("newGroup")) {
this.openNewGroupPage();
}
else {
this.closeAllDesktopComponents();
this.showEmptyComponent = true;
}
}
numSequence(n: number): Array<number> {
return Array(n);
}
setStatus(status: string) {
let body = {
message: '',
status: status,
}
this.chatService.setUserStatus(body).subscribe(res => {
})
}
hideRefreshButton() {
window.onresize = (event) => {
if (window.innerWidth < 701) {
this.idSelected = '';
this.hideRefreshBtn = false;
this.closeAllDesktopComponents()
// this.ChatSystemService.getRoomById(this.roomId)?.roomLeave()
}
else {
this.hideRefreshBtn = true;
if (this.idSelected == '') {
this.showEmptyComponent = true;
}
}
}
if (window.innerWidth < 701) {
this.idSelected = '';
this.hideRefreshBtn = false;
}
}
closeAllDesktopComponents() {
this.showMessages = false;
this.showContacts = false;
this.showNewGroup = false;
this.showEditGroup = false;
this.showGroupMessages = false;
this.showEmptyComponent = false;
this.showGroupContacts = false;
this.showNewEvent = false;
this.showAttendees = false;
}
showEmptyContainer() {
this.idSelected = '';
this.showEmptyComponent = true;
}
openGroupContactsPage(data) {
this.idSelected = '';
this.groupRoomId = data;
this.closeAllDesktopComponents();
if (window.innerWidth < 701) {
}
else {
this.showGroupContacts = true;
}
}
openMessagesPage(rid) {
// this.chatService.refreshtoken();
this.roomId = rid;
if (window.innerWidth < 701) {
this.openMessagesModal(rid);
}
else {
this.idSelected = rid;
this.closeAllDesktopComponents();
this.showEmptyComponent = false;
this.showMessages = true;
}
}
openContactsPage() {
this.segment = 'Contactos';
this.idSelected = '';
this.closeAllDesktopComponents();
if (window.innerWidth < 701) {
this.selectContact();
}
else {
this.showEmptyComponent = false;
this.showContacts = true;
}
}
openNewGroupPage() {
this.segment = 'Grupos';
this.idSelected = '';
if (window.innerWidth < 701) {
this.newGroup();
}
else {
this.closeAllDesktopComponents();
this.showEmptyComponent = false;
this.showNewGroup = true;
}
}
openEditGroupPage(rid) {
if (window.innerWidth < 701) {
this.editGroup(rid);
}
else {
this.closeAllDesktopComponents();
this.showEditGroup = true;
}
}
openGroupMessagesPage(rid) {
this.roomId = rid;
if (window.innerWidth < 701) {
this.openGroupMessagesModal(rid);
}
else {
this.idSelected = rid;
this.closeAllDesktopComponents();
this.showEmptyComponent = false;
this.showMessages = true;
}
}
openNewEventPage(data?) {
if (data) {
this.taskParticipants = data.members.map((val) => {
return {
Name: val.name,
EmailAddress: val.username + "@" + environment.domain,
IsRequired: "true",
}
});
this.groupRoomId = data.roomId;
}
this.closeAllDesktopComponents();
if (window.innerWidth < 701) {
}
else {
this.showNewEvent = true;
}
}
async openAttendeesComponent(data) {
this.adding = data.type
this.closeAllDesktopComponents();
this.showAttendees = true;
}
async clearContact() {
this.contacts = [];
}
async setContact(data: EventPerson[]) {
this.contacts = data;
}
async setIntervenient(data) {
this.taskParticipants = removeDuplicate(data)
}
async setIntervenientCC(data) {
this.taskParticipantsCc = removeDuplicate(data)
}
async closeAttendeesComponent() {
this.closeAllDesktopComponents();
this.showNewEvent = true;
}
async closeNewEventComponent() {
this.closeAllDesktopComponents();
this.showEmptyComponent = true;
this.idSelected = "";
}
async closeNewEventComponentAndOpenChat({ roomId }) {
this.closeAllDesktopComponents();
}
doRefresh(event) {
setTimeout(() => {
try {
event?.target?.complete();
} catch (error) { }
}, 1000);
}
customRoom() {
let params = new HttpParams();
params = params.set("types", "c");
this.chatService.customsRooms(params).subscribe(res => {
//
});
}
showDateDuration(start: any) {
return this.timeService.showDateDuration(start);
}
countDownDate(date: any, roomId: string) {
return this.timeService.countDownDate(date, roomId);
}
async emptyTextDescriptionOpen() {
this.closeAllDesktopComponents()
this.showEmptyComponent = true
}
async selectContact() {
const modal = await this.modalController.create({
component: ContactsPage,
cssClass: 'modal modal-desktop',
});
modal.onDidDismiss().then((Data) => {
// let data = Data.data
// let roomId = data.roomId
// this.openMessagesPage(roomId);
});
await modal.present();
}
async newGroup() {
const modal = await this.modalController.create({
component: NewGroupPage,
cssClass: 'modal modal-desktop',
});
await modal.present();
modal.onDidDismiss();
}
async editGroup(roomId) {
const modal = await this.modalController.create({
component: EditGroupPage,
cssClass: 'modal modal-desktop',
componentProps: {
roomId: roomId,
},
});
modal.onDidDismiss().then((res) => {
this.modalController.dismiss(res.data);
});
await modal.present();
}
async openMessagesModal(roomId: any) {
this.closeAllDesktopComponents();
//
const modal = await this.modalController.create({
component: MessagesPage,
cssClass: 'modal modal-desktop isMessagesChatOpened',
componentProps: {
roomId: roomId,
},
});
await modal.present();
modal.onDidDismiss();
}
backToChat({ roomId }) {
//const room = this.ChatSystemService.getRoomById(roomId);
//if (room.isGroup) {
// this.segment = "Grupos"
// this.openGroupMessagesPage(room.id);
//} else {
this.segment = "Contactos"
this.openMessagesPage(roomId);
// }
}
async openGroupMessagesModal(roomId: any) {
const modal = await this.modalController.create({
component: GroupMessagesPage,
cssClass: 'modal modal-desktop isGroupChatOpened',
componentProps: {
roomId: roomId,
},
});
modal.onDidDismiss().then(() => {
// this.ChatSystemService.currentRoom.roomLeave()
});
await modal.present();
}
}
@@ -1,17 +0,0 @@
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 {}
@@ -1,25 +0,0 @@
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 'src/app/shared/shared.module';
import { BtnSeguintePageModule } from 'src/app/shared/btn-seguinte/btn-seguinte.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
EditGroupPageRoutingModule,
BtnSeguintePageModule,
],
declarations: [EditGroupPage]
})
export class EditGroupPageModule {}
@@ -1,44 +0,0 @@
<ion-header class="ion-no-border">
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="title-content width-100">
<div class="left">
<button class="btn-no-color" (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>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " slot="end" src='assets/images/theme/{{ThemeService.currentTheme}}/icons-calendar-arrow-left.svg'></ion-icon>
</button>
</div>
<div class="middle">
<ion-label class="title">Alterar assunto</ion-label>
</div>
<app-btn-seguinte *ngIf="groupName" (click)="changeGroupName()"></app-btn-seguinte>
</div>
</div>
</ion-toolbar>
</ion-header>
<ion-content>
<div class="main-content">
<div class="item-container">
<ion-input [(ngModel)]="groupName" placeholder="Título"></ion-input>
</div>
<div *ngIf="false" class="item-container-no-border">
<ion-checkbox (ionChange)="_ionChange($event)" color="primary"></ion-checkbox>
<ion-label>Grupo Ultra-secreto</ion-label>
</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>
</div>
<div class="ion-input-class">
<ion-input (click)="showPicker()" [(ngModel)]="displayDuration" placeholder="Duração"></ion-input>
</div>
</div>
</div>
</div>
</ion-content>
@@ -1,152 +0,0 @@
@import '~src/function.scss';
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: rem(45);
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: rem(45);
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{
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
.left{
width: 37px;
float: left;
font-size: rem(35);
overflow: auto;
}
.middle{
padding: 0!important;
float: left;
width: 221px;
margin: 2.5px 0 0 5px;
}
.right{
padding: 0!important;
float: right;
font-size: rem(15);
color: #0782c9;
margin: 8px 0 0 5px;
}
}
.title{
font-size: rem(25);
}
.div-icon{
width: rem(40);
float: right;
font-size: rem(35);
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: rem(12);
color: #000;
}
}
.container-div{
margin-bottom: 15px;
overflow: auto;
.ion-item-class-2{
width: 360px;
margin: 0px auto;
.ion-icon-class{
width: rem(45);
height: rem(45);
float: left;
padding: 10px;
font-size: rem(25);
}
}
.ion-input-class{
width: 315px;
height: rem(45);
border: 1px solid #ebebeb;
border-radius: 5px;
padding-left: 5px;
padding-right: 10px;
float: left;
}
}
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { EditGroupPage } from './edit-group.page';
describe('EditGroupPage', () => {
let component: EditGroupPage;
let fixture: ComponentFixture<EditGroupPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EditGroupPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(EditGroupPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,185 +0,0 @@
import { HttpErrorResponse } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams, PickerController } from '@ionic/angular';
import { ChatService } from 'src/app/services/chat.service';
import { ThemeService } from 'src/app/services/theme.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;
roomId:string;
constructor(
private modalController: ModalController,
private pickerController: PickerController,
private chatService: ChatService,
private navParams: NavParams,
public ThemeService: ThemeService
) {
this.roomId = this.navParams.get('roomId');
}
ngOnInit() {
// this.chatService.refreshtoken();
this.getRoomInfo();
}
getRoomInfo(){
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
this.room = room['room'];
try {
this.groupName = this.room.name.split('-').join(' ');
} catch(error) {
this.groupName = this.room.name;
}
});
}
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{
}
}
_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)=>{
this.selectedDuration = [
value.days.value,
value.hours.value,
value.minutes.value,
]
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: 0,
options: [
{ 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');
});
}
}
@@ -1,17 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { GroupContactsPage } from './group-contacts.page';
const routes: Routes = [
{
path: '',
component: GroupContactsPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class GroupContactsPageRoutingModule {}
@@ -1,27 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { GroupContactsPageRoutingModule } from './group-contacts-routing.module';
import { GroupContactsPage } from './group-contacts.page';
import { SharedModule } from 'src/app/shared/shared.module';
import { PipesModule } from 'src/app/pipes/pipes.module';
import { BtnSeguintePageModule } from 'src/app/shared/btn-seguinte/btn-seguinte.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
PipesModule,
GroupContactsPageRoutingModule,
BtnSeguintePageModule,
],
declarations: [GroupContactsPage]
})
export class GroupContactsPageModule {}
@@ -1,65 +0,0 @@
<ion-header class="ion-no-border">
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="title-content width-100">
<div class="back-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 == 'doneIt' " src="assets/images/theme/doneIt/icons-calendar-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)="updateGroup()"></app-btn-seguinte>
</div>
</div>
</ion-toolbar>
<ion-toolbar class="toolbar-search">
<div class="search">
<ion-searchbar search-icon="undefined" debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<div *ngIf="members">
<ion-label class="members-label">Contactos selecção:</ion-label>
<div class="members-list" *ngFor="let user of members">
<ion-item-sliding [class.inactive]="sessionStore.user.UserName == user.username">
<ion-item lines="none" class="members-checkbox ion-no-border ion-no-padding">
<ion-checkbox checked disabled color="primary"></ion-checkbox>
<p>{{user.name}}</p>
<ion-icon class="{{user.status}}" name="ellipse"></ion-icon>
</ion-item>
<ion-item-options (click)="deleteMember(user)" class="members-options" side="end">
<ion-item-option color="danger">Apagar</ion-item-option>
</ion-item-options>
</ion-item-sliding>
</div>
</div>
<div *ngFor="let userContainer of userContainer | keyvalue;" >
<div class="item-divider">
<ion-label>{{ userContainer.key }}</ion-label>
</div>
<div *ngFor="let user of userContainer.value" class="d-flex px-20 align-center">
<ion-checkbox [(ngModel)]="user.isChecked" color="primary" (click)="selectedContact(user)"></ion-checkbox>
<ion-label class="flex-grow-1 px-10">{{user.name}}</ion-label>
<div class="icon"><ion-icon class="{{user.status}}" name="ellipse"></ion-icon></div>
</div>
</div>
</div>
</ion-content>
@@ -1,173 +0,0 @@
@import '~src/function.scss';
.header-toolbar{
--background:transparent;
--opacity: 1;
.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);
.div-icon{
width: rem(40);
float: right;
font-size: rem(35);
overflow: auto;
padding: 1px;
}
.div-icon ion-icon{
float: right;
padding-left: 20px;
}
.title-content{
margin: 0px auto;
overflow: auto;
padding: 0 !important;
}
.back-icon{
width: 37px;
float: left;
font-size: rem(35);
overflow: auto;
}
.div-title{
width: 221px;
padding: 0!important;
float: left;
margin: 2.5px 0 0 5px;
}
.title{
font-size: rem(25);
}
}
}
.toolbar-search{
--padding-top:0 !important;
--padding-bottom:0 !important;
--padding-start:0 !important;
--padding-end:0 !important;
.search{
border: 1px solid #ebebeb;
margin: 5px 20px 5px 20px;
border-radius: 5px;
}
.search ion-searchbar{
/* border: 1px solid green; */
width: 100%;
margin: 0 !important;
padding: 0 !important;
--border-radius: 5px;
--box-shadow: none;
overflow: auto;
--icon-color: var(--font-awesome);
}
}
ion-content{
--background:transparent;
}
.main-content{
width: 100%;
height: 100%;
font-family: Roboto;
margin: 0 auto;
background-color: #fff;
overflow:auto;
padding: 0 0 0 0;
.members-label{
margin: 10px 20px 10px 20px !important;
/* font-size: rem(15); */
font-weight: bold;
}
.members-checkbox{
display: flex;
margin: 0px 20px 0px 20px !important;
overflow: auto;
align-items: center;
border-bottom: 1px solid #ebebeb;
}
.members-options{
margin: 0px 20px 0px 19px !important;
overflow: auto;
}
.item-divider{
background: #ebebeb;
font-size: rem(15);
margin: 10px 0 10px 0;
padding:5px 0 5px 20px;
}
.item-checkbox{
display: flex;
margin: 10px 20px 10px 20px !important;
overflow: auto;
align-items: center;
}
.members-checkbox ion-checkbox{
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
.item-checkbox ion-checkbox{
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
.item-checkbox p, .members-checkbox p{
display: block;
margin: 0 !important;
padding-left: 10px;
font-size: rem(15);
color: var(--title-text-color);
float: left;
}
.item-checkbox ion-icon, .members-checkbox ion-icon{
font-size: rem(10);
float: left;
color:#99e47b;
margin-left: 10px;
}
.online{
color:#99e47b !important;
}
.offline{
color:#cbced1 !important;
}
.away{
color:#ffd21f !important;
}
.invisible{
color:#cbced1 !important;
}
.busy{
color:#f5455c !important;
}
}
.inactive {
opacity: 0.7;
ion-item-options {
display: none !important;
}
}
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { GroupContactsPage } from './group-contacts.page';
describe('GroupContactsPage', () => {
let component: GroupContactsPage;
let fixture: ComponentFixture<GroupContactsPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GroupContactsPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(GroupContactsPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,310 +0,0 @@
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams } from '@ionic/angular';
import * as _ from 'lodash';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
import { GroupMessagesPage } from '../group-messages.page';
import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service';
// import { ChatSystemService } from 'src/app/services/chat/chat-system.service';
@Component({
selector: 'app-group-contacts',
templateUrl: './group-contacts.page.html',
styleUrls: ['./group-contacts.page.scss'],
})
export class GroupContactsPage implements OnInit {
showLoader: boolean;
users = [];
contact: string[] = [" Ana M.", "Andre F.", "Bruno G.", "Catarina T", "Tiago"];
headers: HttpHeaders;
options:any;
listContacts: any[];
contacts: any;
textSearch:string;
room:any;
members:any;
dm:any;
isGroupCreated:boolean;
groupName:string;
selectedUserList:any;
sessionStore = SessionStore
objectUserSingleStone = []
userContainer = {}
constructor(
private modalController: ModalController,
private http: HttpClient,
private chatService: ChatService,
private authService: AuthService,
private navParams: NavParams,
public ThemeService: ThemeService,
// public ChatSystemService: ChatSystemService,
)
{
// this.textSearch="";
// this.dm=null;
// this.room=null;
// this.isGroupCreated = this.navParams.get('isCreated');
// this.groupName = this.navParams.get('name');
// this.room = this.navParams.get('room');
// this.members = this.navParams.get('members');
}
ngOnInit() {
// this.chatService.refreshtoken();
this.loadUsers();
// this.getMembers();
}
loadUsers(){
// this.options = {
// headers: this.headers,
// };
// this.chatService.getAllUsers().subscribe((res:any)=>{
// if(this.members) {
// this.contacts = res.users.filter(f => !this.members.some(item => item._id === f._id));
// }
// else{
// this.contacts = res.users.filter(data => data.username != this.sessionStore.user.UserName);
// }
// this.users = this.contacts.sort((a,b) => {
// if(a.name < b.name){
// return -1;
// }
// if(a.name > b.name){
// return 1;
// }
// return 0;
// });
// for( const user of this.users) {
// const foundUser = this.objectUserSingleStone.find( e => e.name == user.name)
// if(!foundUser) {
// this.objectUserSingleStone.push(user)
// } else {
// 'not found'
// }
// }
// const userContainer = {}
// for(const user of this.objectUserSingleStone) {
// const firstLetter = user.name.charAt(0)
// if(!userContainer[firstLetter]) {
// userContainer[firstLetter] = [user]
// } else {
// userContainer[firstLetter].push(user)
// }
// }
// this.userContainer = userContainer
// this.showLoader = false;
// });
}
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];
}
let first_prev = records[recordIndex - 1].name[0];
let first_current = record.name[0];
if(first_prev != first_current){
return first_current;
}
return null;
}
deleteMember(data:any){
let body = {
"roomId": this.room._id,
"userId": data._id,
}
if(this.room.t == "p"){
this.chatService.removeGroupMember(body).subscribe(res=>{
this.getMembers();
});
}
else if(this.room.t == "c"){
this.chatService.removeChannelMember(body).subscribe(res=>{
this.getMembers();
});
}
}
doRefresh(ev){
this.loadUsers();
//this.getMembers();
ev.target.complete();
}
async close(){
this.modalController.dismiss();
}
onChange(event) {
this.textSearch = event.detail.value;
const users = this.contacts.filter( e => e.name.toLowerCase().includes(this.textSearch.toLowerCase())).sort((a,b) => {
if(a.name < b.name) {
return -1;
}
if(a.name > b.name) {
return 1;
}
return 0;
});
const selectedUsers = this.users.filter( e => e?.isChecked == true)
users.forEach( (user, index) => {
if(user[index]) {
console.log({user, index})
const isCheck = selectedUsers.find( e => e._id == user._id)?.isChecked
if(isCheck) {
user[index].isChecked = isCheck
}
// if(user[index].isChecked) {
// console.log('user[index].isChecked', user[index].isChecked)
// }
}
})
let a = this.objectUserSingleStone.filter( e => e.name.toLowerCase().includes(this.textSearch.toLowerCase()))
let b = {}
for(const user of a) {
const firstLetter = user.name.charAt(0)
if(!b[firstLetter]) {
b[firstLetter] = [user]
} else {
b[firstLetter].push(user)
}
}
this.userContainer = b
}
clicked(){
}
selectedContact(user:any) {
/* this.groupName = this.room.name; */
if(user.isChecked != true ) {
user.isChecked = false
} else {
user.isChecked = true
}
const userIndex = this.objectUserSingleStone.findIndex((e) => e._id == user._id)
this.objectUserSingleStone[userIndex].isChecked = user.isChecked
}
addContacts(room:any){
this.selectedUserList = this.users.filter(function(contact) {
return contact.isChecked == true;
});
this.selectedUserList.forEach(user=>{
let body ={
"roomId":room._id,
"userId":user._id,
}
this.chatService.addUserToGroup(body).subscribe(res=>{
});
});
}
loading = false
updateGroup(){
if(this.loading) {
return
}
this.loading = true
console.log('this.room', this.room)
this.chatService.getRoomInfo(this.room._id).subscribe(room=>{
this.room = room['room'];
this.addContacts(this.room);
this.openGroupMessages(room['room']._id);
this.loading = false
}, ()=> {
this.loading = false
});
}
async openGroupMessages(roomId:any){
const modal = await this.modalController.create({
component: GroupMessagesPage,
componentProps: {
roomId: roomId,
},
cssClass: 'group-messages',
backdropDismiss: false
});
modal.onDidDismiss().then(() => {
this.close();
});
await modal.present();
}
}
@@ -1,21 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { GroupMessagesPage } from './group-messages.page';
const routes: Routes = [
{
path: '',
component: GroupMessagesPage
},
{
path: 'group-contacts',
loadChildren: () => import('./group-contacts/group-contacts.module').then( m => m.GroupContactsPageModule)
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
@@ -1,36 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { IonicModule } from '@ionic/angular';
import { GroupMessagesPageRoutingModule } from './group-messages-routing.module';
import { GroupMessagesPage } from './group-messages.page';
import { ChatPopoverPageModule } from 'src/app/shared/popover/chat-popover/chat-popover.module';
import { BtnModalDismissPageModule } from 'src/app/shared/btn-modal-dismiss/btn-modal-dismiss.module';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { LettersAvatarModule } from "ngx-letters-avatar";
import { PipesModule } from 'src/app/pipes/pipes.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
FontAwesomeModule,
IonicModule,
GroupMessagesPageRoutingModule,
ChatPopoverPageModule,
BtnModalDismissPageModule,
LettersAvatarModule,
PipesModule,
/* ImageCropperModule,
AngularCropperjsModule */
],
declarations: [GroupMessagesPage]
})
export class GroupMessagesPageModule {}
@@ -1,441 +0,0 @@
@import '~src/function.scss';
.header-toolbar {
--background: transparent;
--opacity: 1;
.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);
.header-top {
overflow: auto;
padding: 0 !important;
background: #fff;
.left {
width: fit-content;
float: left;
//font-size: rem(35);
overflow: hidden;
}
.middle-container {
display: flex;
overflow: auto;
height: auto;
width: calc(100% - 47px);
float: left;
/* white-space: nowrap;
overflow: hidden !important;
text-overflow: ellipsis !important; */
.middle {
width: 100%;
padding: 0 !important;
margin: 0 0 0 10px;
font-size: rem(25);
}
}
.middle-container-options {
padding: 0 !important;
float: left;
width: calc(100% - 67px);
text-align: right;
.middle-container-options-icons {
color: #0782c9;
font-size: rem(23);
}
}
.right {
padding: 0 !important;
float: right;
font-size: rem(25);
color: #0782c9;
}
.header-top-btn {
background: transparent;
font-size: rem(25) !important;
font-weight: 100 !important;
/* color: #0782c9; */
color: #42b9fe;
padding: 0 5px 0 5px;
}
}
.header-bottom {
padding-left: 10px;
overflow: auto;
margin: 0 auto;
.header-bottom-icon {
width: rem(30);
font-size: rem(25);
float: left;
padding: 2px;
}
.header-bottom-contacts {
width: calc(100% - 40px);
font-size: rem(15);
color: #797979;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
float: left;
padding: 5px;
margin: 1px;
.contacts-list {
white-space: nowrap;
overflow: hidden !important;
text-overflow: ellipsis !important;
}
}
}
.div-icon {
width: rem(40);
float: right;
font-size: rem(35);
overflow: auto;
padding: 1px;
}
.div-icon ion-icon {
float: right;
padding-left: 20px;
}
}
}
ion-content {
.welcome-text {
/* width: 322px; */
width: em(422px);
background: #ebebeb;
text-align: center;
font-size: rem(13);
color: #797979;
padding: 10px;
margin: 0 auto !important;
line-height: 1.2rem;
// margin: 20px 39px 25px;
border-radius: 8px;
}
.info-text {
display: flex;
width: fit-content;
height: auto;
background: var(--chat-alert-msg-color);
text-align: center;
font-size: rem(13);
color: #262420;
padding: 10px;
margin: 10px auto;
line-height: 1.2rem;
border-radius: 8px;
}
.info-text-leave {
display: flex;
align-items: center;
justify-content: center;
width: fit-content;
padding: 10px;
background: #e0e9ee;
border-radius: 8px;
margin: 10px auto;
color: #797979 !important;
font-size: rem(13) !important;
/* margin: 15px 0px 15px 0px; */
.info-text-leave ion-label {
font-size: rem(13) !important;
line-height: 1.2rem;
}
}
.messages {
font-size: rem(13);
font-family: Roboto;
overflow: auto;
//set scroll do bottom
position: absolute;
top: 0;
left: 0;
overflow-x: hidden;
overflow-y: auto;
width: 100%;
height: 100%;
word-wrap: break-word;
-webkit-overflow-scrolling: touch;
.messages-list-item-wrapper {
overflow: hidden;
}
.messages-list-item-wrapper-active {
background: #e6f6ff75 !important;
}
.message-container {
//border: 1px solid red;
}
.incoming-true,
.incoming-false {
width: 305px;
padding: 15px 20px;
border-radius: 10px;
}
.incoming-true {
margin: 10px 35px 10px 20px;
background: #ebebeb;
float: left;
}
}
.incoming-false {
margin: 10px 20px 10px 35px;
background: var(--chat-incoming-msg-color);
float: right;
}
.title {
color: var(--title-text-color);
font-weight: bold;
margin-bottom: 5px;
.time {
color: #797979;
text-align: right;
float: right;
}
}
.online {
color: #99e47b !important;
}
.offline {
color: #cbced1 !important;
}
.away {
color: #ffd21f !important;
}
.invisible {
color: #cbced1 !important;
}
.busy {
color: #f5455c !important;
}
}
.info-meeting {
/* width: 322px; */
width: em(422);
background: var(--chat-alert-msg-color);
text-align: center;
font-size: rem(13);
color: #262420;
padding: 10px;
margin: 10px auto;
line-height: 1.2rem;
/* margin: 15px 0px 15px 0px; */
border-radius: 8px;
.info-meeting-small {
font-size: rem(10);
font-style: italic;
}
.info-meeting-medium {
font-size: rem(12);
}
.info-meeting-normal {
color: #0782c9;
font-weight: 700;
text-decoration: underline;
}
.info-meeting-normal:hover {
text-decoration: underline;
color: #0782c9;
}
}
ion-footer {
padding-top: 7.5px;
padding-bottom: 20px;
.container {
justify-content: center;
justify-content: space-evenly;
align-items: center;
.message-box {
margin: 0 5px 0 5px;
}
}
.chat-icon-options {
display: block !important;
font-size: rem(35);
float: right !important;
margin-top: 5px;
}
.chat-icon-send {
font-size: rem(40);
margin: 0 auto;
margin-top: 4px;
}
.type-message {
display: flex;
border: 1px solid #ebebeb;
border-radius: 25px;
padding-left: 15px;
align-items: center;
overflow: auto;
ion-textarea {
margin: 0 !important;
align-self: center;
}
}
}
.preview-slides {
margin-top: 20%;
background: #e6e6e6;
img {
padding-top: 20px;
padding-bottom: 20px;
}
}
.transparent-modal {
.modal-wrapper {
--background: rgba(44, 39, 45, 0.2);
}
}
.image-slide,
.image-card {
overflow: visible;
}
.image-card {
z-index: 9;
}
.backdrop {
height: 200%;
width: 100%;
background: black;
position: absolute;
z-index: 10;
}
.typing {
position: relative;
top: -25px;
height: 0px;
left: 0px;
margin-left: 22px;
display: flex;
font-size: rem(12);
align-items: center;
}
.typing ngx-letters-avatar {
padding-right: 5px;
}
.float-status {
position: relative !important;
float: right;
display: flex;
align-items: self-end;
}
.float-status-image {
position: relative !important;
float: right;
display: flex;
align-items: self-end;
top: -15px;
}
.float-status-webtrix {
position: relative !important;
top: 0px !important;
float: right;
display: flex;
align-items: self-end;
}
.float-status-all {
font-size: rem(13) !important;
}
.try {
color: red;
background: #f3414159;
padding: 6px;
border-radius: 10px;
cursor: pointer;
}
.font-40-rem {
font-size: 2.5rem !important;
}
.dateLabel {
background: #ebebeb !important;
float: unset !important;
margin: 0px auto !important;
width: 111px;
text-align: center;
margin-top: 10px !important;
padding: 15px 20px;
border-radius: 10px;
}
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { GroupMessagesPage } from './group-messages.page';
describe('GroupMessagesPage', () => {
let component: GroupMessagesPage;
let fixture: ComponentFixture<GroupMessagesPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ GroupMessagesPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(GroupMessagesPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
File diff suppressed because it is too large Load Diff
@@ -1,17 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ContactsPage } from './contacts.page';
const routes: Routes = [
{
path: '',
component: ContactsPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ContactsPageRoutingModule {}
@@ -1,26 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ContactsPageRoutingModule } from './contacts-routing.module';
import { ContactsPage } from './contacts.page';
import { SharedModule } from 'src/app/shared/shared.module';
import { PipesModule } from 'src/app/pipes/pipes.module';
import { FilterPipe } from 'src/app/pipes/filter.pipe';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ContactsPageRoutingModule,
PipesModule,
],
declarations: [ContactsPage]
})
export class ContactsPageModule {}
@@ -1,52 +0,0 @@
<ion-header class="ion-no-border">
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="title-content width-100">
<div class="back-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 == 'doneIt' " src="assets/images/theme/doneIt/icons-calendar-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">
<!-- MOBILE -->
<ion-label class="title">Nova Conversa</ion-label>
</div>
</div>
</div>
</ion-toolbar>
<ion-toolbar class="toolbar-search">
<div class="search">
<ion-searchbar search-icon="undefined" debounce="500" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<ion-progress-bar class="position-absolute" type="indeterminate" *ngIf="loading"></ion-progress-bar>
<!-- <ion-virtual-scroll [items]="ChatSystemService.users | filter:textSearch: 'name' " approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
</div>
<div (click)="createRoom(user.username)" *virtualItem="let user" class="item-user cursor-pointer">
<p>{{user.name}}</p>
<span class="icon">
<ion-icon class="{{user.status}}" slot="end" name="ellipse"></ion-icon>
</span>
</div>
</ion-virtual-scroll> -->
</div>
</ion-content>
@@ -1,136 +0,0 @@
@import '~src/function.scss';
.header-toolbar{
--background:transparent;
--opacity: 1;
.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);
.div-icon{
width: rem(40);
float: right;
font-size: rem(35);
overflow: auto;
padding: 1px;
}
.div-icon ion-icon{
float: right;
padding-left: 20px;
}
.title-content{
margin: 0px auto;
overflow: auto;
padding: 0 !important;
}
.back-icon{
width: 37px;
float: left;
font-size: rem(35);
overflow: auto;
}
.div-title{
width: 221px;
padding: 0!important;
float: left;
margin: 2.5px 0 0 5px;
}
.title{
font-size: rem(25);
}
}
}
.toolbar-search{
--padding-top:0 !important;
--padding-bottom:0 !important;
--padding-start:0 !important;
--padding-end:0 !important;
.search{
border: 1px solid #ebebeb;
margin: 5px 20px 5px 20px;
border-radius: 5px;
height: auto;
padding: 0 !important;
}
.search ion-searchbar{
/* border: 1px solid green; */
width: 100%;
margin: 0 !important;
padding: 0 !important;
--border-radius: 5px;
--box-shadow: none;
overflow: hidden;
--icon-color: var( --font-awesome);
}
}
ion-content{
--background:transparent;
}
.main-content{
width: 100%;
height: 100%;
font-family: Roboto;
margin: 0 auto;
background-color: #fff;
overflow:auto;
padding: 0 0 0 0;
.item-divider{
background: #ebebeb;
font-size: rem(15);
margin: 10px 0 10px 0;
padding:5px 0 5px 20px;
}
.item-user{
display: flex;
margin: 10px 20px 10px 20px !important;
overflow: auto;
align-items: center;
}
.item-user p{
display: block;
margin: 0 !important;
width: 90%;
font-size: rem(15);
color: var(--title-text-color);
float: left;
}
.item-user .icon{
width: 10%;
font-size: rem(10);
display: block;
text-align: right;
overflow: auto;
}
.online{
color:#99e47b;
}
.offline{
color:#cbced1;
}
.away{
color:#ffd21f;
}
.invisible{
color:#cbced1;
}
.busy{
color:#f5455c;
}
}
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ContactsPage } from './contacts.page';
describe('ContactsPage', () => {
let component: ContactsPage;
let fixture: ComponentFixture<ContactsPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ContactsPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ContactsPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,134 +0,0 @@
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
import { MessagesPage } from '../messages.page';
import { ThemeService } from 'src/app/services/theme.service'
// import { ChatSystemService} from 'src/app/services/chat/chat-system.service'
import { SessionStore } from 'src/app/store/session.service';
@Component({
selector: 'app-contacts',
templateUrl: './contacts.page.html',
styleUrls: ['./contacts.page.scss'],
})
export class ContactsPage implements OnInit {
showLoader: boolean;
loggedUser: any;
users = [];
contacts:any;
textSearch:string;
room:any;
dm:any;
sessionStore = SessionStore
userList = []
constructor(
private modalController: ModalController,
private http: HttpClient,
private chatService: ChatService,
private authService: AuthService,
public ThemeService: ThemeService,
// public ChatSystemService: ChatSystemService,
)
{
this.loggedUser = SessionStore.user.ChatData['data'];
this.textSearch="";
this.dm=null;
this.room=null;
}
ngOnInit() {
// this.chatService.refreshtoken();
// this.loadUsers();
// this.ChatSystemService.getUser()
}
onChange(event) {
this.textSearch = event.detail.value.toLowerCase();
// this.userList = this.ChatSystemService.users.filter((e) => {
// const username = e.name.toLowerCase()
// return username.includes(this.textSearch)
// })
}
separateLetter(record, recordIndex, records){
if(recordIndex == 0){
return record.name[0];
}
let first_prev = records[recordIndex - 1].name[0];
let first_current = record.name[0];
if(first_prev != first_current){
return first_current;
}
return null;
}
doRefresh(event){
}
close() {
this.modalController.dismiss({});
}
clicked() {}
loading = false
createRoom(username:string) {
if(this.loading) {
return
}
this.loading = true
let body = {
username: username,
}
this.chatService.createRoom(body).subscribe(async(res) => {
this.room = res['room'];
// this.ChatSystemService.getAllRooms(() => {
// this.getDirectMessage(this.room._id);
// this.loading = false
// }, this.room._id);
}, ()=> {
this.loading = false
});
}
getDirectMessage(roomId:any) {
this.openModal(roomId);
}
async openModal(roomId:any){
this.close();
console.log('open chat')
const modal = await this.modalController.create({
component: MessagesPage,
cssClass: 'group-messages',
componentProps: {
roomId: roomId,
},
});
modal.onDidDismiss();
await modal.present();
}
}
@@ -1,21 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { MessagesPage } from './messages.page';
const routes: Routes = [
{
path: '',
component: MessagesPage
},
{
path: 'contacts',
loadChildren: () => import('./contacts/contacts.module').then( m => m.ContactsPageModule)
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
@@ -1,30 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { MessagesPageRoutingModule } from './messages-routing.module';
import { MessagesPage } from './messages.page';
import { SharedModule } from 'src/app/shared/shared.module';
import { BtnModalDismissPage } from 'src/app/shared/btn-modal-dismiss/btn-modal-dismiss.page';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { MatMenuModule } from '@angular/material/menu';
import { LettersAvatarModule } from "ngx-letters-avatar";
import { PipesModule } from 'src/app/pipes/pipes.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
FontAwesomeModule,
MessagesPageRoutingModule,
MatMenuModule,
LettersAvatarModule,
PipesModule
],
declarations: [MessagesPage]
})
export class MessagesPageModule {}
@@ -1,225 +0,0 @@
<ion-header class="ion-no-border" >
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="header-top">
<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 font-awesome-1"></fa-icon>
</button>
</div>
<div class="middle-container" *ngIf="!showMessageOptions">
<div class="middle" *ngIf="roomData$ | async as roomData">
<ion-label class="title">{{ roomData.roomName }}</ion-label>
<span *ngIf="roomStatus$ | async as roomStatus"><ion-icon *ngIf="roomStatus"
class="online" name="ellipse"></ion-icon></span>
</div>
</div>
<!-- <div (click)="ChatSystemService.getDmRoom(roomId).deleteAll()" >delete all</div> -->
<div class="middle-container-options" *ngIf="showMessageOptions">
<fa-icon (click)="deleteMessage(selectedMsgId)" icon="trash" class="middle-container-options-icons"></fa-icon>
<!-- <ion-icon name="trash"></ion-icon> -->
</div>
<div hidden class="right">
<button class="btn-no-color" (click)="openMessagesOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg">
</ion-icon>
</button>
</div>
</div>
<div hidden class="header-bottom" (click)="addContacts()">
<div class="header-bottom-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="text-color-blue">Adicionar contacto</ion-label>
</div>
</div>
</div>
</ion-toolbar>
</ion-header>
<ion-content >
<div class="messages height-100 width-100 d-flex flex-column" #scrollMe >
<div
*ngFor="let message of messages1[roomId]" class="messages-list-item-wrapper"
[ngClass]="{'my-message': message.sender.wxUserId === sessionStore.user.UserId, 'other-message': message.sender.wxUserId !== sessionStore.user.UserId}"
>
<div class="message-container">
<div class="d-flex justify-content-between">
<div>
<div>
{{ message.message }}
</div>
<div *ngFor="let attachment of message.attachments; let i = index">
<div *ngIf="attachment.source == MessageAttachmentFileSource.Webtrix">
<ion-icon src="assets/icon/webtrix.svg" class="file-icon font-25"></ion-icon>
<ion-label>{{ attachment.fileName}}</ion-label>
<!-- <ion-icon *ngIf="ThemeService.currentTheme == 'default' && attachment.type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) " class="icon-download" src="assets/icon/theme/default/icons-download.svg" slot="end"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && attachment.type != 'webtrix' && !( msg.downloadLoader == true || msg.uploadingFile == true ) " class="icon-download" src="assets/icon/theme/gov/icons-download.svg" slot="end"></ion-icon>
<ion-icon *ngIf="( msg.downloadLoader == true || msg.uploadingFile == true )" class="icon-download" src="assets/gif/theme/{{ThemeService.currentTheme}}/Blocks-loader.svg" slot="end"></ion-icon> -->
</div>
<div *ngIf="attachment.fileType == MessageAttachmentFileType.Image">
<img src="{{attachment.safeFile}}">
</div>
<div *ngIf="attachment.fileType == MessageAttachmentFileType.Audio">
<audio [src]="attachment.safeFile|safehtml" preload="metadata" class="flex-grow-1" controls controlsList="nodownload noplaybackrate"></audio>
</div>
<div *ngIf="attachment.fileType == MessageAttachmentFileType.Doc">
<fa-icon *ngIf="attachment.mimeType == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="attachment.mimeType == 'application/word'" icon="file-word" class="word-icon">
</fa-icon>
<fa-icon *ngIf="attachment.mimeType == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'" icon="file-word" class="word-icon"></fa-icon>
<fa-icon
*ngIf="attachment.mimeType == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'"
icon="file-word" class="excel-icon"></fa-icon>
<ion-icon *ngIf="attachment.mimeType == 'application/webtrix'" src="assets/icon/webtrix.svg">
</ion-icon>
<ion-icon *ngIf="attachment.mimeType == 'application/meeting'" src="assets/icon/webtrix.svg">
</ion-icon>
<ion-label>{{ attachment.fileName}}</ion-label>
</div>
</div>
</div>
<div>
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer"></fa-icon>
<mat-menu #beforeMenu="matMenu" xPosition="before">
<button (click)="messageDelete(message)" class="menuButton">Apagar mensagem</button>
<button (click)="editMessage(message)" class="menuButton">Editar mensagem</button>
<button (click)="toggleEmojiPicker(message)" class="menuButton">Reagir mensagem</button>
</mat-menu>
</div>
</div>
</div>
<div style="text-align: end;">
<div *ngIf="message.messageStatus != 'send'" style="font-size: .6875rem;">A enviar</div>
<div *ngIf="message.messageStatus == 'send'" style="font-size: .6875rem;">Enviado</div>
</div>
<!-- Emoji Picker -->
<div *ngIf="selectedMessage === message" class="emoji-picker" [ngStyle]="{'bottom': '0', 'right': '0'}">
<span *ngFor="let emoji of emojis" (click)="addReaction(message, emoji)" class="emoji-icon">
{{ emoji }}
</span>
</div>
</div>
<!-- current emoji -->
<div>
<span *ngFor="let reaction of message.reactions" class="emoji-icon">
{{ reaction.reaction }}
</span>
</div>
</div>
<!--
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
<ion-fab-button *ngIf="scrollToBottomBtn" color="light" size="small">
<ion-icon name="chevron-down"></ion-icon>
</ion-fab-button>
</ion-fab> -->
<ion-fab horizontal="start" vertical="bottom" slot="fixed">
<div #array>
</div>
</ion-fab>
<!-- <div *ngIf="userTyping$?.typingList?.typingList">
<div
*ngFor="let message of userTyping$.typingList.typingList " class="messages-list-item-wrapper"
>
{{ message.userName }}
</div>
</div>
-->
<!-- <div *ngIf="userTyping$" class="header-bottom-contacts" >
<div *ngFor="let typing of userTyping$; let i = index">
{{ typing.userName }}<div *ngIf="i < userTyping$.length - 1">, </div>
</div>
</div>
-->
</div>
</ion-content>
<ion-footer>
<!-- <div class="typing" *ngIf="ChatSystemService.getDmRoom(roomId).otherUserType == true">
<ngx-letters-avatar [avatarName]="ChatSystemService.getGroupRoom(roomId).name" [width]="30" [circular]="true"
fontFamily="Roboto"></ngx-letters-avatar>
está a escrever ...
</div> -->
<div class="width-100 pl-20 pr-20">
<span *ngIf="!lastAudioRecorded">{{durationDisplay}}</span>
<audio [src]="audioRecorded" class="d-flex width-100 mt-10 mb-10" *ngIf="lastAudioRecorded" controls
controlsList="nodownload noplaybackrate"></audio>
</div>
<div class="container width-100 d-flex">
<div>
<button *ngIf="!recording && !lastAudioRecorded && allowTyping" class="btn-no-color" (click)="openChatOptions()">
<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>
<button *ngIf="recording || lastAudioRecorded || !allowTyping" class="btn-no-color" (click)="deleteRecording()">
<fa-icon class="icon-size-27" icon="trash"></fa-icon>
</button>
</div>
<div class="width-70 message-container">
<div *ngIf="!recording && !lastAudioRecorded" class="type-message">
<ion-textarea *ngIf="allowTyping" autocomplete="on" autocorrect="on" spellcheck="true" clearOnEdit="true"
placeholder="Escrever uma mensagem" auto-grow class="message-input" rows="1"
[(ngModel)]="textField"
(ionChange)="sendTyping()"></ion-textarea>
</div>
<div *ngIf="recording" class="d-flex align-items-center justify-content-center">
<button (click)="stopRecording()" class="btn-no-color d-flex align-items-center justify-content-center">
<ion-icon class="icon-size-45" name="stop-circle-outline" color="danger"></ion-icon>
</button>
</div>
</div>
<div>
<button #recordbtn *ngIf="textField == '' && !lastAudioRecorded" (click)="startRecording()" class="btn-no-color">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="chat-icon-send" src="assets/icon/theme/default/icons-chat-record-audio.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="chat-icon-send" src="assets/icon/theme/gov/icons-chat-record-audio.svg"></ion-icon>
</button>
<button *ngIf="textField != ''" class="btn-no-color" (click)="sendMessage()">
<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>
<button *ngIf="textField == '' && lastAudioRecorded" class="btn-no-color" (click)="sendAudio(lastAudioRecorded)">
<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>
</ion-footer>
@@ -1,496 +0,0 @@
@import '~src/function.scss';
@media only screen and (min-width: 100px) {
:host {
font-size: 14px;
}
}
@media only screen and (min-width: 500px) {
:host {
font-size: 16px;
}
}
.header-toolbar {
--background: transparent;
--opacity: 1;
.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);
.header-top {
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
.left {
width: fit-content;
float: left;
//font-size: rem(35);
overflow: hidden;
.header-top-btn {
background: transparent;
font-size: rem(25) !important;
font-weight: 100 !important;
/* color: #0782c9; */
color: #42b9fe;
}
}
.middle-container {
overflow: auto;
height: auto;
.middle {
padding: 0 !important;
float: left;
width: calc(100% - 77px);
margin: 0px 0 0 10px;
display: flex;
align-items: center;
}
}
.middle-container-options {
padding: 0 !important;
float: left;
width: calc(100% - 25px);
text-align: right;
.middle-container-options-icons {
color: #0782c9;
font-size: rem(23);
}
}
.right {
padding: 0 !important;
float: right;
font-size: rem(25);
color: #0782c9;
margin: 5px 0 0 0;
}
}
.header-bottom {
width: 310px;
overflow: auto;
margin: 0 auto;
.header-bottom-icon {
width: rem(30);
font-size: rem(25);
float: left;
padding: 2px;
}
.header-bottom-contacts {
width: 275px;
font-size: rem(15);
color: #797979;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
float: left;
padding: 5px;
margin: 1px;
}
}
.title {
font-size: rem(25);
white-space: nowrap;
overflow: hidden !important;
text-overflow: ellipsis !important;
float: left;
}
.div-icon {
width: rem(40);
float: right;
font-size: rem(35);
overflow: auto;
padding: 1px;
}
.div-icon ion-icon {
float: right;
padding-left: 20px;
}
}
}
ion-content {
.welcome-text {
/* width: 322px; */
width: rem(422);
background: #ebebeb;
text-align: center;
font-size: rem(13);
color: #797979;
padding: 10px;
margin: 0 auto !important;
line-height: 1.2rem;
// margin: 20px 39px 25px;
border-radius: 8px;
}
.messages {
font-size: rem(13);
font-family: Roboto;
overflow: auto;
//set scroll do bottom
position: absolute;
top: 0;
left: 0;
overflow-x: hidden;
overflow-y: auto;
width: 100%;
height: 100%;
word-wrap: break-word;
-webkit-overflow-scrolling: touch;
.messages-list-itrem-wrapper {
overflow: hidden;
}
.messages-list-itrem-wrapper-active {
background: #e6f6ff75 !important;
}
.message-container {
//border: 1px solid red;
}
.incoming-true,
.incoming-false {
width: 305px;
padding: 15px 20px;
border-radius: 10px;
}
.incoming-true {
margin: 10px 35px 10px 20px;
background: #ebebeb;
float: left;
}
}
.incoming-false {
margin: 10px 20px 10px 35px;
background: var(--chat-incoming-msg-color);
float: right;
}
.title {
display: inline;
color: var(--title-text-color);
font-weight: bold;
margin-bottom: 5px;
.time {
color: #797979;
text-align: right;
float: right;
}
}
}
.info-meeting {
/* width: 322px; */
width: rem(422);
background: var(--chat-alert-msg-color);
text-align: center;
font-size: rem(13);
color: #262420;
padding: 10px;
margin: 10px auto;
line-height: 1.2rrem;
/* margin: 15px 0px 15px 0px; */
border-radius: 8px;
.info-meeting-small {
font-size: rem(10);
font-style: italic;
}
.info-meeting-medium {
font-size: rem(12);
}
.info-meeting-normal {
color: #0782c9;
font-weight: 700;
text-decoration: underline;
}
.info-meeting-normal:hover {
text-decoration: underline;
color: #0782c9;
}
}
ion-footer {
padding-top: 7.5px;
padding-bottom: 20px;
.container {
justify-content: center;
justify-content: space-evenly;
align-itrems: center;
}
.chat-icon-options {
display: block !important;
font-size: rem(35);
float: right !important;
margin-top: 5px;
}
.chat-icon-send {
font-size: rem(40);
margin: 0 auto;
margin-top: 4px;
}
.type-message {
display: flex;
border: 1px solid #ebebeb;
border-radius: 25px;
padding-left: 15px;
align-itrems: center;
overflow: auto;
ion-textarea {
margin: 0 !important;
align-self: center;
overflow: auto;
}
}
}
.text-color-blue {
font-size: rem(15);
color: #0782c9;
font-weight: 500;
letter-spacing: normal;
}
.user-status-online {
display: block;
float: left;
color: #99e47b;
padding-left: 10px;
}
.online {
display: block;
float: left;
color: #99e47b;
padding-left: 10px;
}
.offline {
color: #cbced1;
display: block;
float: left;
padding-left: 10px;
}
.away {
color: #ffd21f;
display: block;
float: left;
padding-left: 10px;
}
.invisible {
color: #cbced1;
display: block;
float: left;
padding-left: 10px;
}
.busy {
color: #f5455c;
display: block;
float: left;
padding-left: 10px;
}
.typing {
position: relative;
top: -25px;
height: 0px;
left: 0px;
margin-left: 22px;
display: flex;
font-size: rem(12);
align-itrems: center;
}
.typing ngx-letters-avatar {
padding-right: 5px;
}
button {
padding: 0px;
border: 0px;
}
button::-moz-focus-inner {
padding: 0px;
border: 0px;
}
.float-status {
position: relative !important;
float: right;
display: flex;
align-itrems: self-end;
}
.float-status-image {
position: relative !important;
float: right;
display: flex;
align-itrems: self-end;
top: -15px;
}
.float-status-webtrix {
position: relative !important;
top: 0px !important;
float: right;
display: flex;
align-itrems: self-end;
}
.float-status-all {
font-size: rem(13) !important;
}
.try {
color: red;
background: #f3414159;
padding: 6px;
border-radius: 10px;
cursor: pointer;
}
.font-40-rem {
font-size: 2.5rem !important;
}
.dateLabel {
background: #ebebeb !important;
float: unset !important;
margin: 0px auto !important;
width: 111px !important;
text-align: center;
}
.message-item-options {
position: relative;
}
.emoji-picker {
display: flex;
flex-wrap: wrap;
background: white;
border: 1px solid #ccc;
padding: 5px;
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
}
.emoji-icon {
font-size: 20px;
cursor: pointer;
margin: 2px;
}
.messages {
font-size: rem(13);
font-family: Roboto;
overflow: auto;
//set scroll do bottom
// position: absolute;
// top: 0;
// left: 0;
// overflow-x: hidden;
// overflow-y: auto;
// width: 100%;
// height: 100%;
// word-wrap: break-word;
// -webkit-overflow-scrolling: touch;
.other-message,
.my-message {
.message-container {
padding: 15px 20px;
margin: 10px 20px 10px 75px;
background: var(--chat-incoming-msg-color);
border-radius: 10px;
}
}
.other-message {
display: flex;
/* justify-content: flex-end; */
align-items: start;
flex-direction: column;
// float: left;
// Styles for incoming messages from other users
justify-content: flex-start;
.message-container {
padding: 15px 20px;
margin: 10px 75px 10px 20px;
background: #ebebeb;
border-radius: 10px;
}
}
}
.my-message {
display: flex;
/* justify-content: flex-end; */
align-items: end;
flex-direction: column;
}
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { MessagesPage } from './messages.page';
describe('MessagesPage', () => {
let component: MessagesPage;
let fixture: ComponentFixture<MessagesPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MessagesPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(MessagesPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
File diff suppressed because it is too large Load Diff
@@ -1,17 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ContactsPage } from './contacts.page';
const routes: Routes = [
{
path: '',
component: ContactsPage
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class ContactsPageRoutingModule {}
@@ -1,25 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { ContactsPageRoutingModule } from './contacts-routing.module';
import { ContactsPage } from './contacts.page';
import { SharedModule } from 'src/app/shared/shared.module';
import { BtnSeguintePageModule } from 'src/app/shared/btn-seguinte/btn-seguinte.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ContactsPageRoutingModule,
BtnSeguintePageModule,
],
declarations: [ContactsPage]
})
export class ContactsPageModule {}
@@ -1,57 +0,0 @@
<ion-header class="ion-no-border">
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="title-content width-100">
<div class="back-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 == 'doneIt' " src="assets/images/theme/doneIt/icons-calendar-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)="groupMessages()" class="cursor-pointer"></app-btn-seguinte>
</div>
</div>
</ion-toolbar>
<ion-toolbar class="toolbar-search">
<div class="search">
<ion-searchbar search-icon="undefined" (ionChange)="onChange($event)" placeholder="Pesquisar por contacto" ></ion-searchbar>
</div>
</ion-toolbar>
</ion-header>
<ion-content>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<!-- <ion-list>
<ion-item *ngFor="let user of searchedItem">
{{user.name}}
</ion-item>
</ion-list> -->
<ion-virtual-scroll [items]="users" approxItemHeight="70px" [headerFn]="separateLetter">
<div class="item-divider" *virtualHeader="let header">
<ion-label>{{header}}</ion-label>
</div>
<div *virtualItem="let user" class="item-checkbox">
<ion-checkbox color="primary"></ion-checkbox>
<p>{{user.first}} {{user.last}}</p>
<ion-icon name="ellipse"></ion-icon>
</div>
</ion-virtual-scroll>
</div>
</ion-content>
@@ -1,128 +0,0 @@
@import '~src/function.scss';
.header-toolbar{
--background:transparent;
--opacity: 1;
.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);
.div-icon{
width: rem(40);
float: right;
font-size: rem(35);
overflow: auto;
padding: 1px;
}
.div-icon ion-icon{
float: right;
padding-left: 20px;
}
.title-content{
margin: 0px auto;
overflow: auto;
padding: 0 !important;
}
.back-icon{
width: 37px;
float: left;
font-size: rem(35);
overflow: auto;
}
.div-title{
width: 221px;
padding: 0!important;
float: left;
margin: 2.5px 0 0 5px;
}
.title{
font-size: rem(25);
}
}
}
.toolbar-search{
--padding-top:0 !important;
--padding-bottom:0 !important;
--padding-start:0 !important;
--padding-end:0 !important;
.search{
border: 1px solid #ebebeb;
margin: 5px 20px 5px 20px;
border-radius: 5px;
}
.search ion-searchbar{
/* border: 1px solid green; */
width: 100%;
margin: 0 !important;
padding: 0 !important;
--border-radius: 5px;
--box-shadow: none;
overflow: auto;
--icon-color:var(--title-text-color);
}
}
ion-content{
--background:transparent;
}
.main-content{
width: 100%;
height: 100%;
font-family: Roboto;
margin: 0 auto;
background-color: #fff;
overflow:auto;
padding: 0 0 0 0;
.item-divider{
background: #ebebeb;
font-size: rem(15);
margin: 10px 0 10px 0;
padding:5px 0 5px 20px;
}
.item-checkbox{
display: flex;
margin: 10px 20px 10px 20px !important;
overflow: auto;
align-items: center;
}
.item-checkbox ion-checkbox{
--border-color: var(--title-text-color);
--background-checked:var(--title-text-color);
float: left;
}
.item-checkbox p{
display: block;
margin: 0 !important;
width: 330px;
padding-left: 10px;
font-size: rem(15);
color: var(--title-text-color);
float: left;
}
.item-checkbox ion-icon{
font-size: rem(10);
float: left;
color:#99e47b;
margin-left: 10px;
}
}
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { ContactsPage } from './contacts.page';
describe('ContactsPage', () => {
let component: ContactsPage;
let fixture: ComponentFixture<ContactsPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ContactsPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(ContactsPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,120 +0,0 @@
import { HttpHeaders } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { GroupMessagesPage } from '../../group-messages/group-messages.page';
import { ThemeService } from 'src/app/services/theme.service'
@Component({
selector: 'app-contacts',
templateUrl: './contacts.page.html',
styleUrls: ['./contacts.page.scss'],
})
export class ContactsPage implements OnInit {
showLoader: boolean;
users = [];
contact: string[] = [" Ana M.", "Andre F.", "Bruno G.", "Catarina T", "Tiago"];
headers: HttpHeaders;
options:any;
contacts = [
{
first: 'Ana',
last: 'Manuel',
url: 'https://randomuser.me/api/portraits/med/women/54.jpg',
},
{
first: 'Abdullah',
last: 'Hill',
url: 'https://randomuser.me/api/portraits/med/women/54.jpg',
},
{
first: 'Batur',
last: 'Oymen',
url: 'https://randomuser.me/api/portraits/med/women/54.jpg',
},
{
first: 'Bianca',
last: 'Costa',
url: 'https://randomuser.me/api/portraits/med/women/54.jpg',
},
{
first: 'Zaya',
last: 'Mary',
url: 'https://randomuser.me/api/portraits/med/women/54.jpg',
},
{
first: 'Tiago',
last: 'Kayaya',
url: 'https://randomuser.me/api/portraits/med/women/54.jpg',
}
];
constructor(
private modalController: ModalController,
public ThemeService: ThemeService
)
{ }
ngOnInit() {
this.loadUsers();
}
loadUsers(){
this.users = this.contacts.sort((a,b) => {
if(a.first < b.first){
return -1;
}
if(a.first > b.first){
return 1;
}
return 0;
});
}
separateLetter(record, recordIndex, records){
if(recordIndex == 0){
return record.first[0];
}
let first_prev = records[recordIndex - 1].first[0];
let first_current = record.first[0];
if(first_prev != first_current){
return first_current;
}
return null;
}
doRefresh(event){
}
close(){
this.modalController.dismiss();
}
onChange(event){
}
clicked(){
}
async groupMessages(){
const modal = await this.modalController.create({
component: GroupMessagesPage,
componentProps: {},
cssClass: 'contacts',
backdropDismiss: false
});
modal.onDidDismiss();
await modal.present();
}
}
@@ -1,21 +0,0 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { NewGroupPage } from './new-group.page';
const routes: Routes = [
{
path: '',
component: NewGroupPage
},
{
path: 'contacts',
loadChildren: () => import('./contacts/contacts.module').then( m => m.ContactsPageModule)
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class NewGroupPageRoutingModule {}
@@ -1,25 +0,0 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { NewGroupPageRoutingModule } from './new-group-routing.module';
import { NewGroupPage } from './new-group.page';
import { SharedModule } from 'src/app/shared/shared.module';
import { BtnSeguintePageModule } from 'src/app/shared/btn-seguinte/btn-seguinte.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
NewGroupPageRoutingModule,
BtnSeguintePageModule,
],
declarations: [NewGroupPage]
})
export class NewGroupPageModule {}
@@ -1,47 +0,0 @@
<ion-header class="ion-no-border">
<ion-toolbar class="header-toolbar">
<div class="main-header">
<div class="title-content width-100">
<div class="left">
<button class="btn-no-color" (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 == 'doneIt' " src="assets/images/theme/doneIt/icons-calendar-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="middle">
<ion-label class="title">Novo Grupo</ion-label>
</div>
<div *ngIf="groupName">
<button class="btn-no-color btn-criar" (click)="createGroup()">
<ion-label>Criar grupo</ion-label>
</button>
</div>
</div>
</div>
</ion-toolbar>
</ion-header>
<ion-content>
<div class="main-content">
<div class="item-container">
<ion-input [(ngModel)]="groupName" placeholder="Título"></ion-input>
</div>
<div class="item-container-no-border">
<ion-checkbox (ionChange)="_ionChange($event)" color="primary"></ion-checkbox>
<ion-label>Grupo Ultra-secreto</ion-label>
</div>
<div *ngIf="showDuration" class="container-div">
<div class="ion-item-class-2 width-100">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-duration.svg"></ion-icon>
</div>
<div class="ion-input-class">
<ion-input (click)="showPicker()" [(ngModel)]="displayDuration" placeholder="Duração"></ion-input>
</div>
</div>
</div>
</div>
</ion-content>
@@ -1,157 +0,0 @@
@import '~src/function.scss';
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: rem(45);
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: rem(45);
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{
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
.left{
width: 37px;
float: left;
font-size: rem(35);
overflow: auto;
}
.middle{
padding: 0!important;
float: left;
width:fit-content;
margin: 2.5px 0 0 5px;
}
.btn-criar{
padding: 0!important;
float: right;
font-size: rem(15);
color: var(--font-awesome);
margin: 8px 5px 0 5px;
}
.right{
padding: 0!important;
float: right;
font-size: rem(15);
color: #0782c9;
margin: 8px 0 0 5px;
}
}
.title{
font-size: rem(25);
}
.div-icon{
width: rem(40);
float: right;
font-size: rem(35);
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{
margin: 15px auto;
border: 1px solid #ebebeb;
border-radius: 5px;
padding-left: 10px;
}
.item-container-no-border{
display: flex;
margin: 25px auto;
border-radius: 5px;
align-items: center;
}
.item-container-no-border ion-label{
padding-left: 10px;
font-size: rem(12);
color: #000;
}
}
.container-div{
margin-bottom: 15px;
overflow: auto;
.ion-item-class-2{
margin: 0px auto;
overflow: auto;
.ion-icon-class{
width: rem(45);
height: rem(45);
float: left;
padding: 10px;
font-size: rem(25);
}
}
.ion-input-class{
width: calc(100% - 45px) !important;
height: rem(45);
border: 1px solid #ebebeb;
border-radius: 5px;
padding-left: 5px;
padding-right: 10px;
float: left;
}
}
@@ -1,24 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { NewGroupPage } from './new-group.page';
describe('NewGroupPage', () => {
let component: NewGroupPage;
let fixture: ComponentFixture<NewGroupPage>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NewGroupPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();
fixture = TestBed.createComponent(NewGroupPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,338 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular';
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 { SessionStore } from 'src/app/store/session.service';
import { ToastService } from 'src/app/services/toast.service';
import { catchError } from 'rxjs/operators';
@Component({
selector: 'app-new-group',
templateUrl: './new-group.page.html',
styleUrls: ['./new-group.page.scss'],
})
export class NewGroupPage implements OnInit {
isGroupCreated: boolean;
showLoader: boolean;
displayDuration: any;
showDuration: boolean;
selectedDuration = ['', '', ''];
thedate: any;
groupName: string;
documents: any;
loggedUserChat: any;
constructor(
private pickerController: PickerController,
private popoverController: PopoverController,
private modalController: ModalController,
private navParams: NavParams,
public ThemeService: ThemeService,
// public ChatSystemService: ChatSystemService,
private toastService: ToastService,
) {
this.loggedUserChat = SessionStore.user.ChatData['data'];
this.isGroupCreated = false;
this.groupName = this.navParams.get('name');
this.documents = this.navParams.get('documents');
}
ngOnInit() {
// this.chatService.refreshtoken();
// console.log(this.documents)
}
_ionChange(event) {
this.showDuration = event.detail.checked;
if (event.detail.checked) {
this.thedate = new Date();
}
else {
this.thedate = '';
}
}
close() {
this.modalController.dismiss();
}
async createGroup() {
// let name = this.groupName.split(' ').join('-');
// //Take out all special characters in string
// name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
// let customFields = {}
// let res: any;
// if(!SessionStore.user?.ChatData?.data) {
// this.toastService._successMessage("Chat temporariamente indisponível")
// }
// try {
// if (this.thedate) {
// let customFields = {
// "countDownDate": this.thedate
// }
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
// }
// else {
// res = await this.ChatSystemService.createPrivateRoom(name, SessionStore.user.UserName, customFields);
// }
// try {
// this.isGroupCreated = true;
// this.addContacts(res.result);
// this.ChatSystemService.getRoom([res.result]);
// setTimeout(() => {
// this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
// }, 10)
// } catch (error) {
// await this.ChatSystemService.getUser();
// await this.ChatSystemService.getAllRooms();
// await this.ChatSystemService.subscribeToRoom();
// this.isGroupCreated = true;
// this.addContacts(res.result);
// this.ChatSystemService.getRoom([res.result]);
// setTimeout(() => {
// this.ChatSystemService.subscribeToRoomUpdate(res.result.rid, res.result);
// }, 10)
// }
// if (res?.result?.rid) {
// this.ChatSystemService.getAllRooms(() => {
// if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
// this.createGroupWithAttachmentsCath(res)
// } else {
// setTimeout(() => {
// this.createGroupWithAttachments(res)
// }, 500)
// }
// }, res.result.rid);
// } else {
// this.toastService._badRequest('Existe um grupo com este nome!');
// }
// } catch(error) {
// this.toastService._successMessage("Chat temporariamente indisponível")
// }
}
createGroupWithAttachmentsCath(res: any) {
// if (!this.ChatSystemService.getGroupRoom(res.result.rid)) {
// setTimeout(() => {
// this.createGroupWithAttachmentsCath(res)
// }, 1500)
// } else {
// this.createGroupWithAttachments(res)
// }
}
createGroupWithAttachments(res: any) {
// this.ChatSystemService.getGroupRoom(res.result.rid).hasLoadHistory = true;
// if (this.documents) {
// this.documents.forEach(element => {
// this.ChatSystemService.getGroupRoom(res.result.rid).send({
// file: {
// "name": element.Assunto,
// "type": "application/webtrix",
// "ApplicationId": element.ApplicationId,
// "DocId": element.DocId,
// "Assunto": element.Assunto,
// },
// temporaryData: {
// data: {
// selected: {
// Id: element.DocId,
// ApplicationType: element.ApplicationId
// }
// }
// },
// attachments: [{
// "title": element.Assunto,
// "description": element.Assunto,
// "title_link_download": true,
// "type": "webtrix",
// "text": element.Assunto,
// "thumb_url": "https://static.ichimura.ed.jp/uploads/2017/10/pdf-icon.png",
// }],
// })
// });
// }
// this.ChatSystemService.getAllRooms();
// setTimeout(() => {
// this.groupName = ""
// }, 150);
}
async addContacts(room) {
this.close();
let name = this.groupName.split(' ').join('-');
const modal = await this.modalController.create({
component: GroupContactsPage,
componentProps: {
room: room,
},
cssClass: 'contacts',
backdropDismiss: false
});
modal.onDidDismiss();
await modal.present();
}
async setDuration(ev: any) {
const popover = await this.popoverController.create({
component: GroupDurationPage,
cssClass: 'group-duration',
event: ev,
translucent: true
});
return await popover.present();
}
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) => {
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,
value.minutes.value,
]
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: 0,
options: [
{ 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');
});
}
}
@@ -22,7 +22,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { EventTrigger } from 'src/app/services/eventTrigger.service';
import { Platform } from '@ionic/angular';
import { BackgroundService } from 'src/app/services/background.service';
import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page';
import { NewGroupPage } from 'src/app/ui/chat/modal/new-group/new-group.page';
import { DataService } from 'src/app/services/data.service';
import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage';
@@ -21,7 +21,7 @@ import { PermissionService } from 'src/app/services/permission.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'
import { DataService } from 'src/app/services/data.service';
import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page';
import { NewGroupPage } from 'src/app/ui/chat/modal/new-group/new-group.page';
import { RouteService } from 'src/app/services/route.service';
import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';