diff --git a/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.component.html b/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.component.html index 65193b9..d1d0e77 100644 --- a/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.component.html +++ b/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.component.html @@ -1,14 +1,14 @@

- + Id - Amount - Currency - Recipient - Actions + Amount + Currency + Recipient + Actions @@ -17,14 +17,19 @@ *ngIf="!editCache[expense.expenseID] || !editCache[expense.expenseID].edit; else editTemplate"> {{ expense.expenseID }} {{ expense.amount }} - {{ expense.currency }} + {{ currencies[expense.currency].name }} {{ expense.recipient }} Edit {{ expense.expenseID }} - + + + + + Save diff --git a/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.component.ts b/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.component.ts index 4c7bb56..3b96cc6 100644 --- a/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.component.ts +++ b/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.component.ts @@ -12,6 +12,12 @@ export class ExpenseComponent implements OnInit { expenses: Expense[]; editCache: { [key: string]: { edit: boolean; data: Expense } } = {}; readonly newRecordId: string = "n/a"; + readonly currencies = [ // TODO: find a better place for this + { id: 0, name: 'Eur' }, + { id: 1, name: 'Gbp' }, + { id: 2, name: 'Usd' }, + { id: 3, name: 'Chf' }, + ]; constructor(private expenseService: ExpenseService) { } @@ -41,7 +47,7 @@ export class ExpenseComponent implements OnInit { var record = this.editCache[id].data; delete record.expenseID; this.expenseService.create(record).subscribe((result) => { - Object.assign(this.expenses[this.expenses.length - 1] , result); + Object.assign(this.expenses[this.expenses.length - 1], result); this.updateEditCache(); }); } diff --git a/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.module.ts b/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.module.ts index c7a32c8..c6800ca 100644 --- a/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.module.ts +++ b/ExpenseTracker.Client/expense-tracker/src/app/expense/expense.module.ts @@ -5,7 +5,7 @@ import { ExpenseService } from '../shared/services/expense.service'; import { NzTableModule } from 'ng-zorro-antd/table'; import { FormsModule } from '@angular/forms'; import { NzButtonModule } from 'ng-zorro-antd/button'; - +import { NzSelectModule } from 'ng-zorro-antd/select'; @NgModule({ declarations: [ExpenseComponent], @@ -13,6 +13,7 @@ import { NzButtonModule } from 'ng-zorro-antd/button'; CommonModule, NzTableModule, NzButtonModule, + NzSelectModule, FormsModule ], providers: [