From 42a78a213b1b87c4b35680ffa468b0e990eac35f Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 20 Apr 2018 16:24:19 +0900 Subject: [PATCH] notification --- .../infra/component/map/map.component.html | 2 +- .../notification/notification.component.html | 4 ++++ .../notification/notification.component.ts | 21 ++++++++++++++++++- .../sensor/component/list/list.component.html | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/packages/infra/component/map/map.component.html b/src/packages/infra/component/map/map.component.html index 9d80824..31d69d6 100644 --- a/src/packages/infra/component/map/map.component.html +++ b/src/packages/infra/component/map/map.component.html @@ -17,7 +17,7 @@
Up - Dwon + Down Warn Error
diff --git a/src/packages/notification/component/notification/notification.component.html b/src/packages/notification/component/notification/notification.component.html index ce875db..60b649a 100644 --- a/src/packages/notification/component/notification/notification.component.html +++ b/src/packages/notification/component/notification/notification.component.html @@ -1,4 +1,8 @@

Notifications

+
+ Mark all as read +
+ diff --git a/src/packages/notification/component/notification/notification.component.ts b/src/packages/notification/component/notification/notification.component.ts index 9f3e7a6..636690c 100644 --- a/src/packages/notification/component/notification/notification.component.ts +++ b/src/packages/notification/component/notification/notification.component.ts @@ -22,6 +22,7 @@ export class NotificationComponent implements OnInit, AfterContentInit { pageSize = '12'; totalLength = 0; + currPage = 0; constructor( private router: Router, @@ -55,7 +56,7 @@ export class NotificationComponent implements OnInit, AfterContentInit { } ngAfterContentInit() { - this.getNotifications(0); + this.getNotifications(this.currPage); } updateData(noti: Notification) { @@ -79,6 +80,7 @@ export class NotificationComponent implements OnInit, AfterContentInit { sortDirection: 'descending' }; this.listStore.dispatch(new ListStore.ReadAllByMember({ member, pageParams })); + this.currPage = pageIndex; }, (error) => { console.log(error); @@ -95,4 +97,21 @@ export class NotificationComponent implements OnInit, AfterContentInit { onPaging(e) { this.getNotifications(e.page); } + + onMarkAllAsRead() { + this.listStore.select(AuthSelector.select('member')).subscribe( + (member: Member) => { + const pageParams: PageParams = { + pageNo: this.currPage + '', + countPerPage: this.pageSize, + sortCol: 'id', + sortDirection: 'descending' + }; + this.listStore.dispatch(new ListStore.MarkAllAsRead({ member, pageParams })); + }, + (error) => { + console.log(error); + } + ); + } } diff --git a/src/packages/sensor/component/list/list.component.html b/src/packages/sensor/component/list/list.component.html index 9cfb1c0..622477d 100644 --- a/src/packages/sensor/component/list/list.component.html +++ b/src/packages/sensor/component/list/list.component.html @@ -24,7 +24,7 @@
Up - Dwon + Down Warn Error