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">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -25,7 +25,7 @@
</div>
<div class="line"></div>
<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>
<ion-item class="ion-no-margin ion-no-padding">
@@ -249,7 +249,7 @@
<div class="list-people">
<ion-item lines="none">
<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-list>
</ion-item>
+1 -1
View File
@@ -18,7 +18,7 @@
<div class="list-people">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -58,17 +58,26 @@
</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"
src="assets/images/icons-default-profile.svg"></ion-icon>
@@ -76,11 +85,12 @@
src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="profile-pic"
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;">
<img src="assets/images/camera.png">
</div>
<div
style="background: black;width: 50px;height: 50px;position: relative;top: -33px;left: 38px;border-radius: 55px;overflow: hidden;border: 5px solid white;">
<img src="assets/images/camera.png">
</div>
</div>
</div>
<div class="profile-info">
@@ -1,11 +1,16 @@
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 { PinPage } from 'src/app/shared/pin/pin.page';
import { SessionStore } from 'src/app/store/session.service';
import { environment } from 'src/environments/environment';
import { BackgroundService } from 'src/app/services/background.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({
selector: 'app-edit-profile',
@@ -17,15 +22,31 @@ export class EditProfilePage implements OnInit {
SessionStore = SessionStore
production = environment.production
environment = environment
capturedImage = '';
capturedImageTitle = '';
profilePicture = "";
constructor(private modalController:ModalController,
constructor(private modalController: ModalController,
private animationController: AnimationController,
public platform: Platform,
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() {
this.modalController.dismiss();
@@ -122,5 +143,78 @@ export class EditProfilePage implements OnInit {
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">
<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>
<img *ngIf="SessionStore.user.RoleDescription == 'Presidente da República' " class="profile-pic"
@@ -48,6 +49,13 @@
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 != ''" class="profile-pic">
<img class="profile-pic"
src={{profilePicture}}>
</div>
<!-- <ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="profile-pic"
src="assets/images/icons-default-profile.svg"></ion-icon>
+21 -5
View File
@@ -39,6 +39,7 @@ export class ProfilePage implements OnInit {
taskExist = true;
taskNotExist = false;
isloading = false;
profilePicture = "";
SessionStore = SessionStore;
@@ -53,7 +54,8 @@ export class ProfilePage implements OnInit {
public ThemeService: ThemeService,
private notificationService: NotificationsService,
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.eventTriger.getObservable().subscribe((event) => {
/* this.eventTriger.getObservable().subscribe((event) => {
if (event.notification == "recive") {
this.getNotificationData();
} else if (event.notification == "deleted") {
console.log('header', event.notification)
this.getNotificationData();
}
});
}); */
this.notificationService.notificationReceived.subscribe(() => {
/* this.notificationService.notificationReceived.subscribe(() => {
this.getNotificationData();
});
}); */
setTimeout(() => {
this.hideImage = true
@@ -83,9 +85,19 @@ export class ProfilePage implements OnInit {
ngOnInit() {
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() {
this.modalController.dismiss();
@@ -102,6 +114,8 @@ export class ProfilePage implements OnInit {
//if(keyExist) {
await this.storageservice.get("Notifications").then((value) => {
console.log('Getnotifications 111', value)
this.DataArray = []
value.forEach((element, i) => {
console.log('Getnotifications', element, i)
@@ -207,11 +221,13 @@ export class ProfilePage implements OnInit {
if (Service === "agenda" && Object === "event-list") {
this.isloading = true
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.deleteNotification(index);
this.isloading = false
}, (error) => {
console.log('evento não existe')
this.notificationdata[i].read = true;
this.isloading = false
})
@@ -74,7 +74,7 @@
<div class="line"></div>
<div class="middle-content">
<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-label>
<div *ngFor="let attendee of loadedEvent.Attendees">
@@ -252,7 +252,7 @@
<div class="list-people flex-grow-1">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -275,7 +275,7 @@
<div class="list-people flex-grow-1">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -209,7 +209,7 @@
<div class="list-people">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -69,7 +69,7 @@
<div class="line"></div>
<div class="middle-content">
<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-label>
<div *ngFor="let attendee of loadedEvent.Attendees">
@@ -647,7 +647,18 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
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)
console.log(imageBase64)
@@ -699,7 +710,19 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
//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 blob = await response.blob();
@@ -1183,5 +1206,41 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
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
});
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const blob = this.dataURItoBlob(imageBase64)
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
});
console.log(imageBase64)
const blob = this.dataURItoBlob(imageBase64)
const formData = new FormData();
formData.append("blobFile", blob);
@@ -748,12 +759,24 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
//const imageData = await this.fileToBase64Service.convert(file)
//
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const response = await fetch(imageBase64);
const blob = await response.blob();
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
});
console.log(imageBase64)
const response = await fetch(imageBase64);
const blob = await response.blob();
const formData = new FormData();
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="middle-content" >
<div *ngIf="intervenientes.length > 0">
<h5 >Intervenientes</h5>
<h5 >Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label *ngIf="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="middle-content">
<h5 *ngIf="intervenientes">Intervenientes</h5>
<h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let task of intervenientes">
@@ -37,7 +37,7 @@
</div>
<div class="line"></div>
<div class="middle-content">
<h5 *ngIf="intervenientes">Intervenientes</h5>
<h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let interveniente of intervenientes">
@@ -74,7 +74,7 @@
</div>
<div *ngIf="loadedEvent.workflowInstanceDataFields.Participants" class="middle-content">
<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">
<ion-label>{{att.Name}}</ion-label>
</div>
@@ -73,7 +73,7 @@
<div class="overflow-y-auto">
<div class="middle-content">
<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">
<ion-label>{{att.Name}}</ion-label>
</div>
@@ -213,7 +213,7 @@
<div class="list-people">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -140,7 +140,7 @@
<div class="list-people">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -44,7 +44,7 @@
<div class="overflow-y-auto">
<div class="middle-content">
<!-- <h5 *ngIf="intervenientes">Intervenientes</h5>
<!-- <h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<div *ngFor="let interveniente of intervenientes">
@@ -37,7 +37,7 @@
<div class="overflow-y-auto">
<div class="middle-content">
<h5 *ngIf="intervenientes">Intervenientes</h5>
<h5 *ngIf="intervenientes">Participantes</h5>
<ion-item class="ion-no-margin ion-no-padding">
<ion-label>
<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 { Storage } from '@ionic/storage';
import { CPSession } from 'src/app/store/documentManagement';
import { StorageService } from 'src/app/services/storage.service';
@Component({
selector: 'app-login',
templateUrl: './login.page.html',
@@ -55,6 +57,7 @@ export class LoginPage implements OnInit {
private platform: Platform,
private FirstEnterService: FirstEnterService,
private storage:Storage,
private storageService: StorageService,
) {}
ngOnInit() {}
@@ -140,7 +143,8 @@ export class LoginPage implements OnInit {
}
this.changeProfileService.runLogin();
/* this.getToken(); */
this.getToken();
SessionStore.setInativity(true);
this.goback();
@@ -169,7 +173,7 @@ export class LoginPage implements OnInit {
this.ChatService.setheader();
this.ChatSystemService.loadChat();
}
this.storageService.remove("Notifications")
this.getToken();
if(!this.platform.is('desktop') && !this.platform.is('mobileweb')) {
@@ -125,24 +125,48 @@ export class NewPublicationPage implements OnInit {
// in use
async takePicture() {
const capturedImage = await Camera.getPhoto({
quality: 50,
// allowEditing: true,
resultType: CameraResultType.Uri,
resultType: CameraResultType.Base64,
source: CameraSource.Camera
});
const response = await fetch(capturedImage.webPath!);
const blob = await response.blob();
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('taked: ', picture)
this.capturedImage = picture
});
}
this.convertBlobToBase64Worker.postMessage(blob);
this.convertBlobToBase64Worker.onmessage = async (oEvent)=> {
this.capturedImage = oEvent.data
this.capturedImageTitle = 'foto'
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) {
var canvas = document.createElement('canvas');
@@ -165,7 +189,7 @@ export class NewPublicationPage implements OnInit {
});
// in use
/* // in use
async laodPicture() {
const capturedImage = await Camera.getPhoto({
@@ -185,7 +209,7 @@ export class NewPublicationPage implements OnInit {
}
}
} */
@@ -374,4 +398,41 @@ export class NewPublicationPage implements OnInit {
deletePublicationImage() {
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="middle-content">
<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">
<ion-label>{{att.Name}}</ion-label>
</div>
@@ -282,7 +282,7 @@
<div class="list-people flex-grow-1">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -219,7 +219,7 @@
<div class="list-people">
<ion-item lines="none">
<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>
</ion-list>
</ion-item>
@@ -246,7 +246,7 @@
<div class="list-people">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -95,7 +95,7 @@
<div class="line"></div>
<div class="middle-content">
<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-label>
<div *ngFor="let attendee of loadedEvent.Attendees">
@@ -714,11 +714,22 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
resultType: CameraResultType.Base64,
source: CameraSource.Camera
});
//const imageData = await this.fileToBase64Service.convert(file)
//
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
});
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const blob = this.dataURItoBlob(imageBase64)
console.log(imageBase64)
const response = await fetch(base64);
const blob = await response.blob();
const formData = new FormData();
formData.append("blobFile", blob);
@@ -736,7 +747,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
"title_link_download": false,
}],
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) {
// convert base64 to raw binary data held in a string
// 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
});
const imageBase64 = 'data:image/jpeg;base64,' + file.base64String
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 blob = this.dataURItoBlob(base64)
const formData = new FormData();
formData.append("blobFile", blob);
@@ -667,7 +676,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
"title_link_download": false,
}],
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 imageBase64 = 'data:image/jpeg;base64,' + file.base64String
const response = await fetch(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
});
const response = await fetch(base64);
const blob = await response.blob();
console.log(imageBase64)
console.log(base64)
const formData = new FormData();
formData.append("blobFile", blob);
@@ -798,7 +817,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
"title_link_download": false,
}],
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">
<ion-item lines="none">
<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-list>
</ion-item>
@@ -1,7 +1,7 @@
<ion-content>
<div *ngIf="task" class="overflow-y-auto height-100">
<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-label>
<div *ngFor="let interveniente of intervenientes">
@@ -33,7 +33,7 @@
<ion-content>
<div *ngIf="task" class="overflow-y-auto height-100 px-20">
<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-label>
<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 == '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"
src='assets/images/presidente.png'>
<img *ngIf="loggeduser.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="icon font-45-em"
src='assets/images/ministro.png'>
<img *ngIf="loggeduser.RoleDescription == 'Secretário Geral' " class="icon font-45-em"
src='assets/images/secretaria_geral.png'>
<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'>
<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 *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 == '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"
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'>
<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>
<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 *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
permissionList = new PermissionList();
notificationCount: number = 0;
profilePicture = "";
constructor(
@@ -52,7 +53,8 @@ export class HeaderPage implements OnInit {
private eventTriger: EventTrigger,
public ActiveTabService: ActiveTabService,
private notificationService: NotificationsService,
private cdRef: ChangeDetectorRef
private cdRef: ChangeDetectorRef,
private storageService: StorageService,
) {
this.loggeduser = SessionStore.user;
router.events.subscribe((val) => {
@@ -76,9 +78,19 @@ export class HeaderPage implements OnInit {
async ngOnInit() {
this.hideSearch();
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() {
this.eventTriger.getObservable().subscribe((event) => {
if (event.notification == "recive") {
@@ -114,7 +114,16 @@ export class NewPublicationPage implements OnInit {
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('taked: ', picture)
this.capturedImage = picture
});
}
async laodPicture() {
@@ -126,6 +135,17 @@ export class NewPublicationPage implements OnInit {
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
});
}
@@ -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 = {
"shortSHA": "088ee19e5",
"SHA": "088ee19e5ccf5ce4557d0c5e54a5bd8688239f6b",
"shortSHA": "53e674032",
"SHA": "53e67403238dbaaf46480561ce789b3f4cd17d82",
"branch": "developer-prod",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Mon Aug 28 17:39:48 2023 +0100'",
"lastCommitMessage": "add color black",
"lastCommitNumber": "5225",
"lastCommitTime": "'Tue Aug 29 16:42:46 2023 +0100'",
"lastCommitMessage": "agenda change timeline",
"lastCommitNumber": "5226",
"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"
}