Reschedule Tasks (Basicschedules)
This commit is contained in:
parent
d6d267c645
commit
e2d871f7fb
@ -4,11 +4,10 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Define Entity BasicTaskSchedule and Taskcontroller">
|
||||
<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/controller/ScheduleController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/api/controller/ScheduleController.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/core/repositories/timemanager/BasicTaskScheduleRepository.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" />
|
||||
<list default="true" id="3a869f59-290a-4ab2-b036-a878ce801bc4" name="Changes" comment="Delete Schedules">
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/schedule-dashboard/schedule-dashboard.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.html" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" beforeDir="false" afterPath="$PROJECT_DIR$/../frontend/src/app/schedules/scheduler/scheduler.component.ts" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -96,7 +95,7 @@
|
||||
<workItem from="1697958118995" duration="5749000" />
|
||||
<workItem from="1697969480767" duration="6407000" />
|
||||
<workItem from="1697989716016" duration="3814000" />
|
||||
<workItem from="1698067098771" duration="4010000" />
|
||||
<workItem from="1698067098771" duration="4770000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Structure Taskgroups in Hierarchies">
|
||||
<option name="closed" value="true" />
|
||||
@ -146,7 +145,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1697976314517</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="7" />
|
||||
<task id="LOCAL-00007" summary="Delete Schedules">
|
||||
<option name="closed" value="true" />
|
||||
<created>1698089745245</created>
|
||||
<option name="number" value="00007" />
|
||||
<option name="presentableId" value="LOCAL-00007" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698089745245</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="8" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@ -160,7 +167,8 @@
|
||||
<MESSAGE value="Delete and clear Tasks" />
|
||||
<MESSAGE value="Delete and clear Tasks (Frontend)" />
|
||||
<MESSAGE value="Define Entity BasicTaskSchedule and Taskcontroller" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Define Entity BasicTaskSchedule and Taskcontroller" />
|
||||
<MESSAGE value="Delete Schedules" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Delete Schedules" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
|
@ -15,7 +15,8 @@ const routes: Routes = [
|
||||
{path: 'taskgroups', component: TaskgroupDashboardComponent},
|
||||
{path: 'taskgroups/:taskgroupID', component: TaskgroupDashboardComponent},
|
||||
{path: 'taskgroups/:taskgroupID/tasks/:taskID', component: TaskDetailOverviewComponent},
|
||||
{path: 'taskgroups/:taskgroupID/tasks/:taskID/schedule', component: SchedulerComponent}
|
||||
{path: 'taskgroups/:taskgroupID/tasks/:taskID/schedule', component: SchedulerComponent},
|
||||
{path: 'taskgroups/:taskgroupID/tasks/:taskID/schedule/:scheduleID', component: SchedulerComponent}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
@ -1,3 +1,15 @@
|
||||
mat-form-field {
|
||||
width: 100%;
|
||||
.scheduleContainer {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
mat-form-field {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.scheduleBtn {
|
||||
float: right;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
<div class="scheduler-container">
|
||||
<mat-form-field>
|
||||
<input matInput [matDatepicker]="picker" [formControl]="dateCtrl">
|
||||
<mat-hint>MM/DD/YYYY</mat-hint>
|
||||
@ -5,4 +6,6 @@
|
||||
<mat-datepicker #picker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<button mat-raised-button color="primary" (click)="schedule()">Schedule</button>
|
||||
<button class="scheduleBtn" mat-raised-button color="primary" (click)="schedule()">Schedule</button>
|
||||
</div>
|
||||
|
||||
|
@ -1,21 +1,25 @@
|
||||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||
import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges} from '@angular/core';
|
||||
import {FormControl, Validators} from "@angular/forms";
|
||||
import {BasicScheduleEntityInfo, ScheduleService, TaskEntityInfo} from "../../../api";
|
||||
import {BasicScheduleEntityInfo, ScheduleService, TaskEntityInfo, TaskgroupEntityInfo} from "../../../api";
|
||||
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||
import {Router} from "@angular/router";
|
||||
|
||||
@Component({
|
||||
selector: 'app-basic-scheduler',
|
||||
templateUrl: './basic-scheduler.component.html',
|
||||
styleUrls: ['./basic-scheduler.component.css']
|
||||
})
|
||||
export class BasicSchedulerComponent {
|
||||
export class BasicSchedulerComponent implements OnChanges{
|
||||
|
||||
dateCtrl: FormControl = new FormControl('', [Validators.required])
|
||||
@Input('taskgroup') taskgroup: TaskgroupEntityInfo | undefined
|
||||
@Input('task') task: TaskEntityInfo | undefined
|
||||
@Input('scheduleInfo') scheduleEntityInfo: BasicScheduleEntityInfo | undefined
|
||||
@Output('onSchedule') scheduleEmitter: EventEmitter<BasicScheduleEntityInfo> = new EventEmitter<BasicScheduleEntityInfo>();
|
||||
|
||||
constructor(private scheduleService: ScheduleService,
|
||||
private snackbar: MatSnackBar) {
|
||||
private snackbar: MatSnackBar,
|
||||
private router: Router) {
|
||||
}
|
||||
|
||||
setDate(date: Date) {
|
||||
@ -24,6 +28,7 @@ export class BasicSchedulerComponent {
|
||||
|
||||
schedule() {
|
||||
if(this.task != undefined) {
|
||||
if(this.scheduleEntityInfo == undefined) {
|
||||
this.scheduleService.schedulesTaskIDBasicPut(this.task.taskID, {
|
||||
scheduleDate: this.dateCtrl.value
|
||||
}).subscribe({
|
||||
@ -31,7 +36,43 @@ export class BasicSchedulerComponent {
|
||||
this.scheduleEmitter.emit(resp);
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.scheduleService.schedulesScheduleIDBasicPost(this.scheduleEntityInfo!.scheduleID, {
|
||||
scheduleDate: this.dateCtrl.value
|
||||
}).subscribe({
|
||||
next: resp => {
|
||||
this.router.navigateByUrl("/taskgroups/" + this.taskgroup!.taskgroupID + "/tasks/" + this.task!.taskID);
|
||||
},
|
||||
error: err => {
|
||||
if(err.status == 403) {
|
||||
this.snackbar.open("No permission", "",{duration: 2000});
|
||||
} else if(err.status == 404) {
|
||||
this.snackbar.open("Not found", "", {duration: 2000});
|
||||
} else {
|
||||
this.snackbar.open("Unexpected error", "",{duration: 2000});
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
if(this.scheduleEntityInfo != undefined) {
|
||||
this.dateCtrl.setValue(this.scheduleEntityInfo!.scheduleID)
|
||||
}
|
||||
}
|
||||
|
||||
ngOnChanges(): void {
|
||||
if(this.scheduleEntityInfo != undefined) {
|
||||
this.dateCtrl.setValue(this.scheduleEntityInfo!.scheduleID)
|
||||
}
|
||||
}
|
||||
|
||||
setEditedBasicSchedule(basicSchedule: BasicScheduleEntityInfo) {
|
||||
this.dateCtrl.setValue(basicSchedule.scheduleDate)
|
||||
this.scheduleEntityInfo = basicSchedule;
|
||||
console.log(this.dateCtrl.value)
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="basicScheduleContainer">
|
||||
<p class="basicScheduleContent">{{schedule.scheduleDate | date:'EEEE, d MMM. y'}}</p>
|
||||
<div class="basicScheduleContent">
|
||||
<button mat-icon-button color="primary"><mat-icon>edit</mat-icon></button>
|
||||
<button mat-icon-button color="primary" [routerLink]="['/taskgroups', taskgroup!.taskgroupID, 'tasks', task!.taskID, 'schedule', schedule.scheduleID]"><mat-icon>edit</mat-icon></button>
|
||||
<button mat-icon-button color="warn" (click)="deleteSchedule(schedule)"><mat-icon>delete</mat-icon></button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -19,6 +19,6 @@
|
||||
>
|
||||
</mwl-calendar-week-view>
|
||||
|
||||
<app-basic-scheduler *ngIf="scheduleStrategy === 1" #basicScheduler [task]="task" (onSchedule)="onBasicSchedule($event)"></app-basic-scheduler>
|
||||
<app-basic-scheduler *ngIf="scheduleStrategy === 1" #basicScheduler [task]="task" [taskgroup]="taskgroup" (onSchedule)="onBasicSchedule($event)"></app-basic-scheduler>
|
||||
|
||||
</div>
|
||||
|
@ -129,6 +129,32 @@ export class SchedulerComponent implements OnInit{
|
||||
}
|
||||
|
||||
fetchBasicSchedules() {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params.has('scheduleID')) {
|
||||
this.scheduleService.schedulesTaskIDScheduleTypeGet(this.task!.taskID, "BASIC").subscribe({
|
||||
next: resp => {
|
||||
resp.forEach(basicSchedule => {
|
||||
if(basicSchedule.scheduleID === Number(params.get('scheduleID'))) {
|
||||
this.events.push({
|
||||
start: new Date(basicSchedule.scheduleDate),
|
||||
title: this.computeTaskPath(),
|
||||
color: colors['yellow'],
|
||||
allDay: true,
|
||||
})
|
||||
this.basicScheduler?.setEditedBasicSchedule(basicSchedule);
|
||||
} else {
|
||||
this.events.push({
|
||||
start: new Date(basicSchedule.scheduleDate),
|
||||
title: this.computeTaskPath(),
|
||||
color: colors['red'],
|
||||
allDay: true,
|
||||
})
|
||||
}
|
||||
})
|
||||
this.refresh.next();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.scheduleService.schedulesTaskIDScheduleTypeGet(this.task!.taskID, "BASIC").subscribe({
|
||||
next: resp => {
|
||||
resp.forEach(basicSchedule => {
|
||||
@ -142,6 +168,9 @@ export class SchedulerComponent implements OnInit{
|
||||
this.refresh.next();
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user