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 {
|
2018-07-23 17:56:09 +02:00
|
|
|
@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
|
|
|
|
2018-10-05 08:56:50 +02:00
|
|
|
constructor(private router: Router, private authService: AuthService) { }
|
2017-12-14 17:43:57 +01:00
|
|
|
|
2018-07-23 17:56:09 +02:00
|
|
|
ngOnInit() {
|
|
|
|
}
|
2017-12-14 17:43:57 +01:00
|
|
|
|
2018-07-23 17:56:09 +02:00
|
|
|
navigateToUrl() {
|
2018-10-05 08:56:50 +02:00
|
|
|
if (!this.isAuthenticated()) { return; }
|
2018-07-23 17:56:09 +02:00
|
|
|
this.router.navigate([this.routelLink]);
|
2018-10-05 08:56:50 +02:00
|
|
|
}
|
2017-12-20 15:11:41 +01:00
|
|
|
|
2018-10-05 08:56:50 +02:00
|
|
|
createNew() {
|
|
|
|
this.router.navigate([this.buttonRedirectLink]);
|
|
|
|
}
|
2017-12-20 15:11:41 +01:00
|
|
|
|
2018-10-05 08:56:50 +02:00
|
|
|
isAuthenticated() {
|
|
|
|
return this.authService.current() != null;
|
|
|
|
}
|
2018-08-27 17:09:33 +02:00
|
|
|
|
2017-12-14 17:43:57 +01:00
|
|
|
}
|