Add pin page

This commit is contained in:
Peter Maquiran
2021-05-27 16:49:09 +01:00
parent f227239023
commit 0405cc603c
4 changed files with 129 additions and 49 deletions
@@ -1,7 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { ModalController } from '@ionic/angular';
import { AnimationController, ModalController } from '@ionic/angular';
import { User } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { PinPage } from 'src/app/shared/pin/pin.page';
@Component({
selector: 'app-profile',
@@ -13,7 +14,9 @@ export class ProfileComponent implements OnInit {
loggeduser: User;
constructor(private modalController:ModalController,
private authService: AuthService) {
private authService: AuthService,
private animationController: AnimationController) {
this.loggeduser = authService.ValidatedUser;
console.log(this.loggeduser.RoleDescription)
@@ -21,12 +24,44 @@ export class ProfileComponent implements OnInit {
ngOnInit() {}
close(){
close() {
this.modalController.dismiss();
}
addPrin(){
alert('Pin')
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: {
}
});
return await modal.present();
}