2018-05-25 07:29:06 +00:00
|
|
|
import { Component, Input, EventEmitter, Output, ViewChild, OnInit, OnChanges, SimpleChanges } from '@angular/core';
|
2018-05-25 03:31:08 +00:00
|
|
|
import { Notification } from '@overflow/commons-typescript/model/notification';
|
2018-05-25 03:51:42 +00:00
|
|
|
import { Page } from '@overflow/commons-typescript/model/commons/Page';
|
2018-05-25 07:29:06 +00:00
|
|
|
import { Paginator } from 'primeng/primeng';
|
2018-05-25 03:31:08 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'of-notification-list',
|
|
|
|
templateUrl: './list.component.html',
|
|
|
|
})
|
2018-05-25 07:29:06 +00:00
|
|
|
export class NotificationListComponent implements OnChanges {
|
2018-05-25 03:31:08 +00:00
|
|
|
|
2018-05-25 03:51:42 +00:00
|
|
|
@Input() notificationPage: Page<Notification>;
|
2018-05-25 07:29:06 +00:00
|
|
|
@Output() pageChange = new EventEmitter<number>();
|
|
|
|
@Output() markAll = new EventEmitter();
|
|
|
|
@Output() select = new EventEmitter();
|
|
|
|
@ViewChild('paginator') paginator: Paginator;
|
|
|
|
|
|
|
|
ngOnChanges(changes: SimpleChanges): void {
|
|
|
|
if (changes['notificationPage']) {
|
|
|
|
this.paginator.changePage(this.notificationPage.number);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onPaginate(e) {
|
|
|
|
this.pageChange.emit(e.page);
|
|
|
|
}
|
|
|
|
|
|
|
|
onRowSelect(e) {
|
|
|
|
this.select.emit(e.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
onMarkAllAsRead() {
|
|
|
|
this.markAll.emit();
|
|
|
|
}
|
2018-05-25 03:31:08 +00:00
|
|
|
}
|