mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 05:16:07 +00:00
- Add and Customize contacts pages for group-messages and individual.
- Improved style in chat page
This commit is contained in:
@@ -10,7 +10,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="div-icon">
|
<div class="div-icon">
|
||||||
<ion-icon slot="end" (click)="newGroup()" src="assets/images/icons-chat-new-group.svg" ></ion-icon>
|
<ion-icon slot="end" (click)="newGroup()" src="assets/images/icons-chat-new-group.svg" ></ion-icon>
|
||||||
<!-- [routerLink]="['/home/chat/newchat']" -->
|
|
||||||
<ion-icon slot="end" (click)="selectContact()" src="assets/images/icons-chat-new-conversation.svg"></ion-icon>
|
<ion-icon slot="end" (click)="selectContact()" src="assets/images/icons-chat-new-conversation.svg"></ion-icon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -51,7 +50,7 @@
|
|||||||
<div (click)="openMessages()" class="item-content">
|
<div (click)="openMessages()" class="item-content">
|
||||||
<div class="item-title-time">
|
<div class="item-title-time">
|
||||||
<div class="item-title">
|
<div class="item-title">
|
||||||
<ion-label>Secretário para o sector Produtivo</ion-label>
|
<ion-label>Secretário para o sector Geral</ion-label>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-date">15:00</div>
|
<div class="item-date">15:00</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -67,7 +66,7 @@
|
|||||||
<div (click)="openMessages()" class="item-content">
|
<div (click)="openMessages()" class="item-content">
|
||||||
<div class="item-title-time">
|
<div class="item-title-time">
|
||||||
<div class="item-title">
|
<div class="item-title">
|
||||||
<ion-label>Secretário para o sector Produtivo</ion-label>
|
<ion-label>Secretário para o sector Agricola</ion-label>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-date">15:00</div>
|
<div class="item-date">15:00</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -83,7 +82,7 @@
|
|||||||
<div (click)="openMessages()" class="item-content">
|
<div (click)="openMessages()" class="item-content">
|
||||||
<div class="item-title-time">
|
<div class="item-title-time">
|
||||||
<div class="item-title">
|
<div class="item-title">
|
||||||
<ion-label>Secretário para o sector Produtivo</ion-label>
|
<ion-label>Secretário para o sector Adminstrativo</ion-label>
|
||||||
</div>
|
</div>
|
||||||
<div class="item-date">15:00</div>
|
<div class="item-date">15:00</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -121,6 +120,22 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="item">
|
||||||
|
<div class="item-icon">
|
||||||
|
<ion-icon class="icon" slot="start" src="assets/images/icons-chat-group-chat-40.svg"></ion-icon>
|
||||||
|
</div>
|
||||||
|
<div (click)="openGroupMessages()" class="item-content">
|
||||||
|
<div class="item-title-time">
|
||||||
|
<div class="item-title">
|
||||||
|
<ion-label>Secretário para o sector Produtivo</ion-label>
|
||||||
|
</div>
|
||||||
|
<div class="item-date">15:00</div>
|
||||||
|
</div>
|
||||||
|
<div class="item-description">
|
||||||
|
<p>Podemos marcar reunião para amanha</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</ion-item-sliding>
|
</ion-item-sliding>
|
||||||
</ion-item-group>
|
</ion-item-group>
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,7 @@
|
|||||||
.item{
|
.item{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-bottom: 1px solid #ebebeb;
|
border-bottom: 1px solid #ebebeb;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
.item-icon{
|
.item-icon{
|
||||||
width: 40px;
|
width: 40px;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { ChatService } from 'src/app/services/chat.service';
|
|||||||
import { ConversationPage } from './conversation/conversation.page';
|
import { ConversationPage } from './conversation/conversation.page';
|
||||||
import { GroupMessagesPage } from './group-messages/group-messages.page';
|
import { GroupMessagesPage } from './group-messages/group-messages.page';
|
||||||
import { MessagesPage } from './messages/messages.page';
|
import { MessagesPage } from './messages/messages.page';
|
||||||
|
import { ContactsPage } from './messages/contacts/contacts.page';
|
||||||
import { NewGroupPage } from './new-group/new-group.page';
|
import { NewGroupPage } from './new-group/new-group.page';
|
||||||
import { NewchatPage } from './newchat/newchat.page';
|
import { NewchatPage } from './newchat/newchat.page';
|
||||||
|
|
||||||
@@ -31,7 +32,7 @@ export class ChatPage implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.segment = "Contactos";
|
this.segment = "Contactos";
|
||||||
this.doRefresh();
|
this.doRefresh();
|
||||||
this.authService.getUserData();
|
/* this.authService.getUserData(); */
|
||||||
|
|
||||||
}
|
}
|
||||||
onSegmentChange(){
|
onSegmentChange(){
|
||||||
@@ -72,8 +73,8 @@ export class ChatPage implements OnInit {
|
|||||||
}
|
}
|
||||||
async selectContact(){
|
async selectContact(){
|
||||||
const modal = await this.modalController.create({
|
const modal = await this.modalController.create({
|
||||||
component: NewchatPage,
|
component: ContactsPage,
|
||||||
cssClass: 'newchat',
|
cssClass: 'contacts',
|
||||||
backdropDismiss: false,
|
backdropDismiss: false,
|
||||||
});
|
});
|
||||||
await modal.present();
|
await modal.present();
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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 {}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
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';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
IonicModule,
|
||||||
|
SharedModule,
|
||||||
|
GroupContactsPageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [GroupContactsPage]
|
||||||
|
})
|
||||||
|
export class GroupContactsPageModule {}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<ion-header class="ion-no-border">
|
||||||
|
<ion-toolbar class="header-toolbar">
|
||||||
|
<div class="main-header">
|
||||||
|
<div class="title-content">
|
||||||
|
<div class="back-icon">
|
||||||
|
<ion-icon (click)="close()" slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
|
||||||
|
</div>
|
||||||
|
<div class="div-title">
|
||||||
|
<ion-label class="title">Contactos</ion-label>
|
||||||
|
</div>
|
||||||
|
<app-btn-seguinte (click)="groupMessages()"></app-btn-seguinte>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ion-toolbar>
|
||||||
|
<ion-toolbar class="toolbar-search">
|
||||||
|
<div class="search">
|
||||||
|
<ion-searchbar (ionChange)="onChange($event)" placeholder="Pesquisar por cantacto" ></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>
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
.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: 40px;
|
||||||
|
float: right;
|
||||||
|
font-size: 35px;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
.div-icon ion-icon{
|
||||||
|
float: right;
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
.title-content{
|
||||||
|
width: 360px;
|
||||||
|
margin: 0px auto;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-icon{
|
||||||
|
width: 37px;
|
||||||
|
float: left;
|
||||||
|
font-size: 35px;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
}
|
||||||
|
.div-title{
|
||||||
|
width: 221px;
|
||||||
|
padding: 0!important;
|
||||||
|
float: left;
|
||||||
|
margin: 2.5px 0 0 5px;
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
font-size: 25px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.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:#0d89d1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
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: 15px;
|
||||||
|
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: #0d89d1;
|
||||||
|
--background-checked:#0d89d1;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-checkbox p{
|
||||||
|
display: block;
|
||||||
|
margin: 0 !important;
|
||||||
|
width: 330px;
|
||||||
|
padding-left: 10px;
|
||||||
|
font-size: 15px;
|
||||||
|
color: #0d89d1;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.item-checkbox ion-icon{
|
||||||
|
font-size: 10px;
|
||||||
|
float: left;
|
||||||
|
color:#99e47b;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { ModalController } from '@ionic/angular';
|
||||||
|
import { GroupMessagesPage } from '../group-messages.page';
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
contacts: Contact[] = [
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
private http: HttpClient,
|
||||||
|
)
|
||||||
|
{
|
||||||
|
this.headers = new HttpHeaders();
|
||||||
|
this.headers = this.headers.set('Access-Control-Allow-Origin' , '*');
|
||||||
|
this.headers = this.headers.set('Access-Control-Allow-Methods', 'POST, GET, OPTIONS, PUT');
|
||||||
|
this.headers = this.headers.set('Accept','application/json');
|
||||||
|
this.headers = this.headers.set('content-type','application/json');
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.loadUsers();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
loadUsers(){
|
||||||
|
this.options = {
|
||||||
|
headers: this.headers,
|
||||||
|
};
|
||||||
|
/* this.http.get('https://randomuser.me/api/?results=100', this.options)
|
||||||
|
.subscribe(res => {
|
||||||
|
this.users = res['results'].sort((a,b) => {
|
||||||
|
if(a.name.first < b.name.first){
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(a.name.first > b.name.first){
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
console.log(res);
|
||||||
|
console.log(this.users);
|
||||||
|
}); */
|
||||||
|
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.name.first[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
let first_prev = records[recordIndex - 1].name.first[0];
|
||||||
|
let first_current = record.name.first[0];
|
||||||
|
|
||||||
|
if(first_prev != first_current){
|
||||||
|
return first_current;
|
||||||
|
}
|
||||||
|
return null; */
|
||||||
|
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(){
|
||||||
|
console.log('clicked');
|
||||||
|
|
||||||
|
}
|
||||||
|
async groupMessages(){
|
||||||
|
const modal = await this.modalController.create({
|
||||||
|
component: GroupMessagesPage,
|
||||||
|
componentProps: {},
|
||||||
|
cssClass: 'contacts',
|
||||||
|
backdropDismiss: false
|
||||||
|
});
|
||||||
|
|
||||||
|
await modal.present();
|
||||||
|
|
||||||
|
modal.onDidDismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,11 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: GroupMessagesPage
|
component: GroupMessagesPage
|
||||||
|
},
{
|
||||||
|
path: 'group-contacts',
|
||||||
|
loadChildren: () => import('./group-contacts/group-contacts.module').then( m => m.GroupContactsPageModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
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 {}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
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';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
IonicModule,
|
||||||
|
SharedModule,
|
||||||
|
ContactsPageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [ContactsPage]
|
||||||
|
})
|
||||||
|
export class ContactsPageModule {}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<ion-header class="ion-no-border">
|
||||||
|
<ion-toolbar class="header-toolbar">
|
||||||
|
<div class="main-header">
|
||||||
|
<div class="title-content">
|
||||||
|
<div class="back-icon">
|
||||||
|
<ion-icon (click)="close()" slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
|
||||||
|
</div>
|
||||||
|
<div class="div-title">
|
||||||
|
<ion-label class="title">Nova Conversa</ion-label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ion-toolbar>
|
||||||
|
<ion-toolbar class="toolbar-search">
|
||||||
|
<div class="search">
|
||||||
|
<ion-searchbar (ionChange)="onChange($event)" placeholder="Pesquisar por cantacto" ></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-virtual-scroll [items]="users" approxItemHeight="70px" [headerFn]="separateLetter">
|
||||||
|
|
||||||
|
<div class="item-divider" *virtualHeader="let header">
|
||||||
|
<ion-label>{{header}}</ion-label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div (click)="openMessages()" *virtualItem="let user" class="item-user">
|
||||||
|
<p>{{user.first}} {{user.last}}</p>
|
||||||
|
<span class="icon">
|
||||||
|
<ion-icon slot="end" name="ellipse"></ion-icon>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</ion-virtual-scroll>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</ion-content>
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
|
||||||
|
.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: 40px;
|
||||||
|
float: right;
|
||||||
|
font-size: 35px;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
.div-icon ion-icon{
|
||||||
|
float: right;
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
.title-content{
|
||||||
|
width: 360px;
|
||||||
|
margin: 0px auto;
|
||||||
|
overflow: auto;
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-icon{
|
||||||
|
width: 37px;
|
||||||
|
float: left;
|
||||||
|
font-size: 35px;
|
||||||
|
overflow: auto;
|
||||||
|
|
||||||
|
}
|
||||||
|
.div-title{
|
||||||
|
width: 221px;
|
||||||
|
padding: 0!important;
|
||||||
|
float: left;
|
||||||
|
margin: 2.5px 0 0 5px;
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
font-size: 25px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.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:#0d89d1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
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: 15px;
|
||||||
|
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: 15px;
|
||||||
|
color: #0d89d1;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.item-user .icon{
|
||||||
|
width: 10%;
|
||||||
|
display: block;
|
||||||
|
text-align: right;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
.icon ion-icon{
|
||||||
|
font-size: 10px;
|
||||||
|
color:#99e47b;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
import { HttpClient, 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 { MessagesPage } from '../messages.page';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-contacts',
|
||||||
|
templateUrl: './contacts.page.html',
|
||||||
|
styleUrls: ['./contacts.page.scss'],
|
||||||
|
})
|
||||||
|
export class ContactsPage implements OnInit {
|
||||||
|
showLoader: boolean;
|
||||||
|
users = [];
|
||||||
|
|
||||||
|
headers: HttpHeaders;
|
||||||
|
options:any;
|
||||||
|
|
||||||
|
contacts: Contact[] = [
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
private http: HttpClient,
|
||||||
|
)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.loadUsers();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
loadUsers(){
|
||||||
|
this.options = {
|
||||||
|
headers: this.headers,
|
||||||
|
};
|
||||||
|
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(){
|
||||||
|
console.log('clicked');
|
||||||
|
|
||||||
|
}
|
||||||
|
async openMessages(){
|
||||||
|
this.close();
|
||||||
|
const modal = await this.modalController.create({
|
||||||
|
component: MessagesPage,
|
||||||
|
cssClass: 'group-messages',
|
||||||
|
backdropDismiss: false,
|
||||||
|
});
|
||||||
|
await modal.present();
|
||||||
|
modal.onDidDismiss();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,11 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: MessagesPage
|
component: MessagesPage
|
||||||
|
},
{
|
||||||
|
path: 'contacts',
|
||||||
|
loadChildren: () => import('./contacts/contacts.module').then( m => m.ContactsPageModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|||||||
@@ -47,9 +47,6 @@
|
|||||||
|
|
||||||
</ion-virtual-scroll>
|
</ion-virtual-scroll>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user