issue-52 #64

Merged
sebastian merged 17 commits from issue-52 into docker-deployment 2023-11-13 22:48:50 +01:00
6 changed files with 74 additions and 15 deletions
Showing only changes of commit cf427cdd46 - Show all commits

View File

@ -6,8 +6,11 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Fix parsing datetime (diesmal hoffentlich wirklich)"> <list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Fix parsing datetime (diesmal hoffentlich wirklich)">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskOverviewInfo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/models/timemanager/tasks/TaskOverviewInfo.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/services/TaskScheduleService.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../openapi.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/../openapi.yaml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/draggable-scheduler/draggable-scheduler.component.css" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/draggable-scheduler/draggable-scheduler.component.css" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/draggable-scheduler/draggable-scheduler.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/draggable-scheduler/draggable-scheduler.component.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/draggable-scheduler/draggable-scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/draggable-scheduler/draggable-scheduler.component.ts" afterDir="false" />
<change beforePath="$PROJECT_DIR$/../frontend/src/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/index.html" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@ -96,6 +96,9 @@ public class TaskScheduleService {
} }
public void deleteSchedule(AbstractSchedule schedule) { public void deleteSchedule(AbstractSchedule schedule) {
schedule.getTask().getBasicTaskSchedules().remove(schedule);
schedule.setTask(null);
scheduleRepository.save(schedule);
scheduleRepository.delete(schedule); scheduleRepository.delete(schedule);
} }

View File

@ -56,5 +56,5 @@ app-task-overview {
} }
::ng-deep .cal-event-title { ::ng-deep .cal-event-title {
white-space: normal;
} }

View File

@ -17,7 +17,7 @@
<div style="width: 75%"> <div style="width: 75%">
<mwl-calendar-week-view [viewDate]="viewDate" [daysInWeek]="daysInWeek" [dayStartHour]="7" [dayEndHour]="21" [refresh]="refresh" <mwl-calendar-week-view [viewDate]="viewDate" [daysInWeek]="daysInWeek" [dayStartHour]="7" [dayEndHour]="21" [refresh]="refresh"
[snapDraggedEvents]="false" [snapDraggedEvents]="false"
(eventTimesChanged)="eventDropped($event)" [events]="events" (eventTimesChanged)="eventDropped($event)" [events]="events" (eventClicked)="eventClicked('Click', $event.event)"
> >
</mwl-calendar-week-view> </mwl-calendar-week-view>
</div> </div>

View File

