opt-cc/static/src/app/manage/users/user-list/user-item.component.ts

40 lines
959 B
TypeScript
Raw Normal View History

2018-03-07 11:56:50 +01:00
import {ChangeDetectionStrategy, Component, EventEmitter, Input, Output} from '@angular/core';
import {User} from '../../../models/model-interfaces';
import {Fraction} from '../../../utils/fraction.enum';
import {LoginService} from '../../../services/app-user-service/login-service';
2017-05-10 11:04:06 +02:00
@Component({
selector: 'cc-user-item',
2017-05-10 11:04:06 +02:00
templateUrl: './user-item.component.html',
styleUrls: ['./user-item.component.scss'],
2018-03-07 11:56:50 +01:00
changeDetection: ChangeDetectionStrategy.OnPush
2017-05-10 11:04:06 +02:00
})
export class UserItemComponent {
2018-03-07 11:56:50 +01:00
@Input() user: User;
2017-05-10 11:04:06 +02:00
2018-03-07 11:56:50 +01:00
@Input() selected: boolean;
@Output() userSelected = new EventEmitter();
@Output() userAward = new EventEmitter();
@Output() userDelete = new EventEmitter();
2017-05-10 11:04:06 +02:00
2017-11-08 19:40:51 +01:00
readonly fraction = Fraction;
2017-05-10 11:04:06 +02:00
constructor(public loginService: LoginService) {
2017-05-10 11:04:06 +02:00
}
select() {
2018-03-07 11:56:50 +01:00
this.userSelected.emit(this.user._id);
2017-05-10 11:04:06 +02:00
}
2017-05-13 14:57:40 +02:00
award() {
2018-03-07 11:56:50 +01:00
this.userAward.emit(this.user._id);
2017-05-13 14:57:40 +02:00
}
2017-05-10 11:04:06 +02:00
delete() {
this.userDelete.emit(this.user);
}
}