mirror of
https://github.com/opelly27/WinStudentGoalTracker.git
synced 2026-05-20 01:47:41 +00:00
56 lines
2.2 KiB
TypeScript
56 lines
2.2 KiB
TypeScript
import { Component, inject, input } from '@angular/core';
|
|
import { DatePipe } from '@angular/common';
|
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
import { StudentGoalItem } from '../../../shared/classes/student-goal';
|
|
|
|
@Component({
|
|
selector: 'app-goal-card',
|
|
imports: [DatePipe],
|
|
templateUrl: './goal-card.html',
|
|
styleUrl: './goal-card.scss',
|
|
})
|
|
export class GoalCard {
|
|
|
|
// ************************** Constructor **************************
|
|
|
|
// ************************** Declarations *************************
|
|
|
|
private readonly router = inject(Router);
|
|
private readonly route = inject(ActivatedRoute);
|
|
|
|
readonly goal = input.required<StudentGoalItem>();
|
|
readonly goalNumber = input<number>(0);
|
|
|
|
// ************************** Properties ***************************
|
|
|
|
// ************************ Public Methods *************************
|
|
|
|
// ************************ Event Handlers *************************
|
|
|
|
// *****************************************************************
|
|
// Navigates to the goal detail page.
|
|
// *****************************************************************
|
|
onCardClick() {
|
|
const studentId = this.route.snapshot.paramMap.get('studentId')!;
|
|
this.router.navigate(['/students', studentId, 'goals', this.goal().goalId]);
|
|
}
|
|
|
|
// *****************************************************************
|
|
// Navigates to the benchmarks page for this goal.
|
|
// *****************************************************************
|
|
onBenchmarksClick() {
|
|
const studentId = this.route.snapshot.paramMap.get('studentId')!;
|
|
this.router.navigate(['/students', studentId, 'goals', this.goal().goalId, 'benchmarks']);
|
|
}
|
|
|
|
// *****************************************************************
|
|
// Navigates to the progress events page for this goal.
|
|
// *****************************************************************
|
|
onProgressEventsClick() {
|
|
const studentId = this.route.snapshot.paramMap.get('studentId')!;
|
|
this.router.navigate(['/students', studentId, 'goals', this.goal().goalId, 'progress']);
|
|
}
|
|
|
|
// ********************** Support Procedures ***********************
|
|
}
|