fixed upload submissions

This commit is contained in:
piratefinn 2018-03-14 20:05:46 +00:00
parent e1dfa37f63
commit c45790c7e9
2 changed files with 15 additions and 20 deletions

View file

@ -48,19 +48,19 @@
<div class="row">
<div class="col-md-6 btn-group-vertical">
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'daily'">
<input value="daily" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Daily
<input value="daily" type="radio" name="radios" style="display:none;" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">Daily
</label>
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'weekly'">
<input value="weekly" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Weekly
<input value="weekly" type="radio" name="radios" style="display:none;" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">Weekly
</label>
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'fortnightly'">
<input value="fortnightly" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Fortnightly
<input value="fortnightly" type="radio" name="radios" style="display:none;" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">Fortnightly
</label>
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'monthly'">
<input value="monthly" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Monthly
<input value="monthly" type="radio" name="radios" style="display:none;" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">Monthly
</label>
<label class="btn btn-secondary mb-0" [class.active]="recurringType == 'quarterly'">
<input value="quarterly" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId" (ngModelChange)="transactionFormValidate()">Quarterly
<input value="quarterly" type="radio" name="radios" style="display:none;" [(ngModel)]="recurringType" (ngModelChange)="transactionFormValidate()">Quarterly
</label>
</div>
</div>
@ -75,13 +75,13 @@
<label class="btn btn-secondary mb-0" [class.active]="categoryId == ''">
<input value="" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId">Uncategorised
</label>
<label *ngFor="let category of leftCategoryIdList, let i=index" class="btn btn-secondary mb-0" [class.active]="categoryId == category">
<input [value]="category" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId">{{ leftCategoryNameList[i] }}
<label *ngFor="let category of leftCategoryList" class="btn btn-secondary mb-0" [class.active]="categoryId == category.id">
<input [value]="category.id" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId">{{ category.name }}
</label>
</div>
<div class="col-md-6 btn-group-vertical">
<label *ngFor="let category2 of rightCategoryIdList, let i=index" class="btn btn-secondary mb-0" [class.active]=" categoryId == category2">
<input [value]="category2" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId">{{ rightCategoryNameList[i] }}
<label *ngFor="let category2 of rightCategoryList" class="btn btn-secondary mb-0" [class.active]=" categoryId == category2.id">
<input [value]="category2.id" type="radio" name="radios" style="display:none;" [(ngModel)]="categoryId">{{ category2.name }}
</label>
</div>
</div>

View file

@ -30,8 +30,6 @@ export class AddDataComponent implements OnInit {
organisationTown: string;
organisationPostcode: string;
amount: number;
// Assumes Groceries is 1st category
categoryId: number = 1;
essentialPurchase = false;
recurringPurchase = false;
recurringType: string;
@ -44,8 +42,9 @@ export class AddDataComponent implements OnInit {
minDate: any;
leftCategoryIdList: number[] = [];
rightCategoryIdList: number[] = [];
leftCategoryNameList: number[] = [];
rightCategoryNameList: number[] = [];
leftCategoryNameList: string[] = [];
rightCategoryNameList: string[] = [];
categoryList: any;
constructor(
private formBuilder: FormBuilder,
@ -90,13 +89,9 @@ export class AddDataComponent implements OnInit {
}
private setCategoryList(data: any) {
let categoryIdList = Object.keys(data.ids).map(key => data.ids[key]);
let categoryNameList = Object.keys(data.names).map(key => data.names[key]);
let halfLength = Math.floor(categoryIdList.length / 2);
this.leftCategoryIdList = categoryIdList.splice(0, halfLength);
this.leftCategoryNameList = categoryNameList.splice(0, halfLength);
this.rightCategoryIdList = categoryIdList;
this.rightCategoryNameList = categoryNameList;
let halfLength = Math.floor(data.length / 2);
this.leftCategoryList = data.splice(0, halfLength);
this.rightCategoryList = data;
}
getMinDate() {