@ -10,10 +10,11 @@ import {
TaskOverviewInfo, TaskShortInfo TaskOverviewInfo, TaskShortInfo
} from "../../../api"; } from "../../../api";
import {Subject} from "rxjs"; import {Subject} from "rxjs";
import {CalendarEvent, CalendarEventTimesChangedEvent, CalendarView} from "angular-calendar"; import {CalendarEvent, CalendarEventAction, CalendarEventTimesChangedEvent, CalendarView} from "angular-calendar";
import {TaskOverviewData} from "../../dashboard/taskgroup-overview/taskgroup-overview.component"; import {TaskOverviewData} from "../../dashboard/taskgroup-overview/taskgroup-overview.component";
import {EventColor} from "calendar-utils"; import {EventColor} from "calendar-utils";
import * as moment from "moment"; import * as moment from "moment";
import {Router} from "@angular/router";
const colors: Record<string, EventColor> = { const colors: Record<string, EventColor> = {
red: { red: {
@ -32,7 +33,19 @@ const colors: Record<string, EventColor> = {
@Component({ @Component({
selector: 'app-draggable-scheduler', selector: 'app-draggable-scheduler',
templateUrl: './draggable-scheduler.component.html', templateUrl: './draggable-scheduler.component.html',
styleUrls: ['./draggable-scheduler.component.css'] styleUrls: ['./draggable-scheduler.component.css'],
styles: [
`
h3 {
margin: 0 0 10px;
}
pre {
background-color: #f5f5f5;
padding: 15px;
}
`,
],
}) })
export class DraggableSchedulerComponent { export class DraggableSchedulerComponent {
defaultNavigationLinkPath: NavigationLink[] = [ defaultNavigationLinkPath: NavigationLink[] = [
@ -66,11 +79,28 @@ export class DraggableSchedulerComponent {
refresh: Subject<void> = new Subject<void>() refresh: Subject<void> = new Subject<void>()
events: CalendarEvent[] = [] events: CalendarEvent[] = []
actions: CalendarEventAction[] = [
{
label: '<i class="fas fa-fw fa-pencil-alt"></i>',
a11yLabel: 'Edit',
onClick: ({ event }: { event: CalendarEvent }): void => {
this.eventClicked('Edit', event)
},
},
{
label: '<i class="fas fa-fw fa-trash-alt"></i>',
a11yLabel: 'Delete',
onClick: ({ event }: { event: CalendarEvent }): void => {
this.eventClicked('Delete', event);
},
},
]
tasks: CalendarEvent[] = [] tasks: CalendarEvent[] = []
selectedTaskgroupID: number | undefined selectedTaskgroupID: number | undefined
constructor(private scheduleService: ScheduleService) { constructor(private scheduleService: ScheduleService,
private router: Router) {
} }
ngOnInit() { ngOnInit() {
@ -83,6 +113,7 @@ export class DraggableSchedulerComponent {
title: this.computeTaskPath(schedule.taskgroupPath, schedule.task), title: this.computeTaskPath(schedule.taskgroupPath, schedule.task),
color: colors['red'], color: colors['red'],
start: new Date(basicSchedule.scheduleDate), start: new Date(basicSchedule.scheduleDate),
actions: this.actions,
allDay: true, allDay: true,
draggable: true, draggable: true,
resizable: { resizable: {
@ -91,8 +122,10 @@ export class DraggableSchedulerComponent {
}, },
meta: { meta: {
taskID: schedule.task.taskID, taskID: schedule.task.taskID,
scheduleID: schedule.scheduleID scheduleID: schedule.scheduleID,
} taskgroupID: schedule.taskgroupPath[0].taskgroupID
},
}) })
} else { } else {
const advancedSchedule = schedule as AdvancedScheduleInfo const advancedSchedule = schedule as AdvancedScheduleInfo
@ -102,6 +135,7 @@ export class DraggableSchedulerComponent {
cssClass: 'test', cssClass: 'test',
start: new Date(advancedSchedule.scheduleStartTime), start: new Date(advancedSchedule.scheduleStartTime),
end: new Date(advancedSchedule.scheduleStopTime), end: new Date(advancedSchedule.scheduleStopTime),
actions: this.actions,
draggable: true, draggable: true,
resizable: { resizable: {
beforeStart: true, beforeStart: true,
@ -109,11 +143,13 @@ export class DraggableSchedulerComponent {
}, },
meta: { meta: {
taskID: schedule.task.taskID, taskID: schedule.task.taskID,
scheduleID: schedule.scheduleID scheduleID: schedule.scheduleID,
} taskgroupID: schedule.taskgroupPath[0].taskgroupID
},
}) })
} }
}); });
console.log(this.events)
this.refresh.next(); this.refresh.next();
} }
}) })
@ -134,8 +170,10 @@ export class DraggableSchedulerComponent {
}, },
meta: { meta: {
taskID: task.taskID, taskID: task.taskID,
scheduleID: undefined scheduleID: undefined,
} taskgroupID: taskOverviewData.taskgroupID
},
actions: this.actions
}) })
}) })
this.selectedTaskgroupID = taskOverviewData.taskgroupID; this.selectedTaskgroupID = taskOverviewData.taskgroupID;
@ -221,13 +259,27 @@ export class DraggableSchedulerComponent {
} }
} }
computeTaskPath(taskgroupPath: TaskgroupEntityInfo[], task: TaskShortInfo | TaskEntityInfo) { computeTaskPath(taskgroupPath: TaskgroupEntityInfo[], task: TaskShortInfo | TaskEntityInfo) {
let result = ""; let result = "";
taskgroupPath.forEach(taskgroupPathPart => { taskgroupPath.forEach(taskgroupPathPart => {
result += taskgroupPathPart.taskgroupName + "/" result += taskgroupPathPart.taskgroupName + "/"
}); });
result += task!.taskName result += task!.taskName
return result; return result;
} }
eventClicked(action: string, event: CalendarEvent): void {
if(action == 'Click') {
this.router.navigateByUrl("/taskgroups/" + event.meta.taskgroupID + "/tasks/" + event.meta.taskID);
} else if(action == 'Edit') {
this.router.navigateByUrl("/taskgroups/" + event.meta.taskgroupID + "/tasks/" + event.meta.taskID + "/schedule/" + event.meta.scheduleID);
} else if(action == 'Delete') {
this.scheduleService.schedulesScheduleIDDelete(event.meta.scheduleID).subscribe({
next: resp => {
this.events = this.events.filter(calendarEvent => calendarEvent.meta.scheduleID !== event.meta.scheduleID);
}
})
}
}
} }

View File

@ -11,6 +11,7 @@
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/>
</head> </head>
<body class="mat-typography"> <body class="mat-typography">
<app-root></app-root> <app-root></app-root>