Compare commits
No commits in common. "dd6196555f3273d133d58bd83999e32fe621824a" and "ff0e6158626c0c5e92511fde50959dd2813d98e8" have entirely different histories.
dd6196555f
...
ff0e615862
|
@ -1,15 +0,0 @@
|
|||
.list-header {
|
||||
width: 100%;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
margin-right: 16px;
|
||||
margin-top: -3px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
:host/deep/.mat-icon {
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<div class="input-group list-header pull-left">
|
||||
<mat-button-toggle-group #group="matButtonToggleGroup">
|
||||
<mat-button-toggle *ngFor="let button of filterButtons" value="{{button.value}}" (change)="execute(group)">
|
||||
{{button.label}}
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
<button mat-icon-button class="add-btn">
|
||||
<mat-icon svgIcon="{{addButton.svgIcon}}"
|
||||
title="{{addButton.tooltip}}"
|
||||
(click)="add()"></mat-icon>
|
||||
</button>
|
||||
</div>
|
|
@ -1,28 +0,0 @@
|
|||
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'cc-list-filter',
|
||||
templateUrl: './list-filter.component.html',
|
||||
styleUrls: ['./list-filter.component.css']
|
||||
})
|
||||
export class ListFilterComponent {
|
||||
|
||||
@Input() filterButtons: any[];
|
||||
|
||||
@Input() addButton: any;
|
||||
|
||||
@Output() executeSearch = new EventEmitter();
|
||||
|
||||
@Output() openAddFrom = new EventEmitter();
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
execute(group) {
|
||||
this.executeSearch.emit(group);
|
||||
}
|
||||
|
||||
add() {
|
||||
this.openAddFrom.emit();
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
.list-header {
|
||||
width: 100%;
|
||||
padding-bottom: 20px;
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<div class="input-group list-header">
|
||||
<input id="search-field"
|
||||
type="text" #query class="form-control"
|
||||
(keyup.enter)="emitSearch()"
|
||||
[formControl]="searchTerm">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button"
|
||||
(click)="emitSearch()">
|
||||
Suchen
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
|
@ -1,43 +0,0 @@
|
|||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'cc-list-search',
|
||||
templateUrl: './search-field.component.html',
|
||||
styleUrls: ['./search-field.component.css']
|
||||
})
|
||||
export class SearchFieldComponent implements OnInit {
|
||||
|
||||
@Input() searchTerm;
|
||||
|
||||
@Output() executeSearch = new EventEmitter();
|
||||
|
||||
@Output() searchTermStream = new EventEmitter();
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private location: Location) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
const paramsObservable = this.route.queryParams
|
||||
.map(params => decodeURI(params['query'] || ''))
|
||||
.do(query => this.searchTerm.setValue(query));
|
||||
|
||||
const searchTermObservable = this.searchTerm.valueChanges
|
||||
.debounceTime(400)
|
||||
.do(query => this.adjustBrowserUrl(query));
|
||||
this.searchTermStream.emit({params: paramsObservable, searchTerm: searchTermObservable});
|
||||
}
|
||||
|
||||
emitSearch() {
|
||||
this.executeSearch.emit();
|
||||
}
|
||||
|
||||
adjustBrowserUrl(queryString = '') {
|
||||
const absoluteUrl = this.location.path().split('?')[0];
|
||||
const queryPart = queryString !== '' ? `query=${queryString}` : '';
|
||||
|
||||
this.location.replaceState(absoluteUrl, queryPart);
|
||||
}
|
||||
}
|
|
@ -1,18 +1,36 @@
|
|||
<div class="select-list">
|
||||
<cc-list-filter
|
||||
[filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
|
||||
{label: fraction.OPFOR, value: 'OPFOR'},
|
||||
{label: 'Global', value: 'GLOBAL'}]"
|
||||
[addButton]="{svgIcon: 'add', tooltip: 'Neue Auszeichnung hinzufügen'}"
|
||||
(executeSearch)="filterDecorations($event)"
|
||||
(openAddFrom)="openNewDecorationForm()">
|
||||
</cc-list-filter>
|
||||
<div class="input-group list-header pull-left">
|
||||
<mat-button-toggle-group #group="matButtonToggleGroup">
|
||||
<mat-button-toggle value="BLUFOR" (change)="filterDecorations(group)">
|
||||
{{fraction.BLUFOR}}
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="OPFOR" (change)="filterDecorations(group)">
|
||||
{{fraction.OPFOR}}
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="GLOBAL" (change)="filterDecorations(group)">
|
||||
Global
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
<button mat-icon-button class="add-btn">
|
||||
<mat-icon svgIcon="add" title="Neue Auszeichnung hinzufügen"
|
||||
(click)="openNewDecorationForm()"></mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<cc-list-search [searchTerm]="searchTerm"
|
||||
(searchTermStream)="initObservable($event)"
|
||||
(executeSearch)="filterDecorations()">
|
||||
</cc-list-search>
|
||||
<div class="input-group list-header">
|
||||
<input id="search-tasks"
|
||||
type="text" #query class="form-control"
|
||||
(keyup.enter)="filterDecorations()"
|
||||
[formControl]="searchTerm">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button"
|
||||
(click)="filterDecorations()">
|
||||
Suchen
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<decoration-item *ngFor="let decoration of decorations$ | async"
|
||||
[decoration]="decoration"
|
||||
(decorationDelete)="deleteDecoration(decoration)"
|
||||
|
@ -20,3 +38,5 @@
|
|||
[selected]="decoration._id == selectedDecorationId">
|
||||
</decoration-item>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
|
||||
import {FormControl} from '@angular/forms';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
|
@ -10,7 +11,7 @@ import {MatButtonToggleGroup} from '@angular/material';
|
|||
import {UIHelpers} from '../../utils/global.helpers';
|
||||
|
||||
@Component({
|
||||
selector: 'cc-decoration-list',
|
||||
selector: 'decoration-list',
|
||||
templateUrl: './decoration-list.component.html',
|
||||
styleUrls: ['./decoration-list.component.css', '../../style/select-list.css']
|
||||
})
|
||||
|
@ -28,15 +29,22 @@ export class DecorationListComponent implements OnInit {
|
|||
|
||||
constructor(private decorationService: DecorationService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {
|
||||
private route: ActivatedRoute,
|
||||
private location: Location) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.decorations$ = this.decorationService.decorations$;
|
||||
}
|
||||
|
||||
initObservable(observables: any) {
|
||||
Observable.merge(observables.params as Observable<string>, observables.searchTerm)
|
||||
const paramsStream = this.route.queryParams
|
||||
.map(params => decodeURI(params['query'] || ''))
|
||||
.do(query => this.searchTerm.setValue(query));
|
||||
|
||||
const searchTermStream = this.searchTerm.valueChanges
|
||||
.debounceTime(400)
|
||||
.do(query => this.adjustBrowserUrl(query));
|
||||
|
||||
Observable.merge(paramsStream, searchTermStream)
|
||||
.distinctUntilChanged()
|
||||
.switchMap(query => this.decorationService.findDecorations(query, this.radioModel))
|
||||
.subscribe();
|
||||
|
@ -71,4 +79,12 @@ export class DecorationListComponent implements OnInit {
|
|||
this.radioModel = UIHelpers.toggleReleaseButton(this.radioModel, group);
|
||||
this.decorations$ = this.decorationService.findDecorations(this.searchTerm.value, this.radioModel);
|
||||
}
|
||||
|
||||
adjustBrowserUrl(queryString = '') {
|
||||
const absoluteUrl = this.location.path().split('?')[0];
|
||||
const queryPart = queryString !== '' ? `query=${queryString}` : '';
|
||||
|
||||
this.location.replaceState(absoluteUrl, queryPart);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,10 +4,14 @@ import {CommonModule} from '@angular/common';
|
|||
import {DecorationStore} from '../services/stores/decoration.store';
|
||||
import {DecorationService} from '../services/army-management/decoration.service';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {MatButtonToggleModule} from '@angular/material';
|
||||
import {MatIconModule} from '@angular/material/icon';
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
|
||||
@NgModule({
|
||||
declarations: decorationsRoutingComponents,
|
||||
imports: [CommonModule, SharedModule, decorationRoutesModule],
|
||||
imports: [CommonModule, SharedModule, MatButtonToggleModule, MatButtonModule, MatIconModule,
|
||||
decorationRoutesModule],
|
||||
providers: [DecorationStore, DecorationService]
|
||||
})
|
||||
export class DecorationsModule {
|
||||
|
|
|
@ -1,22 +1,39 @@
|
|||
<div class="select-list">
|
||||
<cc-list-filter
|
||||
[filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
|
||||
{label: fraction.OPFOR, value: 'OPFOR'}]"
|
||||
[addButton]="{svgIcon: 'add', tooltip: 'Neuen Rang hinzufügen'}"
|
||||
(executeSearch)="filterRanks($event)"
|
||||
(openAddFrom)="openNewRankForm()">
|
||||
</cc-list-filter>
|
||||
<div class="list-header">
|
||||
<mat-button-toggle-group #group="matButtonToggleGroup">
|
||||
<mat-button-toggle value="BLUFOR" (change)="filterRanks(group)">
|
||||
{{fraction.BLUFOR}}
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="OPFOR" (change)="filterRanks(group)">
|
||||
{{fraction.OPFOR}}
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
<button mat-icon-button class="add-btn">
|
||||
<mat-icon svgIcon="add" title="Neuen Rang hinzufügen"
|
||||
(click)="openNewRankForm()"></mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<cc-list-search [searchTerm]="searchTerm"
|
||||
(searchTermStream)="initObservable($event)"
|
||||
(executeSearch)="filterRanks()">
|
||||
</cc-list-search>
|
||||
<div class="input-group list-header">
|
||||
<input id="search-tasks"
|
||||
type="text" #query class="form-control"
|
||||
(keyup.enter)="filterRanks()"
|
||||
[formControl]="searchTerm">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button"
|
||||
(click)="filterRanks()">
|
||||
Suchen
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<pjm-rank-item *ngFor="let rank of ranks$ | async"
|
||||
[rank]="rank"
|
||||
(rankDelete)="deleteRank(rank)"
|
||||
(rankSelected)="selectRank($event)"
|
||||
[selected]="rank._id == selectedRankId">
|
||||
</pjm-rank-item>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
|
||||
import {FormControl} from '@angular/forms';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
|
@ -10,7 +11,7 @@ import {UIHelpers} from '../../utils/global.helpers';
|
|||
import {MatButtonToggleGroup} from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'cc-rank-list',
|
||||
selector: 'rank-list',
|
||||
templateUrl: './rank-list.component.html',
|
||||
styleUrls: ['./rank-list.component.css', '../../style/select-list.css']
|
||||
})
|
||||
|
@ -28,20 +29,28 @@ export class RankListComponent implements OnInit {
|
|||
|
||||
constructor(private rankService: RankService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {
|
||||
private route: ActivatedRoute,
|
||||
private location: Location) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.ranks$ = this.rankService.ranks$;
|
||||
}
|
||||
|
||||
initObservable(observables: any) {
|
||||
Observable.merge(observables.params as Observable<string>, observables.searchTerm)
|
||||
this.ranks$ = this.rankService.ranks$;
|
||||
|
||||
const paramsStream = this.route.queryParams
|
||||
.map(params => decodeURI(params['query'] || ''))
|
||||
.do(query => this.searchTerm.setValue(query));
|
||||
|
||||
const searchTermStream = this.searchTerm.valueChanges
|
||||
.debounceTime(400)
|
||||
.do(query => this.adjustBrowserUrl(query));
|
||||
|
||||
Observable.merge(paramsStream, searchTermStream)
|
||||
.distinctUntilChanged()
|
||||
.switchMap(query => this.rankService.findRanks(query, this.radioModel))
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
openNewRankForm() {
|
||||
this.selectedRankId = null;
|
||||
|
@ -66,4 +75,11 @@ export class RankListComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
adjustBrowserUrl(queryString = '') {
|
||||
const absoluteUrl = this.location.path().split('?')[0];
|
||||
const queryPart = queryString !== '' ? `query=${queryString}` : '';
|
||||
|
||||
this.location.replaceState(absoluteUrl, queryPart);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,14 @@ import {SharedModule} from '../shared.module';
|
|||
import {CommonModule} from '@angular/common';
|
||||
import {RankService} from '../services/army-management/rank.service';
|
||||
import {RankStore} from '../services/stores/rank.store';
|
||||
import {MatButtonToggleModule} from '@angular/material';
|
||||
import {MatIconModule} from '@angular/material/icon';
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
|
||||
@NgModule({
|
||||
declarations: ranksRoutingComponents,
|
||||
imports: [CommonModule, SharedModule, rankRouterModule],
|
||||
imports: [CommonModule, SharedModule, MatButtonToggleModule, MatButtonModule, MatIconModule,
|
||||
rankRouterModule],
|
||||
providers: [RankStore, RankService]
|
||||
})
|
||||
export class RanksModule {
|
||||
|
|
|
@ -5,6 +5,7 @@ import {EditRankComponent} from './edit-rank/edit-rank.component';
|
|||
import {RankItemComponent} from './rank-list/rank-item.component';
|
||||
import {ModuleWithProviders} from '@angular/core';
|
||||
|
||||
|
||||
export const ranksRoutes: Routes = [{
|
||||
path: '', component: RankComponent,
|
||||
children: [
|
||||
|
|
|
@ -2,17 +2,11 @@ import {NgModule} from '@angular/core';
|
|||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||
import {ShowErrorComponent} from './common/show-error/show-error.component';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {ListFilterComponent} from './common/user-interface/list-filter/list-filter.component';
|
||||
import {SearchFieldComponent} from './common/user-interface/search-field/search-field.component';
|
||||
import {MatButtonToggleModule} from '@angular/material';
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
import {MatIconModule} from '@angular/material/icon';
|
||||
|
||||
@NgModule({
|
||||
declarations: [ShowErrorComponent, ListFilterComponent, SearchFieldComponent],
|
||||
imports: [CommonModule, FormsModule, ReactiveFormsModule, MatButtonToggleModule, MatButtonModule, MatIconModule],
|
||||
exports: [FormsModule, ReactiveFormsModule, MatButtonToggleModule, MatButtonModule, MatIconModule, ShowErrorComponent,
|
||||
ListFilterComponent, SearchFieldComponent],
|
||||
declarations: [ShowErrorComponent],
|
||||
imports: [CommonModule, FormsModule, ReactiveFormsModule],
|
||||
exports: [FormsModule, ReactiveFormsModule, ShowErrorComponent],
|
||||
})
|
||||
export class SharedModule {
|
||||
}
|
||||
|
|
|
@ -1,17 +1,33 @@
|
|||
<div class="select-list">
|
||||
<cc-list-filter
|
||||
[filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
|
||||
{label: fraction.OPFOR, value: 'OPFOR'}]"
|
||||
[addButton]="{svgIcon: 'add', tooltip: 'Neues Squad hinzufügen'}"
|
||||
(executeSearch)="filterSquads($event)"
|
||||
(openAddFrom)="openNewRankForm()">
|
||||
</cc-list-filter>
|
||||
<div class="list-header">
|
||||
<mat-button-toggle-group #group="matButtonToggleGroup">
|
||||
<mat-button-toggle value="BLUFOR" (change)="filterSquads(group)">
|
||||
{{fraction.BLUFOR}}
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="OPFOR" (change)="filterSquads(group)">
|
||||
{{fraction.OPFOR}}
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
<button mat-icon-button class="add-btn">
|
||||
<mat-icon svgIcon="add" title="Neues Squad hinzufügen"
|
||||
(click)="openNewSquadForm()"></mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<cc-list-search [searchTerm]="searchTerm"
|
||||
(searchTermStream)="initObservable($event)"
|
||||
(executeSearch)="filterSquads()">
|
||||
</cc-list-search>
|
||||
<div class="input-group search-bar">
|
||||
<input id="search-tasks"
|
||||
type="text" #query class="form-control"
|
||||
(keyup.enter)="filterSquads()"
|
||||
[formControl]="searchTerm">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button"
|
||||
(click)="filterSquads()">
|
||||
Suchen
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<pjm-squad-item *ngFor="let squad of squads$ | async"
|
||||
[squad]="squad"
|
||||
(squadDelete)="deleteSquad(squad)"
|
||||
|
@ -19,3 +35,5 @@
|
|||
[selected]="squad._id == selectedSquadId">
|
||||
</pjm-squad-item>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
|
||||
import {FormControl} from '@angular/forms';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
|
@ -10,7 +11,7 @@ import {UIHelpers} from '../../utils/global.helpers';
|
|||
import {MatButtonToggleGroup} from '@angular/material';
|
||||
|
||||
@Component({
|
||||
selector: 'cc-squad-list',
|
||||
selector: 'squad-list',
|
||||
templateUrl: './squad-list.component.html',
|
||||
styleUrls: ['./squad-list.component.css', '../../style/select-list.css']
|
||||
})
|
||||
|
@ -28,18 +29,27 @@ export class SquadListComponent implements OnInit {
|
|||
|
||||
constructor(private squadService: SquadService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {
|
||||
private route: ActivatedRoute,
|
||||
private location: Location) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.squads$ = this.squadService.squads$;
|
||||
}
|
||||
|
||||
initObservable(observables: any) {
|
||||
Observable.merge(observables.params as Observable<string>, observables.searchTerm)
|
||||
this.squads$ = this.squadService.squads$;
|
||||
|
||||
const paramsStream = this.route.queryParams
|
||||
.map(params => decodeURI(params['query'] || ''))
|
||||
.do(query => this.searchTerm.setValue(query));
|
||||
|
||||
const searchTermStream = this.searchTerm.valueChanges
|
||||
.debounceTime(400)
|
||||
.do(query => this.adjustBrowserUrl(query));
|
||||
|
||||
Observable.merge(paramsStream, searchTermStream)
|
||||
.distinctUntilChanged()
|
||||
.switchMap(query => this.squadService.findSquads(query, this.radioModel))
|
||||
.subscribe();
|
||||
|
||||
}
|
||||
|
||||
openNewSquadForm() {
|
||||
|
@ -65,4 +75,11 @@ export class SquadListComponent implements OnInit {
|
|||
this.radioModel = UIHelpers.toggleReleaseButton(this.radioModel, group);
|
||||
this.squads$ = this.squadService.findSquads(this.searchTerm.value, this.radioModel);
|
||||
}
|
||||
|
||||
adjustBrowserUrl(queryString = '') {
|
||||
const absoluteUrl = this.location.path().split('?')[0];
|
||||
const queryPart = queryString !== '' ? `query=${queryString}` : '';
|
||||
|
||||
this.location.replaceState(absoluteUrl, queryPart);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,14 @@ import {SharedModule} from '../shared.module';
|
|||
import {squadRouterModule, squadsRoutingComponents} from './squads.routing';
|
||||
import {SquadStore} from '../services/stores/squad.store';
|
||||
import {SquadService} from '../services/army-management/squad.service';
|
||||
import {MatButtonToggleModule} from '@angular/material';
|
||||
import {MatIconModule} from '@angular/material/icon';
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
|
||||
@NgModule({
|
||||
declarations: squadsRoutingComponents,
|
||||
imports: [CommonModule, SharedModule, squadRouterModule],
|
||||
imports: [CommonModule, SharedModule, MatButtonToggleModule, MatButtonModule, MatIconModule,
|
||||
squadRouterModule],
|
||||
providers: [SquadStore, SquadService]
|
||||
})
|
||||
export class SquadsModule {
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
.select-list {
|
||||
padding: 20px 2% 0 5%;
|
||||
}
|
||||
|
||||
.list-header {
|
||||
width: 100%;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.add-btn {
|
||||
margin-right: 16px;
|
||||
margin-top: -3px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
:host/deep/.mat-icon {
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,34 @@
|
|||
<div class="select-list">
|
||||
<cc-list-filter
|
||||
[filterButtons]="[{label: fraction.BLUFOR, value: 'BLUFOR'},
|
||||
{label: fraction.OPFOR, value: 'OPFOR'},
|
||||
{label: 'Ohne Squad', value: 'UNASSIGNED'}]"
|
||||
[addButton]="{svgIcon: 'add-user', tooltip: 'Neuen Teilnehmer hinzufügen'}"
|
||||
(executeSearch)="filterUsers(undefined, $event)"
|
||||
(openAddFrom)="openNewUserForm()">
|
||||
</cc-list-filter>
|
||||
<div class="input-group list-header pull-left">
|
||||
<mat-button-toggle-group #group="matButtonToggleGroup">
|
||||
<mat-button-toggle value="BLUFOR" (change)="filterUsers(undefined, group)">
|
||||
{{fraction.BLUFOR}}
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="OPFOR" (change)="filterUsers(undefined, group)">
|
||||
{{fraction.OPFOR}}
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="UNASSIGNED" (change)="filterUsers(undefined, group)">
|
||||
Ohne Squad
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
<button mat-icon-button class="add-btn">
|
||||
<mat-icon svgIcon="add-user" title="Neuen Teilnehmer hinzufügen"
|
||||
(click)="openNewUserForm()"></mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<cc-list-search [searchTerm]="searchTerm"
|
||||
(searchTermStream)="initObservable($event)"
|
||||
(executeSearch)="filterUsers()">
|
||||
</cc-list-search>
|
||||
<div class="input-group list-header">
|
||||
<input id="search-tasks"
|
||||
type="text" #query class="form-control"
|
||||
(keyup.enter)="filterUsers()"
|
||||
[formControl]="searchTerm">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-default" type="button"
|
||||
(click)="filterUsers()">
|
||||
Suchen
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="search-results"
|
||||
data-infinite-scroll
|
||||
|
@ -27,4 +44,5 @@
|
|||
[selected]="user._id == selectedUserId">
|
||||
</pjm-user-item>
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
|
|
|
@ -12,7 +12,7 @@ import {MatButtonToggleGroup} from '@angular/material';
|
|||
import {UIHelpers} from '../../utils/global.helpers';
|
||||
|
||||
@Component({
|
||||
selector: 'cc-user-list',
|
||||
selector: 'squad-list',
|
||||
templateUrl: './user-list.component.html',
|
||||
styleUrls: ['./user-list.component.css', '../../style/select-list.css']
|
||||
})
|
||||
|
@ -38,15 +38,22 @@ export class UserListComponent implements OnInit {
|
|||
|
||||
constructor(private userService: UserService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {
|
||||
private route: ActivatedRoute,
|
||||
private location: Location) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.users$ = this.userService.users$;
|
||||
}
|
||||
|
||||
initObservable(observables: any) {
|
||||
Observable.merge(observables.params as Observable<string>, observables.searchTerm)
|
||||
const paramsStream = this.route.queryParams
|
||||
.map(params => decodeURI(params['query'] || ''))
|
||||
.do(query => this.searchTerm.setValue(query));
|
||||
|
||||
const searchTermStream = this.searchTerm.valueChanges
|
||||
.debounceTime(400)
|
||||
.do(query => this.adjustBrowserUrl(query));
|
||||
|
||||
Observable.merge(paramsStream, searchTermStream)
|
||||
.distinctUntilChanged()
|
||||
.switchMap(query => this.filterUsers())
|
||||
.subscribe();
|
||||
|
@ -94,4 +101,11 @@ export class UserListComponent implements OnInit {
|
|||
this.filterUsers(ADD);
|
||||
}
|
||||
}
|
||||
|
||||
adjustBrowserUrl(queryString = '') {
|
||||
const absoluteUrl = this.location.path().split('?')[0];
|
||||
const queryPart = queryString !== '' ? 'query=${queryString}' : '';
|
||||
|
||||
this.location.replaceState(absoluteUrl, queryPart);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,15 @@ import {usersRouterModule, usersRoutingComponents} from './users.routing';
|
|||
import {CommonModule} from '@angular/common';
|
||||
import {SharedModule} from '../shared.module';
|
||||
import {InfiniteScrollModule} from 'ngx-infinite-scroll';
|
||||
import {MatButtonToggleModule} from '@angular/material';
|
||||
import {MatButtonModule} from '@angular/material/button';
|
||||
import {MatIconModule} from '@angular/material/icon';
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: usersRoutingComponents,
|
||||
imports: [CommonModule, SharedModule, InfiniteScrollModule, usersRouterModule],
|
||||
imports: [CommonModule, SharedModule, MatButtonToggleModule, MatButtonModule, MatIconModule,
|
||||
InfiniteScrollModule, usersRouterModule],
|
||||
})
|
||||
export class UsersModule {
|
||||
static routes = usersRouterModule;
|
||||
|
|
|
@ -34,5 +34,4 @@ export const usersRoutes: Routes = [{
|
|||
|
||||
export const usersRouterModule: ModuleWithProviders = RouterModule.forChild(usersRoutes);
|
||||
|
||||
export const usersRoutingComponents = [UserItemComponent, UsersComponent, UserListComponent, EditUserComponent,
|
||||
AwardUserComponent];
|
||||
export const usersRoutingComponents = [UserItemComponent, UsersComponent, UserListComponent, EditUserComponent, AwardUserComponent];
|
||||
|
|
Loading…
Reference in New Issue