issue-20 #46

Merged
sebastian merged 15 commits from issue-20 into master 2023-11-12 13:18:53 +01:00
2 changed files with 15 additions and 10 deletions
Showing only changes of commit 48f162ce0b - Show all commits

View File

@ -1,4 +1,4 @@
import {Component, EventEmitter, Output, ViewChild} from "@angular/core";
import {Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild} from "@angular/core";
import {MatDatepicker} from "@angular/material/datepicker";
import {NgxMaterialTimepickerComponent, NgxMaterialTimepickerToggleComponent} from "ngx-material-timepicker";
import {FormControl, Validators} from "@angular/forms";
@ -8,11 +8,13 @@ import {FormControl, Validators} from "@angular/forms";
templateUrl: './date-time-picker.component.html',
styleUrls: ['./date-time-picker.component.css']
})
export class DateTimePickerComponent {
export class DateTimePickerComponent implements OnInit, OnChanges{
@ViewChild('picker') picker?: MatDatepicker<any>;
@ViewChild('toggleTimepicker') toggleTimepicker?: NgxMaterialTimepickerComponent
@Output('onTimeSet') timeSet: EventEmitter<Date> = new EventEmitter<Date>();
@Input('date') date: Date | undefined
dateControl: FormControl = new FormControl('', [Validators.required])
timeControl: FormControl = new FormControl('', [Validators.required])
constructor() { }
@ -21,6 +23,12 @@ export class DateTimePickerComponent {
}
ngOnChanges() {
if(this.date != undefined) {
this.setDateTime(this.date);
}
}
setDateTime(date: Date) {
console.log(date)
this.dateControl.setValue(date);

View File

@ -2,7 +2,7 @@ import {Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges
import {FormControl, Validators} from "@angular/forms";
import {
BasicScheduleEntityInfo,
BasicScheduleInfo,
BasicScheduleInfo, ScheduleInfo,
ScheduleService,
TaskEntityInfo,
TaskgroupEntityInfo
@ -20,7 +20,7 @@ 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
@Input('scheduleInfo') scheduleEntityInfo: ScheduleInfo | undefined
@Output('onSchedule') scheduleEmitter: EventEmitter<BasicScheduleEntityInfo> = new EventEmitter<BasicScheduleEntityInfo>();
constructor(private scheduleService: ScheduleService,
@ -72,13 +72,10 @@ export class BasicSchedulerComponent implements OnChanges{
ngOnChanges(): void {
if(this.scheduleEntityInfo != undefined) {
this.dateCtrl.setValue(this.scheduleEntityInfo!.scheduleID)
const schedule = this.scheduleEntityInfo as BasicScheduleInfo
this.dateCtrl.setValue(schedule.scheduleDate)
}
}
setEditedBasicSchedule(basicSchedule: BasicScheduleEntityInfo) {
this.dateCtrl.setValue(basicSchedule.scheduleDate)
this.scheduleEntityInfo = basicSchedule;
console.log(this.dateCtrl.value)
}
}