Merge branch 'master' into development

This commit is contained in:
piratefinn 2018-03-12 17:36:27 +00:00
commit 0b27aa43e4
2 changed files with 7 additions and 4 deletions

View file

@ -85,13 +85,13 @@
</div>
<div class="radio" *ngFor="let category of leftCategoryIdList, let i=index">
<input [value]="category" type="radio" name="radios" [(ngModel)]="categoryId">
<label>{{ categoryNameList[i] }}</label>
<label>{{ leftCategoryNameList[i] }}</label>
</div>
</div>
<div class="col-md-6">
<div class="radio" *ngFor="let category2 of rightCategoryIdList, let i=index">
<input [value]="category2" type="radio" name="radios" [(ngModel)]="categoryId">
<label>{{ categoryNameList[category2 - 1] }}</label>
<label>{{ rightCategoryNameList[i] }}</label>
</div>
</div>
</div>

View file

@ -44,7 +44,8 @@ export class AddDataComponent implements OnInit {
minDate: any;
leftCategoryIdList: number[] = [];
rightCategoryIdList: number[] = [];
categoryNameList: string[] = [];
leftCategoryNameList: number[] = [];
rightCategoryNameList: number[] = [];
constructor(
private formBuilder: FormBuilder,
@ -90,10 +91,12 @@ export class AddDataComponent implements OnInit {
private setCategoryList(data: any) {
let categoryIdList = Object.keys(data.ids).map(key => data.ids[key]);
this.categoryNameList = Object.keys(data.names).map(key => data.names[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;
}
getMinDate() {