Add global decorations filter; Add noSquad user filter

pull/1/head
Florian Hartwich 2017-05-23 13:16:47 +02:00
parent 67d6260c32
commit a3df38263e
5 changed files with 22 additions and 8 deletions

View File

@ -31,7 +31,7 @@ decoration.route('/')
if (req.query.q) { if (req.query.q) {
filter.name = {$regex: req.query.q, $options: 'i'} filter.name = {$regex: req.query.q, $options: 'i'}
} }
DecorationModel.find(filter, {}, {sort: {fraction: 'asc', sortingNumber: 'asc', name: 'asc'}}, (err, items) => { DecorationModel.find(filter, {}, {sort: {fraction: 'asc', isMedal: 'asc', sortingNumber: 'asc', name: 'asc'}}, (err, items) => {
if (err) { if (err) {
err.status = codes.servererror; err.status = codes.servererror;
return next(err); return next(err);

View File

@ -56,7 +56,9 @@ users.route('/')
if (!nameQuery || (nameQuery && user.username.toLowerCase().includes(nameQuery.toLowerCase()))) { if (!nameQuery || (nameQuery && user.username.toLowerCase().includes(nameQuery.toLowerCase()))) {
getExtendedUser(user, next, (extUser) => { getExtendedUser(user, next, (extUser) => {
// filter by fraction // filter by fraction
if (!fractionFilter || (fractionFilter && extUser.squad && extUser.squad.fraction.toLowerCase() === fractionFilter)) { if (!fractionFilter ||
(fractionFilter && extUser.squad && extUser.squad.fraction.toLowerCase() === fractionFilter) ||
(fractionFilter && fractionFilter === 'unassigned' && !extUser.squad)) {
resUsers.push(extUser); resUsers.push(extUser);
} else { } else {
rowsLength -= 1; rowsLength -= 1;
@ -174,7 +176,7 @@ users.route('/:id')
}) })
}) })
.put(apiAuthenticationMiddleware, (req, res,next) => { .put(apiAuthenticationMiddleware, (req, res, next) => {
// first check that the given element id is the same as the URL id // first check that the given element id is the same as the URL id
if (!req.body || req.body._id !== req.params.id) { if (!req.body || req.body._id !== req.params.id) {
// the URL does not fit the given element // the URL does not fit the given element

View File

@ -20,6 +20,14 @@
#fractRadioOpfor #fractRadioOpfor
(change)="filterSquadsByFraction(query.value, fractRadioOpfor.value)">CSAT (change)="filterSquadsByFraction(query.value, fractRadioOpfor.value)">CSAT
</label> </label>
<br>
<label class="radio-inline" style="padding-top: 8px;">
<input type="radio" name="fractSelect" value="global"
[(ngModel)]="fractionRadioSelect"
#fractRadioGlobal
(change)="filterSquadsByFraction(query.value, fractRadioGlobal.value)">Global
</label>
</form> </form>
<a class="pull-right btn btn-success" (click)="openNewSquadForm()"> <a class="pull-right btn btn-success" (click)="openNewSquadForm()">
Neue Auszeichnung hinzufügen Neue Auszeichnung hinzufügen

View File

@ -25,8 +25,7 @@
overflow-x: hidden; overflow-x: hidden;
width: 100%; width: 100%;
border-left: thin solid lightgrey; border-left: thin solid lightgrey;
padding-left: 50px; padding: 20px 0 0 50px;
padding-top: 20px;
margin-left: 10px; margin-left: 10px;
height: 100vh; height: 100vh;
bottom: 10px; bottom: 10px;
@ -37,9 +36,7 @@
} }
h3 { h3 {
margin-top: 80px; margin: 80px 0 20px -20px;
margin-bottom: 20px;
margin-left: -20px;
} }
label { label {

View File

@ -20,6 +20,13 @@
#fractRadioOpfor #fractRadioOpfor
(change)="filterUsersByFraction(query.value, fractRadioOpfor.value)">CSAT (change)="filterUsersByFraction(query.value, fractRadioOpfor.value)">CSAT
</label> </label>
<br>
<label class="radio-inline" style="padding-top: 8px;">
<input type="radio" name="fractSelect" value="unassigned"
[(ngModel)]="fractionRadioSelect"
#fractRadioUnassigned
(change)="filterUsersByFraction(query.value, fractRadioUnassigned.value)">Ohne Squad
</label>
</form> </form>
<a class="pull-right btn btn-success" (click)="openNewUserForm()"> <a class="pull-right btn btn-success" (click)="openNewUserForm()">
Neuen Teilnehmer hinzufügen Neuen Teilnehmer hinzufügen