diff --git a/src/operations/operationList.component.ts b/src/operations/operationList.component.ts index 75196c7..17aa54c 100644 --- a/src/operations/operationList.component.ts +++ b/src/operations/operationList.component.ts @@ -1,14 +1,15 @@ import { Component, Inject, OnInit } from '@angular/core'; import { Observable } from 'rxjs/Rx'; +import { Logger } from '@nsalaun/ng-logger'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { ToastrService } from 'ngx-toastr'; -var operationFormTmpl = require('./operation.form.tmpl.html'); - 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', @@ -68,11 +69,12 @@ export class OperationListComponent implements OnInit { private operations: Operation[]; constructor( - @Inject("$modal") private $modal, @Inject("accountIdService") private accountIdService, private toastrService: ToastrService, private operationService: OperationService, - private accountService: AccountService + private accountService: AccountService, + private logger: Logger, + private ngbModal: NgbModal, ) {} ngOnInit() { @@ -136,25 +138,15 @@ export class OperationListComponent implements OnInit { modify(operation) { // FIXME Alexis Lahouze 2017-06-15 i18n - var title = "New operation"; + const modal = this.ngbModal.open(OperationEditModalComponent, { + windowClass: 'in' + }); - this.$modal({ - templateUrl: operationFormTmpl, - controller: function($scope, title, operation, $save) { - $scope.title = title; - $scope.operation = operation; - $scope.$save = () => { - $scope.$hide(); - $save($scope.operation); - }; - }, - locals: { - title: title, - operation: operation, - $save: (operation: Operation) => { - this.save(operation); - } - } + modal.componentInstance.operation = operation; + + modal.result.then((operation: Operation) => { + this.save(operation); + }, (reason) => { }); };