From f921d1d22292c7351a97d913190b13a9b8cadad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20B=C3=B6ckelmann?= Date: Sun, 17 Mar 2024 11:50:47 +0100 Subject: [PATCH] Visualize Upcoming Deadlines --- frontend/src/app/app-routing.module.ts | 2 + frontend/src/app/app.component.html | 3 + frontend/src/app/app.module.ts | 4 ++ .../upcoming-deadlines-overview.component.css | 54 +++++++++++++++++ ...upcoming-deadlines-overview.component.html | 21 +++++++ ...oming-deadlines-overview.component.spec.ts | 21 +++++++ .../upcoming-deadlines-overview.component.ts | 60 +++++++++++++++++++ 7 files changed, 165 insertions(+) create mode 100644 frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.css create mode 100644 frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.html create mode 100644 frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.spec.ts create mode 100644 frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.ts diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 1d22ed5..8c64c79 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -17,6 +17,7 @@ import { } from "./dashboard/forgotten-task-start-dialog/forgotten-task-start-dialog.component"; import {TaskgroupActivityComponent} from "./statistics/taskgroup-activity/taskgroup-activity.component"; import {ScheduleHistoryComponent} from "./statistics/schedule-history/schedule-history.component"; +import {UpcomingDeadlinesOverviewComponent} from "./upcoming-deadlines-overview/upcoming-deadlines-overview.component"; const routes: Routes = [ {path: '', component: MainComponent}, @@ -35,6 +36,7 @@ const routes: Routes = [ {path: 'forgotten', component: ForgottenTaskStartDialogComponent}, {path: 'statistics/taskgroup-activity', component: TaskgroupActivityComponent}, {path: 'statistics/schedule-history', component: ScheduleHistoryComponent}, + {path: 'deadlines', component: UpcomingDeadlinesOverviewComponent} ]; @NgModule({ diff --git a/frontend/src/app/app.component.html b/frontend/src/app/app.component.html index 9e0ad25..9116ab0 100644 --- a/frontend/src/app/app.component.html +++ b/frontend/src/app/app.component.html @@ -6,10 +6,13 @@ + + + diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 71ac5f2..1530f36 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -94,6 +94,8 @@ import { NtfySettingsComponent } from './user-settings/connection-settings/ntfy- import { TaskSeriesCreatorComponent } from './tasks/task-series-creator/task-series-creator.component'; import {MatStepperModule} from "@angular/material/stepper"; import { TaskWeeklySeriesCreatorComponent } from './tasks/task-weekly-series-creator/task-weekly-series-creator.component'; +import { UpcomingDeadlinesOverviewComponent } from './upcoming-deadlines-overview/upcoming-deadlines-overview.component'; +import {CommonModule} from "@angular/common"; @NgModule({ declarations: [ AppComponent, @@ -143,6 +145,7 @@ import { TaskWeeklySeriesCreatorComponent } from './tasks/task-weekly-series-cre NtfySettingsComponent, TaskSeriesCreatorComponent, TaskWeeklySeriesCreatorComponent, + UpcomingDeadlinesOverviewComponent, ], imports: [ BrowserModule, @@ -187,6 +190,7 @@ import { TaskWeeklySeriesCreatorComponent } from './tasks/task-weekly-series-cre MatButtonToggleModule, MatGridListModule, MatStepperModule, + CommonModule ], providers: [ HttpClientModule, diff --git a/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.css b/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.css new file mode 100644 index 0000000..4321d61 --- /dev/null +++ b/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.css @@ -0,0 +1,54 @@ +.container { + margin: 20px auto; + width: 70%; +} + +.spacer { + margin-bottom: 2.5%; +} + + +@media screen and (max-width: 600px) { + .container { + width: 100%; + margin: 20px 10px; + } +} + + +.undecorated-link { + text-decoration: none; + color: black; +} + +.undecorated-link:hover { + color: #3498db; +} + +.cal-event-title { + color: black; + margin-left: 5px; + + white-space: nowrap; + display: inline-block; +} + +.cal-event-circle { + width: 10px; /* Beispielgröße für den Kreis */ + height: 10px; /* Beispielgröße für den Kreis */ + border-radius: 50%; + display: inline-block; + background-color: #1e90ff; + vertical-align: top; /* Vertikale Ausrichtung zentrieren */ +} + +.event { + display: block; + align-items: center; + margin-bottom: 10px; +} + + +.cal-cell-content { + width: calc(100% - 20px); /* Breite der Zelle abzüglich des linken Randes für den Titel */ +} diff --git a/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.html b/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.html new file mode 100644 index 0000000..29540b4 --- /dev/null +++ b/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.html @@ -0,0 +1,21 @@ +
+ + + +
+ {{ day.badgeTotal }} + {{ day.date | calendarDate:'monthViewDayNumber':locale }} +
+
+
+
+
+
{{ event.title }}
+
+
+
+
+ + +
diff --git a/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.spec.ts b/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.spec.ts new file mode 100644 index 0000000..82860b9 --- /dev/null +++ b/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UpcomingDeadlinesOverviewComponent } from './upcoming-deadlines-overview.component'; + +describe('UpcomingDeadlinesOverviewComponent', () => { + let component: UpcomingDeadlinesOverviewComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [UpcomingDeadlinesOverviewComponent] + }); + fixture = TestBed.createComponent(UpcomingDeadlinesOverviewComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.ts b/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.ts new file mode 100644 index 0000000..62e4eee --- /dev/null +++ b/frontend/src/app/upcoming-deadlines-overview/upcoming-deadlines-overview.component.ts @@ -0,0 +1,60 @@ +import {ChangeDetectionStrategy, Component, OnInit} from '@angular/core'; +import {NavigationLink} from "../navigation-link-list/navigation-link-list.component"; +import {TaskService, TaskTaskgroupInfo} from "../../api"; +import {CalendarEvent} from "angular-calendar"; +import * as moment from "moment"; +import {locale} from "moment"; +import {Subject} from "rxjs"; + +@Component({ + selector: 'app-upcoming-deadlines-overview', + templateUrl: './upcoming-deadlines-overview.component.html', + styleUrls: ['./upcoming-deadlines-overview.component.css'], + changeDetection: ChangeDetectionStrategy.OnPush, +}) +export class UpcomingDeadlinesOverviewComponent implements OnInit{ + defaultNavigationLinkPath: NavigationLink[] = [ + { + linkText: "Dashboard", + routerLink: ['/'] + }, + { + linkText: "Upcoming Deadlines", + routerLink: ["/deadlines"] + } + ] + + events: CalendarEvent[] = [] + viewDate = new Date() + refresh: Subject = new Subject() + + constructor(private taskService: TaskService) { + } + + + ngOnInit() { + this.taskService.tasksAllScopeDetailedGet("UNFINISHED", true).subscribe({ + next: resp => { + resp.forEach(taskShortInfo => { + const task_taskgroupInfo = taskShortInfo as TaskTaskgroupInfo + this.events.push({ + title: task_taskgroupInfo.taskName, + start: moment(task_taskgroupInfo.deadline).toDate(), + end: moment(task_taskgroupInfo.deadline).toDate(), + resizable: { + beforeStart: false, + afterEnd: false + }, + draggable: false, + allDay: true, + color: { + primary: '#1e90ff', + secondary: '#D1E8FF', + } + }) + }) + this.refresh.next() + } + }) + } +}