2021-01-29 11:28:26 +01:00
|
|
|
import { Component, OnInit } from '@angular/core';
|
2021-02-18 12:44:35 +01:00
|
|
|
import { AnimationController, ModalController } from '@ionic/angular';
|
2021-01-29 11:28:26 +01:00
|
|
|
import { SearchPage } from 'src/app/pages/search/search.page';
|
2021-02-12 16:56:26 +01:00
|
|
|
import { MenuController } from '@ionic/angular';
|
2021-05-27 16:20:40 +01:00
|
|
|
import { ProfileComponent } from './profile/profile.page';
|
2021-03-01 15:45:30 +01:00
|
|
|
import { Router } from '@angular/router';
|
2021-05-12 11:34:28 +01:00
|
|
|
import { AuthService } from 'src/app/services/auth.service';
|
|
|
|
|
import { User } from 'src/app/models/user.model';
|
2021-07-28 16:27:10 +01:00
|
|
|
import { ProfilePage } from 'src/app/modals/profile/profile.page';
|
2021-01-29 11:28:26 +01:00
|
|
|
@Component({
|
|
|
|
|
selector: 'app-header-no-search',
|
|
|
|
|
templateUrl: './header-no-search.page.html',
|
|
|
|
|
styleUrls: ['./header-no-search.page.scss'],
|
|
|
|
|
})
|
|
|
|
|
export class HeaderNoSearchPage implements OnInit {
|
|
|
|
|
|
2021-05-12 11:34:28 +01:00
|
|
|
loggeduser: User;
|
2021-07-28 16:27:10 +01:00
|
|
|
|
2021-02-12 16:56:26 +01:00
|
|
|
constructor(private modalController: ModalController,
|
2021-02-18 12:44:35 +01:00
|
|
|
private menu: MenuController,
|
2021-03-01 15:45:30 +01:00
|
|
|
private animationController: AnimationController,
|
2021-05-12 11:34:28 +01:00
|
|
|
private router: Router,
|
2021-07-28 16:27:10 +01:00
|
|
|
authService: AuthService) {
|
2021-05-12 11:34:28 +01:00
|
|
|
|
|
|
|
|
this.loggeduser = authService.ValidatedUser;
|
|
|
|
|
}
|
2021-01-29 11:28:26 +01:00
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-02 18:53:37 +01:00
|
|
|
async openProfile() {
|
2021-02-18 12:44:35 +01:00
|
|
|
|
|
|
|
|
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');
|
|
|
|
|
}
|
2021-07-28 16:27:10 +01:00
|
|
|
|
2021-02-18 12:44:35 +01:00
|
|
|
|
2021-01-29 11:28:26 +01:00
|
|
|
const modal = await this.modalController.create({
|
2021-02-18 12:44:35 +01:00
|
|
|
enterAnimation,
|
|
|
|
|
leaveAnimation,
|
2021-07-28 16:27:10 +01:00
|
|
|
component: ProfilePage,
|
2021-02-18 12:44:35 +01:00
|
|
|
cssClass: 'model profile-modal',
|
2021-01-29 11:28:26 +01:00
|
|
|
componentProps: {
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return await modal.present();
|
|
|
|
|
}
|
2021-03-01 15:45:30 +01:00
|
|
|
|
|
|
|
|
changeRoute(path){
|
|
|
|
|
this.router.navigateByUrl(path)
|
|
|
|
|
}
|
2021-03-02 14:46:38 +01:00
|
|
|
|
|
|
|
|
locationPathname(): string {
|
|
|
|
|
return window.location.pathname
|
|
|
|
|
}
|
2021-08-06 12:19:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
profileLabel(text) {
|
|
|
|
|
if (text == 'MDGPR') {
|
|
|
|
|
return 'MD'
|
|
|
|
|
} else if (text=='PR') {
|
|
|
|
|
return text
|
|
|
|
|
} else {
|
|
|
|
|
return 'UN'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-29 11:28:26 +01:00
|
|
|
}
|