Added meta data to transaction list

This commit is contained in:
Finn 2019-07-12 20:47:01 +01:00
parent 17fc5b006b
commit a3522bd902
4 changed files with 17 additions and 3 deletions

View file

@ -101,18 +101,24 @@
<div class="card-header"> <div class="card-header">
<strong>Log of Outgoing Transactions</strong> <strong>Log of Outgoing Transactions</strong>
<small>This lists all purchases that have been submitted.</small> <small>This lists all purchases that have been submitted.</small>
<button class="btn pull-right btn-sm" (click)="toggleShowMeta()">
<span *ngIf="!showMeta">Show</span><span *ngIf="showMeta">Hide</span> Details
</button>
</div> </div>
<div *ngIf="!noTransactionList" class="card-block"> <div *ngIf="!noTransactionList" class="card-block">
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead> <thead>
<tr> <tr>
<th>Seller</th> <th>Seller</th>
<th>Value</th> <th *ngIf="!showMeta">Value</th>
<th *ngIf="showMeta">Net Value</th>
<th *ngIf="showMeta">Sales Tax Value</th>
<th *ngIf="showMeta">Gross Value</th>
<th>Purchase Time</th> <th>Purchase Time</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr transaction-result *ngFor="let transaction of transactionList | paginate: paginateConfig" [transaction]="transaction"></tr> <tr transaction-result *ngFor="let transaction of transactionList | paginate: paginateConfig" [transaction]="transaction" [showMeta]="showMeta"></tr>
</tbody> </tbody>
</table> </table>
<pagination-template #p="paginationApi" <pagination-template #p="paginationApi"

View file

@ -29,6 +29,7 @@ export class TransactionLogComponent implements OnInit {
transactionFormStatusSuccess: string; transactionFormStatusSuccess: string;
transactionFormStatusError = 'Error received, please try again.'; transactionFormStatusError = 'Error received, please try again.';
updatedTime: string; updatedTime: string;
showMeta = false;
public paginateConfig: PaginationInstance = { public paginateConfig: PaginationInstance = {
id: 'transpaginate', id: 'transpaginate',
@ -162,4 +163,7 @@ export class TransactionLogComponent implements OnInit {
); );
} }
toggleShowMeta() {
this.showMeta = !this.showMeta;
}
} }

View file

@ -1,3 +1,6 @@
<td>{{transaction.seller}}</td> <td>{{transaction.seller}}</td>
<td>{{transaction.value | currency:'GBP':'symbol':'1.2-2' }}</td> <td *ngIf="!showMeta">{{transaction.value | currency:'GBP':'symbol':'1.2-2' }}</td>
<td *ngIf="showMeta">{{transaction.net_value | currency:'GBP':'symbol':'1.2-2' }}</td>
<td *ngIf="showMeta">{{transaction.sales_tax_value | currency:'GBP':'symbol':'1.2-2' }}</td>
<td *ngIf="showMeta">{{transaction.gross_value | currency:'GBP':'symbol':'1.2-2' }}</td>
<td>{{transactionDate}}</td> <td>{{transactionDate}}</td>

View file

@ -14,6 +14,7 @@ interface TransactionData {
}) })
export class TransactionResultComponent implements OnInit { export class TransactionResultComponent implements OnInit {
@Input() public transaction: TransactionData; @Input() public transaction: TransactionData;
@Input() public showMeta: boolean;
public transactionDate: string; public transactionDate: string;
ngOnInit(): void { ngOnInit(): void {