@posiwise/dashboard-module 0.0.84 → 0.0.86

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.
Files changed (89) hide show
  1. package/.eslintrc.json +21 -0
  2. package/ng-package.json +15 -0
  3. package/package.json +10 -23
  4. package/project.json +72 -0
  5. package/{index.d.ts → src/index.ts} +1 -0
  6. package/src/lib/customizer/customizer.component.html +184 -0
  7. package/src/lib/customizer/customizer.component.scss +101 -0
  8. package/src/lib/customizer/customizer.component.ts +13 -0
  9. package/src/lib/dashboard.module.ts +63 -0
  10. package/src/lib/faq/faq.component.html +110 -0
  11. package/src/lib/faq/faq.component.scss +58 -0
  12. package/src/lib/faq/faq.component.spec.ts +143 -0
  13. package/src/lib/faq/faq.component.ts +144 -0
  14. package/src/lib/faq-details/faq-details.component.html +21 -0
  15. package/src/lib/faq-details/faq-details.component.scss +3 -0
  16. package/src/lib/faq-details/faq-details.component.spec.ts +69 -0
  17. package/src/lib/faq-details/faq-details.component.ts +38 -0
  18. package/src/lib/footer/footer.component.html +14 -0
  19. package/src/lib/footer/footer.component.spec.ts +42 -0
  20. package/src/lib/footer/footer.component.ts +24 -0
  21. package/src/lib/home/home.component.html +93 -0
  22. package/src/lib/home/home.component.scss +0 -0
  23. package/src/lib/home/home.component.spec.ts +69 -0
  24. package/src/lib/home/home.component.ts +88 -0
  25. package/src/lib/navbar/navbar.component.html +189 -0
  26. package/src/lib/navbar/navbar.component.scss +92 -0
  27. package/src/lib/navbar/navbar.component.spec.ts +76 -0
  28. package/src/lib/navbar/navbar.component.ts +198 -0
  29. package/src/lib/notifications-page/current-notifications/current-notifications.component.html +61 -0
  30. package/src/lib/notifications-page/current-notifications/current-notifications.component.spec.ts +57 -0
  31. package/src/lib/notifications-page/current-notifications/current-notifications.component.ts +63 -0
  32. package/src/lib/notifications-page/dismissed-notifications/dismissed-notifications.component.html +65 -0
  33. package/src/lib/notifications-page/dismissed-notifications/dismissed-notifications.component.spec.ts +71 -0
  34. package/src/lib/notifications-page/dismissed-notifications/dismissed-notifications.component.ts +79 -0
  35. package/src/lib/notifications-page/notifications-page.component.html +24 -0
  36. package/src/lib/notifications-page/notifications-page.component.scss +28 -0
  37. package/src/lib/notifications-page/notifications-page.component.spec.ts +26 -0
  38. package/src/lib/notifications-page/notifications-page.component.ts +8 -0
  39. package/src/lib/search/search.component.html +215 -0
  40. package/src/lib/search/search.component.scss +98 -0
  41. package/src/lib/search/search.component.spec.ts +64 -0
  42. package/src/lib/search/search.component.ts +50 -0
  43. package/src/lib/sidebar/sidebar-routes.config.ts +355 -0
  44. package/{lib/sidebar/sidebar.metadata.d.ts → src/lib/sidebar/sidebar.metadata.ts} +1 -0
  45. package/src/lib/user-feedback/user-feedback.component.html +53 -0
  46. package/src/lib/user-feedback/user-feedback.component.scss +18 -0
  47. package/src/lib/user-feedback/user-feedback.component.spec.ts +54 -0
  48. package/src/lib/user-feedback/user-feedback.component.ts +83 -0
  49. package/src/lib/user-notifications/user-notifications.component.html +21 -0
  50. package/src/lib/user-notifications/user-notifications.component.scss +21 -0
  51. package/src/lib/user-notifications/user-notifications.component.spec.ts +47 -0
  52. package/src/lib/user-notifications/user-notifications.component.ts +74 -0
  53. package/tsconfig.json +30 -0
  54. package/tsconfig.lib.json +19 -0
  55. package/tsconfig.lib.prod.json +9 -0
  56. package/tsconfig.spec.json +11 -0
  57. package/esm2022/index.mjs +0 -16
  58. package/esm2022/lib/customizer/customizer.component.mjs +0 -17
  59. package/esm2022/lib/dashboard.module.mjs +0 -101
  60. package/esm2022/lib/faq/faq.component.mjs +0 -108
  61. package/esm2022/lib/faq-details/faq-details.component.mjs +0 -38
  62. package/esm2022/lib/footer/footer.component.mjs +0 -22
  63. package/esm2022/lib/home/home.component.mjs +0 -79
  64. package/esm2022/lib/navbar/navbar.component.mjs +0 -162
  65. package/esm2022/lib/notifications-page/current-notifications/current-notifications.component.mjs +0 -58
  66. package/esm2022/lib/notifications-page/dismissed-notifications/dismissed-notifications.component.mjs +0 -73
  67. package/esm2022/lib/notifications-page/notifications-page.component.mjs +0 -14
  68. package/esm2022/lib/search/search.component.mjs +0 -47
  69. package/esm2022/lib/sidebar/sidebar-routes.config.mjs +0 -338
  70. package/esm2022/lib/sidebar/sidebar.metadata.mjs +0 -2
  71. package/esm2022/lib/user-feedback/user-feedback.component.mjs +0 -73
  72. package/esm2022/lib/user-notifications/user-notifications.component.mjs +0 -65
  73. package/esm2022/posiwise-dashboard-module.mjs +0 -5
  74. package/fesm2022/posiwise-dashboard-module.mjs +0 -1106
  75. package/fesm2022/posiwise-dashboard-module.mjs.map +0 -1
  76. package/lib/customizer/customizer.component.d.ts +0 -7
  77. package/lib/dashboard.module.d.ts +0 -28
  78. package/lib/faq/faq.component.d.ts +0 -37
  79. package/lib/faq-details/faq-details.component.d.ts +0 -16
  80. package/lib/footer/footer.component.d.ts +0 -12
  81. package/lib/home/home.component.d.ts +0 -18
  82. package/lib/navbar/navbar.component.d.ts +0 -35
  83. package/lib/notifications-page/current-notifications/current-notifications.component.d.ts +0 -17
  84. package/lib/notifications-page/dismissed-notifications/dismissed-notifications.component.d.ts +0 -18
  85. package/lib/notifications-page/notifications-page.component.d.ts +0 -5
  86. package/lib/search/search.component.d.ts +0 -24
  87. package/lib/sidebar/sidebar-routes.config.d.ts +0 -64
  88. package/lib/user-feedback/user-feedback.component.d.ts +0 -24
  89. package/lib/user-notifications/user-notifications.component.d.ts +0 -20
