issue-106 #107
@ -16,18 +16,9 @@ export interface TaskRepeatDayInfo {
|
|||||||
* number repeating days
|
* number repeating days
|
||||||
*/
|
*/
|
||||||
offset: number;
|
offset: number;
|
||||||
deadlineStrategy: TaskRepeatDayInfo.DeadlineStrategyEnum;
|
|
||||||
/**
|
/**
|
||||||
* Date until the tasks repeat
|
* Date until the tasks repeat
|
||||||
*/
|
*/
|
||||||
endingDate: string;
|
endingDate: string;
|
||||||
}
|
}
|
||||||
export namespace TaskRepeatDayInfo {
|
|
||||||
export type DeadlineStrategyEnum = 'DEADLINE_EQUAL_START' | 'DEADLINE_FIT_START';
|
|
||||||
export const DeadlineStrategyEnum = {
|
|
||||||
EqualStart: 'DEADLINE_EQUAL_START' as DeadlineStrategyEnum,
|
|
||||||
FitStart: 'DEADLINE_FIT_START' as DeadlineStrategyEnum
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,5 +20,22 @@ export interface TaskRepeatWeekDayInfo {
|
|||||||
* internal identifier of task
|
* internal identifier of task
|
||||||
*/
|
*/
|
||||||
taskID: number;
|
taskID: number;
|
||||||
|
/**
|
||||||
|
* day of week
|
||||||
|
*/
|
||||||
|
dayOfWeek: TaskRepeatWeekDayInfo.DayOfWeekEnum;
|
||||||
|
}
|
||||||
|
export namespace TaskRepeatWeekDayInfo {
|
||||||
|
export type DayOfWeekEnum = 'MONDAY' | 'TUESDAY' | 'WEDNESDAY' | 'THURSDAY' | 'FRIDAY' | 'SATURDAY' | 'SUNDAY';
|
||||||
|
export const DayOfWeekEnum = {
|
||||||
|
Monday: 'MONDAY' as DayOfWeekEnum,
|
||||||
|
Tuesday: 'TUESDAY' as DayOfWeekEnum,
|
||||||
|
Wednesday: 'WEDNESDAY' as DayOfWeekEnum,
|
||||||
|
Thursday: 'THURSDAY' as DayOfWeekEnum,
|
||||||
|
Friday: 'FRIDAY' as DayOfWeekEnum,
|
||||||
|
Saturday: 'SATURDAY' as DayOfWeekEnum,
|
||||||
|
Sunday: 'SUNDAY' as DayOfWeekEnum
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,19 +13,10 @@ import { TaskRepeatWeekDayInfo } from './taskRepeatWeekDayInfo';
|
|||||||
|
|
||||||
|
|
||||||
export interface TaskRepeatWeekInfo {
|
export interface TaskRepeatWeekInfo {
|
||||||
deadlineStrategy: TaskRepeatWeekInfo.DeadlineStrategyEnum;
|
|
||||||
/**
|
/**
|
||||||
* Date until the tasks repeat
|
* Date until the tasks repeat
|
||||||
*/
|
*/
|
||||||
endDate: string;
|
endDate: string;
|
||||||
weekDayInfos: Array<TaskRepeatWeekDayInfo>;
|
weekDayInfos: Array<TaskRepeatWeekDayInfo>;
|
||||||
}
|
}
|
||||||
export namespace TaskRepeatWeekInfo {
|
|
||||||
export type DeadlineStrategyEnum = 'DEADLINE_EQUAL_START' | 'DEADLINE_FIT_START';
|
|
||||||
export const DeadlineStrategyEnum = {
|
|
||||||
EqualStart: 'DEADLINE_EQUAL_START' as DeadlineStrategyEnum,
|
|
||||||
FitStart: 'DEADLINE_FIT_START' as DeadlineStrategyEnum
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,13 +7,6 @@
|
|||||||
<mat-label>Offset</mat-label>
|
<mat-label>Offset</mat-label>
|
||||||
<input matInput formControlName="offsetCtrl" type="number" (keypress)="($event.charCode >= 48 && $event.charCode < 58)">
|
<input matInput formControlName="offsetCtrl" type="number" (keypress)="($event.charCode >= 48 && $event.charCode < 58)">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline" class="long-form">
|
|
||||||
<mat-label>Deadline Strategy</mat-label>
|
|
||||||
<mat-select formControlName="deadlineStrategyCtrl">
|
|
||||||
<mat-option value="DEADLINE_FIT_START">Fit Next Start</mat-option>
|
|
||||||
<mat-option value="DEADLINE_EQUAL_START">Equal Same Start</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
<div>
|
<div>
|
||||||
<button mat-raised-button color="primary" matStepperNext>Next</button>
|
<button mat-raised-button color="primary" matStepperNext>Next</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,7 +2,6 @@ import {Component, Inject} from '@angular/core';
|
|||||||
import {FormBuilder, Validators} from "@angular/forms";
|
import {FormBuilder, Validators} from "@angular/forms";
|
||||||
import {TaskEntityInfo, TaskRepeatDayInfo, TaskseriesService} from "../../../api";
|
import {TaskEntityInfo, TaskRepeatDayInfo, TaskseriesService} from "../../../api";
|
||||||
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
||||||
import DeadlineStrategyEnum = TaskRepeatDayInfo.DeadlineStrategyEnum;
|
|
||||||
import * as moment from "moment";
|
import * as moment from "moment";
|
||||||
|
|
||||||
|
|
||||||
@ -15,7 +14,6 @@ export class TaskSeriesCreatorComponent {
|
|||||||
|
|
||||||
dailyFormGroup = this._formBuilder.group({
|
dailyFormGroup = this._formBuilder.group({
|
||||||
offsetCtrl: ['', Validators.required],
|
offsetCtrl: ['', Validators.required],
|
||||||
deadlineStrategyCtrl: ['', Validators.required]
|
|
||||||
})
|
})
|
||||||
|
|
||||||
endDateFormGroup = this._formBuilder.group({
|
endDateFormGroup = this._formBuilder.group({
|
||||||
@ -32,7 +30,6 @@ export class TaskSeriesCreatorComponent {
|
|||||||
save() {
|
save() {
|
||||||
this.taskSeriesService.tasksTaskIDTaskseriesDailyPost(this.task.taskID,{
|
this.taskSeriesService.tasksTaskIDTaskseriesDailyPost(this.task.taskID,{
|
||||||
offset: Number(this.dailyFormGroup.get('offsetCtrl')!.value!),
|
offset: Number(this.dailyFormGroup.get('offsetCtrl')!.value!),
|
||||||
deadlineStrategy: this.convertDeadlineStrategyCtrlToDeadlineEnum(),
|
|
||||||
endingDate: moment( this.endDateFormGroup.get('endDateCtrl')!.value!).format('YYYY-MM-DDTHH:mm:ss.SSSZ')
|
endingDate: moment( this.endDateFormGroup.get('endDateCtrl')!.value!).format('YYYY-MM-DDTHH:mm:ss.SSSZ')
|
||||||
}).subscribe({
|
}).subscribe({
|
||||||
next: resp => {
|
next: resp => {
|
||||||
@ -40,13 +37,4 @@ export class TaskSeriesCreatorComponent {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
convertDeadlineStrategyCtrlToDeadlineEnum() {
|
|
||||||
const deadlineStrategy = this.dailyFormGroup.get('deadlineStrategyCtrl')!.value;
|
|
||||||
if(deadlineStrategy === DeadlineStrategyEnum.EqualStart) {
|
|
||||||
return DeadlineStrategyEnum.EqualStart;
|
|
||||||
} else {
|
|
||||||
return DeadlineStrategyEnum.FitStart;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -24,14 +24,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</mat-accordion>
|
</mat-accordion>
|
||||||
</div>
|
</div>
|
||||||
<mat-form-field appearance="outline" class="long-form" id="deadline-strategy-form">
|
|
||||||
<mat-label>Deadline-Strategy</mat-label>
|
|
||||||
<mat-select formControlName="deadlineStrategyCtrl">
|
|
||||||
<mat-option *ngFor="let deadlineStrategy of availableDeadlineStrategys" [value]="deadlineStrategy">
|
|
||||||
{{deadlineStrategy}}
|
|
||||||
</mat-option>
|
|
||||||
</mat-select>
|
|
||||||
</mat-form-field>
|
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="long-form" id="endDate-form">
|
<mat-form-field appearance="outline" class="long-form" id="endDate-form">
|
||||||
<mat-label>Ending Date</mat-label>
|
<mat-label>Ending Date</mat-label>
|
||||||
|
@ -3,7 +3,7 @@ import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog";
|
|||||||
import {TaskEntityInfo, TaskRepeatDayInfo, TaskRepeatWeekDayInfo, TaskseriesService} from "../../../api";
|
import {TaskEntityInfo, TaskRepeatDayInfo, TaskRepeatWeekDayInfo, TaskseriesService} from "../../../api";
|
||||||
import * as moment from "moment";
|
import * as moment from "moment";
|
||||||
import {FormArray, FormBuilder, FormGroup, Validators} from "@angular/forms";
|
import {FormArray, FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||||
import DeadlineStrategyEnum = TaskRepeatDayInfo.DeadlineStrategyEnum;
|
import DayOfWeekEnum = TaskRepeatWeekDayInfo.DayOfWeekEnum;
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -14,7 +14,6 @@ import DeadlineStrategyEnum = TaskRepeatDayInfo.DeadlineStrategyEnum;
|
|||||||
export class TaskWeeklySeriesCreatorComponent implements OnInit{
|
export class TaskWeeklySeriesCreatorComponent implements OnInit{
|
||||||
|
|
||||||
repeatingOffsetForm: FormGroup | undefined
|
repeatingOffsetForm: FormGroup | undefined
|
||||||
availableDeadlineStrategys: DeadlineStrategyEnum[] = ["DEADLINE_EQUAL_START", "DEADLINE_FIT_START"]
|
|
||||||
|
|
||||||
constructor(private dialogRef: MatDialogRef<TaskWeeklySeriesCreatorComponent>,
|
constructor(private dialogRef: MatDialogRef<TaskWeeklySeriesCreatorComponent>,
|
||||||
private taskRepeatingService: TaskseriesService,
|
private taskRepeatingService: TaskseriesService,
|
||||||
@ -27,7 +26,6 @@ export class TaskWeeklySeriesCreatorComponent implements OnInit{
|
|||||||
offsets: this.formbuilder.array(this.tasks.map(task => this.formbuilder.group({
|
offsets: this.formbuilder.array(this.tasks.map(task => this.formbuilder.group({
|
||||||
offsetCtrl: ['', [Validators.required, Validators.min(1)]]
|
offsetCtrl: ['', [Validators.required, Validators.min(1)]]
|
||||||
}))),
|
}))),
|
||||||
deadlineStrategyCtrl: ['', Validators.required],
|
|
||||||
endingDateCtrl: ['', Validators.required]
|
endingDateCtrl: ['', Validators.required]
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -62,12 +60,12 @@ export class TaskWeeklySeriesCreatorComponent implements OnInit{
|
|||||||
for(let i=0; i<formArrayValues.length; i++) {
|
for(let i=0; i<formArrayValues.length; i++) {
|
||||||
weekDayInfos.push({
|
weekDayInfos.push({
|
||||||
taskID: this.tasks[i].taskID,
|
taskID: this.tasks[i].taskID,
|
||||||
offset: Number(formArrayValues[i].offsetCtrl) * 7
|
offset: Number(formArrayValues[i].offsetCtrl) * 7,
|
||||||
|
dayOfWeek: this.getDayOfWeekFromTask(this.tasks[i])!
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.taskRepeatingService.tasksTaskseriesWeeklyPost({
|
this.taskRepeatingService.tasksTaskseriesWeeklyPost({
|
||||||
deadlineStrategy: this.repeatingOffsetForm!.controls['deadlineStrategyCtrl']!.value!,
|
|
||||||
endDate: moment(this.repeatingOffsetForm!.controls['endingDateCtrl']!.value!).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
|
endDate: moment(this.repeatingOffsetForm!.controls['endingDateCtrl']!.value!).format('YYYY-MM-DDTHH:mm:ss.SSSZ'),
|
||||||
weekDayInfos: weekDayInfos
|
weekDayInfos: weekDayInfos
|
||||||
}).subscribe({
|
}).subscribe({
|
||||||
@ -77,6 +75,21 @@ export class TaskWeeklySeriesCreatorComponent implements OnInit{
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getDayOfWeekFromTask(task: TaskEntityInfo): DayOfWeekEnum | undefined {
|
||||||
|
const weekday = moment(task.startDate).isoWeekday();
|
||||||
|
|
||||||
|
switch (weekday) {
|
||||||
|
case 1: return DayOfWeekEnum.Monday;
|
||||||
|
case 2: return DayOfWeekEnum.Tuesday;
|
||||||
|
case 3: return DayOfWeekEnum.Wednesday;
|
||||||
|
case 4: return DayOfWeekEnum.Thursday;
|
||||||
|
case 5: return DayOfWeekEnum.Friday;
|
||||||
|
case 6: return DayOfWeekEnum.Saturday;
|
||||||
|
case 7: return DayOfWeekEnum.Sunday;
|
||||||
|
default: return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel() {
|
||||||
this.dialogRef.close(false);
|
this.dialogRef.close(false);
|
||||||
}
|
}
|
||||||
|
24
openapi.yaml
24
openapi.yaml
@ -2963,7 +2963,6 @@ components:
|
|||||||
TaskRepeatDayInfo:
|
TaskRepeatDayInfo:
|
||||||
required:
|
required:
|
||||||
- offset
|
- offset
|
||||||
- deadlineStrategy
|
|
||||||
- endingDate
|
- endingDate
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
properties:
|
properties:
|
||||||
@ -2972,11 +2971,6 @@ components:
|
|||||||
description: number repeating days
|
description: number repeating days
|
||||||
example: 7
|
example: 7
|
||||||
minimum: 1
|
minimum: 1
|
||||||
deadlineStrategy:
|
|
||||||
type: string
|
|
||||||
enum:
|
|
||||||
- DEADLINE_EQUAL_START
|
|
||||||
- DEADLINE_FIT_START
|
|
||||||
endingDate:
|
endingDate:
|
||||||
type: string
|
type: string
|
||||||
format: date
|
format: date
|
||||||
@ -2985,6 +2979,7 @@ components:
|
|||||||
required:
|
required:
|
||||||
- offset
|
- offset
|
||||||
- taskID
|
- taskID
|
||||||
|
- dayOfWeek
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
properties:
|
properties:
|
||||||
offset:
|
offset:
|
||||||
@ -2996,18 +2991,23 @@ components:
|
|||||||
type: number
|
type: number
|
||||||
description: internal identifier of task
|
description: internal identifier of task
|
||||||
example: 1
|
example: 1
|
||||||
|
dayOfWeek:
|
||||||
|
type: string
|
||||||
|
description: day of week
|
||||||
|
enum:
|
||||||
|
- MONDAY
|
||||||
|
- TUESDAY
|
||||||
|
- WEDNESDAY
|
||||||
|
- THURSDAY
|
||||||
|
- FRIDAY
|
||||||
|
- SATURDAY
|
||||||
|
- SUNDAY
|
||||||
TaskRepeatWeekInfo:
|
TaskRepeatWeekInfo:
|
||||||
required:
|
required:
|
||||||
- weekDayInfos
|
- weekDayInfos
|
||||||
- deadlineStrategy
|
|
||||||
- endDate
|
- endDate
|
||||||
additionalProperties: false
|
additionalProperties: false
|
||||||
properties:
|
properties:
|
||||||
deadlineStrategy:
|
|
||||||
type: string
|
|
||||||
enum:
|
|
||||||
- DEADLINE_EQUAL_START
|
|
||||||
- DEADLINE_FIT_START
|
|
||||||
endDate:
|
endDate:
|
||||||
type: string
|
type: string
|
||||||
format: date
|
format: date
|
||||||
|
Loading…
Reference in New Issue
Block a user