> git show --textconv :src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts

This commit is contained in:
Tiago Kayaya
2020-12-16 15:07:28 +01:00
parent be03b9c0d3
commit c720767774
25 changed files with 329 additions and 122 deletions
+6 -3
View File
@@ -1,4 +1,4 @@
import { NgModule } from '@angular/core';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
@@ -7,14 +7,17 @@ import { IonicModule } from '@ionic/angular';
import { ChatPageRoutingModule } from './chat-routing.module';
import { ChatPage } from './chat.page';
import { SharedModule } from 'src/app/shared/shared.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
ChatPageRoutingModule
SharedModule,
ChatPageRoutingModule,
],
declarations: [ChatPage]
declarations: [ChatPage],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ChatPageModule {}
+21 -6
View File
@@ -1,12 +1,24 @@
<ion-header>
<ion-toolbar>
<ion-title>Chat</ion-title>
<ion-icon slot="end" src="assets/images/icons-chat-new-group.svg" class="iconschatnew-group"></ion-icon>
<ion-icon slot="end" src="assets/images/icons-chat-new-conversation.svg" class="iconschatnew-conversation" [routerLink]="['/home/chat/newchat']"></ion-icon>
<app-header></app-header>
</ion-header>
<ion-header class="ion-no-border">
<ion-toolbar class="bg-blue">
<div class="main-header">
<div class="title-content">
<div class="div-title">
<ion-label class="title">Chat</ion-label>
</div>
<div class="div-icon">
<ion-icon slot="end" src="assets/images/icons-chat-new-group.svg" ></ion-icon>
<ion-icon slot="end" src="assets/images/icons-chat-new-conversation.svg" [routerLink]="['/home/chat/newchat']"></ion-icon>
</div>
</div>
</div>
</ion-toolbar>
</ion-header>
<ion-content>
<div class="main-content">
<ion-toolbar >
<ion-segment [(ngModel)]="segment" (ionChange)="onSegmentChange()">
<ion-segment-button value="Contactos">
@@ -17,8 +29,11 @@
</ion-segment-button>
</ion-segment>
</ion-toolbar>
<ion-refresher name="refresher" slot="fixed" (ionRefresh)="doRefresh($event)">
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
</ion-refresher>
<div [ngSwitch]="segment">
<ion-list *ngSwitchCase="'Contactos'" >
<ion-list *ngSwitchCase="'Contactos'">
<ion-item-group>
<ion-item-sliding>
<ion-item *ngFor="let user of userConnectedList" (click)="starConversation(user)">
@@ -46,6 +61,6 @@
</ion-list>
</div>
</div>
</ion-content>
+47
View File
@@ -20,4 +20,51 @@
width: 40px;
height: 40px;
object-fit: contain;
}
.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{
width: 360px;
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
}
.div-title{
padding: 0!important;
float: left;
}
.title{
font-size: 25px;
}
.div-icon{
width: 112px;
float: right;
font-size: 35px;
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;
}
+14 -8
View File
@@ -10,6 +10,7 @@ import { ConversationPage } from './conversation/conversation.page';
styleUrls: ['./chat.page.scss'],
})
export class ChatPage implements OnInit {
showLoader: boolean;
loggedUser: any;
/* Set segment variable */
segment:string;
@@ -24,28 +25,33 @@ export class ChatPage implements OnInit {
ngOnInit() {
this.segment = "Contactos";
this.authService.userData$.subscribe((res:any)=>{
this.loggedUser=res;
});
this.doRefresh();
}
onSegmentChange(){
this.doRefresh();
}
doRefresh(){
this.getGroups();
this.getConnectedUsers();
}
onSegmentChange(){
this.RefreshEvents();
}
RefreshEvents(){}
getGroups(){
this.showLoader = true;
this.result = this.chatService.getAllPrivateGroups().subscribe((res:any)=>{
this.groupList = res.groups;
/* console.log(this.groupList); */
this.showLoader = false;
});
}
getConnectedUsers(){
this.showLoader = true;
this.result = this.chatService.getAllConnectedUsers().subscribe((res:any)=>{
this.userConnectedList = res.users;
console.log(this.userConnectedList);
this.showLoader = false;
});
}
async starConversation(selectedUser) {
const modal = await this.modalController.create({
component: ConversationPage,
+9 -25
View File
@@ -55,28 +55,15 @@ export class LoginPage implements OnInit {
await alert.present();
}
loginAction(){
if(this.validateInput()){
/* this.authService.loginChat2(this.postData).subscribe((res: any) =>{
if(res.data){
this.storageService.store(AuthConnstants.AUTH, res.data);
console.log('Log RockectChat OK');
//console.log(res.data);
}
else{
console.log("Invalid username or password!");
}
},
(error:any) =>{
console.log('Network error');
}) */
}
else{
this.presentAlert('Por favor, insira o seu nome de utilizador e palavra-passe.');
}
loginRocketChat(){
this.authService.loginChat(this.postData).subscribe((res: any) =>{
console.log('Login to Rocket chat OK');
},(error:any) =>{
console.log('Network error');
});
}
async Login(){
try {
@@ -90,7 +77,7 @@ export class LoginPage implements OnInit {
BasicAuthKey: ""
}
if (await this.authService.login(this.userattempt)){
this.loginAction();
this.loginRocketChat();
console.log('Log Gabinete Digital OK');
this.router.navigate(['/home/events']);
}
@@ -108,7 +95,4 @@ export class LoginPage implements OnInit {
this.presentAlert('Ocorreu um erro ao fazer login. Contacte o administrador de sistema.');
}
}
openCamera(){
this.photoService.takePicture();
}
}
@@ -7,12 +7,14 @@ import { IonicModule } from '@ionic/angular';
import { PublicationsPageRoutingModule } from './publications-routing.module';
import { PublicationsPage } from './publications.page';
import { SharedModule } from 'src/app/shared/shared.module';
@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
SharedModule,
PublicationsPageRoutingModule
],
declarations: [PublicationsPage]
@@ -1,4 +1,7 @@
<ion-header class="ion-no-border">
<ion-header>
<app-header></app-header>
</ion-header>
<!-- <ion-header class="ion-no-border">
<ion-toolbar class="bg-blue">
<div class="div-top-header">
<div class="div-search">
@@ -12,7 +15,7 @@
</div>
</div>
</ion-toolbar>
</ion-header>
</ion-header> -->
<ion-header class="ion-no-border">
<ion-toolbar class="bg-blue">
<div class="main-header">
@@ -36,8 +39,6 @@
</ion-refresher-content>
</ion-refresher>
<div class="main-content">
<!-- [routerLink]="['/home/publications/view-publications', folder.ProcessId]" -->
<div class="item"
*ngFor="let viagem of publicationsTravelFolderList"
@@ -54,7 +54,33 @@ ion-toolbar{
overflow:hidden;
padding: 30px 20px 0px 20px;
color:#000;
transform: translate3d(0, 5px, 0);
transform: translate3d(0, 1px, 0);
.title-content{
width: 360px;
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
}
.div-title{
padding: 0!important;
float: left;
}
.title{
font-size: 25px;
}
.div-icon{
width: 40px;
float: right;
font-size: 35px;
overflow: auto;
padding: 1px;
}
.div-icon ion-icon{
float: right;
padding-left: 20px;
}
}
.main-content{
width: 100%; /* 400px */
@@ -65,26 +91,6 @@ ion-toolbar{
overflow:auto;
padding: 15px 20px 0 20px;
}
.title-content{
width: 360px;
margin: 0px auto;
overflow: auto;
padding: 0 !important;
background: #fff;
}
.div-title{
padding: 0!important;
float: left;
}
.title{
font-size: 25px;
}
.div-icon{
width: 40px;
float: right;
font-size: 35px;
overflow: auto;
}
.item{
width: 360px;
padding: 0 0px 0 0px;
@@ -27,6 +27,11 @@
<p class="post-data">{{publication.DatePublication | date: 'dd-MM-yy | h:mm'}}</p>
</div>
</div>
<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="post-item">
<div *ngIf="publication.FileBase64.length > 30" class="post-img">
<img src="{{publication.FileBase64}}" alt="image" tappable (click)="openPreview(publication.FileBase64)">
@@ -11,7 +11,7 @@ import { NewPublicationPage } from '../../new-publication/new-publication.page';
styleUrls: ['./publication-detail.page.scss'],
})
export class PublicationDetailPage implements OnInit {
showLoader: boolean;
publicationId: string;
folderId: string;
publication: Publication;
@@ -42,6 +42,7 @@ export class PublicationDetailPage implements OnInit {
}
getPublicationDetail(){
this.showLoader = true;
console.log(this.publicationId);
console.log(this.folderId);
this.publications.GetPublicationById(this.folderId,this.publicationId).subscribe(res=>{
@@ -56,7 +57,8 @@ export class PublicationDetailPage implements OnInit {
OriginalFileName: '',
FileExtension: '',
}
})
this.showLoader = false;
});
}
close(){