Add material button toggle to user management
parent
eebcbc32a5
commit
0aefb9c6d9
|
@ -1,10 +1,16 @@
|
|||
<div class="select-list">
|
||||
<div class="input-group list-header pull-left">
|
||||
<div class="btn-group" (click)="filterUsers()">
|
||||
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="BLUFOR" uncheckable>{{fraction.BLUFOR}}</label>
|
||||
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="OPFOR" uncheckable>{{fraction.OPFOR}}</label>
|
||||
<label class="btn btn-success" [(ngModel)]="radioModel" btnRadio="UNASSIGNED" uncheckable>Ohne Squad</label>
|
||||
</div>
|
||||
<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>
|
||||
<a class="pull-right btn btn-success" (click)="openNewUserForm()">+</a>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ import {UserService} from '../../services/army-management/user.service';
|
|||
import {User} from '../../models/model-interfaces';
|
||||
import {ADD, LOAD} from '../../services/stores/user.store';
|
||||
import {Fraction} from '../../utils/fraction.enum';
|
||||
import {MatButtonToggleGroup} from '@angular/material';
|
||||
import {UIHelpers} from '../../utils/global.helpers';
|
||||
|
||||
@Component({
|
||||
selector: 'squad-list',
|
||||
|
@ -22,7 +24,7 @@ export class UserListComponent implements OnInit {
|
|||
|
||||
searchTerm = new FormControl();
|
||||
|
||||
public radioModel: string;
|
||||
radioModel: string = '';
|
||||
|
||||
throttle = 300;
|
||||
|
||||
|
@ -80,11 +82,12 @@ export class UserListComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
filterUsers(action?) {
|
||||
filterUsers(action?, group?:MatButtonToggleGroup) {
|
||||
if (!action || action === LOAD) {
|
||||
this.offset = 0;
|
||||
this.limit = 20;
|
||||
}
|
||||
this.radioModel = UIHelpers.toggleReleaseButton(this.radioModel, group);
|
||||
return this.users$ = this.userService.findUsers(this.searchTerm.value, this.radioModel,
|
||||
null, this.limit, this.offset, action);
|
||||
}
|
||||
|
|
|
@ -2,12 +2,12 @@ import {NgModule} from '@angular/core';
|
|||
import {usersRouterModule, usersRoutingComponents} from './users.routing';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {SharedModule} from '../shared.module';
|
||||
import {ButtonsModule} from 'ngx-bootstrap';
|
||||
import {InfiniteScrollModule} from 'ngx-infinite-scroll';
|
||||
import {MatButtonToggleModule} from '@angular/material';
|
||||
|
||||
@NgModule({
|
||||
declarations: usersRoutingComponents,
|
||||
imports: [CommonModule, SharedModule, ButtonsModule.forRoot(), InfiniteScrollModule, usersRouterModule],
|
||||
imports: [CommonModule, SharedModule, MatButtonToggleModule, InfiniteScrollModule, usersRouterModule],
|
||||
})
|
||||
export class UsersModule {
|
||||
static routes = usersRouterModule;
|
||||
|
|
Loading…
Reference in New Issue