Skip to content

Commit 1eb272f

Browse files
committed
feat(calendar): make due-date scope role-aware for user, project manager, and admin views
1 parent 1ea3f2f commit 1eb272f

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

src/app/features/calendar/components/task-calendar/task-calendar.component.html

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
<p-card styleClass="calendar-hero">
33
<div class="calendar-hero__content">
44
<div class="calendar-hero__title">
5-
<h2>My Due Date Calendar</h2>
6-
<p>
7-
Track your assigned tasks by due date, grouped by project color. Select a day to inspect tasks
8-
and jump directly into project context.
9-
</p>
5+
<h2>{{ calendarTitle }}</h2>
6+
<p>{{ calendarSubtitle }}</p>
107
<div class="calendar-hero__meta" *ngIf="isPreviewMode">
118
<span class="meta-pill">
129
<i class="pi pi-eye"></i>

src/app/features/calendar/components/task-calendar/task-calendar.component.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Router } from '@angular/router';
55
import { Subject, takeUntil } from 'rxjs';
66
import { TaskItemsApiClient } from '../../../../core/api/clients/task-items-api.client';
77
import { TaskItemDto } from '../../../../core/api/models/task-item.model';
8+
import { AppRole } from '../../../../core/auth/models/app-role.model';
89
import { AuthService } from '../../../../core/auth/services/auth.service';
910
import { SharedModule } from '../../../../shared/shared.module';
1011

@@ -80,6 +81,30 @@ export class TaskCalendarComponent implements OnInit, OnDestroy {
8081
return this.authService.isAuthenticated();
8182
}
8283

84+
get calendarTitle(): string {
85+
if (this.authService.hasRole(AppRole.ProjectManager)) {
86+
return 'Project Due Date Calendar';
87+
}
88+
89+
if (this.authService.hasRole(AppRole.Administrator)) {
90+
return 'Workspace Due Date Calendar';
91+
}
92+
93+
return 'My Due Date Calendar';
94+
}
95+
96+
get calendarSubtitle(): string {
97+
if (this.authService.hasRole(AppRole.ProjectManager)) {
98+
return 'Track due dates across tasks in your managed projects. Select a day to inspect workload and jump into project context.';
99+
}
100+
101+
if (this.authService.hasRole(AppRole.Administrator)) {
102+
return 'Track due dates across workspace tasks. Select a day to inspect workload and jump into project context.';
103+
}
104+
105+
return 'Track your assigned tasks by due date, grouped by project color. Select a day to inspect tasks and jump directly into project context.';
106+
}
107+
83108
openTaskContext(task: TaskItemDto): void {
84109
void this.router.navigate(['/projects/kanban'], {
85110
queryParams: { projectId: task.projectId }
@@ -104,8 +129,12 @@ export class TaskCalendarComponent implements OnInit, OnDestroy {
104129
return;
105130
}
106131

132+
const query = this.authService.hasRole(AppRole.User)
133+
? { assignedUserId: currentUserId, page: 1, pageSize: 500 }
134+
: { page: 1, pageSize: 500 };
135+
107136
this.taskItemsApiClient
108-
.getTasks({ assignedUserId: currentUserId, page: 1, pageSize: 500 })
137+
.getTasks(query)
109138
.pipe(takeUntil(this.destroy$))
110139
.subscribe({
111140
next: (tasks) => {

0 commit comments

Comments
 (0)