Fix Operation Row component.

This commit is contained in:
Alexis Lahouze 2017-07-30 15:12:57 +02:00
parent 558988a57a
commit b7c2d94c62

View File

@ -17,7 +17,8 @@ import { OperationService } from './operation.service';
"[id]": "operation.id", "[id]": "operation.id",
"[class.stroke]": "operation.canceled", "[class.stroke]": "operation.canceled",
"[class.italic]": "!operation.confirmed", "[class.italic]": "!operation.confirmed",
"[class.warning]": "operation.balance < 0, danger: operation.balance < operationsCtrl.account.authorized_overdraft" "[class.warning]": "operation.balance < 0",
"[class.danger]": "operation.balance < account.authorized_overdraft"
}, },
template: ` template: `
<td>{{ operation.operation_date | date:"yyyy-MM-dd" }}</td> <td>{{ operation.operation_date | date:"yyyy-MM-dd" }}</td>
@ -37,14 +38,14 @@ import { OperationService } from './operation.service';
<div class="btn-group btn-group-sm"> <div class="btn-group btn-group-sm">
<!-- Edit operation, for non-canceled operation. --> <!-- Edit operation, for non-canceled operation. -->
<button type="button" class="btn btn-success" <button type="button" class="btn btn-success"
[hidden]="operation.canceled" *ngIf="!operation.canceled"
(click)="modify(operation)" title="edit"> (click)="modify(operation)" title="edit">
<span class="fa fa-pencil-square-o"></span> <span class="fa fa-pencil-square-o"></span>
</button> </button>
<!-- Toggle pointed operation, for non-canceled operations. --> <!-- Toggle pointed operation, for non-canceled operations. -->
<button type="button" class="btn btn-secondary" <button type="button" class="btn btn-secondary"
[hidden]="operation.canceled" *ngIf="!operation.canceled"
(click)="togglePointed(operation)" (click)="togglePointed(operation)"
[class.active]="operation.pointed" title="point"> [class.active]="operation.pointed" title="point">
<span class="fa" [class.fa-check-square-o]="operation.pointed" <span class="fa" [class.fa-check-square-o]="operation.pointed"
@ -54,15 +55,15 @@ import { OperationService } from './operation.service';
<!-- Toggle canceled operation. --> <!-- Toggle canceled operation. -->
<button type="button" class="btn btn-warning" <button type="button" class="btn btn-warning"
(click)="toggleCanceled(operation)" (click)="toggleCanceled(operation)"
[hidden]="!operation.scheduled_operation_id" *ngIf="operation.scheduled_operation_id"
[class.active]="operation.canceled" title="cancel"> [class.active]="operation.canceled" title="cancel">
<span class="fa fa-remove"></span> <span class="fa fa-remove"></span>
</button> </button>
<!-- Delete operation, with confirm. --> <!-- Delete operation, with confirm. -->
<button type="button" class="btn btn-danger" <button type="button" class="btn btn-danger"
(click)="confirmDelete(operation)"> (click)="confirmDelete(operation)"
[hidden]="!operation.id || operation.scheduled_operation_id" *ngIf="operation.id && !operation.scheduled_operation_id">
<span class="fa fa-trash-o"></span> <span class="fa fa-trash-o"></span>
</button> </button>
</div> </div>
@ -70,7 +71,8 @@ import { OperationService } from './operation.service';
` `
}) })
export class OperationRowComponent { export class OperationRowComponent {
@Input() operation: Operation; @Input('operation-row') operation: Operation;
@Input() account: Account;
@Output() needsReload: EventEmitter<void> = new EventEmitter<void>(); @Output() needsReload: EventEmitter<void> = new EventEmitter<void>();
constructor( constructor(