profile picture done

This commit is contained in:
Eudes Inácio
2023-08-29 16:05:32 +01:00
64 changed files with 519 additions and 289 deletions
@@ -60,15 +60,24 @@
<div>
<div class="d-flex align-center flex-column" (click)="takePicture()">
<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>
<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>
<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">
@@ -9,6 +9,7 @@ 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({
@@ -23,6 +24,7 @@ export class EditProfilePage implements OnInit {
environment = environment
capturedImage = '';
capturedImageTitle = '';
profilePicture = "";
constructor(private modalController: ModalController,
private animationController: AnimationController,
@@ -30,9 +32,21 @@ export class EditProfilePage implements OnInit {
private BackgroundService: BackgroundService,
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();
@@ -132,6 +146,8 @@ export class EditProfilePage implements OnInit {
async takePicture() {
const capturedImage = await Camera.getPhoto({
width: 188,
height: 188,
quality: 50,
// allowEditing: true,
resultType: CameraResultType.Base64,
@@ -139,12 +155,19 @@ export class EditProfilePage implements OnInit {
});
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');
/* this.saveFile(this.capturedImage,this.capturedImageTitle,'application/img'); */
}
async saveFile(pdfString, filename, type) {
/* async saveFile(pdfString, filename, type) {
const blob = this.b64toBlob(pdfString, type)
console.log(blob)
let pathFile = ''
@@ -165,11 +188,8 @@ export class EditProfilePage implements OnInit {
}).then((dir) => {
console.log('DIR ', dir)
});
}
} */
getImagem() {
}
b64toBlob(b64Data, contentType) {
contentType = contentType || '';
+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
})