Fixed app, added ability for non category transaction changed reset form

This commit is contained in:
piratefinn 2018-01-16 15:57:38 +00:00
parent d17a686490
commit 511969656e
2 changed files with 3 additions and 5 deletions

View file

@ -29,7 +29,7 @@
<div class="col-md-9"> <div class="col-md-9">
<div class="input-group"> <div class="input-group">
<select type="text" class="form-control" [(ngModel)]="categoryId"> <select type="text" class="form-control" [(ngModel)]="categoryId">
<option value="" disabled>Choose a category</option> <option value="">Uncategorised</option>
<option *ngFor="let category of categoryIdList, let i=index" [ngValue]="category" > <option *ngFor="let category of categoryIdList, let i=index" [ngValue]="category" >
{{ categoryNameList[i] }} {{ categoryNameList[i] }}
</option> </option>

View file

@ -30,7 +30,8 @@ export class AddDataComponent implements OnInit {
organisationTown: string; organisationTown: string;
organisationPostcode: string; organisationPostcode: string;
amount: number; amount: number;
categoryId: number; // Assumes Groceries is 1st category
categoryId: number = 1;
transactionAdditionType = 1; transactionAdditionType = 1;
storeList = []; storeList = [];
showAddStore = false; showAddStore = false;
@ -69,8 +70,6 @@ export class AddDataComponent implements OnInit {
// this.myDate = new Date().toISOString().slice(0, 16); // this.myDate = new Date().toISOString().slice(0, 16);
this.api.categoryList().subscribe( this.api.categoryList().subscribe(
result => { result => {
this.categories = result;
console.log(this.categories);
this.setCategoryList(result.categories); this.setCategoryList(result.categories);
}, },
error => { error => {
@ -261,7 +260,6 @@ export class AddDataComponent implements OnInit {
this.amount = null; this.amount = null;
this.transactionFormInvalid = true; this.transactionFormInvalid = true;
this.showAddStore = false; this.showAddStore = false;
this.categoryId = null;
} }
onSubmitPayroll() { onSubmitPayroll() {