Add Operation Delete Modal component.

This commit is contained in:
Alexis Lahouze 2017-07-30 15:22:25 +02:00
parent 072efe7fc3
commit b5e4b1cd08
2 changed files with 48 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import { OperationRowComponent } from './operationRow.component';
import { CategoryService } from './category.service';
import { OperationService } from './operation.service';
import { OperationListComponent } from './operationList.component';
import { OperationDeleteModalComponent } from './operationDeleteModal.component';
export function $modalServiceFactory(i: any) {
return i.get('$modal');
@ -49,12 +50,14 @@ export function accountIdServiceFactory(i: any) {
CategoryChartComponent,
OperationRowComponent,
OperationListComponent,
OperationDeleteModalComponent,
],
entryComponents: [
BalanceChartComponent,
CategoryChartComponent,
OperationRowComponent,
OperationListComponent,
OperationDeleteModalComponent,
]
})
export class OperationModule {}

View File

@ -0,0 +1,45 @@
// vim: set tw=80 ts=2 sw=2 sts=2:
import { Component, Input } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { Operation } from './operation';
@Component({
selector: 'operation-delete-modal',
template: `
<div class="modal-header">
<h3 class="modal-title" id="modal-title">Delete Operation #{{ operation.id }}</h3>
</div>
<div class="modal-body" id="modal-body">
<p>
Do you really want to delete operation #{{ operation.id }} with label:<br/>
{{ operation.label }}
</p>
</div>
<div class="modal-footer">
<button class="btn btn-danger" (click)="submit()">
Yes
</button>
<button class="btn btn-default" (click)="cancel()">
No
</button>
</div>
`
})
export class OperationDeleteModalComponent {
@Input() operation: Operation
constructor(private activeModal: NgbActiveModal) {}
submit(): void {
this.activeModal.close(this.operation);
}
cancel(): void {
this.activeModal.dismiss("closed");
}
}