argos/dmp-frontend/src/app/ui/dashboard/card/card.component.ts

42 lines
1.0 KiB
TypeScript
Raw Normal View History

2019-01-18 18:03:45 +01:00
import { Component, Input, OnInit } from '@angular/core';
2017-12-20 15:11:41 +01:00
import { Router } from '@angular/router';
2019-01-18 18:03:45 +01:00
import { AuthService } from '../../../core/services/auth/auth.service';
2017-12-14 17:43:57 +01:00
@Component({
2019-01-18 18:03:45 +01:00
selector: 'app-dashboard-card',
templateUrl: './card.component.html',
styleUrls: ['./card.component.scss']
2017-12-14 17:43:57 +01:00
})
2019-01-18 18:03:45 +01:00
export class CardComponent implements OnInit {
@Input() headerIcon: string;
@Input() category: string;
@Input() title: string;
@Input() footerIcon: string;
@Input() footContent: string;
@Input() linearColor: string;
@Input() boxShadow: string;
@Input() routelLink: string;
2018-11-29 13:26:18 +01:00
@Input() hasFootContent = false;
2018-08-24 17:21:02 +02:00
@Input() buttonTitle: string;
@Input() buttonRedirectLink: string;
2017-12-20 15:11:41 +01:00
constructor(private router: Router, private authService: AuthService) { }
2017-12-14 17:43:57 +01:00
ngOnInit() {
}
2017-12-14 17:43:57 +01:00
navigateToUrl() {
if (!this.isAuthenticated()) { return; }
this.router.navigate([this.routelLink]);
}
2017-12-20 15:11:41 +01:00
createNew() {
this.router.navigate([this.buttonRedirectLink]);
}
2017-12-20 15:11:41 +01:00
isAuthenticated() {
return this.authService.current() != null;
}
2018-08-27 17:09:33 +02:00
2017-12-14 17:43:57 +01:00
}