Fixed transaction submission

This commit is contained in:
piratefinn 2017-10-20 13:21:49 +01:00
parent 1ce755d2d3
commit 0a9e80fc97
3 changed files with 13 additions and 13 deletions

View file

@ -31,7 +31,7 @@
<span class="help-block">Enter the name of the organisation money was spent. Choose existing ones from below or if not found, enter the details below.</span>
</div>
</div>
<org-table *ngIf="storeList != null" [orgList]="storeList" (onClick)="addStore($event)"></org-table>
<org-table *ngIf="storeList.length > 0" [orgList]="storeList" (onClick)="addStore($event)"></org-table>
<div *ngIf="showAddStore">
<div class="form-group row">
<label class="col-md-3 form-control-label" for="text-input"><strong>Organisation Street Name</strong></label>

View file

@ -32,7 +32,7 @@ export class AddDataComponent implements OnInit {
organisationPostcode: string;
amount: number;
transactionAdditionType = 1;
storeList;
storeList = [];
showAddStore = false;
submitReceipt = false;
transactionFormInvalid = true;
@ -108,7 +108,7 @@ export class AddDataComponent implements OnInit {
}
// handle the case when the storelist is empty
if (this.storeList.length < 1) {
this.storeList = null;
this.storeList = [];
this.showAddStore = true;
this.transactionAdditionType = 3;
}
@ -135,7 +135,7 @@ export class AddDataComponent implements OnInit {
const val = ev.target.value;
// Filter the store list so search seems quicker
if (val && val.trim() !== '' && this.storeList !== null) {
if (val && val.trim() !== '' && this.storeList.length > 0) {
this.storeList = this.storeList.filter(
(item) => {
return ( item.name.toLowerCase().indexOf( val.toLowerCase() ) > -1 );