From d5160a55fbc3054f77b888f1093e7e29b6437506 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Thu, 21 Sep 2017 23:51:05 +0200 Subject: [PATCH] Remove unused shedule row component. --- src/scheduler/scheduleRow.component.ts | 115 ------------------------- 1 file changed, 115 deletions(-) delete mode 100644 src/scheduler/scheduleRow.component.ts diff --git a/src/scheduler/scheduleRow.component.ts b/src/scheduler/scheduleRow.component.ts deleted file mode 100644 index b26cfef..0000000 --- a/src/scheduler/scheduleRow.component.ts +++ /dev/null @@ -1,115 +0,0 @@ -// vim: set tw=80 ts=2 sw=2 sts=2 : -import { CurrencyPipe } from '@angular/common'; -import { Component, Inject, Input, Output, EventEmitter } from '@angular/core'; - -import { Logger } from '@nsalaun/ng-logger'; -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'; - -@Component({ - selector: 'tr[schedule-row]', - host: { - "[id]": "schedule.id", - }, - template: ` -{{ schedule.start_date | date: "yyyy-MM-dd" }} - - -{{ schedule.stop_date | date: "yyyy-MM-dd" }} - -{{ schedule.day }} - -{{ schedule.frequency }} - -{{ schedule.label }} - -{{ schedule.value | currency:"EUR":true }} - -{{ schedule.category }} - - -
- - - - - -
- - ` -}) -export class ScheduleRowComponent { - @Input('schedule-row') schedule: Schedule; - @Output() needsReload: EventEmitter = new EventEmitter(); - - constructor( - private scheduleService: ScheduleService, - private logger: Logger, - private toastrService: ToastrService, - private ngbModal: NgbModal - ) {} - - save(schedule: Schedule) { - return this.scheduleService.update(schedule).subscribe((schedule: Schedule) => { - this.toastrService.success('Schedule #' + schedule.id + ' saved.'); - - this.needsReload.emit(); - }, result => { - this.toastrService.error( - 'Error while saving schedule: ' + result.message - ); - }); - } - - confirmDelete() { - const modal = this.ngbModal.open(ScheduleDeleteModalComponent); - - modal.componentInstance.schedule = this.schedule; - - modal.result.then((schedule: Schedule) => { - this.delete(schedule); - }, (reason) => function(reason) { - }); - } - - delete(schedule: Schedule) { - var id = schedule.id; - - return this.scheduleService.delete(schedule).subscribe(() => { - this.toastrService.success('Schedule #' + id + ' deleted.'); - - this.needsReload.emit(); - }, result => { - this.toastrService.error( - 'An error occurred while trying to delete schedule #' + id + ':
' - + result.message - ); - }); - } - - modify() { - const modal = this.ngbModal.open(ScheduleEditModalComponent, { - size: 'lg' - }); - - modal.componentInstance.schedule = this.schedule; - - modal.result.then((schedule: Schedule) => { - this.save(schedule); - }, (reason) => function(reason) { - }); - } -}