Files
doneit-web/src/app/shared/headers/header-no-search/profile/profile.page.ts
T

70 lines
1.8 KiB
TypeScript
Raw Normal View History

2021-02-18 12:44:35 +01:00
import { Component, OnInit } from '@angular/core';
2021-05-27 16:49:09 +01:00
import { AnimationController, ModalController } from '@ionic/angular';
2021-05-21 15:34:45 +01:00
import { User } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
2021-05-27 16:49:09 +01:00
import { PinPage } from 'src/app/shared/pin/pin.page';
2021-02-18 12:44:35 +01:00
@Component({
selector: 'app-profile',
2021-05-27 16:20:40 +01:00
templateUrl: './profile.page.html',
styleUrls: ['./profile.page.scss'],
2021-02-18 12:44:35 +01:00
})
export class ProfileComponent implements OnInit {
2021-05-21 15:34:45 +01:00
loggeduser: User;
constructor(private modalController:ModalController,
2021-05-27 16:49:09 +01:00
private authService: AuthService,
private animationController: AnimationController) {
2021-05-21 15:34:45 +01:00
this.loggeduser = authService.ValidatedUser;
console.log(this.loggeduser.RoleDescription)
}
2021-02-18 12:44:35 +01:00
ngOnInit() {}
2021-05-27 16:49:09 +01:00
close() {
2021-02-18 12:44:35 +01:00
this.modalController.dismiss();
}
2021-05-27 16:49:09 +01:00
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: {
}
});
2021-05-27 22:09:41 +01:00
modal.present();
2021-05-27 16:20:40 +01:00
}
2021-02-18 12:44:35 +01:00
}