This commit is contained in:
Peter Maquiran
2022-03-11 10:28:15 +01:00
117 changed files with 34570 additions and 1031 deletions
+1 -1
View File
@@ -143,7 +143,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
Media,
StreamingMedia,
PhotoViewer,
NgxImageCompressService
NgxImageCompressService,
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
@@ -1,9 +1,25 @@
<ion-content class=" bg-blue">
<div class="main-content width-100 overflow-y-auto height-100">
<div class="profile-header width-100">
<div class="div-logo d-md-none">
<div class="logo height-fit-content">
<img class="img" src='assets/images/logo-no-bg.png' alt='logo'>
<div class="div-logo d-md-none width-40">
<div class="logo-icon">
<img *ngIf="ThemeService.currentTheme == 'default' " src='assets/images/logo-no-bg.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'gov' " src='assets/images/theme/gov/governoangola_A.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'tribunal' " src='assets/images/theme/tribunal/tribunal-constitucional.png' alt='logo'>
</div>
<div *ngIf="ThemeService.currentTheme == 'gov'" class="logo-description d-flex align-center justify-content-center">
<div class="logo-description-content">
<p class="logo-description-text">Presidente da República</p>
<div class="add-line"></div>
<p class="logo-description-text tp-5">GABINETE DIGITAL</p>
</div>
</div>
<div *ngIf="ThemeService.currentTheme == 'default'" class="logo-description d-flex align-center justify-content-center">
<div class="logo-description-content">
<p class="logo-description-text color-white">Presidente da República</p>
<div class="add-line-white"></div>
<p class="logo-description-text tp-5 color-white">GABINETE DIGITAL</p>
</div>
</div>
</div>
<div class="btn-close d-flex cursor-pointer" (click)="close()">
@@ -10,18 +10,68 @@
.div-logo{
background: transparent;
width: calc(100% - 40px) !important;
width: em(140px);
justify-content: center;
display: flex;
color: black;
overflow: auto;
float: left;
.logo{
width: 140px;
.img{
.logo-icon{
width: 25.33%;
overflow: auto;
img{
width: 100%;
margin: 0px auto;
}
}
.logo-description{
width: 74.67%;
margin: 0 auto;
overflow: auto;
font-size: 8.5px;
font-family: Bahnschrift;
.logo-description-content{
width: 100%;
.logo-description-text{
font-weight: 700;
text-align: center;
width: 100%;
margin: 0 !important;
padding: 0 !important;
}
.add-line{
width: 100%;
border-bottom: 1px solid #000;
margin-bottom: 2.5px !important;
padding: 0 !important;
}
.add-line-white{
width: 100%;
border-bottom: 1px solid #fff;
margin-bottom: 2.5px !important;
padding: 0 !important;
}
}
.color-white{
color: #fff !important;
}
.add-botton-border{
border-bottom: 1px solid #000;
}
.add-botton-border-white{
border-bottom: 1px solid #fff;
}
}
}
}
.btn-close{
+23 -7
View File
@@ -1,8 +1,24 @@
<ion-header class=" bg-blue ion-no-border">
<div class="profile-header width-100">
<div class="div-logo d-md-none">
<div class="logo height-fit-content">
<img class="img" src='assets/images/logo-no-bg.png' alt='logo'>
<div class="div-logo d-md-none width-40">
<div class="logo-icon">
<img *ngIf="ThemeService.currentTheme == 'default' " src='assets/images/logo-no-bg.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'gov' " src='assets/images/theme/gov/governoangola_A.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'tribunal' " src='assets/images/theme/tribunal/tribunal-constitucional.png' alt='logo'>
</div>
<div *ngIf="ThemeService.currentTheme == 'gov'" class="logo-description d-flex align-center justify-content-center">
<div class="logo-description-content">
<p class="logo-description-text">Presidente da República</p>
<div class="add-line"></div>
<p class="logo-description-text tp-5">GABINETE DIGITAL</p>
</div>
</div>
<div *ngIf="ThemeService.currentTheme == 'default'" class="logo-description d-flex align-center justify-content-center">
<div class="logo-description-content">
<p class="logo-description-text color-white">Presidente da República</p>
<div class="add-line-white"></div>
<p class="logo-description-text tp-5 color-white">GABINETE DIGITAL</p>
</div>
</div>
</div>
<div class="btn-close d-flex cursor-pointer" (click)="close()">
@@ -13,7 +29,7 @@
</ion-header>
<ion-header class=" bg-blue ion-no-border">
<div class="profile-content">
<div class="profile-title d-flex justify-content-center width-100">
<ion-label >{{loggeduser.RoleDescription}}</ion-label>
</div>
@@ -37,7 +53,7 @@
<div class="d-flex flex-column height-100 overflow-y-auto">
<div class="notifications-content height-100">
<ion-list>
<div class="item cursor-pointer ion-no-padding ion-no-margin" lines="none"
*ngFor = "let item of notificationdata; let i = index"
@@ -66,9 +82,9 @@
</div>
</div>
</ion-list>
</div>
</div>
</ion-content>
+55 -5
View File
@@ -4,20 +4,70 @@
padding: 20px 20px;
border: 0 !important;
.div-logo {
.div-logo{
background: transparent;
width: calc(100% - 40px) !important;
width: em(140px);
justify-content: center;
display: flex;
color: black;
overflow: auto;
float: left;
.logo {
width: 140px;
.img {
.logo-icon{
width: 25.33%;
overflow: auto;
img{
width: 100%;
margin: 0px auto;
}
}
.logo-description{
width: 74.67%;
margin: 0 auto;
overflow: auto;
font-size: 8.5px;
font-family: Bahnschrift;
.logo-description-content{
width: 100%;
.logo-description-text{
font-weight: 700;
text-align: center;
width: 100%;
margin: 0 !important;
padding: 0 !important;
}
.add-line{
width: 100%;
border-bottom: 1px solid #000;
margin-bottom: 2.5px !important;
padding: 0 !important;
}
.add-line-white{
width: 100%;
border-bottom: 1px solid #fff;
margin-bottom: 2.5px !important;
padding: 0 !important;
}
}
.color-white{
color: #fff !important;
}
.add-botton-border{
border-bottom: 1px solid #000;
}
.add-botton-border-white{
border-bottom: 1px solid #fff;
}
}
}
}
.btn-close {
@@ -8,6 +8,7 @@ import { ViewMediaPageRoutingModule } from './view-media-routing.module';
import { ViewMediaPage } from './view-media.page';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { PdfViewerModule } from 'ng2-pdf-viewer';
@NgModule({
imports: [
@@ -15,7 +16,8 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
FormsModule,
IonicModule,
FontAwesomeModule,
ViewMediaPageRoutingModule
ViewMediaPageRoutingModule,
PdfViewerModule
],
declarations: [ViewMediaPage]
})
@@ -20,7 +20,13 @@
<ion-slides style="width: 100%; height: 100%;" [options]="sliderOpts">
<ion-slide>
<div class="swiper-zoom-container">
<img src="{{image}}">
<div *ngIf="type == 'application/img'">
<img src="{{image}}">
</div>
<div *ngIf="type == 'application/pdf'">
<pdf-viewer [src]="image" [render-text]="true" [original-size]="false" [zoom]="0.5" style="display: block;">
</pdf-viewer>
</div>
</div>
</ion-slide>
</ion-slides>
@@ -9,6 +9,7 @@ import { ModalController, NavParams } from '@ionic/angular';
export class ViewMediaPage implements OnInit {
image: any;
type: any;
name: string
_updatedAt: string
@@ -22,6 +23,7 @@ export class ViewMediaPage implements OnInit {
private navParams:NavParams,
) {
this.image = this.navParams.get('image')
this.type = this.navParams.get('type')
this.name = this.navParams.get('username')
this._updatedAt = this.navParams.get('_updatedAt')
}
+2 -2
View File
@@ -69,7 +69,7 @@
<div *ngIf="room.lastMessage" class="item-description" [class.item-description-active]="room.id == idSelected">
<ion-label *ngIf="room.lastMessage && room.otherUserType == false">{{room.lastMessage.msg}}</ion-label>
<ion-label *ngIf="room.otherUserType == true">A escrever...</ion-label>
<ion-label *ngIf="room.otherUserType == true">está escrever...</ion-label>
<!-- <ion-label *ngIf="room.lastMessage.file">
<fa-icon *ngIf="room.lastMessage.file.type != 'application/meeting'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="room.id == idSelected"></fa-icon>
</ion-label> -->
@@ -131,7 +131,7 @@
</div>
<div *ngIf="group.lastMessage" class="item-description d-flex align-items-center" [class.item-description-active]="group.id ==idSelected">
<div class="item-message" *ngIf="group.otherUserType == false">{{group.lastMessage.u.name}}: {{group.lastMessage.msg}} </div>
<div *ngIf="group.otherUserType == true">{{group.userThatIsTyping}} A escrever ...</div>
<div *ngIf="group.otherUserType == true">{{group.userThatIsTyping}} está escrever ...</div>
<div class="item-files add-ellipsis" *ngIf="group.file">
<fa-icon *ngIf="group.lastMessage.file.type != 'application/meeting'" icon="file-alt" class="file-icon" [class.set-active-item-font-to-white]="group.id == idSelected"></fa-icon>
@@ -107,7 +107,7 @@
</div>
<div *ngIf="msg.file.type != 'application/img'">
<div class="file">
<div (click)="viewDocument(msg.file, file.title_link)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<div (click)="openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
@@ -1,5 +1,5 @@
import { Component, ElementRef, OnInit, ViewChild, AfterViewChecked, AfterViewInit, OnDestroy, ChangeDetectorRef, } from '@angular/core';
import { ActionSheetController, IonSlides, MenuController, ModalController, NavParams, PopoverController,Platform } from '@ionic/angular';
import { ActionSheetController, IonSlides, MenuController, ModalController, NavParams, PopoverController, Platform } from '@ionic/angular';
import { AlertService } from 'src/app/services/alert.service';
import { AuthService } from 'src/app/services/auth.service';
import { ChatService } from 'src/app/services/chat.service';
@@ -8,7 +8,7 @@ import { ChatPopoverPage } from 'src/app/shared/popover/chat-popover/chat-popove
import { ContactsPage } from '../new-group/contacts/contacts.page';
import { NewGroupPage } from '../new-group/new-group.page';
import { GroupContactsPage } from './group-contacts/group-contacts.page';
import {Router} from '@angular/router'
import { Router } from '@angular/router'
import { EditGroupPage } from '../edit-group/edit-group.page';
import { TimeService } from 'src/app/services/functions/time.service';
import { FileLoaderService } from 'src/app/services/file/file-loader.service';
@@ -43,33 +43,33 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
showLoader: boolean;
isGroupCreated:boolean;
isGroupCreated: boolean;
loggedUser: any;
room:any;
roomName:any;
members:any;
room: any;
roomName: any;
members: any;
contacts: string[] = [" Ana M.", "Andre F.", "Bruno G.", "Catarina T", "Tiago"];
allUsers:any[] = [];
allUsers: any[] = [];
roomId: string;
loggedUserChat:any;
loggedUserChat: any;
eventSelectedDate: Date = new Date();
scrollingOnce:boolean = true;
scrollingOnce: boolean = true;
private scrollChangeCallback: () => void;
currentPosition: any;
startPosition: number;
capturedImage:any;
capturedImageTitle:any;
capturedImage: any;
capturedImageTitle: any;
attendees: EventPerson[] = [];
scrollToBottomBtn = false;
longPressActive = false;
showMessageOptions = false;
selectedMsgId:string;
roomCountDownDate:any;
selectedMsgId: string;
roomCountDownDate: any;
downloadFile: any;
@ViewChild('scrollMe') private myScrollContainer: ElementRef;
@@ -104,7 +104,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.isGroupCreated = true;
this.roomId = this.navParams.get('roomId');
window.onresize = (event) => {
if( window.innerWidth > 701){
if (window.innerWidth > 701) {
this.modalController.dismiss();
}
};
@@ -113,7 +113,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.wsChatMethodsService.getGroupRoom(this.roomId).scrollDown = this.scrollToBottomClicked;
this.wsChatMethodsService.openRoom(this.roomId)
setTimeout(()=>{
setTimeout(() => {
this.scrollToBottomClicked()
}, 50)
@@ -121,7 +121,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
ngOnInit() {
console.log(this.roomId);
this.loggedUser=this.loggedUserChat;
this.loggedUser = this.loggedUserChat;
this.getRoomInfo();
this.scrollToBottom();
this.serverLongPull();
@@ -134,7 +134,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
})
}
setStatus(status:string){
setStatus(status: string) {
let body = {
message: '',
status: status,
@@ -144,16 +144,16 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
})
}
deleteMessage(msgId:string){
deleteMessage(msgId: string) {
let body = {
"roomId": this.roomId,
"msgId": msgId,
"asUser": false,
}
if(msgId){
if (msgId) {
//this.alertService.confirmDeleteMessage(body);
}
else{
else {
this.toastService.badRequest('Não foi possível apagar');
}
this.showMessageOptions = false;
@@ -166,12 +166,12 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.roomCountDownDate = this.timeService.countDownDate(this.room.customFields.countDownDate, this.room._id);
}
handlePress(id?:string){
handlePress(id?: string) {
this.selectedMsgId = id;
this.showMessageOptions = true;
}
handleClick(){
handleClick() {
this.showMessageOptions = false;
this.selectedMsgId = "";
}
@@ -188,10 +188,10 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
//alert('UP');
this.scrollingOnce = false;
}
if((containerHeight - 100) > scroll){
if ((containerHeight - 100) > scroll) {
this.scrollToBottomBtn = true;
}
else{
else {
this.scrollToBottomBtn = false;
}
this.currentPosition = scroll;
@@ -225,25 +225,25 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
scrollToBottom(): void {
try {
if(this.scrollingOnce){
if (this.scrollingOnce) {
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
//this.scrollingOnce = false;
}
} catch(err) { }
} catch (err) { }
}
scrollToBottomClicked = () => {
try {
this.myScrollContainer.nativeElement.scrollTop = this.myScrollContainer.nativeElement.scrollHeight;
} catch(err) { }
} catch (err) { }
}
getRoomInfo(){
getRoomInfo() {
this.showLoader = true;
this.chatService.getRoomInfo(this.roomId).subscribe(room=>{
this.chatService.getRoomInfo(this.roomId).subscribe(room => {
this.room = room['room'];
this.roomName = this.room.name.split('-').join(' ');
if(this.room.customFields.countDownDate){
if (this.room.customFields.countDownDate) {
this.roomCountDownDate = this.timeService.countDownDateTimer(this.room.customFields.countDownDate, this.room._id);
}
this.getGroupContacts(this.room);
@@ -251,9 +251,9 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
}
async getChatMembers(){
async getChatMembers() {
//return await this.chatService.getMembers(roomId).toPromise();
this.chatService.getAllUsers().subscribe(res=> {
this.chatService.getAllUsers().subscribe(res => {
console.log(res);
this.allUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username);
@@ -266,28 +266,28 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.loadGroupMessages();
} */
close(){
close() {
this.modalController.dismiss();
}
doRefresh(ev:any){
doRefresh(ev: any) {
this.getRoomInfo();
ev.target.complete();
}
getGroupContacts(room:any){
getGroupContacts(room: any) {
this.showLoader = true;
//If group is private call getGroupMembers
if(this.room.t === 'p'){
this.chatService.getGroupMembers(this.roomId).subscribe(res=>{
if (this.room.t === 'p') {
this.chatService.getGroupMembers(this.roomId).subscribe(res => {
console.log(res);
this.members = res['members'];
this.showLoader = false;
});
}
//Otherwise call getChannelMembers for públic groups
else{
this.chatService.getChannelMembers(this.roomId).subscribe(res=>{
else {
this.chatService.getChannelMembers(this.roomId).subscribe(res => {
console.log(res);
this.members = res['members'];
this.showLoader = false;
@@ -296,10 +296,10 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
showDateDuration(start:any){
showDateDuration(start: any) {
return this.timeService.showDateDuration(start);
}
countDownDate(date:any, roomId:string){
countDownDate(date: any, roomId: string) {
this.roomCountDownDate = this.timeService.countDownDate(date, roomId);
return this.timeService.countDownDateTimer(date, roomId);
}
@@ -328,33 +328,33 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
},
});
await modal.present();
modal.onDidDismiss().then(res=>{
if(res.data == 'leave'){
modal.onDidDismiss().then(res => {
if (res.data == 'leave') {
console.log('saiu do grupo');
//this.wsChatMethodsService.subscribeToRoomUpdate(this.roomId, this.room);
}
else if(res.data == 'cancel'){
else if (res.data == 'cancel') {
console.log('cancel');
}
else if(res.data == 'edit'){
else if (res.data == 'edit') {
this.editGroup(this.roomId);
}
});
}
viewDocument(file:any, url?:string){
viewDocument(file: any, url?: string) {
if(file.type == "application/webtrix") {
if (file.type == "application/webtrix") {
this.openViewDocumentModal(file);
}
else{
else {
let fullUrl = "https://www.tabularium.pt" + url;
this.fileService.viewDocumentByUrl(fullUrl);
}
}
async openViewDocumentModal(file:any){
async openViewDocumentModal(file: any) {
let task = {
serialNumber: '',
@@ -371,17 +371,17 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
let doc = {
"Id": "",
"ParentId": "",
"Source": 1,
"ApplicationId": file.ApplicationId,
"CreateDate": "",
"Data": null,
"Description":"",
"Link": null,
"SourceId": file.DocId,
"SourceName": file.Assunto,
"Stakeholders": "",
"Id": "",
"ParentId": "",
"Source": 1,
"ApplicationId": file.ApplicationId,
"CreateDate": "",
"Data": null,
"Description": "",
"Link": null,
"SourceId": file.DocId,
"SourceName": file.Assunto,
"Stakeholders": "",
}
const modal = await this.modalController.create({
@@ -406,19 +406,19 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async bookMeeting() {
this.attendees = this.members.map((val)=>{
this.attendees = this.members.map((val) => {
return {
Name: val.name,
EmailAddress: val.username+"@"+environment.domain,
EmailAddress: val.username + "@" + environment.domain,
IsRequired: "true",
}
});
console.log(this.attendees);
this.popoverController.dismiss();
if( window.innerWidth <= 1024){
if (window.innerWidth <= 1024) {
const modal = await this.modalController.create({
component: NewEventPage,
componentProps:{
componentProps: {
attendees: this.attendees,
},
cssClass: 'modal modal-desktop',
@@ -426,7 +426,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
await modal.present();
modal.onDidDismiss().then((data) => {
if(data){
if (data) {
}
});
@@ -441,7 +441,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
const image = await this.CameraService.takePicture();
await this.fileService.saveImage(image)
const lastphoto: any = await this.fileService.loadFiles();
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto);
const { capturedImage, capturedImageTitle } = await this.fileService.loadFileData(lastphoto);
const base64 = await fetch(capturedImage);
const blob = await base64.blob();
const formData = new FormData();
@@ -454,8 +454,8 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
},
temporaryData: formData,
attachments: [{
"title": capturedImageTitle ,
"image_url": capturedImage, // rocketchat
"title": capturedImageTitle,
//"image_url": capturedImage, // rocketchat
"text": "description",
"title_link_download": false,
}]
@@ -482,13 +482,13 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
});
await modal.present();
modal.onDidDismiss().then(async res=>{
modal.onDidDismiss().then(async res => {
const data = res.data;
if(data.selected) {
if (data.selected) {
this.wsChatMethodsService.getGroupRoom(this.roomId).send({
file:{
file: {
"name": res.data.selected.Assunto,
"type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType,
@@ -515,26 +515,37 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
async addFileToChat(types: typeof FileType[] ) {
const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types);
const imageData = await this.fileToBase64Service.convert(file)
console.log('Add file', file)
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
console.log('Add file', filee)
}) */
const response = await fetch(file);
const blob = await response.blob();
console.log('Add file', blob)
const formData = new FormData();
formData.append("blobFile", file);
formData.append("blobFile", blob);
this.wsChatMethodsService.getGroupRoom(this.roomId).send({
this.wsChatMethodsService.getGroupRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
"type": file.type,
"guid": '',
},
temporaryData: formData,
attachments: [{
"title": file.name ,
"text": "description",
"image_url": imageData,
"name": file.name ,
// "text": "description",
//"image_url": file.base64String, // rocketchat
"title_link_download": false,
}]
}],
temporaryData: formData
})
}
async openChatOptions(ev?: any) {
@@ -553,7 +564,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
translucent: true
});
await popover.present();
await popover.onDidDismiss().then( async(res)=>{
await popover.onDidDismiss().then(async (res) => {
console.log(res['data']);
if (res['data'] == 'meeting') {
this.bookMeeting();
@@ -575,7 +586,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
}
async addContacts(){
async addContacts() {
console.log(this.members);
const modal = await this.modalController.create({
@@ -592,12 +603,12 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
await modal.present();
modal.onDidDismiss().then(()=>{
modal.onDidDismiss().then(() => {
this.getRoomInfo();
});
}
async editGroup(roomId){
async editGroup(roomId) {
const modal = await this.modalController.create({
component: EditGroupPage,
cssClass: 'modal modal-desktop',
@@ -606,7 +617,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
},
});
await modal.present();
modal.onDidDismiss().then((res)=>{
modal.onDidDismiss().then((res) => {
console.log(res.data);
this.getRoomInfo();
//this.modalController.dismiss(res.data);
@@ -711,42 +722,42 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async serverLongPull(){
async serverLongPull() {
this.chatService.getPrivateGroupMessages(this.roomId).subscribe(async res => {
if (res == 502) {
// Connection timeout
// happens when the connection was pending for too long
// let's reconnect
await this.serverLongPull();
} else if (res != 200) {
// Show Error
//showMessage(response.statusText);
//this.loadMessages()
let msgOnly = res['messages'].filter(data => data.t != 'au');
//this.messages = msgOnly.reverse();
// console.log('MOBILE MSG ROCKET',this.messages);
this.transformDataMSG(msgOnly.reverse());
this.getRoomMessageDB(this.roomId);
// Reconnect in one second
if(this.route.url != "/home/chat"){
console.log("Timer message stop")
} else {
//Check if modal is opened
if(document.querySelector('.isGroupChatOpened')){
await new Promise(resolve => setTimeout(resolve, 5000));
await this.serverLongPull();
console.log('Timer message running')
if (res == 502) {
// Connection timeout
// happens when the connection was pending for too long
// let's reconnect
await this.serverLongPull();
} else if (res != 200) {
// Show Error
//showMessage(response.statusText);
//this.loadMessages()
let msgOnly = res['messages'].filter(data => data.t != 'au');
//this.messages = msgOnly.reverse();
// console.log('MOBILE MSG ROCKET',this.messages);
this.transformDataMSG(msgOnly.reverse());
this.getRoomMessageDB(this.roomId);
// Reconnect in one second
if (this.route.url != "/home/chat") {
console.log("Timer message stop")
} else {
//Check if modal is opened
if (document.querySelector('.isGroupChatOpened')) {
await new Promise(resolve => setTimeout(resolve, 5000));
await this.serverLongPull();
console.log('Timer message running')
}
}
}
} else {
// Got message
//let message = await response.text();
//this.loadMessages()
await this.serverLongPull();
}
});
} else {
// Got message
//let message = await response.text();
//this.loadMessages()
await this.serverLongPull();
}
});
}
sliderOpts = {
@@ -756,86 +767,93 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
centeredSlides: true
};
zoomActive = false;
zoomScale = 1;
zoomScale = 1;
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
zoom: {
maxRatio: 5
},
on: {
zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale/5;
this.changeDetectorRef.detectChanges();
sliderZoomOpts = {
allowSlidePrev: false,
allowSlideNext: false,
zoom: {
maxRatio: 5
},
on: {
zoomChange: (scale, imageEl, slideEl) => {
this.zoomActive = true;
this.zoomScale = scale / 5;
this.changeDetectorRef.detectChanges();
}
}
}
}
async touchEnd(zoomslides: IonSlides, card) {
// Zoom back to normal
const slider = await zoomslides.getSwiper();
const zoom = slider.zoom;
zoom.out();
async touchEnd(zoomslides: IonSlides, card) {
// Zoom back to normal
const slider = await zoomslides.getSwiper();
const zoom = slider.zoom;
zoom.out();
// Card back to normal
card.el.style['z-index'] = 9;
// Card back to normal
card.el.style['z-index'] = 9;
this.zoomActive = false;
this.changeDetectorRef.detectChanges();
}
this.zoomActive = false;
this.changeDetectorRef.detectChanges();
}
touchStart(card) {
// Make card appear above backdrop
card.el.style['z-index'] = 11;
}
touchStart(card) {
// Make card appear above backdrop
card.el.style['z-index'] = 11;
}
downloadFileMsg(msg) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
if (msg.file.type == "application/img") {
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
downloadFileMsg(msg) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
// if (msg.file.type == "application/img") {
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
console.log('FILE TYPE 44', this.downloadFile)
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
if (msg.file.type == "application/img") {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
} else {
msg.file = {
guid: msg.file.guid,
image_url: this.downloadFile,
type: msg.file.type
this.downloadFile = event.body;
}
this.sqlservice.updateChatMsg(msg._id, this.downloadFile);
}
});
console.log('FILE TYPE 44', this.downloadFile)
msg.attachments[0] = {
image_url: this.downloadFile,
name: msg.attachments[0].name,
title: msg.attachments[0].title,
title_link_download: msg.attachments[0].title_link_download,
ts: msg.attachments[0].ts
}
this.sqlservice.updateChatMsg(msg._id, this.downloadFile);
}
});
console.log('FILE TYPE 44', this.downloadFile)
//}
}
async openPreview(msg) {
if (!msg.attachments[0].image_url ||msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
this.downloadFileMsg(msg)
} else {
const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
type: msg.file.type,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
});
modal.present();
}
}
}
async openPreview(msg) {
if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) {
this.downloadFileMsg(msg)
} else {
const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
});
modal.present();
}
}
}
+11 -12
View File
@@ -61,7 +61,7 @@
</div>
</div>
<!-- <div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)" *ngIf="msg.msg !=''">
<div (press)="handlePress(msg._id)" class='message-container incoming-{{msg.u.username!=loggedUser.me.username}}' (click)="openPreview(msg)" *ngIf="msg.msg !=''">
<div class="title">
<ion-label>{{msg.u.name}}</ion-label>
<span class="time">{{msg.duration}}</span>
@@ -70,7 +70,7 @@
<ion-label>{{msg.msg}}</ion-label>
{{last ? scrollToBottom() : ''}}
</div>
</div> -->
</div>
<div *ngIf="msg.file">
@@ -88,7 +88,7 @@
</div>
<div *ngIf="msg.file.type != 'application/img'">
<div class="file">
<div (click)="docIndex(i); viewDocument(msg.file, file.title_link)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<div (click)="docIndex(i); openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
@@ -120,7 +120,7 @@
</div>
<!-- <div *ngIf="msg.file">
<div *ngIf="msg.file">
<div *ngIf="msg.file.type == 'application/meeting'" class="info-meeting">
<ion-label class="info-meeting-small">{{msg.u.name}} criou esta reunião</ion-label><br />
<button (click)="goToEvent(msg.file.id)" class="btn-no-color info-meeting-normal"><ion-label class="info-meeting-normal">{{msg.file.subject}}</ion-label></button><br />
@@ -128,7 +128,7 @@
<ion-label class="info-meeting-medium"><ion-icon></ion-icon><ion-icon name="location-outline"></ion-icon> {{msg.file.venue}}</ion-label><br />
</div>
{{last ? scrollToBottom() : ''}}
</div> -->
</div>
</div>
</div>
<ion-fab horizontal="end" vertical="bottom" slot="fixed">
@@ -168,13 +168,13 @@
<div class="typing" *ngIf="wsChatMethodsService.getDmRoom(roomId).otherUserType == true">
<ngx-letters-avatar
[avatarName]= "wsChatMethodsService.getGroupRoom(roomId).name"
[width]="30"
[width]="30"
[circular]="true"
fontFamily="Roboto"></ngx-letters-avatar>
Está a escrever ...
está a escrever ...
</div>
<ion-list hidden>
<ion-list>
<ion-item (click)="playFile(storedFileNames)">
{{storedFileNames}}
</ion-item>
@@ -182,14 +182,13 @@
{{storedFileNames}}
</ion-item>
</ion-list>
<audio hidden controls>
<audio controls>
<!-- <source src="https://www.tabularium.pt/file-upload/5g6DkyMC4MHcuaDyp/Audio%20record.mp3" type="audio/mpeg"> -->
</audio>
<!-- <button (click)="startRecording()">Start Recording</button>
<button (click)="stopRecording()">Stop Recording</button> -->
<button (click)="startRecording()">Start Recording</button>
<button (click)="stopRecording()">Stop Recording</button>
<div class="container width-100 d-flex">
<div>
<button 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>
+114 -50
View File
@@ -19,7 +19,8 @@ import { ChatMessageStore } from 'src/app/store/chat/chat-message.service';
import { ChatUserStorage } from 'src/app/store/chat/chat-user.service';
import { environment } from 'src/environments/environment';
import { ThemeService } from 'src/app/services/theme.service'
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { Directory, Encoding, FilesystemDirectory } from '@capacitor/filesystem';
import { VoiceRecorder, VoiceRecorderPlugin, RecordingData, GenericResponse, CurrentRecordingStatus } from 'capacitor-voice-recorder';
import { Haptics, ImpactStyle } from '@capacitor/haptics';
import { PreviewCameraPage } from 'src/app/modals/preview-camera/preview-camera.page';
@@ -39,6 +40,11 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { Storage } from '@ionic/storage';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { Plugins } from '@capacitor/core';
import { fromByteArray } from 'base64-js';
const { Filesystem } = Plugins;
const IMAGE_DIR = 'stored-images';
@@ -88,6 +94,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
myAudio: any;
downloadfile: any;
downloadFile: any;
downloadProgess: number;
constructor(
public popoverController: PopoverController,
@@ -128,7 +135,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.wsChatMethodsService.getDmRoom(this.roomId).scrollDown = this.scrollToBottomClicked
this.wsChatMethodsService.openRoom(this.roomId)
setTimeout(()=>{
setTimeout(() => {
this.scrollToBottomClicked()
}, 150)
@@ -195,7 +202,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
const temp: any[] = result.files.reverse();
this.storedFileNames = temp[0];
console.log(this.storedFileNames);
})
}
@@ -352,10 +358,41 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.wsChatMethodsService.getDmRoom(this.roomId).send({})
}
viewDocument(file: any, url?: string) {
viewDocument(msg: any, url?: string) {
console.log(msg)
if (msg.attachments.type == "application/webtrix") {
//this.openViewDocumentModal(file);
}
if (file.type == "application/webtrix") {
this.openViewDocumentModal(file);
if (msg.attachments.type == "application/pdf") {
try {
const writeSecretFile = async () => {
await Filesystem.writeFile({
path: msg.attachments.name,
data: msg.attachments.image_url,
directory: Directory.Documents,
encoding: Encoding.UTF8,
});
};
console.log('WRITE', writeSecretFile);
const readSecretFile = async () => {
const contents = await Filesystem.readFile({
path: msg.attachments.name,
directory: Directory.Documents,
encoding: Encoding.UTF8,
});
console.log('secrets:', contents);
};
console.log('READ', readSecretFile);
} catch (e) {
console.error("Unable to write file", e);
}
}
}
@@ -373,7 +410,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
FolderID: '',
Subject: file.Assunto,
SourceSecFsID: file.ApplicationId,
SourceType: 'DOC',
SourceType: 'PDF',
SourceID: file.DocId,
DispatchNumber: ''
}
@@ -520,7 +557,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
const image = await this.CameraService.takePicture();
await this.fileService.saveImage(image)
const lastphoto: any = await this.fileService.loadFiles();
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto);
const { capturedImage, capturedImageTitle } = await this.fileService.loadFileData(lastphoto);
const base64 = await fetch(capturedImage);
@@ -535,8 +572,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
"guid": ''
},
attachments: [{
"image_url": capturedImage,
"title": capturedImageTitle ,
"title": capturedImageTitle,
"text": "description",
"title_link_download": false,
}],
@@ -568,14 +604,14 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
});
await modal.present();
modal.onDidDismiss().then(async res=>{
modal.onDidDismiss().then(async res => {
const data = res.data;
const roomId = this.roomId
if(data.selected) {
if (data.selected) {
this.wsChatMethodsService.getDmRoom(roomId).send({
file:{
file: {
"name": res.data.selected.Assunto,
"type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType,
@@ -598,7 +634,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
});
}
async addFileToChatMobile(types: typeof FileType[] ) {
async addFileToChatMobile(types: typeof FileType[]) {
const roomId = this.roomId
const file = await Camera.getPhoto({
@@ -611,7 +647,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
//const imageData = await this.fileToBase64Service.convert(file)
//console.log('ADDFILECHAT', imageData)
const response = await fetch('data:image/jpeg;base64,'+ file.base64String!);
const response = await fetch('data:image/jpeg;base64,' + file.base64String!);
const blob = await response.blob();
const formData = new FormData();
@@ -624,8 +660,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
},
temporaryData: formData,
attachments: [{
"title": file.path ,
"image_url": 'data:image/jpeg;base64,' +file.base64String,
"title": file.path,
"text": "description",
"title_link_download": false,
}]
@@ -635,36 +670,44 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
async addFileToChat(types: typeof FileType[] ) {
async addFileToChat(types: typeof FileType[]) {
const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types);
console.log('ADDFILECHAT', file)
const imageData = await this.fileToBase64Service.convert(file)
console.log('ADDFILECHAT', imageData)
console.log('Add file', file)
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
console.log('Add file', filee)
}) */
const response = await fetch(file);
const blob = await response.blob();
const blob2 = new Blob([blob])
console.log('Add file base64', file)
console.log('Add file blob', blob)
const formData = new FormData();
formData.append("blobFile", file);
formData.append("blobFile", blob2);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"type": file.type,
"guid": '',
},
temporaryData: formData,
attachments: [{
"title": file.name ,
"image_url": imageData,
"text": "description",
"title": file.name,
"name": file.name,
// "text": "description",
"title_link_download": false,
}]
}],
temporaryData: formData
})
}
async openChatOptions(ev?: any) {
const roomId = this.roomId
console.log('MOBILE CHAT OPTION',this.members);
console.log('MOBILE CHAT OPTION', this.members);
const popover = await this.popoverController.create({
component: ChatOptionsPopoverPage,
@@ -678,7 +721,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
translucent: true
});
await popover.present();
popover.onDidDismiss().then( async (res) => {
popover.onDidDismiss().then(async (res) => {
console.log(res['data']);
if (res['data'] == 'meeting') {
this.bookMeeting();
@@ -776,39 +819,58 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
testeDownload(msg: MessageService) {
this.downloadFile = "";
this.AttachmentsService.downloadFileAndStore(msg.file.guid);
}
downloadFileMsg(msg: MessageService) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
if (msg.file.type == "application/img") {
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
//if (msg.file.type == "application/img") {
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
if (event.type === HttpEventType.DownloadProgress) {
this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log(this.downloadProgess)
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
if (msg.file.type == "application/img") {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
msg.file = {
guid: msg.file.guid,
image_url: this.downloadFile,
type: msg.file.type
}
this.sqlservice.updateChatMsg(msg._id, this.downloadFile);
} else {
//console.log('TRY THIS LIBRARY ',fromByteArray(event.body));
this.downloadFile = event.body;
}
});
msg.attachments[0] = {
image_url: this.downloadFile,
name: msg.attachments[0].name,
title: msg.attachments[0].title,
title_link_download: msg.attachments[0].title_link_download,
ts: msg.attachments[0].ts
}
this.sqlservice.updateChatMsg(msg._id, this.downloadFile);
}
}
});
//}
}
async openPreview(msg) {
testDownlod(msg: MessageService) {
this.AttachmentsService.downloadFileAndStore(msg.file.guid)
}
if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) {
this.downloadFileMsg(msg)
async openPreview(msg) {
console.log(msg);
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
this.downloadFile(msg)
//this.testDownlod(msg)
} else {
const modal = await this.modalController.create({
@@ -816,6 +878,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
type: msg.file.type,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
@@ -845,6 +908,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
// async ShareEmail(msg){
// // Check if sharing via email is supported
// await Share.share({
@@ -2,19 +2,19 @@
<app-header></app-header>
</ion-header>
<ion-content id="main-content" class="container-wrapper">
<div class="main-content d-flex flex-column height-100" *ngIf="loadedEvent" >
<div class="pl-20 pr-20 text-center d-flex justify-center align-center" style="width:100%; height: 30px; background-color: var(--Event-approve-header-color); border-top-right-radius: 25px;border-top-left-radius: 25px;">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons font-28" src="assets/images/icons-received-event.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov'" class="right-icons font-28" src="assets/images/theme/gov/icons-received-event.svg"></ion-icon>
<!-- <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="right-icons" src="assets/images/theme/gov/icons-received-event-selected.svg"></ion-icon> -->
<ion-icon *ngIf="ThemeService.currentTheme == 'tribunal' " class="right-icons font-28" src="assets/images/theme/tribunal/icons-received-event.svg"></ion-icon>
<div style="color: white;">
Evento Pendente de Aprovação
<div class="main-content height-100" *ngIf="loadedEvent" >
<div class="d-flex width-100">
<div class="pl-20 pr-20 text-center d-flex justify-center align-center" style="width:100%; height: 30px; background-color: var(--Event-approve-header-color); border-top-right-radius: 25px;border-top-left-radius: 25px;">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons font-28" src="assets/images/icons-received-event.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov'" class="right-icons font-28" src="assets/images/theme/gov/icons-received-event.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'tribunal' " class="right-icons font-28" src="assets/images/theme/tribunal/icons-received-event.svg"></ion-icon>
<div style="color: white;">
Evento Pendente de Aprovação
</div>
</div>
</div>
<div class="main-content d-flex height-100 width-100">
<div class="d-flex width-100">
<div class="content d-flex flex-column width-100" *ngIf="loadedEvent.workflowInstanceDataFields">
<div class="header-content width-100 d-flex justify-space-between">
<div (click)="goBack()" class="header-icon-left cursor-pointer">
@@ -39,22 +39,20 @@
<div class="content-location">
<p>
<span class="location">{{loadedEvent.workflowInstanceDataFields.Location}}</span>
<span class="event-type-{{loadedEvent.workflowInstanceDataFields.Agenda}}" *ngIf="loadedEvent.workflowDisplayName == 'Agenda Oficial MDGPR' " style="background-color: #ffb703;">
{{loadedEvent.workflowInstanceDataFields.Agenda}}
</span>
<span class="event-type-{{loadedEvent.workflowInstanceDataFields.Agenda}}" *ngIf="loadedEvent.workflowDisplayName == 'Agenda Pessoal MDGPR' " style="background-color: #f05d5e;">
{{loadedEvent.workflowInstanceDataFields.Agenda}}
</span>
<span class="event-type-{{loadedEvent.workflowInstanceDataFields.Agenda}}" *ngIf="loadedEvent.workflowDisplayName == 'Agenda Oficial PR' " style="background-color: #99e47b;">
{{loadedEvent.workflowInstanceDataFields.Agenda}}
</span>
<span class="event-type-{{loadedEvent.workflowInstanceDataFields.Agenda}}" *ngIf="loadedEvent.workflowDisplayName == 'Agenda Pessoal PR' " style="background-color: #958bfc;">
{{loadedEvent.workflowInstanceDataFields.Agenda}}
</span>
</p>
</div>
<div class="content-details">
@@ -62,13 +60,12 @@
<p>{{customDate}}</p>
<p *ngIf="toDateString(loadedEvent.workflowInstanceDataFields.StartDate) == toDateString(loadedEvent.workflowInstanceDataFields.EndDate)">das {{loadedEvent.workflowInstanceDataFields.StartDate | date: 'HH:mm'}} às {{loadedEvent.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
<p *ngIf="toDateString(loadedEvent.workflowInstanceDataFields.StartDate) != toDateString(loadedEvent.workflowInstanceDataFields.EndDate)">{{loadedEvent.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ loadedEvent.workflowInstanceDataFields.StartDate | date: 'dd/M/yy'}} </p>
<p *ngIf="loadedEvent.workflowInstanceDataFields.OccurrenceType == '-1'">(Não se repete)</p>
<p *ngIf="loadedEvent.workflowInstanceDataFields.OccurrenceType != '-1'">Repete</p>
<p *ngIf="!loadedEvent.workflowInstanceDataFields.IsRecurring">(Não se repete)</p>
<p *ngIf="loadedEvent.workflowInstanceDataFields.IsRecurring">Repete</p>
</ion-label>
</div>
</div>
<div class="line"></div>
<div class="overflow-y-auto">
<div class="middle-content">
<div *ngIf="loadedEvent.workflowInstanceDataFields.ParticipantsList">
@@ -86,7 +83,6 @@
<div class="line"></div>
</div>
</div>
<div *ngIf="loadedEvent.Documents" class="bottom-content width-100">
<ion-list>
<h5>Documentos Anexados</h5>
@@ -103,18 +99,18 @@
</div>
</div>
</div>
<div *ngIf="loadedEvent" class="aside-right flex-column height-100">
<div class="aside-buttons">
<button hidden full class="btn-cancel" shape="round" >Editar evento</button>
<button (click)="approveTask(loadedEvent.serialNumber)" full class="btn-cancel" shape="round" >Aprovar</button>
<button (click)="emendTask(loadedEvent.serialNumber)" class="btn-cancel" shape="round" >Rever</button>
<div class="solid"></div>
<button full class="btn-cancel" shape="round" (click)="editar(loadedEvent.serialNumber)" >Editar</button>
<button (click)="rejeitar(loadedEvent.serialNumber)" full class="btn-delete" shape="round" >Rejeitar</button>
</div>
<div *ngIf="loadedEvent" class="aside-right flex-column height-100">
<div class="aside-buttons">
<button hidden full class="btn-cancel" shape="round" >Editar evento</button>
<button (click)="approveTask(loadedEvent.serialNumber)" full class="btn-cancel" shape="round" >Aprovar</button>
<button (click)="emendTask(loadedEvent.serialNumber)" class="btn-cancel" shape="round" >Rever</button>
<div class="solid"></div>
<button full class="btn-cancel" shape="round" (click)="editar(loadedEvent.serialNumber)" >Editar</button>
<button (click)="rejeitar(loadedEvent.serialNumber)" full class="btn-delete" shape="round" >Rejeitar</button>
</div>
</div>
</div>
</div>
</ion-content>
@@ -17,7 +17,7 @@
<div class="title">
<ion-label>Gabinete Digital</ion-label>
</div>
<button *ngIf="hideRefreshBtn" class="btn-no-color btn-refresh" (click)="doRefresh($event)">
<button title="Atualizar" *ngIf="hideRefreshBtn" class="btn-no-color btn-refresh" (click)="doRefresh($event)">
<ion-icon class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
<div *ngIf="!hideRefreshBtn" class="title-icons">
@@ -25,11 +25,11 @@
<ion-label class="title ">Acções Presidenciais</ion-label>
</div>
<div class="div-icon">
<button class="btn-no-color" (click)="AddPublicationFolder()">
<button title="Adicionar nova ação presidencial" class="btn-no-color" (click)="AddPublicationFolder()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="icon-only" src='assets/images/icons-add.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="icon-only" src='assets/images/theme/gov/icons-add.svg'></ion-icon>
</button>
<button *ngIf="hideRefreshBtn" class="btn-no-color" (click)="refreshing()">
<button title="Atualizar" *ngIf="hideRefreshBtn" class="btn-no-color" (click)="refreshing()">
<ion-icon slot="icon-only" class="title-icon font-awesome" name="reload-circle" title="Actualizar"></ion-icon>
</button>
</div>
@@ -10,7 +10,7 @@ import { ViewPublicationsPage } from './view-publications.page';
import { HeaderPageModule } from 'src/app/shared/header/header.module';
import { Attributes, IntersectionObserverHooks, LazyLoadImageModule, LAZYLOAD_IMAGE_HOOKS } from 'ng-lazyload-image'; // <-- import it
import { Attributes, IntersectionObserverHooks, LazyLoadImageModule, LAZYLOAD_IMAGE_HOOKS } from 'ng-lazyload-image';
export class LazyLoadImageHooks extends IntersectionObserverHooks {
setup(attributes: Attributes) {
+26 -1
View File
@@ -5,6 +5,8 @@ import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { environment } from 'src/environments/environment';
import { LoginUserRespose } from '../models/user.model';
import { SessionStore } from '../store/session.service';
import { File } from '@ionic-native/file/ngx';
import { Platform } from '@ionic/angular';
@Injectable({
providedIn: 'root'
@@ -14,7 +16,7 @@ export class AttachmentsService {
loggeduser: LoginUserRespose;
headers: HttpHeaders;
constructor(private http: HttpClient) {
constructor(private http: HttpClient, private platform: Platform, private file: File) {
this.loggeduser = SessionStore.user
this.headers = new HttpHeaders();
@@ -61,6 +63,29 @@ export class AttachmentsService {
})
}
downloadFileAndStore(guid:any) {
var name = new Date().getTime();
const downloadPath = (
this.platform.is('android')
) ? this.file.externalDataDirectory : this.file.documentsDirectory;
let vm = this;
/** HttpClient - @angular/common/http */
this.http.get(
environment.apiURL +'objectserver/streamfiles?path='+guid,
{
responseType: 'arraybuffer',
}
).subscribe((fileBlob: Uint8Array) => {
/** File - @ionic-native/file/ngx */
vm.file.writeFile(downloadPath, "YourFileName.pdf", fileBlob, {replace: true});
console.log(downloadPath +"/"+"YourFileName.pdf")
console.log(fileBlob)
});
}
getAttachmentsBySerial(serialNumber: string): Observable<Attachment[]>{
let geturl = environment.apiURL + 'attachments/GetAttachments';
@@ -89,7 +89,7 @@
</div>
<div class="div-attach">
<ion-item>
<ion-buttons slot="end" (click)="showAlert()">
<ion-buttons slot="end">
<ion-label color="secondary">Editar</ion-label>
</ion-buttons>
<ion-label class="attach-label">Anexos</ion-label>
@@ -91,7 +91,7 @@
</div>
<div class="div-attach">
<ion-item>
<ion-buttons slot="end" (click)="showAlert()">
<ion-buttons slot="end">
<ion-label color="secondary">Editar</ion-label>
</ion-buttons>
<ion-label class="attach-label">Anexos</ion-label>
@@ -91,7 +91,7 @@
</div>
<div class="div-attach">
<ion-item>
<ion-buttons slot="end" (click)="showAlert()">
<ion-buttons slot="end">
<ion-label color="secondary">Editar</ion-label>
</ion-buttons>
<ion-label class="attach-label">Anexos</ion-label>
@@ -3,7 +3,7 @@
<div class="header-title d-flex align-center justify-between width-100">
<div class="flex-grow-1">Eventos para Aprovação</div>
<div (click)="refreshing()">
<button class="btn-no-color" >
<button title="Atualizar" class="btn-no-color" >
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -83,7 +83,7 @@
</div>
<div *ngIf="msg.file.type != 'application/img'">
<div class="file">
<div (click)="viewDocument(msg.file, file.title_link)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<div (click)="openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
@@ -205,14 +205,14 @@
<ion-footer>
<!-- <div class="typing" *ngIf="wsChatMethodsService.getGroupRoom(roomId).otherUserType == true" >A escrever...</div> -->
<div class="typing" *ngIf="wsChatMethodsService.getGroupRoom(roomId).otherUserType == true">
<!-- <div class="typing" *ngIf="wsChatMethodsService.getGroupRoom(roomId).otherUserType == true">
<ngx-letters-avatar *ngIf="showAvatar"
[avatarName]= "wsChatMethodsService.getGroupRoom(roomId).name"
[width]="30"
[width]="30"
[circular]="true"
fontFamily="Roboto"></ngx-letters-avatar>
{{ wsChatMethodsService.getGroupRoom(roomId).userThatIsTyping }} está a escrever...
</div>
</div> -->
<div class="container width-100 d-flex">
@@ -699,29 +699,52 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
async addFileToChat(types: typeof FileType[] ) {
const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types);
const imageData = await this.fileToBase64Service.convert(file)
console.log('Add file', file)
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
console.log('Add file', filee)
}) */
const blob = new Blob([file],{type: file.type})
console.log('Add file', blob)
const formData = new FormData();
formData.append("blobFile", file);
formData.append("blobFile", blob);
let pdfBase64;
this.blobToBase64(blob).then(res => {
console.log('Base64 pdf', res);
this.wsChatMethodsService.getGroupRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name ,
"name": file.name ,
"image_url": res,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData
})
});
this.wsChatMethodsService.getGroupRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
},
temporaryData: formData,
attachments: [{
"title": file.name ,
"image_url": imageData,
"text": "description",
"title_link_download": false,
}]
})
}
blobToBase64 = blob => {
const reader = new FileReader();
reader.readAsDataURL(blob);
return new Promise(resolve => {
reader.onloadend = () => {
resolve(reader.result);
};
});
};
bookMeeting() {
let data = {
roomId: this.roomId,
@@ -816,12 +839,19 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
msg.file = {
guid: msg.file.guid,
if (msg.file.type == "application/img") {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
} else if (msg.file.type === 'application/pdf') {
this.downloadFile = event.body;
}
msg.attachments[0] = {
image_url: this.downloadFile,
type: msg.file.type
name: msg.attachments[0].name,
title: msg.attachments[0].title,
title_link_download: msg.attachments[0].title_link_download,
ts: msg.attachments[0].ts
}
await this.storage.set(msg.file.guid, this.downloadFile).then(() => {
@@ -837,7 +867,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
async openPreview(msg) {
if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) {
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) {
this.downloadFileMsg(msg)
} else {
@@ -846,6 +876,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
type: msg.file.type,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
@@ -12,6 +12,7 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { MatButtonModule } from '@angular/material/button';
import {MatMenuModule} from '@angular/material/menu';
import { LettersAvatarModule } from "ngx-letters-avatar";
import { PdfViewerModule } from 'ng2-pdf-viewer';
@NgModule({
imports: [
@@ -22,7 +23,8 @@ import { LettersAvatarModule } from "ngx-letters-avatar";
MessagesPageRoutingModule,
MatButtonModule,
MatMenuModule,
LettersAvatarModule
LettersAvatarModule,
PdfViewerModule
],
exports: [MessagesPage],
+29 -21
View File
@@ -38,7 +38,8 @@
</ion-refresher-content>
</ion-refresher>
<div class="messages" #scrollMe>
<div class="messages-list-item-wrapper container-width-100" *ngFor="let msg of wsChatMethodsService.getDmRoom(roomId).messages; let last = last">
<div class="messages-list-item-wrapper container-width-100"
*ngFor="let msg of wsChatMethodsService.getDmRoom(roomId).messages; let last = last">
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45' *ngIf="msg.msg !=''">
<div class="message-item-options d-flex justify-content-end">
<fa-icon [matMenuTriggerFor]="beforeMenu" icon="chevron-down" class="message-options-icon cursor-pointer">
@@ -65,7 +66,8 @@
</div>
<div *ngIf="msg.file">
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45' *ngIf="msg.file.type != 'application/meeting'">
<div class='message-item incoming-{{msg.u.username!=loggedUser.me.username}} max-width-45'
*ngIf="msg.file.type != 'application/meeting'">
<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>
@@ -82,24 +84,28 @@
<div *ngFor="let file of msg.attachments">
<div *ngIf="msg.file.type == 'application/img'" (click)="openPreview(msg)" dfsdvsvs>
<img src={{msg.attachments[0].image_url}} alt="image">
<ion-label class="float-status-image float-status-all">
<ion-icon *ngIf="!msg.offline && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.offline && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.viewed.length == 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
<ion-label class="float-status-all float-status" >
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
<div *ngIf="msg.file.type != 'application/img'">
<div class="file">
<div (click)="viewDocument(msg, file.title_link)" class="file-details add-ellipsis cursor-pointer"
*ngIf="msg.file">
<div (click)="openPreview(msg)" class="file-details add-ellipsis cursor-pointer" *ngIf="msg.file">
<span *ngIf="msg.file.type">
<fa-icon *ngIf="msg.file.type == 'application/pdf'" icon="file-pdf" class="pdf-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon"></fa-icon>
<fa-icon *ngIf="msg.file.type == 'application/word'" icon="file-word" class="word-icon">
</fa-icon>
<fa-icon
*ngIf="msg.file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'"
icon="file-word" class="excel-icon"></fa-icon>
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg"></ion-icon>
<ion-icon *ngIf="msg.file.type == 'application/meeting'" src="assets/icon/webtrix.svg"></ion-icon>
<ion-icon *ngIf="msg.file.type == 'application/webtrix'" src="assets/icon/webtrix.svg">
</ion-icon>
<ion-icon *ngIf="msg.file.type == 'application/meeting'" src="assets/icon/webtrix.svg">
</ion-icon>
</span>
<ion-label class="file-title">{{file.title}}</ion-label>
</div>
@@ -108,13 +114,14 @@
<ion-label *ngIf="msg.file">
<span *ngIf="file.description">{{file.description}}</span>
<span *ngIf="file.description && msg.file.type != 'application/webtrix'"></span>
<span
*ngIf="msg.file.type != 'application/webtrix'">{{msg.displayType}}</span>
<span *ngIf="msg.file.type != 'application/webtrix'">{{msg.displayType}}</span>
</ion-label>
<ion-label class="float-status-webtrix float-status-all">
<ion-icon *ngIf="!msg.offline && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.offline && msg.viewed.length == 0" src="assets/images/check-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.viewed.length == 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
<ion-label class="float-status-all float-status" >
<ion-icon *ngIf="msg.messageSend == false" src="assets/images/clock-regular.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend == true && msg.received.length == 0" src="assets/images/check-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.messageSend && msg.received.length >= 1 && msg.viewed.length == 0" src="assets/images/check-double-solid.svg"></ion-icon>
<ion-icon *ngIf="msg.viewed.length >= 1" src="assets/images/check-double-solid -viewed.svg"></ion-icon>
</ion-label>
</div>
</div>
@@ -154,10 +161,10 @@
<div class="typing" *ngIf="wsChatMethodsService.getDmRoom(roomId).otherUserType == true" >
<ngx-letters-avatar *ngIf="showAvatar"
[avatarName]= "wsChatMethodsService.getDmRoom(roomId).name"
[width]="30"
[width]="30"
[circular]="true"
fontFamily="Roboto"></ngx-letters-avatar>
Está a escrever...
está a escrever...
</div>
<div class="container width-100 d-flex">
@@ -193,8 +200,9 @@
<div class="width-100">
<ion-item class="ion-no-padding type-message" lines="none">
<ion-textarea (keyup.enter)="sendMessage()" clearOnEdit="true" placeholder="Escrever uma mensagem"
class="message-input" rows="1" [(ngModel)]="wsChatMethodsService.getDmRoom(roomId).message" (ionChange)="wsChatMethodsService.getDmRoom(roomId).sendTyping()"></ion-textarea>
<button hidden class="btn-no-color" >
class="message-input" rows="1" [(ngModel)]="wsChatMethodsService.getDmRoom(roomId).message"
(ionChange)="wsChatMethodsService.getDmRoom(roomId).sendTyping()"></ion-textarea>
<button hidden class="btn-no-color">
<ion-icon slot="end" src="assets/icon/icons-chat-mic.svg"></ion-icon>
</button>
</ion-item>
+103 -55
View File
@@ -32,7 +32,7 @@ import { SearchPage } from 'src/app/pages/search/search.page';
import { ProcessesService } from 'src/app/services/processes.service';
import { FileToBase64Service } from 'src/app/services/file/file-to-base64.service';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { DocumentViewer, DocumentViewerOptions} from '@ionic-native/document-viewer';
import { DocumentViewer, DocumentViewerOptions } from '@ionic-native/document-viewer';
const IMAGE_DIR = 'stored-images';
@Component({
@@ -267,13 +267,17 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.openViewDocumentModal(msg.file);
}
else {
let fullUrl;
console.log('PDF CLICK', msg)
/* let fullUrl;
fullUrl = "https://gabinetedigitalchat.dyndns.info" + url;
//fullUrl = "http://www.africau.edu/images/default/sample.pdf";
this.frameUrl = fullUrl;
this.frameUrl = fullUrl; */
let file = new Blob([msg.attachments[0].image_url], { type: 'application/pdf' });
let fileURL = URL.createObjectURL(file)
window.open(fileURL);
this.chatService.getDocumentDetails(fullUrl);
// this.chatService.getDocumentDetails(fullUrl);
}
}
@@ -450,7 +454,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
//const imageData = await this.fileToBase64Service.convert(file)
//console.log('ADDFILECHAT', imageData)
const response = await fetch('data:image/jpeg;base64,'+ file.base64String!);
const response = await fetch('data:image/jpeg;base64,' + file.base64String!);
const blob = await response.blob();
const formData = new FormData();
@@ -465,6 +469,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
attachments: [{
"title": file.path,
// "image_url": "",
//"image_url": 'data:image/jpeg;base64,' + file.base64String,
"text": "description",
"title_link_download": false,
}]
@@ -478,7 +483,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
const image = await this.CameraService.takePicture();
await this.fileService.saveImage(image)
const lastphoto: any = await this.fileService.loadFiles();
const { capturedImage, capturedImageTitle} = await this.fileService.loadFileData(lastphoto);
const { capturedImage, capturedImageTitle } = await this.fileService.loadFileData(lastphoto);
const base64 = await fetch(capturedImage);
console.log('imsge take picture', image)
const blob = await base64.blob();
@@ -494,8 +499,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
},
temporaryData: formData,
attachments: [{
"title": capturedImageTitle ,
"image_url": "",
"title": capturedImageTitle,
"image_url": capturedImage,
"text": "description",
"title_link_download": false,
}]
@@ -522,14 +527,14 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
});
await modal.present();
modal.onDidDismiss().then(async res=>{
modal.onDidDismiss().then(async res => {
const data = res.data;
const roomId = this.roomId
if(data.selected) {
if (data.selected) {
this.wsChatMethodsService.getDmRoom(roomId).send({
file:{
file: {
"name": res.data.selected.Assunto,
"type": "application/webtrix",
"ApplicationId": res.data.selected.ApplicationType,
@@ -551,7 +556,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
});
}
async addFileToChatMobile(types: typeof FileType[] ) {
async addFileToChatMobile(types: typeof FileType[]) {
const roomId = this.roomId
const file = await Camera.getPhoto({
@@ -564,7 +569,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
//const imageData = await this.fileToBase64Service.convert(file)
//console.log('ADDFILECHAT', imageData)
const response = await fetch('data:image/jpeg;base64,'+ file.base64String!);
const response = await fetch('data:image/jpeg;base64,' + file.base64String!);
const blob = await response.blob();
const formData = new FormData();
@@ -577,8 +582,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
},
temporaryData: formData,
attachments: [{
"title": file.path ,
"image_url": 'data:image/jpeg;base64,' +file.base64String,
"title": file.path,
//"image_url": 'data:image/jpeg;base64,' + file.base64String,
"text": "description",
"title_link_download": false,
}]
@@ -588,7 +593,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
async addFileToChat(types: typeof FileType[] ) {
async addFileToChat(types: typeof FileType[]) {
const roomId = this.roomId
@@ -597,30 +602,44 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
/* const imageData = await this.fileToBase64Service.convert(file).then((filee) => {
console.log('Add file', filee)
}) */
const blob = new Blob([file],{type: file.type})
const blob = new Blob([file], { type: file.type })
console.log('Add file', blob)
const formData = new FormData();
formData.append("blobFile", blob);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name ,
"name": file.name ,
// "text": "description",
"image_url": file, // rocketchat
"title_link_download": false,
}],
temporaryData: formData
})
let pdfBase64;
this.blobToBase64(blob).then(res => {
console.log('Base64 pdf', res);
this.wsChatMethodsService.getDmRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name,
"name": file.name,
//"image_url": res,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData
})
});
}
blobToBase64 = blob => {
const reader = new FileReader();
reader.readAsDataURL(blob);
return new Promise(resolve => {
reader.onloadend = () => {
resolve(reader.result);
};
});
};
bookMeeting() {
let data = {
@@ -673,7 +692,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
});
await modal.present();
modal.onDidDismiss().then( async (res) => {
modal.onDidDismiss().then(async (res) => {
console.log(res['data']);
@@ -716,35 +735,52 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
downloadFileMsg(msg: MessageService) {
console.log('FILE TYPE', msg.file.type)
this.downloadFile = "";
if (msg.file.type == "application/img") {
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
//if (msg.file.type == "application/img") {
this.AttachmentsService.downloadFile(msg.file.guid).subscribe(async (event) => {
console.log('FILE TYPE 22', msg.file.guid)
var name = msg.file.guid;
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
console.log('FILE TYPE 33', msg.file.type)
} else if (event.type === HttpEventType.Response) {
if (msg.file.type == "application/img") {
this.downloadFile = 'data:image/jpeg;base64,' + btoa(new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''));
msg.file = {
guid: msg.file.guid,
image_url: this.downloadFile,
type: msg.file.type
}
await this.storage.set(msg.file.guid, this.downloadFile).then(() => {
console.log('IMAGE SAVED')
});
} else if (msg.file.type === 'application/pdf') {
this.downloadFile = event.body;
}
});
msg.attachments[0] = {
image_url: this.downloadFile,
name: msg.attachments[0].name,
title: msg.attachments[0].title,
title_link_download: msg.attachments[0].title_link_download,
ts: msg.attachments[0].ts
}
}
await this.storage.set(msg.file.guid, this.downloadFile).then(() => {
console.log('IMAGE SAVED')
});
}
});
// }
}
pdfPreviwe() {
_arrayBufferToBase64( buffer ) {
var binary = '';
var bytes = new Uint8Array( buffer );
var len = bytes.byteLength;
for (var i = 0; i < len; i++) {
binary += String.fromCharCode( bytes[ i ] );
}
return window.btoa( binary );
}
pdfPreview() {
const options: DocumentViewerOptions = {
title: 'My App'
};
@@ -752,26 +788,38 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
async openPreview(msg) {
console.log(msg);
console.log(msg);
if (msg.attachments[0].image_url === null || msg.attachments[0].image_url === '' ) {
if (!msg.attachments[0].image_url || msg.attachments[0].image_url === null || msg.attachments[0].image_url === '') {
this.downloadFileMsg(msg)
} else {
/* if(msg.file.type === "application/pdf") {
this.viewDocument(msg, msg.attachments.image_url)
} else { */
const modal = await this.modalController.create({
component: ViewMediaPage,
cssClass: 'modal modal-desktop',
componentProps: {
image: msg.attachments[0].image_url,
type: msg.file.type,
username: msg.u.name,
_updatedAt: msg._updatedAt
}
});
modal.present();
//}
}
}
testEditMessage(msg: MessageService) {
// msg.receptorReceive()
// alert('cool!')
}
}
@@ -3,7 +3,7 @@
<div class="title">
<div class="thetitle"><ion-label >Todas as tarefas</ion-label></div>
<div class="theicon">
<button class="btn-no-color" (click)="refreshing()">
<button title="Atualizar" class="btn-no-color" (click)="refreshing()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -6,7 +6,7 @@
<ion-label *ngIf="loggeduser.Profile =='PR'" >Despachos</ion-label>
</div>
<div class="theicon">
<button class="btn-no-color" (click)="doRefresh()">
<button title="Atualizar" class="btn-no-color" (click)="doRefresh()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -3,7 +3,7 @@
<div class="title">
<div class="thetitle"><ion-label >Despachos</ion-label></div>
<div class="theicon">
<button class="btn-no-color" (click)="refreshing()">
<button title="Atualizar" class="btn-no-color" (click)="refreshing()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -3,7 +3,7 @@
<div class="title">
<div class="thetitle"><ion-label >Diplomas</ion-label></div>
<div class="theicon">
<button class="btn-no-color" (click)="doRefresh()">
<button title="Atualizar" class="btn-no-color" (click)="doRefresh()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -3,7 +3,7 @@
<div class="title">
<div class="thetitle"><ion-label >Diplomas</ion-label></div>
<div class="theicon">
<button class="btn-no-color" (click)="doRefresh()">
<button title="Atualizar" class="btn-no-color" (click)="doRefresh()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -3,7 +3,7 @@
<div class="title width-100">
<div class="title-container d-flex justify-space-between">
<span class="text-center mt-0 aside-title px-20"><label>Eventos para Aprovação</label></span>
<button class="btn-no-color" (click)="doRefresh()">
<button title="Atualizar" title="Atualizar" class="btn-no-color" (click)="doRefresh()">
<ion-icon class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -3,7 +3,7 @@
<div class="title">
<div class="thetitle"><ion-label >Expediente</ion-label></div>
<div class="theicon">
<button class="btn-no-color" (click)="refreshing()">
<button title="Atualizar" class="btn-no-color" (click)="refreshing()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -3,7 +3,7 @@
<div class="title">
<div class="thetitle"><ion-label >Expediente</ion-label></div>
<div class="theicon">
<button class="btn-no-color" (click)="doRefresh()">
<button title="Atualizar" class="btn-no-color" (click)="doRefresh()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -3,7 +3,7 @@
<div class="title">
<div class="thetitle"><ion-label >Pedidos</ion-label></div>
<div class="theicon">
<button class="btn-no-color" (click)="doRefresh()">
<button title="Atualizar" class="btn-no-color" (click)="doRefresh()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
@@ -3,7 +3,7 @@
<div class="title">
<div class="thetitle"><ion-label >Pendentes</ion-label></div>
<div class="theicon">
<button class="btn-no-color" (click)="doRefresh()">
<button title="Atualizar" class="btn-no-color" (click)="doRefresh()">
<ion-icon slot="end" class="title-icon font-awesome" name="reload-circle"></ion-icon>
</button>
</div>
+8 -1
View File
@@ -22,13 +22,20 @@
<img *ngIf="ThemeService.currentTheme == 'gov' " src='assets/images/theme/gov/governoangola_A.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'tribunal' " src='assets/images/theme/tribunal/tribunal-constitucional.png' alt='logo'>
</div>
<div class="logo-description d-flex align-center justify-content-center">
<div *ngIf="ThemeService.currentTheme == 'gov'" class="logo-description d-flex align-center justify-content-center">
<div class="logo-description-content">
<p class="logo-description-text">Presidente da República</p>
<div class="add-line"></div>
<p class="logo-description-text tp-5">GABINETE DIGITAL</p>
</div>
</div>
<div *ngIf="ThemeService.currentTheme == 'default'" class="logo-description d-flex align-center justify-content-center">
<div class="logo-description-content">
<p class="logo-description-text color-white">Presidente da República</p>
<div class="add-line-white"></div>
<p class="logo-description-text tp-5 color-white">GABINETE DIGITAL</p>
</div>
</div>
</div>
<div title="Perfil" class="div-profile cursor-pointer" (click)="openProfile()">
+14
View File
@@ -49,12 +49,26 @@
margin-bottom: 2.5px !important;
padding: 0 !important;
}
.add-line-white{
width: 100%;
border-bottom: 1px solid #fff;
margin-bottom: 2.5px !important;
padding: 0 !important;
}
}
.color-white{
color: #fff !important;
}
.add-botton-border{
border-bottom: 1px solid #000;
}
.add-botton-border-white{
border-bottom: 1px solid #fff;
}
}
}
@@ -7,7 +7,7 @@
</div>
<div class="buttons">
<button (click)="takePicture()" full class="btn-ok" shape="round" >Tirar Fotografia</button>
<button hidden (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button>
<button (click)="addFile()" class="btn-ok" shape="round" >Anexar Documento</button>
<button (click)="anexarFoto()" full class="btn-ok" shape="round" >Anexar Fotografia</button>
<button (click)="addDocGestaoDocumental()" class="btn-ok" shape="round" >Gestão Documental</button>
<div class="solid"></div>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

+1 -1
View File
@@ -13,7 +13,7 @@ export const environment = {
domain: 'gabinetedigital.local', //gabinetedigital.local
defaultuser: 'paulo.pinto@gabinetedigital.local',//paulo.pinto paulo.pinto@gabinetedigital.local
defaultuserpwd: 'tabteste@006', //tabteste@006,
chatOffline: true
chatOffline: false
};
/*
+5 -5
View File
@@ -195,7 +195,7 @@ $app-theme: mat-light-theme(
* -------------------------------------------
*/
.ios body {
/* .ios body {
--ion-background-color: #000000;
--ion-background-color-rgb: 0, 0, 0;
@@ -229,14 +229,14 @@ $app-theme: mat-light-theme(
--ion-card-background: #1c1c1d;
--ion-color-expediente: #dae3f3;
}
} */
/*
* Material Design Dark Theme
* -------------------------------------------
*/
.md body {
/* .md body {
--ion-background-color: #121212;
--ion-background-color-rgb: 18, 18, 18;
@@ -272,9 +272,9 @@ $app-theme: mat-light-theme(
--ion-tab-bar-background: #1f1f1f;
--ion-card-background: #1e1e1e;
/* My colors */
--ion-color-expediente: #dae3f3;
}
} */
}
.center {
text-align: center;