diff --git a/src/scheduler/schedule.module.ts b/src/scheduler/schedule.module.ts index e8c5c9a..423eaae 100644 --- a/src/scheduler/schedule.module.ts +++ b/src/scheduler/schedule.module.ts @@ -12,6 +12,7 @@ import { ToastrModule } from 'ngx-toastr'; import { ScheduleService } from './schedule.service'; import { ScheduleDeleteModalComponent } from './scheduleDeleteModal.component'; +import { ScheduleEditModalComponent } from './scheduleEditModal.component'; import { ScheduleFormComponent } from './scheduleForm.component'; import { ScheduleRowComponent } from './scheduleRow.component'; import { ScheduleListComponent } from './scheduleList.component'; @@ -48,12 +49,14 @@ export function accountIdServiceFactory(i: any) { ], declarations: [ ScheduleDeleteModalComponent, + ScheduleEditModalComponent, ScheduleFormComponent, ScheduleListComponent, ScheduleRowComponent ], entryComponents: [ ScheduleDeleteModalComponent, + ScheduleEditModalComponent, ScheduleFormComponent, ScheduleListComponent, ScheduleRowComponent diff --git a/src/scheduler/scheduleEditModal.component.ts b/src/scheduler/scheduleEditModal.component.ts new file mode 100644 index 0000000..98258f8 --- /dev/null +++ b/src/scheduler/scheduleEditModal.component.ts @@ -0,0 +1,53 @@ +// vim: set tw=80 ts=2 sw=2 sts=2: +import { Component, Input } from '@angular/core'; +import { NgForm } from '@angular/forms'; + +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; + +import { Schedule } from './schedule'; + +@Component({ + selector: 'schedule-edit-modal', + template: ` + + + + + + ` +}) +export class ScheduleEditModalComponent { + @Input() schedule: Schedule; + + valid: boolean = false; + + constructor(private activeModal: NgbActiveModal) {} + + title(): string { + if(this.schedule.id) { + return "Schedule #" + this.schedule.id; + } else { + return "New schedule"; + } + } + + submit(): void { + this.activeModal.close(this.schedule); + } + + cancel(): void { + this.activeModal.dismiss("closed"); + } +} diff --git a/src/scheduler/scheduleRow.component.ts b/src/scheduler/scheduleRow.component.ts index 151d07b..9440577 100644 --- a/src/scheduler/scheduleRow.component.ts +++ b/src/scheduler/scheduleRow.component.ts @@ -7,6 +7,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrService } from 'ngx-toastr'; import { ScheduleDeleteModalComponent } from './scheduleDeleteModal.component'; +import { ScheduleEditModalComponent } from './scheduleEditModal.component'; import { ScheduleService } from './schedule.service'; import { Schedule } from './schedule';