Compare commits

...

3 Commits

5 changed files with 51 additions and 9 deletions

View File

@ -1,3 +1,12 @@
### Get Campaigns [GET /campaigns]
Get all campaigns information
+ Response 200 (application/json; charset=utf-8)
+ Attributes (array[Campaign], fixed-type)
### Get Campaign [GET /campaigns/{id}]
Get single campaign information

View File

@ -26,10 +26,6 @@ h1 {
background-color: #222222;
}
:host /deep/ .mat-tab-list {
margin-left: 10%;
}
:host /deep/ .mat-tab-label {
font-size: 16px;
color: #dadada;
@ -43,6 +39,10 @@ h1 {
background-color: #222222;
}
:host /deep/ div.mat-tab-body-wrapper {
box-shadow: #666666 2px 2px 8px;
}
:host /deep/ .mat-tab-body-content {
background-color: rgba(255, 255, 255, 0.35);
height: calc(100vh - 241px);
@ -54,8 +54,9 @@ h1 {
float: left;
width: 10%;
min-width: 100px;
height: calc(100vh - 188px);
height: calc(100vh - 192px);
background: #222222;;
box-shadow: #666666 2px 2px 8px;
}
.fraction-side-bar > div {

View File

@ -7,7 +7,7 @@
<div [ngClass]="{active: active === 'GLOBAL'}" (click)="switchFraction('GLOBAL')">GLOBAL</div>
</div>
<mat-tab-group>
<mat-tab-group [selectedIndex]="selectedType" (selectedIndexChange)="switchTab($event)">
<mat-tab label="Orden">
<ng-template matTabContent>
<cc-decoration-panel *ngFor="let decoration of medals"

View File

@ -6,6 +6,7 @@ import {Decoration} from '../../models/model-interfaces';
import {DecorationService} from '../../services/army-management/decoration.service';
import {MatBottomSheet} from '@angular/material';
import {UserListSheetComponent} from '../user-list-sheet/user-list-sheet.component';
import {Location} from '@angular/common';
@Component({
@ -23,10 +24,13 @@ export class DecorationOverviewComponent implements OnInit {
active: string;
selectedType = 0;
readonly fraction = Fraction;
constructor(private router: Router,
private route: ActivatedRoute,
private location: Location,
private decorationService: DecorationService,
private bottomSheet: MatBottomSheet) {
}
@ -36,17 +40,45 @@ export class DecorationOverviewComponent implements OnInit {
this.decorationService.findDecorations()
.subscribe(decorations => {
this.decorations = decorations;
const queryParams = this.route.snapshot.queryParams;
if (queryParams.type < 2) {
this.selectedType = queryParams.type;
}
const fract = queryParams.fraction;
if (fract && (fract === 'BLUFOR' || fract === 'OPFOR' || fract === 'GLOBAL')) {
this.switchFraction(queryParams.fraction);
} else {
this.switchFraction('BLUFOR');
}
});
};
switchFraction(value: string) {
switchFraction(value: any) {
this.medals = this.decorations.filter(d => d.fraction === value && d.isMedal);
this.ribbons = this.decorations.filter(d => d.fraction === value && !d.isMedal);
this.active = value;
this.adjustBrowserUrl(value)
}
switchTab(tabIndex) {
this.selectedType = tabIndex;
this.adjustBrowserUrl(this.active)
}
select(decoration: Decoration) {
this.bottomSheet.open(UserListSheetComponent, {data: {decoration: decoration}});
}
adjustBrowserUrl(fractionKey = '') {
const absoluteUrl = this.location.path().split('?')[0];
if (fractionKey === 'BLUFOR' && this.selectedType === 0) {
this.location.replaceState(absoluteUrl);
return;
}
const queryPart = fractionKey !== '' ? 'fraction='.concat(fractionKey)
.concat('&type=' + this.selectedType) : 'type=0';
this.location.replaceState(absoluteUrl, queryPart);
}
}

View File

@ -1,6 +1,6 @@
.decoration-card {
background: rgba(255, 255, 255, 0.87);
width: 229px;
width: 213px;
height: 258px;
margin: 7px 12px;
padding: 0;