This commit is contained in:
Peter Maquiran
2023-08-29 16:45:29 +01:00
39 changed files with 606 additions and 105 deletions
@@ -87,7 +87,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -25,7 +25,7 @@
</div> </div>
<div class="line"></div> <div class="line"></div>
<div class="middle-content"> <div class="middle-content">
<h5 *ngIf="LoadedDocument.ApplicationId == 361 || LoadedDocument.ApplicationID == 361" >Intervenientes</h5> <h5 *ngIf="LoadedDocument.ApplicationId == 361 || LoadedDocument.ApplicationID == 361" >Participantes</h5>
<h5 *ngIf="LoadedDocument.ApplicationId == 8 || LoadedDocument.ApplicationID == 8" >Remetente</h5> <h5 *ngIf="LoadedDocument.ApplicationId == 8 || LoadedDocument.ApplicationID == 8" >Remetente</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
@@ -249,7 +249,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
+1 -1
View File
@@ -18,7 +18,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -58,17 +58,26 @@
</div> </div>
<div> <div>
<div class="d-flex align-center flex-column"> <div class="d-flex align-center flex-column" (click)="takePicture()">
<div *ngIf="profilePicture == '' ">
<ion-icon
*ngIf="SessionStore.user.RoleDescription != 'Presidente da República' && SessionStore.user.RoleDescription != 'Ministro e Director do Gabinete do PR' && SessionStore.user.RoleDescription != 'Secretário Geral' "
class="profile-pic" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<img *ngIf="SessionStore.user.RoleDescription == 'Presidente da República' " class="profile-pic"
src='assets/images/presidente.png'>
<img *ngIf="SessionStore.user.RoleDescription == 'Ministro e Director do Gabinete do PR' "
class="profile-pic" src='assets/images/ministro.png'>
<img *ngIf="SessionStore.user.RoleDescription == 'Secretário Geral' " class="profile-pic"
src='assets/images/secretaria_geral.png'>
</div>
<div *ngIf="profilePicture != '' ">
<img class="profile-pic" src={{profilePicture}}>
</div>
<ion-icon *ngIf="SessionStore.user.RoleDescription != 'Presidente da República' && SessionStore.user.RoleDescription != 'Ministro e Director do Gabinete do PR' && SessionStore.user.RoleDescription != 'Secretário Geral' " class="profile-pic"
src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<img *ngIf="SessionStore.user.RoleDescription == 'Presidente da República' " class="profile-pic"
src='assets/images/presidente.png'>
<img *ngIf="SessionStore.user.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="profile-pic"
src='assets/images/ministro.png'>
<img *ngIf="SessionStore.user.RoleDescription == 'Secretário Geral' " class="profile-pic"
src='assets/images/secretaria_geral.png'>
<!-- <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="profile-pic" <!-- <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="profile-pic"
src="assets/images/icons-default-profile.svg"></ion-icon> src="assets/images/icons-default-profile.svg"></ion-icon>
@@ -76,9 +85,10 @@
src="assets/images/theme/gov/icons-profile.svg"></ion-icon> src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="profile-pic" <ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="profile-pic"
src="assets/images/theme/{{ThemeService.currentTheme}}/icons-profile.svg"></ion-icon> --> src="assets/images/theme/{{ThemeService.currentTheme}}/icons-profile.svg"></ion-icon> -->
<div style="background: black;width: 50px;height: 50px;position: relative;top: -33px;left: 38px;border-radius: 55px;overflow: hidden;border: 5px solid white;"> <div
<img src="assets/images/camera.png"> style="background: black;width: 50px;height: 50px;position: relative;top: -33px;left: 38px;border-radius: 55px;overflow: hidden;border: 5px solid white;">
</div> <img src="assets/images/camera.png">
</div>
</div> </div>
</div> </div>
@@ -1,11 +1,16 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { AnimationController, ModalController,Platform } from '@ionic/angular'; import { AnimationController, ModalController, Platform } from '@ionic/angular';
import { FingerprintPage } from 'src/app/shared/fingerprint/fingerprint.page'; import { FingerprintPage } from 'src/app/shared/fingerprint/fingerprint.page';
import { PinPage } from 'src/app/shared/pin/pin.page'; import { PinPage } from 'src/app/shared/pin/pin.page';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { BackgroundService } from 'src/app/services/background.service'; import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service'; import { ThemeService } from 'src/app/services/theme.service';
import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera';
import { Filesystem, Directory } from '@capacitor/filesystem';
import { File } from '@awesome-cordova-plugins/file/ngx';
import { StorageService } from 'src/app/services/storage.service';
@Component({ @Component({
selector: 'app-edit-profile', selector: 'app-edit-profile',
@@ -17,15 +22,31 @@ export class EditProfilePage implements OnInit {
SessionStore = SessionStore SessionStore = SessionStore
production = environment.production production = environment.production
environment = environment environment = environment
capturedImage = '';
capturedImageTitle = '';
profilePicture = "";
constructor(private modalController:ModalController, constructor(private modalController: ModalController,
private animationController: AnimationController, private animationController: AnimationController,
public platform: Platform, public platform: Platform,
private BackgroundService: BackgroundService, private BackgroundService: BackgroundService,
public ThemeService: ThemeService public ThemeService: ThemeService,
) {} private file: File,
private storageService: StorageService,
ngOnInit() {} ) { }
ngOnInit() {
this.getProfilpicture()
}
getProfilpicture() {
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
console.log(picture)
this.profilePicture = picture
}).catch((error ) => {
this.profilePicture = "";
})
}
close() { close() {
this.modalController.dismiss(); this.modalController.dismiss();
@@ -122,5 +143,78 @@ export class EditProfilePage implements OnInit {
this.BackgroundService.paint(); this.BackgroundService.paint();
} }
async takePicture() {
const capturedImage = await Camera.getPhoto({
width: 188,
height: 188,
quality: 50,
// allowEditing: true,
resultType: CameraResultType.Base64,
source: CameraSource.Camera
});
this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;
console.log(this.SessionStore.user.RoleID.toString())
this.storageService.store(this.SessionStore.user.RoleID.toString(),this.capturedImage).then((value) => {
console.log('picture saved')
}).catch((error) => {
console.log('picture not saved')
})
this.getProfilpicture()
this.capturedImageTitle = SessionStore.user.Profile;
/* this.saveFile(this.capturedImage,this.capturedImageTitle,'application/img'); */
}
/* async saveFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
console.log(blob)
let pathFile = ''
const fileName = filename
const contentFile = blob
if (this.platform.is('ios')) {
pathFile = this.file.documentsDirectory
} else {
pathFile = this.file.externalRootDirectory
}
console.log(pathFile)
await Filesystem.writeFile({
path: fileName,
data: pdfString,
directory: Directory.Documents,
}).then((dir) => {
console.log('DIR ', dir)
});
} */
b64toBlob(b64Data, contentType) {
contentType = contentType || '';
var sliceSize = 512;
b64Data = b64Data.replace(/^[^,]+,/, '');
b64Data = b64Data.replace(/\s/g, '');
var byteCharacters = window.atob(b64Data);
var byteArrays = [];
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
var slice = byteCharacters.slice(offset, offset + sliceSize);
var byteNumbers = new Array(slice.length);
for (var i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray);
}
var blob = new Blob(byteArrays, { type: contentType });
return blob;
}
} }
+9 -1
View File
@@ -39,7 +39,8 @@
<div class="d-flex align-center"> <div class="d-flex align-center">
<ion-icon *ngIf="SessionStore.user.RoleDescription != 'Presidente da República' && SessionStore.user.RoleDescription != 'Ministro e Director do Gabinete do PR' && SessionStore.user.RoleDescription != 'Secretário Geral' " class="profile-pic" <div *ngIf="profilePicture == ''" class="profile-pic">
<ion-icon *ngIf="SessionStore.user.RoleDescription != 'Presidente da República' && SessionStore.user.RoleDescription != 'Ministro e Director do Gabinete do PR' && SessionStore.user.RoleDescription != 'Secretário Geral' " class="profile-pic"
src="assets/images/theme/gov/icons-profile.svg"></ion-icon> src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<img *ngIf="SessionStore.user.RoleDescription == 'Presidente da República' " class="profile-pic" <img *ngIf="SessionStore.user.RoleDescription == 'Presidente da República' " class="profile-pic"
@@ -48,6 +49,13 @@
src='assets/images/ministro.png'> src='assets/images/ministro.png'>
<img *ngIf="SessionStore.user.RoleDescription == 'Secretário Geral' " class="profile-pic" <img *ngIf="SessionStore.user.RoleDescription == 'Secretário Geral' " class="profile-pic"
src='assets/images/secretaria_geral.png'> src='assets/images/secretaria_geral.png'>
</div>
<div *ngIf="profilePicture != ''" class="profile-pic">
<img class="profile-pic"
src={{profilePicture}}>
</div>
<!-- <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="profile-pic" <!-- <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="profile-pic"
src="assets/images/icons-default-profile.svg"></ion-icon> src="assets/images/icons-default-profile.svg"></ion-icon>
+21 -5
View File
@@ -39,6 +39,7 @@ export class ProfilePage implements OnInit {
taskExist = true; taskExist = true;
taskNotExist = false; taskNotExist = false;
isloading = false; isloading = false;
profilePicture = "";
SessionStore = SessionStore; SessionStore = SessionStore;
@@ -53,7 +54,8 @@ export class ProfilePage implements OnInit {
public ThemeService: ThemeService, public ThemeService: ThemeService,
private notificationService: NotificationsService, private notificationService: NotificationsService,
private processesService: ProcessesService, private processesService: ProcessesService,
private eventsService: EventsService private eventsService: EventsService,
private storageService: StorageService,
) { ) {
@@ -62,18 +64,18 @@ export class ProfilePage implements OnInit {
this.logoutOut = true this.logoutOut = true
}); });
this.eventTriger.getObservable().subscribe((event) => { /* this.eventTriger.getObservable().subscribe((event) => {
if (event.notification == "recive") { if (event.notification == "recive") {
this.getNotificationData(); this.getNotificationData();
} else if (event.notification == "deleted") { } else if (event.notification == "deleted") {
console.log('header', event.notification) console.log('header', event.notification)
this.getNotificationData(); this.getNotificationData();
} }
}); }); */
this.notificationService.notificationReceived.subscribe(() => { /* this.notificationService.notificationReceived.subscribe(() => {
this.getNotificationData(); this.getNotificationData();
}); }); */
setTimeout(() => { setTimeout(() => {
this.hideImage = true this.hideImage = true
@@ -83,9 +85,19 @@ export class ProfilePage implements OnInit {
ngOnInit() { ngOnInit() {
this.getNotificationData(); this.getNotificationData();
this.getProfilpicture();
} }
getProfilpicture() {
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
console.log(picture)
this.profilePicture = picture
}).catch((error ) => {
this.profilePicture = "";
})
}
close() { close() {
this.modalController.dismiss(); this.modalController.dismiss();
@@ -102,6 +114,8 @@ export class ProfilePage implements OnInit {
//if(keyExist) { //if(keyExist) {
await this.storageservice.get("Notifications").then((value) => { await this.storageservice.get("Notifications").then((value) => {
console.log('Getnotifications 111', value)
this.DataArray = [] this.DataArray = []
value.forEach((element, i) => { value.forEach((element, i) => {
console.log('Getnotifications', element, i) console.log('Getnotifications', element, i)
@@ -207,11 +221,13 @@ export class ProfilePage implements OnInit {
if (Service === "agenda" && Object === "event-list") { if (Service === "agenda" && Object === "event-list") {
this.isloading = true this.isloading = true
this.processesService.GetTask(IdObject).subscribe((task) => { this.processesService.GetTask(IdObject).subscribe((task) => {
console.log('evento exist')
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda'])); this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda']));
this.deleteNotification(index); this.deleteNotification(index);
this.isloading = false this.isloading = false
}, (error) => { }, (error) => {
console.log('evento não existe')
this.notificationdata[i].read = true; this.notificationdata[i].read = true;
this.isloading = false this.isloading = false
}) })
@@ -74,7 +74,7 @@
<div class="line"></div> <div class="line"></div>
<div class="middle-content"> <div class="middle-content">
<div *ngIf="loadedEvent.Attendees"> <div *ngIf="loadedEvent.Attendees">
<h5 class="font-17-rem">Intervenientes</h5> <h5 class="font-17-rem">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let attendee of loadedEvent.Attendees"> <div *ngFor="let attendee of loadedEvent.Attendees">
@@ -252,7 +252,7 @@
<div class="list-people flex-grow-1"> <div class="list-people flex-grow-1">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -275,7 +275,7 @@
<div class="list-people flex-grow-1"> <div class="list-people flex-grow-1">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipantsCc?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipantsCc?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipantsCc">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipantsCc">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -209,7 +209,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -69,7 +69,7 @@
<div class="line"></div> <div class="line"></div>
<div class="middle-content"> <div class="middle-content">
<div *ngIf="loadedEvent.Attendees"> <div *ngIf="loadedEvent.Attendees">
<h5 class="font-17-rem">Intervenientes</h5> <h5 class="font-17-rem">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let attendee of loadedEvent.Attendees"> <div *ngFor="let attendee of loadedEvent.Attendees">
@@ -647,7 +647,18 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
source: CameraSource.Camera source: CameraSource.Camera
}); });
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const compressedImage = await this.compressImageBase64(
imageBase64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
imageBase64 = picture
});
const blob = this.dataURItoBlob(imageBase64) const blob = this.dataURItoBlob(imageBase64)
console.log(imageBase64) console.log(imageBase64)
@@ -699,7 +710,19 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
//const imageData = await this.fileToBase64Service.convert(file) //const imageData = await this.fileToBase64Service.convert(file)
// //
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const compressedImage = await this.compressImageBase64(
imageBase64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
imageBase64 = picture
});
const response = await fetch(imageBase64); const response = await fetch(imageBase64);
const blob = await response.blob(); const blob = await response.blob();
@@ -1183,5 +1206,41 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
return blob; return blob;
} }
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
return new Promise((resolve, reject) => {
const image = new (window as any).Image();
image.src = base64String;
image.onload = async () => {
const canvas = document.createElement('canvas');
let newWidth = image.width;
let newHeight = image.height;
if (newWidth > maxWidth) {
newHeight *= maxWidth / newWidth;
newWidth = maxWidth;
}
if (newHeight > maxHeight) {
newWidth *= maxHeight / newHeight;
newHeight = maxHeight;
}
canvas.width = newWidth;
canvas.height = newHeight;
const context = canvas.getContext('2d');
context?.drawImage(image, 0, 0, newWidth, newHeight);
const compressedBase64 = canvas.toDataURL('image/jpeg', quality);
resolve(compressedBase64);
};
image.onerror = (error) => {
reject(error);
};
});
}
} }
+64 -5
View File
@@ -630,10 +630,21 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
source: CameraSource.Camera source: CameraSource.Camera
}); });
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const blob = this.dataURItoBlob(imageBase64)
const compressedImage = await this.compressImageBase64(
imageBase64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
imageBase64 = picture
});
console.log(imageBase64) console.log(imageBase64)
const blob = this.dataURItoBlob(imageBase64)
const formData = new FormData(); const formData = new FormData();
formData.append("blobFile", blob); formData.append("blobFile", blob);
@@ -748,12 +759,24 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
//const imageData = await this.fileToBase64Service.convert(file) //const imageData = await this.fileToBase64Service.convert(file)
// //
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String var imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const response = await fetch(imageBase64);
const blob = await response.blob();
const compressedImage = await this.compressImageBase64(
imageBase64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
imageBase64 = picture
});
console.log(imageBase64) console.log(imageBase64)
const response = await fetch(imageBase64);
const blob = await response.blob();
const formData = new FormData(); const formData = new FormData();
formData.append("blobFile", blob); formData.append("blobFile", blob);
@@ -1146,6 +1169,42 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}); });
} }
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
return new Promise((resolve, reject) => {
const image = new (window as any).Image();
image.src = base64String;
image.onload = async () => {
const canvas = document.createElement('canvas');
let newWidth = image.width;
let newHeight = image.height;
if (newWidth > maxWidth) {
newHeight *= maxWidth / newWidth;
newWidth = maxWidth;
}
if (newHeight > maxHeight) {
newWidth *= maxHeight / newHeight;
newHeight = maxHeight;
}
canvas.width = newWidth;
canvas.height = newHeight;
const context = canvas.getContext('2d');
context?.drawImage(image, 0, 0, newWidth, newHeight);
const compressedBase64 = canvas.toDataURL('image/jpeg', quality);
resolve(compressedBase64);
};
image.onerror = (error) => {
reject(error);
};
});
}
} }
@@ -36,7 +36,7 @@
<div class="overflow-y-auto"> <div class="overflow-y-auto">
<div class="middle-content" > <div class="middle-content" >
<div *ngIf="intervenientes.length > 0"> <div *ngIf="intervenientes.length > 0">
<h5 >Intervenientes</h5> <h5 >Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label *ngIf="intervenientes"> <ion-label *ngIf="intervenientes">
<div *ngFor="let interveniente of intervenientes"> <div *ngFor="let interveniente of intervenientes">
@@ -35,7 +35,7 @@
<div class="overflow-y-auto" style="margin-right: -20px; margin-right: -20px;"> <div class="overflow-y-auto" style="margin-right: -20px; margin-right: -20px;">
<div class="middle-content"> <div class="middle-content">
<h5 *ngIf="intervenientes">Intervenientes</h5> <h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let task of intervenientes"> <div *ngFor="let task of intervenientes">
@@ -37,7 +37,7 @@
</div> </div>
<div class="line"></div> <div class="line"></div>
<div class="middle-content"> <div class="middle-content">
<h5 *ngIf="intervenientes">Intervenientes</h5> <h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let interveniente of intervenientes"> <div *ngFor="let interveniente of intervenientes">
@@ -74,7 +74,7 @@
</div> </div>
<div *ngIf="loadedEvent.workflowInstanceDataFields.Participants" class="middle-content"> <div *ngIf="loadedEvent.workflowInstanceDataFields.Participants" class="middle-content">
<div *ngIf="loadedEvent.workflowInstanceDataFields.Participants"> <div *ngIf="loadedEvent.workflowInstanceDataFields.Participants">
<h5 class="font-17-rem">Intervenientes</h5> <h5 class="font-17-rem">Participantes</h5>
<div *ngFor="let att of loadedEvent.workflowInstanceDataFields.ParticipantsList"> <div *ngFor="let att of loadedEvent.workflowInstanceDataFields.ParticipantsList">
<ion-label>{{att.Name}}</ion-label> <ion-label>{{att.Name}}</ion-label>
</div> </div>
@@ -73,7 +73,7 @@
<div class="overflow-y-auto"> <div class="overflow-y-auto">
<div class="middle-content"> <div class="middle-content">
<div *ngIf="loadedEvent.workflowInstanceDataFields.ParticipantsList"> <div *ngIf="loadedEvent.workflowInstanceDataFields.ParticipantsList">
<h5 class="font-17-rem">Intervenientes</h5> <h5 class="font-17-rem">Participantes</h5>
<div *ngFor="let att of loadedEvent.workflowInstanceDataFields.ParticipantsList"> <div *ngFor="let att of loadedEvent.workflowInstanceDataFields.ParticipantsList">
<ion-label>{{att.Name}}</ion-label> <ion-label>{{att.Name}}</ion-label>
</div> </div>
@@ -213,7 +213,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -140,7 +140,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -44,7 +44,7 @@
<div class="overflow-y-auto"> <div class="overflow-y-auto">
<div class="middle-content"> <div class="middle-content">
<!-- <h5 *ngIf="intervenientes">Intervenientes</h5> <!-- <h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let interveniente of intervenientes"> <div *ngFor="let interveniente of intervenientes">
@@ -37,7 +37,7 @@
<div class="overflow-y-auto"> <div class="overflow-y-auto">
<div class="middle-content"> <div class="middle-content">
<h5 *ngIf="intervenientes">Intervenientes</h5> <h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let interveniente of intervenientes"> <div *ngFor="let interveniente of intervenientes">
+6 -2
View File
@@ -19,6 +19,8 @@ import { Platform } from '@ionic/angular';
import { FirstEnterService } from '../../services/first-enter.service'; import { FirstEnterService } from '../../services/first-enter.service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { CPSession } from 'src/app/store/documentManagement'; import { CPSession } from 'src/app/store/documentManagement';
import { StorageService } from 'src/app/services/storage.service';
@Component({ @Component({
selector: 'app-login', selector: 'app-login',
templateUrl: './login.page.html', templateUrl: './login.page.html',
@@ -55,6 +57,7 @@ export class LoginPage implements OnInit {
private platform: Platform, private platform: Platform,
private FirstEnterService: FirstEnterService, private FirstEnterService: FirstEnterService,
private storage:Storage, private storage:Storage,
private storageService: StorageService,
) {} ) {}
ngOnInit() {} ngOnInit() {}
@@ -140,7 +143,8 @@ export class LoginPage implements OnInit {
} }
this.changeProfileService.runLogin(); this.changeProfileService.runLogin();
/* this.getToken(); */
this.getToken();
SessionStore.setInativity(true); SessionStore.setInativity(true);
this.goback(); this.goback();
@@ -169,7 +173,7 @@ export class LoginPage implements OnInit {
this.ChatService.setheader(); this.ChatService.setheader();
this.ChatSystemService.loadChat(); this.ChatSystemService.loadChat();
} }
this.storageService.remove("Notifications")
this.getToken(); this.getToken();
if(!this.platform.is('desktop') && !this.platform.is('mobileweb')) { if(!this.platform.is('desktop') && !this.platform.is('mobileweb')) {
@@ -125,24 +125,48 @@ export class NewPublicationPage implements OnInit {
// in use // in use
async takePicture() { async takePicture() {
const capturedImage = await Camera.getPhoto({ const capturedImage = await Camera.getPhoto({
quality: 50, quality: 50,
// allowEditing: true, // allowEditing: true,
resultType: CameraResultType.Uri, resultType: CameraResultType.Base64,
source: CameraSource.Camera source: CameraSource.Camera
}); });
const response = await fetch(capturedImage.webPath!); this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
const blob = await response.blob(); this.capturedImageTitle = 'foto';
this.convertBlobToBase64Worker.postMessage(blob); const compressedImage = await this.compressImageBase64(
this.convertBlobToBase64Worker.onmessage = async (oEvent)=> { this.capturedImage,
this.capturedImage = oEvent.data 800, // maxWidth
this.capturedImageTitle = 'foto' 800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('taked: ', picture)
this.capturedImage = picture
});
}
async laodPicture() {
const capturedImage = await Camera.getPhoto({
quality: 90,
resultType: CameraResultType.Base64,
source: CameraSource.Photos
});
this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
this.capturedImageTitle = 'foto';
const compressedImage = await this.compressImageBase64(
this.capturedImage,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
this.capturedImage = picture
});
} }
}
imageSize(image) { imageSize(image) {
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
@@ -165,7 +189,7 @@ export class NewPublicationPage implements OnInit {
}); });
// in use /* // in use
async laodPicture() { async laodPicture() {
const capturedImage = await Camera.getPhoto({ const capturedImage = await Camera.getPhoto({
@@ -185,7 +209,7 @@ export class NewPublicationPage implements OnInit {
} }
} } */
@@ -374,4 +398,41 @@ export class NewPublicationPage implements OnInit {
deletePublicationImage() { deletePublicationImage() {
this.publication.FileBase64 = "" this.publication.FileBase64 = ""
} }
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
return new Promise((resolve, reject) => {
const image = new (window as any).Image();
image.src = base64String;
image.onload = async () => {
const canvas = document.createElement('canvas');
let newWidth = image.width;
let newHeight = image.height;
if (newWidth > maxWidth) {
newHeight *= maxWidth / newWidth;
newWidth = maxWidth;
}
if (newHeight > maxHeight) {
newWidth *= maxHeight / newHeight;
newHeight = maxHeight;
}
canvas.width = newWidth;
canvas.height = newHeight;
const context = canvas.getContext('2d');
context?.drawImage(image, 0, 0, newWidth, newHeight);
const compressedBase64 = canvas.toDataURL('image/jpeg', quality);
resolve(compressedBase64);
};
image.onerror = (error) => {
reject(error);
};
});
}
} }
@@ -83,7 +83,7 @@
<div class="overflow-y-auto"> <div class="overflow-y-auto">
<div class="middle-content"> <div class="middle-content">
<div *ngIf="loadedEvent.workflowInstanceDataFields.ParticipantsList"> <div *ngIf="loadedEvent.workflowInstanceDataFields.ParticipantsList">
<h5 class="font-17-rem">Intervenientes</h5> <h5 class="font-17-rem">Participantes</h5>
<div *ngFor="let att of loadedEvent.workflowInstanceDataFields.ParticipantsList"> <div *ngFor="let att of loadedEvent.workflowInstanceDataFields.ParticipantsList">
<ion-label>{{att.Name}}</ion-label> <ion-label>{{att.Name}}</ion-label>
</div> </div>
@@ -282,7 +282,7 @@
<div class="list-people flex-grow-1"> <div class="list-people flex-grow-1">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -219,7 +219,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<div *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</div> <div *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</div>
<div *ngFor="let participant of taskParticipants">{{participant.Name}}</div> <div *ngFor="let participant of taskParticipants">{{participant.Name}}</div>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -246,7 +246,7 @@
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants.length ==0" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants.length ==0" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -95,7 +95,7 @@
<div class="line"></div> <div class="line"></div>
<div class="middle-content"> <div class="middle-content">
<div *ngIf="loadedEvent.Attendees"> <div *ngIf="loadedEvent.Attendees">
<h5 class="font-17-rem">Intervenientes</h5> <h5 class="font-17-rem">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let attendee of loadedEvent.Attendees"> <div *ngFor="let attendee of loadedEvent.Attendees">
@@ -715,10 +715,21 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
source: CameraSource.Camera source: CameraSource.Camera
}); });
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String //const imageData = await this.fileToBase64Service.convert(file)
const blob = this.dataURItoBlob(imageBase64) //
var base64 = 'data:image/jpeg;base64,' + file.base64String
const compressedImage = await this.compressImageBase64(
base64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
base64 = picture
});
console.log(imageBase64) const response = await fetch(base64);
const blob = await response.blob();
const formData = new FormData(); const formData = new FormData();
formData.append("blobFile", blob); formData.append("blobFile", blob);
@@ -736,7 +747,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
"title_link_download": false, "title_link_download": false,
}], }],
attachmentsModelData: { attachmentsModelData: {
fileBase64: imageBase64, fileBase64: base64,
} }
}) })
@@ -1141,6 +1152,42 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
} }
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
return new Promise((resolve, reject) => {
const image = new (window as any).Image();
image.src = base64String;
image.onload = async () => {
const canvas = document.createElement('canvas');
let newWidth = image.width;
let newHeight = image.height;
if (newWidth > maxWidth) {
newHeight *= maxWidth / newWidth;
newWidth = maxWidth;
}
if (newHeight > maxHeight) {
newWidth *= maxHeight / newHeight;
newHeight = maxHeight;
}
canvas.width = newWidth;
canvas.height = newHeight;
const context = canvas.getContext('2d');
context?.drawImage(image, 0, 0, newWidth, newHeight);
const compressedBase64 = canvas.toDataURL('image/jpeg', quality);
resolve(compressedBase64);
};
image.onerror = (error) => {
reject(error);
};
});
}
dataURItoBlob(dataURI) { dataURItoBlob(dataURI) {
// convert base64 to raw binary data held in a string // convert base64 to raw binary data held in a string
// doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this // doesn't handle URLEncoded DataURIs - see SO answer #6850276 for code that does this
@@ -1180,5 +1227,6 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
}; };
}) })
} }
} }
+64 -8
View File
@@ -645,10 +645,19 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
source: CameraSource.Camera source: CameraSource.Camera
}); });
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String var base64 = 'data:image/jpeg;base64,' + file.base64String
const blob = this.dataURItoBlob(imageBase64) const compressedImage = await this.compressImageBase64(
base64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
base64 = picture
});
console.log(imageBase64)
const blob = this.dataURItoBlob(base64)
const formData = new FormData(); const formData = new FormData();
formData.append("blobFile", blob); formData.append("blobFile", blob);
@@ -667,7 +676,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
"title_link_download": false, "title_link_download": false,
}], }],
attachmentsModelData: { attachmentsModelData: {
fileBase64: imageBase64, fileBase64: base64,
} }
}) })
@@ -776,11 +785,21 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
//const imageData = await this.fileToBase64Service.convert(file) //const imageData = await this.fileToBase64Service.convert(file)
// //
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String var base64 = 'data:image/jpeg;base64,' + file.base64String
const response = await fetch(imageBase64); const compressedImage = await this.compressImageBase64(
base64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
base64 = picture
});
const response = await fetch(base64);
const blob = await response.blob(); const blob = await response.blob();
console.log(imageBase64) console.log(base64)
const formData = new FormData(); const formData = new FormData();
formData.append("blobFile", blob); formData.append("blobFile", blob);
@@ -798,7 +817,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
"title_link_download": false, "title_link_download": false,
}], }],
attachmentsModelData: { attachmentsModelData: {
fileBase64: imageBase64, fileBase64: base64,
} }
}) })
@@ -1176,6 +1195,43 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
} }
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
return new Promise((resolve, reject) => {
const image = new (window as any).Image();
image.src = base64String;
image.onload = async () => {
const canvas = document.createElement('canvas');
let newWidth = image.width;
let newHeight = image.height;
if (newWidth > maxWidth) {
newHeight *= maxWidth / newWidth;
newWidth = maxWidth;
}
if (newHeight > maxHeight) {
newWidth *= maxHeight / newHeight;
newHeight = maxHeight;
}
canvas.width = newWidth;
canvas.height = newHeight;
const context = canvas.getContext('2d');
context?.drawImage(image, 0, 0, newWidth, newHeight);
const compressedBase64 = canvas.toDataURL('image/jpeg', quality);
resolve(compressedBase64);
};
image.onerror = (error) => {
reject(error);
};
});
}
} }
@@ -224,7 +224,7 @@
<div class="list-people flex-grow-1"> <div class="list-people flex-grow-1">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar intervenientes*</ion-label> <ion-label *ngIf="taskParticipants?.length < 1" class="list-people-title">Adicionar Participantes*</ion-label>
<ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label> <ion-label *ngFor="let participant of taskParticipants">{{participant.Name}}</ion-label>
</ion-list> </ion-list>
</ion-item> </ion-item>
@@ -1,7 +1,7 @@
<ion-content> <ion-content>
<div *ngIf="task" class="overflow-y-auto height-100"> <div *ngIf="task" class="overflow-y-auto height-100">
<div class="middle-content"> <div class="middle-content">
<h5 class="font-17-rem" *ngIf="intervenientes">Intervenientes</h5> <h5 class="font-17-rem" *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let interveniente of intervenientes"> <div *ngFor="let interveniente of intervenientes">
@@ -33,7 +33,7 @@
<ion-content> <ion-content>
<div *ngIf="task" class="overflow-y-auto height-100 px-20"> <div *ngIf="task" class="overflow-y-auto height-100 px-20">
<div class="middle-content"> <div class="middle-content">
<h5 class="font-17-rem" *ngIf="intervenientes">Intervenientes</h5> <h5 class="font-17-rem" *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding"> <ion-item class="ion-no-margin ion-no-padding">
<ion-label> <ion-label>
<div *ngFor="let interveniente of intervenientes"> <div *ngFor="let interveniente of intervenientes">
+32 -14
View File
@@ -47,14 +47,25 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon font-45-em" src='assets/images/icons-profile.svg'></ion-icon> <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="icon font-45-em" src='assets/images/icons-profile.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon font-45-em" src='assets/images/theme/gov/icons-profile.svg'></ion-icon> --> <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon font-45-em" src='assets/images/theme/gov/icons-profile.svg'></ion-icon> -->
<img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="icon font-45-em" <div *ngIf="profilePicture == ''" class="profile-image">
src='assets/images/presidente.png'> <img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="profile-image"
<img *ngIf="loggeduser.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="icon font-45-em" src='assets/images/presidente.png'>
src='assets/images/ministro.png'> <img *ngIf="loggeduser.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="profile-image"
<img *ngIf="loggeduser.RoleDescription == 'Secretário Geral' " class="icon font-45-em" src='assets/images/ministro.png'>
src='assets/images/secretaria_geral.png'> <img *ngIf="loggeduser.RoleDescription == 'Secretário Geral' " class="profile-image"
src='assets/images/secretaria_geral.png'>
<ion-icon
*ngIf="loggeduser.RoleDescription != 'Presidente da República'&& loggeduser.RoleDescription != 'Ministro e Director do Gabinete do PR' && loggeduser.RoleDescription != 'Secretário Geral' "
class="icon font-45-em" src='assets/images/theme/gov/icons-profile.svg'></ion-icon>
</div>
<div *ngIf="profilePicture != ''" class="profile-image">
<img class="profile-image" src={{profilePicture}}>
</div>
<ion-icon *ngIf="loggeduser.RoleDescription != 'Presidente da República'&& loggeduser.RoleDescription != 'Ministro e Director do Gabinete do PR' && loggeduser.RoleDescription != 'Secretário Geral' " class="icon font-45-em" src='assets/images/theme/gov/icons-profile.svg'></ion-icon>
<div class="profile-text"> <div class="profile-text">
<div *ngIf="notificationLength > 0" class="icon-badge" style="right: -6px;top: 38px;top: -6px;"> <div *ngIf="notificationLength > 0" class="icon-badge" style="right: -6px;top: 38px;top: -6px;">
@@ -200,16 +211,23 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="icon" src='assets/images/theme/doneIt/icons-profile.svg'></ion-icon> <ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="icon" src='assets/images/theme/doneIt/icons-profile.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon" src='assets/images/theme/gov/icons-profile.svg'></ion-icon> --> <ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon" src='assets/images/theme/gov/icons-profile.svg'></ion-icon> -->
<div *ngIf="profilePicture == ''" class="profile-image">
<img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="profile-image"
src='assets/images/presidente.png'>
<img *ngIf="loggeduser.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="profile-image"
src='assets/images/ministro.png'>
<img *ngIf="loggeduser.RoleDescription == 'Secretário Geral' " class="profile-image"
src='assets/images/secretaria_geral.png'>
<img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="profile-image" <ion-icon
src='assets/images/presidente.png'> *ngIf="loggeduser.RoleDescription != 'Presidente da República'&& loggeduser.RoleDescription != 'Ministro e Director do Gabinete do PR' && loggeduser.RoleDescription != 'Secretário Geral' "
<img *ngIf="loggeduser.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="profile-image" class="icon" src='assets/images/theme/gov/icons-profile.svg'></ion-icon>
src='assets/images/ministro.png'> </div>
<img *ngIf="loggeduser.RoleDescription == 'Secretário Geral' " class="profile-image"
src='assets/images/secretaria_geral.png'>
<ion-icon *ngIf="loggeduser.RoleDescription != 'Presidente da República'&& loggeduser.RoleDescription != 'Ministro e Director do Gabinete do PR' && loggeduser.RoleDescription != 'Secretário Geral' " class="icon" src='assets/images/theme/gov/icons-profile.svg'></ion-icon>
<div *ngIf="profilePicture != ''" class="profile-image">
<img class="profile-image" src={{profilePicture}}>
</div>
<div class="profile-text"> <div class="profile-text">
<div *ngIf="notificationLength > 0" class="icon-badge" style="right: -6px;top: 38px;top: -6px;"> <div *ngIf="notificationLength > 0" class="icon-badge" style="right: -6px;top: 38px;top: -6px;">
+13 -1
View File
@@ -38,6 +38,7 @@ export class HeaderPage implements OnInit {
showProfileModal = false showProfileModal = false
permissionList = new PermissionList(); permissionList = new PermissionList();
notificationCount: number = 0; notificationCount: number = 0;
profilePicture = "";
constructor( constructor(
@@ -52,7 +53,8 @@ export class HeaderPage implements OnInit {
private eventTriger: EventTrigger, private eventTriger: EventTrigger,
public ActiveTabService: ActiveTabService, public ActiveTabService: ActiveTabService,
private notificationService: NotificationsService, private notificationService: NotificationsService,
private cdRef: ChangeDetectorRef private cdRef: ChangeDetectorRef,
private storageService: StorageService,
) { ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
router.events.subscribe((val) => { router.events.subscribe((val) => {
@@ -76,9 +78,19 @@ export class HeaderPage implements OnInit {
async ngOnInit() { async ngOnInit() {
this.hideSearch(); this.hideSearch();
this.notificationLengthData(); this.notificationLengthData();
this.getProfilpicture();
} }
getProfilpicture() {
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
console.log(picture)
this.profilePicture = picture
}).catch((error ) => {
this.profilePicture = "";
})
}
updateReciveNotification() { updateReciveNotification() {
this.eventTriger.getObservable().subscribe((event) => { this.eventTriger.getObservable().subscribe((event) => {
if (event.notification == "recive") { if (event.notification == "recive") {
@@ -114,7 +114,16 @@ export class NewPublicationPage implements OnInit {
this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String; this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
this.capturedImageTitle = 'foto'; this.capturedImageTitle = 'foto';
//
const compressedImage = await this.compressImageBase64(
this.capturedImage,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('taked: ', picture)
this.capturedImage = picture
});
} }
async laodPicture() { async laodPicture() {
@@ -126,6 +135,17 @@ export class NewPublicationPage implements OnInit {
this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String; this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
this.capturedImageTitle = 'foto'; this.capturedImageTitle = 'foto';
const compressedImage = await this.compressImageBase64(
this.capturedImage,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
this.capturedImage = picture
});
} }
@@ -313,4 +333,40 @@ export class NewPublicationPage implements OnInit {
} }
async compressImageBase64(base64String: string, maxWidth: number, maxHeight: number, quality: number): Promise<string> {
return new Promise((resolve, reject) => {
const image = new (window as any).Image();
image.src = base64String;
image.onload = async () => {
const canvas = document.createElement('canvas');
let newWidth = image.width;
let newHeight = image.height;
if (newWidth > maxWidth) {
newHeight *= maxWidth / newWidth;
newWidth = maxWidth;
}
if (newHeight > maxHeight) {
newWidth *= maxHeight / newHeight;
newHeight = maxHeight;
}
canvas.width = newWidth;
canvas.height = newHeight;
const context = canvas.getContext('2d');
context?.drawImage(image, 0, 0, newWidth, newHeight);
const compressedBase64 = canvas.toDataURL('image/jpeg', quality);
resolve(compressedBase64);
};
image.onerror = (error) => {
reject(error);
};
});
}
} }
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = { export let versionData = {
"shortSHA": "088ee19e5", "shortSHA": "53e674032",
"SHA": "088ee19e5ccf5ce4557d0c5e54a5bd8688239f6b", "SHA": "53e67403238dbaaf46480561ce789b3f4cd17d82",
"branch": "developer-prod", "branch": "developer-prod",
"lastCommitAuthor": "'Peter Maquiran'", "lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Mon Aug 28 17:39:48 2023 +0100'", "lastCommitTime": "'Tue Aug 29 16:42:46 2023 +0100'",
"lastCommitMessage": "add color black", "lastCommitMessage": "agenda change timeline",
"lastCommitNumber": "5225", "lastCommitNumber": "5226",
"change": "", "change": "",
"changeStatus": "On branch developer-prod\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/agenda/agenda.page.html\n\tmodified: src/app/pages/agenda/agenda.page.scss\n\tmodified: src/app/pages/agenda/agenda.page.ts\n\tmodified: src/app/services/agenda/list-box.service.ts\n\tmodified: src/app/shared/gabinete-digital/despachos-pr/despachos-pr.page.scss\n\tmodified: src/app/shared/gabinete-digital/despachos/despachos.page.scss\n\tmodified: src/global.scss", "changeStatus": "On branch developer-prod\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/modals/create-process/create-process.page.html\n\tmodified: src/app/modals/document-detail/document-detail.page.html\n\tmodified: src/app/modals/document-set-up-meeting/document-set-up-meeting.page.html\n\tmodified: src/app/modals/forward/forward.page.html\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.html\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.ts\n\tmodified: src/app/modals/profile/profile.page.html\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/modals/view-event/view-event.page.html\n\tmodified: src/app/pages/agenda/edit-event/edit-event.page.html\n\tmodified: src/app/pages/agenda/new-event/new-event.page.html\n\tmodified: src/app/pages/agenda/view-event/view-event.page.html\n\tmodified: src/app/pages/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/pages/chat/messages/messages.page.ts\n\tmodified: src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.html\n\tmodified: src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html\n\tmodified: src/app/pages/gabinete-digital/diplomas-gerar/diplomas-gerar/diplomas-gerar.page.html\n\tmodified: src/app/pages/gabinete-digital/event-list/approve-event-modal/approve-event-modal.page.html\n\tmodified: src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html\n\tmodified: src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html\n\tmodified: src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html\n\tmodified: src/app/pages/gabinete-digital/expedientes-pr/expediente-pr/expediente-pr.page.html\n\tmodified: src/app/pages/gabinete-digital/pedidos/pedido/pedido.page.html\n\tmodified: src/app/pages/login/login.page.ts\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/shared/agenda/approve-event/approve-event.page.html\n\tmodified: src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html\n\tmodified: src/app/shared/agenda/edit-event/edit-event.page.html\n\tmodified: src/app/shared/agenda/new-event/new-event.page.html\n\tmodified: src/app/shared/agenda/view-event/view-event.page.html\n\tmodified: src/app/shared/chat/group-messages/group-messages.page.ts\n\tmodified: src/app/shared/chat/messages/messages.page.ts\n\tmodified: src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html\n\tmodified: src/app/shared/gabinete-digital/generic/task-detail-content/task-detail-content.page.html\n\tmodified: src/app/shared/gabinete-digital/generic/task-details/task-details.page.html\n\tmodified: src/app/shared/header/header.page.html\n\tmodified: src/app/shared/header/header.page.ts\n\tmodified: src/app/shared/publication/new-publication/new-publication.page.ts\n\tmodified: version/git-version.ts",
"changeAuthor": "peter.maquiran" "changeAuthor": "peter.maquiran"
} }