sorted crusade cards
This commit is contained in:
parent
50bbb6a54d
commit
e6557fade3
@ -69,7 +69,7 @@
|
|||||||
<div class="col-md-1" style="border: 1px solid black; background: whitesmoke; color: #0f0f0f;">CRUSADE POINTS</div>
|
<div class="col-md-1" style="border: 1px solid black; background: whitesmoke; color: #0f0f0f;">CRUSADE POINTS</div>
|
||||||
<div class="col-md-1" style="border: 1px solid black; background: whitesmoke; color: #0f0f0f;">ADD TO FORCE</div>
|
<div class="col-md-1" style="border: 1px solid black; background: whitesmoke; color: #0f0f0f;">ADD TO FORCE</div>
|
||||||
</div>
|
</div>
|
||||||
<div *ngFor="let unit of army.units; let rowIndex=index">
|
<div *ngFor="let unit of sortUnits(army.units); let rowIndex=index">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-3" style="border: 1px solid black;">
|
<div class="col-md-3" style="border: 1px solid black;">
|
||||||
Unit {{rowIndex + 1}}:
|
Unit {{rowIndex + 1}}:
|
||||||
|
@ -35,7 +35,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngFor="let unit of army.units; let rowIndex=index">
|
<div *ngFor="let unit of sortUnits(army.units); let rowIndex=index">
|
||||||
|
<!-- <div *ngFor="let unit of army.units; let rowIndex=index">-->
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<div class="crusade-cards" style="padding-top: 10px">
|
<div class="crusade-cards" style="padding-top: 10px">
|
||||||
|
@ -4,7 +4,7 @@ import { JhiDataUtils } from 'ng-jhipster';
|
|||||||
import { LocalStorage } from 'ngx-webstorage';
|
import { LocalStorage } from 'ngx-webstorage';
|
||||||
|
|
||||||
import { IArmy } from 'app/shared/model/army.model';
|
import { IArmy } from 'app/shared/model/army.model';
|
||||||
import { UnitArmy } from '../../shared/model/unit-army.model';
|
import {IUnitArmy, UnitArmy} from '../../shared/model/unit-army.model';
|
||||||
import {DomSanitizer} from "@angular/platform-browser";
|
import {DomSanitizer} from "@angular/platform-browser";
|
||||||
import {ResponsiveService} from "../../responsive.service";
|
import {ResponsiveService} from "../../responsive.service";
|
||||||
|
|
||||||
@ -46,6 +46,15 @@ export class ArmyDetailComponent implements OnInit {
|
|||||||
console.log(msg);
|
console.log(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sortUnits(unitArmy: IUnitArmy[] | undefined): Array<UnitArmy> | undefined {
|
||||||
|
if (unitArmy) {
|
||||||
|
// @ts-ignore
|
||||||
|
unitArmy.sort((a,b) => a.unitName.localeCompare(b.unitName));
|
||||||
|
return unitArmy
|
||||||
|
}
|
||||||
|
return unitArmy
|
||||||
|
}
|
||||||
|
|
||||||
calculatePoints(armylocal: IArmy): Number {
|
calculatePoints(armylocal: IArmy): Number {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
if (armylocal['units']) {
|
if (armylocal['units']) {
|
||||||
|
Loading…
Reference in New Issue
Block a user