diff --git a/src/operations/operation.module.ts b/src/operations/operation.module.ts index 2fa0d98..916d47f 100644 --- a/src/operations/operation.module.ts +++ b/src/operations/operation.module.ts @@ -20,7 +20,6 @@ import { CategoryService } from './category.service'; import { OperationService } from './operation.service'; import { OperationListComponent } from './operationList.component'; import { OperationNewComponent } from './operationNew.component'; -import { OperationEditComponent } from './operationEdit.component'; import { OperationDeleteModalComponent } from './operationDeleteModal.component'; import { OperationRoutes } from './operation.states'; @@ -48,7 +47,6 @@ import { OperationRoutes } from './operation.states'; CategoryChartComponent, OperationRowComponent, OperationListComponent, - OperationEditComponent, OperationNewComponent, OperationDeleteModalComponent, ], diff --git a/src/operations/operation.states.ts b/src/operations/operation.states.ts index b6de753..6f7af70 100644 --- a/src/operations/operation.states.ts +++ b/src/operations/operation.states.ts @@ -4,7 +4,6 @@ import { Routes } from '@angular/router'; import { OperationListComponent } from './operationList.component'; import { OperationNewComponent } from './operationNew.component'; -import { OperationEditComponent } from './operationEdit.component'; export const OperationRoutes: Routes = [{ path: 'account/:accountId/operations', diff --git a/src/operations/operationEdit.component.ts b/src/operations/operationEdit.component.ts deleted file mode 100644 index 1818037..0000000 --- a/src/operations/operationEdit.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -// vim: set tw=80 ts=2 sw=2 sts=2 : - -import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; - -@Component({ - selector: 'operation-edit', - template: ` -
-
-
-
- ` -}) -export class OperationEditComponent implements OnInit { - ngOnInit(): void { - - } -} - diff --git a/src/operations/operationEditModal.component.ts b/src/operations/operationEditModal.component.ts deleted file mode 100644 index eee4260..0000000 --- a/src/operations/operationEditModal.component.ts +++ /dev/null @@ -1,63 +0,0 @@ -// vim: set tw=80 ts=2 sw=2 sts=2: -import { Component, Input, ViewChild } from '@angular/core'; - -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; - -import { Operation } from './operation'; -import { OperationFormComponent } from './operationForm.component'; - -@Component({ - selector: 'operation-edit-modal', - template: ` - - - - - - ` -}) -export class OperationEditModalComponent { - @Input() operation: Operation; - @ViewChild('operationForm') operationForm: OperationFormComponent; - - valid: boolean = false; - - constructor(private activeModal: NgbActiveModal) {} - - title(): string { - if(this.operation.id) { - return "Operation #" + this.operation.id; - } else { - return "New operation"; - } - } - - submit(): void { - let formModel = this.operationForm.form.value; - let operation = Object.assign({}, this.operation); - - operation.id = this.operation.id; - operation.operation_date = formModel.operationDate; - operation.label = formModel.label; - operation.value = formModel.value; - operation.category = formModel.category; - - this.activeModal.close(operation); - } - - cancel(): void { - this.activeModal.dismiss("closed"); - } -} diff --git a/src/operations/operationList.component.ts b/src/operations/operationList.component.ts index 4c03b6d..6dad013 100644 --- a/src/operations/operationList.component.ts +++ b/src/operations/operationList.component.ts @@ -15,7 +15,6 @@ import { Account } from '../accounts/account'; import { AccountService } from '../accounts/account.service'; import { Operation } from './operation'; import { OperationService } from './operation.service'; -import { OperationEditModalComponent } from './operationEditModal.component'; @Component({ selector: 'operation-list', @@ -107,27 +106,6 @@ export class OperationListComponent implements OnInit { //this.loadData(); } - /* - * Add an empty operation. - */ - add() { - var operation = new Operation(); - let accountId = this.route.snapshot.paramMap.get('accountId'); - operation.account_id = +accountId; - - // FIXME Alexis Lahouze 2017-06-15 i18n - const modal = this.ngbModal.open(OperationEditModalComponent, { - size: 'lg' - }); - - modal.componentInstance.operation = operation; - - modal.result.then((operation: Operation) => { - this.save(operation); - }, (reason) => { - }); - } - /* * Load operations. */ @@ -144,25 +122,4 @@ export class OperationListComponent implements OnInit { this.operations = operations.reverse(); }); } - - /* - * Save an operation and return a promise. - */ - save(operation) { - operation.confirmed = true; - - return this.operationService.create(operation).subscribe( - (operation) => { - this.toastrService.success('Operation #' + operation.id + ' saved.'); - - //this.loadData(); - this.logger.info('Reload route', this.router.url); - this.router.navigateByUrl(this.router.url); - }, (result) => { - this.toastrService.error( - 'Error while saving operation: ' + result.message - ); - } - ); - } } diff --git a/src/operations/operationRow.component.ts b/src/operations/operationRow.component.ts index 2e158bc..fc22cee 100644 --- a/src/operations/operationRow.component.ts +++ b/src/operations/operationRow.component.ts @@ -11,7 +11,6 @@ import { Account } from '../accounts/account'; import { Operation } from './operation'; import { OperationService } from './operation.service'; import { OperationDeleteModalComponent } from './operationDeleteModal.component'; -import { OperationEditModalComponent } from './operationEditModal.component'; @Component({ selector: 'tr[operation-row]', @@ -146,18 +145,4 @@ export class OperationRowComponent { ); }); }; - - modify(operation) { - // FIXME Alexis Lahouze 2017-06-15 i18n - const modal = this.ngbModal.open(OperationEditModalComponent, { - size: 'lg' - }); - - modal.componentInstance.operation = operation; - - modal.result.then((operation: Operation) => { - this.save(operation); - }, (reason) => { - }); - }; }