@sgcloud-sgsistemas/base 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/modules/side-menu/components/sub-category/sub-category.style.scss +0 -2
- package/src/modules/topbar/components/notifications/notifications.controller.js +37 -35
- package/src/modules/topbar/components/notifications/notifications.styles.scss +14 -1
- package/src/modules/topbar/components/notifications/notifications.template.html +122 -46
- package/src/modules/topbar/services/base-notification-service.js +57 -8
package/package.json
CHANGED
|
@@ -1,42 +1,20 @@
|
|
|
1
1
|
const controller = ($scope, $timeout, baseNotificationService, $sce) => {
|
|
2
2
|
const vm = $scope
|
|
3
|
-
vm.
|
|
4
|
-
vm.notificationsNews = []
|
|
5
|
-
vm.notificationsOlds = []
|
|
3
|
+
vm.notifications
|
|
6
4
|
vm.total = 0
|
|
7
|
-
vm.totalDisplay = 0
|
|
8
5
|
|
|
9
|
-
vm.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
vm.deleteAllRead = () => {
|
|
7
|
+
baseNotificationService.deleteAllRead()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
vm.readAll = () => {
|
|
11
|
+
baseNotificationService.readAll()
|
|
14
12
|
}
|
|
15
13
|
|
|
16
|
-
const separatorNotications = (notifications
|
|
17
|
-
vm.totalDisplay = notifications.length
|
|
14
|
+
const separatorNotications = (notifications) => {
|
|
18
15
|
vm.total = baseNotificationService.total
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
vm.notificationsOlds = notifications.filter((n) => n.read)
|
|
22
|
-
if (vm.notificationsNews.length > 0 || vm.notificationsOlds.length > 0) {
|
|
23
|
-
$timeout(() => {
|
|
24
|
-
vm.notifications = []
|
|
25
|
-
if (vm.notificationsNews.length > 0) {
|
|
26
|
-
vm.notifications.push({
|
|
27
|
-
label: 'Novas',
|
|
28
|
-
active: false,
|
|
29
|
-
items: vm.notificationsNews
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
if (vm.notificationsOlds.length > 0) {
|
|
33
|
-
vm.notifications.push({
|
|
34
|
-
label: `Anteriores`,
|
|
35
|
-
active: true,
|
|
36
|
-
items: vm.notificationsOlds
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
})
|
|
16
|
+
if (notifications) {
|
|
17
|
+
vm.notifications = notifications
|
|
40
18
|
}
|
|
41
19
|
}
|
|
42
20
|
|
|
@@ -70,6 +48,7 @@ const controller = ($scope, $timeout, baseNotificationService, $sce) => {
|
|
|
70
48
|
vm.toogle = () => {
|
|
71
49
|
vm.notificationOpen = !vm.notificationOpen
|
|
72
50
|
if (vm.notificationOpen) {
|
|
51
|
+
baseNotificationService.getNotifications()
|
|
73
52
|
$timeout(() => document.addEventListener('dblclick', onClickOutside))
|
|
74
53
|
} else {
|
|
75
54
|
$timeout(() => document.removeEventListener('dblclick', onClickOutside))
|
|
@@ -92,11 +71,34 @@ const controller = ($scope, $timeout, baseNotificationService, $sce) => {
|
|
|
92
71
|
}
|
|
93
72
|
|
|
94
73
|
vm.removeNotification = (notification) => {
|
|
95
|
-
|
|
74
|
+
baseNotificationService.removeNotification(notification.id)
|
|
75
|
+
$timeout(() => {
|
|
76
|
+
vm.notifications.read = vm.notifications.read.filter((not) => not.id != notification.id)
|
|
77
|
+
vm.notifications.countRead = vm.notifications.countRead - 1
|
|
78
|
+
if (vm.notifications.read.length == 0) {
|
|
79
|
+
baseNotificationService.getNotifications()
|
|
80
|
+
}
|
|
81
|
+
}, 500)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
vm.markRead = (notification) => {
|
|
85
|
+
baseNotificationService.markRead(notification.id)
|
|
86
|
+
$timeout(() => {
|
|
87
|
+
vm.notifications.unread = vm.notifications.unread.filter((not) => not.id != notification.id)
|
|
88
|
+
vm.notifications.countUnread = vm.notifications.countUnread - 1
|
|
89
|
+
baseNotificationService.seeMoreRead(0, vm.notifications.pageSizeRead)
|
|
90
|
+
if (vm.notifications.unread.length == 0) {
|
|
91
|
+
baseNotificationService.getNotifications()
|
|
92
|
+
}
|
|
93
|
+
}, 500)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
vm.seeMoreUnread = () => {
|
|
97
|
+
baseNotificationService.seeMoreUnread(parseInt(vm.notifications.unread.length / vm.notifications.pageSizeUnread), vm.notifications.pageSizeUnread)
|
|
96
98
|
}
|
|
97
99
|
|
|
98
|
-
vm.
|
|
99
|
-
baseNotificationService.
|
|
100
|
+
vm.seeMoreRead = () => {
|
|
101
|
+
baseNotificationService.seeMoreRead(parseInt(vm.notifications.read.length / vm.notifications.pageSizeRead), vm.notifications.pageSizeRead)
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
vm.openSetting = () => {
|
|
@@ -263,7 +263,20 @@ mb-topbar-notifications {
|
|
|
263
263
|
align-items: center;
|
|
264
264
|
justify-content: space-between;
|
|
265
265
|
padding-right: 14px;
|
|
266
|
-
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.mark-read-notification {
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-direction: column;
|
|
271
|
+
align-items: center;
|
|
272
|
+
justify-content: space-between;
|
|
273
|
+
padding-right: 14px;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.fas.fa-eye {
|
|
277
|
+
font-size: 18px;
|
|
278
|
+
color: #666;
|
|
279
|
+
}
|
|
267
280
|
|
|
268
281
|
.fas.fa-times {
|
|
269
282
|
font-size: 18px;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
ng-class="{open: notificationOpen}">
|
|
17
17
|
<div class="empty-notification"
|
|
18
18
|
tabindex="-1"
|
|
19
|
-
ng-show="notifications.length == 0">
|
|
19
|
+
ng-show="notifications && notifications.read.length == 0 && notifications.unread.length == 0">
|
|
20
20
|
<svg xmlns="http://www.w3.org/2000/svg"
|
|
21
21
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
22
22
|
version="1.1"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
<div style="max-height: 450px;overflow: auto;"
|
|
47
47
|
tabindex="-1"
|
|
48
|
-
ng-show="
|
|
48
|
+
ng-show="notifications && (notifications.read.length > 0 || notifications.unread.length > 0)">
|
|
49
49
|
<div class="row" tabindex="-1">
|
|
50
50
|
<div class="col-md-12"
|
|
51
51
|
tabindex="-1"
|
|
@@ -62,52 +62,49 @@
|
|
|
62
62
|
cursor: pointer;"></i>
|
|
63
63
|
</div>
|
|
64
64
|
</div>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
ng-repeat="group in notifications">
|
|
65
|
+
|
|
66
|
+
<div ng-show="notifications && notifications.unread.length > 0">
|
|
68
67
|
<div class="row"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
<div class="col-md-
|
|
72
|
-
<label tabindex="-1" class="mb-notification-label-category">
|
|
68
|
+
tabindex="-1"
|
|
69
|
+
style="cursor: auto;">
|
|
70
|
+
<div class="col-md-4" tabindex="-1">
|
|
71
|
+
<label tabindex="-1" class="mb-notification-label-category"> Novas </label>
|
|
73
72
|
</div>
|
|
74
|
-
<div
|
|
75
|
-
tabindex="-1"
|
|
76
|
-
class="col-md-5 justify-end">
|
|
73
|
+
<div tabindex="-1" class="col-md-8 justify-end">
|
|
77
74
|
<a class="link"
|
|
78
|
-
|
|
79
|
-
|
|
75
|
+
tabindex="-1"
|
|
76
|
+
ng-click="readAll()">Marcar todas como lidas</a>
|
|
80
77
|
</div>
|
|
81
78
|
</div>
|
|
82
79
|
<div class="notifition-item notification-bottom"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
tabindex="-1"
|
|
81
|
+
ng-repeat="notification in notifications.unread"
|
|
82
|
+
first="{{ $first }}"
|
|
83
|
+
last="{{ $last }}">
|
|
87
84
|
<div class="notifition-item"
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
tabindex="-1"
|
|
86
|
+
ng-click="handleClickNotification($event, notification); toogle()">
|
|
90
87
|
<div class="notification-icon" tabindex="-1">
|
|
91
88
|
<i ng-class="notification.icon"
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
tabindex="-1"
|
|
90
|
+
ng-show="notification.type !== 'IMPORTATION_PROGRESS'"></i>
|
|
94
91
|
<i ng-class="{[notification.icon] : notification.data.progress < 100, 'fas fa-check-circle': notification.data.progress == 100 && !notification.data.failed, 'fas fa-times-circle': notification.data.progress == 100 && notification.data.failed}"
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
tabindex="-1"
|
|
93
|
+
ng-show="notification.type === 'IMPORTATION_PROGRESS'"></i>
|
|
97
94
|
</div>
|
|
98
95
|
<div class="notification-metadata" tabindex="-1">
|
|
99
96
|
<label class="notification-title"
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
tabindex="-1"
|
|
98
|
+
ng-bind-html="trustAsHtml(notification.title)"></label>
|
|
102
99
|
<label class="notification-time" tabindex="-1">
|
|
103
100
|
{{ notification.time }}
|
|
104
101
|
</label>
|
|
105
102
|
<label class="notification-body"
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
tabindex="-1"
|
|
104
|
+
ng-bind-html="trustAsHtml(notification.body)"></label>
|
|
108
105
|
<div class="notification-actions"
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
tabindex="-1"
|
|
107
|
+
ng-show="notification.actions.length > 0">
|
|
111
108
|
<button ng-repeat="action in notification.actions"
|
|
112
109
|
tabindex="-1"
|
|
113
110
|
ng-class="action.style"
|
|
@@ -117,11 +114,11 @@
|
|
|
117
114
|
</button>
|
|
118
115
|
</div>
|
|
119
116
|
<div class="progress-wrapper"
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
tabindex="-1"
|
|
118
|
+
ng-if="notification.type === 'IMPORTATION_PROGRESS'">
|
|
122
119
|
<div class="mbg-progress-bar"
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
tabindex="-1"
|
|
121
|
+
style="--percentage: {{notification.data.progress}}%">
|
|
125
122
|
</div>
|
|
126
123
|
<label tabindex="-1" class="progress-label">{{notification.data.progress}}%</label>
|
|
127
124
|
</div>
|
|
@@ -130,22 +127,101 @@
|
|
|
130
127
|
</div>
|
|
131
128
|
</div>
|
|
132
129
|
</div>
|
|
133
|
-
<div
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
<div tabindex="-1" class="mark-read-notification">
|
|
131
|
+
<i class="fas fa-eye"
|
|
132
|
+
tabindex="-1"
|
|
133
|
+
ng-click="markRead(notification)"></i>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
<div class="row" tabindex="-1" ng-show="notifications.countUnread > notifications.unread.length">
|
|
137
|
+
<div class="col-md-12 see-more-wrapper" tabindex="-1">
|
|
138
|
+
<a class="button-see-more"
|
|
137
139
|
tabindex="-1"
|
|
138
|
-
ng-
|
|
140
|
+
ng-if="true"
|
|
141
|
+
ng-click="seeMoreUnread()">
|
|
142
|
+
Ver mais</a>
|
|
139
143
|
</div>
|
|
140
144
|
</div>
|
|
141
145
|
</div>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
|
|
147
|
+
<div ng-show="notifications && notifications.read.length > 0">
|
|
148
|
+
<div class="row"
|
|
149
|
+
tabindex="-1"
|
|
150
|
+
style="cursor: auto;">
|
|
151
|
+
<div class="col-md-6" tabindex="-1">
|
|
152
|
+
<label tabindex="-1" class="mb-notification-label-category"> Anteriores </label>
|
|
153
|
+
</div>
|
|
154
|
+
<div tabindex="-1" class="col-md-6 justify-end">
|
|
155
|
+
<a class="link"
|
|
156
|
+
tabindex="-1"
|
|
157
|
+
ng-click="deleteAllRead()">Limpar Anteriores</a>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
<div class="notifition-item notification-bottom"
|
|
161
|
+
tabindex="-1"
|
|
162
|
+
ng-repeat="notification in notifications.read"
|
|
163
|
+
first="{{ $first }}"
|
|
164
|
+
last="{{ $last }}">
|
|
165
|
+
<div class="notifition-item"
|
|
166
|
+
tabindex="-1"
|
|
167
|
+
ng-click="handleClickNotification($event, notification); toogle()">
|
|
168
|
+
<div class="notification-icon" tabindex="-1">
|
|
169
|
+
<i ng-class="notification.icon"
|
|
170
|
+
tabindex="-1"
|
|
171
|
+
ng-show="notification.type !== 'IMPORTATION_PROGRESS'"></i>
|
|
172
|
+
<i ng-class="{[notification.icon] : notification.data.progress < 100, 'fas fa-check-circle': notification.data.progress == 100 && !notification.data.failed, 'fas fa-times-circle': notification.data.progress == 100 && notification.data.failed}"
|
|
173
|
+
tabindex="-1"
|
|
174
|
+
ng-show="notification.type === 'IMPORTATION_PROGRESS'"></i>
|
|
175
|
+
</div>
|
|
176
|
+
<div class="notification-metadata" tabindex="-1">
|
|
177
|
+
<label class="notification-title"
|
|
178
|
+
tabindex="-1"
|
|
179
|
+
ng-bind-html="trustAsHtml(notification.title)"></label>
|
|
180
|
+
<label class="notification-time" tabindex="-1">
|
|
181
|
+
{{ notification.time }}
|
|
182
|
+
</label>
|
|
183
|
+
<label class="notification-body"
|
|
184
|
+
tabindex="-1"
|
|
185
|
+
ng-bind-html="trustAsHtml(notification.body)"></label>
|
|
186
|
+
<div class="notification-actions"
|
|
187
|
+
tabindex="-1"
|
|
188
|
+
ng-show="notification.actions.length > 0">
|
|
189
|
+
<button ng-repeat="action in notification.actions"
|
|
190
|
+
tabindex="-1"
|
|
191
|
+
ng-class="action.style"
|
|
192
|
+
ng-click="handleClickNotification($event, notification, action)">
|
|
193
|
+
{{ action.label }}
|
|
194
|
+
</span>
|
|
195
|
+
</button>
|
|
196
|
+
</div>
|
|
197
|
+
<div class="progress-wrapper"
|
|
198
|
+
tabindex="-1"
|
|
199
|
+
ng-if="notification.type === 'IMPORTATION_PROGRESS'">
|
|
200
|
+
<div class="mbg-progress-bar"
|
|
201
|
+
tabindex="-1"
|
|
202
|
+
style="--percentage: {{notification.data.progress}}%">
|
|
203
|
+
</div>
|
|
204
|
+
<label tabindex="-1" class="progress-label">{{notification.data.progress}}%</label>
|
|
205
|
+
</div>
|
|
206
|
+
<div class="info-import" tabindex="-1">
|
|
207
|
+
<span ng-show="notification.data.total" tabindex="-1">{{notification.data.current}}/{{notification.data.total}}</span>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
<div tabindex="-1" class="remove-notification">
|
|
212
|
+
<i class="fas fa-times"
|
|
213
|
+
tabindex="-1"
|
|
214
|
+
ng-click="removeNotification(notification)"></i>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
<div class="row" tabindex="-1" ng-show="notifications.countRead > notifications.read.length">
|
|
218
|
+
<div class="col-md-12 see-more-wrapper" tabindex="-1">
|
|
219
|
+
<a class="button-see-more"
|
|
220
|
+
tabindex="-1"
|
|
221
|
+
ng-if="true"
|
|
222
|
+
ng-click="seeMoreRead()">
|
|
223
|
+
Ver mais</a>
|
|
224
|
+
</div>
|
|
149
225
|
</div>
|
|
150
226
|
</div>
|
|
151
227
|
</div>
|
|
@@ -1,24 +1,46 @@
|
|
|
1
1
|
const service = function () {
|
|
2
|
-
this.notifications =
|
|
2
|
+
this.notifications = null
|
|
3
3
|
this.observers = []
|
|
4
|
-
this.
|
|
4
|
+
this.seeMoreRead = null
|
|
5
|
+
this.seeMoreUnread = null
|
|
5
6
|
this.openSetting = null
|
|
7
|
+
this.getNotifications = null
|
|
8
|
+
this.removeNotification = null
|
|
9
|
+
this.markRead = null
|
|
10
|
+
this.deleteAllRead = null
|
|
11
|
+
this.readAll = null
|
|
6
12
|
this.total = 0
|
|
7
13
|
|
|
8
|
-
|
|
9
14
|
this.onNotificationChange = (callback) => {
|
|
10
15
|
this.observers.push(callback)
|
|
11
16
|
}
|
|
12
17
|
|
|
13
18
|
this.setNotifications = (_notifications) => {
|
|
14
|
-
this.notifications = _notifications
|
|
19
|
+
this.notifications = _notifications
|
|
20
|
+
this.observers.forEach((observer) => {
|
|
21
|
+
observer(this.notifications)
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
this.addToNotificationsRead = (_notifications) => {
|
|
26
|
+
this.notifications.read = (_notifications.pageRead == 0)
|
|
27
|
+
? _notifications.read
|
|
28
|
+
: this.notifications.read.concat(_notifications.read)
|
|
29
|
+
this.notifications.countRead = _notifications.countRead
|
|
30
|
+
this.notifications.pageSizeRead = _notifications.pageSizeRead
|
|
31
|
+
this.notifications.pageRead = _notifications.pageRead
|
|
15
32
|
this.observers.forEach((observer) => {
|
|
16
33
|
observer(this.notifications)
|
|
17
34
|
})
|
|
18
35
|
}
|
|
19
36
|
|
|
20
|
-
this.
|
|
21
|
-
|
|
37
|
+
this.addToNotificationsUnread = (_notifications) => {
|
|
38
|
+
this.notifications.unread = (_notifications.pageUnread == 0)
|
|
39
|
+
? _notifications.unread
|
|
40
|
+
: this.notifications.unread.concat(_notifications.unread)
|
|
41
|
+
this.notifications.countUnread = _notifications.countUnread
|
|
42
|
+
this.notifications.pageSizeUnread = _notifications.pageSizeUnread
|
|
43
|
+
this.notifications.pageUnread = _notifications.pageUnread
|
|
22
44
|
this.observers.forEach((observer) => {
|
|
23
45
|
observer(this.notifications)
|
|
24
46
|
})
|
|
@@ -26,15 +48,42 @@ const service = function () {
|
|
|
26
48
|
|
|
27
49
|
this.setTotal = (total = 0) => {
|
|
28
50
|
this.total = total
|
|
51
|
+
this.observers.forEach((observer) => {
|
|
52
|
+
observer(this.notifications)
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
this.setGetNotifications = (funct) => {
|
|
57
|
+
this.getNotifications = funct
|
|
29
58
|
}
|
|
30
59
|
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
60
|
+
this.setSeeMoreRead = (funct) => {
|
|
61
|
+
this.seeMoreRead = funct
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
this.setSeeMoreUnread = (funct) => {
|
|
65
|
+
this.seeMoreUnread = funct
|
|
33
66
|
}
|
|
34
67
|
|
|
35
68
|
this.setOpenSetting = (funct) => {
|
|
36
69
|
this.openSetting = funct
|
|
37
70
|
}
|
|
71
|
+
|
|
72
|
+
this.setRemoveNotification = (funct) => {
|
|
73
|
+
this.removeNotification = funct
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.setMarkRead = (funct) => {
|
|
77
|
+
this.markRead = funct
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
this.setDeleteAllRead = (funct) => {
|
|
81
|
+
this.deleteAllRead = funct
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
this.setReadAll = (funct) => {
|
|
85
|
+
this.readAll = funct
|
|
86
|
+
}
|
|
38
87
|
}
|
|
39
88
|
|
|
40
89
|
export default service;
|