@@ -0,0 +1,355 @@
1
+ import { RouteInfo } from './sidebar.metadata';
2
+
3
+ // Sidebar menu Routes and data
4
+ export const ROUTES: RouteInfo[] = [
5
+ // Dashboard Home
6
+ {
7
+ permission: 'Pages.Dashboard',
8
+ path: '/home',
9
+ title: 'Home',
10
+ icon: 'ft-home',
11
+ class: '',
12
+ badge: '',
13
+ badgeClass: '',
14
+ isExternalLink: false,
15
+ submenu: [],
16
+ visible: true,
17
+ order: 1
18
+ },
19
+ // Menus for Admin page
20
+ {
21
+ permission: 'Pages.Admin',
22
+ path: null,
23
+ title: 'Admin',
24
+ icon: 'ft-user',
25
+ class: 'has-sub',
26
+ badge: '',
27
+ badgeClass: '',
28
+ isExternalLink: false,
29
+ visible: true,
30
+ order: 3,
31
+ submenu: [
32
+ {
33
+ permission: 'Pages.Admin',
34
+ path: '/admin/generic',
35
+ title: 'Generic',
36
+ icon: 'far fa-book',
37
+ class: '',
38
+ badge: '',
39
+ badgeClass: '',
40
+ isExternalLink: false,
41
+ submenu: [],
42
+ visible: true
43
+ },
44
+ {
45
+ permission: 'Pages.Admin.DomainConfig',
46
+ path: '/admin/domain-config/list',
47
+ title: 'Domain Config',
48
+ icon: 'fa fa-fw fa-cog',
49
+ class: '',
50
+ badge: '',
51
+ badgeClass: '',
52
+ isExternalLink: false,
53
+ submenu: [],
54
+ visible: true
55
+ },
56
+ {
57
+ permission: 'Pages.Admin.Users',
58
+ path: '/admin/users',
59
+ title: 'Users',
60
+ icon: 'far fa-user-cog',
61
+ class: '',
62
+ badge: '',
63
+ badgeClass: '',
64
+ isExternalLink: false,
65
+ submenu: [],
66
+ visible: true
67
+ },
68
+ {
69
+ permission: 'Pages.Admin.Subscription',
70
+ path: '/admin/subscriptions',
71
+ title: 'Subscriptions',
72
+ icon: 'ft-box',
73
+ class: '',
74
+ badge: '',
75
+ badgeClass: '',
76
+ isExternalLink: false,
77
+ submenu: [],
78
+ visible: true
79
+ },
80
+ {
81
+ permission: 'Pages.Admin.Product',
82
+ path: '/admin/products',
83
+ title: 'Products',
84
+ icon: 'far fa-parking',
85
+ class: '',
86
+ badge: '',
87
+ badgeClass: '',
88
+ isExternalLink: false,
89
+ submenu: [],
90
+ visible: true
91
+ },
92
+ {
93
+ permission: 'Pages.Admin.LoginNotification',
94
+ path: '/admin/login-notifications/list',
95
+ title: 'Notifications',
96
+ icon: 'fa fa-fw fa-bell',
97
+ class: '',
98
+ badge: '',
99
+ badgeClass: '',
100
+ isExternalLink: false,
101
+ submenu: [],
102
+ visible: true
103
+ },
104
+ {
105
+ permission: 'Pages.Admin.Newsletter',
106
+ path: '/admin/newsletter',
107
+ title: 'Newsletters',
108
+ icon: 'far fa-newspaper',
109
+ class: '',
110
+ badge: '',
111
+ badgeClass: '',
112
+ isExternalLink: false,
113
+ submenu: [],
114
+ visible: true
115
+ },
116
+ {
117
+ permission: 'Pages.Admin.FAQ',
118
+ path: '/admin/faq/list',
119
+ title: 'FAQs',
120
+ icon: 'fa fa-question',
121
+ class: '',
122
+ badge: '',
123
+ badgeClass: '',
124
+ isExternalLink: false,
125
+ submenu: [],
126
+ visible: true
127
+ },
128
+ {
129
+ permission: 'Pages.Admin.Incident',
130
+ path: '/admin/incident/list',
131
+ title: 'Incidents',
132
+ icon: 'fa fa-solid fa-triangle-exclamation',
133
+ class: '',
134
+ badge: '',
135
+ badgeClass: '',
136
+ isExternalLink: false,
137
+ submenu: [],
138
+ visible: true
139
+ },
140
+ {
141
+ permission: 'Pages.Admin.ContactUs',
142
+ path: '/admin/contact-us/list',
143
+ title: 'Contact Us',
144
+ icon: 'fa fa-address-book',
145
+ class: '',
146
+ badge: '',
147
+ badgeClass: '',
148
+ isExternalLink: false,
149
+ submenu: [],
150
+ visible: true
151
+ },
152
+ {
153
+ permission: 'Pages.Admin.Tips',
154
+ path: '/admin/tips/list',
155
+ title: 'Tips',
156
+ icon: 'far fa-lightbulb',
157
+ class: '',
158
+ badge: '',
159
+ badgeClass: '',
160
+ isExternalLink: false,
161
+ submenu: [],
162
+ visible: true
163
+ },
164
+ {
165
+ permission: 'Pages.Admin.Tags',
166
+ path: '/admin/tags',
167
+ title: 'Tags',
168
+ icon: 'far fa-tags',
169
+ class: '',
170
+ badge: '',
171
+ badgeClass: '',
172
+ isExternalLink: false,
173
+ submenu: [],
174
+ visible: true
175
+ },
176
+ {
177
+ permission: 'Pages.Admin.Roles',
178
+ path: '/admin/permissions',
179
+ title: 'Permissions',
180
+ icon: 'fas fa-key',
181
+ class: '',
182
+ badge: '',
183
+ badgeClass: '',
184
+ isExternalLink: false,
185
+ submenu: [],
186
+ visible: true
187
+ },
188
+ {
189
+ permission: 'Pages.Admin.Tos',
190
+ path: '/admin/tos/list',
191
+ title: 'Privacy & TOS',
192
+ icon: 'fas fa-sticky-note',
193
+ class: '',
194
+ badge: '',
195
+ badgeClass: '',
196
+ isExternalLink: false,
197
+ submenu: [],
198
+ visible: true
199
+ },
200
+ {
201
+ permission: 'Pages.Admin.Credential',
202
+ path: '/admin/credentials',
203
+ title: 'Credentials',
204
+ icon: 'fas fa-file-signature',
205
+ class: '',
206
+ badge: '',
207
+ badgeClass: '',
208
+ isExternalLink: false,
209
+ submenu: [],
210
+ visible: true
211
+ },
212
+ {
213
+ permission: 'Pages.Admin.Tracking',
214
+ path: '/admin/tracking',
215
+ title: 'Tracking',
216
+ icon: 'fa fa-map-marker',
217
+ class: '',
218
+ badge: '',
219
+ badgeClass: '',
220
+ isExternalLink: false,
221
+ submenu: [],
222
+ visible: true
223
+ },
224
+ {
225
+ permission: 'Pages.Admin.Global-Config',
226
+ path: '/admin/global-config',
227
+ title: 'Global Configs',
228
+ icon: 'fa fa-fw fa-cog',
229
+ class: '',
230
+ badge: '',
231
+ badgeClass: '',
232
+ isExternalLink: false,
233
+ submenu: [],
234
+ visible: true
235
+ }
236
+ ]
237
+ }
238
+ ];
239
+
240
+ // THE FOLLOWING GOES INTO THE BOTTOM OF THE SIDEBAR
241
+ export const FAQ_Menu = {
242
+ permission: 'Pages.Product.{permission_key}.{feature_key}.FAQ',
243
+ path: '/faq',
244
+ title: 'FAQ',
245
+ icon: 'ft-info',
246
+ class: '',
247
+ badge: '',
248
+ badgeClass: '',
249
+ isExternalLink: false,
250
+ submenu: [],
251
+ visible: true,
252
+ order: 999
253
+ };
254
+
255
+ export const ENTERPRISE_MENU = {
256
+ permission: 'Pages.Product.{permission_key}.{feature_key}.Enterprise',
257
+ path: '/enterprise',
258
+ title: 'Enterprise',
259
+ icon: 'ft-package',
260
+ class: 'has-sub',
261
+ badge: '',
262
+ badgeClass: 'badge rounded-pill bg-danger float-end mt-1',
263
+ isExternalLink: false,
264
+ order: 4,
265
+ submenu: [
266
+ {
267
+ permission: '',
268
+ path: ':slug/enterprise/members',
269
+ title: 'Members',
270
+ icon: 'far fa-users',
271
+ class: '',
272
+ badge: '',
273
+ badgeClass: '',
274
+ isExternalLink: false,
275
+ submenu: [],
276
+ visible: true
277
+ },
278
+ {
279
+ permission: 'Pages.Beta',
280
+ path: ':slug/enterprise/groups',
281
+ title: 'Teams',
282
+ icon: 'far fa-users-class',
283
+ class: '',
284
+ badge: '',
285
+ badgeClass: '',
286
+ isExternalLink: false,
287
+ submenu: [],
288
+ visible: true
289
+ },
290
+ {
291
+ permission: 'Pages.Beta',
292
+ path: ':slug/enterprise/communications',
293
+ title: 'Communications',
294
+ icon: 'fas fa-comments',
295
+ class: '',
296
+ badge: '',
297
+ badgeClass: '',
298
+ isExternalLink: false,
299
+ submenu: [],
300
+ visible: true
301
+ },
302
+ {
303
+ permission: 'Pages.Beta',
304
+ path: ':slug/enterprise/wiki',
305
+ title: 'Documentation',
306
+ icon: 'fab fa-wikipedia-w',
307
+ class: '',
308
+ badge: '',
309
+ badgeClass: '',
310
+ isExternalLink: false,
311
+ submenu: [],
312
+ visible: true
313
+ },
314
+ {
315
+ permission: 'Pages.Beta',
316
+ path: ':slug/enterprise/insights',
317
+ title: 'Insights',
318
+ icon: 'far fa-tag',
319
+ class: '',
320
+ badge: '',
321
+ badgeClass: '',
322
+ isExternalLink: false,
323
+ submenu: [],
324
+ visible: true
325
+ }
326
+ ],
327
+ visible: true
328
+ };
329
+
330
+ export const CHAT_MENU = {
331
+ permission: 'Pages.Product.{permission_key}.{feature_key}.Chat',
332
+ path: '/message',
333
+ title: 'Chat',
334
+ icon: 'ft-message-square',
335
+ class: '',
336
+ badge: '',
337
+ badgeClass: 'badge rounded-pill bg-danger float-end mt-1',
338
+ isExternalLink: false,
339
+ submenu: [],
340
+ order: 2,
341
+ visible: true
342
+ };
343
+
344
+ export const BLOG_MENU = {
345
+ permission: 'Pages.Product.{permission_key}.{feature_key}.Blog',
346
+ path: '/posts/list',
347
+ title: 'Blog',
348
+ icon: 'far fa-blog',
349
+ class: '',
350
+ badge: '',
351
+ badgeClass: '',
352
+ isExternalLink: false,
353
+ submenu: [],
354
+ visible: true
355
+ };
@@ -1,3 +1,4 @@
1
+ // Sidebar route metadata
1
2
  export interface RouteInfo {
2
3
  permission: string;
3
4
  path: string;
@@ -0,0 +1,53 @@
1
+ <ng-container *ngIf="showSection">
2
+ <div class="mt-4"
3
+ *ngIf="questions?.length">
4
+ <div class="card pb-1">
5
+ <h3 class="text-end me-3 pt-2 cursor-pointer"
6
+ (click)="closeSection()">&times;</h3>
7
+ <div class="card-content p-0"
8
+ *ngFor="let question of questions; let first = first; trackBy: trackByQuestion">
9
+ <div class="card-header">
10
+ <form #feedbackForm="ngForm">
11
+ <div class="col-lg-8 p-0 mx-auto">
12
+ <h3 class="mb-1"
13
+ *ngIf="first">Your input is valuable to us</h3>
14
+ <p class="mb-4"
15
+ *ngIf="first">
16
+ Please take a moment to answer these questions
17
+ </p>
18
+ <h6 class="fw-bold pb-3 mx-auto">{{ question?.question }}</h6>
19
+ <div class="text-center row p-2 mx-md-2 feedback-value">
20
+ <span class="col-auto me-0">Not at all</span>
21
+ <div *ngFor="let val of counter(11); let i = index" class="p-field-checkbox col-auto ms-0 me-0">
22
+ <p-radioButton name="feedback" [(ngModel)]="selectedValue" [value]="i" [inputId]="i"></p-radioButton>
23
+ <br />
24
+ <label [for]="i">{{ i }}</label>
25
+ </div>
26
+ <span class="col-auto ms-0">Extremely</span>
27
+ </div>
28
+
29
+ <div class="text mt-3">
30
+ <h6>Can you tell us the reason for your score? Do you have any particular features you want us to build or fix?</h6>
31
+ <textarea rows="4"
32
+ name="description"
33
+ placeholder="“What is the primary reason for your score?”"
34
+ ngModel
35
+ type="text"
36
+ pInputTextarea
37
+ class="form-control">
38
+ </textarea>
39
+ </div>
40
+ <div class="mt-3">
41
+ <button class="btn btn-primary d-block mx-auto"
42
+ (click)="onSubmit(question?.id, feedbackForm.value)">
43
+ Submit
44
+ </button>
45
+ </div>
46
+ </div>
47
+ </form>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+
53
+ </ng-container>
@@ -0,0 +1,18 @@
1
+ .feedback-value {
2
+ justify-content: center;
3
+
4
+ label {
5
+ color: rgb(0 0 0 / 87%);
6
+ cursor: pointer;
7
+ font-size: 1rem;
8
+ font-weight: normal;
9
+ letter-spacing: normal;
10
+ margin-left: 10px;
11
+ margin-right: 10px;
12
+ text-transform: none;
13
+ }
14
+
15
+ .p-field-checkbox {
16
+ margin: 0 10px;
17
+ }
18
+ }
@@ -0,0 +1,54 @@
1
+ import {
2
+ CommonService,
3
+ CommonServicesModule,
4
+ PermissionService,
5
+ UserService
6
+ } from '@posiwise/common-services';
7
+ import { SharedModule } from '@posiwise/shared-module';
8
+ import { DashboardLibModule } from '../dashboard.module';
9
+ import { TestBed } from '@angular/core/testing';
10
+ import { byText } from '@ngneat/spectator';
11
+ import { DEFAULT_USER, TestHelper } from '@posiwise/test-helpers';
12
+ import { MockProvider } from 'ng-mocks';
13
+ import { of, EMPTY } from 'rxjs';
14
+ import { UserFeedbackComponent } from './user-feedback.component';
15
+
16
+ describe('UserFeedbackComponent', () => {
17
+ const createComponent = TestHelper.createComponentFactory({
18
+ component: UserFeedbackComponent,
19
+ imports: [SharedModule, CommonServicesModule, DashboardLibModule],
20
+ providers: [
21
+ ...TestHelper.TEST_PROVIDERS,
22
+ MockProvider(CommonService, {
23
+ feedbackQuestions: () => of([{ id: 7, question: 'test question', product_id: 16 }]),
24
+ userFeedbacks: () => of({})
25
+ }),
26
+ MockProvider(UserService, {
27
+ getUserInfo: () => EMPTY
28
+ })
29
+ ]
30
+ });
31
+
32
+ beforeEach(() => {
33
+ TestHelper.setUpPermissionsAndUser();
34
+ PermissionService.selectedSubscription = DEFAULT_USER.subscriptions[0];
35
+ });
36
+
37
+ it('should create', async () => {
38
+ const spectator = await createComponent();
39
+ expect(spectator.component).toBeTruthy();
40
+ });
41
+
42
+ it('should add User Feedback', async () => {
43
+ const spectator = await createComponent();
44
+ expect(spectator.component).toBeTruthy();
45
+ const service = TestBed.inject(CommonService);
46
+ const spy = spyOn(service, 'userFeedbacks').and.callThrough();
47
+ const el = spectator.query(
48
+ byText('5', { selector: '.card-content:first-of-type form label' })
49
+ );
50
+ spectator.click(el);
51
+ spectator.click(spectator.query(byText('Submit')));
52
+ expect(spy).toHaveBeenCalledTimes(1);
53
+ });
54
+ });
@@ -0,0 +1,83 @@
1
+ import { Component, Injector, OnInit } from '@angular/core';
2
+
3
+ import { AppBaseComponent } from '@posiwise/app-base-component';
4
+ import { User } from '@posiwise/common-utilities';
5
+ import { CommonService, PermissionService } from '@posiwise/common-services';
6
+ import moment from 'moment';
7
+
8
+ @Component({
9
+ selector: 'pw-user-feedback',
10
+ templateUrl: './user-feedback.component.html',
11
+ styleUrls: ['./user-feedback.component.scss']
12
+ })
13
+ export class UserFeedbackComponent extends AppBaseComponent implements OnInit {
14
+ rating = 3;
15
+
16
+ selectedValue: number | null = null;
17
+
18
+ questions = [];
19
+
20
+ counter = Array;
21
+
22
+ subscriptionId: number;
23
+
24
+ user: User;
25
+
26
+ showSection = true;
27
+
28
+ constructor(injector: Injector, private commonService: CommonService) {
29
+ super(injector);
30
+ }
31
+
32
+ ngOnInit(): void {
33
+ this.subscriptionId = PermissionService.selectedSubscription?.id;
34
+ this.getFeedbackQuestions();
35
+ this.userService.getUserInfo().subscribe({
36
+ next: user => {
37
+ this.user = user;
38
+ }
39
+ });
40
+ this.checkFeedBackExpiry();
41
+ }
42
+
43
+ checkFeedBackExpiry() {
44
+ const item = localStorage.getItem('showFeedBack');
45
+ if (item) {
46
+ const currentDate = new Date().getTime();
47
+ const expiryDate = new Date(JSON.parse(item)).getTime();
48
+ this.showSection = currentDate > expiryDate;
49
+ }
50
+ }
51
+
52
+ closeSection() {
53
+ this.showSection = false;
54
+ const addedTime = moment(new Date()).add(7, 'days').toDate();
55
+ localStorage.setItem('showFeedBack', JSON.stringify(addedTime));
56
+ }
57
+
58
+ private getFeedbackQuestions() {
59
+ if (this.subscriptionId) {
60
+ this.commonService.feedbackQuestions(this.subscriptionId).subscribe(res => {
61
+ this.questions = res;
62
+ });
63
+ }
64
+ }
65
+
66
+ onSubmit(questionId: number, formValue) {
67
+ if (formValue?.feedback) {
68
+ const data = {
69
+ subscription_id: this.subscriptionId,
70
+ feedback_question_id: questionId,
71
+ value: Number(formValue?.feedback),
72
+ comment: formValue?.description
73
+ };
74
+ this.commonService.userFeedbacks(data).subscribe(() => {
75
+ this.getFeedbackQuestions();
76
+ });
77
+ }
78
+ }
79
+
80
+ trackByQuestion(_index: number, item: any) {
81
+ return item.id;
82
+ }
83
+ }
@@ -0,0 +1,21 @@
1
+ <div class="row mt-4 mb-0 notification-wrapper"
2
+ id="user-message">
3
+ <ng-container *ngFor="let noti of notifications">
4
+ <div class="col-12 col-sm-12 col-md-12 mb-2"
5
+ *ngIf="isHomePage || noti?.can_disregard">
6
+ <div class="card pb-0">
7
+ <div class="alert border-0 card-body d-flex align-items-center justify-content-between px-3 mb-0"
8
+ [ngClass]="noti.type ? 'alert-' + noti.type : 'alert-panel'">
9
+ <p class="mb-0"
10
+ [innerHtml]="noti.message | safe: 'html'"
11
+ appAnchorRouter></p>
12
+ <a class="icon-dismiss float-end text-white"
13
+ *ngIf="noti?.can_disregard"
14
+ (click)="hideNoty(noti?.notification_id)">
15
+ <i class="ft-x" aria-hidden="true"></i>
16
+ </a>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </ng-container>
21
+ </div>
@@ -0,0 +1,21 @@
1
+ @import 'variables/branding-variables';
2
+
3
+ .alert-panel {
4
+ background-color: rgb(255 255 255) !important;
5
+ border-color: rgb(221 221 221) !important;
6
+ border-radius: 8px;
7
+ box-shadow: 3px 3px 40px 0 rgb(210 210 210);
8
+ color: rgb(2 26 17) !important;
9
+ }
10
+
11
+ .alert-info {
12
+ background-color: $tabs-bg !important;
13
+ }
14
+
15
+ p {
16
+ color: rgb(255, 255, 255);
17
+ }
18
+
19
+ .notification-wrapper:empty {
20
+ display: none;
21
+ }
@@ -0,0 +1,47 @@
1
+ // import { MockProvider } from 'ng-mocks';
2
+ // import { of } from 'rxjs';
3
+ //
4
+ // import { AppModule } from '@app/app.module';
5
+ // import { UserNotificationsComponent } from '@app/modules/dashboard/user-notifications/user-notifications.component';
6
+ // import { PermissionService } from '@posiwise/common-services';
7
+ // import { UserService } from '@app/shared/services/user.service';
8
+ //
9
+ // import { DEFAULT_USER } from '@testing/data/database';
10
+ // import { TestHelper } from '@testing/test-helper';
11
+ //
12
+ // class UserServiceMock {
13
+ // getUserState() {
14
+ // return of({ currentUser: DEFAULT_USER });
15
+ // }
16
+ //
17
+ // getUserNotifications() {
18
+ // return of([]);
19
+ // }
20
+ // }
21
+ // describe('UserNotificationsComponent', () => {
22
+ // const createComponent = TestHelper.createComponentFactory({
23
+ // component: UserNotificationsComponent,
24
+ // imports: [AppModule],
25
+ // providers: [
26
+ // ...TestHelper.TEST_PROVIDERS,
27
+ // MockProvider(PermissionService, {
28
+ // evaluatePermissions: () => {
29
+ // return true;
30
+ // }
31
+ // }),
32
+ // {
33
+ // provide: UserService,
34
+ // useClass: UserServiceMock
35
+ // }
36
+ // ]
37
+ // });
38
+ //
39
+ // beforeEach(() => {
40
+ // TestHelper.setUpPermissionsAndUser();
41
+ // });
42
+ //
43
+ // it('should create', async () => {
44
+ // const spectator = await createComponent();
45
+ // expect(spectator.component).toBeTruthy();
46
+ // });
47
+ // });