This commit is contained in:
tiago.kayaya
2021-07-28 09:34:11 +01:00
parent e76c41a6bb
commit ba82497d8e
3 changed files with 290 additions and 8 deletions
+79 -6
View File
@@ -1,9 +1,82 @@
<ion-header>
<ion-toolbar>
<ion-title>profile</ion-title>
</ion-toolbar>
</ion-header>
<ion-content class=" bg-blue">
<ion-content>
<div class="profile-content">
<div class="d-flex justify-space-between align-center">
<div class="go-back d-flex align-center" (click)="close()">
<ion-icon class="icon" src="assets/images/icons-calendar-arrow-left.svg"></ion-icon> <div>Perfil</div>
</div>
<!-- <div class="d-flex " (click)="close()">
<ion-icon class="icon" src="assets/images/icons-search-close.svg"></ion-icon>
</div> -->
</div>
<div >
<div class="d-flex align-center">
<ion-icon class="profile-pic" name="add-circle-outline"></ion-icon>
</div>
</div>
<div class="profile-info">
<div class="label-text">Dados Perfil</div>
<div class="user-role">{{loggeduser.RoleDescription}}</div>
<div class="email">{{loggeduser.Email}}</div>
</div>
<div class="login-preference" (mouseover)="checkState()" (click)="checkState()">
<div class="preference">Preferência Login</div>
<ion-row>
<ion-col class="align-center d-flex">
<div class="d-flex align-center" (click)="LoginPreferenceMethod('pin')">
<ion-checkbox [checked]="userLoginPreference=='pin' " class="checkBox" ></ion-checkbox>
PIN
</div>
</ion-col>
<ion-col class="align-center d-flex">
<div (click)="addFingerprint()" class="d-flex align-center">
<ion-checkbox class="checkBox" [checked]="false"></ion-checkbox>
Impressão Digital
</div>
</ion-col>
</ion-row>
</div>
<div class="d-flex justify-center mt-10">
<ion-buttons slot="start" class="buttonSize" (click)="logout()" >
<ion-button class="btn-cancel buttonSize" fill="clear" style="background:#ffe0e0;" >
<ion-label style="color:#d30a0a;">Terminar sessão</ion-label>
</ion-button>
</ion-buttons>
</div>
<div class="d-flex justify-center mt-10">
<ion-button (click)="addPin()" class="btn-ok buttonSize" fill="clear" color="#fff" >
<ion-label>Alterar PIN</ion-label>
</ion-button>
</div>
</div>
</ion-content>
<!-- <ion-footer class=" footer-container ion-no-border bg-blue">
<div class="d-flex justify-space-between">
<ion-buttons slot="start" (click)="close()">
<ion-button class="btn-cancel" fill="clear" color="#061b52" >
<ion-label>Cancelar</ion-label>
</ion-button>
</ion-buttons>
<ion-buttons slot="end" (click)="close()">
<ion-button class="btn-ok" fill="clear" color="#fff" >
<ion-label>Gravar</ion-label>
</ion-button>
</ion-buttons>
</div>
</ion-footer> -->
+64
View File
@@ -0,0 +1,64 @@
.profile-content{
padding: 20px 20px;
}
.icon{
font-size: 35px;
}
.go-back{
font-family: Roboto;
font-size: 25px;
.icon{
margin-right: 7px;
}
}
.profile-pic{
width: 200px;
height: 200px;
border-radius: 20px;
margin: 0px auto;
}
.profile-info{
.label-text{
font-size: 15px;
font-weight: bold;
color: white;
margin-bottom: 10px;
}
.user-role{
background-color: white;
border-radius: 5px;
padding: 12px;
font-family: Roboto;
font-size: 13px;
color: black;
text-align: center;
}
.email {
margin-top: 15px;
}
}
.login-preference{
margin-top: 44px;
.preference{
font-family: Roboto;
font-size: 15px;
margin-bottom: 20px;
font-weight: bold;
}
.checkBox{
margin-right: 10px;
}
}
.buttonSize {
width: 100% !important;
}
+147 -2
View File
@@ -1,4 +1,11 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { AnimationController, ModalController } from '@ionic/angular';
import { User } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { FingerprintPage } from 'src/app/shared/fingerprint/fingerprint.page';
import { PinPage } from 'src/app/shared/pin/pin.page';
import { LocalstoreService } from 'src/app/store/localstore.service';
@Component({
selector: 'app-profile',
@@ -7,9 +14,147 @@ import { Component, OnInit } from '@angular/core';
})
export class ProfilePage implements OnInit {
constructor() { }
loggeduser: User;
userLoginPreference = ''
constructor(private modalController:ModalController,
private authService: AuthService,
private animationController: AnimationController,
private router: Router,
private localstoreService: LocalstoreService
) {
this.loggeduser = authService.ValidatedUser;
console.log(this.loggeduser.RoleDescription)
this.checkState()
}
ngOnInit() {}
close() {
this.modalController.dismiss();
}
async addPin() {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!)
.keyframes([
{ offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: PinPage,
cssClass: 'model profile-modal',
componentProps: {
}
});
modal.present();
}
async addFingerprint() {
const enterAnimation = (baseEl: any) => {
const backdropAnimation = this.animationController.create()
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)');
const wrapperAnimation = this.animationController.create()
.addElement(baseEl.querySelector('.modal-wrapper')!)
.keyframes([
{ offset: 0, opacity: '1', right: '-100%' },
{ offset: 1, opacity: '1', right: '0px' }
]);
return this.animationController.create()
.addElement(baseEl)
.easing('ease-out')
.duration(500)
.addAnimation([backdropAnimation, wrapperAnimation]);
}
const leaveAnimation = (baseEl: any) => {
return enterAnimation(baseEl).direction('reverse');
}
const modal = await this.modalController.create({
enterAnimation,
leaveAnimation,
component: FingerprintPage,
cssClass: 'model profile-modal',
componentProps: {
}
});
modal.present();
}
logout() {
// clear local storage
window.localStorage.clear();
setTimeout(()=>{
window.location.pathname = '/'
location.reload();
}, 1000)
}
LoginPreferenceMethod(type: string) {
let userData = this.localstoreService.get('UserData', {})
if (userData.hasOwnProperty('loginPreference')) {
if (userData.loginPreference != type) {
if (type) {
userData.loginPreference = type
}
} else {
userData.loginPreference = 'none'
}
} else {
userData.loginPreference = 'none'
}
this.localstoreService.set('UserData', userData)
}
checkState() {
let userData = this.localstoreService.get('UserData', {})
if (userData.hasOwnProperty('loginPreference')) {
this.userLoginPreference = userData.loginPreference
} else {
this.userLoginPreference = ''
}
ngOnInit() {
}
}