Filter requestable awards to user fraction + alternative fraction
parent
df7edc873c
commit
af2a8882af
|
@ -37,11 +37,14 @@ decorationRouter.route('/')
|
|||
.get((req, res, next) => {
|
||||
const filter = {};
|
||||
if (req.query.fractFilter) {
|
||||
filter.fraction = req.query.fractFilter.toUpperCase();
|
||||
filter.fraction = { "$in" : req.query.fractFilter
|
||||
.toUpperCase()
|
||||
.split(',')};
|
||||
}
|
||||
if (req.query.q) {
|
||||
filter.name = {$regex: req.query.q, $options: 'i'};
|
||||
}
|
||||
console.log(filter)
|
||||
DecorationModel.find(filter, {}, {
|
||||
sort: {
|
||||
fraction: 'asc',
|
||||
|
|
|
@ -35,12 +35,10 @@
|
|||
</div>
|
||||
|
||||
<div class="div-table-row" [style.display]="decoPreviewDisplay" style="margin-top: 5px; margin-bottom:10px">
|
||||
<div class="col-sm-1 decoration-preview">
|
||||
<div class="decoration-preview">
|
||||
<img class="center-block" #decoPreview>
|
||||
</div>
|
||||
<div class="col-sm-2"
|
||||
style="border-radius: 0px 15px 15px 0px; font-style: oblique" #decoDescription>
|
||||
|
||||
<div style="border-radius: 0px 15px 15px 0px; font-style: oblique; padding: 0 10px" #decoDescription>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import {DecorationService} from '../../services/army-management/decoration.servi
|
|||
import {UserService} from '../../services/army-management/user.service';
|
||||
import {LoginService} from '../../services/app-user-service/login-service';
|
||||
import {SnackBarService} from '../../services/user-interface/snack-bar/snack-bar.service';
|
||||
import {Fraction} from '../../utils/fraction.enum';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -47,7 +48,13 @@ export class RequestAwardComponent implements OnInit {
|
|||
this.userService.findUsers({squadId: currentUser.squad._id}).subscribe(users => {
|
||||
this.users = users;
|
||||
});
|
||||
this.decorationService.findDecorations('', currentUser.squad.fraction).subscribe(decorations => {
|
||||
|
||||
const selectableFractions = [
|
||||
(currentUser.squad.fraction === Fraction.BLUFOR) ? Fraction.ARF : Fraction.SWORD,
|
||||
currentUser.squad.fraction
|
||||
];
|
||||
|
||||
this.decorationService.findDecorations('', selectableFractions).subscribe(decorations => {
|
||||
this.decorations = decorations;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
export enum Fraction {
|
||||
ARF = 'ARF',
|
||||
COLOR_ARF = '#668866',
|
||||
COLOR_ARF = '#336699',
|
||||
SWORD = 'SWORD',
|
||||
COLOR_SWORD = '#9499a1',
|
||||
COLOR_SWORD = '#8b8b8b',
|
||||
BLUFOR = 'NATO',
|
||||
OPFOR = 'CSAT',
|
||||
COLOR_BLUFOR = '#3c5fa1',
|
||||
|
|
Loading…
Reference in New Issue