This commit is contained in:
Peter Maquiran
2023-08-29 16:45:29 +01:00
39 changed files with 606 additions and 105 deletions
@@ -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);
};
});
}
}